From 8c8504964e6186e899c4e403c1f1f32b8c526fac Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 20 Jul 2007 03:34:20 +0000 Subject: [PATCH] * disable copying of Applet due to dptr-but-no-copy-ctor * provide an accessor to the Package object. * some const corrections svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=690105 --- applet.cpp | 7 ++++++- applet.h | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/applet.cpp b/applet.cpp index dde026eb9..e053a922a 100644 --- a/applet.cpp +++ b/applet.cpp @@ -186,7 +186,7 @@ KConfigGroup Applet::globalConfig() const return KConfigGroup(d->globalConfig, "General"); } -DataEngine* Applet::dataEngine(const QString& name) +DataEngine* Applet::dataEngine(const QString& name) const { int index = d->loadedEngines.indexOf(name); if (index != -1) { @@ -201,6 +201,11 @@ DataEngine* Applet::dataEngine(const QString& name) return engine; } +const Package* Applet::package() const +{ + return d->package; +} + void Applet::constraintsUpdated() { kDebug() << "Applet::constraintsUpdate(): constraints are FormFactor: " << formFactor() << ", Location: " << location() << endl; diff --git a/applet.h b/applet.h index b5cd4de98..e8ba64fb5 100644 --- a/applet.h +++ b/applet.h @@ -33,6 +33,7 @@ namespace Plasma { class DataEngine; +class Package; /** * @short The base Applet (Plasmoid) class @@ -116,7 +117,15 @@ class PLASMA_EXPORT Applet : public QObject, public Widget * or an invalid data engine if the requested engine * could not be loaded */ - DataEngine* dataEngine(const QString& name); + DataEngine* dataEngine(const QString& name) const; + + /** + * Accessor for the associated Package object if any. + * Generally, only Plasmoids come in a Package. + * + * @return the Package object, or 0 if none + **/ + const Package* package() const; /** * Called when any of the geometry constraints have been updated. @@ -390,6 +399,8 @@ class PLASMA_EXPORT Applet : public QObject, public Widget bool eventFilter( QObject *o, QEvent *e ); private: + Q_DISABLE_COPY(Applet) + // Reimplemented from QGraphicsItem void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);