be more careful with our configChanged signals

svn path=/trunk/KDE/kdelibs/; revision=973255
This commit is contained in:
Aaron J. Seigo 2009-05-26 17:32:33 +00:00
parent b41714f56d
commit 376de3b3b7

View File

@ -1,3 +1,5 @@
#ifndef APPLET_CPP
#define APPLET_CPP
/* /*
* Copyright 2005 by Aaron Seigo <aseigo@kde.org> * Copyright 2005 by Aaron Seigo <aseigo@kde.org>
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org> * Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>
@ -244,12 +246,14 @@ void Applet::save(KConfigGroup &g) const
} }
KConfigGroup appletConfigGroup(&group, "Configuration"); KConfigGroup appletConfigGroup(&group, "Configuration");
//FIXME: we need a global save state too
saveState(appletConfigGroup); saveState(appletConfigGroup);
if (d->configLoader) { if (d->configLoader) {
// we're saving so we know its changed, we don't need or want the configChanged
// signal bubbling up at this point due to that
disconnect(d->configLoader, SIGNAL(configChanged()), this, SLOT(configChanged()));
d->configLoader->writeConfig(); d->configLoader->writeConfig();
connect(d->configLoader, SIGNAL(configChanged()), this, SLOT(configChanged()));
} }
} }
@ -1558,8 +1562,6 @@ void Applet::showConfigurationInterface()
d->addGlobalShortcutsPage(dialog); d->addGlobalShortcutsPage(dialog);
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configDialogFinished())); connect(dialog, SIGNAL(applyClicked()), this, SLOT(configDialogFinished()));
connect(dialog, SIGNAL(okClicked()), this, SLOT(configDialogFinished())); connect(dialog, SIGNAL(okClicked()), this, SLOT(configDialogFinished()));
//FIXME: in this case use another ad-hoc slot?
connect(dialog, SIGNAL(finished()), this, SLOT(configDialogFinished()));
dialog->show(); dialog->show();
} else if (d->script) { } else if (d->script) {
d->script->showConfigurationInterface(); d->script->showConfigurationInterface();
@ -1620,7 +1622,6 @@ KConfigDialog *AppletPrivate::generateGenericConfigDialog()
dialog->showButton(KDialog::Apply, false); dialog->showButton(KDialog::Apply, false);
QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished())); QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished()));
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished())); QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
QObject::connect(dialog, SIGNAL(finished()), q, SLOT(configDialogFinished()));
QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater())); QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
return dialog; return dialog;
} }
@ -1660,7 +1661,10 @@ void AppletPrivate::configDialogFinished()
} }
} }
if (!configLoader) {
// the config loader will trigger this for us, so we don't need to.
q->configChanged(); q->configChanged();
}
} }
void AppletPrivate::updateShortcuts() void AppletPrivate::updateShortcuts()
@ -2495,3 +2499,4 @@ void AppletOverlayWidget::paint(QPainter *painter,
#include "applet.moc" #include "applet.moc"
#include "private/applet_p.moc" #include "private/applet_p.moc"
#endif // APPLET_CPP