mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 00:11:21 +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)));
|
addAction(collection->action(KStandardAction::name(KStandardAction::RenameFile)));
|
||||||
|
|
||||||
// Insert 'Move to Trash' and/or 'Delete'
|
// Insert 'Move to Trash' and/or 'Delete'
|
||||||
if (properties.supportsDeleting()) {
|
const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) ||
|
||||||
const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) ||
|
!properties.isLocal());
|
||||||
!properties.isLocal());
|
const bool showMoveToTrashAction = (properties.isLocal() &&
|
||||||
const bool showMoveToTrashAction = (properties.isLocal() &&
|
properties.supportsMoving());
|
||||||
properties.supportsMoving());
|
|
||||||
|
|
||||||
if (showDeleteAction && showMoveToTrashAction) {
|
if (showDeleteAction && showMoveToTrashAction) {
|
||||||
delete m_removeAction;
|
delete m_removeAction;
|
||||||
m_removeAction = nullptr;
|
m_removeAction = nullptr;
|
||||||
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)));
|
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::MoveToTrash)));
|
||||||
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
|
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
|
||||||
} else if (showDeleteAction && !showMoveToTrashAction) {
|
} else if (showDeleteAction && !showMoveToTrashAction) {
|
||||||
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
|
addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)));
|
||||||
} else {
|
} else {
|
||||||
if (!m_removeAction) {
|
if (!m_removeAction) {
|
||||||
m_removeAction = new DolphinRemoveAction(this, m_mainWindow->actionCollection());
|
m_removeAction = new DolphinRemoveAction(this, m_mainWindow->actionCollection());
|
||||||
}
|
|
||||||
addAction(m_removeAction);
|
|
||||||
m_removeAction->update();
|
|
||||||
}
|
}
|
||||||
|
addAction(m_removeAction);
|
||||||
|
m_removeAction->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue