Merge lp:~rpadovani/ubuntu-clock-app/09Oct2013 into lp:ubuntu-clock-app/saucy

Proposed by Riccardo Padovani
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 229
Merged at revision: 229
Proposed branch: lp:~rpadovani/ubuntu-clock-app/09Oct2013
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 55 lines (+26/-1)
2 files modified
ubuntu-clock-app.desktop (+1/-1)
ubuntu-clock-app.qml (+25/-0)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-clock-app/09Oct2013
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Approve
Ted Gould (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+190139@code.launchpad.net

Commit message

Added arguments on startup: for now, only alarm:/// but it's ready to have also other arguments

Description of the change

Added arguments on startup: for now, only alarm:/// but it's ready to have also other arguments

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
229. By Riccardo Padovani

Added %u in .desktop Exec entry, before app command due bug #1231136

Revision history for this message
Riccardo Padovani (rpadovani) wrote :
Revision history for this message
Ted Gould (ted) wrote :

Not sure about the QML, but the desktop file looks correct.

review: Approve
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

lgtm. I tested it by running qmlscene alarm ubuntu-clock-app.qml and it correctly opened the alarm tab. Any argument which starts with alarm like alarm:/// etc should properly.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-clock-app.desktop'
2--- ubuntu-clock-app.desktop 2013-10-09 08:26:48 +0000
3+++ ubuntu-clock-app.desktop 2013-10-09 19:42:14 +0000
4@@ -2,7 +2,7 @@
5 Version=1.0
6 Type=Application
7 Terminal=false
8-Exec=qmlscene /usr/share/ubuntu-clock-app/ubuntu-clock-app.qml
9+Exec=qmlscene %u /usr/share/ubuntu-clock-app/ubuntu-clock-app.qml
10 Icon=/usr/share/ubuntu-clock-app/clock64.png
11 Name=Clock
12 X-Ubuntu-Touch=true
13
14=== modified file 'ubuntu-clock-app.qml'
15--- ubuntu-clock-app.qml 2013-10-09 08:20:41 +0000
16+++ ubuntu-clock-app.qml 2013-10-09 19:42:14 +0000
17@@ -30,6 +30,27 @@
18
19 MainView {
20 id: root
21+
22+ // Argument during startup
23+ Arguments {
24+ id: args;
25+
26+ // IMPORTANT
27+ // Due to bug #1231558 you have to pass arguments BEFORE app:
28+ // qmlscene alarm:/// ubuntu-clock-app.qml
29+
30+ defaultArgument.valueNames: ["URL"];
31+ defaultArgument.help: i18n.tr("Clock app accepts only one argument: alarm:/// to switch to Alarm Page");
32+ }
33+
34+ // Function to parse arguments that are invoked on start
35+ function parseArgument(url) {
36+ var alarmPattern = new RegExp ("alarm");
37+
38+ if (alarmPattern.test(url))
39+ return "alarm";
40+ }
41+
42 // objectName for functional testing purposes (autopilot-qt5)
43 objectName: "clock"
44
45@@ -51,6 +72,10 @@
46 Component.onCompleted: {
47 // Any init here
48 Utils.log("MainView loaded");
49+
50+ // If alarm has been invoked on startup
51+ if (parseArgument(args.defaultArgument.at(0)) === "alarm")
52+ rootTabs.selectedTabIndex = 1;
53 }
54
55 // Timer that runs our app

Subscribers

People subscribed via source and target branches