diff --git a/applet.cpp b/applet.cpp index 3d8f7b8db..f2f03b9f8 100644 --- a/applet.cpp +++ b/applet.cpp @@ -190,7 +190,7 @@ void Applet::save(KConfigGroup &g) const //which isn't very nice. foreach (ExtenderItem *item, extender()->attachedItems()) { if (!item->isDetached() || item->autoExpireDelay()) { - //destroy temporary extender items, or items that aren't detached, so their + //destroy temporary extender items, or items that aren't detached, so their //configuration won't linger after a plasma restart. item->destroy(); } @@ -443,7 +443,7 @@ QGraphicsView *Applet::view() const QGraphicsView *found = 0; QGraphicsView *possibleFind = 0; foreach (QGraphicsView *view, scene()->views()) { - kDebug() << "checking" << view->sceneRect() << "against" << sceneBoundingRect() + kDebug() << "checking" << view->sceneRect() << "against" << sceneBoundingRect() << scenePos(); if (view->sceneRect().intersects(sceneBoundingRect()) || view->sceneRect().contains(scenePos())) { @@ -651,9 +651,9 @@ bool Applet::hasFailedToLaunch() const void Applet::paintWindowFrame(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { - Q_UNUSED( painter ); - Q_UNUSED( option ); - Q_UNUSED( widget ); + Q_UNUSED(painter) + Q_UNUSED(option) + Q_UNUSED(widget) //Here come the code for the window frame //kDebug() << windowFrameGeometry(); //painter->drawRoundedRect(windowFrameGeometry(), 5, 5); @@ -1241,12 +1241,21 @@ void Applet::showConfigurationInterface() connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater())); //TODO: Apply button does not correctly work for now, so do not show it dialog->showButton( KDialog::Apply, false ); + connect(dialog, SIGNAL(applyClicked()), this, SLOT(configChanged())); + connect(dialog, SIGNAL(okClicked()), this, SLOT(configChanged())); dialog->show(); } emit releaseVisualFocus(); } +void Applet::configChanged() +{ + if (d->script) { + d->script->configChanged(); + } +} + void Applet::createConfigurationInterface(KConfigDialog *parent) { Q_UNUSED(parent) @@ -1645,6 +1654,7 @@ void AppletPrivate::setupScriptSupport() // FIXME: KConfigSkeleton doesn't play well with KConfigGroup =/ KConfigGroup config = q->config(); configXml = new ConfigXml(&config, &file); + QObject::connect(configXml, SIGNAL(configChanged()), q, SLOT(configChanged())); } if (!package->filePath("mainconfigui").isEmpty()) { diff --git a/applet.h b/applet.h index aa90ac8d1..c1e5ced20 100644 --- a/applet.h +++ b/applet.h @@ -593,6 +593,11 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget **/ virtual void init(); + /** + * Called when applet configuration values has changed. + */ + virtual void configChanged(); + /** * Get's called when and extender item has to be initialized after a plasma restart. If you * create ExtenderItems in your applet, you should implement this function to again create diff --git a/scripting/appletscript.cpp b/scripting/appletscript.cpp index 84a336150..824038490 100644 --- a/scripting/appletscript.cpp +++ b/scripting/appletscript.cpp @@ -93,6 +93,7 @@ QPainterPath AppletScript::shape() const void AppletScript::setHasConfigurationInterface(bool hasInterface) { + Q_UNUSED(hasInterface) if (applet()) { applet()->setHasConfigurationInterface(true); } @@ -102,6 +103,10 @@ void AppletScript::showConfigurationInterface() { } +void AppletScript::configChanged() +{ +} + DataEngine* AppletScript::dataEngine(const QString &engine) const { Q_ASSERT(d->applet); diff --git a/scripting/appletscript.h b/scripting/appletscript.h index 7d688f40c..57417ea97 100644 --- a/scripting/appletscript.h +++ b/scripting/appletscript.h @@ -125,6 +125,11 @@ public Q_SLOTS: */ virtual void showConfigurationInterface(); + /** + * Configure was changed. + */ + virtual void configChanged(); + protected: /** * @arg engine name of the engine