]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/viewpropertiesdialog.cpp
Use capitalized KDE includes
[dolphin.git] / src / settings / viewpropertiesdialog.cpp
index 438bf74fb321a00299176e86f0f6adc7a0e626de..f52bd12d2c4788421b189c38b2d6f5a1a73de9e0 100644 (file)
 #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 <config-nepomuk.h>
 #include <nepomuk/resourcemanager.h>
 #endif
 
-#include <kcomponentdata.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kio/netaccess.h>
-#include <kmessagebox.h>
-#include <kstandarddirs.h>
-#include <kurl.h>
+#include <KComponentData>
+#include <KLocale>
+#include <KIconLoader>
+#include <KIO/NetAccess>
+#include <KMessageBox>
+#include <KStandardDirs>
+#include <KUrl>
 #include <kcombobox.h>
 
 #include <QAction>
@@ -54,6 +52,9 @@
 #include <QRadioButton>
 #include <QBoxLayout>
 
+#include <views/dolphinsortfilterproxymodel.h>
+#include <views/viewproperties.h>
+
 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),
@@ -122,11 +124,12 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
     //    m_sorting->addItem(i18nc("@item:inlistbox Sort", "By Tags"));
     // }
 #endif
-    m_showPreview = new QCheckBox(i18nc("@option:check", "Show preview"), propsBox);
-    m_showInGroups = new QCheckBox(i18nc("@option:check", "Show in groups"), propsBox);
-    m_showHiddenFiles = new QCheckBox(i18nc("@option:check", "Show hidden files"), propsBox);
+    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"));
 
-    m_additionalInfo = new QPushButton(i18nc("@action:button", "Additional Information"), propsBox);
+    m_additionalInfo = new QPushButton(i18nc("@action:button", "Additional Information"));
 
     QHBoxLayout* sortingLayout = new QHBoxLayout();
     sortingLayout->setMargin(0);
@@ -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<AdditionalInfoDialog> dialog = new AdditionalInfoDialog(this, info);
+    if (dialog->exec() == QDialog::Accepted) {
+        m_viewProps->setAdditionalInfo(dialog->informationList());
         markAsDirty(true);
     }
+    delete dialog;
 }
 
 void ViewPropertiesDialog::applyViewProperties()
@@ -321,7 +335,7 @@ void ViewPropertiesDialog::applyViewProperties()
     const bool applyToSubFolders = (m_applyToSubFolders != 0) &&
                                    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;
         }
@@ -370,6 +384,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 +410,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());