From 341c38a31f4bde9a2f016b4d58a11b8beb2bae5a Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Sun, 11 Jan 2015 18:36:08 +0100 Subject: Implemented adding App by opening .pbw file --- app/pebble.cpp | 15 +++++++++++++++ daemon/daemon.cpp | 1 + 2 files changed, 16 insertions(+) diff --git a/app/pebble.cpp b/app/pebble.cpp index 41da080..6f5d605 100644 --- a/app/pebble.cpp +++ b/app/pebble.cpp @@ -38,6 +38,21 @@ int main(int argc, char *argv[]) { QScopedPointer app(SailfishApp::application(argc, argv)); + app->setApplicationName("pebble"); + app->setOrganizationName(""); + + for (int i = 1; i < argc; i++) { + if (QString(argv[i]).endsWith(".pbw", Qt::CaseInsensitive)) { + QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + if (dataDir.mkpath("apps")) { + QFile pbw(argv[i]); + QFileInfo dst(pbw); + dst.setFile(dataDir.absoluteFilePath("apps"), dst.fileName()); + QFile(dst.filePath()).remove(); + pbw.copy(dst.filePath()); + } + } + } qmlRegisterUncreatableType("org.pebbled", 0, 1, "PebbledInterface", "Please use pebbled context property"); diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp index b645eba..85af751 100644 --- a/daemon/daemon.cpp +++ b/daemon/daemon.cpp @@ -48,6 +48,7 @@ int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); app.setApplicationName("pebble"); // Use the same appname as the UI. + app.setOrganizationName(""); QStringList filterRules; -- cgit v1.2.3