]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
added signals errorMessage(const QString&) and infoMessage(const QString&) for the...
[dolphin.git] / src / dolphinview.cpp
index 8d3bf1e2f7fa783732193e358da201d4bc24645a..ae56c6ea25893701879f639b8dcf3c7a1ac2221d 100644 (file)
@@ -58,8 +58,7 @@ DolphinView::DolphinView(QWidget* parent,
                          KDirLister* dirLister,
                          KDirModel* dirModel,
                          DolphinSortFilterProxyModel* proxyModel,
-                         Mode mode,
-                         bool showHiddenFiles) :
+                         Mode mode) :
     QWidget(parent),
     m_active(true),
     m_blockContentsMovedSignal(false),
@@ -267,78 +266,6 @@ bool DolphinView::supportsCategorizedSorting() const
     return m_iconsView != 0;
 }
 
-void DolphinView::renameSelectedItems()
-{
-    // TODO: temporary deactivate due to DolphinView/DolphinViewController split
-
-    /*DolphinView* view = 0; //mainWindow()->activeView();
-    const KUrl::List urls = selectedUrls();
-    if (urls.count() > 1) {
-        // More than one item has been selected for renaming. Open
-        // a rename dialog and rename all items afterwards.
-        RenameDialog dialog(urls);
-        if (dialog.exec() == QDialog::Rejected) {
-            return;
-        }
-
-        const QString& newName = dialog.newName();
-        if (newName.isEmpty()) {
-            view->statusBar()->setMessage(dialog.errorString(),
-                                          DolphinStatusBar::Error);
-        } else {
-            // TODO: check how this can be integrated into KonqUndoManager/KonqOperations
-            // as one operation instead of n rename operations like it is done now...
-            Q_ASSERT(newName.contains('#'));
-
-            // iterate through all selected items and rename them...
-            const int replaceIndex = newName.indexOf('#');
-            Q_ASSERT(replaceIndex >= 0);
-            int index = 1;
-
-            KUrl::List::const_iterator it = urls.begin();
-            KUrl::List::const_iterator end = urls.end();
-            while (it != end) {
-                const KUrl& oldUrl = *it;
-                QString number;
-                number.setNum(index++);
-
-                QString name(newName);
-                name.replace(replaceIndex, 1, number);
-
-                if (oldUrl.fileName() != name) {
-                    KUrl newUrl = oldUrl;
-                    newUrl.setFileName(name);
-                    m_mainWindow->rename(oldUrl, newUrl);
-                }
-                ++it;
-            }
-        }
-    } else {
-        // Only one item has been selected for renaming. Use the custom
-        // renaming mechanism from the views.
-        Q_ASSERT(urls.count() == 1);
-
-        // TODO: Think about using KFileItemDelegate as soon as it supports editing.
-        // Currently the RenameDialog is used, but I'm not sure whether inline renaming
-        // is a benefit for the user at all -> let's wait for some input first...
-        RenameDialog dialog(urls);
-        if (dialog.exec() == QDialog::Rejected) {
-            return;
-        }
-
-        const QString& newName = dialog.newName();
-        if (newName.isEmpty()) {
-            view->statusBar()->setMessage(dialog.errorString(),
-                                          DolphinStatusBar::Error);
-        } else {
-            const KUrl& oldUrl = urls.first();
-            KUrl newUrl = oldUrl;
-            newUrl.setFileName(newName);
-            m_mainWindow->rename(oldUrl, newUrl);
-        }
-    }*/
-}
-
 void DolphinView::selectAll()
 {
     selectAll(QItemSelectionModel::Select);
@@ -477,63 +404,6 @@ KFileItem* DolphinView::fileItem(const QModelIndex index) const
     return m_dirModel->itemForIndex(dirModelIndex);
 }
 
