diff --git a/applet.cpp b/applet.cpp index 1a746a392..009c3ca89 100644 --- a/applet.cpp +++ b/applet.cpp @@ -95,6 +95,17 @@ public: delete package; } + void init(Applet* applet) + { + if (!appletDescription) { + applet->setFailedToLaunch(true); + } + + applet->setImmutable(applet->globalConfig().isImmutable() || + applet->config().isImmutable()); + + } + static uint nextId() { ++s_maxAppletId; @@ -127,7 +138,7 @@ Applet::Applet(QGraphicsItem *parent, Widget(parent), d(new Private(KService::serviceByStorageId(serviceID), appletId)) { - init(); + d->init(this); } Applet::Applet(QObject* parent, const QStringList& args) @@ -136,7 +147,7 @@ Applet::Applet(QObject* parent, const QStringList& args) d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0] : QString()), args.count() > 1 ? args[1].toInt() : 0)) { - init(); + d->init(this); // the brain damage seen in the initialization list is due to the // inflexibility of KService::createInstance } @@ -147,16 +158,6 @@ Applet::~Applet() delete d; } -void Applet::init() -{ - if (!d->appletDescription) { - setFailedToLaunch(true); - } - - setImmutable(globalConfig().isImmutable() || - config().isImmutable()); -} - KConfigGroup Applet::config() const { if (!d->appletConfig) { diff --git a/applet.h b/applet.h index cc0b5e4fc..671fa21e6 100644 --- a/applet.h +++ b/applet.h @@ -324,9 +324,16 @@ class PLASMA_EXPORT Applet : public QObject, public Widget **/ void setFailedToLaunch(bool failed, const QString& reason = QString()); - // Reimplemented from QGraphicsItem enum { Type = Plasma::AppletType }; + + /** + * Reimplemented from QGraphicsItem + **/ int type() const { return Type; } + + /** + * Reimplemented from QGraphicsItem + **/ QRectF boundingRect () const; Q_SIGNALS: @@ -401,11 +408,11 @@ class PLASMA_EXPORT Applet : public QObject, public Widget private: Q_DISABLE_COPY(Applet) - // Reimplemented from QGraphicsItem + /** + * Reimplemented from QGraphicsItem + **/ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - void init(); - class Private; Private* const d; };