]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/bottombarcontentscontainer.cpp
Exit the deleted directory when it is removed
[dolphin.git] / src / selectionmode / bottombarcontentscontainer.cpp
index cbfdac9b96a4e1ea58c106f9245016569307f8e6..1634cf4c98a9c12de328b5b29925c0a2e86d5b0f 100644 (file)
@@ -291,9 +291,9 @@ void BottomBarContentsContainer::addDuplicateContents()
 void BottomBarContentsContainer::addGeneralContents()
 {
     if (!m_overflowButton) {
-        // i18n: This button appears in a bar if there isn't enough horizontal space to fit all the other buttons.
+        // i18n: This button appears in a bar if there isn't enough horizontal space to fit all the other buttons so please keep it short.
         // The small button opens a menu that contains the actions that didn't fit on the bar.
-        m_overflowButton = new QPushButton{QIcon::fromTheme(QStringLiteral("view-more-symbolic")), i18nc("@action", "More"), this};
+        m_overflowButton = new QPushButton{QIcon::fromTheme(QStringLiteral("view-more-symbolic")), i18nc("@action keep short", "More"), this};
         m_overflowButton->setMenu(new QMenu{m_overflowButton});
         m_overflowButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); // Makes sure it has the same height as the labeled buttons.
         m_layout->addWidget(m_overflowButton);
@@ -388,7 +388,7 @@ void BottomBarContentsContainer::addPasteContents()
      * So we first have to claim that we have different contents before requesting to leave selection mode. */
     auto actuallyLeaveSelectionMode = [this]() {
         m_contents = BottomBar::Contents::CopyLocationContents;
-        Q_EMIT selectionModeLeavingRequested();
+        Q_EMIT barVisibilityChangeRequested(false);
     };
 
     auto *pasteButton = new QPushButton(this);
@@ -498,6 +498,21 @@ std::vector<QAction *> BottomBarContentsContainer::contextActionsFor(const KFile
             }
         }
     }
+
+    auto separator = new QAction(m_internalContextMenu.get());
+    separator->setSeparator(true);
+    contextActions.emplace_back(separator);
+
+    // Add "Invert Selection" and "Select All" at the very end for better usability while in selection mode.
+    // Design-wise this decision is slightly questionable because the other actions in the bar apply to the selected items while
+    // the "select" actions apply to the view instead but we decided that there are more benefits than drawbacks to this.
+    auto invertSelectionAction = m_actionCollection->action(QStringLiteral("invert_selection"));
+    Q_ASSERT(invertSelectionAction && !internalContextMenuActions.contains(invertSelectionAction));
+    contextActions.emplace_back(invertSelectionAction);
+    auto selectAllAction = m_actionCollection->action(KStandardAction::name(KStandardAction::SelectAll));
+    Q_ASSERT(selectAllAction && !internalContextMenuActions.contains(selectAllAction));
+    contextActions.emplace_back(selectAllAction);
+
     return contextActions;
 }