diff --git a/applet.cpp b/applet.cpp index b9492586d..5c118de1b 100644 --- a/applet.cpp +++ b/applet.cpp @@ -342,9 +342,9 @@ Applet::Applet(QGraphicsItem *parent, d->init(this); } -Applet::Applet(QObject* parentObject, const QStringList& args) +Applet::Applet(QObject* parentObject, const QVariantList& args) : Widget(0,parentObject), - d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0] : QString()), + d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()), args.count() > 1 ? args[1].toInt() : 0)) { d->init(this); @@ -689,7 +689,7 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW d->shadow->generate(); } - qreal zoomLevel = painter->transform().m11() / transform().m11(); + //qreal zoomLevel = painter->transform().m11() / transform().m11(); //kDebug() << "qreal " << zoomLevel << " = " << painter->transform().m11() << " / " << transform().m11(); //if (fabs(zoomLevel - scalingFactor(Plasma::DesktopZoom)) < std::numeric_limits::epsilon()) { // Show Desktop if (d->background) { @@ -911,7 +911,7 @@ QStringList Applet::knownCategories(const QString &parentApp) return categories; } -Applet* Applet::loadApplet(const QString& appletName, uint appletId, const QStringList& args) +Applet* Applet::loadApplet(const QString& appletName, uint appletId, const QVariantList& args) { if (appletName.isEmpty()) { return 0; @@ -931,20 +931,19 @@ Applet* Applet::loadApplet(const QString& appletName, uint appletId, const QStri appletId = Private::nextId(); } - QStringList allArgs; - QString id; - id.setNum(appletId); - allArgs << offers.first()->storageId() << id << args; - Applet* applet = KService::createInstance(offers.first(), 0, allArgs); + QVariantList allArgs; + allArgs << offers.first()->storageId() << appletId << args; + QString error; + Applet* applet = KService::createInstance(offers.first(), 0, allArgs, &error); if (!applet) { - kDebug() << "Couldn't load applet \"" << appletName << "\"!"; + kDebug() << "Couldn't load applet \"" << appletName << "\"! reason given: " << error; } return applet; } -Applet* Applet::loadApplet(const KPluginInfo& info, uint appletId, const QStringList& args) +Applet* Applet::loadApplet(const KPluginInfo& info, uint appletId, const QVariantList& args) { if (!info.isValid()) { return 0; diff --git a/applet.h b/applet.h index d83f9c180..800f22560 100644 --- a/applet.h +++ b/applet.h @@ -91,7 +91,7 @@ class PLASMA_EXPORT Applet : public Widget * @arg args a list of strings containing two entries: the service id * and the applet id */ - Applet(QObject* parent, const QStringList& args); + Applet(QObject* parent, const QVariantList& args); ~Applet(); @@ -300,7 +300,7 @@ class PLASMA_EXPORT Applet : public Widget * @return a pointer to the loaded applet, or 0 on load failure **/ static Applet* loadApplet(const QString &name, uint appletId = 0, - const QStringList& args = QStringList()); + const QVariantList& args = QVariantList()); /** * Attempts to load an applet @@ -315,7 +315,7 @@ class PLASMA_EXPORT Applet : public Widget * @return a pointer to the loaded applet, or 0 on load failure **/ static Applet* loadApplet(const KPluginInfo& info, uint appletId = 0, - const QStringList& args = QStringList()); + const QVariantList& args = QVariantList()); /** * This method is called when the interface should be painted. @@ -579,8 +579,7 @@ class PLASMA_EXPORT Applet : public Widget * Register an applet when it is contained in a loadable module */ #define K_EXPORT_PLASMA_APPLET(libname, classname) \ - K_EXPORT_COMPONENT_FACTORY( \ - plasma_applet_##libname, \ - KGenericFactory("plasma_applet_" #libname)) +K_PLUGIN_FACTORY(factory, registerPlugin();) \ +K_EXPORT_PLUGIN(factory("plasma_applet_" #libname)) #endif // multiple inclusion guard diff --git a/corona.cpp b/corona.cpp index b90ba8e85..c9761e256 100644 --- a/corona.cpp +++ b/corona.cpp @@ -192,11 +192,11 @@ void Corona::saveApplets() const void Corona::loadApplets(const QString& config) { clearApplets(); - + KConfig appletConfig(config, KConfig::OnlyLocal); foreach (const QString& group, appletConfig.groupList()) { KConfigGroup cg(&appletConfig, group); - addApplet(cg.readEntry("plugin", QString()), QStringList(), + addApplet(cg.readEntry("plugin", QString()), QVariantList(), group.toUInt(), cg.readEntry("geometry", QRectF())); } } @@ -212,7 +212,7 @@ void Corona::clearApplets() d->applets.clear(); } -Applet* Corona::addApplet(const QString& name, const QStringList& args, uint id, const QRectF& geometry) +Applet* Corona::addApplet(const QString& name, const QVariantList& args, uint id, const QRectF& geometry) { Applet* applet = Applet::loadApplet(name, id, args); if (!applet) { @@ -303,7 +303,7 @@ void Corona::dropEvent(QGraphicsSceneDragDropEvent *event) QString plasmoidName; plasmoidName = event->mimeData()->data(d->mimetype); QRectF geom(event->scenePos(), QSize(0, 0)); - addApplet(plasmoidName, QStringList(), 0, geom); + addApplet(plasmoidName, QVariantList(), 0, geom); event->acceptProposedAction(); } else if (KUrl::List::canDecode(event->mimeData())) { KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); @@ -311,7 +311,7 @@ void Corona::dropEvent(QGraphicsSceneDragDropEvent *event) KMimeType::Ptr mime = KMimeType::findByUrl(url); QString mimeName = mime->name(); QRectF geom(event->scenePos(), QSize(0, 0)); - QStringList args; + QVariantList args; args << url.url(); // kDebug() << mimeName; KPluginInfo::List appletList = Applet::knownAppletsForMimetype(mimeName); diff --git a/corona.h b/corona.h index 75858964f..2bdd64906 100644 --- a/corona.h +++ b/corona.h @@ -134,7 +134,7 @@ public Q_SLOTS: * * @return a pointer to the applet on success, or 0 on failure */ - Applet* addApplet(const QString& name, const QStringList& args = QStringList(), + Applet* addApplet(const QString& name, const QVariantList& args = QVariantList(), uint id = 0, const QRectF &geometry = QRectF(-1, -1, -1, -1)); /** diff --git a/glapplet.cpp b/glapplet.cpp index 3fd3e24d8..5ceb94ae9 100644 --- a/glapplet.cpp +++ b/glapplet.cpp @@ -74,7 +74,7 @@ GLApplet::GLApplet(QGraphicsItem *parent, } } -GLApplet::GLApplet(QObject *parent, const QStringList &args) +GLApplet::GLApplet(QObject *parent, const QVariantList &args) : Applet(parent, args), d(new Private) { diff --git a/glapplet.h b/glapplet.h index 453e91cee..2535d0d50 100644 --- a/glapplet.h +++ b/glapplet.h @@ -56,7 +56,7 @@ class PLASMA_EXPORT GLApplet : public Applet * @arg args a list of strings containing two entries: the service id * and the applet id */ - GLApplet(QObject *parent, const QStringList &args); + GLApplet(QObject *parent, const QVariantList &args); ~GLApplet();