diff --git a/src/declarativeimports/core/CMakeLists.txt b/src/declarativeimports/core/CMakeLists.txt index 4c1296666..66a4ef82e 100644 --- a/src/declarativeimports/core/CMakeLists.txt +++ b/src/declarativeimports/core/CMakeLists.txt @@ -27,6 +27,7 @@ set(corebindings_SRCS serviceoperationstatus.cpp dataenginebindings.cpp iconitem.cpp + units.cpp windowthumbnail.cpp ) diff --git a/src/declarativeimports/core/corebindingsplugin.cpp b/src/declarativeimports/core/corebindingsplugin.cpp index 7574c3180..63132ffeb 100644 --- a/src/declarativeimports/core/corebindingsplugin.cpp +++ b/src/declarativeimports/core/corebindingsplugin.cpp @@ -43,6 +43,7 @@ #include "serviceoperationstatus.h" #include "tooltip.h" +#include "units.h" #include "windowthumbnail.h" // #include "dataenginebindings_p.h" @@ -59,6 +60,10 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) Plasma::Theme *theme = new Plasma::Theme(engine); context->setContextProperty("theme", theme); + Units *units = new Units(context); + context->setContextProperty("units", units); + + if (!engine->rootContext()->contextObject()) { KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine); @@ -71,6 +76,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri) Q_ASSERT(uri == QLatin1String("org.kde.plasma.core")); qmlRegisterUncreatableType(uri, 2, 0, "Types", ""); + qmlRegisterUncreatableType(uri, 2, 0, "Units", ""); qmlRegisterType(uri, 2, 0, "Svg"); qmlRegisterType(uri, 2, 0, "FrameSvg"); @@ -105,7 +111,6 @@ void CoreBindingsPlugin::registerTypes(const char *uri) qRegisterMetaType("DataSource"); qmlRegisterType(uri, 2, 0, "WindowThumbnail"); - } diff --git a/src/declarativeimports/plasmacomponents/units.cpp b/src/declarativeimports/core/units.cpp similarity index 100% rename from src/declarativeimports/plasmacomponents/units.cpp rename to src/declarativeimports/core/units.cpp diff --git a/src/declarativeimports/plasmacomponents/units.h b/src/declarativeimports/core/units.h similarity index 100% rename from src/declarativeimports/plasmacomponents/units.h rename to src/declarativeimports/core/units.h diff --git a/src/declarativeimports/plasmacomponents/CMakeLists.txt b/src/declarativeimports/plasmacomponents/CMakeLists.txt index 363c1a7bd..7a7408bc7 100644 --- a/src/declarativeimports/plasmacomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmacomponents/CMakeLists.txt @@ -10,7 +10,6 @@ set(plasmacomponents_SRCS enums.cpp qmenu.cpp qmenuitem.cpp - units.cpp ) add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) diff --git a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp index b54f8644b..007a04d73 100644 --- a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp @@ -33,10 +33,6 @@ #include "enums.h" #include "qmenu.h" #include "qmenuitem.h" -//#include "fullscreensheet.h" -#include "units.h" - -//Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin) class BKSingleton { @@ -83,10 +79,6 @@ void PlasmaComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *ur { QQmlExtensionPlugin::initializeEngine(engine, uri); EngineBookKeeping::self()->insertEngine(engine); - - QQmlContext *context = engine->rootContext(); - Units *units = new Units(context); - context->setContextProperty("units", units); } void PlasmaComponentsPlugin::registerTypes(const char *uri) @@ -107,7 +99,6 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri) qmlRegisterUncreatableType(uri, 2, 0, "DialogStatus", ""); qmlRegisterUncreatableType(uri, 2, 0, "PageOrientation", ""); qmlRegisterUncreatableType(uri, 2, 0, "PageStatus", ""); - qmlRegisterUncreatableType(uri, 2, 0, "Units", ""); }