Merge lp:~tiagosh/messaging-app/fix-1231442 into lp:messaging-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 41
Merged at revision: 40
Proposed branch: lp:~tiagosh/messaging-app/fix-1231442
Merge into: lp:messaging-app
Diff against target: 145 lines (+65/-31)
2 files modified
src/qml/Messages.qml (+60/-5)
src/qml/ThreadDelegate.qml (+5/-26)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/fix-1231442
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+188088@code.launchpad.net

Commit message

Replace the "new contact" icon used for unknown contacts on the conversations list by the default avatar.
Remove popup when tapping unknown contact avatars and implement a dialog for adding new contacts.

Description of the change

Replace the "new contact" icon used for unknown contacts on the conversations list by the default avatar.
Remove popup when tapping unknown contact avatars and implement a dialog for adding new contacts.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
41. By Tiago Salem Herrmann

Change label

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good and works fine!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/Messages.qml'
2--- src/qml/Messages.qml 2013-09-25 17:07:07 +0000
3+++ src/qml/Messages.qml 2013-09-27 17:28:42 +0000
4@@ -51,6 +51,32 @@
5 return eventModel.markEventAsRead(accountId, threadId, eventId, type);
6 }
7
8+ Component {
9+ id: newContactDialog
10+ Dialog {
11+ id: dialogue
12+ title: i18n.tr("Save contact")
13+ text: i18n.tr("How do you want to save the contact?")
14+ Button {
15+ text: i18n.tr("Add to existing contact")
16+ color: UbuntuColors.orange
17+ onClicked: {
18+ PopupUtils.open(addPhoneNumberToContactSheet)
19+ PopupUtils.close(dialogue)
20+ }
21+ }
22+ Button {
23+ text: i18n.tr("Create new contact")
24+ color: UbuntuColors.warmGrey
25+ onClicked: {
26+ applicationUtils.switchToAddressbookApp("addressbook://create" +
27+ "?phone=" + encodeURIComponent(contactWatcher.phoneNumber))
28+ PopupUtils.close(dialogue)
29+ }
30+ }
31+ }
32+ }
33+
34 ContactWatcher {
35 id: contactWatcher
36 }
37@@ -60,7 +86,36 @@
38 }
39
40 Component {
41- id: contactsSheet
42+ id: addPhoneNumberToContactSheet
43+ DefaultSheet {
44+ // FIXME: workaround to set the contact list
45+ // background to black
46+ Rectangle {
47+ anchors.fill: parent
48+ anchors.margins: -units.gu(1)
49+ color: "#221e1c"
50+ }
51+ id: sheet
52+ title: "Add Contact"
53+ doneButton: false
54+ modal: true
55+ contentsHeight: parent.height
56+ contentsWidth: parent.width
57+ ContactListView {
58+ anchors.fill: parent
59+ onContactClicked: {
60+ applicationUtils.switchToAddressbookApp("addressbook://addphone" +
61+ "?id=" + encodeURIComponent(contact.contactId) +
62+ "&phone=" + encodeURIComponent(contactWatcher.phoneNumber))
63+ PopupUtils.close(sheet)
64+ }
65+ }
66+ onDoneClicked: PopupUtils.close(sheet)
67+ }
68+ }
69+
70+ Component {
71+ id: addContactToConversationSheet
72 DefaultSheet {
73 // FIXME: workaround to set the contact list
74 // background to black
75@@ -110,9 +165,9 @@
76 objectName: "addContactButton"
77 action: Action {
78 iconSource: Qt.resolvedUrl("assets/new-contact.svg")
79- text: i18n.tr("Add contact")
80+ text: i18n.tr("Add")
81 onTriggered: {
82- applicationUtils.switchToAddressbookApp("create://" + contactWatcher.phoneNumber)
83+ PopupUtils.open(newContactDialog)
84 messagesToolbar.opened = false
85 }
86 }
87@@ -124,7 +179,7 @@
88 iconSource: Qt.resolvedUrl("assets/contact.svg")
89 text: i18n.tr("Contact")
90 onTriggered: {
91- applicationUtils.switchToAddressbookApp("contact://" + contactWatcher.contactId)
92+ applicationUtils.switchToAddressbookApp("addressbook://contact?id=" + encodeURIComponent(contactWatcher.contactId))
93 messagesToolbar.opened = false
94 }
95 }
96@@ -225,7 +280,7 @@
97 source: Qt.resolvedUrl("assets/new-contact.svg")
98 MouseArea {
99 anchors.fill: parent
100- onClicked: PopupUtils.open(contactsSheet)
101+ onClicked: PopupUtils.open(addContactToConversationSheet)
102 }
103 }
104 }
105
106=== modified file 'src/qml/ThreadDelegate.qml'
107--- src/qml/ThreadDelegate.qml 2013-09-09 18:43:24 +0000
108+++ src/qml/ThreadDelegate.qml 2013-09-27 17:28:42 +0000
109@@ -46,32 +46,11 @@
110 image: Image {
111 anchors.fill: parent
112 source: {
113- if(!unknownContact) {
114- if (delegateHelper.avatar != "") {
115- return delegateHelper.avatar
116- }
117- return Qt.resolvedUrl("assets/avatar-default.png")
118- }
119- return Qt.resolvedUrl("assets/new-contact.svg")
120- }
121- }
122- MouseArea {
123- anchors.fill: avatar
124- onClicked: {
125- mainView.newPhoneNumber = delegateHelper.phoneNumber
126- if (selectionMode) {
127- delegate.clicked()
128- } else {
129- PopupUtils.open(newcontactPopover, avatar)
130- }
131- }
132- onPressAndHold: {
133- mainView.newPhoneNumber = delegateHelper.phoneNumber
134- if (!selectionMode) {
135- PopupUtils.open(newcontactPopover, avatar)
136- }
137- }
138- enabled: unknownContact
139+ if(!unknownContact && delegateHelper.avatar !== "") {
140+ return delegateHelper.avatar
141+ }
142+ return Qt.resolvedUrl("assets/avatar-default.png")
143+ }
144 }
145 }
146

Subscribers

People subscribed via source and target branches