Merge lp:~phablet-team/messaging-app/background_and_overlay into lp:messaging-app

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 495
Merged at revision: 490
Proposed branch: lp:~phablet-team/messaging-app/background_and_overlay
Merge into: lp:messaging-app
Prerequisite: lp:~phablet-team/messaging-app/voice_recording
Diff against target: 177 lines (+88/-5)
4 files modified
src/qml/MainPage.qml (+1/-0)
src/qml/MessageDelegateFactory.qml (+1/-0)
src/qml/Messages.qml (+29/-1)
src/qml/ThreadDelegate.qml (+57/-4)
To merge this branch: bzr merge lp:~phablet-team/messaging-app/background_and_overlay
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+280497@code.launchpad.net

Commit message

Show an overlay icon and a background image depending on the protocol used.

Description of the change

Show an overlay icon and a background image depending on the protocol used.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve
496. By Gustavo Pichorim Boiko

Merge parent

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/qml/MainPage.qml'
--- src/qml/MainPage.qml 2015-10-30 13:21:59 +0000
+++ src/qml/MainPage.qml 2015-12-16 19:35:20 +0000
@@ -218,6 +218,7 @@
218 }218 }
219 properties["participantIds"] = participantIds219 properties["participantIds"] = participantIds
220 properties["participants"] = model.participants220 properties["participants"] = model.participants
221 properties["presenceRequest"] = threadDelegate.presenceItem
221 if (displayedEvent != null) {222 if (displayedEvent != null) {
222 properties["scrollToEventId"] = displayedEvent.eventId223 properties["scrollToEventId"] = displayedEvent.eventId
223 }224 }
224225
=== modified file 'src/qml/MessageDelegateFactory.qml'
--- src/qml/MessageDelegateFactory.qml 2015-09-14 13:51:27 +0000
+++ src/qml/MessageDelegateFactory.qml 2015-12-16 19:35:20 +0000
@@ -35,6 +35,7 @@
35 signal resendMessage()35 signal resendMessage()
36 signal copyMessage()36 signal copyMessage()
37 signal showMessageDetails()37 signal showMessageDetails()
38 color: "transparent"
3839
39 width: messageList.width40 width: messageList.width
40 leftSideAction: Action {41 leftSideAction: Action {
4142
=== modified file 'src/qml/Messages.qml'
--- src/qml/Messages.qml 2015-12-16 19:35:19 +0000
+++ src/qml/Messages.qml 2015-12-16 19:35:20 +0000
@@ -59,6 +59,7 @@
59 property string firstParticipantId: participantIds.length > 0 ? participantIds[0] : ""59 property string firstParticipantId: participantIds.length > 0 ? participantIds[0] : ""
60 property variant firstParticipant: participants.length > 0 ? participants[0] : null60 property variant firstParticipant: participants.length > 0 ? participants[0] : null
61 property var threads: []61 property var threads: []
62 property QtObject presenceRequest: presenceItem
62 property var accountsModel: getAccountsModel()63 property var accountsModel: getAccountsModel()
63 function getAccountsModel() {64 function getAccountsModel() {
64 var accounts = []65 var accounts = []
@@ -428,7 +429,7 @@
428 }429 }
429430
430 PresenceRequest {431 PresenceRequest {
431 id: presenceRequest432 id: presenceItem
432 accountId: {433 accountId: {
433 // if this is a regular sms chat, try requesting the presence on434 // if this is a regular sms chat, try requesting the presence on
434 // a multimedia account435 // a multimedia account
@@ -953,6 +954,33 @@
953 objectName: "messageList"954 objectName: "messageList"
954 visible: !isSearching955 visible: !isSearching
955956
957 Rectangle {
958 color: Theme.palette.normal.background
959 anchors.fill: parent
960 Image {
961 width: units.gu(20)
962 fillMode: Image.PreserveAspectFit
963 anchors.centerIn: parent
964 visible: source !== ""
965 source: {
966 var accountId = ""
967
968 if (messages.account) {
969 accountId = messages.account.accountId
970 }
971
972 if (presenceRequest.type != PresenceRequest.PresenceTypeUnknown
973 && presenceRequest.type != PresenceRequest.PresenceTypeUnset) {
974 accountId = presenceRequest.accountId
975 }
976
977 return telepathyHelper.accountForId(accountId).protocolInfo.backgroundImage
978 }
979 z: 1
980 }
981 z: -1
982 }
983
956 // because of the header984 // because of the header
957 clip: true985 clip: true
958 anchors {986 anchors {
959987
=== modified file 'src/qml/ThreadDelegate.qml'
--- src/qml/ThreadDelegate.qml 2015-10-23 20:41:36 +0000
+++ src/qml/ThreadDelegate.qml 2015-12-16 19:35:20 +0000
@@ -38,6 +38,7 @@
38 property var displayedEventTextAttachments: displayedEvent ? displayedEvent.textMessageAttachments : eventTextAttachments38 property var displayedEventTextAttachments: displayedEvent ? displayedEvent.textMessageAttachments : eventTextAttachments
39 property var displayedEventTimestamp: displayedEvent ? displayedEvent.timestamp : eventTimestamp39 property var displayedEventTimestamp: displayedEvent ? displayedEvent.timestamp : eventTimestamp
40 property var displayedEventTextMessage: displayedEvent ? displayedEvent.textMessage : eventTextMessage40 property var displayedEventTextMessage: displayedEvent ? displayedEvent.textMessage : eventTextMessage
41 property QtObject presenceItem: delegateHelper.presenceItem
41 property string groupChatLabel: {42 property string groupChatLabel: {
42 var firstRecipient43 var firstRecipient
43 if (unknownContact) {44 if (unknownContact) {
@@ -172,16 +173,36 @@
172 fontSize: "small"173 fontSize: "small"
173 }174 }
174175
176 Image {
177 id: protocolIcon
178 anchors {
179 top: time.bottom
180 topMargin: units.gu(1)
181 right: parent.right
182 }
183 height: units.gu(2)
184 width: units.gu(2)
185 visible: source !== ""
186 source: {
187 if (delegateHelper.presenceType != PresenceRequest.PresenceTypeUnknown
188 && delegateHelper.presenceType != PresenceRequest.PresenceTypeUnset) {
189 return telepathyHelper.accountForId(delegateHelper.presenceAccountId).protocolInfo.icon
190 }
191 return ""
192 }
193 }
194
175 UbuntuShape {195 UbuntuShape {
176 id: unreadCountIndicator196 id: unreadCountIndicator
177 height: units.gu(2)197 height: units.gu(2)
178 width: height198 width: height
179 anchors {199 anchors {
180 top: time.bottom200 top: avatar.top
181 topMargin: units.gu(1)201 topMargin: units.gu(-0.5)
182 right: parent.right202 left: avatar.left
183 rightMargin: units.gu(2)203 leftMargin: units.gu(-0.5)
184 }204 }
205 z: 1
185 visible: unreadCount > 0206 visible: unreadCount > 0
186 color: "#38b44a"207 color: "#38b44a"
187 Label {208 Label {
@@ -232,6 +253,9 @@
232 property alias contexts: phoneDetail.contexts253 property alias contexts: phoneDetail.contexts
233 property bool isUnknown: contactId === ""254 property bool isUnknown: contactId === ""
234 property string phoneNumberSubTypeLabel: ""255 property string phoneNumberSubTypeLabel: ""
256 property alias presenceAccountId: presenceRequest.accountId
257 property alias presenceType: presenceRequest.type
258 property alias presenceItem: presenceRequest
235 property string latestFilter: ""259 property string latestFilter: ""
236 property var searchHistoryFilter260 property var searchHistoryFilter
237 property var searchHistoryFilterString: 'import Ubuntu.History 0.1; 261 property var searchHistoryFilterString: 'import Ubuntu.History 0.1;
@@ -310,6 +334,35 @@
310 }334 }
311 }335 }
312336
337 // FIXME: there is another instance of PresenceRequest in Messages.qml,
338 // we have to reuse the same instance when possible
339 PresenceRequest {
340 id: presenceRequest
341 accountId: {
342 // if this is a regular sms chat, try requesting the presence on
343 // a multimedia account
344 if (!telepathyHelper.ready) {
345 return ""
346 }
347 var account = telepathyHelper.accountForId(model.accountId)
348 if (!account) {
349 return ""
350 }
351 if (account.type == AccountEntry.PhoneAccount) {
352 for (var i in telepathyHelper.accounts) {
353 var tmpAccount = telepathyHelper.accounts[i]
354 if (tmpAccount.type == AccountEntry.MultimediaAccount) {
355 return tmpAccount.accountId
356 }
357 }
358 return ""
359 }
360 return account.accountId
361 }
362 // we just request presence on 1-1 chats
363 identifier: !groupChat ? participant.identifier : ""
364 }
365
313 function updateSubTypeLabel() {366 function updateSubTypeLabel() {
314 var subLabel = "";367 var subLabel = "";
315 if (participant && participant.phoneNumber) {368 if (participant && participant.phoneNumber) {

Subscribers

People subscribed via source and target branches

to all changes: