X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3d4e6938f57fcf010b4fda7255384098327eb67d..629ec98952bcf38bc99f2b11bc37bdc2ec7aabcc:/src/viewpropertiesdialog.cpp diff --git a/src/viewpropertiesdialog.cpp b/src/viewpropertiesdialog.cpp index 844a2ecf9..c0db408f2 100644 --- a/src/viewpropertiesdialog.cpp +++ b/src/viewpropertiesdialog.cpp @@ -101,8 +101,8 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : QWidget* sortingBox = new QWidget(propsGrid); m_sortOrder = new QComboBox(sortingBox); - m_sortOrder->addItem(i18nc("@item:inlistbox", "Ascending")); - m_sortOrder->addItem(i18nc("@item:inlistbox", "Descending")); + m_sortOrder->addItem(i18nc("@item:inlistbox Sort", "Ascending")); + m_sortOrder->addItem(i18nc("@item:inlistbox Sort", "Descending")); m_sorting = new QComboBox(sortingBox); m_sorting->addItem(i18nc("@item:inlistbox Sort", "By Name")); @@ -320,8 +320,9 @@ void ViewPropertiesDialog::applyViewProperties() } ViewPropsProgressInfo* info = new ViewPropsProgressInfo(m_dolphinView, - m_dolphinView->url(), - *m_viewProps); + m_dolphinView->url(), + *m_viewProps); + info->setAttribute(Qt::WA_DeleteOnClose); info->setWindowModality(Qt::NonModal); info->show(); } @@ -329,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) { @@ -345,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()); @@ -355,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()