emit externalData only after the ui is here
This commit is contained in:
parent
a7928f29dd
commit
ac963b8a27
@ -51,8 +51,9 @@
|
||||
|
||||
Q_DECLARE_METATYPE(AppletInterface *)
|
||||
|
||||
AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent)
|
||||
AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariantList &args, QQuickItem *parent)
|
||||
: AppletQuickItem(script->applet(), parent),
|
||||
m_args(args),
|
||||
m_actionSignals(0),
|
||||
m_appletScriptEngine(script),
|
||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||
@ -86,8 +87,9 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
||||
}
|
||||
}
|
||||
|
||||
AppletInterface::AppletInterface(Plasma::Applet *a, QQuickItem *parent)
|
||||
AppletInterface::AppletInterface(Plasma::Applet *a, const QVariantList &args, QQuickItem *parent)
|
||||
: AppletQuickItem(a, parent),
|
||||
m_args(args),
|
||||
m_actionSignals(0),
|
||||
m_appletScriptEngine(0),
|
||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||
@ -151,6 +153,12 @@ void AppletInterface::init()
|
||||
i->forceActiveFocus(Qt::ShortcutFocusReason);
|
||||
}
|
||||
});
|
||||
|
||||
if (m_args.count() == 1) {
|
||||
emit externalData(QString(), m_args.first());
|
||||
} else if (m_args.count() > 0) {
|
||||
emit externalData(QString(), m_args);
|
||||
}
|
||||
}
|
||||
|
||||
Plasma::Types::FormFactor AppletInterface::formFactor() const
|
||||
|
@ -166,8 +166,8 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
|
||||
Q_PROPERTY(QKeySequence globalShortcut READ globalShortcut WRITE setGlobalShortcut NOTIFY globalShortcutChanged)
|
||||
|
||||
public:
|
||||
AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0);
|
||||
AppletInterface(Plasma::Applet *applet, QQuickItem *parent = 0);
|
||||
AppletInterface(DeclarativeAppletScript *script, const QVariantList &args = QVariantList(), QQuickItem *parent = 0);
|
||||
AppletInterface(Plasma::Applet *applet, const QVariantList &args = QVariantList(), QQuickItem *parent = 0);
|
||||
~AppletInterface();
|
||||
|
||||
//API not intended for the QML part
|
||||
@ -332,6 +332,7 @@ private:
|
||||
|
||||
QString m_toolTipMainText;
|
||||
QString m_toolTipSubText;
|
||||
QVariantList m_args;
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
bool m_busy : 1;
|
||||
bool m_hideOnDeactivate : 1;
|
||||
|
@ -52,8 +52,8 @@
|
||||
#include "kdeclarative/configpropertymap.h"
|
||||
#include <packageurlinterceptor.h>
|
||||
|
||||
ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
|
||||
: AppletInterface(parent),
|
||||
ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, const QVariantList &args)
|
||||
: AppletInterface(parent, args),
|
||||
m_wallpaperInterface(0),
|
||||
m_activityInfo(0)
|
||||
{
|
||||
@ -505,7 +505,7 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet)
|
||||
<< "Applet: " << applet << applet->title() << appletGraphicObject;
|
||||
|
||||
if (!appletGraphicObject) {
|
||||
appletGraphicObject = new AppletInterface(applet, this);
|
||||
appletGraphicObject = new AppletInterface(applet, QVariantList(), this);
|
||||
applet->setProperty("_plasma_graphicObject", QVariant::fromValue(appletGraphicObject));
|
||||
static_cast<AppletInterface *>(appletGraphicObject)->init();
|
||||
}
|
||||
|
@ -70,7 +70,8 @@ class ContainmentInterface : public AppletInterface
|
||||
Q_PROPERTY(QList<QObject *> actions READ actions NOTIFY actionsChanged)
|
||||
|
||||
public:
|
||||
ContainmentInterface(DeclarativeAppletScript *parent);
|
||||
ContainmentInterface(DeclarativeAppletScript *parent, const QVariantList &args = QVariantList());
|
||||
|
||||
//Not for QML
|
||||
Plasma::Containment *containment() const
|
||||
{
|
||||
|
@ -82,19 +82,14 @@ bool DeclarativeAppletScript::init()
|
||||
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(a);
|
||||
|
||||
if (pc && pc->isContainment()) {
|
||||
m_interface = new ContainmentInterface(this);
|
||||
m_interface = new ContainmentInterface(this, m_args);
|
||||
|
||||
//fail? so it's a normal Applet
|
||||
} else {
|
||||
m_interface = new AppletInterface(this);
|
||||
m_interface = new AppletInterface(this, m_args);
|
||||
}
|
||||
|
||||
m_interface->setParent(this);
|
||||
if (m_args.count() == 1) {
|
||||
emit m_interface->externalData(QString(), m_args.first());
|
||||
} else if (m_args.count() > 0) {
|
||||
emit m_interface->externalData(QString(), m_args);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user