get the components target from libkdeclarative
This commit is contained in:
parent
050222e9ed
commit
06f5f555a9
@ -23,7 +23,7 @@ qt4_automoc(${plasmacomponents_SRCS})
|
||||
|
||||
|
||||
add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS})
|
||||
target_link_libraries(plasmacomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBRARY} ${KDE4_PLASMA_LIBS})
|
||||
target_link_libraries(plasmacomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBRARY} ${KDECLARATIVE_LIBRARIES} ${KDE4_PLASMA_LIBS})
|
||||
|
||||
install(TARGETS plasmacomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/components)
|
||||
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include <KWindowSystem>
|
||||
#include <KStandardDirs>
|
||||
|
||||
#include <kdeclarative.h>
|
||||
|
||||
#include <Plasma/Corona>
|
||||
#include <Plasma/WindowEffects>
|
||||
|
||||
@ -122,31 +124,22 @@ void FullScreenWindow::init(const QString &componentName)
|
||||
}
|
||||
|
||||
//Try to figure out the path of the dialog component
|
||||
QString componentsPlatform = getenv("KDE_PLASMA_COMPONENTS_PLATFORM");
|
||||
if (componentsPlatform.isEmpty()) {
|
||||
KConfigGroup cg(KSharedConfig::openConfig("kdeclarativerc"), "Components-platform");
|
||||
componentsPlatform = cg.readEntry("name", "desktop");
|
||||
}
|
||||
|
||||
const QString target = KDeclarative::componentsTarget();
|
||||
QString filePath;
|
||||
if (componentsPlatform == "desktop") {
|
||||
foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "imports/")) {
|
||||
filePath = importPath % "org/kde/plasma/components/" % componentName % ".qml";
|
||||
QFile f(filePath);
|
||||
if (f.exists()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "platformimports/" % componentsPlatform)) {
|
||||
filePath = importPath % "org/kde/plasma/components/" % componentName % ".qml";
|
||||
QFile f(filePath);
|
||||
if (f.exists()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (target != KDeclarative::defaultComponentsTarget()) {
|
||||
const QString file = "platformimports/" % target % "org/kde/plasma/components/" % componentName % ".qml";
|
||||
filePath = KStandardDirs::locate("module", file);
|
||||
}
|
||||
|
||||
if (filePath.isEmpty()) {
|
||||
const QString file = "imports/org/kde/plasma/components/" % componentName % ".qml";
|
||||
filePath = KStandardDirs::locate("module", file);
|
||||
}
|
||||
|
||||
if (filePath.isEmpty()) {
|
||||
kWarning() << "Component not found:" << componentName;
|
||||
return;
|
||||
}
|
||||
|
||||
QDeclarativeEngine *engine = EngineBookKeeping::self()->engine();
|
||||
if (!engine) {
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <KSharedConfig>
|
||||
#include <KDebug>
|
||||
|
||||
#include <kdeclarative.h>
|
||||
|
||||
#include "enums.h"
|
||||
#include "qmenu.h"
|
||||
#include "qmenuitem.h"
|
||||
@ -89,20 +91,14 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.components"));
|
||||
|
||||
QString componentsPlatform = getenv("KDE_PLASMA_COMPONENTS_PLATFORM");
|
||||
if (componentsPlatform.isEmpty()) {
|
||||
KConfigGroup cg(KSharedConfig::openConfig("kdeclarativerc"), "Components-platform");
|
||||
componentsPlatform = cg.readEntry("name", "desktop");
|
||||
}
|
||||
|
||||
//platform specific c++ components
|
||||
if (componentsPlatform == "desktop") {
|
||||
const QString target = KDeclarative::componentsTarget();
|
||||
if (target == KDeclarative::defaultComponentsTarget()) {
|
||||
qmlRegisterType<KDialogProxy>(uri, 0, 1, "QueryDialog");
|
||||
|
||||
qmlRegisterType<QMenuProxy>(uri, 0, 1, "Menu");
|
||||
qmlRegisterType<QMenuItem>(uri, 0, 1, "MenuItem");
|
||||
//on touch systems the dialog is fullscreen, c++ needed to do that
|
||||
} else {
|
||||
//on touch systems the dialog is fullscreen, c++ needed to do that
|
||||
qmlRegisterType<FullScreenDialog>(uri, 0, 1, "Dialog");
|
||||
qmlRegisterType<FullScreenSheet>(uri, 0, 1, "Sheet");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user