]> cloud.milkyroute.net Git - dolphin.git/commitdiff
removed obsolete renaming code, which is not needed anymore due to the DolphinView...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 7 Jun 2007 21:30:02 +0000 (21:30 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 7 Jun 2007 21:30:02 +0000 (21:30 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=672696

src/dolphinview.cpp
src/dolphinview.h
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h

index 8d3bf1e2f7fa783732193e358da201d4bc24645a..6177643358409d56371d5c59c91a2ef5e591511a 100644 (file)
@@ -267,78 +267,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 +405,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());
index 24c4f60a14e18366f8a227b2aedbdcee45437e6d..b4aef3468c8ef6cefb6c0b383b0048c641f0fcd4 100644 (file)
@@ -199,12 +199,6 @@ public:
      */
     bool supportsCategorizedSorting() const;
 
-    /**
-     * Triggers the renaming of the currently selected items, where
-     * the user must input a new name for the items.
-     */
-    void renameSelectedItems();
-
     /**
      * Selects all items.
      * @see DolphinView::selectedItems()
@@ -242,13 +236,6 @@ public:
      */
     KFileItem* fileItem(const QModelIndex index) const;
 
-    /**
-     * Renames the filename of the source URL by the new file name.
-     * If the new file name already exists, a dialog is opened which
-     * asks the user to enter a new name.
-     */
-    void rename(const KUrl& source, const QString& newName);
-
     /**
      * Returns the x-position of the view content.
      * The content of the view might be larger than the visible area
index 0b2812a7ce1e7be18426353cf437ae1c237577ec..3c687c8d250ff11969d36d28805e515a991c3c3c 100644 (file)
@@ -277,61 +277,6 @@ KFileItem* DolphinViewContainer::fileItem(const QModelIndex index) const
     return m_dirModel->itemForIndex(dirModelIndex);
 }
 
-void DolphinViewContainer::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) {
-        m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName),
-                                DolphinStatusBar::OperationCompleted);
-
-        KonqOperations::rename(this, source, destFileName);
-    } else {
-        m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
-                                DolphinStatusBar::Error);
-    }
-}
-
 DolphinMainWindow* DolphinViewContainer::mainWindow() const
 {
     return m_mainWindow;
index 5652e4b4a6fc5d9ad6fe09b5c8e3eda14daef041..f6ab8d1c15f5519f07bc993d6acce8e3a3cd5bf6 100644 (file)
@@ -107,13 +107,6 @@ public:
 
     KFileItem* fileItem(const QModelIndex index) const;
 
-    /**
-     * Renames the filename of the source URL by the new file name.
-     * If the new file name already exists, a dialog is opened which
-     * asks the user to enter a new name.
-     */
-    void rename(const KUrl& source, const QString& newName);
-
     DolphinStatusBar* statusBar() const;
 
     /**