X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/1dfb2f385a8f036b96cc893d6384f76d887f3fd2..d78c7bffb1445554a44cf3dd3c8e3559e7376f96:/src/views/viewproperties.cpp?ds=sidebyside diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index dac951f09..11b2404a9 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -40,12 +40,16 @@ ViewProperties::ViewProperties(const KUrl& url) : m_autoSave(true), m_node(0) { + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + const bool useGlobalViewProps = settings->globalViewProps(); + // We try and save it to the file .directory 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. - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - const bool useGlobalViewProps = settings->globalViewProps(); - if (useGlobalViewProps) { + const bool isSearchUrl = url.protocol().contains("search"); + if (isSearchUrl) { + m_filePath = destinationDir("search"); + } else if (useGlobalViewProps) { m_filePath = destinationDir("global"); } else if (url.isLocalFile()) { m_filePath = url.toLocalFile(); @@ -60,20 +64,26 @@ ViewProperties::ViewProperties(const KUrl& url) : const QString file = m_filePath + QDir::separator() + QLatin1String(".directory"); m_node = new ViewPropertySettings(KSharedConfig::openConfig(file)); - const bool useDefaultProps = !useGlobalViewProps && + // If the .directory file does not exist or the timestamp is too old, + // use default values instead. + const bool useDefaultProps = (!useGlobalViewProps || isSearchUrl) && (!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; + if (isSearchUrl) { + setViewMode(DolphinView::DetailsView); + setAdditionalInfo(KFileItemDelegate::InformationList() << KFileItemDelegate::LocalPathOrUrl); + } else { + // The global view-properties act as default for directories without + // any view-property configuration + settings->setGlobalViewProps(true); + + ViewProperties defaultProps(url); + setDirProperties(defaultProps); + + settings->setGlobalViewProps(false); + m_changedProps = false; + } } }