remove deprecated property

This commit is contained in:
Marco Martin 2012-01-09 11:41:28 +01:00
parent b566382d48
commit edda55f015
4 changed files with 24 additions and 24 deletions

View File

@ -21,6 +21,8 @@
#include <QtDeclarative/qdeclarative.h> #include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/QDeclarativeEngine> #include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeItem>
#include "qrangemodel.h" #include "qrangemodel.h"
@ -31,6 +33,8 @@
#include "qmenuitem.h" #include "qmenuitem.h"
#include "kdialogproxy.h" #include "kdialogproxy.h"
Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
class BKSingleton class BKSingleton
{ {
public: public:
@ -47,31 +51,32 @@ EngineBookKeeping *EngineBookKeeping::self()
return &privateBKSelf->self; return &privateBKSelf->self;
} }
QDeclarativeEngine *EngineBookKeeping::engineFor(QDeclarativeItem *item) const QDeclarativeEngine *EngineBookKeeping::engineFor(QObject *item) const
{ {
foreach (QDeclarativeEngine *engine, m_engines) {
QObject *root = engine->rootContext()->contextObject();
QObject *candidate = item;
while (candidate) {
if (candidate == root) {
return engine;
}
candidate = candidate->parent();
}
}
return 0; return 0;
} }
void EngineBookKeeping::insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine) void EngineBookKeeping::insertEngine(QDeclarativeEngine *engine)
{ {
m_engines.insert(plugin, engine); m_engines.insert(engine);
}
void EngineBookKeeping::removePlugin(PlasmaComponentsPlugin *plugin)
{
m_engines.remove(plugin);
} }
PlasmaComponentsPlugin::~PlasmaComponentsPlugin()
{
EngineBookKeeping::self()->removePlugin(this);
}
void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
{ {
QDeclarativeExtensionPlugin::initializeEngine(engine, uri); QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
EngineBookKeeping::self()->insertPlugin(this, engine); EngineBookKeeping::self()->insertEngine(engine);
} }
void PlasmaComponentsPlugin::registerTypes(const char *uri) void PlasmaComponentsPlugin::registerTypes(const char *uri)

View File

@ -21,7 +21,7 @@
#define PLASMACOMPONENTSPLUGIN_H #define PLASMACOMPONENTSPLUGIN_H
#include <QDeclarativeExtensionPlugin> #include <QDeclarativeExtensionPlugin>
#include <QHash> #include <QSet>
class QDeclarativeEngine; class QDeclarativeEngine;
class QDeclarativeItem; class QDeclarativeItem;
@ -33,12 +33,11 @@ public:
EngineBookKeeping(); EngineBookKeeping();
static EngineBookKeeping *self(); static EngineBookKeeping *self();
void insertPlugin(PlasmaComponentsPlugin *plugin, QDeclarativeEngine *engine); void insertEngine(QDeclarativeEngine *engine);
void removePlugin(PlasmaComponentsPlugin *plugin); QDeclarativeEngine *engineFor(QObject *item) const;
QDeclarativeEngine *engineFor(QDeclarativeItem *item) const;
private: private:
QHash <PlasmaComponentsPlugin*, QDeclarativeEngine*> m_engines; QSet <QDeclarativeEngine*> m_engines;
}; };
class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin
@ -46,11 +45,8 @@ class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin
Q_OBJECT Q_OBJECT
public: public:
~PlasmaComponentsPlugin();
void initializeEngine(QDeclarativeEngine *engine, const char *uri); void initializeEngine(QDeclarativeEngine *engine, const char *uri);
void registerTypes(const char *uri); void registerTypes(const char *uri);
}; };
Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
#endif #endif

View File

@ -26,10 +26,11 @@
#include <QGraphicsView> #include <QGraphicsView>
#include <QDeclarativeItem> #include <QDeclarativeItem>
#include "plasmacomponentsplugin.h"
QMenuProxy::QMenuProxy (QObject *parent) QMenuProxy::QMenuProxy (QObject *parent)
: QObject(parent), : QObject(parent),
m_status(DialogStatus::Closed) m_status(DialogStatus::Closed)
{ {qDebug()<<"AAAAAA"<<EngineBookKeeping::self()->engineFor(this);
m_menu = new QMenu(0); m_menu = new QMenu(0);
connect(m_menu, SIGNAL(triggered(QAction *)), connect(m_menu, SIGNAL(triggered(QAction *)),
this, SLOT(itemTriggered(QAction *))); this, SLOT(itemTriggered(QAction *)));

View File

@ -81,8 +81,6 @@ CommonDialog {
property int selectedIndex: -1 property int selectedIndex: -1
property Component delegate: defaultDelegate property Component delegate: defaultDelegate
privateCloseIcon: true
Component { Component {
id: defaultDelegate id: defaultDelegate