From 60d6a3bdbcd44360e1c6ae1c82239ecf6d60ded7 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Sat, 24 Aug 2019 14:33:00 -0600 Subject: [PATCH] Fix ascending/descending choosers getting unchecked when re-selecting the same sort order Summary: When you select the same sort order that's already selected, the currently-checked sort order description (the human-readable ascending/descending items) gets unchecked in `slotSortTriggered()` yet the ascending/descending items items only get checked in `slotSortOrderChanged()`. Because the order hasn't gotten changed, neither one gets checked again. This patch fixes the problem by not unchecking them in the first place. BUG: 411223 FIXED-IN: 19.08.2 Test Plan: 1. Right-click > Sort By > Click the currently-selected sort order 2. Right-click > Sort By > See that the item for the current ascending/descending setting has not been changed Reviewers: elvisangelaccio, #dolphin Reviewed By: elvisangelaccio, #dolphin Subscribers: broulik, meven, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D23412 --- src/views/dolphinviewactionhandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 41752e4f15..a79dacb1f8 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -637,9 +637,10 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action) // and several sub-menus. Because of this they don't have a common // action-group that assures an exclusive toggle-state between the main-menu // actions and the sub-menu-actions. If an action gets checked, it must - // be assured that all other actions get unchecked. + // be assured that all other actions get unchecked, except the ascending/ + // descending actions QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort")); - foreach (QAction* groupAction, sortByMenu->menu()->actions()) { + for (QAction *groupAction : qAsConst(m_sortByActions)) { KActionMenu* actionMenu = qobject_cast(groupAction); if (actionMenu) { foreach (QAction* subAction, actionMenu->menu()->actions()) {