diff options
| author | Gaston Haro <[email protected]> | 2021-08-01 13:00:05 -0400 |
|---|---|---|
| committer | Zren (Chris Holland) <[email protected]> | 2021-08-05 12:55:01 +0000 |
| commit | 50149d6abb8a0a978db3c6afb5238bc42a4a89c8 (patch) | |
| tree | 26889c44b339ef9fc83a914525afdcc3c94499f8 /src/views/dolphinviewactionhandler.cpp | |
| parent | 2b90a13c62ba9fe8d15377b7811ac6e0ec26b3c4 (diff) | |
Configurable Show hidden files and folders last toggle
CCBUG: 241227
Revision: https://phabricator.kde.org/D29115
Diffstat (limited to 'src/views/dolphinviewactionhandler.cpp')
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index c9bab5f82..90109605b 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -57,6 +57,8 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view) this, &DolphinViewActionHandler::slotSortOrderChanged); connect(view, &DolphinView::sortFoldersFirstChanged, this, &DolphinViewActionHandler::slotSortFoldersFirstChanged); + connect(view, &DolphinView::sortHiddenLastChanged, + this, &DolphinViewActionHandler::slotSortHiddenLastChanged); connect(view, &DolphinView::visibleRolesChanged, this, &DolphinViewActionHandler::slotVisibleRolesChanged); connect(view, &DolphinView::groupedSortingChanged, @@ -253,6 +255,10 @@ void DolphinViewActionHandler::createActions() sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First")); connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst); + KToggleAction* sortHiddenLast = m_actionCollection->add<KToggleAction>(QStringLiteral("hidden_last")); + sortHiddenLast->setText(i18nc("@action:inmenu Sort", "Hidden Files Last")); + connect(sortHiddenLast, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortHiddenLast); + // View -> Sort By QActionGroup* sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_")); @@ -287,6 +293,7 @@ void DolphinViewActionHandler::createActions() sortByActionMenu->addAction(descendingAction); sortByActionMenu->addSeparator(); sortByActionMenu->addAction(sortFoldersFirst); + sortByActionMenu->addAction(sortHiddenLast); // View -> Additional Information QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_")); @@ -481,6 +488,7 @@ void DolphinViewActionHandler::updateViewActions() slotSortOrderChanged(m_currentView->sortOrder()); slotSortFoldersFirstChanged(m_currentView->sortFoldersFirst()); + slotSortHiddenLastChanged(m_currentView->sortHiddenLast()); slotVisibleRolesChanged(m_currentView->visibleRoles(), QList<QByteArray>()); slotGroupedSortingChanged(m_currentView->groupedSorting()); slotSortRoleChanged(m_currentView->sortRole()); @@ -516,6 +524,12 @@ void DolphinViewActionHandler::toggleSortFoldersFirst() m_currentView->setSortFoldersFirst(!sortFirst); } +void DolphinViewActionHandler::toggleSortHiddenLast() +{ + const bool sortHiddenLast = m_currentView->sortHiddenLast(); + m_currentView->setSortHiddenLast(!sortHiddenLast); +} + void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order) { QAction* descending = m_actionCollection->action(QStringLiteral("descending")); @@ -530,6 +544,11 @@ void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst) m_actionCollection->action(QStringLiteral("folders_first"))->setChecked(foldersFirst); } +void DolphinViewActionHandler::slotSortHiddenLastChanged(bool hiddenLast) +{ + m_actionCollection->action(QStringLiteral("hidden_last"))->setChecked(hiddenLast); +} + void DolphinViewActionHandler::toggleVisibleRole(QAction* action) { Q_EMIT actionBeingHandled(); |
