X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/eb4e1dc66efcd4832cb9b2363f282d7a2b12314d..d3496b12310d9fec0e52e537c341e87fcaa2f8b5:/src/settings/viewpropertiesdialog.cpp diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index 6760d3467..2a35f7eb8 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -21,27 +21,25 @@ #include "viewpropertiesdialog.h" #include "additionalinfodialog.h" -#include "dolphinview.h" +#include "views/dolphinview.h" #include "settings/dolphinsettings.h" -#include "dolphinsortfilterproxymodel.h" #include "dolphin_generalsettings.h" #include "dolphin_iconsmodesettings.h" -#include "viewproperties.h" #include "viewpropsprogressinfo.h" #include #ifdef HAVE_NEPOMUK -#include +#include #endif -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -54,6 +52,9 @@ #include #include +#include +#include + ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : KDialog(dolphinView), m_isDirty(false), @@ -62,6 +63,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_viewMode(0), m_sortOrder(0), m_sorting(0), + m_sortFoldersFirst(0), m_showPreview(0), m_showInGroups(0), m_showHiddenFiles(0), @@ -71,7 +73,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_applyToAllFolders(0), m_useAsDefault(0) { - Q_ASSERT(dolphinView != 0); + Q_ASSERT(dolphinView); const bool useGlobalViewProps = DolphinSettings::instance().generalSettings()->globalViewProps(); setCaption(i18nc("@title:window", "View Properties")); @@ -122,6 +124,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : // m_sorting->addItem(i18nc("@item:inlistbox Sort", "By Tags")); // } #endif + m_sortFoldersFirst = new QCheckBox(i18nc("@option:check", "Show folders first")); m_showPreview = 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")); @@ -142,6 +145,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : QVBoxLayout* propsBoxLayout = new QVBoxLayout(propsBox); propsBoxLayout->addWidget(propsGrid); + propsBoxLayout->addWidget(m_sortFoldersFirst); propsBoxLayout->addWidget(m_showPreview); propsBoxLayout->addWidget(m_showInGroups); propsBoxLayout->addWidget(m_showHiddenFiles); @@ -157,6 +161,8 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : this, SLOT(slotSortOrderChanged(int))); connect(m_additionalInfo, SIGNAL(clicked()), this, SLOT(configureAdditionalInfo())); + connect(m_sortFoldersFirst, SIGNAL(clicked()), + this, SLOT(slotSortFoldersFirstChanged())); connect(m_showPreview, SIGNAL(clicked()), this, SLOT(slotShowPreviewChanged())); connect(m_showInGroups, SIGNAL(clicked()), @@ -177,7 +183,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : "Current folder"), applyBox); m_applyToCurrentFolder->setChecked(true); m_applyToSubFolders = new QRadioButton(i18nc("@option:radio Apply View Properties To", - "Current folder including all sub folders"), applyBox); + "Current folder including all sub-folders"), applyBox); m_applyToAllFolders = new QRadioButton(i18nc("@option:radio Apply View Properties To", "All folders"), applyBox); @@ -191,7 +197,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : applyBoxLayout->addWidget(m_applyToSubFolders); applyBoxLayout->addWidget(m_applyToAllFolders); - m_useAsDefault = new QCheckBox(i18nc("@option:check", "Use as default for new folders"), main); + m_useAsDefault = new QCheckBox(i18nc("@option:check", "Use these view properties as default"), main); topLayout->addWidget(applyBox); topLayout->addWidget(m_useAsDefault); @@ -269,6 +275,13 @@ void ViewPropertiesDialog::slotCategorizedSortingChanged() markAsDirty(true); } +void ViewPropertiesDialog::slotSortFoldersFirstChanged() +{ + const bool foldersFirst = m_sortFoldersFirst->isChecked(); + m_viewProps->setSortFoldersFirst(foldersFirst); + markAsDirty(true); +} + void ViewPropertiesDialog::slotShowPreviewChanged() { const bool show = m_showPreview->isChecked(); @@ -304,11 +317,12 @@ void ViewPropertiesDialog::configureAdditionalInfo() m_viewProps->setAdditionalInfo(info); } - AdditionalInfoDialog dialog(this, info); - if (dialog.exec() == QDialog::Accepted) { - m_viewProps->setAdditionalInfo(dialog.additionalInfo()); + QPointer dialog = new AdditionalInfoDialog(this, info); + if (dialog->exec() == QDialog::Accepted) { + m_viewProps->setAdditionalInfo(dialog->informationList()); markAsDirty(true); } + delete dialog; } void ViewPropertiesDialog::applyViewProperties() @@ -318,10 +332,9 @@ void ViewPropertiesDialog::applyViewProperties() return; } - const bool applyToSubFolders = (m_applyToSubFolders != 0) && - m_applyToSubFolders->isChecked(); + 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?")); + 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) { return; } @@ -334,13 +347,11 @@ void ViewPropertiesDialog::applyViewProperties() info->show(); } - const bool applyToAllFolders = (m_applyToAllFolders != 0) && - m_applyToAllFolders->isChecked(); + const bool applyToAllFolders = m_applyToAllFolders && m_applyToAllFolders->isChecked(); // If the user selected 'Apply To All Folders' the view properties implicitely // are also used as default for new folders. - const bool useAsDefault = applyToAllFolders || - ((m_useAsDefault != 0) && m_useAsDefault->isChecked()); + const bool useAsDefault = applyToAllFolders || (m_useAsDefault && m_useAsDefault->isChecked()); if (useAsDefault) { // For directories where no .directory file is available, the .directory // file stored for the global view properties is used as fallback. To update @@ -370,6 +381,7 @@ void ViewPropertiesDialog::applyViewProperties() m_dolphinView->setMode(m_viewProps->viewMode()); m_dolphinView->setSorting(m_viewProps->sorting()); m_dolphinView->setSortOrder(m_viewProps->sortOrder()); + m_dolphinView->setSortFoldersFirst(m_viewProps->sortFoldersFirst()); m_dolphinView->setCategorizedSorting(m_viewProps->categorizedSorting()); m_dolphinView->setAdditionalInfo(m_viewProps->additionalInfo()); m_dolphinView->setShowPreview(m_viewProps->showPreview()); @@ -395,6 +407,7 @@ void ViewPropertiesDialog::loadSettings() (index == DolphinView::IconsView); m_additionalInfo->setEnabled(enabled); + m_sortFoldersFirst->setChecked(m_viewProps->sortFoldersFirst()); // load show preview, show in groups and show hidden files settings m_showPreview->setChecked(m_viewProps->showPreview()); @@ -402,7 +415,7 @@ void ViewPropertiesDialog::loadSettings() m_showInGroups->setEnabled(index == DolphinView::IconsView); // only the icons view supports categorized sorting m_showHiddenFiles->setChecked(m_viewProps->showHiddenFiles()); - markAsDirty = false; + markAsDirty(false); } #include "viewpropertiesdialog.moc"