Merge lp:~renatofilho/address-book-app/mailto into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 454
Merged at revision: 438
Proposed branch: lp:~renatofilho/address-book-app/mailto
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/no-expasion
Diff against target: 342 lines (+101/-17)
10 files modified
src/imports/ABContactViewPage.qml (+1/-1)
src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml (+0/-2)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml (+3/-0)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml (+4/-3)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml (+5/-3)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml (+9/-1)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml (+19/-4)
src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml (+5/-1)
tests/data/vcard_single.vcf (+1/-0)
tests/qml/tst_ContactPreviewPage.qml (+54/-2)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/mailto
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+259150@code.launchpad.net

Commit message

Add 'mailto' url call when clicking on e-mail field.

To post a comment you must log in.
450. By Renato Araujo Oliveira Filho

Created unit test for click on e-mail field.

451. By Renato Araujo Oliveira Filho

Used offscreen module on qmltestrunner instead of xvfb.

452. By Renato Araujo Oliveira Filho

Removed xvfb from build dep.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
453. By Renato Araujo Oliveira Filho

Try fix tests on ppa.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
454. By Renato Araujo Oliveira Filho

Revert xvfb removal.
The tests fail on ppa without it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Are there any related MPs required for this MP to build/function as expected?
NO

Is your branch in sync with latest trunk?
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 on device or emulator?
YES

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

If you changed UI labels, did you update the pot file?
NO LABEL CHANGE

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
NO PACKAGE CHANGE

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

review: Approve
455. By Renato Araujo Oliveira Filho

Use Qt.openUrlExternally("<action>:<value>") as default instead of Qt.openUrlExternally("<action>:///<value>")

456. By Renato Araujo Oliveira Filho

Fixed detail click function.

457. By Renato Araujo Oliveira Filho

