┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/viewproperties.cpp21
-rw-r--r--src/views/viewproperties.h20
2 files changed, 29 insertions, 12 deletions
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp
index 3a9a2a370..125ac749e 100644
--- a/src/views/viewproperties.cpp
+++ b/src/views/viewproperties.cpp
@@ -42,6 +42,9 @@ namespace {
// the details view as customized by the user. See
// ViewProperties::visibleRoles() for more information.
const char* CustomizedDetailsString = "CustomizedDetails";
+
+ // Filename that is used for storing the properties
+ const char* ViewPropertiesFileName = ".directory";
}
ViewProperties::ViewProperties(const KUrl& url) :
@@ -78,13 +81,13 @@ ViewProperties::ViewProperties(const KUrl& url) :
m_filePath = destinationDir("remote") + m_filePath;
}
- const QString file = m_filePath + QDir::separator() + QLatin1String(".directory");
+ const QString file = m_filePath + QDir::separator() + ViewPropertiesFileName;
m_node = new ViewPropertySettings(KSharedConfig::openConfig(file));
// If the .directory file does not exist or the timestamp is too old,
// use default values instead.
const bool useDefaultProps = (!useGlobalViewProps || useDetailsViewWithPath) &&
- (!QFileInfo(file).exists() ||
+ (!QFile::exists(file) ||
(m_node->timestamp() < settings->viewPropsTimestamp()));
if (useDefaultProps) {
if (useDetailsViewWithPath) {
@@ -353,11 +356,10 @@ void ViewProperties::save()
m_changedProps = false;
}
-KUrl ViewProperties::mirroredDirectory()
+bool ViewProperties::exist() const
{
- QString basePath = KGlobal::mainComponent().componentName();
- basePath.append("/view_properties/");
- return KUrl(KStandardDirs::locateLocal("data", basePath));
+ const QString file = m_filePath + QDir::separator() + ViewPropertiesFileName;
+ return QFile::exists(file);
}
QString ViewProperties::destinationDir(const QString& subDir) const
@@ -453,3 +455,10 @@ QString ViewProperties::directoryHashForUrl(const KUrl& url)
hashString.replace('/', '-');
return hashString;
}
+
+KUrl ViewProperties::mirroredDirectory()
+{
+ QString basePath = KGlobal::mainComponent().componentName();
+ basePath.append("/view_properties/");
+ return KUrl(KStandardDirs::locateLocal("data", basePath));
+}
diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h
index 97fb7cdba..b3d3070ed 100644
--- a/src/views/viewproperties.h
+++ b/src/views/viewproperties.h
@@ -118,13 +118,12 @@ 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
+ * @return True if properties for the given URL exist:
+ * As soon as the properties for an URL have been saved with
+ * ViewProperties::save(), true will be returned. If false is
+ * returned, the default view-properties are used.
*/
- static KUrl mirroredDirectory();
+ bool exist() const;
private:
/**
@@ -165,6 +164,15 @@ private:
*/
static QString directoryHashForUrl(const KUrl& url);
+ /**
+ * 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();
+
Q_DISABLE_COPY(ViewProperties)
private: