]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
The &-shortcut from another action is not set until the action has been shown at...
[dolphin.git] / src / dolphincontextmenu.cpp
index 13fa6f35b9ec33e6aeecf20579641e7b248d9ec6..a3d913d6a02a8c9f026ff06c19d7cf121432a691 100644 (file)
@@ -486,8 +486,18 @@ void DolphinContextMenu::updateRemoveAction()
 {
     const KActionCollection* collection = m_mainWindow->actionCollection();
     const bool moveToTrash = capabilities().isLocal() && !m_shiftPressed;
-    const QAction* action = moveToTrash ? collection->action("move_to_trash") : collection->action("delete");
-    m_removeAction->setText(action->text());
+
+    // Using m_removeAction->setText(action->text()) does not apply the &-shortcut.
+    // This is only done until the original action has been shown at least once. To
+    // bypass this issue, the text and &-shortcut is applied manually.
+    const QAction* action = 0;
+    if (moveToTrash) {
+        action = collection->action("move_to_trash");
+        m_removeAction->setText(i18nc("@action:inmenu", "&Move to Trash"));
+    } else {
+        action = collection->action("delete");
+        m_removeAction->setText(i18nc("@action:inmenu", "&Delete"));
+    }
     m_removeAction->setIcon(action->icon());
     m_removeAction->setShortcuts(action->shortcuts());
 }