diff options
| author | Ramil Nurmanov <[email protected]> | 2026-06-05 00:06:12 +0400 |
|---|---|---|
| committer | Ramil Nurmanov <[email protected]> | 2026-06-11 14:30:18 +0400 |
| commit | 989c0f4f0319f7d8e573c8a88fe8011bd3315466 (patch) | |
| tree | 2cecdf3bed6375269e4d9b6948ebc4c34918988d /src/views/dolphinviewactionhandler.h | |
| parent | 6eed05fd769b01c37530b8b62cdcd65933ea8d14 (diff) | |
Allow grouping by a separate criterion
Add an explicit group role to Dolphin views so items can be grouped independently from the active sort role.
Previously, Dolphin's grouped view always used the current sort role as the grouping criterion. This meant that grouping and sorting were tied together, for example grouping by type also required sorting by type.
This change adds a separate Group By menu. It replaces the previous Show in Groups toggle and allows the user to disable grouping, keep the old Same as Sort behavior, or explicitly group by a selected criterion.
When an explicit group role is set, the model keeps groups stable and uses the normal sort role as a secondary key inside each group. The roles
updater also receives the active group role, so roles used only for grouping are still updated correctly.
BUG: 416134
CCBUG: 510670
CCBUG: 513235
CCBUG: 46393
Diffstat (limited to 'src/views/dolphinviewactionhandler.h')
| -rw-r--r-- | src/views/dolphinviewactionhandler.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h index 20d62cf64..b15a73933 100644 --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -186,15 +186,9 @@ private Q_SLOTS: */ void slotVisibleRolesChanged(const QList<QByteArray> ¤t, const QList<QByteArray> &previous); - /** - * Switches between sorting by groups or not. - */ - void toggleGroupedSorting(bool); - - /** - * Updates the state of the 'Categorized sorting' menu action. - */ - void slotGroupedSortingChanged(bool sortCategorized); + void slotGroupByTriggered(QAction *action); + void slotGroupedSortingChanged(bool groupedSorting); + void slotGroupRoleChanged(const QByteArray &role); /** * Switches between showing and hiding of hidden marked files @@ -252,10 +246,11 @@ private: /** * Creates an action-group out of all roles from KFileItemModel. * Dependent on the group-prefix either a radiobutton-group is - * created for sorting (prefix is "sort_by_") or a checkbox-group + * created for sorting (prefix is "sort_by_"), a radiobutton-group + * is created for group-by (prefix is "group_"), or a checkbox-group * is created for additional information (prefix is "show_"). - * The changes of actions are reported to slotSortTriggered() or - * toggleAdditionalInfo(). + * The changes of actions are reported to slotSortTriggered(), + * slotGroupByTriggered(), or toggleAdditionalInfo() respectively. */ QActionGroup *createFileItemRolesActionGroup(const QString &groupPrefix); @@ -277,11 +272,14 @@ private: */ KToggleAction *detailsModeAction(); + void updateGroupByActions(); + KActionCollection *m_actionCollection; DolphinView *m_currentView; QHash<QByteArray, KToggleAction *> m_sortByActions; QHash<QByteArray, KToggleAction *> m_visibleRoles; + QHash<QByteArray, KToggleAction *> m_groupByActions; }; #endif /* DOLPHINVIEWACTIONHANDLER_H */ |
