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
=== modified file 'src/qml/Messages.qml'
--- src/qml/Messages.qml 2013-09-25 17:07:07 +0000
+++ src/qml/Messages.qml 2013-09-27 17:28:42 +0000
@@ -51,6 +51,32 @@
51 return eventModel.markEventAsRead(accountId, threadId, eventId, type);51 return eventModel.markEventAsRead(accountId, threadId, eventId, type);
52 }52 }
5353
54 Component {
55 id: newContactDialog
56 Dialog {
57 id: dialogue
58 title: i18n.tr("Save contact")
59 text: i18n.tr("How do you want to save the contact?")
60 Button {
61 text: i18n.tr("Add to existing contact")
62 color: UbuntuColors.orange
63 onClicked: {
64 PopupUtils.open(addPhoneNumberToContactSheet)
65 PopupUtils.close(dialogue)
66 }
67 }
68 Button {
69 text: i18n.tr("Create new contact")
70 color: UbuntuColors.warmGrey
71 onClicked: {
72 applicationUtils.switchToAddressbookApp("addressbook://create" +
73 "?phone=" + encodeURIComponent(contactWatcher.phoneNumber))
74 PopupUtils.close(dialogue)
75 }
76 }
77 }
78 }
79
54 ContactWatcher {80 ContactWatcher {
55 id: contactWatcher81 id: contactWatcher
56 }82 }
@@ -60,7 +86,36 @@
60 }86 }
6187
62 Component {88 Component {
63 id: contactsSheet89 id: addPhoneNumberToContactSheet
90 DefaultSheet {
91 // FIXME: workaround to set the contact list
92 // background to black
93 Rectangle {
94 anchors.fill: parent
95 anchors.margins: -units.gu(1)
96 color: "#221e1c"
97 }
98 id: sheet
99 title: "Add Contact"
100 doneButton: false
101 modal: true
102 contentsHeight: parent.height
103 contentsWidth: parent.width
104 ContactListView {
105 anchors.fill: parent
106 onContactClicked: {
107 applicationUtils.switchToAddressbookApp("addressbook://addphone" +
108 "?id=" + encodeURIComponent(contact.contactId) +
109 "&phone=" + encodeURIComponent(contactWatcher.phoneNumber))
110 PopupUtils.close(sheet)
111 }
112 }
113 onDoneClicked: PopupUtils.close(sheet)
114 }
115 }
116
117 Component {
118 id: addContactToConversationSheet
64 DefaultSheet {119 DefaultSheet {
65 // FIXME: workaround to set the contact list120 // FIXME: workaround to set the contact list
66 // background to black121 // background to black
@@ -110,9 +165,9 @@
110 objectName: "addContactButton"165 objectName: "addContactButton"
111 action: Action {166 action: Action {
112 iconSource: Qt.resolvedUrl("assets/new-contact.svg")167 iconSource: Qt.resolvedUrl("assets/new-contact.svg")
113 text: i18n.tr("Add contact")168 text: i18n.tr("Add")
114 onTriggered: {169 onTriggered: {
115 applicationUtils.switchToAddressbookApp("create://" + contactWatcher.phoneNumber)170 PopupUtils.open(newContactDialog)
116 messagesToolbar.opened = false171 messagesToolbar.opened = false
117 }172 }
118 }173 }
@@ -124,7 +179,7 @@
124 iconSource: Qt.resolvedUrl("assets/contact.svg")179 iconSource: Qt.resolvedUrl("assets/contact.svg")
125 text: i18n.tr("Contact")180 text: i18n.tr("Contact")
126 onTriggered: {181 onTriggered: {
127 applicationUtils.switchToAddressbookApp("contact://" + contactWatcher.contactId)182 applicationUtils.switchToAddressbookApp("addressbook://contact?id=" + encodeURIComponent(contactWatcher.contactId))
128 messagesToolbar.opened = false183 messagesToolbar.opened = false
129 }184 }
130 }185 }
@@ -225,7 +280,7 @@
225 source: Qt.resolvedUrl("assets/new-contact.svg")280 source: Qt.resolvedUrl("assets/new-contact.svg")
226 MouseArea {281 MouseArea {
227 anchors.fill: parent282 anchors.fill: parent
228 onClicked: PopupUtils.open(contactsSheet)283 onClicked: PopupUtils.open(addContactToConversationSheet)
229 }284 }
230 }285 }
231 }286 }
232287
=== modified file 'src/qml/ThreadDelegate.qml'
--- src/qml/ThreadDelegate.qml 2013-09-09 18:43:24 +0000
+++ src/qml/ThreadDelegate.qml 2013-09-27 17:28:42 +0000
@@ -46,32 +46,11 @@
46 image: Image {46 image: Image {
47 anchors.fill: parent47 anchors.fill: parent
48 source: {48 source: {
49 if(!unknownContact) {49 if(!unknownContact && delegateHelper.avatar !== "") {
50 if (delegateHelper.avatar != "") {50 return delegateHelper.avatar
51 return delegateHelper.avatar51 }
52 }52 return Qt.resolvedUrl("assets/avatar-default.png")
53 return Qt.resolvedUrl("assets/avatar-default.png")53 }
54 }
55 return Qt.resolvedUrl("assets/new-contact.svg")
56 }
57 }
58 MouseArea {
59 anchors.fill: avatar
60 onClicked: {
61 mainView.newPhoneNumber = delegateHelper.phoneNumber
62 if (selectionMode) {
63 delegate.clicked()
64 } else {
65 PopupUtils.open(newcontactPopover, avatar)
66 }
67 }
68 onPressAndHold: {
69 mainView.newPhoneNumber = delegateHelper.phoneNumber
70 if (!selectionMode) {
71 PopupUtils.open(newcontactPopover, avatar)
72 }
73 }
74 enabled: unknownContact
75 }54 }
76 }55 }
7756

Subscribers

People subscribed via source and target branches