- QAction* rename = m_actionCollection->addAction(QStringLiteral("rename"));
- rename->setText(i18nc("@action:inmenu File", "Rename..."));
- m_actionCollection->setDefaultShortcut(rename, Qt::Key_F2);
- 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
+ auto renameAction = KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection);
+ renameAction->setWhatsThis(xi18nc("@info:whatsthis", "This renames the "
+ "items in your current selection.<nl/>Renaming multiple items "
+ "at once amounts to their new names differing only in a number."));
+
+ auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
+ auto trashShortcuts = trashAction->shortcuts();
+ if (!trashShortcuts.contains(QKeySequence::Delete)) {
+ trashShortcuts.append(QKeySequence::Delete);
+ m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts);
+ }
+ trashAction->setWhatsThis(xi18nc("@info:whatsthis", "This moves the "
+ "items in your current selection to the <filename>Trash"
+ "</filename>.<nl/>The trash is a temporary storage where "
+ "items can be deleted from if disk space is needed."));
+
+ auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
+ auto deleteShortcuts = deleteAction->shortcuts();
+ if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) {
+ deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete);
+ m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts);
+ }
+ deleteAction->setWhatsThis(xi18nc("@info:whatsthis", "This deletes "
+ "the items in your current selection completely. They can "
+ "not be recovered by normal means."));
+
+ // 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