diff options
| author | Peter Penz <[email protected]> | 2012-05-16 23:11:56 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-16 23:13:55 +0200 |
| commit | 3e2cf9721b7b9726af37d679d1afd6eaf306ad29 (patch) | |
| tree | b9fb21425d837904918f038773368d0941b6d28a /src/views/viewproperties.cpp | |
| parent | 2fd31c8a95eaa38defa0f6adf3b83b12fc1aa1a3 (diff) | |
Provide default view properties for system-places
For the "Recently Accessed"-places and "Search For"-places like
documents, images, audio-files and videos proper default properties
are created now (e.g. previews and images-sizes are shown when
searching for "images" etc).
Diffstat (limited to 'src/views/viewproperties.cpp')
| -rw-r--r-- | src/views/viewproperties.cpp | 21 |
1 files changed, 15 insertions, 6 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)); +} |