-void DolphinView::rename(const KUrl& source, const QString& newName)
-{
-    bool ok = false;
-
-    if (newName.isEmpty() || (source.fileName() == newName)) {
-        return;
-    }
-
-    KUrl dest(source.upUrl());
-    dest.addPath(newName);
-
-    const bool destExists = KIO::NetAccess::exists(dest, false, this);
-    if (destExists) {
-        // the destination already exists, hence ask the user
-        // how to proceed...
-        KIO::RenameDialog renameDialog(this,
-                                       i18n("File Already Exists"),
-                                       source.path(),
-                                       dest.path(),
-                                       KIO::M_OVERWRITE);
-        switch (renameDialog.exec()) {
-        case KIO::R_OVERWRITE:
-            // the destination should be overwritten
-            ok = KIO::NetAccess::file_move(source, dest, -1, true);
-            break;
-
-        case KIO::R_RENAME: {
-            // a new name for the destination has been used
-            KUrl newDest(renameDialog.newDestUrl());
-            ok = KIO::NetAccess::file_move(source, newDest);
-            break;
-        }
-
-        default:
-            // the renaming operation has been canceled
-            return;
-        }
-    } else {
-        // no destination exists, hence just move the file to
-        // do the renaming
-        ok = KIO::NetAccess::file_move(source, dest);
-    }
-
-    const QString destFileName = dest.fileName();
-    if (ok) {
-        // XYDZ
-        //m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName),
-        //                        DolphinStatusBar::OperationCompleted);
-
-        KonqOperations::rename(this, source, destFileName);
-    } else {
-        // XYDZ
-        //m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
-        //                        DolphinStatusBar::Error);
-    }
-}
-
 void DolphinView::reload()
 {
     setUrl(url());
@@ -671,31 +541,15 @@ void DolphinView::emitSelectionChangedSignal()
 void DolphinView::startDirLister(const KUrl& url, bool reload)
 {
     if (!url.isValid()) {
-        // TODO: temporary deactivated due to DolphinView/DolphinViewController split
-
-        //const QString location(url.pathOrUrl());
-        //if (location.isEmpty()) {
-        //    m_statusBar->setMessage(i18n("The location is empty."), DolphinStatusBar::Error);
-        //} else {
-        //    m_statusBar->setMessage(i18n("The location '%1' is invalid.", location),
-        //                            DolphinStatusBar::Error);
-        //}
+        const QString location(url.pathOrUrl());
+        if (location.isEmpty()) {
+            emit errorMessage(i18n("The location is empty."));
+        } else {
+            emit errorMessage(i18n("The location '%1' is invalid.", location));
+        }
         return;
     }
 
-    // Only show the directory loading progress if the status bar does
-    // not contain another progress information. This means that
-    // the directory loading progress information has the lowest priority.
-
-    // TODO: temporary deactivated due to DolphinView/DolphinViewController split
-    //const QString progressText(m_statusBar->progressText());
-    //m_showProgress = progressText.isEmpty() ||
-    //                 (progressText == i18n("Loading folder..."));
-    //if (m_showProgress) {
-    //    m_statusBar->setProgressText(i18n("Loading folder..."));
-    //    m_statusBar->setProgress(0);
-    //}
-
     m_cutItemsCache.clear();
     m_blockContentsMovedSignal = true;
     m_dirLister->stop();
@@ -821,9 +675,6 @@ void DolphinView::setUrl(const KUrl& url)
 
     startDirLister(url);
     emit urlChanged(url);
-
-    // TODO: temporary deactivated due to DolphinView/DolphinViewController split
-    //m_statusBar->clear();
 }
 
 void DolphinView::changeSelection(const KFileItemList& selection)
@@ -944,16 +795,12 @@ void DolphinView::showHoverInformation(const QModelIndex& index)
 
     const KFileItem* item = fileItem(index);
     if (item != 0) {
-        // TODO: temporary deactivated due to DolphinView/DolphinViewController split
-        //m_statusBar->setMessage(item->getStatusBarInfo(), DolphinStatusBar::Default);
         emit requestItemInfo(item->url());
     }
 }
 
 void DolphinView::clearHoverInformation()
 {
-    // TODO: temporary deactivated due to DolphinView/DolphinViewController split
-    //m_statusBar->clear();
     emit requestItemInfo(KUrl());
 }