diff options
author | Kimmo Ollila <kimmo.ollila@theqtcompany.com> | 2016-01-15 09:46:55 +0200 |
---|---|---|
committer | Kimmo Ollila <kimmo.ollila@theqtcompany.com> | 2016-01-15 10:00:08 +0000 |
commit | d1bc24eadf6935a4aa5ce0bfef18a28dab1abd8a (patch) | |
tree | 226edcd1cebf42c90020367d23e916ba0a7a5d9a | |
parent | 9834944a9d042e3e484bd5cf915f2056473d1b0a (diff) |
Fixed Launcher Settings application startup
Change-Id: If1e429a3b78ec0e35d9c636784e12733122f8910
Reviewed-by: Katja Marttila <katja.marttila@theqtcompany.com>
-rw-r--r-- | qml/Main.qml | 12 | ||||
-rw-r--r-- | src/engine.cpp | 6 | ||||
-rw-r--r-- | src/engine.h | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/qml/Main.qml b/qml/Main.qml index 7d61562..d89472f 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -355,16 +355,16 @@ Window { MouseArea { anchors.fill: parent onClicked: { - //TODO is there a better way? - //find launchersettings application, it is under basicsuite + //Find launchersettings application from appsRoots //There can be several roots which are split with ':' var fileArray = applicationSettings.appsRoot.split(":") for ( var i = 0; i < fileArray.length; i++ ) { var file = fileArray[i] - if ( file.search("basicsuite") > -1 ) { - var prepend = "file://" - file = prepend.concat(file) - file += "/launchersettings" + var prepend = "file://" + file = prepend.concat(file) + file += "/launchersettings" + + if (engine.fileExists(file + "/main.qml")) { engine.launchApplication(file, "main.qml", "Launcher Settings") break } diff --git a/src/engine.cpp b/src/engine.cpp index 8c6264e..860efaa 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -163,6 +163,12 @@ int Engine::sensibleButtonSize() const return buttonSize; } +bool Engine::fileExists(const QUrl &fileName) +{ + QFile file(fileName.toLocalFile()); + return file.exists(); +} + void Engine::launchApplication(const QUrl &path, const QString &mainFile, const QString &name) { // only launch apps when in the homescreen... diff --git a/src/engine.h b/src/engine.h index ec0cbb7..cf30172 100644 --- a/src/engine.h +++ b/src/engine.h @@ -101,6 +101,8 @@ public slots: void setFps(qreal fps); + bool fileExists(const QUrl &fileName); + private slots: void windowChanged(QQuickWindow *window); |