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

<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<?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" />
<MenuBar>
<Menu name="file">
<Action name="new_menu" />
<text context="@title:menu">Main Toolbar</text>
<Action name="go_back" />
<Action name="go_forward" />
<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" />
<Action name="url_navigators" />
<Action name="split_view" />
<Action name="split_stash" />
// after going forwards which is probably not intended.
}
}
// 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
"view the contents of multiple folders in the same list.</para>"));
KSelectAction *viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode"));
"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->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::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."));
QAction *zoomInAction = KStandardAction::zoomIn(this, &DolphinViewActionHandler::zoomIn, m_actionCollection);
zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size."));