┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-06-08 14:23:32 +0200
committerFelix Ernst <[email protected]>2022-08-14 14:42:40 +0000
commitf45d2e985422a0ca96098155a20d32ec4783e5fa (patch)
treedc2d17e1ffacf9a658d9206257f30e2e7a502adc /src
parent6b0dcb62dae13647a36ad343eee0a4ce5f48d7c8 (diff)
Add "Invert Selection" and "Select All" to bottom bar
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.
Diffstat (limited to 'src')
-rw-r--r--src/selectionmode/bottombarcontentscontainer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/selectionmode/bottombarcontentscontainer.cpp b/src/selectionmode/bottombarcontentscontainer.cpp
index ab3a8e7c7..048e845a0 100644
--- a/src/selectionmode/bottombarcontentscontainer.cpp
+++ b/src/selectionmode/bottombarcontentscontainer.cpp
@@ -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;
}