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
=== modified file 'src/qml/MainPage.qml'
--- src/qml/MainPage.qml 2014-07-15 15:23:21 +0000
+++ src/qml/MainPage.qml 2014-07-25 16:28:41 +0000
@@ -146,6 +146,8 @@
146 sortField: "lastEventTimestamp"146 sortField: "lastEventTimestamp"
147 sortOrder: HistorySort.DescendingOrder147 sortOrder: HistorySort.DescendingOrder
148 }148 }
149 filter: HistoryFilter {
150 }
149 }151 }
150152
151 Component {153 Component {
152154
=== modified file 'src/qml/MessageDelegate.qml'
--- src/qml/MessageDelegate.qml 2014-07-14 15:47:34 +0000
+++ src/qml/MessageDelegate.qml 2014-07-25 16:28:41 +0000
@@ -103,7 +103,8 @@
103 return "MMS/MMSImage.qml"103 return "MMS/MMSImage.qml"
104 } else if (startsWith(modelData.contentType, "video/")) {104 } else if (startsWith(modelData.contentType, "video/")) {
105 return "MMS/MMSVideo.qml"105 return "MMS/MMSVideo.qml"
106 } else if (modelData.contentType === "application/smil" ) {106 } else if (startsWith(modelData.contentType, "application/smil") ||
107 startsWith(modelData.contentType, "application/x-smil")) {
107 console.log("Ignoring SMIL file")108 console.log("Ignoring SMIL file")
108 return ""109 return ""
109 } else if (startsWith(modelData.contentType, "text/plain") ) {110 } else if (startsWith(modelData.contentType, "text/plain") ) {
@@ -260,7 +261,7 @@
260 visible: running && !selectionMode261 visible: running && !selectionMode
261 // if temporarily failed or unknown status, then show the spinner262 // if temporarily failed or unknown status, then show the spinner
262 running: (textMessageStatus == HistoryThreadModel.MessageStatusUnknown ||263 running: (textMessageStatus == HistoryThreadModel.MessageStatusUnknown ||
263 textMessageStatus == HistoryThreadModel.MessageStatusTemporarilyFailed) && !incoming && mmsText === ""264 textMessageStatus == HistoryThreadModel.MessageStatusTemporarilyFailed) && !incoming
264 }265 }
265266
266 Label {267 Label {
267268
=== modified file 'src/qml/Messages.qml'
--- src/qml/Messages.qml 2014-07-23 16:40:57 +0000
+++ src/qml/Messages.qml 2014-07-25 16:28:41 +0000
@@ -58,8 +58,13 @@
58 }58 }
59 var filePath = String(transfer.items[i].url).replace('file://', '')59 var filePath = String(transfer.items[i].url).replace('file://', '')
60 // get only the basename60 // get only the basename
61 attachment["name"] = filePath.split('/').reverse()[0]
62 attachment["contentType"] = application.fileMimeType(filePath)61 attachment["contentType"] = application.fileMimeType(filePath)
62 if (startsWith(attachment["contentType"], "text/vcard") ||
63 startsWith(attachment["contentType"], "text/x-vcard")) {
64 attachment["name"] = "contact.vcf"
65 } else {
66 attachment["name"] = filePath.split('/').reverse()[0]
67 }
63 attachment["filePath"] = filePath68 attachment["filePath"] = filePath
64 attachments.append(attachment)69 attachments.append(attachment)
65 }70 }
@@ -345,30 +350,147 @@
345 }350 }
346 }351 }
347352
348 ContactListView {353 Component {
349 id: contactSearch354 id: contactSearchComponent
350355
351 property bool searchEnabled: multiRecipient.searchString !== "" && multiRecipient.focus356 ContactListView {
352357 id: contactSearch
353 visible: searchEnabled358
354 detailToPick: ContactDetail.PhoneNumber359 detailToPick: ContactDetail.PhoneNumber
355 clip: true360 clip: true
356 z: 1361 z: 1
357 autoUpdate: false362 autoUpdate: false
358 filterTerm: multiRecipient.searchString363 filterTerm: multiRecipient.searchString
359 showSections: false364 showSections: false
360365
361 states: [366 states: [
362 State {367 State {
363 name: "empty"368 name: "empty"
364 when: contactSearch.count === 0369 when: contactSearch.count === 0
365 PropertyChanges {370 PropertyChanges {
366 target: contactSearch371 target: contactSearch
367 height: 0372 height: 0
368 }373 }
369 }374 }
370 ]375 ]
371376
377 anchors {
378 top: accountList.bottom
379 topMargin: units.gu(1)
380 left: parent.left
381 right: parent.right
382 bottom: bottomPanel.top
383 }
384
385 Behavior on height {
386 UbuntuNumberAnimation { }
387 }
388
389 InvalidFilter {
390 id: invalidFilter
391 }
392
393 // clear list if it is invisible to save some memory
394 onVisibleChanged: {
395 if (visible && (filter != null)) {
396 changeFilter(null)
397 update()
398 } else if (!visible && filter != invalidFilter) {
399 changeFilter(invalidFilter)
400 update()
401 }
402 }
403
404 ContactDetailPhoneNumberTypeModel {
405 id: phoneTypeModel
406 }
407
408 listDelegate: Item {
409 anchors {
410 left: parent.left
411 right: parent.right
412 margins: units.gu(2)
413 }
414 height: phoneRepeater.count * units.gu(6)
415 Column {
416 anchors.fill: parent
417 spacing: units.gu(1)
418
419 Repeater {
420 id: phoneRepeater
421
422 model: contact.phoneNumbers.length
423
424 delegate: MouseArea {
425 anchors {
426 left: parent.left
427 right: parent.right
428 }
429 height: units.gu(5)
430
431 onClicked: {
432 multiRecipient.addRecipient(contact.phoneNumbers[index].number)
433 multiRecipient.clearSearch()
434 multiRecipient.forceActiveFocus()
435 }
436
437 Column {
438 anchors.fill: parent
439
440 Label {
441 anchors {
442 left: parent.left
443 right: parent.right
444 }
445 height: units.gu(2)
446 text: {
447 // this is necessary to keep the string in the original format
448 var originalText = contact.displayLabel.label
449 var lowerSearchText = multiRecipient.searchString.toLowerCase()
450 var lowerText = originalText.toLowerCase()
451 var searchIndex = lowerText.indexOf(lowerSearchText)
452 if (searchIndex !== -1) {
453 var piece = originalText.substr(searchIndex, lowerSearchText.length)
454 return originalText.replace(piece, "<b>" + piece + "</b>")
455 } else {
456 return originalText
457 }
458 }
459 fontSize: "medium"
460 color: UbuntuColors.lightAubergine
461 }
462 Label {
463 anchors {
464 left: parent.left
465 right: parent.right
466 }
467 height: units.gu(2)
468 text: {
469 var phoneDetail = contact.phoneNumbers[index]
470 return ("%1 %2").arg(phoneTypeModel.get(phoneTypeModel.getTypeIndex(phoneDetail)).label)
471 .arg(phoneDetail.number)
472 }
473 }
474 Item {
475 anchors {
476 left: parent.left
477 right: parent.right
478 }
479 height: units.gu(1)
480 }
481
482 ListItem.ThinDivider {}
483 }
484 }
485 }
486 }
487 }
488 }
489 }
490
491 Loader {
492 active: multiRecipient.searchString !== "" && multiRecipient.focus
493 sourceComponent: contactSearchComponent
372 anchors {494 anchors {
373 top: accountList.bottom495 top: accountList.bottom
374 topMargin: units.gu(1)496 topMargin: units.gu(1)
@@ -376,110 +498,7 @@
376 right: parent.right498 right: parent.right
377 bottom: bottomPanel.top499 bottom: bottomPanel.top
378 }500 }
379501 z: 1
380 Behavior on height {
381 UbuntuNumberAnimation { }
382 }
383
384 InvalidFilter {
385 id: invalidFilter
386 }
387
388 // clear list if it is invisible to save some memory
389 onVisibleChanged: {
390 if (visible && (filter != null)) {
391 changeFilter(null)
392 update()
393 } else if (!visible && filter != invalidFilter) {
394 changeFilter(invalidFilter)
395 update()
396 }
397 }
398
399 ContactDetailPhoneNumberTypeModel {
400 id: phoneTypeModel
401 }
402
403 listDelegate: Item {
404 anchors {
405 left: parent.left
406 right: parent.right
407 margins: units.gu(2)
408 }
409 height: phoneRepeater.count * units.gu(6)
410 Column {
411 anchors.fill: parent
412 spacing: units.gu(1)
413
414 Repeater {
415 id: phoneRepeater
416
417 model: contact.phoneNumbers.length
418
419 delegate: MouseArea {
420 anchors {
421 left: parent.left
422 right: parent.right
423 }
424 height: units.gu(5)
425
426 onClicked: {
427 multiRecipient.addRecipient(contact.phoneNumbers[index].number)
428 multiRecipient.clearSearch()
429 multiRecipient.forceActiveFocus()
430 }
431
432 Column {
433 anchors.fill: parent
434
435 Label {
436 anchors {
437 left: parent.left
438 right: parent.right
439 }
440 height: units.gu(2)
441 text: {
442 // this is necessary to keep the string in the original format
443 var originalText = contact.displayLabel.label
444 var lowerSearchText = multiRecipient.searchString.toLowerCase()
445 var lowerText = originalText.toLowerCase()
446 var searchIndex = lowerText.indexOf(lowerSearchText)
447 if (searchIndex !== -1) {
448 var piece = originalText.substr(searchIndex, lowerSearchText.length)
449 return originalText.replace(piece, "<b>" + piece + "</b>")
450 } else {
451 return originalText
452 }
453 }
454 fontSize: "medium"
455 color: UbuntuColors.lightAubergine
456 }
457 Label {
458 anchors {
459 left: parent.left
460 right: parent.right
461 }
462 height: units.gu(2)
463 text: {
464 var phoneDetail = contact.phoneNumbers[index]
465 return ("%1 %2").arg(phoneTypeModel.get(phoneTypeModel.getTypeIndex(phoneDetail)).label)
466 .arg(phoneDetail.number)
467 }
468 }
469 Item {
470 anchors {
471 left: parent.left
472 right: parent.right
473 }
474 height: units.gu(1)
475 }
476
477 ListItem.ThinDivider {}
478 }
479 }
480 }
481 }
482 }
483 }502 }
484503
485 ContactWatcher {504 ContactWatcher {
486505
=== modified file 'src/qml/ThreadDelegate.qml'
--- src/qml/ThreadDelegate.qml 2014-07-15 15:23:21 +0000
+++ src/qml/ThreadDelegate.qml 2014-07-25 16:28:41 +0000
@@ -44,6 +44,40 @@
44 property bool unknownContact: delegateHelper.isUnknown44 property bool unknownContact: delegateHelper.isUnknown
45 property bool selectionMode: false45 property bool selectionMode: false
46 property string threadId: model.threadId46 property string threadId: model.threadId
47 property string textMessage: {
48 // check if this is an mms, if so, search for the actual text
49 var imageCount = 0
50 var videoCount = 0
51 var contactCount = 0
52 var attachmentCount = 0
53 for (var i = 0; i < eventTextAttachments.length; i++) {
54 if (startsWith(eventTextAttachments[i].contentType, "text/plain")) {
55 return application.readTextFile(eventTextAttachments[i].filePath)
56 } else if (startsWith(eventTextAttachments[i].contentType, "image/")) {
57 imageCount++
58 } else if (startsWith(eventTextAttachments[i].contentType, "video/")) {
59 videoCount++
60 } else if (startsWith(eventTextAttachments[i].contentType, "text/vcard") ||
61 startsWith(eventTextAttachments[i].contentType, "text/x-vcard")) {
62 contactCount++
63 }
64 }
65 attachmentCount = imageCount + videoCount + contactCount
66
67 if (imageCount > 0 && attachmentCount == imageCount) {
68 return i18n.tr("Attachment: %1 image", "Attachments: %s images").arg(imageCount)
69 }
70 if (videoCount > 0 && attachmentCount == videoCount) {
71 return i18n.tr("Attachment: %1 video", "Attachments: %s videos").arg(videoCount)
72 }
73 if (contactCount > 0 && attachmentCount == contactCount) {
74 return i18n.tr("Attachment: %1 contact", "Attachments: %s contacts").arg(contactCount)
75 }
76 if (attachmentCount > 0) {
77 return i18n.tr("Attachment: %1 file", "Attachments: %s files").arg(attachmentCount)
78 }
79 return eventTextMessage
80 }
47 anchors.left: parent.left81 anchors.left: parent.left
48 anchors.right: parent.right82 anchors.right: parent.right
49 height: units.gu(10)83 height: units.gu(10)
@@ -176,7 +210,7 @@
176 maximumLineCount: 2210 maximumLineCount: 2
177 fontSize: "x-small"211 fontSize: "x-small"
178 wrapMode: Text.WordWrap212 wrapMode: Text.WordWrap
179 text: eventTextMessage == undefined ? "" : eventTextMessage213 text: textMessage
180 font.weight: Font.Light214 font.weight: Font.Light
181 }215 }
182 onItemRemoved: {216 onItemRemoved: {

Subscribers

People subscribed via source and target branches