diff options
| author | Nate Graham <[email protected]> | 2025-01-02 13:39:24 -0700 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2025-01-07 15:17:24 +0000 |
| commit | 65f095b81f9df7846d13a581a63757eb7c71ade8 (patch) | |
| tree | c6a6221268453491666a0c125e7c99b02a8c7ec8 /src/dolphincontextmenu.cpp | |
| parent | f42e81fb5d71ffa23948c4edea9bb3f86c84e8c7 (diff) | |
Improve trash context menu UI
Right now the "Delete" item is right next to "Restore", which means you
can accidentally destroy the item you meant to restore!
To prevent this, the menu is re-arranged slightly, and "Restore" is
given a more visually clear icon and label.
BUG: 498132
FIXED-IN: 25.04.0
Diffstat (limited to 'src/dolphincontextmenu.cpp')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 84023ddbd..413ab96a0 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -147,28 +147,36 @@ void DolphinContextMenu::addTrashItemContextMenu() Q_ASSERT(m_context & TrashContext); Q_ASSERT(m_context & ItemContext); - addAction(QIcon::fromTheme("restoration"), i18nc("@action:inmenu", "Restore"), [this]() { - QList<QUrl> selectedUrls; - selectedUrls.reserve(m_selectedItems.count()); - for (const KFileItem &item : std::as_const(m_selectedItems)) { - selectedUrls.append(item.url()); - } + addAction(QIcon::fromTheme(QStringLiteral("edit-reset")), + i18ncp("@action:inmenu Restore the selected files that are in the trash to the place they lived at the moment they were trashed. Minimize the " + "length of this string if possible.", + "Restore to Former Location", + "Restore to Former Locations", + m_selectedItems.count()), + [this]() { + QList<QUrl> selectedUrls; + selectedUrls.reserve(m_selectedItems.count()); + for (const KFileItem &item : std::as_const(m_selectedItems)) { + selectedUrls.append(item.url()); + } - KIO::RestoreJob *job = KIO::restoreFromTrash(selectedUrls); - KJobWidgets::setWindow(job, m_mainWindow); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - }); + KIO::RestoreJob *job = KIO::restoreFromTrash(selectedUrls); + KJobWidgets::setWindow(job, m_mainWindow); + job->uiDelegate()->setAutoErrorHandlingEnabled(true); + }); - QAction *deleteAction = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)); - addAction(deleteAction); + QAction *propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties")); + addAction(propertiesAction); addSeparator(); + addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Cut))); addAction(m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Copy))); addSeparator(); - QAction *propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties")); - addAction(propertiesAction); + + QAction *deleteAction = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::DeleteFile)); + addAction(deleteAction); } void DolphinContextMenu::addDirectoryItemContextMenu() |
