X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e28a32728b40ac22dd36ea4db136adc2d6f1026d..07e07fd522cc278dffccc3b8b6faded0f6f5df20:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index cc22c1fd9..470abe5b7 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -20,34 +20,34 @@ #include "dolphinview.h" +#include + #include -#include +#include // TODO #include #include #include #include #include -#include #include #include #include #include -#include +#include +#include -#include "urlnavigator.h" #include "dolphinstatusbar.h" #include "dolphinmainwindow.h" #include "dolphindirlister.h" #include "dolphinsortfilterproxymodel.h" -#include "viewproperties.h" #include "dolphindetailsview.h" #include "dolphiniconsview.h" #include "dolphincontextmenu.h" -#include "undomanager.h" -#include "renamedialog.h" -#include "progressindicator.h" #include "filterbar.h" +#include "renamedialog.h" +#include "urlnavigator.h" +#include "viewproperties.h" DolphinView::DolphinView(DolphinMainWindow *mainWindow, QWidget *parent, @@ -233,17 +233,14 @@ void DolphinView::renameSelectedItems() DolphinStatusBar::Error); } else { - UndoManager& undoMan = UndoManager::instance(); - undoMan.beginMacro(); + // TODO: check how this can be integrated into KonqUndoManager/KonqOperations + + //UndoManager& undoMan = UndoManager::instance(); + //undoMan.beginMacro(); assert(newName.contains('#')); const int urlsCount = urls.count(); - ProgressIndicator* progressIndicator = - new ProgressIndicator(mainWindow(), - i18n("Renaming items..."), - i18n("Renaming finished."), - urlsCount); // iterate through all selected items and rename them... const int replaceIndex = newName.indexOf('#'); @@ -259,8 +256,6 @@ void DolphinView::renameSelectedItems() const bool destExists = KIO::NetAccess::exists(dest, false, view); if (destExists) { - delete progressIndicator; - progressIndicator = 0; view->statusBar()->setMessage(i18n("Renaming failed (item '%1' already exists).",name), DolphinStatusBar::Error); break; @@ -268,17 +263,13 @@ void DolphinView::renameSelectedItems() else if (KIO::NetAccess::file_move(source, dest)) { // TODO: From the users point of view he executed one 'rename n files' operation, // but internally we store it as n 'rename 1 file' operations for the undo mechanism. - DolphinCommand command(DolphinCommand::Rename, source, dest); - undoMan.addCommand(command); + //DolphinCommand command(DolphinCommand::Rename, source, dest); + //undoMan.addCommand(command); } } - - progressIndicator->execOperation(); } - delete progressIndicator; - progressIndicator = 0; - undoMan.endMacro(); + //undoMan.endMacro(); } } else { @@ -566,15 +557,15 @@ void DolphinView::rename(const KUrl& source, const QString& newName) 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(), dest.fileName()), + m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.",source.fileName(), destFileName), DolphinStatusBar::OperationCompleted); - DolphinCommand command(DolphinCommand::Rename, source, dest); - UndoManager::instance().addCommand(command); + KonqOperations::rename(this, source, destFileName); } else { - m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source.fileName(), dest.fileName()), + m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source.fileName(), destFileName), DolphinStatusBar::Error); reload(); }