From f0e644896d34c4c354a978788cbb461db653484b Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Sun, 11 Jan 2015 21:26:02 +0100 Subject: Implemented "Add App file" dialog --- app/pebbledinterface.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/pebbledinterface.cpp') diff --git a/app/pebbledinterface.cpp b/app/pebbledinterface.cpp index cc9a617..b30af28 100644 --- a/app/pebbledinterface.cpp +++ b/app/pebbledinterface.cpp @@ -170,6 +170,22 @@ void PebbledInterface::reconnect() watch->Reconnect(); } +bool PebbledInterface::registerAppFile(const QString& filePath) +{ + if (filePath.endsWith(".pbw", Qt::CaseInsensitive)) { + QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + if (dataDir.mkpath("apps")) { + QFile pbw(filePath); + QFileInfo dst(pbw); + dst.setFile(dataDir.absoluteFilePath("apps"), dst.fileName()); + QFile(dst.filePath()).remove(); + return pbw.copy(dst.filePath()); + } + } + + return false; +} + QUrl PebbledInterface::configureApp(const QString &uuid) { qDebug() << Q_FUNC_INFO << uuid; -- cgit v1.2.3