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
1=== modified file 'src/qml/MainPage.qml'
2--- src/qml/MainPage.qml 2015-10-30 13:21:59 +0000
3+++ src/qml/MainPage.qml 2015-12-16 19:35:20 +0000
4@@ -218,6 +218,7 @@
5 }
6 properties["participantIds"] = participantIds
7 properties["participants"] = model.participants
8+ properties["presenceRequest"] = threadDelegate.presenceItem
9 if (displayedEvent != null) {
10 properties["scrollToEventId"] = displayedEvent.eventId
11 }
12
13=== modified file 'src/qml/MessageDelegateFactory.qml'
14--- src/qml/MessageDelegateFactory.qml 2015-09-14 13:51:27 +0000
15+++ src/qml/MessageDelegateFactory.qml 2015-12-16 19:35:20 +0000
16@@ -35,6 +35,7 @@
17 signal resendMessage()
18 signal copyMessage()
19 signal showMessageDetails()
20+ color: "transparent"
21
22 width: messageList.width
23 leftSideAction: Action {
24
25=== modified file 'src/qml/Messages.qml'
26--- src/qml/Messages.qml 2015-12-16 19:35:19 +0000
27+++ src/qml/Messages.qml 2015-12-16 19:35:20 +0000
28@@ -59,6 +59,7 @@
29 property string firstParticipantId: participantIds.length > 0 ? participantIds[0] : ""
30 property variant firstParticipant: participants.length > 0 ? participants[0] : null
31 property var threads: []
32+ property QtObject presenceRequest: presenceItem
33 property var accountsModel: getAccountsModel()
34 function getAccountsModel() {
35 var accounts = []
36@@ -428,7 +429,7 @@
37 }
38
39 PresenceRequest {
40- id: presenceRequest
41+ id: presenceItem
42 accountId: {
43 // if this is a regular sms chat, try requesting the presence on
44 // a multimedia account
45@@ -953,6 +954,33 @@
46 objectName: "messageList"
47 visible: !isSearching
48
49+ Rectangle {
50+ color: Theme.palette.normal.background
51+ anchors.fill: parent
52+ Image {
53+ width: units.gu(20)
54+ fillMode: Image.PreserveAspectFit
55+ anchors.centerIn: parent
56+ visible: source !== ""
57+ source: {
58+ var accountId = ""
59+
60+ if (messages.account) {
61+ accountId = messages.account.accountId
62+ }
63+
64+ if (presenceRequest.type != PresenceRequest.PresenceTypeUnknown
65+ && presenceRequest.type != PresenceRequest.PresenceTypeUnset) {
66+ accountId = presenceRequest.accountId
67+ }
68+
69+ return telepathyHelper.accountForId(accountId).protocolInfo.backgroundImage
70+ }
71+ z: 1
72+ }
73+ z: -1
74+ }
75+
76 // because of the header
77 clip: true
78 anchors {
79
80=== modified file 'src/qml/ThreadDelegate.qml'
81--- src/qml/ThreadDelegate.qml 2015-10-23 20:41:36 +0000
82+++ src/qml/ThreadDelegate.qml 2015-12-16 19:35:20 +0000
83@@ -38,6 +38,7 @@
84 property var displayedEventTextAttachments: displayedEvent ? displayedEvent.textMessageAttachments : eventTextAttachments
85 property var displayedEventTimestamp: displayedEvent ? displayedEvent.timestamp : eventTimestamp
86 property var displayedEventTextMessage: displayedEvent ? displayedEvent.textMessage : eventTextMessage
87+ property QtObject presenceItem: delegateHelper.presenceItem
88 property string groupChatLabel: {
89 var firstRecipient
90 if (unknownContact) {
91@@ -172,16 +173,36 @@
92 fontSize: "small"
93 }
94
95+ Image {
96+ id: protocolIcon
97+ anchors {
98+ top: time.bottom
99+ topMargin: units.gu(1)
100+ right: parent.right
101+ }
102+ height: units.gu(2)
103+ width: units.gu(2)
104+ visible: source !== ""
105+ source: {
106+ if (delegateHelper.presenceType != PresenceRequest.PresenceTypeUnknown
107+ && delegateHelper.presenceType != PresenceRequest.PresenceTypeUnset) {
108+ return telepathyHelper.accountForId(delegateHelper.presenceAccountId).protocolInfo.icon
109+ }
110+ return ""
111+ }
112+ }
113+
114 UbuntuShape {
115 id: unreadCountIndicator
116 height: units.gu(2)
117 width: height
118 anchors {
119- top: time.bottom
120- topMargin: units.gu(1)
121- right: parent.right
122- rightMargin: units.gu(2)
123+ top: avatar.top
124+ topMargin: units.gu(-0.5)
125+ left: avatar.left
126+ leftMargin: units.gu(-0.5)
127 }
128+ z: 1
129 visible: unreadCount > 0
130 color: "#38b44a"
131 Label {
132@@ -232,6 +253,9 @@
133 property alias contexts: phoneDetail.contexts
134 property bool isUnknown: contactId === ""
135 property string phoneNumberSubTypeLabel: ""
136+ property alias presenceAccountId: presenceRequest.accountId
137+ property alias presenceType: presenceRequest.type
138+ property alias presenceItem: presenceRequest
139 property string latestFilter: ""
140 property var searchHistoryFilter
141 property var searchHistoryFilterString: 'import Ubuntu.History 0.1;
142@@ -310,6 +334,35 @@
143 }
144 }
145
146+ // FIXME: there is another instance of PresenceRequest in Messages.qml,
147+ // we have to reuse the same instance when possible
148+ PresenceRequest {
149+ id: presenceRequest
150+ accountId: {
151+ // if this is a regular sms chat, try requesting the presence on
152+ // a multimedia account
153+ if (!telepathyHelper.ready) {
154+ return ""
155+ }
156+ var account = telepathyHelper.accountForId(model.accountId)
157+ if (!account) {
158+ return ""
159+ }
160+ if (account.type == AccountEntry.PhoneAccount) {
161+ for (var i in telepathyHelper.accounts) {
162+ var tmpAccount = telepathyHelper.accounts[i]
163+ if (tmpAccount.type == AccountEntry.MultimediaAccount) {
164+ return tmpAccount.accountId
165+ }
166+ }
167+ return ""
168+ }
169+ return account.accountId
170+ }
171+ // we just request presence on 1-1 chats
172+ identifier: !groupChat ? participant.identifier : ""
173+ }
174+
175 function updateSubTypeLabel() {
176 var subLabel = "";
177 if (participant && participant.phoneNumber) {

Subscribers

People subscribed via source and target branches

to all changes: