]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/viewproperties.cpp
Added Rafael López's item categorizer into Dolphin (it's currently deactivated in...
[dolphin.git] / src / viewproperties.cpp
index 25aa98e0e579d495755cf9893521a7a349e4b09f..485ed438498f6a8146bfe40e72c89d9721318ab8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QDateTime>
 #include <QFile>
+#include <QFileInfo>
 
 #include <kcomponentdata.h>
 #include <klocale.h>
 
 #include "viewproperties.h"
 #include "dolphinsettings.h"
-#include "generalsettings.h"
+#include "dolphin_generalsettings.h"
 
 #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;
     }
 
@@ -163,6 +162,20 @@ 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());
@@ -170,6 +183,7 @@ void ViewProperties::setDirProperties(const ViewProperties& props)
     setShowHiddenFiles(props.showHiddenFiles());
     setSorting(props.sorting());
     setSortOrder(props.sortOrder());
+    setAdditionalInfo(props.additionalInfo());
 }
 
 void ViewProperties::setAutoSaveEnabled(bool autoSave)
@@ -195,19 +209,16 @@ void ViewProperties::save()
     m_changedProps = false;
 }
 
-QString ViewProperties::destinationDir(const QString& subDir) const
+KUrl ViewProperties::mirroredDirectory()
 {
     QString basePath = KGlobal::mainComponent().componentName();
-    basePath.append("/view_properties/").append(subDir);
-    return KStandardDirs::locateLocal("data", basePath);
-}
-
-ViewProperties::ViewProperties(const ViewProperties& /*props*/)
-{
-    assert(false);
+    basePath.append("/view_properties/");
+    return KUrl(KStandardDirs::locateLocal("data", basePath));
 }
 
-ViewProperties& ViewProperties::operator = (const ViewProperties& /*props*/)
+QString ViewProperties::destinationDir(const QString& subDir) const
 {
-    assert(false);
+    QString basePath = KGlobal::mainComponent().componentName();
+    basePath.append("/view_properties/").append(subDir);
+    return KStandardDirs::locateLocal("data", basePath);
 }