From: David Faure Date: Wed, 30 Apr 2008 23:32:33 +0000 (+0000) Subject: KonqFileUndoManager moved to kdelibs, as KIO::FileUndoManager. Ported the code in... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/06e9ece82168a739d3f59a9d843ba89113fba650 KonqFileUndoManager moved to kdelibs, as KIO::FileUndoManager. Ported the code in libkonq+dolphin+konqueror. svn path=/trunk/KDE/kdebase/apps/; revision=802881 --- diff --git a/src/dolphindropcontroller.cpp b/src/dolphindropcontroller.cpp index a9fd94df5..45a7092c7 100644 --- a/src/dolphindropcontroller.cpp +++ b/src/dolphindropcontroller.cpp @@ -29,6 +29,7 @@ // TODO replace with KonqOperations::doDrop [or move doDrop code into this class] // Note that this means changing the DolphinDropController controller usage // to "create with new and let it autodelete" instead of on stack, since doDrop is async. +// NOTE: let's wait for KDirModel::dropEvent first. DolphinDropController::DolphinDropController(QWidget* parentWidget) : QObject(parentWidget), m_parentWidget(parentWidget) @@ -107,17 +108,17 @@ void DolphinDropController::dropUrls(const KUrl::List& urls, switch (action) { case Qt::MoveAction: KonqOperations::copy(m_parentWidget, KonqOperations::MOVE, urls, destination); - emit doingOperation(KonqFileUndoManager::MOVE); + emit doingOperation(KIO::FileUndoManager::Move); break; case Qt::CopyAction: KonqOperations::copy(m_parentWidget, KonqOperations::COPY, urls, destination); - emit doingOperation(KonqFileUndoManager::COPY); + emit doingOperation(KIO::FileUndoManager::Copy); break; case Qt::LinkAction: KonqOperations::copy(m_parentWidget, KonqOperations::LINK, urls, destination); - emit doingOperation(KonqFileUndoManager::LINK); + emit doingOperation(KIO::FileUndoManager::Link); break; default: diff --git a/src/dolphindropcontroller.h b/src/dolphindropcontroller.h index 0a3c23706..955d1614c 100644 --- a/src/dolphindropcontroller.h +++ b/src/dolphindropcontroller.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include "libdolphin_export.h" @@ -55,7 +55,7 @@ signals: * Is emitted when renaming, copying, moving, linking etc. * Used for feedback in the mainwindow. */ - void doingOperation(KonqFileUndoManager::CommandType type); + void doingOperation(KIO::FileUndoManager::CommandType type); private: QWidget* m_parentWidget; diff --git a/src/dolphinfileplacesview.cpp b/src/dolphinfileplacesview.cpp index 5dacae633..a4f801c3a 100644 --- a/src/dolphinfileplacesview.cpp +++ b/src/dolphinfileplacesview.cpp @@ -39,8 +39,8 @@ void DolphinFilePlacesView::slotUrlsDropped(const KUrl& dest, QDropEvent* event, DolphinDropController dropController(parent); // forward doingOperation signal up to the mainwindow - connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)), - this, SIGNAL(doingOperation(KonqFileUndoManager::CommandType))); + connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), + this, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType))); dropController.dropUrls(urls, dest); } diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 48956e093..43818f580 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -102,7 +102,7 @@ DolphinMainWindow::DolphinMainWindow(int id) : new MainWindowAdaptor(this); QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this); - KonqFileUndoManager* undoManager = KonqFileUndoManager::self(); + KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); undoManager->setUiInterface(new UndoUiInterface()); connect(undoManager, SIGNAL(undoAvailable(bool)), @@ -133,7 +133,7 @@ void DolphinMainWindow::toggleViews() m_viewTab[m_tabIndex].secondaryView = container; } -void DolphinMainWindow::slotDoingOperation(KonqFileUndoManager::CommandType commandType) +void DolphinMainWindow::slotDoingOperation(KIO::FileUndoManager::CommandType commandType) { clearStatusBar(); m_undoCommandTypes.append(commandType); @@ -160,8 +160,8 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, const KUrl& destination) { DolphinDropController dropController(this); - connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)), - this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType))); + connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), + this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType))); dropController.dropUrls(urls, destination); } @@ -387,31 +387,31 @@ void DolphinMainWindow::slotUndoAvailable(bool available) } if (available && (m_undoCommandTypes.count() > 0)) { - const KonqFileUndoManager::CommandType command = m_undoCommandTypes.takeFirst(); + const KIO::FileUndoManager::CommandType command = m_undoCommandTypes.takeFirst(); DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); switch (command) { - case KonqFileUndoManager::COPY: + case KIO::FileUndoManager::Copy: statusBar->setMessage(i18nc("@info:status", "Copy operation completed."), DolphinStatusBar::OperationCompleted); break; - case KonqFileUndoManager::MOVE: + case KIO::FileUndoManager::Move: statusBar->setMessage(i18nc("@info:status", "Move operation completed."), DolphinStatusBar::OperationCompleted); break; - case KonqFileUndoManager::LINK: + case KIO::FileUndoManager::Link: statusBar->setMessage(i18nc("@info:status", "Link operation completed."), DolphinStatusBar::OperationCompleted); break; - case KonqFileUndoManager::TRASH: + case KIO::FileUndoManager::Trash: statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."), DolphinStatusBar::OperationCompleted); break; - case KonqFileUndoManager::RENAME: + case KIO::FileUndoManager::Rename: statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."), DolphinStatusBar::OperationCompleted); break; - case KonqFileUndoManager::MKDIR: + case KIO::FileUndoManager::Mkdir: statusBar->setMessage(i18nc("@info:status", "Created folder."), DolphinStatusBar::OperationCompleted); break; @@ -434,8 +434,8 @@ void DolphinMainWindow::slotUndoTextChanged(const QString& text) void DolphinMainWindow::undo() { clearStatusBar(); - KonqFileUndoManager::self()->uiInterface()->setParentWidget(this); - KonqFileUndoManager::self()->undo(); + KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this); + KIO::FileUndoManager::self()->undo(); } void DolphinMainWindow::cut() @@ -1152,8 +1152,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) this, SLOT(slotRequestItemInfo(KFileItem))); connect(view, SIGNAL(activated()), this, SLOT(toggleActiveView())); - connect(view, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)), - this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType))); + connect(view, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), + this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType))); connect(view, SIGNAL(tabRequested(const KUrl&)), this, SLOT(openNewTab(const KUrl&))); @@ -1189,7 +1189,7 @@ QString DolphinMainWindow::tabName(const KUrl& url) const } DolphinMainWindow::UndoUiInterface::UndoUiInterface() : - KonqFileUndoManager::UiInterface() + KIO::FileUndoManager::UiInterface() { } @@ -1204,7 +1204,7 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job) DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar(); statusBar->setMessage(job->errorString(), DolphinStatusBar::Error); } else { - KonqFileUndoManager::UiInterface::jobError(job); + KIO::FileUndoManager::UiInterface::jobError(job); } } diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 675b08bed..47fddf381 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -323,7 +323,7 @@ private slots: void toggleActiveView(); /** Called when the view is doing a file operation, like renaming, copying, moving etc. */ - void slotDoingOperation(KonqFileUndoManager::CommandType type); + void slotDoingOperation(KIO::FileUndoManager::CommandType type); /** * Activates the tab with the index \a index, which means that the current view @@ -388,7 +388,7 @@ private: * assures that all errors are shown in the status bar of Dolphin * instead as modal error dialog with an OK button. */ - class UndoUiInterface : public KonqFileUndoManager::UiInterface + class UndoUiInterface : public KIO::FileUndoManager::UiInterface { public: UndoUiInterface(); @@ -418,7 +418,7 @@ private: DolphinViewActionHandler* m_actionHandler; /// remember pending undo operations until they are finished - QList m_undoCommandTypes; + QList m_undoCommandTypes; }; inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 28e50a0a2..5dd81426f 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -518,7 +518,7 @@ void DolphinView::renameSelectedItems() if (newName.isEmpty()) { emit errorMessage(dialog.errorString()); } else { - // TODO: check how this can be integrated into KonqFileUndoManager/KonqOperations + // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations // as one operation instead of n rename operations like it is done now... Q_ASSERT(newName.contains('#')); @@ -536,7 +536,7 @@ void DolphinView::renameSelectedItems() KUrl newUrl = oldUrl; newUrl.setFileName(name); KonqOperations::rename(this, oldUrl, newUrl); - emit doingOperation(KonqFileUndoManager::RENAME); + emit doingOperation(KIO::FileUndoManager::Rename); } } } @@ -566,14 +566,14 @@ void DolphinView::renameSelectedItems() KUrl newUrl = oldUrl; newUrl.setFileName(newName); KonqOperations::rename(this, oldUrl, newUrl); - emit doingOperation(KonqFileUndoManager::RENAME); + emit doingOperation(KIO::FileUndoManager::Rename); } } } void DolphinView::trashSelectedItems() { - emit doingOperation(KonqFileUndoManager::TRASH); + emit doingOperation(KIO::FileUndoManager::Trash); KonqOperations::del(this, KonqOperations::TRASH, selectedUrls()); } @@ -800,8 +800,8 @@ void DolphinView::dropUrls(const KUrl::List& urls, { DolphinDropController dropController(this); // forward doingOperation signal up to the mainwindow - connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)), - this, SIGNAL(doingOperation(KonqFileUndoManager::CommandType))); + connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), + this, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType))); dropController.dropUrls(urls, destination); } @@ -1163,11 +1163,11 @@ void DolphinView::pasteToUrl(const KUrl& url) const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); if (KonqMimeData::decodeIsCutSelection(mimeData)) { KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url); - emit doingOperation(KonqFileUndoManager::MOVE); + emit doingOperation(KIO::FileUndoManager::Move); clipboard->clear(); } else { KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url); - emit doingOperation(KonqFileUndoManager::COPY); + emit doingOperation(KIO::FileUndoManager::Copy); } } diff --git a/src/dolphinview.h b/src/dolphinview.h index 048486354..1fcdaa087 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -496,7 +496,7 @@ signals: * Is emitted when renaming, copying, moving, linking etc. * Used for feedback in the mainwindow. */ - void doingOperation(KonqFileUndoManager::CommandType type); + void doingOperation(KIO::FileUndoManager::CommandType type); protected: /** @see QWidget::mouseReleaseEvent */