From 8578ad1e751d218b40c49a601934a23d8ecd027d Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 17 Nov 2007 00:08:54 +0000 Subject: 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: peter.penz@gmx.at svn path=/trunk/KDE/kdebase/apps/; revision=737682 --- src/dolphinmainwindow.cpp | 52 +++++------------------------------------------ 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'src/dolphinmainwindow.cpp') 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 #include #include -#include #include #include #include @@ -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"); -- cgit v1.3