┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/dolphinui.rc7
-rw-r--r--src/tests/dolphinmainwindowtest.cpp2
-rw-r--r--src/views/dolphinviewactionhandler.cpp15
3 files changed, 17 insertions, 7 deletions
diff --git a/src/dolphinui.rc b/src/dolphinui.rc
index 5c9afa03d..7c2cb2bfc 100644
--- a/src/dolphinui.rc
+++ b/src/dolphinui.rc
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="dolphin" version="41">
+<gui name="dolphin" version="42">
<MenuBar>
<Menu name="file">
<Action name="new_menu" />
@@ -106,10 +106,7 @@
<text context="@title:menu">Main Toolbar</text>
<Action name="go_back" />
<Action name="go_forward" />
- <Separator name="separator_1" />
- <Action name="icons" />
- <Action name="compact" />
- <Action name="details" />
+ <Action name="view_mode" />
<Action name="url_navigators" />
<Action name="split_view" />
<Action name="split_stash" />
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index 37e042219..b22afa142 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -846,7 +846,7 @@ void DolphinMainWindowTest::testAccessibilityTree()
// after going forwards which is probably not intended.
}
}
- QCOMPARE_GE(testedObjectsSizeAfterTraversingForwards, 12); // The test did not reach many objects while using the Tab key to move through Dolphin. Did the
+ QCOMPARE_GE(testedObjectsSizeAfterTraversingForwards, 11); // The test did not reach many objects while using the Tab key to move through Dolphin. Did the
// test run correctly?
}
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."));