]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinviewactionhandler.cpp
Port to KStandardAction::MoveToTrash
[dolphin.git] / src / views / dolphinviewactionhandler.cpp
index 273bcdd76a1046277424045c0c5ebd25e42aa9e2..5f98577b1852c99b7a79d7d9e1875d23e68be14b 100644 (file)
@@ -113,21 +113,11 @@ void DolphinViewActionHandler::createActions()
     rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
     connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename);
 
-    QAction* moveToTrash = m_actionCollection->addAction(QStringLiteral("move_to_trash"));
-    moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
-    moveToTrash->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
-    m_actionCollection->setDefaultShortcut(moveToTrash, QKeySequence::Delete);
-    connect(moveToTrash, &QAction::triggered,
-            this, &DolphinViewActionHandler::slotTrashActivated);
-
-    QAction* deleteAction = m_actionCollection->addAction(QStringLiteral("delete"));
-    deleteAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
-    deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
-    m_actionCollection->setDefaultShortcut(deleteAction, Qt::SHIFT | Qt::Key_Delete);
-    connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
-
-    // This action is useful for being enabled when "move_to_trash" should be
-    // disabled and "delete" is enabled (e.g. non-local files), so that Key_Del
+    KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
+    KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
+
+    // This action is useful for being enabled when KStandardAction::MoveToTrash should be
+    // disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del
     // can be used for deleting the file (#76016). It needs to be a separate action
     // so that the Edit menu isn't affected.
     QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut"));