]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add "Invert Selection" and "Select All" to bottom bar
authorFelix Ernst <fe.a.ernst@gmail.com>
Wed, 8 Jun 2022 12:23:32 +0000 (14:23 +0200)
committerFelix Ernst <fe.a.ernst@gmail.com>
Sun, 14 Aug 2022 14:42:40 +0000 (14:42 +0000)
In selection mode, a bottom bar with contextual actions appears
when at least one item is selected. This commit makes it so this
bottom bar also contains the "Invert Selection" and "Select All"
actions so users have more complete control over changing what is
and isn't selected while in selection mode.

src/selectionmode/bottombarcontentscontainer.cpp

index ab3a8e7c78da9a696b27c0c98c30355d5502e643..048e845a01d38cf2639ee4b28db24efbb3dc6cb7 100644 (file)
@@ -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;
 }
 
     return contextActions;
 }