ensure that the containment configChanged() routine always happens
This commit is contained in:
parent
2c3a5ef8fa
commit
fbb50df067
29
applet.cpp
29
applet.cpp
@ -293,9 +293,9 @@ void Applet::save(KConfigGroup &g) const
|
||||
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()));
|
||||
disconnect(d->configLoader, SIGNAL(configChanged()), this, SLOT(propagateConfigChanged()));
|
||||
d->configLoader->writeConfig();
|
||||
connect(d->configLoader, SIGNAL(configChanged()), this, SLOT(configChanged()));
|
||||
connect(d->configLoader, SIGNAL(configChanged()), this, SLOT(propagateConfigChanged()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2038,7 +2038,7 @@ void AppletPrivate::configDialogFinished()
|
||||
|
||||
if (!configLoader) {
|
||||
// the config loader will trigger this for us, so we don't need to.
|
||||
q->configChanged();
|
||||
propagateConfigChanged();
|
||||
if (KConfigDialog *dialog = qobject_cast<KConfigDialog *>(q->sender())) {
|
||||
dialog->enableButton(KDialog::Apply, false);
|
||||
}
|
||||
@ -2072,12 +2072,25 @@ void AppletPrivate::updateShortcuts()
|
||||
}
|
||||
}
|
||||
|
||||
void AppletPrivate::propagateConfigChanged()
|
||||
{
|
||||
if (script && configLoader) {
|
||||
configLoader->readConfig();
|
||||
script->configChanged();
|
||||
}
|
||||
|
||||
if (isContainment) {
|
||||
Containment *c = qobject_cast<Containment *>(q);
|
||||
if (c) {
|
||||
c->d->configChanged();
|
||||
}
|
||||
}
|
||||
|
||||
q->configChanged();
|
||||
}
|
||||
|
||||
void Applet::configChanged()
|
||||
{
|
||||
if (d->script && d->configLoader) {
|
||||
d->configLoader->readConfig();
|
||||
d->script->configChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
||||
@ -2694,7 +2707,7 @@ void AppletPrivate::setupScriptSupport()
|
||||
QFile file(xmlPath);
|
||||
KConfigGroup config = q->config();
|
||||
configLoader = new ConfigLoader(&config, &file);
|
||||
QObject::connect(configLoader, SIGNAL(configChanged()), q, SLOT(configChanged()));
|
||||
QObject::connect(configLoader, SIGNAL(configChanged()), q, SLOT(propagateConfigChanged()));
|
||||
}
|
||||
|
||||
if (!package->filePath("mainconfigui").isEmpty()) {
|
||||
|
1
applet.h
1
applet.h
@ -1121,6 +1121,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
Q_PRIVATE_SLOT(d, void updateShortcuts())
|
||||
Q_PRIVATE_SLOT(d, void publishCheckboxStateChanged(int state))
|
||||
Q_PRIVATE_SLOT(d, void globalShortcutChanged())
|
||||
Q_PRIVATE_SLOT(d, void propagateConfigChanged())
|
||||
|
||||
/**
|
||||
* Reimplemented from QGraphicsItem
|
||||
|
@ -2118,13 +2118,15 @@ void Containment::showConfigurationInterface()
|
||||
|
||||
void Containment::configChanged()
|
||||
{
|
||||
if (d->drawWallpaper) {
|
||||
KConfigGroup group = config();
|
||||
setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper),
|
||||
group.readEntry("wallpaperpluginmode", defaultWallpaperMode));
|
||||
}
|
||||
}
|
||||
|
||||
Applet::configChanged();
|
||||
void ContainmentPrivate::configChanged()
|
||||
{
|
||||
if (drawWallpaper) {
|
||||
KConfigGroup group = q->config();
|
||||
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper),
|
||||
group.readEntry("wallpaperpluginmode", defaultWallpaperMode));
|
||||
}
|
||||
}
|
||||
|
||||
void ContainmentPrivate::requestConfiguration()
|
||||
|
@ -133,6 +133,7 @@ public:
|
||||
void updateShortcuts();
|
||||
void publishCheckboxStateChanged(int state);
|
||||
void globalShortcutChanged();
|
||||
void propagateConfigChanged();
|
||||
|
||||
static KActionCollection* defaultActions(QObject *parent);
|
||||
static QSet<QString> knownCategories();
|
||||
|
@ -107,6 +107,7 @@ public:
|
||||
void addContainmentActions(KMenu &desktopMenu, QEvent *event);
|
||||
void addAppletActions(KMenu &desktopMenu, Applet *applet, QEvent *event);
|
||||
void checkRemoveAction();
|
||||
void configChanged();
|
||||
|
||||
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
|
||||
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user