]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't use a hardcoded path in the view properties dialog for the mirrored directory...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 18 Feb 2007 18:54:22 +0000 (18:54 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 18 Feb 2007 18:54:22 +0000 (18:54 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=634899

src/viewproperties.cpp
src/viewproperties.h
src/viewpropertiesdialog.cpp

index 25aa98e0e579d495755cf9893521a7a349e4b09f..7101bed29ab296b83ad73a71747237f74140a5a4 100644 (file)
@@ -195,6 +195,13 @@ void ViewProperties::save()
     m_changedProps = false;
 }
 
+KUrl ViewProperties::mirroredDirectory()
+{
+    QString basePath = KGlobal::mainComponent().componentName();
+    basePath.append("/view_properties/");
+    return KUrl(KStandardDirs::locateLocal("data", basePath));
+}
+
 QString ViewProperties::destinationDir(const QString& subDir) const
 {
     QString basePath = KGlobal::mainComponent().componentName();
index b4d9500bc66e57c1e905c59b2bcc4c564de745b7..e4f7821fc48fba2c81483b48599fccaebf2b717d 100644 (file)
@@ -97,6 +97,15 @@ public:
      */
     void save();
 
+    /**
+     * Returns the URL of the directory, where the mirrored view properties
+     * are stored into. Mirrored view properties are used if:
+     * - there is no write access for storing the view properties into
+     *   the original directory
+     * - for non local directories
+     */
+    static KUrl mirroredDirectory();
+
 private:
     /**
      * Returns the destination directory path where the view
index 350113a3cb5b21601c11ff1ad6daceee67ef63c7..93c37788789493db1141c1ef453b4f5c3dc7679c 100644 (file)
@@ -266,10 +266,8 @@ void ViewPropertiesDialog::applyViewProperties()
         settings->setViewPropsTimestamp(QDateTime::currentDateTime());
 
         // This is also a good chance to make a cleanup of all mirrored view properties:
-        QString basePath = KGlobal::mainComponent().componentName();
-        basePath.append("/view_properties/");
-        const QString mirroredViewProps = KStandardDirs::locateLocal("data", basePath);
-        KIO::NetAccess::del(mirroredViewProps, this);
+        const KUrl mirroredDir = ViewProperties::mirroredDirectory();
+        KIO::NetAccess::del(mirroredDir, this);
     }
 
     m_viewProps->save();
@@ -292,7 +290,6 @@ void ViewPropertiesDialog::applyViewProperties()
         settings->setGlobalViewProps(true);
         ViewProperties defaultProps(m_dolphinView->url());
         defaultProps.setDirProperties(*m_viewProps);
-        kDebug() << "saving global viewprops" << endl;
         defaultProps.save();
         settings->setGlobalViewProps(false);
     }