X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7fcab3c7839d46592dc821b12c572a7040435a38..39f89141b06c:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 8913468e6..a3d913d6a 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -74,8 +74,10 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, // The context menu either accesses the URLs of the selected items // or the items itself. To increase the performance both lists are cached. const DolphinView* view = m_mainWindow->activeViewContainer()->view(); - m_selectedUrls = view->selectedUrls(); m_selectedItems = view->selectedItems(); + foreach (const KFileItem &item, m_selectedItems) { + m_selectedUrls.append(item.url()); + } if (m_keyInfo != 0) { if (m_keyInfo->isKeyPressed(Qt::Key_Shift) || m_keyInfo->isKeyLatched(Qt::Key_Shift)) { @@ -321,9 +323,18 @@ void DolphinContextMenu::openViewportContextMenu() m_popup->addMenu(newFileMenu->menu()); m_popup->addSeparator(); - // insert 'Open in new window' and 'Open in new tab' entries - m_popup->addAction(m_mainWindow->actionCollection()->action("open_in_new_window")); - m_popup->addAction(m_mainWindow->actionCollection()->action("open_in_new_tab")); + // Insert 'New Window' and 'New Tab' entries. Don't use "open_in_new_window" and + // "open_in_new_tab" here, as the current selection should get ignored. + m_popup->addAction(m_mainWindow->actionCollection()->action("new_window")); + m_popup->addAction(m_mainWindow->actionCollection()->action("new_tab")); + + // Insert 'Add to Places' entry if exactly one item is selected + QAction* addToPlacesAction = 0; + if (!placeExists(m_mainWindow->activeViewContainer()->url())) { + addToPlacesAction = m_popup->addAction(KIcon("bookmark-new"), + i18nc("@action:inmenu Add current folder to places", "Add to Places")); + } + m_popup->addSeparator(); QAction* pasteAction = createPasteAction(); @@ -339,13 +350,6 @@ void DolphinContextMenu::openViewportContextMenu() addVersionControlActions(); - // insert 'Add to Places' entry if exactly one item is selected - QAction* addToPlacesAction = 0; - if (!placeExists(m_mainWindow->activeViewContainer()->url())) { - addToPlacesAction = m_popup->addAction(KIcon("bookmark-new"), - i18nc("@action:inmenu Add current folder to places", "Add to Places")); - } - addCustomActions(); QAction* propertiesAction = m_popup->addAction(i18nc("@action:inmenu", "Properties")); @@ -482,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()); }