From af1aef4e6ffdbfc3842b3031b58fe117fe9c9ab6 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 18 Apr 2018 15:46:34 +0200 Subject: [PATCH] set the context properties the app expects --- mobile/app/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mobile/app/main.cpp b/mobile/app/main.cpp index c6e51f114..46fd141d9 100644 --- a/mobile/app/main.cpp +++ b/mobile/app/main.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include Q_DECL_EXPORT int main(int argc, char *argv[]) @@ -37,8 +38,23 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QApplication app(argc, argv); app.setApplicationName(QStringLiteral("okularmobile")); + QCommandLineParser parser; + parser.addVersionOption(); + parser.addHelpOption(); + //parser.setApplicationDescription(i18n("Okular mobile")); + parser.process(app); + QQmlApplicationEngine engine; engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); + engine.rootContext()->setContextProperty(QStringLiteral("commandlineArguments"), parser.positionalArguments()); + QVariantMap paths; + paths[QStringLiteral("desktop")] = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + paths[QStringLiteral("documents")] = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); + paths[QStringLiteral("music")] = QStandardPaths::writableLocation(QStandardPaths::MusicLocation); + paths[QStringLiteral("movies")] = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); + paths[QStringLiteral("pictures")] = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); + paths[QStringLiteral("home")] = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); + engine.rootContext()->setContextProperty(QStringLiteral("userPaths"), paths); engine.setBaseUrl(QUrl("qrc:/package/contents/ui/")); engine.load(QUrl("qrc:/package/contents/ui/main.qml"));