22
22
#include <QtDeclarative/qdeclarative.h>
23
23
#include <QtDeclarative/QDeclarativeEngine>
24
#include <QtDeclarative/QDeclarativeContext>
25
#include <QtDeclarative/QDeclarativeItem>
25
27
#include "qrangemodel.h"
27
29
#include <KSharedConfig>
31
34
#include "qmenuitem.h"
32
35
#include "kdialogproxy.h"
36
#include "fullscreendialog.h"
37
#include "fullscreensheet.h"
39
Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
44
EngineBookKeeping self;
46
K_GLOBAL_STATIC(BKSingleton, privateBKSelf)
48
EngineBookKeeping::EngineBookKeeping()
52
EngineBookKeeping *EngineBookKeeping::self()
54
return &privateBKSelf->self;
57
QDeclarativeEngine *EngineBookKeeping::engine() const
59
//for components creation, any engine will do, as long is valid
60
if (m_engines.isEmpty()) {
61
kWarning() << "No engines found, this should never happen";
64
return m_engines.values().first();
68
void EngineBookKeeping::insertEngine(QDeclarativeEngine *engine)
70
connect(engine, SIGNAL(destroyed(QObject *)),
71
this, SLOT(engineDestroyed(QObject *)));
72
m_engines.insert(engine);
75
void EngineBookKeeping::engineDestroyed(QObject *deleted)
77
m_engines.remove(static_cast<QDeclarativeEngine *>(deleted));
82
void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
84
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
85
EngineBookKeeping::self()->insertEngine(engine);
34
88
void PlasmaComponentsPlugin::registerTypes(const char *uri)
41
95
componentsPlatform = cg.readEntry("name", "desktop");
98
//platform specific c++ components
44
99
if (componentsPlatform == "desktop") {
45
100
qmlRegisterType<KDialogProxy>(uri, 0, 1, "QueryDialog");
47
102
qmlRegisterType<QMenuProxy>(uri, 0, 1, "Menu");
48
qmlRegisterType<QMenuProxy>(uri, 0, 1, "ContextMenu");
49
103
qmlRegisterType<QMenuItem>(uri, 0, 1, "MenuItem");
104
//on touch systems the dialog is fullscreen, c++ needed to do that
106
qmlRegisterType<FullScreenDialog>(uri, 0, 1, "Dialog");
107
qmlRegisterType<FullScreenSheet>(uri, 0, 1, "Sheet");
52
110
qmlRegisterType<Plasma::QRangeModel>(uri, 0, 1, "RangeModel");