From: Peter Penz Date: Mon, 30 Jan 2012 15:36:40 +0000 (+0100) Subject: Synchronize view-mode settings before the settings dialog gets opened X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/e283a9f7d9cd0e77c159316e4f98108b28f917ce Synchronize view-mode settings before the settings dialog gets opened BUG: 292698 FIXED-IN: 4.8.1 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 74b751f5a..074185f49 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1118,7 +1118,10 @@ void DolphinMainWindow::openTerminal() void DolphinMainWindow::editSettings() { if (!m_settingsDialog) { - const KUrl url = activeViewContainer()->url(); + DolphinViewContainer* container = activeViewContainer(); + container->view()->writeSettings(); + + const KUrl url = container->url(); DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this); connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews())); settingsDialog->setAttribute(Qt::WA_DeleteOnClose); @@ -2066,9 +2069,9 @@ void DolphinMainWindow::refreshViews() const int tabCount = m_viewTab.count(); for (int i = 0; i < tabCount; ++i) { - m_viewTab[i].primaryView->refresh(); + m_viewTab[i].primaryView->readSettings(); if (m_viewTab[i].secondaryView) { - m_viewTab[i].secondaryView->refresh(); + m_viewTab[i].secondaryView->readSettings(); } } diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 6c6683d91..8720e0ce2 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -591,7 +591,7 @@ void DolphinPartBrowserExtension::pasteTo(const KUrl&) void DolphinPartBrowserExtension::reparseConfiguration() { - m_part->view()->refresh(); + m_part->view()->readSettings(); } //// diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 72c943eb4..2d2e20ff6 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -211,7 +211,7 @@ DolphinSearchBox* DolphinViewContainer::searchBox() return m_searchBox; } -void DolphinViewContainer::refresh() +void DolphinViewContainer::readSettings() { if (GeneralSettings::modifiedStartupSettings()) { // The startup settings should only get applied if they have been @@ -222,8 +222,8 @@ void DolphinViewContainer::refresh() setFilterBarVisible(GeneralSettings::filterBar()); } - m_view->refresh(); - m_statusBar->refresh(); + m_view->readSettings(); + m_statusBar->readSettings(); } bool DolphinViewContainer::isFilterBarVisible() const diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index ee9f83dea..59b3c79ed 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -86,7 +86,7 @@ public: /** * Refreshes the view container to get synchronized with the (updated) Dolphin settings. */ - void refresh(); + void readSettings(); /** Returns true, if the filter bar is visible. */ bool isFilterBarVisible() const; diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp index b5cacf787..47aad7dd2 100644 --- a/src/settings/viewmodes/viewsettingstab.cpp +++ b/src/settings/viewmodes/viewsettingstab.cpp @@ -155,7 +155,9 @@ void ViewSettingsTab::loadSettings() m_textWidthBox->setCurrentIndex(IconsModeSettings::textWidthIndex()); } - const ViewModeSettings settings(viewMode()); + ViewModeSettings settings(viewMode()); + settings.readConfig(); + const QSize iconSize(settings.iconSize(), settings.iconSize()); m_defaultSizeSlider->setValue(ZoomLevelInfo::zoomLevelForIconSize(iconSize)); diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index c733ebe02..b01f6042c 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -254,7 +254,7 @@ QString DolphinStatusBar::defaultText() const return m_messageLabel->defaultText(); } -void DolphinStatusBar::refresh() +void DolphinStatusBar::readSettings() { setExtensionsVisible(true); } diff --git a/src/statusbar/dolphinstatusbar.h b/src/statusbar/dolphinstatusbar.h index 32d603ac5..789656b8e 100644 --- a/src/statusbar/dolphinstatusbar.h +++ b/src/statusbar/dolphinstatusbar.h @@ -112,7 +112,7 @@ public: /** * Refreshes the status bar to get synchronized with the (updated) Dolphin settings. */ - void refresh(); + void readSettings(); signals: /** diff --git a/src/views/dolphinitemlistcontainer.cpp b/src/views/dolphinitemlistcontainer.cpp index 7c32f982a..c687ede4d 100644 --- a/src/views/dolphinitemlistcontainer.cpp +++ b/src/views/dolphinitemlistcontainer.cpp @@ -59,10 +59,8 @@ DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister, DolphinItemListContainer::~DolphinItemListContainer() { - IconsModeSettings::self()->writeConfig(); - CompactModeSettings::self()->writeConfig(); - DetailsModeSettings::self()->writeConfig(); - + writeSettings(); + controller()->setView(0); delete m_fileItemListView; m_fileItemListView = 0; @@ -170,7 +168,7 @@ void DolphinItemListContainer::endTransaction() m_fileItemListView->endTransaction(); } -void DolphinItemListContainer::refresh() +void DolphinItemListContainer::readSettings() { ViewModeSettings settings(viewMode()); settings.readConfig(); @@ -192,6 +190,13 @@ void DolphinItemListContainer::refresh() endTransaction(); } +void DolphinItemListContainer::writeSettings() +{ + IconsModeSettings::self()->writeConfig(); + CompactModeSettings::self()->writeConfig(); + DetailsModeSettings::self()->writeConfig(); +} + void DolphinItemListContainer::updateGridSize() { const ViewModeSettings settings(viewMode()); diff --git a/src/views/dolphinitemlistcontainer.h b/src/views/dolphinitemlistcontainer.h index 251552cc8..fa816b48c 100644 --- a/src/views/dolphinitemlistcontainer.h +++ b/src/views/dolphinitemlistcontainer.h @@ -64,10 +64,8 @@ public: void beginTransaction(); void endTransaction(); - /** - * Refreshs the view by reapplying the (changed) viewmode settings. - */ - void refresh(); + void readSettings(); + void writeSettings(); private: void updateGridSize(); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 1e300c5cf..ef39414c9 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -446,13 +446,19 @@ void DolphinView::stopLoading() m_dirLister->stop(); } -void DolphinView::refresh() +void DolphinView::readSettings() { GeneralSettings::self()->readConfig(); - m_container->refresh(); + m_container->readSettings(); applyViewProperties(); } +void DolphinView::writeSettings() +{ + GeneralSettings::self()->writeConfig(); + m_container->writeSettings(); +} + void DolphinView::setNameFilter(const QString& nameFilter) { fileItemModel()->setNameFilter(nameFilter); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 197a41046..56ebbe402 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -265,11 +265,15 @@ public: void stopLoading(); /** - * Refreshes the view to get synchronized with the (updated) Dolphin settings. - * This method only needs to get invoked if the view settings for the Icons View, - * Details View or Columns View have been changed. + * Refreshes the view to get synchronized with the settings (e.g. icons size, + * font, ...). */ - void refresh(); + void readSettings(); + + /** + * Saves the current settings (e.g. icons size, font, ..). + */ + void writeSettings(); /** * Filters the currently shown items by \a nameFilter. All items