Merge lp:~tiagosh/messaging-app/mms-send-fixes into lp:messaging-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: 134
Merged at revision: 161
Proposed branch: lp:~tiagosh/messaging-app/mms-send-fixes
Merge into: lp:messaging-app
Diff against target: 392 lines (+188/-132)
4 files modified
src/qml/MainPage.qml (+2/-0)
src/qml/MessageDelegate.qml (+3/-2)
src/qml/Messages.qml (+148/-129)
src/qml/ThreadDelegate.qml (+35/-1)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/mms-send-fixes
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+227954@code.launchpad.net

Commit message

- Ignore x-smil content-type
- Enable spinner for mms

Description of the change

- Ignore x-smil content-type
- Enable spinner for mms

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~tiagosh/history-service/mms-send-fixes/+merge/228341

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/messaging-app) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

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

improve performance
set thread labels correctly for mms

133. By Tiago Salem Herrmann

remove debug

134. By Tiago Salem Herrmann

remove commented code

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

tested, works

review: Approve

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 2014-07-15 15:23:21 +0000
3+++ src/qml/MainPage.qml 2014-07-25 16:28:41 +0000
4@@ -146,6 +146,8 @@
5 sortField: "lastEventTimestamp"
6 sortOrder: HistorySort.DescendingOrder
7 }
8+ filter: HistoryFilter {
9+ }
10 }
11
12 Component {
13
14=== modified file 'src/qml/MessageDelegate.qml'
15--- src/qml/MessageDelegate.qml 2014-07-14 15:47:34 +0000
16+++ src/qml/MessageDelegate.qml 2014-07-25 16:28:41 +0000
17@@ -103,7 +103,8 @@
18 return "MMS/MMSImage.qml"
19 } else if (startsWith(modelData.contentType, "video/")) {
20 return "MMS/MMSVideo.qml"
21- } else if (modelData.contentType === "application/smil" ) {
22+ } else if (startsWith(modelData.contentType, "application/smil") ||
23+ startsWith(modelData.contentType, "application/x-smil")) {
24 console.log("Ignoring SMIL file")
25 return ""
26 } else if (startsWith(modelData.contentType, "text/plain") ) {
27@@ -260,7 +261,7 @@
28 visible: running && !selectionMode
29 // if temporarily failed or unknown status, then show the spinner
30 running: (textMessageStatus == HistoryThreadModel.MessageStatusUnknown ||
31- textMessageStatus == HistoryThreadModel.MessageStatusTemporarilyFailed) && !incoming && mmsText === ""
32+ textMessageStatus == HistoryThreadModel.MessageStatusTemporarilyFailed) && !incoming
33 }
34
35 Label {
36
37=== modified file 'src/qml/Messages.qml'
38--- src/qml/Messages.qml 2014-07-23 16:40:57 +0000
39+++ src/qml/Messages.qml 2014-07-25 16:28:41 +0000
40@@ -58,8 +58,13 @@
41 }
42 var filePath = String(transfer.items[i].url).replace('file://', '')
43 // get only the basename
44- attachment["name"] = filePath.split('/').reverse()[0]
45 attachment["contentType"] = application.fileMimeType(filePath)
46+ if (startsWith(attachment["contentType"], "text/vcard") ||
47+ startsWith(attachment["contentType"], "text/x-vcard")) {
48+ attachment["name"] = "contact.vcf"
49+ } else {
50+ attachment["name"] = filePath.split('/').reverse()[0]
51+ }
52 attachment["filePath"] = filePath
53 attachments.append(attachment)
54 }
55@@ -345,30 +350,147 @@
56 }
57 }
58
59- ContactListView {
60- id: contactSearch
61-
62- property bool searchEnabled: multiRecipient.searchString !== "" && multiRecipient.focus
63-
64- visible: searchEnabled
65- detailToPick: ContactDetail.PhoneNumber
66- clip: true
67- z: 1
68- autoUpdate: false
69- filterTerm: multiRecipient.searchString
70- showSections: false
71-
72- states: [
73- State {
74- name: "empty"
75- when: contactSearch.count === 0
76- PropertyChanges {
77- target: contactSearch
78- height: 0
79- }
80- }
81- ]
82-
83+ Component {
84+ id: contactSearchComponent
85+
86+ ContactListView {
87+ id: contactSearch
88+
89+ detailToPick: ContactDetail.PhoneNumber
90+ clip: true
91+ z: 1
92+ autoUpdate: false
93+ filterTerm: multiRecipient.searchString
94+ showSections: false
95+
96+ states: [
97+ State {
98+ name: "empty"
99+ when: contactSearch.count === 0
100+ PropertyChanges {
101+ target: contactSearch
102+ height: 0
103+ }
104+ }
105+ ]
106+
107+ anchors {
108+ top: accountList.bottom
109+ topMargin: units.gu(1)
110+ left: parent.left
111+ right: parent.right
112+ bottom: bottomPanel.top
113+ }
114+
115+ Behavior on height {
116+ UbuntuNumberAnimation { }
117+ }
118+
119+ InvalidFilter {
120+ id: invalidFilter
121+ }
122+
123+ // clear list if it is invisible to save some memory
124+ onVisibleChanged: {
125+ if (visible && (filter != null)) {
126+ changeFilter(null)
127+ update()
128+ } else if (!visible && filter != invalidFilter) {
129+ changeFilter(invalidFilter)
130+ update()
131+ }
132+ }
133+
134+ ContactDetailPhoneNumberTypeModel {
135+ id: phoneTypeModel
136+ }
137+
138+ listDelegate: Item {
139+ anchors {
140+ left: parent.left
141+ right: parent.right
142+ margins: units.gu(2)
143+ }
144+ height: phoneRepeater.count * units.gu(6)
145+ Column {
146+ anchors.fill: parent
147+ spacing: units.gu(1)
148+
149+ Repeater {
150+ id: phoneRepeater
151+
152+ model: contact.phoneNumbers.length
153+
154+ delegate: MouseArea {
155+ anchors {
156+ left: parent.left
157+ right: parent.right
158+ }
159+ height: units.gu(5)
160+
161+ onClicked: {
162+ multiRecipient.addRecipient(contact.phoneNumbers[index].number)
163+ multiRecipient.clearSearch()
164+ multiRecipient.forceActiveFocus()
165+ }
166+
167+ Column {
168+ anchors.fill: parent
169+
170+ Label {
171+ anchors {
172+ left: parent.left
173+ right: parent.right
174+ }
175+ height: units.gu(2)
176+ text: {
177+ // this is necessary to keep the string in the original format
178+ var originalText = contact.displayLabel.label
179+ var lowerSearchText = multiRecipient.searchString.toLowerCase()
180+ var lowerText = originalText.toLowerCase()
181+ var searchIndex = lowerText.indexOf(lowerSearchText)
182+ if (searchIndex !== -1) {
183+ var piece = originalText.substr(searchIndex, lowerSearchText.length)
184+ return originalText.replace(piece, "<b>" + piece + "</b>")
185+ } else {
186+ return originalText
187+ }
188+ }
189+ fontSize: "medium"
190+ color: UbuntuColors.lightAubergine
191+ }
192+ Label {
193+ anchors {
194+ left: parent.left
195+ right: parent.right
196+ }
197+ height: units.gu(2)
198+ text: {
199+ var phoneDetail = contact.phoneNumbers[index]
200+ return ("%1 %2").arg(phoneTypeModel.get(phoneTypeModel.getTypeIndex(phoneDetail)).label)
201+ .arg(phoneDetail.number)
202+ }
203+ }
204+ Item {
205+ anchors {
206+ left: parent.left
207+ right: parent.right
208+ }
209+ height: units.gu(1)
210+ }
211+
212+ ListItem.ThinDivider {}
213+ }
214+ }
215+ }
216+ }
217+ }
218+ }
219+ }
220+
221+ Loader {
222+ active: multiRecipient.searchString !== "" && multiRecipient.focus
223+ sourceComponent: contactSearchComponent
224 anchors {
225 top: accountList.bottom
226 topMargin: units.gu(1)
227@@ -376,110 +498,7 @@
228 right: parent.right
229 bottom: bottomPanel.top
230 }
231-
232- Behavior on height {
233- UbuntuNumberAnimation { }
234- }
235-
236- InvalidFilter {
237- id: invalidFilter
238- }
239-
240- // clear list if it is invisible to save some memory
241- onVisibleChanged: {
242- if (visible && (filter != null)) {
243- changeFilter(null)
244- update()
245- } else if (!visible && filter != invalidFilter) {
246- changeFilter(invalidFilter)
247- update()
248- }
249- }
250-
251- ContactDetailPhoneNumberTypeModel {
252- id: phoneTypeModel
253- }
254-
255- listDelegate: Item {
256- anchors {
257- left: parent.left
258- right: parent.right
259- margins: units.gu(2)
260- }
261- height: phoneRepeater.count * units.gu(6)
262- Column {
263- anchors.fill: parent
264- spacing: units.gu(1)
265-
266- Repeater {
267- id: phoneRepeater
268-
269- model: contact.phoneNumbers.length
270-
271- delegate: MouseArea {
272- anchors {
273- left: parent.left
274- right: parent.right
275- }
276- height: units.gu(5)
277-
278- onClicked: {
279- multiRecipient.addRecipient(contact.phoneNumbers[index].number)
280- multiRecipient.clearSearch()
281- multiRecipient.forceActiveFocus()
282- }
283-
284- Column {
285- anchors.fill: parent
286-
287- Label {
288- anchors {
289- left: parent.left
290- right: parent.right
291- }
292- height: units.gu(2)
293- text: {
294- // this is necessary to keep the string in the original format
295- var originalText = contact.displayLabel.label
296- var lowerSearchText = multiRecipient.searchString.toLowerCase()
297- var lowerText = originalText.toLowerCase()
298- var searchIndex = lowerText.indexOf(lowerSearchText)
299- if (searchIndex !== -1) {
300- var piece = originalText.substr(searchIndex, lowerSearchText.length)
301- return originalText.replace(piece, "<b>" + piece + "</b>")
302- } else {
303- return originalText
304- }
305- }
306- fontSize: "medium"
307- color: UbuntuColors.lightAubergine
308- }
309- Label {
310- anchors {
311- left: parent.left
312- right: parent.right
313- }
314- height: units.gu(2)
315- text: {
316- var phoneDetail = contact.phoneNumbers[index]
317- return ("%1 %2").arg(phoneTypeModel.get(phoneTypeModel.getTypeIndex(phoneDetail)).label)
318- .arg(phoneDetail.number)
319- }
320- }
321- Item {
322- anchors {
323- left: parent.left
324- right: parent.right
325- }
326- height: units.gu(1)
327- }
328-
329- ListItem.ThinDivider {}
330- }
331- }
332- }
333- }
334- }
335+ z: 1
336 }
337
338 ContactWatcher {
339
340=== modified file 'src/qml/ThreadDelegate.qml'
341--- src/qml/ThreadDelegate.qml 2014-07-15 15:23:21 +0000
342+++ src/qml/ThreadDelegate.qml 2014-07-25 16:28:41 +0000
343@@ -44,6 +44,40 @@
344 property bool unknownContact: delegateHelper.isUnknown
345 property bool selectionMode: false
346 property string threadId: model.threadId
347+ property string textMessage: {
348+ // check if this is an mms, if so, search for the actual text
349+ var imageCount = 0
350+ var videoCount = 0
351+ var contactCount = 0
352+ var attachmentCount = 0
353+ for (var i = 0; i < eventTextAttachments.length; i++) {
354+ if (startsWith(eventTextAttachments[i].contentType, "text/plain")) {
355+ return application.readTextFile(eventTextAttachments[i].filePath)
356+ } else if (startsWith(eventTextAttachments[i].contentType, "image/")) {
357+ imageCount++
358+ } else if (startsWith(eventTextAttachments[i].contentType, "video/")) {
359+ videoCount++
360+ } else if (startsWith(eventTextAttachments[i].contentType, "text/vcard") ||
361+ startsWith(eventTextAttachments[i].contentType, "text/x-vcard")) {
362+ contactCount++
363+ }
364+ }
365+ attachmentCount = imageCount + videoCount + contactCount
366+
367+ if (imageCount > 0 && attachmentCount == imageCount) {
368+ return i18n.tr("Attachment: %1 image", "Attachments: %s images").arg(imageCount)
369+ }
370+ if (videoCount > 0 && attachmentCount == videoCount) {
371+ return i18n.tr("Attachment: %1 video", "Attachments: %s videos").arg(videoCount)
372+ }
373+ if (contactCount > 0 && attachmentCount == contactCount) {
374+ return i18n.tr("Attachment: %1 contact", "Attachments: %s contacts").arg(contactCount)
375+ }
376+ if (attachmentCount > 0) {
377+ return i18n.tr("Attachment: %1 file", "Attachments: %s files").arg(attachmentCount)
378+ }
379+ return eventTextMessage
380+ }
381 anchors.left: parent.left
382 anchors.right: parent.right
383 height: units.gu(10)
384@@ -176,7 +210,7 @@
385 maximumLineCount: 2
386 fontSize: "x-small"
387 wrapMode: Text.WordWrap
388- text: eventTextMessage == undefined ? "" : eventTextMessage
389+ text: textMessage
390 font.weight: Font.Light
391 }
392 onItemRemoved: {

Subscribers

People subscribed via source and target branches