40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
|
From b449460131aa342ff8405e508345957116b87baf Mon Sep 17 00:00:00 2001
|
||
|
From: Marco Martin <notmart@gmail.com>
|
||
|
Date: Tue, 21 Jul 2015 18:58:28 +0200
|
||
|
Subject: [PATCH 4/6] add the userPaths context property
|
||
|
|
||
|
some user paths for pictures, movies etc, from QStandardPaths
|
||
|
---
|
||
|
src/kpackagelauncherqml/main.cpp | 8 ++++++++
|
||
|
1 file changed, 8 insertions(+)
|
||
|
|
||
|
diff --git a/src/kpackagelauncherqml/main.cpp b/src/kpackagelauncherqml/main.cpp
|
||
|
index ba4559b..9d9cbbc 100644
|
||
|
--- a/src/kpackagelauncherqml/main.cpp
|
||
|
+++ b/src/kpackagelauncherqml/main.cpp
|
||
|
@@ -31,6 +31,7 @@
|
||
|
#include <QQmlExpression>
|
||
|
#include <QQmlProperty>
|
||
|
#include <QQuickWindow>
|
||
|
+#include <QStandardPaths>
|
||
|
#include <kdeclarative/qmlobject.h>
|
||
|
#include <KAboutData>
|
||
|
|
||
|
@@ -70,6 +71,13 @@ int main(int argc, char **argv)
|
||
|
return 1;
|
||
|
}
|
||
|
obj.engine()->rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments());
|
||
|
+ QVariantMap paths;
|
||
|
+ paths["desktop"] = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||
|
+ paths["documents"] = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||
|
+ paths["music"] = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
|
||
|
+ paths["movies"] = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
|
||
|
+ paths["pictures"] = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||
|
+ obj.engine()->rootContext()->setContextProperty("userPaths", paths);
|
||
|
obj.completeInitialization();
|
||
|
|
||
|
if (!obj.package().metadata().isValid()) {
|
||
|
--
|
||
|
1.9.3
|
||
|
|