X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f6e3d851334e14a05f5e1a7b281a7101a12d43bb..29c5ab3b74d26657c60b40770676be082caa953d:/src/dolphinviewactionhandler.cpp diff --git a/src/dolphinviewactionhandler.cpp b/src/dolphinviewactionhandler.cpp index 88530febf..71e9fd398 100644 --- a/src/dolphinviewactionhandler.cpp +++ b/src/dolphinviewactionhandler.cpp @@ -57,6 +57,8 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view) this, SLOT(slotShowPreviewChanged())); connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)), this, SLOT(slotSortOrderChanged(Qt::SortOrder))); + connect(view, SIGNAL(sortFoldersFirstChanged(bool)), + this, SLOT(slotSortFoldersFirstChanged(bool))); connect(view, SIGNAL(additionalInfoChanged()), this, SLOT(slotAdditionalInfoChanged())); connect(view, SIGNAL(categorizedSortingChanged()), @@ -148,6 +150,10 @@ void DolphinViewActionHandler::createActions() sortDescending->setText(i18nc("@action:inmenu Sort", "Descending")); connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder())); + KToggleAction* sortFoldersFirst = m_actionCollection->add("folders_first"); + sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First")); + connect(sortFoldersFirst, SIGNAL(triggered()), this, SLOT(toggleSortFoldersFirst())); + QActionGroup* sortByActionGroup = createSortByActionGroup(); connect(sortByActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotSortTriggered(QAction*))); @@ -356,6 +362,7 @@ void DolphinViewActionHandler::updateViewActions() showPreviewAction->setChecked(m_currentView->showPreview()); slotSortOrderChanged(m_currentView->sortOrder()); + slotSortFoldersFirstChanged(m_currentView->sortFoldersFirst()); slotAdditionalInfoChanged(); slotCategorizedSortingChanged(); slotSortingChanged(m_currentView->sorting()); @@ -385,6 +392,11 @@ void DolphinViewActionHandler::toggleSortOrder() m_currentView->toggleSortOrder(); } +void DolphinViewActionHandler::toggleSortFoldersFirst() +{ + m_currentView->toggleSortFoldersFirst(); +} + void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order) { QAction* descending = m_actionCollection->action("descending"); @@ -392,6 +404,11 @@ void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order) descending->setChecked(sortDescending); } +void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst) +{ + m_actionCollection->action("folders_first")->setChecked(foldersFirst); +} + void DolphinViewActionHandler::toggleAdditionalInfo(QAction* action) { emit actionBeingHandled();