On Friday 12 September 2008 06:24:08 Petri Damstén wrote: > patch for: > - configChanged functions in Applet and AppletScript > - connected to configXml configChanged() and applyClicked/okClicked (for > C++ applets) > - package typo mainconfiggui -> mainconfigui > - and some Q_UNUSED to remove warnings
Additional fix to package. Fix icon path in services (not in plasmoid dir). It also seems that I have to run kbuildsycoca and restart plasma before I get installed plasmoid to Add Widgets (I run svn plasma on top of kubuntu kde 4.1.1. They have different sycoca dirs but I'm not sure if that can have something to do with it). Petri
Index: scripting/appletscript.h =================================================================== --- scripting/appletscript.h (revision 860117) +++ scripting/appletscript.h (working copy) @@ -125,6 +125,11 @@ */ virtual void showConfigurationInterface(); + /** + * Configure was changed. + */ + virtual void configChanged(); + protected: /** * @arg engine name of the engine Index: scripting/appletscript.cpp =================================================================== --- scripting/appletscript.cpp (revision 860117) +++ scripting/appletscript.cpp (working copy) @@ -93,6 +93,7 @@ void AppletScript::setHasConfigurationInterface(bool hasInterface) { + Q_UNUSED(hasInterface) if (applet()) { applet()->setHasConfigurationInterface(true); } @@ -102,6 +103,10 @@ { } +void AppletScript::configChanged() +{ +} + DataEngine* AppletScript::dataEngine(const QString &engine) const { Q_ASSERT(d->applet); Index: applet.h =================================================================== --- applet.h (revision 860117) +++ applet.h (working copy) @@ -594,6 +594,11 @@ 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 * the widget that should be shown in this extender item. This function might look something Index: package.cpp =================================================================== --- package.cpp (revision 860117) +++ package.cpp (working copy) @@ -346,6 +346,8 @@ QString iconPath = targetName + '/' + cg.readEntry("Icon"); QFile icon(iconPath); if (icon.exists()) { + KDesktopFile df(service); + KConfigGroup cg = df.desktopGroup(); cg.writeEntry("Icon", iconPath); } } @@ -427,6 +429,7 @@ const QString &destination, const QString &icon) // static { + Q_UNUSED(icon) if (!metadata.isValid()) { kWarning(550) << "Metadata file is not complete"; return false; Index: applet.cpp =================================================================== --- applet.cpp (revision 860117) +++ applet.cpp (working copy) @@ -190,7 +190,7 @@ //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 *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,6 +651,9 @@ void Applet::paintWindowFrame(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * 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); @@ -1238,12 +1241,21 @@ 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) @@ -1642,6 +1654,7 @@ // 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()) { Index: private/packages.cpp =================================================================== --- private/packages.cpp (revision 860117) +++ private/packages.cpp (working copy) @@ -48,7 +48,7 @@ mimetypes << "text/*"; setMimetypes("scripts", mimetypes); - addFileDefinition("mainconfiggui", "ui/config.ui", i18n("Main Config UI File")); + addFileDefinition("mainconfigui", "ui/config.ui", i18n("Main Config UI File")); addFileDefinition("mainconfigxml", "config/main.xml", i18n("Configuration XML file")); addFileDefinition("mainscript", "code/main", i18n("Main Script File")); setRequired("mainscript", true);
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel