~renatofilho/messaging-app/fix-1417341-rtm

« back to all changes in this revision

Viewing changes to src/qml/messaging-app.qml

  • Committer: CI bot
  • Author(s): Bill Filler
  • Date: 2014-08-22 17:44:09 UTC
  • mfrom: (192.2.1 messaging-app)
  • Revision ID: ps-jenkins@lists.canonical.com-20140822174409-14v77jr1ctvzqzzq
sim presence and call grouping merge from trunk 

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    id: mainView
29
29
 
30
30
    property string newPhoneNumber
31
 
    property bool multipleAccounts: telepathyHelper.accounts.length > 1
32
 
    property QtObject defaultAccount: {
 
31
    property bool multipleAccounts: telepathyHelper.activeAccounts.length > 1
 
32
    property QtObject account: defaultAccount()
 
33
 
 
34
    function defaultAccount() {
33
35
        // we only use the default account property if we have more
34
36
        // than one account, otherwise we use always the first one
35
37
        if (multipleAccounts) {
36
38
            return telepathyHelper.defaultMessagingAccount
37
39
        } else {
38
 
            return telepathyHelper.accounts[0]
39
 
        }
40
 
    }
 
40
            return telepathyHelper.activeAccounts[0]
 
41
        }
 
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
 
41
58
 
42
59
    automaticOrientation: true
43
60
    width: units.gu(40)