reintroduce busy property in Applet
both the comic and weather applet have to pick out the _plasma_graphicsObject to access the AppletInterface object just to set the busy property on it. this reintroduces the busy proeprty in Applet too, both setting it to Applet or AppletInterface will keep them in sync REVIEW:127411
This commit is contained in:
parent
0e9976afb1
commit
2661cd701c
@ -360,6 +360,21 @@ void Applet::setIcon(const QString &icon)
|
||||
emit iconChanged(icon);
|
||||
}
|
||||
|
||||
bool Applet::isBusy() const
|
||||
{
|
||||
return d->busy;
|
||||
}
|
||||
|
||||
void Applet::setBusy(bool busy)
|
||||
{
|
||||
if (busy == d->busy) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->busy = busy;
|
||||
emit busyChanged(busy);
|
||||
}
|
||||
|
||||
KPluginInfo Applet::pluginInfo() const
|
||||
{
|
||||
return d->appletDescription;
|
||||
|
@ -73,6 +73,7 @@ class PLASMA_EXPORT Applet : public QObject
|
||||
Q_PROPERTY(Plasma::Types::Location location READ location NOTIFY locationChanged)
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
|
||||
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged FINAL)
|
||||
Q_PROPERTY(bool busy READ isBusy WRITE setBusy NOTIFY busyChanged FINAL)
|
||||
|
||||
public:
|
||||
//CONSTRUCTORS
|
||||
@ -323,6 +324,23 @@ public:
|
||||
*/
|
||||
void setIcon(const QString &icon);
|
||||
|
||||
/**
|
||||
* @returns true if the applet should show a busy status, for instance doing
|
||||
* some network operation
|
||||
* @since 5.21
|
||||
*/
|
||||
bool isBusy() const;
|
||||
|
||||
/**
|
||||
* Sets the Applet to have a busy status hint, for instance the applet doing
|
||||
* some network operation.
|
||||
* The graphical representation of the busy status depends completely from
|
||||
* the visualization.
|
||||
* @param busy true if the applet is busy
|
||||
* @since 5.21
|
||||
*/
|
||||
void setBusy(bool busy);
|
||||
|
||||
//ACTIONS
|
||||
/**
|
||||
* Returns a list of context-related QAction instances.
|
||||
@ -431,6 +449,12 @@ Q_SIGNALS:
|
||||
*/
|
||||
void iconChanged(const QString &icon);
|
||||
|
||||
/**
|
||||
* Emitted when the busy status has changed
|
||||
* @since 5.21
|
||||
*/
|
||||
void busyChanged(bool busy);
|
||||
|
||||
//CONFIGURATION
|
||||
/**
|
||||
* Emitted when an applet has changed values in its configuration
|
||||
|
@ -74,7 +74,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
||||
needsConfig(false),
|
||||
started(false),
|
||||
globalShortcutEnabled(false),
|
||||
userConfiguring(false)
|
||||
userConfiguring(false),
|
||||
busy(false)
|
||||
{
|
||||
if (appletId == 0) {
|
||||
appletId = ++s_maxAppletId;
|
||||
|
@ -119,6 +119,7 @@ public:
|
||||
bool started : 1;
|
||||
bool globalShortcutEnabled : 1;
|
||||
bool userConfiguring : 1;
|
||||
bool busy : 1;
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
@ -56,7 +56,6 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
|
||||
m_toolTipItem(0),
|
||||
m_args(args),
|
||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||
m_busy(false),
|
||||
m_hideOnDeactivate(true),
|
||||
m_oldKeyboardShortcut(0),
|
||||
m_dummyNativeInterface(0),
|
||||
@ -86,6 +85,9 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
|
||||
connect(applet(), &Plasma::Applet::iconChanged,
|
||||
this, &AppletInterface::iconChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::busyChanged,
|
||||
this, &AppletInterface::busyChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::activated,
|
||||
this, &AppletInterface::activated);
|
||||
|
||||
@ -125,7 +127,6 @@ AppletInterface::AppletInterface(Plasma::Applet *a, const QVariantList &args, QQ
|
||||
m_toolTipTextFormat(0),
|
||||
m_args(args),
|
||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||
m_busy(false),
|
||||
m_hideOnDeactivate(true),
|
||||
m_oldKeyboardShortcut(0),
|
||||
m_dummyNativeInterface(0),
|
||||
@ -151,6 +152,15 @@ AppletInterface::AppletInterface(Plasma::Applet *a, const QVariantList &args, QQ
|
||||
connect(applet(), &Plasma::Applet::destroyedChanged,
|
||||
this, &AppletInterface::destroyedChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::titleChanged,
|
||||
this, &AppletInterface::titleChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::iconChanged,
|
||||
this, &AppletInterface::iconChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::busyChanged,
|
||||
this, &AppletInterface::busyChanged);
|
||||
|
||||
connect(appletScript(), &DeclarativeAppletScript::formFactorChanged,
|
||||
this, &AppletInterface::formFactorChanged);
|
||||
connect(appletScript(), &DeclarativeAppletScript::locationChanged,
|
||||
@ -385,17 +395,12 @@ void AppletInterface::setToolTipItem(QQuickItem *toolTipItem)
|
||||
|
||||
bool AppletInterface::isBusy() const
|
||||
{
|
||||
return m_busy;
|
||||
return applet()->isBusy();
|
||||
}
|
||||
|
||||
void AppletInterface::setBusy(bool busy)
|
||||
{
|
||||
if (m_busy == busy) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_busy = busy;
|
||||
emit busyChanged();
|
||||
applet()->setBusy(busy);
|
||||
}
|
||||
|
||||
Plasma::Types::BackgroundHints AppletInterface::backgroundHints() const
|
||||
|
@ -428,7 +428,6 @@ private:
|
||||
QPointer<QQuickItem> m_toolTipItem;
|
||||
QVariantList m_args;
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
bool m_busy : 1;
|
||||
bool m_hideOnDeactivate : 1;
|
||||
//this is used to build an emacs style shortcut
|
||||
int m_oldKeyboardShortcut;
|
||||
|
Loading…
Reference in New Issue
Block a user