[Merge] lp:~boiko/messaging-app/remove_proxies into lp:messaging-app
Tiago Salem Herrmann
tiago.herrmann at canonical.com
Fri Sep 12 20:01:11 UTC 2014
Review: Needs Information
Diff comments:
> === modified file 'src/qml/MainPage.qml'
> --- src/qml/MainPage.qml 2014-09-11 21:19:58 +0000
> +++ src/qml/MainPage.qml 2014-09-11 21:19:58 +0000
> @@ -176,13 +176,14 @@
> right: parent.right
> bottom: keyboard.top
> }
> - listModel: sortProxy
> + listModel: threadModel
> section.property: "eventDate"
> //spacing: searchField.text === "" ? units.gu(-2) : 0
> section.delegate: searching && searchField.text !== "" ? null : sectionDelegate
> listDelegate: ThreadDelegate {
> id: threadDelegate
> - objectName: "thread%1".arg(participants)
> + // FIXME: find a better unique name
> + objectName: "thread%1".arg(participants[0].phoneNumber)
>
> anchors {
> left: parent.left
> @@ -200,6 +201,10 @@
> } else {
> var properties = model.properties
> properties["keyboardFocus"] = false
> + if (model.participants[0].alias) {
> + properties["firstRecipientAlias"] = model.participants[0].alias;
> + }
> +
> mainStack.push(Qt.resolvedUrl("Messages.qml"), properties)
> }
> }
>
> === modified file 'src/qml/Messages.qml'
> --- src/qml/Messages.qml 2014-09-11 21:19:58 +0000
> +++ src/qml/Messages.qml 2014-09-11 21:19:58 +0000
> @@ -117,6 +117,7 @@
> multiRecipient.forceFocus()
> }
>
> + property string firstRecipientAlias: ""
> title: {
> if (selectionMode) {
> return " "
> @@ -126,14 +127,9 @@
> return ""
> }
> if (participants.length > 0) {
> - var firstRecipient = ""
> - if (contactWatcher.isUnknown) {
> - firstRecipient = contactWatcher.phoneNumber
> - } else {
> - firstRecipient = contactWatcher.alias
> - }
> if (participants.length == 1) {
> - return firstRecipient
> + console.log("Using title: " + (firstRecipientAlias !== "") ? firstRecipientAlias : contactWatcher.phoneNumber);
was this added to the MR intentionally?
> + return (firstRecipientAlias !== "") ? firstRecipientAlias : contactWatcher.phoneNumber
> } else {
> // TRANSLATORS: %1 refers to the number of participants in a group chat
> return i18n.tr("Group (%1)").arg(participants.length)
> @@ -347,14 +343,9 @@
>
> ContactWatcher {
> id: contactWatcherInternal
> - phoneNumber: {
> - if (contactWatcher != contactWatcherInternal || participants.length === 0) {
> - // dont update if we are using another contact watcher or the list
> - // of participants is empty
> - return ""
> - }
> - return participants[0]
> - }
> + phoneNumber: participants.length === 0 ? "" : participants[0]
> + onIsUnknownChanged: firstRecipientAlias = contactWatcherInternal.alias
> + onAliasChanged: firstRecipientAlias = contactWatcherInternal.alias
> }
>
> onParticipantsChanged: {
>
> === modified file 'src/qml/MessagesListView.qml'
> --- src/qml/MessagesListView.qml 2014-09-03 19:50:24 +0000
> +++ src/qml/MessagesListView.qml 2014-09-11 21:19:58 +0000
> @@ -52,7 +52,7 @@
> header: Item {
> height: units.gu(1)
> }
> - listModel: participants.length > 0 ? sortProxy : null
> + listModel: participants.length > 0 ? eventModel : null
> verticalLayoutDirection: ListView.BottomToTop
> highlightFollowsCurrentItem: true
> // this is to keep the scrolling smooth
> @@ -105,7 +105,7 @@
> leftMargin: units.gu(2)
> rightMargin: units.gu(2)
> }
> - visible: (index === root.count) || !DateUtils.areSameDay(sortProxy.get(index+1).timestamp, timestamp)
> + visible: (index === root.count) || !DateUtils.areSameDay(eventModel.get(index+1).timestamp, timestamp)
> }
>
> MessageDelegateFactory {
> @@ -160,11 +160,4 @@
> positionViewAtBeginning()
> }
> }
> -
> - SortProxyModel {
> - id: sortProxy
> - sourceModel: eventModel.filter ? eventModel : null
> - sortRole: HistoryEventModel.TimestampRole
> - ascending: false
> - }
> }
>
> === modified file 'src/qml/messaging-app.qml'
> --- src/qml/messaging-app.qml 2014-09-11 21:19:58 +0000
> +++ src/qml/messaging-app.qml 2014-09-11 21:19:58 +0000
> @@ -77,7 +77,7 @@
> }
> }
>
> - HistoryThreadModel {
> + HistoryGroupedThreadsModel {
> id: threadModel
> type: HistoryThreadModel.EventTypeText
> sort: HistorySort {
> @@ -85,35 +85,10 @@
> sortOrder: HistorySort.DescendingOrder
> }
> filter: HistoryFilter {}
> + groupingProperty: "participants"
> matchContacts: true
> }
>
> - // the model depends on dbus calls, so we instantiate it as earlier as possible
> - // to improve a bit the startup time
> - HistoryThreadGroupingProxyModel {
> - id: sortProxy
> - sortRole: HistoryThreadModel.LastEventTimestampRole
> - sourceModel: threadModel
> - ascending: false
> - groupingProperty: "participants"
> - // WORKAROUND: remove this once the sort model is replaced by something else.
> - // the dynamicSortFilter during startup causes bindings
> - // to be re-evaluated multiple times
> - dynamicSortFilter: false
> - onCountChanged: {
> - if (count > 0) {
> - timer.start()
> - }
> - }
> - }
> -
> - Timer {
> - id: timer
> - repeat: false
> - interval: 10
> - onTriggered: sortProxy.dynamicSortFilter = true
> - }
> -
> Settings {
> id: settings
> category: "DualSim"
>
--
https://code.launchpad.net/~boiko/messaging-app/remove_proxies/+merge/234025
Your team Ubuntu Phablet Team is subscribed to branch lp:messaging-app.
More information about the Ubuntu-reviews
mailing list