┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorAkseli Lahtinen <[email protected]>2025-01-30 09:25:12 +0000
committerMéven Car <[email protected]>2025-01-30 09:25:12 +0000
commit128f797d73ba8118072767cbead7f22590b522db (patch)
tree4af2c58870a55e5135fd5ac46ac4abc1f9045c8e /src/views
parent82bacf482f8006363b129f023c9c1b9c7082aebc (diff)
Change three view buttons into one with menu arrow
Instead of showing three buttons, which is quite visually noisy, show only one button that is split: First button, when clicked, loops through the view modes. Second smaller button with the down arrow shows menu of the available view modes. See also https://invent.kde.org/system/dolphin/-/issues/68#toolbar-button-changes Alternative for https://invent.kde.org/system/dolphin/-/merge_requests/893 ![Screencast_20250121_123718](/uploads/e8625c485c58a9c47e8168106b3e7419/Screencast_20250121_123718.mp4)
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinviewactionhandler.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index 2934e8005..88d5c015b 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -211,12 +211,25 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
"view the contents of multiple folders in the same list.</para>"));
KSelectAction *viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode"));
- viewModeActions->setText(i18nc("@action:intoolbar", "View Mode"));
+ viewModeActions->setText(i18nc("@action:intoolbar", "Change View Mode"));
+ viewModeActions->setWhatsThis(xi18nc("@info:whatsthis View Mode Toolbutton", "This cycles through all view modes."));
viewModeActions->addAction(iconsAction);
viewModeActions->addAction(compactAction);
viewModeActions->addAction(detailsAction);
viewModeActions->setToolBarMode(KSelectAction::MenuMode);
+ viewModeActions->setToolButtonPopupMode(QToolButton::ToolButtonPopupMode::MenuButtonPopup);
connect(viewModeActions, &KSelectAction::actionTriggered, this, &DolphinViewActionHandler::slotViewModeActionTriggered);
+ connect(viewModeActions, &KSelectAction::triggered, this, [this, viewModeActions, iconsAction, compactAction, detailsAction]() {
+ // Loop through the actions when button is clicked
+ const auto currentAction = viewModeActions->currentAction();
+ if (currentAction == iconsAction) {
+ slotViewModeActionTriggered(compactAction);
+ } else if (currentAction == compactAction) {
+ slotViewModeActionTriggered(detailsAction);
+ } else if (currentAction == detailsAction) {
+ slotViewModeActionTriggered(iconsAction);
+ }
+ });
QAction *zoomInAction = KStandardAction::zoomIn(this, &DolphinViewActionHandler::zoomIn, m_actionCollection);
zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size."));