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
=== modified file 'src/imports/ABContactViewPage.qml'
--- src/imports/ABContactViewPage.qml 2015-05-15 20:13:54 +0000
+++ src/imports/ABContactViewPage.qml 2015-05-15 20:13:54 +0000
@@ -78,7 +78,7 @@
78 }78 }
79 }79 }
8080
81 onActionTrigerred: Qt.openUrlExternally(("%1:///%2").arg(action).arg(detail.value(0)))81 onActionTrigerred: Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))
8282
83 Component {83 Component {
84 id: contactShareComponent84 id: contactShareComponent
8585
=== modified file 'src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml'
--- src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-05-15 20:13:54 +0000
@@ -25,8 +25,6 @@
25 property QtObject contact: null25 property QtObject contact: null
26 property QtObject detail: null26 property QtObject detail: null
27 property variant fields: null27 property variant fields: null
28 signal actionTrigerred(string action)
29
30 // help to test used to retrieve the correct element28 // help to test used to retrieve the correct element
31 property int index: -129 property int index: -1
3230
3331
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailEmailsView.qml 2015-05-15 20:13:54 +0000
@@ -19,11 +19,14 @@
19import Ubuntu.Components 1.119import Ubuntu.Components 1.1
2020
21ContactDetailGroupWithTypeView {21ContactDetailGroupWithTypeView {
22 id: root
23
22 detailType: QtContacts.ContactDetail.Email24 detailType: QtContacts.ContactDetail.Email
23 title: i18n.dtr("address-book-app", "Email")25 title: i18n.dtr("address-book-app", "Email")
24 fields: [ 0 ]26 fields: [ 0 ]
25 defaultAction: Action {27 defaultAction: Action {
26 text: i18n.dtr("address-book-app", "Email")28 text: i18n.dtr("address-book-app", "Email")
29 name: "mailto"
27 iconName: "email"30 iconName: "email"
28 }31 }
29}32}
3033
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-05-15 20:13:54 +0000
@@ -25,8 +25,8 @@
25ContactDetailGroupWithTypeBase {25ContactDetailGroupWithTypeBase {
26 id: root26 id: root
2727
28 property Action defaultAction28 property QtObject defaultAction: null
29 signal actionTrigerred(string action, QtObject detail)29 signal actionTrigerred(string actionName, QtObject detail)
3030
31 showEmpty: false31 showEmpty: false
32 headerDelegate: ListItem.Empty {32 headerDelegate: ListItem.Empty {
@@ -61,6 +61,7 @@
6161
62 height: implicitHeight62 height: implicitHeight
63 width: root.width63 width: root.width
64 onClicked: root.actionTrigerred(action, detail)64
65 onClicked: root.actionTrigerred(root.defaultAction.name, detail)
65 }66 }
66}67}
6768
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumberView.qml 2015-05-15 20:13:54 +0000
@@ -25,6 +25,8 @@
25 property alias lineHeight: view.lineHeight25 property alias lineHeight: view.lineHeight
26 readonly property bool isReady: (fields != null) && (detail != null)26 readonly property bool isReady: (fields != null) && (detail != null)
2727
28 signal actionTrigerred(string actionName, QtObject detail)
29
28 function populateValues()30 function populateValues()
29 {31 {
30 if (isReady) {32 if (isReady) {
@@ -38,6 +40,7 @@
3840
39 implicitHeight: view.implicitHeight41 implicitHeight: view.implicitHeight
40 onIsReadyChanged: populateValues()42 onIsReadyChanged: populateValues()
43
41 Connections {44 Connections {
42 target: root.detail45 target: root.detail
43 onDetailChanged: populateValues()46 onDetailChanged: populateValues()
@@ -71,7 +74,7 @@
71 width: units.gu(4)74 width: units.gu(4)
72 height: units.gu(4)75 height: units.gu(4)
73 iconName: "message"76 iconName: "message"
74 onClicked: root.actionTrigerred("message")77 onClicked: root.actionTrigerred("message", root.detail)
75 }78 }
7679
7780
@@ -88,7 +91,6 @@
88 width: units.gu(4)91 width: units.gu(4)
89 height: units.gu(4)92 height: units.gu(4)
90 iconName: "call-start"93 iconName: "call-start"
91 onClicked: root.actionTrigerred("tel")94 onClicked: root.actionTrigerred("tel", root.detail)
92 }95 }
93
94}96}
9597
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailPhoneNumbersView.qml 2015-05-15 20:13:54 +0000
@@ -18,6 +18,7 @@
18import QtContacts 5.0 as QtContacts18import QtContacts 5.0 as QtContacts
1919
20import Ubuntu.Contacts 0.120import Ubuntu.Contacts 0.1
21import Ubuntu.Components 1.1
2122
22ContactDetailGroupWithTypeView {23ContactDetailGroupWithTypeView {
23 id: root24 id: root
@@ -27,15 +28,22 @@
2728
28 title: i18n.dtr("address-book-app", "Phone")29 title: i18n.dtr("address-book-app", "Phone")
29 typeModel: ContactDetailPhoneNumberTypeModel { }30 typeModel: ContactDetailPhoneNumberTypeModel { }
31 defaultAction: Action {
32 text: i18n.dtr("address-book-app", "Phone")
33 name: "default"
34 }
30 detailDelegate: ContactDetailPhoneNumberView {35 detailDelegate: ContactDetailPhoneNumberView {
31 property variant detailType: detail && root.contact && root.typeModelReady ? root.getType(detail) : null36 property variant detailType: detail && root.contact && root.typeModelReady ? root.getType(detail) : null
3237
38 action: root.defaultAction
33 contact: root.contact39 contact: root.contact
34 fields: root.fields40 fields: root.fields
35 typeLabel: detailType ? detailType.label : ""41 typeLabel: detailType ? detailType.label : ""
3642
37 height: implicitHeight43 height: implicitHeight
38 width: root.width44 width: root.width
39 onActionTrigerred: root.actionTrigerred(action, detail)45
46 onActionTrigerred: root.actionTrigerred(actionName, detail)
47 onClicked: root.actionTrigerred(root.defaultAction.name, detail)
40 }48 }
41}49}
4250
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-05-15 20:13:54 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.217import QtQuick 2.2
18import QtContacts 5.018import QtContacts 5.0
1919
20import Ubuntu.Components 1.1
20import Ubuntu.AddressBook.Base 0.121import Ubuntu.AddressBook.Base 0.1
2122
22ContactDetailBase {23ContactDetailBase {
@@ -39,6 +40,7 @@
3940
40 implicitHeight: view.implicitHeight41 implicitHeight: view.implicitHeight
41 onIsReadyChanged: populateValues()42 onIsReadyChanged: populateValues()
43
42 Connections {44 Connections {
43 target: root.detail45 target: root.detail
44 onDetailChanged: populateValues()46 onDetailChanged: populateValues()
@@ -52,11 +54,24 @@
52 parentIndex: root.index54 parentIndex: root.index
5355
54 anchors {56 anchors {
55 right: parent.right57 left: parent.left
58 leftMargin: units.gu(2)
59 right: icon.left
56 rightMargin: units.gu(2)60 rightMargin: units.gu(2)
57 top: parent.top61 top: parent.top
58 left: parent.left62 }
59 leftMargin: units.gu(2)63 }
60 }64
65 Icon {
66 id: icon
67
68 anchors {
69 right: parent.right
70 rightMargin: units.gu(3)
71 verticalCenter: parent.verticalCenter
72 }
73 width: root.action && (root.action.iconName !== "") ? units.gu(2.5) : 0
74 height: width
75 name: root.action ? root.action.iconName : ""
61 }76 }
62}77}
6378
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-05-15 20:13:54 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-05-15 20:13:54 +0000
@@ -123,7 +123,7 @@
123 right: parent.right123 right: parent.right
124 }124 }
125 height: implicitHeight125 height: implicitHeight
126 onActionTrigerred: root.actionTrigerred(action, root.contact, detail)126 onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
127 }127 }
128128
129 ContactDetailEmailsView {129 ContactDetailEmailsView {
@@ -135,6 +135,7 @@
135 right: parent.right135 right: parent.right
136 }136 }
137 height: implicitHeight137 height: implicitHeight
138 onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
138 }139 }
139140
140 ContactDetailOnlineAccountsView {141 ContactDetailOnlineAccountsView {
@@ -144,6 +145,7 @@
144 right: parent.right145 right: parent.right
145 }146 }
146 height: implicitHeight147 height: implicitHeight
148 onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
147 }149 }
148150
149 ContactDetailAddressesView {151 ContactDetailAddressesView {
@@ -155,6 +157,7 @@
155 right: parent.right157 right: parent.right
156 }158 }
157 height: implicitHeight159 height: implicitHeight
160 onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
158 }161 }
159162
160 ContactDetailOrganizationsView {163 ContactDetailOrganizationsView {
@@ -166,6 +169,7 @@
166 right: parent.right169 right: parent.right
167 }170 }
168 height: implicitHeight171 height: implicitHeight
172 onActionTrigerred: root.actionTrigerred(actionName, root.contact, detail)
169 }173 }
170174
171 Item {175 Item {
172176
=== modified file 'tests/data/vcard_single.vcf'
--- tests/data/vcard_single.vcf 2014-08-13 20:52:57 +0000
+++ tests/data/vcard_single.vcf 2015-05-15 20:13:54 +0000
@@ -12,5 +12,6 @@
12ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America12ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
13LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America13LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
14EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com14EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
15EMAIL;TYPE=INTERNET:bubbagump@example.com
15REV:2008-04-24T19:52:43Z16REV:2008-04-24T19:52:43Z
16END:VCARD17END:VCARD
1718
=== modified file 'tests/qml/tst_ContactPreviewPage.qml'
--- tests/qml/tst_ContactPreviewPage.qml 2015-05-15 20:13:54 +0000
+++ tests/qml/tst_ContactPreviewPage.qml 2015-05-15 20:13:54 +0000
@@ -43,6 +43,13 @@
43 return ContactUtilJS.createContact(details, root)43 return ContactUtilJS.createContact(details, root)
44 }44 }
4545
46 function createSignalSpy(target, signalName) {
47 var spy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', root, "")
48 spy.target = target
49 spy.signalName = signalName
50 return spy
51 }
52
46 VCardParser {53 VCardParser {
47 id: vcardParser54 id: vcardParser
4855
@@ -113,7 +120,6 @@
113 {120 {
114 compare(vcardParser.contacts.length, 1)121 compare(vcardParser.contacts.length, 1)
115 var contact = vcardParser.contacts[0]122 var contact = vcardParser.contacts[0]
116 console.debug("Contact: " + contact.phoneNumber.number)
117 contactPreviewPage.contact = contact123 contactPreviewPage.contact = contact
118 tryCompare(contactPreviewPage, "title", "Forrest Gump")124 tryCompare(contactPreviewPage, "title", "Forrest Gump")
119 // PhoneNumbers125 // PhoneNumbers
@@ -143,7 +149,7 @@
143 // number of e-mails149 // number of e-mails
144 var emailGroup = findChild(root, "emails")150 var emailGroup = findChild(root, "emails")
145 var emails = findChildOfType(emailGroup, "BasicFieldView")151 var emails = findChildOfType(emailGroup, "BasicFieldView")
146 compare(emails.length, 1)152 compare(emails.length, 2)
147153
148 // e-mail address154 // e-mail address
149 var email = findChild(emailGroup, "label_emailAddress_0.0")155 var email = findChild(emailGroup, "label_emailAddress_0.0")
@@ -151,6 +157,13 @@
151 compare(email.text, "forrestgump@example.com")157 compare(email.text, "forrestgump@example.com")
152 compare(emailType.text, "Home")158 compare(emailType.text, "Home")
153159
160 // e-mail address
161 var email1 = findChild(emailGroup, "label_emailAddress_1.0")
162 var emailType1 = findChild(emailGroup, "type_email_1")
163 compare(email1.text, "bubbagump@example.com")
164 compare(emailType1.text, "Home")
165
166
154 // Address167 // Address
155 // ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America168 // ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
156 // ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America169 // ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
@@ -205,6 +218,45 @@
205 compare(org_role.text, "")218 compare(org_role.text, "")
206 compare(org_title.text, "Shrimp Man")219 compare(org_title.text, "Shrimp Man")
207 }220 }
221
222 function test_click_on_email()
223 {
224 // load contact from vcard
225 compare(vcardParser.contacts.length, 1)
226 var contact = vcardParser.contacts[0]
227 contactPreviewPage.contact = contact
228 // wait contact be loaded
229 waitForRendering(contactPreviewPage);
230
231 // find object 0
232 var emailGroup = findChild(root, "emails")
233 var email = findChild(emailGroup, "label_emailAddress_0.0")
234 tryCompare(email, "text", "forrestgump@example.com")
235 tryCompare(email, "visible", true)
236
237 // click on e-mail field
238 var spy = root.createSignalSpy(contactPreviewPage, "actionTrigerred");
239 mouseClick(email, email.width / 2, email.height / 2)
240
241 tryCompare(spy, "count", 1)
242 compare(spy.signalArguments[0][0], "mailto")
243 compare(spy.signalArguments[0][2].value(0), "forrestgump@example.com")
244
245 spy.clear()
246
247 // find object 1
248 var email1 = findChild(emailGroup, "label_emailAddress_1.0")
249 tryCompare(email1, "text", "bubbagump@example.com")
250 tryCompare(email1, "visible", true)
251
252 // click on e-mail field
253 mouseClick(email1, email1.width / 2, email1.height / 2)
254
255 // check new values
256 tryCompare(spy, "count", 1)
257 compare(spy.signalArguments[0][0], "mailto")
258 compare(spy.signalArguments[0][2].value(0), "bubbagump@example.com")
259 }
208 }260 }
209}261}
210262

Subscribers

People subscribed via source and target branches