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
This commit is contained in:
Rob Scheepmaker 2008-10-25 13:41:00 +00:00
parent caef45dcf9
commit 704fad3d81
4 changed files with 29 additions and 29 deletions

View File

@ -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;
};

View File

@ -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();

View File

@ -275,7 +275,7 @@ void ExtenderItem::setAutoExpireDelay(uint time)
}
}
bool ExtenderItem::autoExpireDelay() const
uint ExtenderItem::autoExpireDelay() const
{
if (d->expirationTimer) {
return d->expirationTimer->interval();

View File

@ -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.