From: Nate Graham Date: Thu, 2 Jan 2025 20:39:24 +0000 (-0700) Subject: Improve trash context menu UI X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/65f095b81f9df7846d13a581a63757eb7c71ade8 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 --- 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 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); - }); + 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 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); + }); - 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()