register extra types on QScriptEngine
only if hasn't been done yet
This commit is contained in:
parent
38c8915cd7
commit
2bb756cfe7
@ -23,7 +23,7 @@ qt4_automoc(${corebindings_SRCS})
|
|||||||
|
|
||||||
|
|
||||||
add_library(corebindingsplugin SHARED ${corebindings_SRCS})
|
add_library(corebindingsplugin SHARED ${corebindings_SRCS})
|
||||||
target_link_libraries(corebindingsplugin ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
target_link_libraries(corebindingsplugin ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative)
|
||||||
|
|
||||||
install(TARGETS corebindingsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/core)
|
install(TARGETS corebindingsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/core)
|
||||||
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/core)
|
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/core)
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
|
|
||||||
#include <QtDeclarative/qdeclarative.h>
|
#include <QtDeclarative/qdeclarative.h>
|
||||||
#include <QDeclarativeContext>
|
#include <QDeclarativeContext>
|
||||||
|
#include <QScriptEngine>
|
||||||
|
|
||||||
|
#include <kdeclarative.h>
|
||||||
|
|
||||||
#include <Plasma/FrameSvg>
|
#include <Plasma/FrameSvg>
|
||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
@ -43,6 +46,17 @@ void CoreBindingsPlugin::initializeEngine(QDeclarativeEngine *engine, const char
|
|||||||
|
|
||||||
ThemeProxy *theme = new ThemeProxy(context);
|
ThemeProxy *theme = new ThemeProxy(context);
|
||||||
context->setContextProperty("theme", theme);
|
context->setContextProperty("theme", theme);
|
||||||
|
|
||||||
|
KDeclarative kdeclarative;
|
||||||
|
kdeclarative.setDeclarativeEngine(engine);
|
||||||
|
kdeclarative.initialize();
|
||||||
|
QScriptEngine *scriptEngine = kdeclarative.scriptEngine();
|
||||||
|
kWarning()<<"AAAAA"<<scriptEngine->globalObject().property("i18n").isValid();
|
||||||
|
//inject the hack only if wasn't injected already
|
||||||
|
if (!scriptEngine->globalObject().property("i18n").isValid()) {
|
||||||
|
//binds things like kconfig and icons
|
||||||
|
kdeclarative.setupBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreBindingsPlugin::registerTypes(const char *uri)
|
void CoreBindingsPlugin::registerTypes(const char *uri)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user