Merge lp:~macslow/unity-notifications/swipe-to-act-fix-1358343 into lp:unity-notifications

Proposed by Mirco Müller
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 224
Merged at revision: 223
Proposed branch: lp:~macslow/unity-notifications/swipe-to-act-fix-1358343
Merge into: lp:unity-notifications
Diff against target: 131 lines (+20/-6)
8 files modified
examples/example.py (+3/-0)
examples/sd-example-incoming-call-canceled.py (+1/-0)
examples/sd-example-incoming-call.py (+1/-0)
include/ActionModel.h (+8/-6)
include/notify-backend.h.in (+1/-0)
src/ActionModel.cpp (+4/-0)
src/NotificationPlugin.cpp (+1/-0)
src/NotificationServer.cpp (+1/-0)
To merge this branch: bzr merge lp:~macslow/unity-notifications/swipe-to-act-fix-1358343
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+238956@code.launchpad.net

Commit message

Added new hint for SwipeToAct-widget.

This allows applications to explicitly request the new widget for special cases, e.g for incoming-call snap-decision notifications.

Updated examples accordingly.

Description of the change

Added hint to allow applications to explicitly request the new SwipeToAct-widget for incoming-call snap-decision notifications. Also updated examples accordingly.

* Are there any related MPs required for this MP to build/function as expected? Please list.
No.

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

* Did you make sure that your branch does not contain spurious tags?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.

* If you changed the UI, has there been a design review?
Not applicable.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Please update the copyright year in include/ActionModel.h

223. By Mirco Müller

Updated copyright year.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

remove Q_INVOKABLE from the .cpp

