move the status stuff into Applet, constify and also put a bit of apidox

(forgotten from the previous commit:))

svn path=/trunk/KDE/kdelibs/; revision=993912
This commit is contained in:
Marco Martin 2009-07-09 17:19:00 +00:00
parent 2a0e957d14
commit a3c54b201c
5 changed files with 33 additions and 21 deletions

View File

@ -1019,6 +1019,17 @@ QVariantList Applet::startupArguments() const
return d->args;
}
ItemStatus Applet::status() const
{
return d->itemStatus;
}
void Applet::setStatus(const ItemStatus status)
{
d->itemStatus = status;
emit newStatus(status);
}
void Applet::flushPendingConstraintsEvents()
{
if (d->pendingConstraints == NoConstraint) {
@ -2191,6 +2202,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
actions(AppletPrivate::defaultActions(applet)),
activationAction(0),
shortcutEditor(0),
itemStatus(UnknownStatus),
constraintsTimerId(0),
modificationsTimerId(-1),
hasConfigurationInterface(false),

View File

@ -687,6 +687,11 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/
void appletDestroyed(Plasma::Applet *applet);
/**
* Emitted when the applet status changes
* @since 4.4
*/
void newStatus(Plasma::ItemStatus status);
public Q_SLOTS:
/**
@ -760,6 +765,18 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/
QVariantList startupArguments() const;
/**
* @return the status of the applet
* @since 4.4
*/
ItemStatus status() const;
/**
* sets the status for this applet
* @since 4.4
*/
void setStatus(const ItemStatus stat);
protected:
/**
* This constructor is to be used with the plugin loading systems

View File

@ -251,14 +251,15 @@ enum MessageButton {
Q_DECLARE_FLAGS(MessageButtons, MessageButton)
/**
* Status of an applet...
* FIXME: this will have to move in PopupApplet? or find an api-less way?
* Status of an applet
* @since 4.3
*/
enum ItemStatus {
UnknownStatus = 0,
PassiveStatus = 1,
ActiveStatus = 2,
NeedsAttentionStatus = 3
NeedsAttentionStatus = 3,
AcceptingInputStatus = 4
};
Q_ENUMS(ItemStatus)

View File

@ -481,17 +481,6 @@ bool PopupApplet::isPopupShowing() const
return d->dialog && d->dialog->isVisible();
}
ItemStatus PopupApplet::status()
{
return d->itemStatus;
}
void PopupApplet::setStatus(ItemStatus status)
{
d->itemStatus = status;
emit newStatus(status);
}
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
: q(applet),
icon(0),
@ -500,7 +489,6 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
popupPlacement(Plasma::FloatingPopup),
savedAspectRatio(Plasma::InvalidAspectRatioMode),
timer(0),
itemStatus(UnknownStatus),
popupLostFocus(false),
passive(false)
{

View File

@ -108,9 +108,6 @@ public:
*/
bool isPopupShowing() const;
ItemStatus status();
void setStatus(ItemStatus stat);
public Q_SLOTS:
/**
* Hides the popup.
@ -146,9 +143,6 @@ protected:
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
void dropEvent(QGraphicsSceneDragDropEvent *event);
Q_SIGNALS:
void newStatus(ItemStatus status);
private:
Q_PRIVATE_SLOT(d, void internalTogglePopup())
Q_PRIVATE_SLOT(d, void hideTimedPopup())