Now when you click the button "Defaults" in the settings dialog, it will push the settings to the UI, then the user can apply, cancel, or modify them from there. Also removed the message box prompt. Use settings->useDefaults(true), then set it back to false after you are done loading settings in the restoreDefaults() method calls. Don't use ->setDefaults() normally, anymore.

svn path=/trunk/KDE/kdebase/apps/; revision=919897
This commit is contained in:
Shaun Reich 2009-02-01 20:43:26 +00:00
parent 3df531dcf6
commit 9f7c2424d9
8 changed files with 16 additions and 15 deletions

View file

@ -133,11 +133,10 @@ void BehaviorSettingsPage::applySettings()
void BehaviorSettingsPage::restoreDefaults() void BehaviorSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); //TODO: Reset default settings for both trash and show delete commands (confirmations).
settings->useDefaults(true);
// TODO: reset default settings for trash and show delete command...
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void BehaviorSettingsPage::loadSettings() void BehaviorSettingsPage::loadSettings()

View file

@ -71,8 +71,9 @@ void ContextMenuSettingsPage::applySettings()
void ContextMenuSettingsPage::restoreDefaults() void ContextMenuSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void ContextMenuSettingsPage::loadSettings() void ContextMenuSettingsPage::loadSettings()

View file

@ -102,10 +102,7 @@ void DolphinSettingsDialog::slotButtonClicked(int button)
if ((button == Ok) || (button == Apply)) { if ((button == Ok) || (button == Apply)) {
applySettings(); applySettings();
} else if (button == Default) { } else if (button == Default) {
const QString text(i18nc("@info", "All settings will be reset to default values. Do you want to continue?")); restoreDefaults();
if (KMessageBox::questionYesNo(this, text) == KMessageBox::Yes) {
restoreDefaults();
}
} }
KPageDialog::slotButtonClicked(button); KPageDialog::slotButtonClicked(button);
@ -130,7 +127,6 @@ void DolphinSettingsDialog::restoreDefaults()
foreach (SettingsPageBase* page, m_pages) { foreach (SettingsPageBase* page, m_pages) {
page->restoreDefaults(); page->restoreDefaults();
} }
DolphinApplication::app()->refreshMainWindows();
} }
#include "dolphinsettingsdialog.moc" #include "dolphinsettingsdialog.moc"

View file

@ -94,8 +94,9 @@ void NavigationSettingsPage::applySettings()
void NavigationSettingsPage::restoreDefaults() void NavigationSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void NavigationSettingsPage::loadSettings() void NavigationSettingsPage::loadSettings()

View file

@ -99,8 +99,9 @@ void PreviewsSettingsPage::applySettings()
void PreviewsSettingsPage::restoreDefaults() void PreviewsSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void PreviewsSettingsPage::loadSettings() void PreviewsSettingsPage::loadSettings()

View file

@ -44,8 +44,9 @@ void ServicesSettingsPage::applySettings()
void ServicesSettingsPage::restoreDefaults() void ServicesSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void ServicesSettingsPage::loadSettings() void ServicesSettingsPage::loadSettings()

View file

@ -131,8 +131,9 @@ void StartupSettingsPage::applySettings()
void StartupSettingsPage::restoreDefaults() void StartupSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void StartupSettingsPage::selectHomeUrl() void StartupSettingsPage::selectHomeUrl()

View file

@ -67,8 +67,9 @@ void StatusBarSettingsPage::applySettings()
void StatusBarSettingsPage::restoreDefaults() void StatusBarSettingsPage::restoreDefaults()
{ {
GeneralSettings* settings = DolphinSettings::instance().generalSettings(); GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults(); settings->useDefaults(true);
loadSettings(); loadSettings();
settings->useDefaults(false);
} }
void StatusBarSettingsPage::loadSettings() void StatusBarSettingsPage::loadSettings()