Also to keep the style of the file please move the { up in the new ::data function

review: Needs Fixing
224. By Mirco Müller

Style-guide fixes.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/example.py'
2--- examples/example.py 2014-08-08 14:36:12 +0000
3+++ examples/example.py 2014-10-29 15:56:24 +0000
4@@ -51,6 +51,7 @@
5 'x-canonical-truncation': False,
6 'x-canonical-snap-decisions': False,
7 'x-canonical-snap-decisions-timeout': False,
8+ 'x-canonical-snap-decisions-swipe': False,
9 'x-canonical-switch-to-application': False,
10 'x-canonical-secondary-icon': False,
11 'x-canonical-private-affirmative-tint': False,
12@@ -114,6 +115,8 @@
13 print "\tx-canonical-snap-decisions"
14 if capabilities['x-canonical-snap-decisions-timeout']:
15 print "\tx-canonical-snap-decisions-timeout"
16+ if capabilities['x-canonical-snap-decisions-swipe']:
17+ print "\tx-canonical-snap-decisions-swipe"
18 if capabilities['x-canonical-switch-to-application']:
19 print "\tx-canonical-switch-to-application"
20 if capabilities['x-canonical-secondary-icon']:
21
22=== modified file 'examples/sd-example-incoming-call-canceled.py'
23--- examples/sd-example-incoming-call-canceled.py 2014-08-08 14:36:12 +0000
24+++ examples/sd-example-incoming-call-canceled.py 2014-10-29 15:56:24 +0000
25@@ -94,6 +94,7 @@
26
27 # indicate to the notification-daemon, that we want to use snap-decisions
28 n.set_hint_string ("x-canonical-snap-decisions", "true");
29+ n.set_hint_string ("x-canonical-snap-decisions-swipe", "true");
30 n.set_hint_string ("x-canonical-secondary-icon", "incoming-call");
31
32 # set the button-tint hint so that the right/positive button is tinted and
33
34=== modified file 'examples/sd-example-incoming-call.py'
35--- examples/sd-example-incoming-call.py 2014-07-25 08:22:02 +0000
36+++ examples/sd-example-incoming-call.py 2014-10-29 15:56:24 +0000
37@@ -94,6 +94,7 @@
38
39 # indicate to the notification-daemon, that we want to use snap-decisions
40 n.set_hint_string ("x-canonical-snap-decisions", "true");
41+ n.set_hint_string ("x-canonical-snap-decisions-swipe", "true");
42 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
43 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
44 n.set_hint_string ("x-canonical-secondary-icon", "incoming-call");
45
46=== modified file 'include/ActionModel.h'
47--- include/ActionModel.h 2013-10-18 08:19:39 +0000
48+++ include/ActionModel.h 2014-10-29 15:56:24 +0000
49@@ -1,5 +1,5 @@
50 /*
51- * Copyright (C) 2013 Canonical, Ltd.
52+ * Copyright (C) 2014 Canonical, Ltd.
53 *
54 * This program is free software: you can redistribute it and/or modify it
55 * under the terms of the GNU General Public License version 3, as published
56@@ -21,11 +21,6 @@
57
58 struct ActionModelPrivate;
59
60-enum ActionsRoles {
61- RoleActionLabel = Qt::UserRole + 1,
62- RoleActionId = Qt::UserRole + 2
63-};
64-
65 class ActionModel : public QStringListModel {
66 Q_OBJECT
67
68@@ -37,6 +32,13 @@
69 virtual QVariant data(const QModelIndex &index, int role) const;
70 virtual QHash<int, QByteArray> roleNames() const;
71
72+ Q_ENUMS(ActionsRoles)
73+ enum ActionsRoles {
74+ RoleActionLabel = Qt::UserRole + 1,
75+ RoleActionId = Qt::UserRole + 2
76+ };
77+ Q_INVOKABLE QVariant data(int row, int role) const;
78+
79 void insertAction(const QString &id, const QString &label);
80
81 private:
82
83=== modified file 'include/notify-backend.h.in'
84--- include/notify-backend.h.in 2014-08-08 14:36:12 +0000
85+++ include/notify-backend.h.in 2014-10-29 15:56:24 +0000
86@@ -69,5 +69,6 @@
87 #define REJECTION_TINT_HINT "x-canonical-private-rejection-tint"
88 #define TRUNCATION_HINT "x-canonical-truncation"
89 #define TIMEOUT_HINT "x-canonical-snap-decisions-timeout"
90+#define SWIPE_HINT "x-canonical-snap-decisions-swipe"
91
92 #endif
93
94=== modified file 'src/ActionModel.cpp'
95--- src/ActionModel.cpp 2013-10-18 08:19:39 +0000
96+++ src/ActionModel.cpp 2014-10-29 15:56:24 +0000
97@@ -56,6 +56,10 @@
98 return roles;
99 }
100
101+QVariant ActionModel::data(int row, int role) const {
102+ return data(index(row, 0), role);
103+}
104+
105 void ActionModel::insertAction(const QString &id, const QString &label) {
106 p->ids.push_back(id);
107 p->labels.push_back(label);
108
109=== modified file 'src/NotificationPlugin.cpp'
110--- src/NotificationPlugin.cpp 2014-04-02 17:26:11 +0000
111+++ src/NotificationPlugin.cpp 2014-10-29 15:56:24 +0000
112@@ -47,6 +47,7 @@
113 qmlRegisterUncreatableType<ModelInterface>(uri, 1, 0, "ModelInterface", "Abstract Interface. Cannot be instantiated.");
114 qmlRegisterSingletonType<NotificationModel>(uri, 1, 0, "Model", modelProvider);
115 qmlRegisterUncreatableType<Notification>(uri, 1, 0, "Notification", "Notification objects can only be created by the plugin");
116+ qmlRegisterUncreatableType<ActionModel>(uri, 1, 0, "ActionModel", "Abstract Interface. Cannot be instantiated.");
117 }
118
119 void NotificationPlugin::initializeEngine(QQmlEngine *engine, const char *uri) {
120
121=== modified file 'src/NotificationServer.cpp'
122--- src/NotificationServer.cpp 2014-08-08 14:36:12 +0000
123+++ src/NotificationServer.cpp 2014-10-29 15:56:24 +0000
124@@ -60,6 +60,7 @@
125 capabilities.push_back(MENU_MODEL_HINT);
126 capabilities.push_back(INTERACTIVE_HINT);
127 capabilities.push_back(TIMEOUT_HINT);
128+ capabilities.push_back(SWIPE_HINT);
129
130 return capabilities;
131 }

Subscribers

People subscribed via source and target branches

to all changes: