Merge lp:~bfiller/messaging-app/rtm-14.09-sim-presence into lp:messaging-app/rtm-14.09

Proposed by Bill Filler
Status: Merged
Approved by: Bill Filler
Approved revision: 193
Merged at revision: 193
Proposed branch: lp:~bfiller/messaging-app/rtm-14.09-sim-presence
Merge into: lp:messaging-app/rtm-14.09
Diff against target: 279 lines (+156/-32)
4 files modified
src/qml/Dialogs/NoDefaultSIMCardDialog.qml (+1/-1)
src/qml/Messages.qml (+19/-26)
src/qml/PictureImport.qml (+114/-0)
src/qml/messaging-app.qml (+22/-5)
To merge this branch: bzr merge lp:~bfiller/messaging-app/rtm-14.09-sim-presence
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+231913@code.launchpad.net

Commit message

sim presence and call grouping merge from trunk

Description of the change

sim presence and call grouping merge from trunk

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/qml/Dialogs/NoDefaultSIMCardDialog.qml'
--- src/qml/Dialogs/NoDefaultSIMCardDialog.qml 2014-08-11 22:22:59 +0000
+++ src/qml/Dialogs/NoDefaultSIMCardDialog.qml 2014-08-22 15:28:37 +0000
@@ -35,7 +35,7 @@
35 anchors.horizontalCenter: parent.horizontalCenter35 anchors.horizontalCenter: parent.horizontalCenter
36 height: paintedHeight + units.gu(3)36 height: paintedHeight + units.gu(3)
37 Repeater {37 Repeater {
38 model: telepathyHelper.accounts38 model: telepathyHelper.activeAccounts
39 delegate: Label {39 delegate: Label {
40 text: modelData.displayName40 text: modelData.displayName
41 color: UbuntuColors.orange41 color: UbuntuColors.orange
4242
=== modified file 'src/qml/Messages.qml'
--- src/qml/Messages.qml 2014-08-12 15:14:25 +0000
+++ src/qml/Messages.qml 2014-08-22 15:28:37 +0000
@@ -36,7 +36,7 @@
3636
37 // this property can be overriden by the user using the account switcher,37 // this property can be overriden by the user using the account switcher,
38 // in the suru divider38 // in the suru divider
39 property QtObject account: mainView.defaultAccount39 property QtObject account: mainView.account
4040
41 property variant participants: []41 property variant participants: []
42 property bool groupChat: participants.length > 142 property bool groupChat: participants.length > 1
@@ -80,25 +80,24 @@
80 // default account changes in system settings80 // default account changes in system settings
81 Connections {81 Connections {
82 target: mainView82 target: mainView
83 onDefaultAccountChanged: account = mainView.defaultAccount83 onAccountChanged: messages.account = mainView.account
84 }84 }
8585
86 ListModel {86 ListModel {
87 id: attachments87 id: attachments
88 }88 }
8989
90 Connections {90 PictureImport {
91 target: activeTransfer !== null ? activeTransfer : null91 id: pictureImporter
92 onStateChanged: {
93 var done = ((activeTransfer.state === ContentTransfer.Charged) ||
94 (activeTransfer.state === ContentTransfer.Aborted));
9592
96 if (activeTransfer.state === ContentTransfer.Charged) {93 onPictureReceived: {
97 if (activeTransfer.items.length > 0) {94 var attachment = {}
98 addAttachmentsToModel(activeTransfer)95 var filePath = String(pictureUrl).replace('file://', '')
99 textEntry.forceActiveFocus()96 attachment["contentType"] = application.fileMimeType(filePath)
100 }97 attachment["name"] = filePath.split('/').reverse()[0]
101 }98 attachment["filePath"] = filePath
99 attachments.append(attachment)
100 textEntry.forceActiveFocus()
102 }101 }
103 }102 }
104103
@@ -175,13 +174,6 @@
175 return eventModel.markEventAsRead(accountId, threadId, eventId, type);174 return eventModel.markEventAsRead(accountId, threadId, eventId, type);
176 }175 }
177176
178 ContentPeer {
179 id: defaultSource
180 contentType: ContentType.Pictures
181 handler: ContentHandler.Source
182 selectionType: ContentTransfer.Single
183 }
184
185 Component {177 Component {
186 id: attachmentPopover178 id: attachmentPopover
187179
@@ -262,8 +254,8 @@
262 }254 }
263255
264 var accountNames = []256 var accountNames = []
265 for(var i=0; i < telepathyHelper.accounts.length; i++) {257 for(var i=0; i < telepathyHelper.activeAccounts.length; i++) {
266 accountNames.push(telepathyHelper.accounts[i].displayName)258 accountNames.push(telepathyHelper.activeAccounts[i].displayName)
267 }259 }
268 return accountNames260 return accountNames
269 }261 }
@@ -271,8 +263,8 @@
271 if (!messages.account) {263 if (!messages.account) {
272 return -1264 return -1
273 }265 }
274 for (var i in telepathyHelper.accounts) {266 for (var i in telepathyHelper.activeAccounts) {
275 if (telepathyHelper.accounts[i].accountId === messages.account.accountId) {267 if (telepathyHelper.activeAccounts[i].accountId === messages.account.accountId) {
276 return i268 return i
277 }269 }
278 }270 }
@@ -280,7 +272,7 @@
280 }272 }
281 Connections {273 Connections {
282 target: messages.head.sections274 target: messages.head.sections
283 onSelectedIndexChanged: messages.account = telepathyHelper.accounts[head.sections.selectedIndex]275 onSelectedIndexChanged: messages.account = telepathyHelper.activeAccounts[head.sections.selectedIndex]
284 }276 }
285277
286 Component {278 Component {
@@ -738,7 +730,8 @@
738 MouseArea {730 MouseArea {
739 anchors.fill: parent731 anchors.fill: parent
740 onClicked: {732 onClicked: {
741 activeTransfer = defaultSource.request();733 Qt.inputMethod.hide()
734 pictureImporter.requestNewPicture()
742 }735 }
743 }736 }
744 }737 }
745738
=== added file 'src/qml/PictureImport.qml'
--- src/qml/PictureImport.qml 1970-01-01 00:00:00 +0000
+++ src/qml/PictureImport.qml 2014-08-22 15:28:37 +0000
@@ -0,0 +1,114 @@
1/*
2 * Copyright (C) 2012-2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import Ubuntu.Components 1.1
19import Ubuntu.Components.Popups 1.0 as Popups
20import Ubuntu.Content 0.1 as ContentHub
21
22Item {
23 id: root
24
25 property var importDialog: null
26
27 signal pictureReceived(string pictureUrl)
28
29 function requestNewPicture()
30 {
31 if (!root.importDialog) {
32 root.importDialog = PopupUtils.open(contentHubDialog, root)
33 } else {
34 console.warn("Import dialog already running")
35 }
36 }
37
38 Component {
39 id: contentHubDialog
40
41 Popups.PopupBase {
42 id: dialogue
43
44 property alias activeTransfer: signalConnections.target
45
46
47 focus: true
48
49 Rectangle {
50 anchors.fill: parent
51
52 ContentHub.ContentPeerPicker {
53 id: peerPicker
54
55 anchors.fill: parent
56 visible: dialogue.done
57 contentType: ContentHub.ContentType.Pictures
58 handler: ContentHub.ContentHandler.Source
59
60 onPeerSelected: {
61 peer.selectionType = ContentHub.ContentTransfer.Single
62 dialogue.activeTransfer = peer.request()
63 }
64
65 onCancelPressed: {
66 PopupUtils.close(root.importDialog)
67 }
68 }
69 }
70
71 Connections {
72 id: signalConnections
73
74 target: dialogue.activeTransfer
75 onStateChanged: {
76 var done = ((dialogue.activeTransfer.state === ContentHub.ContentTransfer.Charged) ||
77 (dialogue.activeTransfer.state === ContentHub.ContentTransfer.Aborted))
78
79 if (dialogue.activeTransfer.state === ContentHub.ContentTransfer.Charged) {
80 dialogue.hide()
81 if (dialogue.activeTransfer.items.length > 0) {
82 root.pictureReceived(dialogue.activeTransfer.items[0].url)
83 }
84 }
85
86 if (done) {
87 acceptTimer.restart()
88 }
89 }
90 }
91
92 // WORKAROUND: Work around for application becoming insensitive to touch events
93 // if the dialog is dismissed while the application is inactive.
94 // Just listening for changes to Qt.application.active doesn't appear
95 // to be enough to resolve this, so it seems that something else needs
96 // to be happening first. As such there's a potential for a race
97 // condition here, although as yet no problem has been encountered.
98 Timer {
99 id: acceptTimer
100
101 interval: 100
102 repeat: true
103 running: false
104 onTriggered: {
105 if(Qt.application.active) {
106 PopupUtils.close(root.importDialog)
107 }
108 }
109 }
110
111 Component.onDestruction: root.importDialog = null
112 }
113 }
114}
0115
=== modified file 'src/qml/messaging-app.qml'
--- src/qml/messaging-app.qml 2014-08-12 15:14:25 +0000
+++ src/qml/messaging-app.qml 2014-08-22 15:28:37 +0000
@@ -28,16 +28,33 @@
28 id: mainView28 id: mainView
2929
30 property string newPhoneNumber30 property string newPhoneNumber
31 property bool multipleAccounts: telepathyHelper.accounts.length > 131 property bool multipleAccounts: telepathyHelper.activeAccounts.length > 1
32 property QtObject defaultAccount: {32 property QtObject account: defaultAccount()
33
34 function defaultAccount() {
33 // we only use the default account property if we have more35 // we only use the default account property if we have more
34 // than one account, otherwise we use always the first one36 // than one account, otherwise we use always the first one
35 if (multipleAccounts) {37 if (multipleAccounts) {
36 return telepathyHelper.defaultMessagingAccount38 return telepathyHelper.defaultMessagingAccount
37 } else {39 } else {
38 return telepathyHelper.accounts[0]40 return telepathyHelper.activeAccounts[0]
39 }41 }
40 }42 }
43
44 Connections {
45 target: telepathyHelper
46 // restore default bindings if any system settings changed
47 onActiveAccountsChanged: {
48 for (var i in telepathyHelper.activeAccounts) {
49 if (telepathyHelper.activeAccounts[i] == account) {
50 return;
51 }
52 }
53 account = Qt.binding(defaultAccount)
54 }
55 onDefaultMessagingAccountChanged: account = Qt.binding(defaultAccount)
56 }
57
4158
42 automaticOrientation: true59 automaticOrientation: true
43 width: units.gu(40)60 width: units.gu(40)

Subscribers

People subscribed via source and target branches