diff options
| author | Peter Penz <[email protected]> | 2011-11-06 11:58:48 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-11-06 11:59:26 +0100 |
| commit | 3c77ffe832a00f405e474f11da7b39d37a410a5b (patch) | |
| tree | 2d84d23b993e759710127a296b9f5a19d62cea90 /src/settings | |
| parent | 4fcb5662a784b8490c989cfda84e5ee649334418 (diff) | |
Delete obsolete class DolphinSettings
Diffstat (limited to 'src/settings')
| -rw-r--r-- | src/settings/dolphinsettings.cpp | 59 | ||||
| -rw-r--r-- | src/settings/dolphinsettings.h | 71 | ||||
| -rw-r--r-- | src/settings/dolphinsettingsdialog.cpp | 3 | ||||
| -rw-r--r-- | src/settings/general/behaviorsettingspage.cpp | 14 | ||||
| -rw-r--r-- | src/settings/general/contextmenusettingspage.cpp | 11 | ||||
| -rw-r--r-- | src/settings/general/previewssettingspage.cpp | 1 | ||||
| -rw-r--r-- | src/settings/general/statusbarsettingspage.cpp | 11 | ||||
| -rw-r--r-- | src/settings/navigation/navigationsettingspage.cpp | 11 | ||||
| -rw-r--r-- | src/settings/startup/startupsettingspage.cpp | 20 | ||||
| -rw-r--r-- | src/settings/trash/trashsettingspage.cpp | 2 | ||||
| -rw-r--r-- | src/settings/viewpropertiesdialog.cpp | 13 |
11 files changed, 33 insertions, 183 deletions
diff --git a/src/settings/dolphinsettings.cpp b/src/settings/dolphinsettings.cpp deleted file mode 100644 index aae684201..000000000 --- a/src/settings/dolphinsettings.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz ([email protected]), * - * Cvetoslav Ludmiloff and Patrice Tremblay * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "dolphinsettings.h" - -#include <KFilePlacesModel> -#include <KComponentData> -#include <KLocale> -#include <KStandardDirs> - -#include "dolphin_detailsmodesettings.h" -#include "dolphin_generalsettings.h" -#include "dolphin_iconsmodesettings.h" - -class DolphinSettingsSingleton -{ -public: - DolphinSettings instance; -}; -K_GLOBAL_STATIC(DolphinSettingsSingleton, s_settings) - -DolphinSettings& DolphinSettings::instance() -{ - return s_settings->instance; -} - -void DolphinSettings::save() -{ - m_generalSettings->writeConfig(); -} - -DolphinSettings::DolphinSettings() -{ - m_generalSettings = GeneralSettings::self(); - m_placesModel = new KFilePlacesModel(); -} - -DolphinSettings::~DolphinSettings() -{ - delete m_placesModel; - m_placesModel = 0; -} diff --git a/src/settings/dolphinsettings.h b/src/settings/dolphinsettings.h deleted file mode 100644 index 88e1d2905..000000000 --- a/src/settings/dolphinsettings.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * [email protected] * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef DOLPHINSETTINGS_H -#define DOLPHINSETTINGS_H - -#include <libdolphin_export.h> - -class GeneralSettings; -class KFilePlacesModel; - -// TODO: Remove this class completely and just work with the settings directly instead - -/** - * @brief Manages and stores all settings from Dolphin. - * - * The following properties are stored: - * - home URL - * - default view mode - * - URL navigator state (editable or not) - * - Text completion state - * - split view - * - properties for views - */ -class LIBDOLPHINPRIVATE_EXPORT DolphinSettings -{ -public: - static DolphinSettings& instance(); - - GeneralSettings* generalSettings() const; - KFilePlacesModel* placesModel() const; - virtual void save(); - -protected: - DolphinSettings(); - virtual ~DolphinSettings(); - friend class DolphinSettingsSingleton; - -private: - GeneralSettings* m_generalSettings; - KFilePlacesModel* m_placesModel; -}; - -inline GeneralSettings* DolphinSettings::generalSettings() const -{ - return m_generalSettings; -} - -inline KFilePlacesModel* DolphinSettings::placesModel() const -{ - return m_placesModel; -} - -#endif diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 79a241aca..609e2ab92 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -22,7 +22,6 @@ #include <dolphinapplication.h> #include <dolphinmainwindow.h> -#include "dolphinsettings.h" #include "dolphin_generalsettings.h" #include "general/generalsettingspage.h" #include "navigation/navigationsettingspage.h" @@ -132,7 +131,7 @@ void DolphinSettingsDialog::applySettings() emit settingsChanged(); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); if (settings->modifiedStartupSettings()) { // Reset the modified startup settings hint. The changed startup settings // have been applied already due to emitting settingsChanged(). diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp index 8a5b070ce..3ad66e367 100644 --- a/src/settings/general/behaviorsettingspage.cpp +++ b/src/settings/general/behaviorsettingspage.cpp @@ -21,7 +21,6 @@ #include "behaviorsettingspage.h" #include "dolphin_generalsettings.h" -#include <settings/dolphinsettings.h> #include <KDialog> #include <KLocale> @@ -156,7 +155,7 @@ void BehaviorSettingsPage::applySettings() void BehaviorSettingsPage::restoreDefaults() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->useDefaults(true); loadSettings(); settings->useDefaults(false); @@ -166,8 +165,7 @@ void BehaviorSettingsPage::restoreDefaults() void BehaviorSettingsPage::loadSettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - if (settings->globalViewProps()) { + if (GeneralSettings::globalViewProps()) { m_globalProps->setChecked(true); } else { m_localProps->setChecked(true); @@ -178,10 +176,10 @@ void BehaviorSettingsPage::loadSettings() m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", CONFIRM_TRASH)); m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", CONFIRM_DELETE)); - m_confirmClosingMultipleTabs->setChecked(settings->confirmClosingMultipleTabs()); - m_renameInline->setChecked(settings->renameInline()); - m_showToolTips->setChecked(settings->showToolTips()); - m_showSelectionToggle->setChecked(settings->showSelectionToggle()); + m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs()); + m_renameInline->setChecked(GeneralSettings::renameInline()); + m_showToolTips->setChecked(GeneralSettings::showToolTips()); + m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle()); m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); } diff --git a/src/settings/general/contextmenusettingspage.cpp b/src/settings/general/contextmenusettingspage.cpp index e9c00fd73..142a942a3 100644 --- a/src/settings/general/contextmenusettingspage.cpp +++ b/src/settings/general/contextmenusettingspage.cpp @@ -19,7 +19,6 @@ #include "contextmenusettingspage.h" -#include <settings/dolphinsettings.h> #include <dolphin_generalsettings.h> #include <KDialog> @@ -68,14 +67,13 @@ void ContextMenuSettingsPage::applySettings() configGroup.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked()); configGroup.sync(); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked()); - settings->writeConfig(); + GeneralSettings::setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked()); + GeneralSettings::self()->writeConfig(); } void ContextMenuSettingsPage::restoreDefaults() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->useDefaults(true); loadSettings(); settings->useDefaults(false); @@ -88,8 +86,7 @@ void ContextMenuSettingsPage::loadSettings() KConfigGroup configGroup(globalConfig, "KDE"); m_showDeleteCommand->setChecked(configGroup.readEntry("ShowDeleteCommand", SHOW_DELETE)); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu()); + m_showCopyMoveMenu->setChecked(GeneralSettings::showCopyMoveMenu()); } #include "contextmenusettingspage.moc" diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp index 3c3211d47..913ca0817 100644 --- a/src/settings/general/previewssettingspage.cpp +++ b/src/settings/general/previewssettingspage.cpp @@ -30,7 +30,6 @@ #include <KServiceTypeTrader> #include <KService> -#include <settings/dolphinsettings.h> #include <settings/serviceitemdelegate.h> #include <settings/servicemodel.h> diff --git a/src/settings/general/statusbarsettingspage.cpp b/src/settings/general/statusbarsettingspage.cpp index 0e85a1295..8ba0d7337 100644 --- a/src/settings/general/statusbarsettingspage.cpp +++ b/src/settings/general/statusbarsettingspage.cpp @@ -25,8 +25,6 @@ #include <KLocale> #include <KVBox> -#include <settings/dolphinsettings.h> - #include <QCheckBox> #include <QVBoxLayout> @@ -62,7 +60,7 @@ StatusBarSettingsPage::~StatusBarSettingsPage() void StatusBarSettingsPage::applySettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->setShowZoomSlider(m_showZoomSlider->isChecked()); settings->setShowSpaceInfo(m_showSpaceInfo->isChecked()); settings->writeConfig(); @@ -70,7 +68,7 @@ void StatusBarSettingsPage::applySettings() void StatusBarSettingsPage::restoreDefaults() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->useDefaults(true); loadSettings(); settings->useDefaults(false); @@ -78,9 +76,8 @@ void StatusBarSettingsPage::restoreDefaults() void StatusBarSettingsPage::loadSettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_showZoomSlider->setChecked(settings->showZoomSlider()); - m_showSpaceInfo->setChecked(settings->showSpaceInfo()); + m_showZoomSlider->setChecked(GeneralSettings::showZoomSlider()); + m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo()); } #include "statusbarsettingspage.moc" diff --git a/src/settings/navigation/navigationsettingspage.cpp b/src/settings/navigation/navigationsettingspage.cpp index 1d9c8950f..8076d705d 100644 --- a/src/settings/navigation/navigationsettingspage.cpp +++ b/src/settings/navigation/navigationsettingspage.cpp @@ -19,8 +19,6 @@ #include "navigationsettingspage.h" -#include "settings/dolphinsettings.h" - #include "dolphin_generalsettings.h" #include <KDialog> @@ -88,7 +86,7 @@ void NavigationSettingsPage::applySettings() config.sync(); KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked()); settings->setAutoExpandFolders(m_autoExpandFolders->isChecked()); @@ -97,7 +95,7 @@ void NavigationSettingsPage::applySettings() void NavigationSettingsPage::restoreDefaults() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->useDefaults(true); loadSettings(); settings->useDefaults(false); @@ -113,9 +111,8 @@ void NavigationSettingsPage::loadSettings() const bool singleClick = KGlobalSettings::singleClick(); m_singleClick->setChecked(singleClick); m_doubleClick->setChecked(!singleClick); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_openArchivesAsFolder->setChecked(settings->browseThroughArchives()); - m_autoExpandFolders->setChecked(settings->autoExpandFolders()); + m_openArchivesAsFolder->setChecked(GeneralSettings::browseThroughArchives()); + m_autoExpandFolders->setChecked(GeneralSettings::autoExpandFolders()); } #include "navigationsettingspage.moc" diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp index ce6139d1d..43c176560 100644 --- a/src/settings/startup/startupsettingspage.cpp +++ b/src/settings/startup/startupsettingspage.cpp @@ -19,7 +19,6 @@ #include "startupsettingspage.h" -#include "settings/dolphinsettings.h" #include "dolphinmainwindow.h" #include "dolphinviewcontainer.h" @@ -111,7 +110,7 @@ StartupSettingsPage::~StartupSettingsPage() void StartupSettingsPage::applySettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); const KUrl url(m_homeUrl->text()); KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url); @@ -131,7 +130,7 @@ void StartupSettingsPage::applySettings() void StartupSettingsPage::restoreDefaults() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->useDefaults(true); loadSettings(); settings->useDefaults(false); @@ -142,9 +141,7 @@ void StartupSettingsPage::slotSettingsChanged() // Provide a hint that the startup settings have been changed. This allows the views // to apply the startup settings only if they have been explicitly changed by the user // (see bug #254947). - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setModifiedStartupSettings(true); - + GeneralSettings::setModifiedStartupSettings(true); emit changed(); } @@ -171,13 +168,12 @@ void StartupSettingsPage::useDefaultLocation() void StartupSettingsPage::loadSettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - KUrl url(settings->homeUrl()); + const KUrl url(GeneralSettings::homeUrl()); m_homeUrl->setText(url.prettyUrl()); - m_splitView->setChecked(settings->splitView()); - m_editableUrl->setChecked(settings->editableUrl()); - m_showFullPath->setChecked(settings->showFullPath()); - m_filterBar->setChecked(settings->filterBar()); + m_splitView->setChecked(GeneralSettings::splitView()); + m_editableUrl->setChecked(GeneralSettings::editableUrl()); + m_showFullPath->setChecked(GeneralSettings::showFullPath()); + m_filterBar->setChecked(GeneralSettings::filterBar()); } #include "startupsettingspage.moc" diff --git a/src/settings/trash/trashsettingspage.cpp b/src/settings/trash/trashsettingspage.cpp index b8294bffd..cd699856c 100644 --- a/src/settings/trash/trashsettingspage.cpp +++ b/src/settings/trash/trashsettingspage.cpp @@ -23,8 +23,6 @@ #include <KDialog> #include <KVBox> -#include <settings/dolphinsettings.h> - #include <QVBoxLayout> TrashSettingsPage::TrashSettingsPage(QWidget* parent) : diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index f3a5caa1d..3e96bebed 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -22,7 +22,6 @@ #include "additionalinfodialog.h" #include "views/dolphinview.h" -#include "settings/dolphinsettings.h" #include "dolphin_generalsettings.h" #include "dolphin_iconsmodesettings.h" #include "viewpropsprogressinfo.h" @@ -73,7 +72,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_useAsDefault(0) { Q_ASSERT(dolphinView); - const bool useGlobalViewProps = DolphinSettings::instance().generalSettings()->globalViewProps(); + const bool useGlobalViewProps = GeneralSettings::globalViewProps(); setCaption(i18nc("@title:window", "View Properties")); setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply); @@ -348,14 +347,13 @@ void ViewPropertiesDialog::applyViewProperties() // 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()); + Q_ASSERT(!GeneralSettings::globalViewProps()); - settings->setGlobalViewProps(true); + GeneralSettings::setGlobalViewProps(true); ViewProperties defaultProps(m_dolphinView->url()); defaultProps.setDirProperties(*m_viewProps); defaultProps.save(); - settings->setGlobalViewProps(false); + GeneralSettings::setGlobalViewProps(false); } if (applyToAllFolders) { @@ -366,8 +364,9 @@ void ViewPropertiesDialog::applyViewProperties() // Updating the global view properties time stamp in the general settings makes // all existing viewproperties invalid, as they have a smaller time stamp. - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + GeneralSettings* settings = GeneralSettings::self(); settings->setViewPropsTimestamp(QDateTime::currentDateTime()); + settings->writeConfig(); } m_dolphinView->setMode(m_viewProps->viewMode()); |
