Merge lp:~renatofilho/address-book-app/focus-improvements into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Approved
Approved by: Tiago Salem Herrmann
Approved revision: 678
Proposed branch: lp:~renatofilho/address-book-app/focus-improvements
Merge into: lp:address-book-app
Diff against target: 498 lines (+196/-131)
9 files modified
src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml (+9/-5)
src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+18/-4)
src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml (+3/-1)
src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml (+3/-0)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+3/-0)
src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml (+5/-3)
src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml (+13/-3)
src/imports/Ubuntu/Contacts/ContactListView.qml (+141/-114)
src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml (+1/-1)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/focus-improvements
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
system-apps-ci-bot continuous-integration Needs Fixing
Review via email: mp+315310@code.launchpad.net

Commit message

Fixed focus feedback visual.
Use UbuntuListiView to make use of theme colors.
Allow to overwrite ContactViewPage leadingActions

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
676. By Renato Araujo Oliveira Filho

Allow create IRC accounts.

677. By Renato Araujo Oliveira Filho

Allow user to add a provider on online accounts.

678. By Renato Araujo Oliveira Filho

Does not show provider as a individual field.

User should fill account alias with <user>@<server> to correct match on messaging app.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good to me.

review: Approve

Unmerged revisions

678. By Renato Araujo Oliveira Filho

Does not show provider as a individual field.

User should fill account alias with <user>@<server> to correct match on messaging app.

677. By Renato Araujo Oliveira Filho

Allow user to add a provider on online accounts.

676. By Renato Araujo Oliveira Filho

Allow create IRC accounts.

675. By Renato Araujo Oliveira Filho

Allow to overwrite ContactViewPage leadingActions

674. By Renato Araujo Oliveira Filho

Use UbuntuListiView to make use of theme colors.

673. By Renato Araujo Oliveira Filho

Fixed foocus feedback visual.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml'
--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml 2015-10-26 13:18:11 +0000
+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml 2017-02-24 13:55:25 +0000
@@ -19,12 +19,16 @@
1919
20import Ubuntu.Contacts 0.120import Ubuntu.Contacts 0.1
2121
22ContactDetailGroupWithTypeEditor {22ContactDetailGroupWithTypeEditor {
23 title: i18n.dtr("address-book-app", "IM")23 title: i18n.dtr("address-book-app", "Social")
24 detailQmlTypeName: "OnlineAccount"
24 detailType: ContactDetail.OnlineAccount25 detailType: ContactDetail.OnlineAccount
25 detailQmlTypeName: "OnlineAccount"26 fields: [
26 fields: [ OnlineAccount.AccountUri ]27 OnlineAccount.AccountUri
27 placeholderTexts: [ i18n.dtr("address-book-app", "Enter a social alias") ]28 ]
29 placeholderTexts: [
30 i18n.dtr("address-book-app", "Enter an alias"),
31 ]
28 typeModel: ContactDetailOnlineAccountTypeModel { }32 typeModel: ContactDetailOnlineAccountTypeModel { }
29 inputMethodHints: Qt.ImhEmailCharactersOnly33 inputMethodHints: Qt.ImhEmailCharactersOnly
30}34}
3135
=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml'
--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-09-23 12:35:41 +0000
+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2017-02-24 13:55:25 +0000
@@ -152,7 +152,10 @@
152 switch (contactEditor.initialFocusSection)152 switch (contactEditor.initialFocusSection)
153 {153 {
154 case "phones":154 case "phones":
155 contactEditor.focusToLastPhoneField()155 contactEditor.focusToLastField(phonesEditor)
156 break;
157 case "ims":
158 contactEditor.focusToLastField(accountsEditor)
156 break;159 break;
157 case "name":160 case "name":
158 default:161 default:
@@ -161,10 +164,13 @@
161 }164 }
162 }165 }
163166
164 function focusToLastPhoneField()167 function focusToLastField(editor)
165 {168 {
166 var lastPhoneField = phonesEditor.detailDelegates[phonesEditor.detailDelegates.length - 2].item169 var lastField = editor.detailDelegates[editor.detailDelegates.length - 2].item
167 lastPhoneField.forceActiveFocus()170 if (lastField.repeater.count > 0)
171 lastField.repeater.itemAt(0).forceActiveFocus()
172 else
173 lastField.forceActiveFocus()
168 }174 }
169175
170 function focusToFirstEntry(field)176 function focusToFirstEntry(field)
@@ -498,6 +504,14 @@
498 }504 }
499 }505 }
500506
507 onEnabledChanged: {
508 if (!active || !enabled) {
509 return
510 }
511
512 focusTimer.restart()
513 }
514
501 onActiveChanged: {515 onActiveChanged: {
502 if (!active || !enabled) {516 if (!active || !enabled) {
503 return517 return
504518
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml 2015-10-26 13:18:11 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml 2017-02-24 13:55:25 +0000
@@ -22,7 +22,9 @@
2222
23ContactDetailGroupWithTypeView {23ContactDetailGroupWithTypeView {
24 detailType: QtContacts.ContactDetail.OnlineAccount24 detailType: QtContacts.ContactDetail.OnlineAccount
25 fields: [ QtContacts.OnlineAccount.AccountUri ]25 fields: [
26 QtContacts.OnlineAccount.AccountUri
27 ]
26 title: i18n.dtr("address-book-app", "Social")28 title: i18n.dtr("address-book-app", "Social")
27 typeModel: ContactDetailOnlineAccountTypeModel { }29 typeModel: ContactDetailOnlineAccountTypeModel { }
28 defaultAction: Action {30 defaultAction: Action {
2931
=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml'
--- src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2016-09-23 12:35:41 +0000
+++ src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2017-02-24 13:55:25 +0000
@@ -30,6 +30,7 @@
30 property alias model: contactFetch.model30 property alias model: contactFetch.model
31 property alias editable: contactDetailAvatar.editable31 property alias editable: contactDetailAvatar.editable
32 property alias headerActions: trailingBar.actions32 property alias headerActions: trailingBar.actions
33 property list<Action> leadingActions
3334
34 signal contactFetched(QtObject contact)35 signal contactFetched(QtObject contact)
35 signal contactRemoved()36 signal contactRemoved()
@@ -50,6 +51,8 @@
50 trailingActionBar {51 trailingActionBar {
51 id: trailingBar52 id: trailingBar
52 }53 }
54
55 leadingActionBar.actions: root.leadingActions
53 }56 }
5457
55 Connections {58 Connections {
5659
=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2016-02-05 16:07:45 +0000
+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2017-02-24 13:55:25 +0000
@@ -43,6 +43,9 @@
43 }43 }
44 }44 }
4545
46 Keys.onEnterPressed: root.clicked(index, contact)
47 Keys.onReturnPressed: root.clicked(index, contact)
48
46 Item {49 Item {
47 id: delegate50 id: delegate
4851
4952
=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml'
--- src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml 2015-10-26 13:18:11 +0000
+++ src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml 2017-02-24 13:55:25 +0000
@@ -29,6 +29,8 @@
29 return 0;29 return 0;
30 case 2:30 case 2:
31 return 1;31 return 1;
32 case 3:
33 return 6;
32 case 4:34 case 4:
33 return 2;35 return 2;
34 case 5:36 case 5:
@@ -59,14 +61,14 @@
59 Component.onCompleted: {61 Component.onCompleted: {
60 //append({"value": 0, "label": i18n.dtr("address-book-app", "Other"), icon: "artwork:/protocol-other.svg"})62 //append({"value": 0, "label": i18n.dtr("address-book-app", "Other"), icon: "artwork:/protocol-other.svg"})
61 /*0*/ // TRANSLATORS: This refers to the AIM chat network http://en.wikipedia.org/wiki/AOL_Instant_Messenger63 /*0*/ // TRANSLATORS: This refers to the AIM chat network http://en.wikipedia.org/wiki/AOL_Instant_Messenger
62 append({"value": 1, "label": i18n.dtr("address-book-app", "Aim"), "icon": "artwork:/protocol-aim.svg"})64 /*0*/ append({"value": 1, "label": i18n.dtr("address-book-app", "Aim"), "icon": "artwork:/protocol-aim.svg"})
63 /*1*/ append({"value": 2, "label": i18n.dtr("address-book-app", "ICQ"), "icon": "artwork:/protocol-icq.svg"})65 /*1*/ append({"value": 2, "label": i18n.dtr("address-book-app", "ICQ"), "icon": "artwork:/protocol-icq.svg"})
64 //append({"value": 3, "label": i18n.dtr("address-book-app", "IRC"), icon: "artwork:/protocol-irc.svg"})
65 /*2*/ append({"value": 4, "label": i18n.dtr("address-book-app", "Jabber"), "icon": "artwork:/protocol-jabber.svg"})66 /*2*/ append({"value": 4, "label": i18n.dtr("address-book-app", "Jabber"), "icon": "artwork:/protocol-jabber.svg"})
66 /*3*/ append({"value": 5, "label": i18n.dtr("address-book-app", "MSN"), "icon": "artwork:/protocol-msn.svg"})67 /*3*/ append({"value": 5, "label": i18n.dtr("address-book-app", "MSN"), "icon": "artwork:/protocol-msn.svg"})
67 // append({"value": 6, "label": i18n.dtr("address-book-app", "QQ"), icon: "artwork:/protocol-qq.svg"})68 // append({"value": 6, "label": i18n.dtr("address-book-app", "QQ"), icon: "artwork:/protocol-qq.svg"})
68 /*4*/ append({"value": 7, "label": i18n.dtr("address-book-app", "Skype"), "icon": "artwork:/protocol-skype.svg"})69 /*4*/ append({"value": 7, "label": i18n.dtr("address-book-app", "Skype"), "icon": "artwork:/protocol-skype.svg"})
69 /*5*/ append({"value": 8, "label": i18n.dtr("address-book-app", "Yahoo"), "icon": "artwork:/protocol-yahoo.svg"})70 /*5*/ append({"value": 8, "label": i18n.dtr("address-book-app", "Yahoo"), "icon": "artwork:/protocol-yahoo.svg"})
71 /*6*/ append({"value": 3, "label": i18n.dtr("address-book-app", "IRC"), "icon": "artwork:/protocol-irc.svg"})
70 loaded()72 loaded()
71 }73 }
72}74}
7375
=== modified file 'src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml'
--- src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2016-09-23 13:47:49 +0000
+++ src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2017-02-24 13:55:25 +0000
@@ -17,9 +17,10 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
1919
20Item {20FocusScope {
21 id: root21 id: root
2222
23 readonly property bool _allowFocus: true
23 property string iconSource24 property string iconSource
24 property alias labelText: name.text25 property alias labelText: name.text
25 property bool expandIcon: false26 property bool expandIcon: false
@@ -31,13 +32,21 @@
31 right: parent.right32 right: parent.right
32 }33 }
33 height: visible ? units.gu(8) : 034 height: visible ? units.gu(8) : 0
35 activeFocusOnTab: true
36
37 Keys.onEnterPressed: clicked()
38 Keys.onReturnPressed: clicked()
3439
35 Rectangle {40 Rectangle {
36 anchors.fill: parent41 anchors.fill: parent
37 color: Theme.palette.selected.background42 border {
38 opacity: addNewContactButtonArea.pressed ? 1.0 : 0.043 color: UbuntuColors.orange
44 width: parent.activeFocus ? 1 : 0
45 }
46 color: addNewContactButtonArea.pressed ? Theme.palette.selected.background : "transparent"
39 }47 }
4048
49
41 UbuntuShape {50 UbuntuShape {
42 id: uShape51 id: uShape
4352
@@ -77,6 +86,7 @@
77 }86 }
78 elide: Text.ElideRight87 elide: Text.ElideRight
79 visible: root.showContents88 visible: root.showContents
89 color: parent.activeFocus ? UbuntuColors.blue : UbuntuColors.darkGrey
80 }90 }
8191
82 MouseArea {92 MouseArea {
8393
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2016-12-12 18:54:08 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2017-02-24 13:55:25 +0000
@@ -444,129 +444,155 @@
444 onTriggered: view.positionViewAtBeginning()444 onTriggered: view.positionViewAtBeginning()
445 }445 }
446446
447 header: Column {447 header: FocusScope {
448 anchors {448 anchors {
449 left: parent.left449 left: parent.left
450 right: parent.right450 right: parent.right
451 }451 }
452452
453 // top margin453 height: childrenRect.height
454 Item {
455 anchors {
456 left: parent.left
457 right: parent.right
458 }
459 height: units.gu(0.5)
460 }
461
462 Binding {
463 target: view
464 property: 'currentIndex'
465 value: -1
466 when: root.showNewContact
467 }
468
469 // AddNewButton
470 ContactListButtonDelegate {
471 anchors {
472 left: parent.left
473 right: parent.right
474 margins: units.gu(1)
475 }
476 objectName: "addNewButton"
477
478 iconSource: "image://theme/add"
479 // TRANSLATORS: this refers to a new contact
480 labelText: i18n.dtr("address-book-app", "+ Create New")
481 onClicked: root.addNewContactClicked()
482 visible: root.showAddNewButton
483 }
484
485 ContactDelegate {
486 property var contact: Contact {
487 Name {
488 firstName: i18n.tr("New contact")
489 }
490 Avatar {
491 imageUrl: "image://theme/contact"
492 }
493 }
494 selected: pageStack.hasKeyboard
495 visible: root.showNewContact
496 height: root.showNewContact ? defaultHeight : 0
497 onHeightChanged: {
498 if (visible)
499 view.positionViewAtBeginning()
500 }
501 Behavior on height {UbuntuNumberAnimation {}}
502 }
503454
504 Column {455 Column {
505 id: importFromButtons
506 objectName: "importFromButtons"
507
508 readonly property bool isSearching: (root.filterTerm && root.filterTerm !== "")
509
510 anchors {456 anchors {
511 left: parent.left457 left: parent.left
512 right: parent.right458 right: parent.right
513 margins: units.gu(1)459 }
514 }460
515 height: visible ? childrenRect.height : 0461 height: childrenRect.height
516462 onActiveFocusChanged: {
517 visible: root.showImportOptions &&463 if (activeFocus) {
518 !indicator.visible &&464 for(var i = 0; i < children.length; i++) {
519 (root.count === 0) &&465 if (children[i].enabled) {
520 !view.favouritesIsSelected &&466 children[i].forceActiveFocus()
521 !isSearching467 break
522468 }
523 // avoid show the button while the list still loading contacts469 }
524 Behavior on visible {470 }
525 SequentialAnimation {471 }
526 PauseAnimation {472
527 duration: !importFromButtons.visible ? 500 : 0473 // top margin
528 }474 Item {
529 PropertyAction {475 objectName: "Marging"
530 target: importFromButtons476 anchors {
531 property: "visible"477 left: parent.left
532 }478 right: parent.right
533 }479 }
534 }480 height: units.gu(0.5)
535481 enabled: false
536 // Import from google482 }
537 ContactListButtonDelegate {483
538 id: importFromGoogleButton484 Binding {
539 objectName: "%1.importFromOnlineAccountButton".arg(root.objectName)485 target: view
540486 property: 'currentIndex'
541 visible: (onlineAccountHelper.status === Loader.Ready)487 value: -1
542 expandIcon: true488 when: root.showNewContact
543 iconSource: "image://theme/google"489 }
544 labelText: i18n.dtr("address-book-app", "Import contacts from Google")490
545 onClicked: root.createOnlineAccount(false)491 // AddNewButton
546 }492 ContactListButtonDelegate {
547493 anchors {
548 // Import from sim card494 left: parent.left
549 ContactListButtonDelegate {495 right: parent.right
550 id: importFromSimCard496 margins: units.gu(1)
551 objectName: "%1.importFromSimCardButton".arg(root.objectName)497 }
552498
553 expandIcon: true499 objectName: "addNewButton"
554 iconSource: "image://theme/import"500
555 labelText: i18n.dtr("address-book-app", "Import contacts from SIM card")501 iconSource: "image://theme/add"
556 // Does not show the button if the list is not in a pageStack502 // TRANSLATORS: this refers to a new contact
557 visible: (typeof(pageStack) !== "undefined") &&503 labelText: i18n.dtr("address-book-app", "+ Create New")
558 ((simList.sims.length > 0) && (simList.present.length > 0))504 onClicked: root.addNewContactClicked()
559 onClicked: {505 visible: root.showAddNewButton
560 if (pageStack.addPageToNextColumn)506 focus: visible
561 pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),507 }
562 {"objectName": "simCardImportPage",508
563 "targetModel": view.listModel,509 ContactDelegate {
564 "sims": simList.sims})510 property var contact: Contact {
565 else511 Name {
566 pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),512 firstName: i18n.tr("New contact")
567 {"objectName": "simCardImportPage",513 }
568 "targetModel": view.listModel,514 Avatar {
569 "sims": simList.sims})515 imageUrl: "image://theme/contact"
516 }
517 }
518 activeFocusOnTab: false
519 selected: pageStack.hasKeyboard
520 visible: root.showNewContact
521 height: root.showNewContact ? defaultHeight : 0
522 onHeightChanged: {
523 if (visible)
524 view.positionViewAtBeginning()
525 }
526 Behavior on height {UbuntuNumberAnimation {}}
527 }
528
529 Column {
530 id: importFromButtons
531 objectName: "importFromButtons"
532
533 readonly property bool isSearching: (root.filterTerm && root.filterTerm !== "")
534
535 anchors {
536 left: parent.left
537 right: parent.right
538 margins: units.gu(1)
539 }
540 height: visible ? childrenRect.height : 0
541
542 visible: root.showImportOptions &&
543 !indicator.visible &&
544 (root.count === 0) &&
545 !view.favouritesIsSelected &&
546 !isSearching
547
548 // avoid show the button while the list still loading contacts
549 Behavior on visible {
550 SequentialAnimation {
551 PauseAnimation {
552 duration: !importFromButtons.visible ? 500 : 0
553 }
554 PropertyAction {
555 target: importFromButtons
556 property: "visible"
557 }
558 }
559 }
560
561 // Import from google
562 ContactListButtonDelegate {
563 id: importFromGoogleButton
564 objectName: "%1.importFromOnlineAccountButton".arg(root.objectName)
565
566 visible: (onlineAccountHelper.status === Loader.Ready)
567 expandIcon: true
568 iconSource: "image://theme/google"
569 labelText: i18n.dtr("address-book-app", "Import contacts from Google")
570 onClicked: root.createOnlineAccount(false)
571 }
572
573 // Import from sim card
574 ContactListButtonDelegate {
575 id: importFromSimCard
576 objectName: "%1.importFromSimCardButton".arg(root.objectName)
577
578 expandIcon: true
579 iconSource: "image://theme/import"
580 labelText: i18n.dtr("address-book-app", "Import contacts from SIM card")
581 // Does not show the button if the list is not in a pageStack
582 visible: (typeof(pageStack) !== "undefined") &&
583 ((simList.sims.length > 0) && (simList.present.length > 0))
584 onClicked: {
585 if (pageStack.addPageToNextColumn)
586 pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
587 {"objectName": "simCardImportPage",
588 "targetModel": view.listModel,
589 "sims": simList.sims})
590 else
591 pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),
592 {"objectName": "simCardImportPage",
593 "targetModel": view.listModel,
594 "sims": simList.sims})
595 }
570 }596 }
571 }597 }
572 }598 }
@@ -696,7 +722,8 @@
696 //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822722 //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822
697 //because of that we need this723 //because of that we need this
698 if (view.currentIndex == 0) {724 if (view.currentIndex == 0) {
699 pageStack._nextItemInFocusChain(view, false)725 view.currentIndex = -1
726 view.headerItem.forceActiveFocus()
700 } else {727 } else {
701 view.currentIndex -= 1728 view.currentIndex -= 1
702 }729 }
703730
=== modified file 'src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml'
--- src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml 2015-11-10 19:51:19 +0000
+++ src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml 2017-02-24 13:55:25 +0000
@@ -55,7 +55,7 @@
55 \endqml55 \endqml
56*/56*/
5757
58ListView {58UbuntuListView {
59 id: listView59 id: listView
6060
61 /*!61 /*!

Subscribers

People subscribed via source and target branches