mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
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
This commit is contained in:
parent
1f162f181c
commit
1340e98548
|
@ -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());
|
||||
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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue