~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to NewEvent.qml

merged: ~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field

Show diffs side-by-side

added added

removed removed

Lines of Context:
545
545
 
546
546
                Button{
547
547
                    id: addGuestButton
 
548
                    objectName: "addGuestButton"
 
549
 
 
550
                    property var contactsPopup: null
 
551
 
548
552
                    text: i18n.tr("Add Guest")
549
 
                    objectName: "addGuestButton"
550
 
 
551
553
                    anchors {
552
554
                        left: parent.left
553
555
                        right: parent.right
554
556
                        margins: units.gu(2)
555
557
                    }
556
558
 
 
559
                    // WORKAROUND: causes the popover to follow the buttom position when keyboard appears
 
560
                    Connections {
 
561
                        target: keyboard
 
562
                        onHeightChanged: {
 
563
                            if (addGuestButton.contactsPopup) {
 
564
                                addGuestButton.contactsPopup.caller = null
 
565
                                addGuestButton.contactsPopup.caller = addGuestButton
 
566
                            }
 
567
                        }
 
568
                    }
 
569
 
557
570
                    onClicked: {
558
 
                        keyboard.forceVisible = true
 
571
                        if (contactsPopup)
 
572
                            return
 
573
 
559
574
                        flickable.makeMeVisible(addGuestButton)
560
 
                        var popup = PopupUtils.open(Qt.resolvedUrl("ContactChoicePopup.qml"), addGuestButton);
561
 
                        popup.contactSelected.connect( function(contact) {
 
575
                        contactsPopup = PopupUtils.open(Qt.resolvedUrl("ContactChoicePopup.qml"), addGuestButton);
 
576
                        contactsPopup.contactSelected.connect( function(contact) {
562
577
                            var t = internal.contactToAttendee(contact);
563
578
                            if( !internal.isContactAlreadyAdded(contact) ) {
564
579
                                contactModel.append(t);
566
581
                            }
567
582
 
568
583
                        });
569
 
                        popup.Component.onDestruction.connect( function() {
570
 
                            keyboard.forceVisible = false
 
584
                        contactsPopup.Component.onDestruction.connect( function() {
 
585
                            addGuestButton.contactsPopup = null
571
586
                        })
572
587
                    }
573
588
                }