Commit 5336e5e8 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Use directly KI18n for exposing i18n()

parent e9f99075
add_subdirectory(plugins)
if(KDeclarative_FOUND)
if(KF5I18n_FOUND)
add_definitions(-DKDECOMPONENTS)
endif()
......@@ -19,8 +19,8 @@ elseif(${MOBILE_BACKEND} STREQUAL "material")
# if we don't link it here explicitly, androiddeployqt doesn't bring it
find_package(Qt5Svg REQUIRED)
target_link_libraries(kalgebramobile Qt5::Svg)
elseif(KDeclarative_FOUND)
target_link_libraries(kalgebramobile KF5::KDeclarative)
elseif(KF5I18n_FOUND)
target_link_libraries(kalgebramobile KF5::I18n)
endif()
set(DESKTOPFILE kalgebramobile.desktop)
......
......@@ -19,7 +19,7 @@
#include <QGuiApplication>
#ifdef KDECOMPONENTS
#include <kdeclarative/kdeclarative.h>
#include <KLocalizedContext>
#endif
#include <QDebug>
......@@ -47,14 +47,6 @@ int main(int argc, char *argv[])
KAlgebraMobile widget;
#ifdef KDECOMPONENTS
KDeclarative kdeclarative;
// kdeclarative.setDeclarativeEngine(view.engine());
// kdeclarative.initialize();
//binds things like kconfig and icons
// kdeclarative.setupBindings();
#endif
QString main = PluginsModel::pluginsDirectoryPath()+"/widgets/KAlgebraMobile.qml";
QDir dir = QFileInfo(main).dir();
......@@ -63,7 +55,11 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty(QStringLiteral("app"), &widget);
engine.addImportPath(dir.path());
#ifdef KDECOMPONENTS
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
#endif
engine.load(QUrl::fromLocalFile(main));
return app.exec();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment