if there are args, emit externalData

This commit is contained in:
Marco Martin 2014-05-06 19:06:31 +02:00
parent f123671346
commit a7928f29dd
2 changed files with 8 additions and 2 deletions

View File

@ -50,7 +50,8 @@ K_EXPORT_PLASMA_APPLETSCRIPTENGINE(declarativeappletscript, DeclarativeAppletScr
DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariantList &args) DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariantList &args)
: Plasma::AppletScript(parent), : Plasma::AppletScript(parent),
m_interface(0) m_interface(0),
m_args(args)
{ {
//qmlRegisterType<AppletInterface>(); //qmlRegisterType<AppletInterface>();
//FIXME: use this if/when will be possible to have properties of attached items subclasses on the left hand of expressions //FIXME: use this if/when will be possible to have properties of attached items subclasses on the left hand of expressions
@ -65,7 +66,6 @@ DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariant
QLatin1String("Do not create objects of type Wallpaper")); QLatin1String("Do not create objects of type Wallpaper"));
qmlRegisterType<KDeclarative::ConfigPropertyMap>(); qmlRegisterType<KDeclarative::ConfigPropertyMap>();
Q_UNUSED(args);
} }
DeclarativeAppletScript::~DeclarativeAppletScript() DeclarativeAppletScript::~DeclarativeAppletScript()
@ -90,6 +90,11 @@ bool DeclarativeAppletScript::init()
} }
m_interface->setParent(this); 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; return true;
} }

View File

@ -56,6 +56,7 @@ Q_SIGNALS:
private: private:
AppletInterface *m_interface; AppletInterface *m_interface;
QVariantList m_args;
friend class AppletLoader; friend class AppletLoader;
friend class AppletInterface; friend class AppletInterface;
friend class ContainmentInterface; friend class ContainmentInterface;