~phablet-team/messaging-app/trunk

« back to all changes in this revision

Viewing changes to src/qml/Messages.qml

  • Committer: CI Train Bot
  • Author(s): Tiago Salem Herrmann
  • Date: 2015-11-20 11:32:32 UTC
  • mfrom: (415.2.17 update-sim-dialogs)
  • Revision ID: ci-train-bot@canonical.com-20151120113232-8yb7glitlthjyyj9
Update SIM dialogs according to design spec. Fixes: #1449778
Approved by: Gustavo Pichorim Boiko

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
        multiRecipient.forceActiveFocus()
326
326
    }
327
327
 
328
 
    function sendMessage(text, participantIds, attachments) {
 
328
    function sendMessage(text, participantIds, attachments, properties) {
 
329
        if (typeof(properties) === 'undefined') {
 
330
            properties = {}
 
331
        }
 
332
 
329
333
        // check if at least one account is selected
330
334
        if (!messages.account) {
331
335
            Qt.inputMethod.hide()
427
431
            }
428
432
            eventModel.writeEvents([event]);
429
433
        } else {
430
 
            var isMMS = attachments.length > 0
431
 
            var isMmsGroupChat = participantIds.length > 1 && telepathyHelper.mmsGroupChat
 
434
            var isMmsGroupChat = participants.length > 1 && telepathyHelper.mmsGroupChat && messages.account.type == AccountEntry.PhoneAccount
432
435
            // mms group chat only works if we know our own phone number
433
436
            var isSelfContactKnown = account.selfContactId != ""
434
 
            // FIXME: maybe move this to telepathy-ofono itself and treat as just sendMessage on the app?
435
 
            if (isMMS || (isMmsGroupChat && isSelfContactKnown)) {
436
 
                chatManager.sendMMS(participantIds, text, attachments, messages.account.accountId)
437
 
            } else {
438
 
                chatManager.sendMessage(participantIds, text, messages.account.accountId)
 
437
            if (isMmsGroupChat && !isSelfContactKnown) {
 
438
                // TODO: inform the user to enter the phone number of the selected sim card manually
 
439
                // and use it in the telepathy-ofono account as selfContactId. 
 
440
                return
439
441
            }
 
442
            chatManager.sendMessage(messages.account.accountId, participantIds, text, attachments, properties)
440
443
        }
441
444
 
442
445
        // FIXME: soon it won't be just about SIM cards, so the dialogs need updating
443
 
        if (multiplePhoneAccounts && !telepathyHelper.defaultMessagingAccount && !settings.messagesDontAsk) {
 
446
        if (multiplePhoneAccounts && !telepathyHelper.defaultMessagingAccount && !settings.messagesDontAsk && account.type == AccountEntry.PhoneAccount) {
444
447
            Qt.inputMethod.hide()
445
448
            PopupUtils.open(Qt.createComponent("Dialogs/SetDefaultSIMCardDialog.qml").createObject(messages))
446
449
        } else {
854
857
            name: "groupChat"
855
858
            head: messages.head
856
859
            when: groupChat
 
860
            contents: header
857
861
            backAction: backButton
858
862
 
859
863
            actions: [