diff options
| author | David Faure <[email protected]> | 2008-06-05 22:25:07 +0000 |
|---|---|---|
| committer | David Faure <[email protected]> | 2008-06-05 22:25:07 +0000 |
| commit | 3d28c535643ce8ad0c91b20adbdd1229031d3c82 (patch) | |
| tree | 5b4d3b175129147105da6e52a432de4da565d830 | |
| parent | 008f524498475dd28717b1f3d65e2c99bbdb5b2a (diff) | |
When "move_to_trash" is disabled and "delete" is enabled (e.g. non-local files),
enable a hidden action with Key_Del as shortcut, so that the user can press Del to delete the file.
BUG: 76016
svn path=/trunk/KDE/kdebase/apps/; revision=817389
| -rw-r--r-- | src/dolphinmainwindow.cpp | 2 | ||||
| -rw-r--r-- | src/dolphinpart.cpp | 11 | ||||
| -rw-r--r-- | src/dolphinui.rc | 3 | ||||
| -rw-r--r-- | src/dolphinviewactionhandler.cpp | 11 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 81d1e2670..57926d33e 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1113,6 +1113,7 @@ void DolphinMainWindow::updateEditActions() QAction* moveToTrashAction = col->action("move_to_trash"); QAction* deleteAction = col->action("delete"); QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut)); + QAction* deleteWithTrashShortcut = col->action("delete_shortcut"); // see DolphinViewActionHandler KonqFileItemCapabilities capabilities(list); const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving(); @@ -1120,6 +1121,7 @@ void DolphinMainWindow::updateEditActions() renameAction->setEnabled(capabilities.supportsMoving()); moveToTrashAction->setEnabled(enableMoveToTrash); deleteAction->setEnabled(capabilities.supportsDeleting()); + deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash); cutAction->setEnabled(capabilities.supportsMoving()); } updatePasteAction(); diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index bca9ee4a6..58e68a39f 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -122,8 +122,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL m_actionHandler->updateViewActions(); slotSelectionChanged(KFileItemList()); // initially disable selection-dependent actions - // TODO sort_by_* actions - // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror // (sort of spacial navigation) @@ -213,26 +211,27 @@ void DolphinPart::slotSelectionChanged(const KFileItemList& selection) QAction* deleteAction = actionCollection()->action("delete"); QAction* editMimeTypeAction = actionCollection()->action("editMimeType"); QAction* propertiesAction = actionCollection()->action("properties"); + QAction* deleteWithTrashShortcut = actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler if (!hasSelection) { stateChanged("has_no_selection"); emit m_extension->enableAction("cut", false); emit m_extension->enableAction("copy", false); - renameAction->setEnabled(false); - moveToTrashAction->setEnabled(false); - deleteAction->setEnabled(false); + deleteWithTrashShortcut->setEnabled(false); editMimeTypeAction->setEnabled(false); - propertiesAction->setEnabled(false); } else { stateChanged("has_selection"); + // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code) + // in libkonq KonqFileItemCapabilities capabilities(selection); const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving(); renameAction->setEnabled(capabilities.supportsMoving()); moveToTrashAction->setEnabled(enableMoveToTrash); deleteAction->setEnabled(capabilities.supportsDeleting()); + deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash); editMimeTypeAction->setEnabled(true); propertiesAction->setEnabled(true); emit m_extension->enableAction("cut", capabilities.supportsMoving()); diff --git a/src/dolphinui.rc b/src/dolphinui.rc index 0dd1c8332..05875dcd4 100644 --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui version="4" name="dolphin" > +<kpartgui name="dolphin" version="5"> <MenuBar> <Menu name="file"> <Action name="create_new" /> @@ -109,6 +109,7 @@ <Action name="rename" /> <Action name="move_to_trash" /> <Action name="delete" /> + <Action name="delete_shortcut" /> <Action name="properties" /> <Action name="invert_selection" /> </disable> diff --git a/src/dolphinviewactionhandler.cpp b/src/dolphinviewactionhandler.cpp index 938ce785d..420db5404 100644 --- a/src/dolphinviewactionhandler.cpp +++ b/src/dolphinviewactionhandler.cpp @@ -93,6 +93,17 @@ void DolphinViewActionHandler::createActions() deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete); connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteItems())); + // This action is useful for being enabled when "move_to_trash" should be + // disabled and "delete" is enabled (e.g. non-local files), so that Key_Del + // can be used for deleting the file (#76016). It needs to be a separate action + // so that the Edit menu isn't affected. + KAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut"); + // TODO after message freeze, a more descriptive text, for the shortcuts editor. + deleteWithTrashShortcut->setText(i18nc("@action:inmenu File", "Delete")); + deleteWithTrashShortcut->setShortcut(QKeySequence::Delete); + deleteWithTrashShortcut->setEnabled(false); + connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems())); + // View menu QActionGroup* viewModeActions = new QActionGroup(this); |
