~ci-train-bot/messaging-app/messaging-app-ubuntu-xenial-landing-064

« back to all changes in this revision

Viewing changes to src/qml/Messages.qml

  • Committer: CI Train Bot
  • Author(s): Tiago Salem Herrmann
  • Date: 2016-05-06 14:06:03 UTC
  • mfrom: (555.1.6 messaging-app-add-dialog-back)
  • Revision ID: ci-train-bot@canonical.com-20160506140603-241mz8ff12i3frar
Do not pre-select sim 1. Prompt users to select one instead. Fixes: #1571686

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            for (var i in telepathyHelper.activeAccounts) {
91
91
                accounts.push(telepathyHelper.activeAccounts[i])
92
92
            }
93
 
            // suru divider must be empty if there is only one sim card
94
 
            if (accounts.length == 1 && accounts[0].type == AccountEntry.PhoneAccount) {
95
 
                return []
96
 
            }
97
93
            return accounts
98
94
        }
99
95
 
140
136
                    }
141
137
                }
142
138
            }
143
 
            // otherwise pre-select the first available phone account if any
144
 
            for (var i in messages.accountsModel) {
145
 
                if (messages.accountsModel[i].type == AccountEntry.PhoneAccount) {
146
 
                    return i
147
 
                }
148
 
            }
149
 
            // otherwise select none
150
 
            return -1
151
139
        }
152
140
 
153
141
        // if we get here, just pre-select the account that is set in messages.account
171
159
            // if the selected account is a phone account, check if there is a default
172
160
            // phone account for messages
173
161
            if (tmpAccount && tmpAccount.type == AccountEntry.PhoneAccount) {
174
 
                if (telepathyHelper.defaultMessagingAccount) {
 
162
                if (multiplePhoneAccounts) {
 
163
                    return telepathyHelper.defaultMessagingAccount
 
164
                } else {
175
165
                    for (var i in messages.accountsModel) {
176
 
                        if (messages.accountsModel[i] == telepathyHelper.defaultMessagingAccount) {
177
 
                            return telepathyHelper.defaultMessagingAccount
 
166
                        if (messages.accountsModel[i].type == AccountEntry.PhoneAccount) {
 
167
                            return messages.accountsModel[i]
178
168
                        }
179
169
                    }
180
170
                }
181
 
                for (var i in messages.accountsModel) {
182
 
                    if (messages.accountsModel[i].type == AccountEntry.PhoneAccount) {
183
 
                        return messages.accountsModel[i]
184
 
                    }
185
 
                }
 
171
                return null
186
172
            }
187
173
            for (var i in messages.accountsModel) {
188
174
                if (tmpAccount.accountId == messages.accountId) {
492
478
 
493
479
        Sections {
494
480
            id: headerSections
 
481
            objectName: "headerSections"
495
482
            anchors {
496
483
                left: parent.left
497
484
                leftMargin: units.gu(2)
815
802
                return
816
803
            }
817
804
            messages.account = mainView.account
 
805
            headerSections.selectedIndex = getSelectedIndex()
818
806
        }
819
807
 
820
808
        onApplicationActiveChanged: {