From: Thomas Surrel Date: Mon, 19 Nov 2018 13:08:19 +0000 (+0100) Subject: Show the Delete context menu entry even when disabled X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/1340e98548753f0c8e087b2f80c55c2cf6e9acd3 Show the Delete context menu entry even when disabled Summary: This is consistent with the HIG, and the 'Rename' entry in the context menu already behaves like that. Test Plan: Right click on /home. The context menu should contained the 'Delete' entry, but it should be disabled. Reviewers: #dolphin, #vdg, ngraham Reviewed By: #dolphin, #vdg, ngraham Subscribers: ngraham, romangg, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D17012 --- diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index a521551e5..9d7972b9f 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -421,26 +421,24 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties& addAction(collection->action(KStandardAction::name(KStandardAction::RenameFile))); // Insert 'Move to Trash' and/or 'Delete' - if (properties.supportsDeleting()) { - const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) || - !properties.isLocal()); - const bool showMoveToTrashAction = (properties.isLocal() && - properties.supportsMoving()); - - if (showDeleteAction && showMoveToTrashAction) { - delete m_removeAction; - m_removeAction = nullptr; - addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash))); - addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); - } else if (showDeleteAction && !showMoveToTrashAction) { - addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); - } else { - if (!m_removeAction) { - m_removeAction = new DolphinRemoveAction(this, m_mainWindow->actionCollection()); - } - addAction(m_removeAction); - m_removeAction->update(); + const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) || + !properties.isLocal()); + const bool showMoveToTrashAction = (properties.isLocal() && + properties.supportsMoving()); + + if (showDeleteAction && showMoveToTrashAction) { + delete m_removeAction; + m_removeAction = nullptr; + addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash))); + addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); + } else if (showDeleteAction && !showMoveToTrashAction) { + addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile))); + } else { + if (!m_removeAction) { + m_removeAction = new DolphinRemoveAction(this, m_mainWindow->actionCollection()); } + addAction(m_removeAction); + m_removeAction->update(); } }