From 704fad3d81eeffa870efaa47df5956c2cea45bbf Mon Sep 17 00:00:00 2001 From: Rob Scheepmaker Date: Sat, 25 Oct 2008 13:41:00 +0000 Subject: [PATCH] Small extender api improvements: * extender() -> protected * initExtenderItem() no longer a slot * autoExpireDelay return uint instead of bool svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=875751 --- applet.h | 50 ++++++++++++++++++++++++------------------------ extender.cpp | 4 ++-- extenderitem.cpp | 2 +- extenderitem.h | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/applet.h b/applet.h index ea3f3928f..e2af15d60 100644 --- a/applet.h +++ b/applet.h @@ -513,6 +513,25 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget */ virtual void removeAssociatedWidget(QWidget *widget); + /** + * 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 + * like this: + * + * @code + * SuperCoolWidget *widget = new SuperCoolWidget(); + * dataEngine("engine")->connectSource(item->config("dataSourceName"), widget); + * item->setWidget(widget); + * @endcode + * + * You can also add one or more custom qactions to this extender item in this function. + * + * Note that by default, not all ExtenderItems are persistent. Only items that are detached, + * will have there configuration stored when plasma exists. + */ + virtual void initExtenderItem(ExtenderItem *item); + /** * @param parent the QGraphicsItem this applet is parented to * @param serviceId the name of the .desktop file containing the @@ -616,30 +635,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget */ 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 - * like this: - * - * @code - * SuperCoolWidget *widget = new SuperCoolWidget(); - * dataEngine("engine")->connectSource(item->config("dataSourceName"), widget); - * item->setWidget(widget); - * @endcode - * - * You can also add one or more custom qactions to this extender item in this function. - * - * Note that by default, not all ExtenderItems are persistent. Only items that are detached, - * will have there configuration stored when plasma exists. - */ - virtual void initExtenderItem(ExtenderItem *item); - - /** - * @return the extender this applet has. - */ - Extender *extender() const; - protected: /** * This constructor is to be used with the plugin loading systems @@ -751,6 +746,12 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget */ bool isRegisteredAsDragHandle(QGraphicsItem *item); + + /** + * @return the extender this applet has. + */ + Extender *extender() const; + /** * @internal event filter; used for focus watching **/ @@ -838,7 +839,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget friend class PopupApplet; friend class PopupAppletPrivate; - //FIXME: this shouldn't be necesarry. friend class Extender; friend class ExtenderItem; }; diff --git a/extender.cpp b/extender.cpp index 149037745..0d37555db 100644 --- a/extender.cpp +++ b/extender.cpp @@ -50,8 +50,8 @@ Extender::Extender(Applet *applet) << "The previous extender will be destroyed."; delete applet->d->extender; } - applet->d->extender = this; + setContentsMargins(0, 0, 0, 0); d->layout = new QGraphicsLinearLayout(this); d->layout->setOrientation(Qt::Vertical); @@ -65,7 +65,7 @@ Extender::Extender(Applet *applet) d->emptyExtenderLabel->setText(d->emptyExtenderMessage); d->emptyExtenderLabel->setMinimumSize(QSizeF(150, 64)); d->emptyExtenderLabel->setPreferredSize(QSizeF(200, 64)); - d->emptyExtenderLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + d->emptyExtenderLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); d->layout->addItem(d->emptyExtenderLabel); d->loadExtenderItems(); diff --git a/extenderitem.cpp b/extenderitem.cpp index 01333fb7b..91c67a0b0 100644 --- a/extenderitem.cpp +++ b/extenderitem.cpp @@ -275,7 +275,7 @@ void ExtenderItem::setAutoExpireDelay(uint time) } } -bool ExtenderItem::autoExpireDelay() const +uint ExtenderItem::autoExpireDelay() const { if (d->expirationTimer) { return d->expirationTimer->interval(); diff --git a/extenderitem.h b/extenderitem.h index d53ba9431..fce756dbc 100644 --- a/extenderitem.h +++ b/extenderitem.h @@ -171,7 +171,7 @@ class PLASMA_EXPORT ExtenderItem : public QGraphicsWidget /** * @return whether or not this extender item has an auto expire delay. */ - bool autoExpireDelay() const; + uint autoExpireDelay() const; /** * @return whether or not this item is detached from it's original source.