diff options
| author | David Faure <[email protected]> | 2007-11-17 00:08:54 +0000 |
|---|---|---|
| committer | David Faure <[email protected]> | 2007-11-17 00:08:54 +0000 |
| commit | 8578ad1e751d218b40c49a601934a23d8ecd027d (patch) | |
| tree | 9d486cf3620757d56f320dcefe80d99440d6e752 /src/dolphinmainwindow.cpp | |
| parent | 3a1d98a8eb1c758859152a27c7bb697d8d0162e9 (diff) | |
Fix "delete" and "move to trash" actions in dolphinpart; moved all logic for those out of konqueror.
Inside dolphin, the usual: moving code to DolphinView.
Pressing shift while clicking on "Move to Trash" in konq (dolphinpart) offers to delete, as in kde3 (this bit of logic might be good for dolphin itself too? see DolphinPart::slotTrashActivated)
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=737682
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index c38cc5ea3..540fe5e48 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -52,7 +52,6 @@ #include <kicon.h> #include <kiconloader.h> #include <kio/netaccess.h> -#include <kio/deletejob.h> #include <kinputdialog.h> #include <klocale.h> #include <kmenu.h> @@ -488,28 +487,13 @@ void DolphinMainWindow::rename() void DolphinMainWindow::moveToTrash() { clearStatusBar(); - const KUrl::List selectedUrls = m_activeViewContainer->view()->selectedUrls(); - KonqOperations::del(this, KonqOperations::TRASH, selectedUrls); - m_undoCommandTypes.append(KonqFileUndoManager::TRASH); + m_activeViewContainer->view()->trashSelectedItems(); } void DolphinMainWindow::deleteItems() { clearStatusBar(); - - const KUrl::List list = m_activeViewContainer->view()->selectedUrls(); - const bool del = KonqOperations::askDeleteConfirmation(list, - KonqOperations::DEL, - KonqOperations::DEFAULT_CONFIRMATION, - this); - - if (del) { - KIO::Job* job = KIO::del(list); - connect(job, SIGNAL(result(KJob*)), - this, SLOT(slotHandleJobError(KJob*))); - connect(job, SIGNAL(result(KJob*)), - this, SLOT(slotDeleteFileFinished(KJob*))); - } + m_activeViewContainer->view()->deleteSelectedItems(); } void DolphinMainWindow::properties() @@ -533,24 +517,6 @@ void DolphinMainWindow::slotHandlePlacesError(const QString &message) } } -void DolphinMainWindow::slotHandleJobError(KJob* job) -{ - if (job->error() != 0) { - DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); - statusBar->setMessage(job->errorString(), - DolphinStatusBar::Error); - } -} - -void DolphinMainWindow::slotDeleteFileFinished(KJob* job) -{ - if (job->error() == 0) { - DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); - statusBar->setMessage(i18nc("@info:status", "Delete operation completed."), - DolphinStatusBar::OperationCompleted); - } -} - void DolphinMainWindow::slotUndoAvailable(bool available) { QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo)); @@ -1047,21 +1013,13 @@ void DolphinMainWindow::setupActions() newWindow->setShortcut(Qt::CTRL | Qt::Key_N); connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow())); - KAction* rename = actionCollection()->addAction("rename"); - rename->setText(i18nc("@action:inmenu File", "Rename...")); - rename->setShortcut(Qt::Key_F2); + KAction* rename = DolphinView::createRenameAction(actionCollection()); connect(rename, SIGNAL(triggered()), this, SLOT(rename())); - KAction* moveToTrash = actionCollection()->addAction("move_to_trash"); - moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash")); - moveToTrash->setIcon(KIcon("user-trash")); - moveToTrash->setShortcut(QKeySequence::Delete); + KAction* moveToTrash = DolphinView::createMoveToTrashAction(actionCollection()); connect(moveToTrash, SIGNAL(triggered()), this, SLOT(moveToTrash())); - KAction* deleteAction = actionCollection()->addAction("delete"); - deleteAction->setText(i18nc("@action:inmenu File", "Delete")); - deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete); - deleteAction->setIcon(KIcon("edit-delete")); + KAction* deleteAction = DolphinView::createDeleteAction(actionCollection()); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems())); KAction* properties = actionCollection()->addAction("properties"); |
