Merge lp:~tiagosh/dialer-app/fallback-to-original-number into lp:dialer-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 479
Merged at revision: 481
Proposed branch: lp:~tiagosh/dialer-app/fallback-to-original-number
Merge into: lp:dialer-app
Diff against target: 65 lines (+16/-5)
2 files modified
src/qml/HistoryPage/HistoryDelegate.qml (+5/-1)
src/qml/HistoryPage/HistoryDetailsPage.qml (+11/-4)
To merge this branch: bzr merge lp:~tiagosh/dialer-app/fallback-to-original-number
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+277252@code.launchpad.net

Commit message

Fallback to original phone number when format() returns a blank string

Description of the change

Fallback to original phone number when format() returns a blank string

To post a comment you must log in.
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/HistoryPage/HistoryDelegate.qml'
2--- src/qml/HistoryPage/HistoryDelegate.qml 2015-10-23 20:43:44 +0000
3+++ src/qml/HistoryPage/HistoryDelegate.qml 2015-11-11 14:25:58 +0000
4@@ -170,7 +170,11 @@
5 } else if (participant.alias && participant.alias !== "") {
6 return participant.alias
7 }
8- return PhoneUtils.PhoneUtils.format(phoneNumber)
9+ var formattedPhoneNumber = PhoneUtils.PhoneUtils.format(phoneNumber)
10+ if (formattedPhoneNumber !== "") {
11+ return formattedPhoneNumber
12+ }
13+ return phoneNumber
14 }
15 elide: Text.ElideRight
16 color: UbuntuColors.lightAubergine
17
18=== modified file 'src/qml/HistoryPage/HistoryDetailsPage.qml'
19--- src/qml/HistoryPage/HistoryDetailsPage.qml 2015-09-07 15:40:45 +0000
20+++ src/qml/HistoryPage/HistoryDetailsPage.qml 2015-11-11 14:25:58 +0000
21@@ -37,7 +37,8 @@
22
23 objectName: "historyDetailsPage"
24 anchors.fill: parent
25- title: {
26+
27+ function getFormattedPhoneLabel(phoneNumber) {
28 if (phoneNumber == "x-ofono-private") {
29 return i18n.tr("Private number")
30 } else if (phoneNumber == "x-ofono-unknown") {
31@@ -45,9 +46,15 @@
32 } else if (contactWatcher.alias != "") {
33 return contactWatcher.alias
34 }
35- return PhoneUtils.PhoneUtils.format(phoneNumber)
36+ var formattedPhoneNumber = PhoneUtils.PhoneUtils.format(phoneNumber)
37+ if (formattedPhoneNumber !== "") {
38+ return formattedPhoneNumber
39+ }
40+ return phoneNumber
41 }
42
43+ title: getFormattedPhoneLabel(phoneNumber)
44+
45 head.actions: [
46 Action {
47 iconName: unknownContact ? "contact-new" : "stock_contact"
48@@ -138,7 +145,7 @@
49 }
50 verticalAlignment: Text.AlignTop
51 fontSize: "medium"
52- text: PhoneUtils.PhoneUtils.format(phoneNumber)
53+ text: getFormattedPhoneLabel(phoneNumber)
54 elide: Text.ElideRight
55 color: UbuntuColors.lightAubergine
56 height: units.gu(2)
57@@ -263,7 +270,7 @@
58 Label {
59 id: remoteParticipantId
60 // FIXME: we need to check if the id is actually a phone number
61- text: PhoneUtils.PhoneUtils.format(modelData.remoteParticipant)
62+ text: getFormattedPhoneLabel(modelData.remoteParticipant)
63 anchors {
64 left: timeLabel.right
65 leftMargin: units.gu(1)

Subscribers

People subscribed via source and target branches