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) {
|
if (d->configLoader) {
|
||||||
// we're saving so we know its changed, we don't need or want the configChanged
|
// 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
|
// 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();
|
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) {
|
if (!configLoader) {
|
||||||
// the config loader will trigger this for us, so we don't need to.
|
// 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())) {
|
if (KConfigDialog *dialog = qobject_cast<KConfigDialog *>(q->sender())) {
|
||||||
dialog->enableButton(KDialog::Apply, false);
|
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()
|
void Applet::configChanged()
|
||||||
{
|
{
|
||||||
if (d->script && d->configLoader) {
|
|
||||||
d->configLoader->readConfig();
|
|
||||||
d->script->configChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
||||||
@ -2694,7 +2707,7 @@ void AppletPrivate::setupScriptSupport()
|
|||||||
QFile file(xmlPath);
|
QFile file(xmlPath);
|
||||||
KConfigGroup config = q->config();
|
KConfigGroup config = q->config();
|
||||||
configLoader = new ConfigLoader(&config, &file);
|
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()) {
|
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 updateShortcuts())
|
||||||
Q_PRIVATE_SLOT(d, void publishCheckboxStateChanged(int state))
|
Q_PRIVATE_SLOT(d, void publishCheckboxStateChanged(int state))
|
||||||
Q_PRIVATE_SLOT(d, void globalShortcutChanged())
|
Q_PRIVATE_SLOT(d, void globalShortcutChanged())
|
||||||
|
Q_PRIVATE_SLOT(d, void propagateConfigChanged())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplemented from QGraphicsItem
|
* Reimplemented from QGraphicsItem
|
||||||
|
@ -2118,13 +2118,15 @@ void Containment::showConfigurationInterface()
|
|||||||
|
|
||||||
void Containment::configChanged()
|
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()
|
void ContainmentPrivate::requestConfiguration()
|
||||||
|
@ -133,6 +133,7 @@ public:
|
|||||||
void updateShortcuts();
|
void updateShortcuts();
|
||||||
void publishCheckboxStateChanged(int state);
|
void publishCheckboxStateChanged(int state);
|
||||||
void globalShortcutChanged();
|
void globalShortcutChanged();
|
||||||
|
void propagateConfigChanged();
|
||||||
|
|
||||||
static KActionCollection* defaultActions(QObject *parent);
|
static KActionCollection* defaultActions(QObject *parent);
|
||||||
static QSet<QString> knownCategories();
|
static QSet<QString> knownCategories();
|
||||||
|
@ -107,6 +107,7 @@ public:
|
|||||||
void addContainmentActions(KMenu &desktopMenu, QEvent *event);
|
void addContainmentActions(KMenu &desktopMenu, QEvent *event);
|
||||||
void addAppletActions(KMenu &desktopMenu, Applet *applet, QEvent *event);
|
void addAppletActions(KMenu &desktopMenu, Applet *applet, QEvent *event);
|
||||||
void checkRemoveAction();
|
void checkRemoveAction();
|
||||||
|
void configChanged();
|
||||||
|
|
||||||
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
|
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
|
||||||
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
|
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user