]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/viewproperties.cpp
allow to enable the categorization feature for sorting
[dolphin.git] / src / viewproperties.cpp
index 45aadba23902dda48e8317a8f757764d4621b02e..ab5e0634e2083087a8ced4b263ad7b01452d4e26 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QDateTime>
 #include <QFile>
+#include <QFileInfo>
 
 #include <kcomponentdata.h>
 #include <klocale.h>
@@ -36,9 +37,9 @@
 #define FILE_NAME "/.directory"
 
 ViewProperties::ViewProperties(const KUrl& url) :
-      m_changedProps(false),
-      m_autoSave(true),
-      m_node(0)
+        m_changedProps(false),
+        m_autoSave(true),
+        m_node(0)
 {
     KUrl cleanUrl(url);
     cleanUrl.cleanPath();
@@ -56,14 +57,12 @@ ViewProperties::ViewProperties(const KUrl& url) :
     const bool useGlobalViewProps = settings->globalViewProps();
     if (useGlobalViewProps) {
         m_filepath = destinationDir("global");
-    }
-    else if (cleanUrl.isLocalFile()) {
+    } else if (cleanUrl.isLocalFile()) {
         const QFileInfo info(m_filepath);
         if (!info.isWritable()) {
             m_filepath = destinationDir("local") + m_filepath;
         }
-    }
-    else {
+    } else {
         m_filepath = destinationDir("remote") + m_filepath;
     }
 
@@ -132,6 +131,20 @@ void ViewProperties::setShowHiddenFiles(bool show)
     }
 }
 
+void ViewProperties::setCategorizedSorting(bool categorized)
+{
+    if (m_node->categorizedSorting() != categorized) {
+        m_node->setCategorizedSorting(categorized);
+        updateTimeStamp();
+    }
+}
+
+bool ViewProperties::categorizedSorting() const
+{
+    return m_node->categorizedSorting();
+}
+
+
 bool ViewProperties::showHiddenFiles() const
 {
     return m_node->showHiddenFiles();
@@ -163,13 +176,29 @@ Qt::SortOrder ViewProperties::sortOrder() const
     return static_cast<Qt::SortOrder>(m_node->sortOrder());
 }
 
+void ViewProperties::setAdditionalInfo(KFileItemDelegate::AdditionalInformation info)
+{
+    if (m_node->additionalInfo() != info) {
+        m_node->setAdditionalInfo(info);
+        updateTimeStamp();
+    }
+}
+
+KFileItemDelegate::AdditionalInformation ViewProperties::additionalInfo() const
+{
+    return static_cast<KFileItemDelegate::AdditionalInformation>(m_node->additionalInfo());
+}
+
+
 void ViewProperties::setDirProperties(const ViewProperties& props)
 {
     setViewMode(props.viewMode());
     setShowPreview(props.showPreview());
     setShowHiddenFiles(props.showHiddenFiles());
+    setCategorizedSorting(props.categorizedSorting());
     setSorting(props.sorting());
     setSortOrder(props.sortOrder());
+    setAdditionalInfo(props.additionalInfo());
 }
 
 void ViewProperties::setAutoSaveEnabled(bool autoSave)
@@ -208,13 +237,3 @@ QString ViewProperties::destinationDir(const QString& subDir) const
     basePath.append("/view_properties/").append(subDir);
     return KStandardDirs::locateLocal("data", basePath);
 }
-
-ViewProperties::ViewProperties(const ViewProperties& /*props*/)
-{
-    assert(false);
-}
-
-ViewProperties& ViewProperties::operator = (const ViewProperties& /*props*/)
-{
-    assert(false);
-}