X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/1b192c67f9735cd724c4958e7ba32a7b549770b6..f3a0986b8b1addabb93323ac850060ffa0a8c5bd:/src/settings/viewpropertiesdialog.cpp diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index 82d182d1d..0f182512c 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -19,7 +19,7 @@ #include #include -#ifdef HAVE_BALOO +#if HAVE_BALOO #include #endif @@ -44,6 +44,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_sortOrder(nullptr), m_sorting(nullptr), m_sortFoldersFirst(nullptr), + m_sortHiddenLast(nullptr), m_previewsShown(nullptr), m_showInGroups(nullptr), m_showHiddenFiles(nullptr), @@ -82,6 +83,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : } m_sortFoldersFirst = new QCheckBox(i18nc("@option:check", "Show folders first")); + m_sortHiddenLast = new QCheckBox(i18nc("@option:check", "Show hidden files last")); m_previewsShown = new QCheckBox(i18nc("@option:check", "Show preview")); m_showInGroups = new QCheckBox(i18nc("@option:check", "Show in groups")); m_showHiddenFiles = new QCheckBox(i18nc("@option:check", "Show hidden files")); @@ -106,7 +108,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : // Add checkboxes bool indexingEnabled = false; -#ifdef HAVE_BALOO +#if HAVE_BALOO Baloo::IndexerConfig config; indexingEnabled = config.fileIndexingEnabled(); #endif @@ -146,15 +148,18 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : layout->addRow(QString(), m_previewsShown); layout->addRow(QString(), m_showInGroups); layout->addRow(QString(), m_showHiddenFiles); + layout->addRow(QString(), m_sortHiddenLast); - connect(m_viewMode, QOverload::of(&QComboBox::currentIndexChanged), + connect(m_viewMode, &QComboBox::currentIndexChanged, this, &ViewPropertiesDialog::slotViewModeChanged); - connect(m_sorting, QOverload::of(&QComboBox::currentIndexChanged), + connect(m_sorting, &QComboBox::currentIndexChanged, this, &ViewPropertiesDialog::slotSortingChanged); - connect(m_sortOrder, QOverload::of(&QComboBox::currentIndexChanged), + connect(m_sortOrder, &QComboBox::currentIndexChanged, this, &ViewPropertiesDialog::slotSortOrderChanged); connect(m_sortFoldersFirst, &QCheckBox::clicked, this, &ViewPropertiesDialog::slotSortFoldersFirstChanged); + connect(m_sortHiddenLast, &QCheckBox::clicked, + this, &ViewPropertiesDialog::slotSortHiddenLastChanged); connect(m_previewsShown, &QCheckBox::clicked, this, &ViewPropertiesDialog::slotShowPreviewChanged); connect(m_showInGroups, &QCheckBox::clicked, @@ -282,6 +287,13 @@ void ViewPropertiesDialog::slotSortFoldersFirstChanged() markAsDirty(true); } +void ViewPropertiesDialog::slotSortHiddenLastChanged() +{ + const bool hiddenLast = m_sortHiddenLast->isChecked(); + m_viewProps->setSortHiddenLast(hiddenLast); + markAsDirty(true); +} + void ViewPropertiesDialog::slotShowPreviewChanged() { const bool show = m_previewsShown->isChecked(); @@ -336,7 +348,9 @@ void ViewPropertiesDialog::applyViewProperties() const bool applyToSubFolders = m_applyToSubFolders && m_applyToSubFolders->isChecked(); if (applyToSubFolders) { const QString text(i18nc("@info", "The view properties of all sub-folders will be changed. Do you want to continue?")); - if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) { + if (KMessageBox::questionYesNo(this, text, {}, + KStandardGuiItem::cont(), + KStandardGuiItem::cancel()) == KMessageBox::No) { return; } @@ -368,7 +382,9 @@ void ViewPropertiesDialog::applyViewProperties() if (applyToAllFolders) { const QString text(i18nc("@info", "The view properties of all folders will be changed. Do you want to continue?")); - if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) { + if (KMessageBox::questionYesNo(this, text, {}, + KStandardGuiItem::cont(), + KStandardGuiItem::cancel()) == KMessageBox::No) { return; } @@ -383,6 +399,7 @@ void ViewPropertiesDialog::applyViewProperties() m_dolphinView->setSortRole(m_viewProps->sortRole()); m_dolphinView->setSortOrder(m_viewProps->sortOrder()); m_dolphinView->setSortFoldersFirst(m_viewProps->sortFoldersFirst()); + m_dolphinView->setSortHiddenLast(m_viewProps->sortHiddenLast()); m_dolphinView->setGroupedSorting(m_viewProps->groupedSorting()); m_dolphinView->setVisibleRoles(m_viewProps->visibleRoles()); m_dolphinView->setPreviewsShown(m_viewProps->previewsShown()); @@ -418,6 +435,7 @@ void ViewPropertiesDialog::loadSettings() m_sorting->setCurrentIndex(sortRoleIndex); m_sortFoldersFirst->setChecked(m_viewProps->sortFoldersFirst()); + m_sortHiddenLast->setChecked(m_viewProps->sortHiddenLast()); // Load show preview, show in groups and show hidden files settings m_previewsShown->setChecked(m_viewProps->previewsShown());