FEATURE: expose the activity name and id
expose activity name and activityid in the containment wrapper interface
This commit is contained in:
parent
da186219ae
commit
2754c01add
@ -453,9 +453,12 @@ ContainmentInterface::ContainmentInterface(AbstractJsAppletScript *parent)
|
||||
connect(containment(), SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAddedForward(Plasma::Applet *, const QPointF &)));
|
||||
|
||||
connect(containment(), SIGNAL(screenChanged(int, int, Plasma::Containment)), this, SLOT(screenChanged()));
|
||||
|
||||
connect(containment()->context(), SIGNAL(activityChanged(Plasma::Context *)), this, SIGNAL(activityNameChanged()));
|
||||
connect(containment()->context(), SIGNAL(changed(Plasma::Context *)), this, SIGNAL(activityIdChanged()));
|
||||
}
|
||||
|
||||
QScriptValue ContainmentInterface::applets()
|
||||
QScriptValue ContainmentInterface::applets()
|
||||
{
|
||||
QScriptValue list = m_appletScriptEngine->engine()->newArray(containment()->applets().size());
|
||||
int i = 0;
|
||||
@ -556,6 +559,16 @@ bool ContainmentInterface::hasMovableApplets() const
|
||||
return m_movableApplets;
|
||||
}
|
||||
|
||||
QString ContainmentInterface::activityName() const
|
||||
{
|
||||
return containment()->context()->currentActivity();
|
||||
}
|
||||
|
||||
QString ContainmentInterface::activityId() const
|
||||
{
|
||||
return containment()->context()->currentActivityId();
|
||||
}
|
||||
|
||||
#ifndef USE_JS_SCRIPTENGINE
|
||||
#include "appletinterface.moc"
|
||||
#endif
|
||||
|
@ -367,6 +367,8 @@ class ContainmentInterface : public APPLETSUPERCLASS
|
||||
Q_PROPERTY(Type containmentType READ containmentType WRITE setContainmentType)
|
||||
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
||||
Q_PROPERTY(bool movableApplets READ hasMovableApplets WRITE setMovableApplets)
|
||||
Q_PROPERTY(QString activityName READ activityName NOTIFY activityNameChanged)
|
||||
Q_PROPERTY(QString activityId READ activityId NOTIFY activityIdChanged)
|
||||
Q_ENUMS(Type)
|
||||
|
||||
public:
|
||||
@ -393,6 +395,9 @@ public:
|
||||
void setMovableApplets(bool movable);
|
||||
bool hasMovableApplets() const;
|
||||
|
||||
QString activityName() const;
|
||||
QString activityId() const;
|
||||
|
||||
Q_INVOKABLE QScriptValue screenGeometry(int id) const;
|
||||
Q_INVOKABLE QScriptValue availableScreenRegion(int id) const;
|
||||
|
||||
@ -400,6 +405,8 @@ Q_SIGNALS:
|
||||
void appletAdded(QGraphicsWidget *applet, const QPointF &pos);
|
||||
void appletRemoved(QGraphicsWidget *applet);
|
||||
void screenChanged();
|
||||
void activityNameChanged();
|
||||
void activityIdChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void appletAddedForward(Plasma::Applet *applet, const QPointF &pos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user