Merge lp:~tiagosh/dialer-app/ussd into lp:dialer-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 118
Merged at revision: 118
Proposed branch: lp:~tiagosh/dialer-app/ussd
Merge into: lp:dialer-app
Diff against target: 216 lines (+152/-0)
2 files modified
src/qml/DialerPage/DialerPage.qml (+13/-0)
src/qml/dialer-app.qml (+139/-0)
To merge this branch: bzr merge lp:~tiagosh/dialer-app/ussd
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+213934@code.launchpad.net

Commit message

Add initial USSD support

Description of the change

Add initial USSD support

----

Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~tiagosh/telephony-service/ussd/+merge/213935
https://code.launchpad.net/~tiagosh/telepathy-ofono/ussd/+merge/213936

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/dialer-app) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
N/A

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
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/DialerPage/DialerPage.qml'
2--- src/qml/DialerPage/DialerPage.qml 2014-02-20 21:31:09 +0000
3+++ src/qml/DialerPage/DialerPage.qml 2014-04-02 21:59:44 +0000
4@@ -19,6 +19,7 @@
5 import QtContacts 5.0
6 import QtQuick 2.0
7 import Ubuntu.Components 0.1
8+import Ubuntu.Components.Popups 0.1
9 import Ubuntu.Telephony 0.1
10 import Ubuntu.Contacts 0.1
11 import Ubuntu.Components.ListItems 0.1 as ListItems
12@@ -33,6 +34,18 @@
13 opened: false
14 locked: true
15 }
16+ onDialNumberChanged: {
17+ if(checkUSSD(dialNumber)) {
18+ // check for custom strings
19+ if (dialNumber == "*#06#") {
20+ dialNumber = ""
21+ mainView.ussdResponseTitle = "IMEI"
22+ // TODO: handle dual sim
23+ mainView.ussdResponseText = ussdManager.serial(telepathyHelper.accountIds[0])
24+ PopupUtils.open(ussdResponseDialog)
25+ }
26+ }
27+ }
28
29 FocusScope {
30 id: keypadContainer
31
32=== modified file 'src/qml/dialer-app.qml'
33--- src/qml/dialer-app.qml 2014-03-12 20:42:21 +0000
34+++ src/qml/dialer-app.qml 2014-04-02 21:59:44 +0000
35@@ -18,17 +18,21 @@
36
37 import QtQuick 2.0
38 import Ubuntu.Components 0.1
39+import Ubuntu.Components.Popups 0.1
40 import Ubuntu.Telephony 0.1
41
42 MainView {
43 id: mainView
44
45 property bool applicationActive: Qt.application.active
46+ property string ussdResponseTitle: ""
47+ property string ussdResponseText: ""
48 automaticOrientation: false
49 width: units.gu(40)
50 height: units.gu(71)
51
52 signal applicationReady
53+ signal closeUSSDProgressIndicator
54
55 onApplicationActiveChanged: {
56 if (applicationActive) {
57@@ -58,10 +62,30 @@
58 call(callManager.voicemailNumber);
59 }
60
61+ function checkUSSD(number) {
62+ var endString = "#"
63+ // check if it ends with #
64+ if (number.slice(-endString.length) == endString) {
65+ // check if it starts with any of these strings
66+ var startStrings = ["*", "#", "**", "##", "*#"]
67+ for(var i in startStrings) {
68+ if (number.slice(0, startStrings[i].length) == startStrings[i]) {
69+ return true
70+ }
71+ }
72+ }
73+ return false
74+ }
75+
76 function call(number, accountId) {
77 if (!telepathyHelper.connected || number === "") {
78 return
79 }
80+ if (checkUSSD(number)) {
81+ PopupUtils.open(ussdProgressDialog)
82+ ussdManager.initiate(number, accountId)
83+ return
84+ }
85 if (pageStack.depth === 1 && !callManager.hasCalls) {
86 pageStack.push(Qt.resolvedUrl("LiveCallPage/LiveCall.qml"))
87 }
88@@ -86,6 +110,53 @@
89 }
90 }
91
92+ Component {
93+ id: ussdProgressDialog
94+ Dialog {
95+ id: ussdProgressIndicator
96+ visible: false
97+ title: i18n.tr("Please wait")
98+ ActivityIndicator {
99+ running: parent.visible
100+ }
101+ Connections {
102+ target: mainView
103+ onCloseUSSDProgressIndicator: {
104+ PopupUtils.close(ussdProgressIndicator)
105+ }
106+
107+ }
108+ }
109+ }
110+
111+ Component {
112+ id: ussdErrorDialog
113+ Dialog {
114+ id: ussdError
115+ visible: false
116+ title: i18n.tr("Error")
117+ text: i18n.tr("Invalid USSD code")
118+ Button {
119+ text: i18n.tr("Dismiss")
120+ onClicked: PopupUtils.close(ussdError)
121+ }
122+ }
123+ }
124+
125+ Component {
126+ id: ussdResponseDialog
127+ Dialog {
128+ id: ussdResponse
129+ visible: false
130+ title: mainView.ussdResponseTitle
131+ text: mainView.ussdResponseText
132+ Button {
133+ text: i18n.tr("Dismiss")
134+ onClicked: PopupUtils.close(ussdResponse)
135+ }
136+ }
137+ }
138+
139 Connections {
140 target: telepathyHelper
141 onAccountReady: {
142@@ -119,6 +190,74 @@
143 }
144 }
145
146+ Connections {
147+ target: ussdManager
148+ onInitiateFailed: {
149+ mainView.closeUSSDProgressIndicator()
150+ PopupUtils.open(ussdErrorDialog)
151+ }
152+ onInitiateUSSDComplete: {
153+ mainView.closeUSSDProgressIndicator()
154+ }
155+ onBarringComplete: {
156+ mainView.closeUSSDProgressIndicator()
157+ mainView.ussdResponseTitle = String(i18n.tr("Call Barring") + " - " + cbService + "\n" + ssOp)
158+ mainView.ussdResponseText = ""
159+ for (var prop in cbMap) {
160+ if (cbMap[prop] !== "") {
161+ mainView.ussdResponseText += String(prop + ": " + cbMap[prop] + "\n")
162+ }
163+ }
164+ PopupUtils.open(ussdResponseDialog)
165+ }
166+ onForwardingComplete: {
167+ mainView.closeUSSDProgressIndicator()
168+ mainView.ussdResponseTitle = String(i18n.tr("Call Forwarding") + " - " + cfService + "\n" + ssOp)
169+ mainView.ussdResponseText = ""
170+ for (var prop in cfMap) {
171+ if (cfMap[prop] !== "") {
172+ mainView.ussdResponseText += String(prop + ": " + cfMap[prop] + "\n")
173+ }
174+ }
175+ PopupUtils.open(ussdResponseDialog)
176+ }
177+ onWaitingComplete: {
178+ mainView.closeUSSDProgressIndicator()
179+ mainView.ussdResponseTitle = String(i18n.tr("Call Waiting") + " - " + ssOp)
180+ mainView.ussdResponseText = ""
181+ for (var prop in cwMap) {
182+ if (cwMap[prop] !== "") {
183+ mainView.ussdResponseText += String(prop + ": " + cwMap[prop] + "\n")
184+ }
185+ }
186+ PopupUtils.open(ussdResponseDialog)
187+ }
188+ onCallingLinePresentationComplete: {
189+ mainView.closeUSSDProgressIndicator()
190+ mainView.ussdResponseTitle = String(i18n.tr("Calling Line Presentation") + " - " + ssOp)
191+ mainView.ussdResponseText = status
192+ PopupUtils.open(ussdResponseDialog)
193+ }
194+ onConnectedLinePresentationComplete: {
195+ mainView.closeUSSDProgressIndicator()
196+ mainView.ussdResponseTitle = String(i18n.tr("Connected Line Presentation") + " - " + ssOp)
197+ mainView.ussdResponseText = status
198+ PopupUtils.open(ussdResponseDialog)
199+ }
200+ onCallingLineRestrictionComplete: {
201+ mainView.closeUSSDProgressIndicator()
202+ mainView.ussdResponseTitle = String(i18n.tr("Calling Line Restriction") + " - " + ssOp)
203+ mainView.ussdResponseText = status
204+ PopupUtils.open(ussdResponseDialog)
205+ }
206+ onConnectedLineRestrictionComplete: {
207+ mainView.closeUSSDProgressIndicator()
208+ mainView.ussdResponseTitle = String(i18n.tr("Connected Line Restriction") + " - " + ssOp)
209+ mainView.ussdResponseText = status
210+ PopupUtils.open(ussdResponseDialog)
211+ }
212+ }
213+
214 PageStack {
215 id: pageStack
216 anchors.fill: parent

Subscribers

People subscribed via source and target branches