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 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/pebble.cpp') 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"); -- cgit v1.2.3