X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c12946ee2ec8dbbb8645ca5763584574458a0a6c..04e493d78cdf46e64562fe8a302426b1fd8c47df:/src/views/viewproperties.cpp diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index 5dbdd938e..8bf3b2531 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -42,22 +42,14 @@ ViewPropertySettings *ViewProperties::loadProperties(const QString &folderPath) return new ViewPropertySettings(KSharedConfig::openConfig(settingsFile, KConfig::SimpleConfig)); } - auto createTempFile = []() -> QTemporaryFile * { - QTemporaryFile *tempFile = new QTemporaryFile; - tempFile->setAutoRemove(false); - if (!tempFile->open()) { - qCWarning(DolphinDebug) << "Could not open temp file"; - return nullptr; - } - return tempFile; - }; - + std::unique_ptr tempFile(new QTemporaryFile()); + tempFile->setAutoRemove(false); + if (!tempFile->open()) { + qCWarning(DolphinDebug) << "Could not open temp file"; + return nullptr; + } if (QFile::exists(settingsFile)) { // copy settings to tempfile to load them separately - const QTemporaryFile *tempFile = createTempFile(); - if (!tempFile) { - return nullptr; - } QFile::remove(tempFile->fileName()); QFile::copy(settingsFile, tempFile->fileName()); @@ -84,11 +76,6 @@ ViewPropertySettings *ViewProperties::loadProperties(const QString &folderPath) return nullptr; } // load view properties from xattr to temp file then loads into ViewPropertySettings - // clear the temp file - const QTemporaryFile *tempFile = createTempFile(); - if (!tempFile) { - return nullptr; - } QFile outputFile(tempFile->fileName()); outputFile.open(QIODevice::WriteOnly); outputFile.write(viewPropertiesString.toUtf8()); @@ -369,6 +356,19 @@ bool ViewProperties::sortHiddenLast() const return m_node->sortHiddenLast(); } +void ViewProperties::setDynamicViewPassed(bool dynamicViewPassed) +{ + if (m_node->dynamicViewPassed() != dynamicViewPassed) { + m_node->setDynamicViewPassed(dynamicViewPassed); + update(); + } +} + +bool ViewProperties::dynamicViewPassed() const +{ + return m_node->dynamicViewPassed(); +} + void ViewProperties::setVisibleRoles(const QList &roles) { if (roles == visibleRoles()) {