From bd8b41a13577eb197b721d00303c7056926502bf Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 18 Feb 2007 18:54:22 +0000 Subject: [PATCH] Don't use a hardcoded path in the view properties dialog for the mirrored directory, ask the class ViewProperties for the location instead. svn path=/trunk/KDE/kdebase/apps/; revision=634899 --- src/viewproperties.cpp | 7 +++++++ src/viewproperties.h | 9 +++++++++ src/viewpropertiesdialog.cpp | 7 ++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/viewproperties.cpp b/src/viewproperties.cpp index 25aa98e0e..7101bed29 100644 --- a/src/viewproperties.cpp +++ b/src/viewproperties.cpp @@ -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(); diff --git a/src/viewproperties.h b/src/viewproperties.h index b4d9500bc..e4f7821fc 100644 --- a/src/viewproperties.h +++ b/src/viewproperties.h @@ -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 diff --git a/src/viewpropertiesdialog.cpp b/src/viewpropertiesdialog.cpp index 350113a3c..93c377887 100644 --- a/src/viewpropertiesdialog.cpp +++ b/src/viewpropertiesdialog.cpp @@ -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); } -- 2.47.3