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
1=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml'
2--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml 2015-10-26 13:18:11 +0000
3+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailOnlineAccountsEditor.qml 2017-02-24 13:55:25 +0000
4@@ -19,12 +19,16 @@
5
6 import Ubuntu.Contacts 0.1
7
8-ContactDetailGroupWithTypeEditor {
9- title: i18n.dtr("address-book-app", "IM")
10+ContactDetailGroupWithTypeEditor {
11+ title: i18n.dtr("address-book-app", "Social")
12+ detailQmlTypeName: "OnlineAccount"
13 detailType: ContactDetail.OnlineAccount
14- detailQmlTypeName: "OnlineAccount"
15- fields: [ OnlineAccount.AccountUri ]
16- placeholderTexts: [ i18n.dtr("address-book-app", "Enter a social alias") ]
17+ fields: [
18+ OnlineAccount.AccountUri
19+ ]
20+ placeholderTexts: [
21+ i18n.dtr("address-book-app", "Enter an alias"),
22+ ]
23 typeModel: ContactDetailOnlineAccountTypeModel { }
24 inputMethodHints: Qt.ImhEmailCharactersOnly
25 }
26
27=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml'
28--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-09-23 12:35:41 +0000
29+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2017-02-24 13:55:25 +0000
30@@ -152,7 +152,10 @@
31 switch (contactEditor.initialFocusSection)
32 {
33 case "phones":
34- contactEditor.focusToLastPhoneField()
35+ contactEditor.focusToLastField(phonesEditor)
36+ break;
37+ case "ims":
38+ contactEditor.focusToLastField(accountsEditor)
39 break;
40 case "name":
41 default:
42@@ -161,10 +164,13 @@
43 }
44 }
45
46- function focusToLastPhoneField()
47+ function focusToLastField(editor)
48 {
49- var lastPhoneField = phonesEditor.detailDelegates[phonesEditor.detailDelegates.length - 2].item
50- lastPhoneField.forceActiveFocus()
51+ var lastField = editor.detailDelegates[editor.detailDelegates.length - 2].item
52+ if (lastField.repeater.count > 0)
53+ lastField.repeater.itemAt(0).forceActiveFocus()
54+ else
55+ lastField.forceActiveFocus()
56 }
57
58 function focusToFirstEntry(field)
59@@ -498,6 +504,14 @@
60 }
61 }
62
63+ onEnabledChanged: {
64+ if (!active || !enabled) {
65+ return
66+ }
67+
68+ focusTimer.restart()
69+ }
70+
71 onActiveChanged: {
72 if (!active || !enabled) {
73 return
74
75=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml'
76--- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml 2015-10-26 13:18:11 +0000
77+++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailOnlineAccountsView.qml 2017-02-24 13:55:25 +0000
78@@ -22,7 +22,9 @@
79
80 ContactDetailGroupWithTypeView {
81 detailType: QtContacts.ContactDetail.OnlineAccount
82- fields: [ QtContacts.OnlineAccount.AccountUri ]
83+ fields: [
84+ QtContacts.OnlineAccount.AccountUri
85+ ]
86 title: i18n.dtr("address-book-app", "Social")
87 typeModel: ContactDetailOnlineAccountTypeModel { }
88 defaultAction: Action {
89
90=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml'
91--- src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2016-09-23 12:35:41 +0000
92+++ src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2017-02-24 13:55:25 +0000
93@@ -30,6 +30,7 @@
94 property alias model: contactFetch.model
95 property alias editable: contactDetailAvatar.editable
96 property alias headerActions: trailingBar.actions
97+ property list<Action> leadingActions
98
99 signal contactFetched(QtObject contact)
100 signal contactRemoved()
101@@ -50,6 +51,8 @@
102 trailingActionBar {
103 id: trailingBar
104 }
105+
106+ leadingActionBar.actions: root.leadingActions
107 }
108
109 Connections {
110
111=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
112--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2016-02-05 16:07:45 +0000
113+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2017-02-24 13:55:25 +0000
114@@ -43,6 +43,9 @@
115 }
116 }
117
118+ Keys.onEnterPressed: root.clicked(index, contact)
119+ Keys.onReturnPressed: root.clicked(index, contact)
120+
121 Item {
122 id: delegate
123
124
125=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml'
126--- src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml 2015-10-26 13:18:11 +0000
127+++ src/imports/Ubuntu/Contacts/ContactDetailOnlineAccountTypeModel.qml 2017-02-24 13:55:25 +0000
128@@ -29,6 +29,8 @@
129 return 0;
130 case 2:
131 return 1;
132+ case 3:
133+ return 6;
134 case 4:
135 return 2;
136 case 5:
137@@ -59,14 +61,14 @@
138 Component.onCompleted: {
139 //append({"value": 0, "label": i18n.dtr("address-book-app", "Other"), icon: "artwork:/protocol-other.svg"})
140 /*0*/ // TRANSLATORS: This refers to the AIM chat network http://en.wikipedia.org/wiki/AOL_Instant_Messenger
141- append({"value": 1, "label": i18n.dtr("address-book-app", "Aim"), "icon": "artwork:/protocol-aim.svg"})
142- /*1*/ append({"value": 2, "label": i18n.dtr("address-book-app", "ICQ"), "icon": "artwork:/protocol-icq.svg"})
143- //append({"value": 3, "label": i18n.dtr("address-book-app", "IRC"), icon: "artwork:/protocol-irc.svg"})
144+ /*0*/ append({"value": 1, "label": i18n.dtr("address-book-app", "Aim"), "icon": "artwork:/protocol-aim.svg"})
145+ /*1*/ append({"value": 2, "label": i18n.dtr("address-book-app", "ICQ"), "icon": "artwork:/protocol-icq.svg"})
146 /*2*/ append({"value": 4, "label": i18n.dtr("address-book-app", "Jabber"), "icon": "artwork:/protocol-jabber.svg"})
147 /*3*/ append({"value": 5, "label": i18n.dtr("address-book-app", "MSN"), "icon": "artwork:/protocol-msn.svg"})
148 // append({"value": 6, "label": i18n.dtr("address-book-app", "QQ"), icon: "artwork:/protocol-qq.svg"})
149 /*4*/ append({"value": 7, "label": i18n.dtr("address-book-app", "Skype"), "icon": "artwork:/protocol-skype.svg"})
150 /*5*/ append({"value": 8, "label": i18n.dtr("address-book-app", "Yahoo"), "icon": "artwork:/protocol-yahoo.svg"})
151+ /*6*/ append({"value": 3, "label": i18n.dtr("address-book-app", "IRC"), "icon": "artwork:/protocol-irc.svg"})
152 loaded()
153 }
154 }
155
156=== modified file 'src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml'
157--- src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2016-09-23 13:47:49 +0000
158+++ src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2017-02-24 13:55:25 +0000
159@@ -17,9 +17,10 @@
160 import QtQuick 2.4
161 import Ubuntu.Components 1.3
162
163-Item {
164+FocusScope {
165 id: root
166
167+ readonly property bool _allowFocus: true
168 property string iconSource
169 property alias labelText: name.text
170 property bool expandIcon: false
171@@ -31,13 +32,21 @@
172 right: parent.right
173 }
174 height: visible ? units.gu(8) : 0
175+ activeFocusOnTab: true
176+
177+ Keys.onEnterPressed: clicked()
178+ Keys.onReturnPressed: clicked()
179
180 Rectangle {
181 anchors.fill: parent
182- color: Theme.palette.selected.background
183- opacity: addNewContactButtonArea.pressed ? 1.0 : 0.0
184+ border {
185+ color: UbuntuColors.orange
186+ width: parent.activeFocus ? 1 : 0
187+ }
188+ color: addNewContactButtonArea.pressed ? Theme.palette.selected.background : "transparent"
189 }
190
191+
192 UbuntuShape {
193 id: uShape
194
195@@ -77,6 +86,7 @@
196 }
197 elide: Text.ElideRight
198 visible: root.showContents
199+ color: parent.activeFocus ? UbuntuColors.blue : UbuntuColors.darkGrey
200 }
201
202 MouseArea {
203
204=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
205--- src/imports/Ubuntu/Contacts/ContactListView.qml 2016-12-12 18:54:08 +0000
206+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2017-02-24 13:55:25 +0000
207@@ -444,129 +444,155 @@
208 onTriggered: view.positionViewAtBeginning()
209 }
210
211- header: Column {
212+ header: FocusScope {
213 anchors {
214 left: parent.left
215 right: parent.right
216 }
217
218- // top margin
219- Item {
220- anchors {
221- left: parent.left
222- right: parent.right
223- }
224- height: units.gu(0.5)
225- }
226-
227- Binding {
228- target: view
229- property: 'currentIndex'
230- value: -1
231- when: root.showNewContact
232- }
233-
234- // AddNewButton
235- ContactListButtonDelegate {
236- anchors {
237- left: parent.left
238- right: parent.right
239- margins: units.gu(1)
240- }
241- objectName: "addNewButton"
242-
243- iconSource: "image://theme/add"
244- // TRANSLATORS: this refers to a new contact
245- labelText: i18n.dtr("address-book-app", "+ Create New")
246- onClicked: root.addNewContactClicked()
247- visible: root.showAddNewButton
248- }
249-
250- ContactDelegate {
251- property var contact: Contact {
252- Name {
253- firstName: i18n.tr("New contact")
254- }
255- Avatar {
256- imageUrl: "image://theme/contact"
257- }
258- }
259- selected: pageStack.hasKeyboard
260- visible: root.showNewContact
261- height: root.showNewContact ? defaultHeight : 0
262- onHeightChanged: {
263- if (visible)
264- view.positionViewAtBeginning()
265- }
266- Behavior on height {UbuntuNumberAnimation {}}
267- }
268+ height: childrenRect.height
269
270 Column {
271- id: importFromButtons
272- objectName: "importFromButtons"
273-
274- readonly property bool isSearching: (root.filterTerm && root.filterTerm !== "")
275-
276 anchors {
277 left: parent.left
278 right: parent.right
279- margins: units.gu(1)
280- }
281- height: visible ? childrenRect.height : 0
282-
283- visible: root.showImportOptions &&
284- !indicator.visible &&
285- (root.count === 0) &&
286- !view.favouritesIsSelected &&
287- !isSearching
288-
289- // avoid show the button while the list still loading contacts
290- Behavior on visible {
291- SequentialAnimation {
292- PauseAnimation {
293- duration: !importFromButtons.visible ? 500 : 0
294- }
295- PropertyAction {
296- target: importFromButtons
297- property: "visible"
298- }
299- }
300- }
301-
302- // Import from google
303- ContactListButtonDelegate {
304- id: importFromGoogleButton
305- objectName: "%1.importFromOnlineAccountButton".arg(root.objectName)
306-
307- visible: (onlineAccountHelper.status === Loader.Ready)
308- expandIcon: true
309- iconSource: "image://theme/google"
310- labelText: i18n.dtr("address-book-app", "Import contacts from Google")
311- onClicked: root.createOnlineAccount(false)
312- }
313-
314- // Import from sim card
315- ContactListButtonDelegate {
316- id: importFromSimCard
317- objectName: "%1.importFromSimCardButton".arg(root.objectName)
318-
319- expandIcon: true
320- iconSource: "image://theme/import"
321- labelText: i18n.dtr("address-book-app", "Import contacts from SIM card")
322- // Does not show the button if the list is not in a pageStack
323- visible: (typeof(pageStack) !== "undefined") &&
324- ((simList.sims.length > 0) && (simList.present.length > 0))
325- onClicked: {
326- if (pageStack.addPageToNextColumn)
327- pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
328- {"objectName": "simCardImportPage",
329- "targetModel": view.listModel,
330- "sims": simList.sims})
331- else
332- pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),
333- {"objectName": "simCardImportPage",
334- "targetModel": view.listModel,
335- "sims": simList.sims})
336+ }
337+
338+ height: childrenRect.height
339+ onActiveFocusChanged: {
340+ if (activeFocus) {
341+ for(var i = 0; i < children.length; i++) {
342+ if (children[i].enabled) {
343+ children[i].forceActiveFocus()
344+ break
345+ }
346+ }
347+ }
348+ }
349+
350+ // top margin
351+ Item {
352+ objectName: "Marging"
353+ anchors {
354+ left: parent.left
355+ right: parent.right
356+ }
357+ height: units.gu(0.5)
358+ enabled: false
359+ }
360+
361+ Binding {
362+ target: view
363+ property: 'currentIndex'
364+ value: -1
365+ when: root.showNewContact
366+ }
367+
368+ // AddNewButton
369+ ContactListButtonDelegate {
370+ anchors {
371+ left: parent.left
372+ right: parent.right
373+ margins: units.gu(1)
374+ }
375+
376+ objectName: "addNewButton"
377+
378+ iconSource: "image://theme/add"
379+ // TRANSLATORS: this refers to a new contact
380+ labelText: i18n.dtr("address-book-app", "+ Create New")
381+ onClicked: root.addNewContactClicked()
382+ visible: root.showAddNewButton
383+ focus: visible
384+ }
385+
386+ ContactDelegate {
387+ property var contact: Contact {
388+ Name {
389+ firstName: i18n.tr("New contact")
390+ }
391+ Avatar {
392+ imageUrl: "image://theme/contact"
393+ }
394+ }
395+ activeFocusOnTab: false
396+ selected: pageStack.hasKeyboard
397+ visible: root.showNewContact
398+ height: root.showNewContact ? defaultHeight : 0
399+ onHeightChanged: {
400+ if (visible)
401+ view.positionViewAtBeginning()
402+ }
403+ Behavior on height {UbuntuNumberAnimation {}}
404+ }
405+
406+ Column {
407+ id: importFromButtons
408+ objectName: "importFromButtons"
409+
410+ readonly property bool isSearching: (root.filterTerm && root.filterTerm !== "")
411+
412+ anchors {
413+ left: parent.left
414+ right: parent.right
415+ margins: units.gu(1)
416+ }
417+ height: visible ? childrenRect.height : 0
418+
419+ visible: root.showImportOptions &&
420+ !indicator.visible &&
421+ (root.count === 0) &&
422+ !view.favouritesIsSelected &&
423+ !isSearching
424+
425+ // avoid show the button while the list still loading contacts
426+ Behavior on visible {
427+ SequentialAnimation {
428+ PauseAnimation {
429+ duration: !importFromButtons.visible ? 500 : 0
430+ }
431+ PropertyAction {
432+ target: importFromButtons
433+ property: "visible"
434+ }
435+ }
436+ }
437+
438+ // Import from google
439+ ContactListButtonDelegate {
440+ id: importFromGoogleButton
441+ objectName: "%1.importFromOnlineAccountButton".arg(root.objectName)
442+
443+ visible: (onlineAccountHelper.status === Loader.Ready)
444+ expandIcon: true
445+ iconSource: "image://theme/google"
446+ labelText: i18n.dtr("address-book-app", "Import contacts from Google")
447+ onClicked: root.createOnlineAccount(false)
448+ }
449+
450+ // Import from sim card
451+ ContactListButtonDelegate {
452+ id: importFromSimCard
453+ objectName: "%1.importFromSimCardButton".arg(root.objectName)
454+
455+ expandIcon: true
456+ iconSource: "image://theme/import"
457+ labelText: i18n.dtr("address-book-app", "Import contacts from SIM card")
458+ // Does not show the button if the list is not in a pageStack
459+ visible: (typeof(pageStack) !== "undefined") &&
460+ ((simList.sims.length > 0) && (simList.present.length > 0))
461+ onClicked: {
462+ if (pageStack.addPageToNextColumn)
463+ pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
464+ {"objectName": "simCardImportPage",
465+ "targetModel": view.listModel,
466+ "sims": simList.sims})
467+ else
468+ pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),
469+ {"objectName": "simCardImportPage",
470+ "targetModel": view.listModel,
471+ "sims": simList.sims})
472+ }
473 }
474 }
475 }
476@@ -696,7 +722,8 @@
477 //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822
478 //because of that we need this
479 if (view.currentIndex == 0) {
480- pageStack._nextItemInFocusChain(view, false)
481+ view.currentIndex = -1
482+ view.headerItem.forceActiveFocus()
483 } else {
484 view.currentIndex -= 1
485 }
486
487=== modified file 'src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml'
488--- src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml 2015-11-10 19:51:19 +0000
489+++ src/imports/Ubuntu/Contacts/MultipleSelectionListView.qml 2017-02-24 13:55:25 +0000
490@@ -55,7 +55,7 @@
491 \endqml
492 */
493
494-ListView {
495+UbuntuListView {
496 id: listView
497
498 /*!

Subscribers

People subscribed via source and target branches