Create unit test for contacts with multiple e-mails.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/ABContactViewPage.qml'
2--- src/imports/ABContactViewPage.qml 2015-05-15 20:13:54 +0000
3+++ src/imports/ABContactViewPage.qml 2015-05-15 20:13:54 +0000
4@@ -78,7 +78,7 @@
5 }
6 }
7
8- onActionTrigerred: Qt.openUrlExternally(("%1:///%2").arg(action).arg(detail.value(0)))
9+ onActionTrigerred: Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))
10
11 Component {
12 id: contactShareComponent
13
14=== modified file 'src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml'
15--- src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-05-15 20:13:54 +0000
16+++ src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-05-15 20:13:54 +0000
17@@ -25,8 +25,6 @@
18 property QtObject contact: null
19 property QtObject detail: null
20 property variant fields: null
21- signal actionTrigerred(string action)
22-
23 // help to test used to retrieve the correct element
24 property int index: -1
25
26
27=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml'
28--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml 2015-05-15 20:13:54 +0000
29+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml 2015-05-15 20:13:54 +0000
30@@ -19,11 +19,14 @@
31 import Ubuntu.Components 1.1
32
33 ContactDetailGroupWithTypeView {
34+ id: root
35+
36 detailType: QtContacts.ContactDetail.Email
37 title: i18n.dtr("address-book-app", "Email")
38 fields: [ 0 ]
39 defaultAction: Action {
40 text: i18n.dtr("address-book-app", "Email")
41+ name: "mailto"
42 iconName: "email"
43 }
44 }
45
46=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml'
47--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-05-15 20:13:54 +0000
48+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-05-15 20:13:54 +0000
49@@ -25,8 +25,8 @@
50 ContactDetailGroupWithTypeBase {
51 id: root
52
53- property Action defaultAction
54- signal actionTrigerred(string action, QtObject detail)
55+ property QtObject defaultAction: null
56+ signal actionTrigerred(string actionName, QtObject detail)
57
58 showEmpty: false
59 headerDelegate: ListItem.Empty {
60@@ -61,6 +61,7 @@
61
62 height: implicitHeight
63 width: root.width
64- onClicked: root.actionTrigerred(action, detail)
65+
66+ onClicked: root.actionTrigerred(root.defaultAction.name, detail)
67 }
68 }
69
70=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml'
71--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml 2015-05-15 20:13:54 +0000
72+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml 2015-05-15 20:13:54 +0000
73@@ -25,6 +25,8 @@
74 property alias lineHeight: view.lineHeight
75 readonly property bool isReady: (fields != null) && (detail != null)
76
77+ signal actionTrigerred(string actionName, QtObject detail)
78+
79 function populateValues()
80 {
81 if (isReady) {
82@@ -38,6 +40,7 @@
83
84 implicitHeight: view.implicitHeight
85 onIsReadyChanged: populateValues()
86+
87 Connections {
88 target: root.detail
89 onDetailChanged: populateValues()
90@@ -71,7 +74,7 @@
91 width: units.gu(4)
92 height: units.gu(4)
93 iconName: "message"
94- onClicked: root.actionTrigerred("message")
95+ onClicked: root.actionTrigerred("message", root.detail)
96 }
97
98
99@@ -88,7 +91,6 @@
100 width: units.gu(4)
101 height: units.gu(4)
102 iconName: "call-start"
103- onClicked: root.actionTrigerred("tel")
104+ onClicked: root.actionTrigerred("tel", root.detail)
105 }
106-
107 }
108
109=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml'
110--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml 2015-05-15 20:13:54 +0000
111+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml 2015-05-15 20:13:54 +0000
112@@ -18,6 +18,7 @@
113 import QtContacts 5.0 as QtContacts
114
115 import Ubuntu.Contacts 0.1
116+import Ubuntu.Components 1.1
117
118 ContactDetailGroupWithTypeView {
119 id: root
120@@ -27,15 +28,22 @@
121
122 title: i18n.dtr("address-book-app", "Phone")
123 typeModel: ContactDetailPhoneNumberTypeModel { }
124+ defaultAction: Action {
125+ text: i18n.dtr("address-book-app", "Phone")
126+ name: "default"
127+ }
128 detailDelegate: ContactDetailPhoneNumberView {
129 property variant detailType: detail && root.contact && root.typeModelReady ? root.getType(detail) : null
130
131+ action: root.defaultAction
132 contact: root.contact
133 fields: root.fields
134 typeLabel: detailType ? detailType.label : ""
135
136 height: implicitHeight
137 width: root.width
138- onActionTrigerred: root.actionTrigerred(action, detail)
139+
140+ onActionTrigerred: root.actionTrigerred(actionName, detail)
141+ onClicked: root.actionTrigerred(root.defaultAction.name, detail)
142 }
143 }
144
145=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml'
146--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-05-15 20:13:54 +0000
147+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-05-15 20:13:54 +0000
148@@ -17,6 +17,7 @@
149 import QtQuick 2.2
150 import QtContacts 5.0
151
152+import Ubuntu.Components 1.1
153 import Ubuntu.AddressBook.Base 0.1
154
155 ContactDetailBase {
156@@ -39,6 +40,7 @@
157
158 implicitHeight: view.implicitHeight
159 onIsReadyChanged: populateValues()
160+
161 Connections {
162 target: root.detail
163 onDetailChanged: populateValues()
164@@ -52,11 +54,24 @@
165 parentIndex: root.index
166
167 anchors {
168- right: parent.right
169+ left: parent.left
170+ leftMargin: units.gu(2)
171+ right: icon.left
172 rightMargin: units.gu(2)
173 top: parent.top
174- left: parent.left
175- leftMargin: units.gu(2)
176- }
177+ }
178+ }
179+
180+ Icon {
181+ id: icon
182+
183+ anchors {
184+ right: parent.right
185+ rightMargin: units.gu(3)
186+ verticalCenter: parent.verticalCenter
187+ }
188+ width: root.action && (root.action.iconName !== "") ? units.gu(2.5) : 0
189+ height: width
190+ name: root.action ? root.action.iconName : ""
191 }
192 }
193
194=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml'
195--- src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-05-15 20:13:54 +0000
196+++ src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-05-15 20:13:54 +0000
197@@ -123,7 +123,7 @@
198 right: parent.right
199 }
200 height: implicitHeight
201- onActionTrigerred: root.actionTrigerred(action, root.contact, detail)
202+ onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
203 }
204
205 ContactDetailEmailsView {
206@@ -135,6 +135,7 @@
207 right: parent.right
208 }
209 height: implicitHeight
210+ onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
211 }
212
213 ContactDetailOnlineAccountsView {
214@@ -144,6 +145,7 @@
215 right: parent.right
216 }
217 height: implicitHeight
218+ onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
219 }
220
221 ContactDetailAddressesView {
222@@ -155,6 +157,7 @@
223 right: parent.right
224 }
225 height: implicitHeight
226+ onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
227 }
228
229 ContactDetailOrganizationsView {
230@@ -166,6 +169,7 @@
231 right: parent.right
232 }
233 height: implicitHeight
234+ onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
235 }
236
237 Item {
238
239=== modified file 'tests/data/vcard_single.vcf'
240--- tests/data/vcard_single.vcf 2014-08-13 20:52:57 +0000
241+++ tests/data/vcard_single.vcf 2015-05-15 20:13:54 +0000
242@@ -12,5 +12,6 @@
243 ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
244 LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
245 EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
246+EMAIL;TYPE=INTERNET:bubbagump@example.com
247 REV:2008-04-24T19:52:43Z
248 END:VCARD
249
250=== modified file 'tests/qml/tst_ContactPreviewPage.qml'
251--- tests/qml/tst_ContactPreviewPage.qml 2015-05-15 20:13:54 +0000
252+++ tests/qml/tst_ContactPreviewPage.qml 2015-05-15 20:13:54 +0000
253@@ -43,6 +43,13 @@
254 return ContactUtilJS.createContact(details, root)
255 }
256
257+ function createSignalSpy(target, signalName) {
258+ var spy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', root, "")
259+ spy.target = target
260+ spy.signalName = signalName
261+ return spy
262+ }
263+
264 VCardParser {
265 id: vcardParser
266
267@@ -113,7 +120,6 @@
268 {
269 compare(vcardParser.contacts.length, 1)
270 var contact = vcardParser.contacts[0]
271- console.debug("Contact: " + contact.phoneNumber.number)
272 contactPreviewPage.contact = contact
273 tryCompare(contactPreviewPage, "title", "Forrest Gump")
274 // PhoneNumbers
275@@ -143,7 +149,7 @@
276 // number of e-mails
277 var emailGroup = findChild(root, "emails")
278 var emails = findChildOfType(emailGroup, "BasicFieldView")
279- compare(emails.length, 1)
280+ compare(emails.length, 2)
281
282 // e-mail address
283 var email = findChild(emailGroup, "label_emailAddress_0.0")
284@@ -151,6 +157,13 @@
285 compare(email.text, "forrestgump@example.com")
286 compare(emailType.text, "Home")
287
288+ // e-mail address
289+ var email1 = findChild(emailGroup, "label_emailAddress_1.0")
290+ var emailType1 = findChild(emailGroup, "type_email_1")
291+ compare(email1.text, "bubbagump@example.com")
292+ compare(emailType1.text, "Home")
293+
294+
295 // Address
296 // ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
297 // ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
298@@ -205,6 +218,45 @@
299 compare(org_role.text, "")
300 compare(org_title.text, "Shrimp Man")
301 }
302+
303+ function test_click_on_email()
304+ {
305+ // load contact from vcard
306+ compare(vcardParser.contacts.length, 1)
307+ var contact = vcardParser.contacts[0]
308+ contactPreviewPage.contact = contact
309+ // wait contact be loaded
310+ waitForRendering(contactPreviewPage);
311+
312+ // find object 0
313+ var emailGroup = findChild(root, "emails")
314+ var email = findChild(emailGroup, "label_emailAddress_0.0")
315+ tryCompare(email, "text", "forrestgump@example.com")
316+ tryCompare(email, "visible", true)
317+
318+ // click on e-mail field
319+ var spy = root.createSignalSpy(contactPreviewPage, "actionTrigerred");
320+ mouseClick(email, email.width / 2, email.height / 2)
321+
322+ tryCompare(spy, "count", 1)
323+ compare(spy.signalArguments[0][0], "mailto")
324+ compare(spy.signalArguments[0][2].value(0), "forrestgump@example.com")
325+
326+ spy.clear()
327+
328+ // find object 1
329+ var email1 = findChild(emailGroup, "label_emailAddress_1.0")
330+ tryCompare(email1, "text", "bubbagump@example.com")
331+ tryCompare(email1, "visible", true)
332+
333+ // click on e-mail field
334+ mouseClick(email1, email1.width / 2, email1.height / 2)
335+
336+ // check new values
337+ tryCompare(spy, "count", 1)
338+ compare(spy.signalArguments[0][0], "mailto")
339+ compare(spy.signalArguments[0][2].value(0), "bubbagump@example.com")
340+ }
341 }
342 }
343

Subscribers

People subscribed via source and target branches