From: Peter Penz Date: Mon, 15 Oct 2007 14:34:12 +0000 (+0000) Subject: use KGlobal::config() instead of parsing kdeglobals each time (thanks to David for... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a23a882c68fb399f895ebed253cf2ad09944a347 use KGlobal::config() instead of parsing kdeglobals each time (thanks to David for the hint!) svn path=/trunk/KDE/kdebase/apps/; revision=725485 --- diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index cbc1893c9..4b58809bd 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -277,8 +277,7 @@ void DolphinContextMenu::insertDefaultItemActions(KMenu* popup) popup->addAction(renameAction); // insert 'Move to Trash' and (optionally) 'Delete' - const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals"); - const KConfigGroup kdeConfig(globalConfig, "KDE"); + KConfigGroup kdeConfig(KGlobal::config(), "KDE"); bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false); const KUrl& url = m_mainWindow->activeViewContainer()->url(); if (url.isLocalFile()) { diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp index 4aa762b88..5584350b3 100644 --- a/src/generalsettingspage.cpp +++ b/src/generalsettingspage.cpp @@ -137,14 +137,12 @@ void GeneralSettingsPage::applySettings() settings->setEditableUrl(m_editableUrl->isChecked()); settings->setFilterBar(m_filterBar->isChecked()); - KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals"); - - KConfigGroup trashConfig(globalConfig, "Trash"); + KConfigGroup trashConfig(KGlobal::config(), "Trash"); trashConfig.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked()); trashConfig.writeEntry("ConfirmDelete", m_confirmDelete->isChecked()); trashConfig.sync(); - KConfigGroup kdeConfig(globalConfig, "KDE"); + KConfigGroup kdeConfig(KGlobal::config(), "KDE"); kdeConfig.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked()); kdeConfig.sync(); } @@ -155,9 +153,6 @@ void GeneralSettingsPage::restoreDefaults() settings->setDefaults(); // TODO: reset default settings for trash and show delete command... - //KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals"); - //KConfigGroup trashConfig(konqConfig, "Trash"); - //KConfigGroup kdeConfig(globalConfig, "KDE"); loadSettings(); } @@ -190,13 +185,11 @@ void GeneralSettingsPage::loadSettings() m_editableUrl->setChecked(settings->editableUrl()); m_filterBar->setChecked(settings->filterBar()); - const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals"); - - const KConfigGroup trashConfig(globalConfig, "Trash"); + const KConfigGroup trashConfig(KGlobal::config(), "Trash"); m_confirmMoveToTrash->setChecked(trashConfig.readEntry("ConfirmTrash", false)); m_confirmDelete->setChecked(trashConfig.readEntry("ConfirmDelete", true)); - const KConfigGroup kdeConfig(globalConfig, "KDE"); + const KConfigGroup kdeConfig(KGlobal::config(), "KDE"); m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false)); } diff --git a/src/treeviewcontextmenu.cpp b/src/treeviewcontextmenu.cpp index b53241b18..d095ee13d 100644 --- a/src/treeviewcontextmenu.cpp +++ b/src/treeviewcontextmenu.cpp @@ -75,8 +75,7 @@ void TreeViewContextMenu::open() popup->addAction(renameAction); // insert 'Move to Trash' and (optionally) 'Delete' - const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals"); - const KConfigGroup kdeConfig(globalConfig, "KDE"); + KConfigGroup kdeConfig(KGlobal::config(), "KDE"); bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false); const KUrl& url = m_fileInfo.url(); if (url.isLocalFile()) {