From 7d81e3092a85b77d575d2519d97c578365080e0e Mon Sep 17 00:00:00 2001 From: Antti Savolainen Date: Sat, 18 Apr 2026 09:31:32 +0000 Subject: dolphincontextmenu: move "Empty Trash" to where you expect destructive actions to be "Empty Trash" has caused me to delete files that I've wanted to restore. This moves the position to where you expect them to be. To my understanding the standard order in the context menu is: Creation operations Visual adjustments Destructive operations Misc. Settings | Before | After | Restore for comparison | |-|-|-| | ![image](/uploads/16e8bc66d3123be2f6ab598972d8be3c/image.png){width=185 height=144}| ![image](/uploads/fbcded1023c7133099b2dcddbd6c7bc3/image.png){width=225 height=161} | ![image](/uploads/8bdb39e0e21a9128204181d38acb0ed6/image.png){width=270 height=159} | BUG: 518713 --- src/dolphincontextmenu.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 31c353ee3..796c723ed 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -121,6 +121,18 @@ bool DolphinContextMenu::eventFilter(QObject *object, QEvent *event) void DolphinContextMenu::addTrashContextMenu() { + // Insert 'Sort By' and 'View Mode' + if (ContextMenuSettings::showSortBy()) { + addAction(m_mainWindow->actionCollection()->action(QStringLiteral("sort"))); + } + if (ContextMenuSettings::showViewMode()) { + addAction(m_mainWindow->actionCollection()->action(QStringLiteral("view_mode"))); + } + + if (ContextMenuSettings::showSortBy() || ContextMenuSettings::showViewMode()) { + addSeparator(); + } + Q_ASSERT(m_context & TrashContext); QAction *emptyTrashAction = addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@action:inmenu", "Empty Trash"), this, [this]() { @@ -132,17 +144,6 @@ void DolphinContextMenu::addTrashContextMenu() emptyTrashAction->setEnabled(!isEmpty); }); - // Insert 'Sort By' and 'View Mode' - if (ContextMenuSettings::showSortBy() || ContextMenuSettings::showViewMode()) { - addSeparator(); - } - if (ContextMenuSettings::showSortBy()) { - addAction(m_mainWindow->actionCollection()->action(QStringLiteral("sort"))); - } - if (ContextMenuSettings::showViewMode()) { - addAction(m_mainWindow->actionCollection()->action(QStringLiteral("view_mode"))); - } - addSeparator(); auto *configureTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18nc("@action:inmenu", "Configure Trash…"), this); -- cgit v1.3