]> cloud.milkyroute.net Git - dolphin.git/commitdiff
fixed issue that "Apply to all folders" in the view properties dialog might forget...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 8 Jun 2008 12:43:10 +0000 (12:43 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 8 Jun 2008 12:43:10 +0000 (12:43 +0000)
BUG: 163366

svn path=/trunk/KDE/kdebase/apps/; revision=818368

src/viewpropertiesdialog.cpp

index 26994bfbc1f46661524f3bfb6ab709f3fec67a37..c0db408f2c6fa2e704e4505f95040d880997b67a 100644 (file)
@@ -330,6 +330,25 @@ void ViewPropertiesDialog::applyViewProperties()
     const bool applyToAllFolders = m_isDirty &&
                                    (m_applyToAllFolders != 0) &&
                                    m_applyToAllFolders->isChecked();
+
+    // If the user selected 'Apply To All Folders' the view properties implicitely
+    // are also used as default for new folders.
+    const bool useAsDefault = applyToAllFolders ||
+                              (m_useAsDefault != 0) && m_useAsDefault->isChecked();
+    if (useAsDefault) {
+        // For directories where no .directory file is available, the .directory
+        // file stored for the global view properties is used as fallback. To update
+        // this file we temporary turn on the global view properties mode.
+        GeneralSettings* settings = DolphinSettings::instance().generalSettings();
+        Q_ASSERT(!settings->globalViewProps());
+
+        settings->setGlobalViewProps(true);
+        ViewProperties defaultProps(m_dolphinView->url());
+        defaultProps.setDirProperties(*m_viewProps);
+        defaultProps.save();
+        settings->setGlobalViewProps(false);
+    }
+
     if (applyToAllFolders) {
         const QString text(i18nc("@info", "The view properties of all folders will be changed. Do you want to continue?"));
         if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) {
@@ -346,8 +365,6 @@ void ViewPropertiesDialog::applyViewProperties()
         KIO::NetAccess::del(mirroredDir, this);
     }
 
-    m_viewProps->save();
-
     m_dolphinView->setMode(m_viewProps->viewMode());
     m_dolphinView->setSorting(m_viewProps->sorting());
     m_dolphinView->setSortOrder(m_viewProps->sortOrder());
@@ -356,21 +373,9 @@ void ViewPropertiesDialog::applyViewProperties()
     m_dolphinView->setShowPreview(m_viewProps->showPreview());
     m_dolphinView->setShowHiddenFiles(m_viewProps->showHiddenFiles());
 
-    m_isDirty = false;
-
-    if (m_useAsDefault && m_useAsDefault->isChecked()) {
-        // For directories where no .directory file is available, the .directory
-        // file stored for the global view properties is used as fallback. To update
-        // this file we temporary turn on the global view properties mode.
-        GeneralSettings* settings = DolphinSettings::instance().generalSettings();
-        Q_ASSERT(!settings->globalViewProps());
+    m_viewProps->save();
 
-        settings->setGlobalViewProps(true);
-        ViewProperties defaultProps(m_dolphinView->url());
-        defaultProps.setDirProperties(*m_viewProps);
-        defaultProps.save();
-        settings->setGlobalViewProps(false);
-    }
+    m_isDirty = false;
 }
 
 void ViewPropertiesDialog::loadSettings()