add/remove associations plugin/engine

This commit is contained in:
Marco Martin 2012-01-09 11:12:05 +01:00
parent 691b22dbab
commit b566382d48
2 changed files with 25 additions and 1 deletions

View File

@ -47,12 +47,32 @@ EngineBookKeeping *EngineBookKeeping::self()
return &privateBKSelf->self;
}
QDeclarativeEngine *engineFor(QDeclarativeItem *item) const
QDeclarativeEngine *EngineBookKeeping::engineFor(QDeclarativeItem *item) const
{
return 0;
}
void EngineBookKeeping::insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine)
{
m_engines.insert(plugin, engine);
}
void EngineBookKeeping::removePlugin(PlasmaComponentsPlugin *plugin)
{
m_engines.remove(plugin);
}
PlasmaComponentsPlugin::~PlasmaComponentsPlugin()
{
EngineBookKeeping::self()->removePlugin(this);
}
void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
{
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
EngineBookKeeping::self()->insertPlugin(this, engine);
}
void PlasmaComponentsPlugin::registerTypes(const char *uri)
{

View File

@ -33,6 +33,8 @@ public:
EngineBookKeeping();
static EngineBookKeeping *self();
void insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine);
void removePlugin(PlasmaComponentsPlugin *plugin);
QDeclarativeEngine *engineFor(QDeclarativeItem *item) const;
private:
@ -44,6 +46,8 @@ class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin
Q_OBJECT
public:
~PlasmaComponentsPlugin();
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
void registerTypes(const char *uri);
};