diff options
| author | Peter Penz <[email protected]> | 2007-02-18 11:20:32 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-18 11:20:32 +0000 |
| commit | 3316903fe8a9a3c95dad18d19d795cdb55208473 (patch) | |
| tree | 19a2c7522a426e10b5638673a15d9322b41c923e /src/viewproperties.cpp | |
| parent | 0368591365d3a4ddd7c7cd189087eeed96acd1fa (diff) | |
View properties dialog: Allow to reset all view properties (the timestamp is used for this). Additionally it is possible for the user to specify whether the current view properties should be the default for new directories.
svn path=/trunk/KDE/kdebase/apps/; revision=634789
Diffstat (limited to 'src/viewproperties.cpp')
| -rw-r--r-- | src/viewproperties.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/viewproperties.cpp b/src/viewproperties.cpp index 24573c1c9..fd4dfd8dd 100644 --- a/src/viewproperties.cpp +++ b/src/viewproperties.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * [email protected] * + * Copyright (C) 2006 by Peter Penz (<[email protected]>) * + * Copyright (C) 2006 by Aaron J. Seigo (<[email protected]>) * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -52,7 +52,8 @@ ViewProperties::ViewProperties(const KUrl& url) : // We try and save it to a file in the directory being viewed. // If the directory is not writable by the user or the directory is not local, // we store the properties information in a local file. - const bool useGlobalViewProps = DolphinSettings::instance().generalSettings()->globalViewProps(); + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + const bool useGlobalViewProps = settings->globalViewProps(); if (useGlobalViewProps) { m_filepath = destinationDir("global"); } @@ -66,7 +67,26 @@ ViewProperties::ViewProperties(const KUrl& url) : m_filepath = destinationDir("remote") + m_filepath; } - m_node = new ViewPropertySettings(KSharedConfig::openConfig(m_filepath + FILE_NAME)); + const QString file(m_filepath + FILE_NAME); + m_node = new ViewPropertySettings(KSharedConfig::openConfig(file)); + + kDebug() << "------------------ global timestamp: " << settings->viewPropsTimestamp() << endl; + + const bool useDefaultProps = !useGlobalViewProps && + (!QFileInfo(file).exists() || + (m_node->timestamp() < settings->viewPropsTimestamp())); + if (useDefaultProps) { + // If the .directory file does not exist or the timestamp is too old, + // use the values from the global .directory file instead, which acts + // as default view for new folders in this case. + settings->setGlobalViewProps(true); + + ViewProperties defaultProps(url); + setDirProperties(defaultProps); + + settings->setGlobalViewProps(false); + m_changedProps = false; + } } ViewProperties::~ViewProperties() @@ -184,12 +204,12 @@ QString ViewProperties::destinationDir(const QString& subDir) const return KStandardDirs::locateLocal("data", basePath); } -ViewProperties::ViewProperties(const ViewProperties& props) +ViewProperties::ViewProperties(const ViewProperties& /*props*/) { assert(false); } -ViewProperties& ViewProperties::operator = (const ViewProperties& props) +ViewProperties& ViewProperties::operator = (const ViewProperties& /*props*/) { assert(false); } |
