Merge lp:~renatofilho/address-book-app/new-bottom-edge into lp:address-book-app
- new-bottom-edge
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~renatofilho/address-book-app/new-bottom-edge |
Merge into: | lp:address-book-app |
Diff against target: |
2077 lines (+541/-660) 31 files modified
src/imports/ABContactEditorPage.qml (+8/-5) src/imports/ABContactListPage.qml (+161/-166) src/imports/ABContactViewPage.qml (+31/-3) src/imports/ABNewContactBottomEdge.qml (+67/-0) src/imports/BottomEdge.qml (+0/-321) src/imports/BottomEdgeShadow.qml (+0/-31) src/imports/CMakeLists.txt (+1/-2) src/imports/MainWindow.qml (+29/-1) src/imports/Settings/SettingsPage.qml (+54/-3) src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml (+20/-5) src/imports/Ubuntu/AddressBook/Base/ContactDetailGroupBase.qml (+2/-1) src/imports/Ubuntu/AddressBook/Base/RemoveContactsDialog.qml (+19/-2) src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailAvatarEditor.qml (+1/-0) src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailGroupWithTypeEditor.qml (+12/-23) src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailNameEditor.qml (+1/-0) src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml (+8/-3) src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailWithTypeEditor.qml (+0/-1) src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+25/-17) src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml (+24/-10) src/imports/Ubuntu/AddressBook/ContactView/ActionButton.qml (+1/-0) src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml (+2/-0) src/imports/Ubuntu/AddressBook/ContactView/ContactDetailAvatarView.qml (+2/-0) src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml (+13/-21) src/imports/Ubuntu/AddressBook/ContactView/ContactDetailNameView.qml (+2/-1) src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml (+2/-1) src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml (+4/-0) src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml (+1/-0) src/imports/Ubuntu/Contacts/ContactDelegate.qml (+1/-0) src/imports/Ubuntu/Contacts/ContactListView.qml (+41/-19) src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+6/-13) src/imports/Ubuntu/Contacts/FastScroll.qml (+3/-11) |
To merge this branch: | bzr merge lp:~renatofilho/address-book-app/new-bottom-edge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phablet Team | Pending | ||
Review via email: mp+279612@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-12-04.
Commit message
Implement the new bottom edge using the SDK component.
Description of the change
- 548. By Renato Araujo Oliveira Filho
-
Update BottomEdge editor page with the correct contact model.
- 549. By Renato Araujo Oliveira Filho
-
Removed support for deprecated application arguments.
- 550. By Renato Araujo Oliveira Filho
-
Make use of the new SDK PageHearder API.
- 551. By Renato Araujo Oliveira Filho
-
WORKAROUND: Set 'QuickUtils.
mouseAttached = true' to avoid problems with bottom edge on desktop; - 552. By Renato Araujo Oliveira Filho
-
Make sure that a contact is selected on application startup.
- 553. By Renato Araujo Oliveira Filho
-
Push contact view page component instead of object to avoid problems with page stack.
- 554. By Renato Araujo Oliveira Filho
-
Make bottom edge component on contact view available only when in dual column layout.
- 555. By Renato Araujo Oliveira Filho
-
Does not use navigationActions.
- 556. By Renato Araujo Oliveira Filho
-
Trunk merged.
- 557. By Renato Araujo Oliveira Filho
-
Fix problems with previous merge.
- 558. By Renato Araujo Oliveira Filho
-
Remove debug message.
Fix focus on contact list after close contact editor page.
Fix ambigous 'esc' short cut when editor page is opened. - 559. By Renato Araujo Oliveira Filho
-
Create a empty state page for multi column layout.
- 560. By Renato Araujo Oliveira Filho
-
Move focus back to contaclist after close ContactEditor page.
Add 'esc' shortcut to close BottomEdge. - 561. By Renato Araujo Oliveira Filho
-
Change bottom edge visual if a mouse is present.
- 562. By Renato Araujo Oliveira Filho
-
Update test to use new header API.
- 563. By Renato Araujo Oliveira Filho
-
Trunk merged.
- 564. By Renato Araujo Oliveira Filho
-
Create a leading actions property on Contact editor page to avoid problems with SDK replacing it.
Check if the mouse event is a real mouse event and not a touch event. - 565. By Renato Araujo Oliveira Filho
-
Only enable keyboard visuals after pres 'down' key. To avoid enabling it while using the virtual keyboard.
- 566. By Renato Araujo Oliveira Filho
-
Sync load bottom edge page.
- 567. By Renato Araujo Oliveira Filho
-
Load BottomEdge component async to avoid delays on app startup.
Fix bottom edge contents size. - 568. By Renato Araujo Oliveira Filho
-
Does not move contact list when vkb appears on bottom edge page.
- 569. By Renato Araujo Oliveira Filho
-
Trunk merged.
- 570. By Renato Araujo Oliveira Filho
-
Fixed 'back' action state while searching.
- 571. By Renato Araujo Oliveira Filho
-
Compile ContactEditorPage before push it on stack.
- 572. By Renato Araujo Oliveira Filho
-
Avoid stole contact list focus while creating bottom edge component.
- 573. By Renato Araujo Oliveira Filho
-
Disable edit button after first click on it. (avoid push the page more than once)
- 574. By Renato Araujo Oliveira Filho
-
highlight contact on click.
- 575. By Renato Araujo Oliveira Filho
-
Quick focus on contact name after open bottom edge page.
- 576. By Renato Araujo Oliveira Filho
-
Does not highlight settings item if not using keyboard.
- 577. By Renato Araujo Oliveira Filho
-
Update autopilot tests to work with the new bottom edge component.
- 578. By Renato Araujo Oliveira Filho
-
Removed debug message.
- 579. By Renato Araujo Oliveira Filho
-
Disable bottom edge while searching on multi colum layout.
- 580. By Renato Araujo Oliveira Filho
-
Cancel search after open bottom edge.
- 581. By Renato Araujo Oliveira Filho
-
Update contact view title on contact name change.
- 582. By Renato Araujo Oliveira Filho
-
Removed debug message.
- 583. By Renato Araujo Oliveira Filho
-
Fetch selected contact on application expansion.
- 584. By Renato Araujo Oliveira Filho
-
Use unity 8 private api to detect mouse and keyboard.
- 585. By Renato Araujo Oliveira Filho
-
Fetch first contact if no contact is selected after close bottom edge.
- 586. By Renato Araujo Oliveira Filho
-
Fixed field focus while adding new fields on contact editor.
- 587. By Renato Araujo Oliveira Filho
-
Disable bottom edge shortcut on contact list while it is not active.
- 588. By Renato Araujo Oliveira Filho
-
Update autopilot tests to work with the new bottom edge components.
- 589. By Renato Araujo Oliveira Filho
-
Update contact delegate click animation.
- 590. By Renato Araujo Oliveira Filho
-
Remove unused variables.
- 591. By Renato Araujo Oliveira Filho
-
Fixed focus on wrong field after add a new contact detail
- 592. By Renato Araujo Oliveira Filho
-
Focus contact list after close bottom edge.
- 593. By Renato Araujo Oliveira Filho
-
set minimum width and height for the app.
- 594. By Renato Araujo Oliveira Filho
-
Fixed focus on contact deletion.
- 595. By Renato Araujo Oliveira Filho
-
Fixed share component page to work with pagestack
- 596. By Renato Araujo Oliveira Filho
-
Reduce the application width necessary to change into multi column layout.
Unmerged revisions
Preview Diff
1 | === modified file 'src/imports/ABContactEditorPage.qml' | |||
2 | --- src/imports/ABContactEditorPage.qml 2015-10-26 13:18:11 +0000 | |||
3 | +++ src/imports/ABContactEditorPage.qml 2015-12-04 15:09:43 +0000 | |||
4 | @@ -34,10 +34,10 @@ | |||
5 | 34 | name: "cancel" | 34 | name: "cancel" |
6 | 35 | 35 | ||
7 | 36 | text: i18n.tr("Cancel") | 36 | text: i18n.tr("Cancel") |
12 | 37 | iconName: "back" | 37 | iconName: "down" |
13 | 38 | onTriggered: { | 38 | enabled: root.active && root.enabled |
14 | 39 | root.cancel() | 39 | shortcut: "Esc" |
15 | 40 | } | 40 | onTriggered: root.cancel() |
16 | 41 | } | 41 | } |
17 | 42 | 42 | ||
18 | 43 | head.actions: [ | 43 | head.actions: [ |
19 | @@ -46,9 +46,10 @@ | |||
20 | 46 | name: "save" | 46 | name: "save" |
21 | 47 | 47 | ||
22 | 48 | text: i18n.tr("Save") | 48 | text: i18n.tr("Save") |
23 | 49 | shortcut: "Ctrl+s" | ||
24 | 49 | iconName: "ok" | 50 | iconName: "ok" |
25 | 50 | // disable save button while avatar scale still running | 51 | // disable save button while avatar scale still running |
27 | 51 | enabled: root.isContactValid | 52 | enabled: root.isContactValid && root.active |
28 | 52 | onTriggered: root.save() | 53 | onTriggered: root.save() |
29 | 53 | } | 54 | } |
30 | 54 | ] | 55 | ] |
31 | @@ -58,4 +59,6 @@ | |||
32 | 58 | pageStack.contactListPage.moveListToContact(contact) | 59 | pageStack.contactListPage.moveListToContact(contact) |
33 | 59 | } | 60 | } |
34 | 60 | } | 61 | } |
35 | 62 | |||
36 | 63 | Component.onDestruction: console.debug("Destroy editor") | ||
37 | 61 | } | 64 | } |
38 | 62 | 65 | ||
39 | === modified file 'src/imports/ABContactListPage.qml' | |||
40 | --- src/imports/ABContactListPage.qml 2015-11-25 16:59:11 +0000 | |||
41 | +++ src/imports/ABContactListPage.qml 2015-12-04 15:09:43 +0000 | |||
42 | @@ -1,4 +1,4 @@ | |||
44 | 1 | /* | 1 | /* |
45 | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. |
46 | 3 | * | 3 | * |
47 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
48 | @@ -30,18 +30,19 @@ | |||
49 | 30 | id: mainPage | 30 | id: mainPage |
50 | 31 | objectName: "contactListPage" | 31 | objectName: "contactListPage" |
51 | 32 | 32 | ||
52 | 33 | property var viewPage: null | ||
53 | 33 | property bool pickMode: false | 34 | property bool pickMode: false |
54 | 34 | property alias contentHubTransfer: contactExporter.activeTransfer | 35 | property alias contentHubTransfer: contactExporter.activeTransfer |
55 | 35 | property bool pickMultipleContacts: false | 36 | property bool pickMultipleContacts: false |
56 | 36 | property QtObject contactIndex: null | 37 | property QtObject contactIndex: null |
57 | 37 | property string newPhoneToAdd: "" | 38 | property string newPhoneToAdd: "" |
58 | 38 | property alias contactManager: contactList.manager | 39 | property alias contactManager: contactList.manager |
59 | 39 | property Page contactViewPage: null | ||
60 | 40 | property Page contactEditorPage: null | ||
61 | 41 | property var _busyDialog: null | 40 | property var _busyDialog: null |
62 | 42 | property bool _importingTestData: false | 41 | property bool _importingTestData: false |
63 | 42 | property bool _creatingContact: false | ||
64 | 43 | 43 | ||
66 | 44 | readonly property bool bottomEdgePageOpened: bottomEdge.opened && bottomEdge.fullLoaded | 44 | readonly property string currentViewContactId: viewPage && viewPage.contact ? viewPage.contact.contactId : "" |
67 | 45 | readonly property bool bottomEdgePageOpened: false //bottomEdge.opened && bottomEdge.fullLoaded | ||
68 | 45 | readonly property bool isEmpty: (contactList.count === 0) | 46 | readonly property bool isEmpty: (contactList.count === 0) |
69 | 46 | readonly property bool allowToQuit: (application.callbackApplication.length > 0) | 47 | readonly property bool allowToQuit: (application.callbackApplication.length > 0) |
70 | 47 | readonly property var contactModel: contactList.listModel ? contactList.listModel : null | 48 | readonly property var contactModel: contactList.listModel ? contactList.listModel : null |
71 | @@ -61,30 +62,31 @@ | |||
72 | 61 | function createContactWithPhoneNumber(phoneNumber) | 62 | function createContactWithPhoneNumber(phoneNumber) |
73 | 62 | { | 63 | { |
74 | 63 | var newContact = ContactsJS.createEmptyContact(phoneNumber, mainPage); | 64 | var newContact = ContactsJS.createEmptyContact(phoneNumber, mainPage); |
87 | 64 | openEditPage({model: contactList.listModel, | 65 | pageStack.bottomEdge.editContact(newContact, mainPage.contactModel) |
76 | 65 | contact: newContact, | ||
77 | 66 | initialFocusSection: "name"}, | ||
78 | 67 | mainPage); | ||
79 | 68 | } | ||
80 | 69 | |||
81 | 70 | function openEditPage(editPageProperties, sourcePage) { | ||
82 | 71 | var component = Qt.createComponent(Qt.resolvedUrl("ABContactEditorPage.qml")) | ||
83 | 72 | if (component.status === Component.Ready) { | ||
84 | 73 | mainPage.contactEditorPage = component.createObject(mainPage, editPageProperties) | ||
85 | 74 | pageStack.addPageToNextColumn(sourcePage, mainPage.contactEditorPage) | ||
86 | 75 | } | ||
88 | 76 | } | 66 | } |
89 | 77 | 67 | ||
90 | 78 | function openViewPage(viewPageProperties) { | 68 | function openViewPage(viewPageProperties) { |
91 | 69 | if (mainPage.viewPage) { | ||
92 | 70 | pageStack.removePages(mainPage.viewPage) | ||
93 | 71 | mainPage.viewPage.destroy() | ||
94 | 72 | mainPage.viewPage = null | ||
95 | 73 | } | ||
96 | 74 | |||
97 | 79 | var component = Qt.createComponent(Qt.resolvedUrl("ABContactViewPage.qml")) | 75 | var component = Qt.createComponent(Qt.resolvedUrl("ABContactViewPage.qml")) |
98 | 80 | if (component.status === Component.Ready) { | 76 | if (component.status === Component.Ready) { |
101 | 81 | mainPage.contactViewPage = component.createObject(mainPage, viewPageProperties) | 77 | mainPage.viewPage = component.createObject(mainPage, viewPageProperties) |
102 | 82 | pageStack.addPageToNextColumn(mainPage, mainPage.contactViewPage) | 78 | pageStack.addPageToNextColumn(mainPage, mainPage.viewPage) |
103 | 83 | } | 79 | } |
104 | 84 | } | 80 | } |
105 | 85 | 81 | ||
106 | 86 | function showContact(contact) | 82 | function showContact(contact) |
107 | 87 | { | 83 | { |
108 | 84 | var currentContact = contactList.listModel.contacts[contactList.currentIndex] | ||
109 | 85 | if (currentContact && (mainPage.currentViewContactId === currentContact.contactId)) { | ||
110 | 86 | console.debug("Skip show contact") | ||
111 | 87 | return | ||
112 | 88 | } | ||
113 | 89 | |||
114 | 88 | // go back to normal state if not searching | 90 | // go back to normal state if not searching |
115 | 89 | if ((state !== "searching") && | 91 | if ((state !== "searching") && |
116 | 90 | (state !== "vcardImported")) { | 92 | (state !== "vcardImported")) { |
117 | @@ -136,14 +138,12 @@ | |||
118 | 136 | 138 | ||
119 | 137 | function moveListToContact(contact) | 139 | function moveListToContact(contact) |
120 | 138 | { | 140 | { |
125 | 139 | // skipt it if searching or importing contacts | 141 | if ((state !== "searching") && |
126 | 140 | if ((state === "searching") || | 142 | (state !== "vcardImported")) { |
127 | 141 | (state === "vcardImported")) { | 143 | mainPage.state = "default" |
124 | 142 | return | ||
128 | 143 | } | 144 | } |
129 | 144 | 145 | ||
130 | 145 | contactIndex = contact | 146 | contactIndex = contact |
131 | 146 | mainPage.state = "default" | ||
132 | 147 | // this means a new contact was created | 147 | // this means a new contact was created |
133 | 148 | if (mainPage.allowToQuit) { | 148 | if (mainPage.allowToQuit) { |
134 | 149 | application.goBackToSourceApp() | 149 | application.goBackToSourceApp() |
135 | @@ -157,42 +157,62 @@ | |||
136 | 157 | contactList.reset() | 157 | contactList.reset() |
137 | 158 | } | 158 | } |
138 | 159 | 159 | ||
139 | 160 | function showContactEditorPage(editorPage) { | ||
140 | 161 | contactList.currentIndex = -1; | ||
141 | 162 | mainPage.contactEditorPage = editorPage; | ||
142 | 163 | pageStack.addPageToNextColumn(mainPage, editorPage); | ||
143 | 164 | editorPage.ready(); | ||
144 | 165 | editorPage.contactSaved.connect(onNewContactSaved); | ||
145 | 166 | } | ||
146 | 167 | |||
147 | 168 | function onNewContactSaved(contact) { | 160 | function onNewContactSaved(contact) { |
148 | 161 | _creatingContact = true | ||
149 | 162 | moveListToContact(contact) | ||
150 | 169 | if (pageStack.columns > 1) { | 163 | if (pageStack.columns > 1) { |
151 | 170 | showContact(contact); | 164 | showContact(contact); |
152 | 171 | } | 165 | } |
153 | 172 | } | 166 | } |
154 | 173 | 167 | ||
155 | 168 | function reloadContact() | ||
156 | 169 | { | ||
157 | 170 | fetchNewContactTimer.restart() | ||
158 | 171 | contactList.forceActiveFocus() | ||
159 | 172 | } | ||
160 | 173 | |||
161 | 174 | title: i18n.tr("Contacts") | 174 | title: i18n.tr("Contacts") |
162 | 175 | 175 | ||
163 | 176 | flickable: null | 176 | flickable: null |
164 | 177 | |||
165 | 178 | Timer { | ||
166 | 179 | id: fetchNewContactTimer | ||
167 | 180 | |||
168 | 181 | interval: 0 | ||
169 | 182 | repeat: false | ||
170 | 183 | onTriggered: { | ||
171 | 184 | if ((contactList.currentIndex >= 0) && (pageStack.columns > 1)) { | ||
172 | 185 | var currentContact = contactList.listModel.contacts[contactList.currentIndex] | ||
173 | 186 | if (mainPage.currentViewContactId === currentContact.contactId) | ||
174 | 187 | return | ||
175 | 188 | |||
176 | 189 | contactList.view._fetchContact(contactList.currentIndex, currentContact) | ||
177 | 190 | } | ||
178 | 191 | } | ||
179 | 192 | } | ||
180 | 193 | |||
181 | 177 | ContactsUI.ContactListView { | 194 | ContactsUI.ContactListView { |
182 | 178 | id: contactList | 195 | id: contactList |
183 | 179 | objectName: "contactListView" | 196 | objectName: "contactListView" |
184 | 197 | |||
185 | 198 | focus: true | ||
186 | 180 | showImportOptions: !mainPage.pickMode && | 199 | showImportOptions: !mainPage.pickMode && |
187 | 181 | mainPage.newPhoneToAdd === "" && | 200 | mainPage.newPhoneToAdd === "" && |
189 | 182 | (!mainPage.contactEditorPage || !mainPage.contactEditorPage.active) | 201 | pageStack.bottomEdge && (pageStack.bottomEdge.satus === BottomEdge.Hidden) |
190 | 183 | anchors { | 202 | anchors { |
191 | 184 | top: parent.top | 203 | top: parent.top |
192 | 185 | left: parent.left | 204 | left: parent.left |
193 | 186 | bottom: keyboard.top | 205 | bottom: keyboard.top |
194 | 187 | right: parent.right | 206 | right: parent.right |
195 | 188 | } | 207 | } |
196 | 208 | currentIndex: 0 | ||
197 | 189 | filterTerm: searchField.text | 209 | filterTerm: searchField.text |
198 | 190 | multiSelectionEnabled: true | 210 | multiSelectionEnabled: true |
199 | 191 | multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode | 211 | multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode |
201 | 192 | highlightSelected: pageStack.columns > 1 | 212 | highlightSelected: pageStack.columns > 1 && !mainPage._creatingContact |
202 | 213 | showNewContact: (pageStack.columns > 1) && pageStack.bottomEdge && (pageStack.bottomEdge.status === BottomEdge.Committed) | ||
203 | 193 | onAddContactClicked: mainPage.createContactWithPhoneNumber(label) | 214 | onAddContactClicked: mainPage.createContactWithPhoneNumber(label) |
204 | 194 | onAddNewContactClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd) | 215 | onAddNewContactClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd) |
205 | 195 | |||
206 | 196 | onContactClicked: mainPage.showContact(contact) | 216 | onContactClicked: mainPage.showContact(contact) |
207 | 197 | onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default" | 217 | onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default" |
208 | 198 | onSelectionCanceled: { | 218 | onSelectionCanceled: { |
209 | @@ -208,25 +228,71 @@ | |||
210 | 208 | } | 228 | } |
211 | 209 | 229 | ||
212 | 210 | onError: pageStack.contactModelError(error) | 230 | onError: pageStack.contactModelError(error) |
213 | 231 | onActiveFocusChanged: { | ||
214 | 232 | if (activeFocus && (contactList.currentIndex === -1)) { | ||
215 | 233 | contactList.currentIndex = 0 | ||
216 | 234 | } | ||
217 | 235 | } | ||
218 | 236 | onCountChanged: { | ||
219 | 237 | if (mainPage.active && | ||
220 | 238 | (pageStack.columns > 1) && | ||
221 | 239 | (contactList.currentIndex === -1)) { | ||
222 | 240 | contactList.currentIndex = 0 | ||
223 | 241 | } | ||
224 | 242 | fetchNewContactTimer.restart() | ||
225 | 243 | } | ||
226 | 244 | onCurrentIndexChanged: { | ||
227 | 245 | if (!mainPage.contactIndex) | ||
228 | 246 | fetchNewContactTimer.restart() | ||
229 | 247 | } | ||
230 | 248 | |||
231 | 249 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
232 | 250 | //because of that we need this | ||
233 | 251 | Keys.onRightPressed: { | ||
234 | 252 | // only move focus away when in edit mode | ||
235 | 253 | if (pageStack.bottomEdge.status === BottomEdge.Committed) { | ||
236 | 254 | var next = pageStack._nextItemInFocusChain(view, true) | ||
237 | 255 | if (next === searchField) { | ||
238 | 256 | pageStack._nextItemInFocusChain(next, true) | ||
239 | 257 | } | ||
240 | 258 | } | ||
241 | 259 | } | ||
242 | 260 | Keys.onTabPressed: { | ||
243 | 261 | var next = pageStack._nextItemInFocusChain(view, true) | ||
244 | 262 | if (next === searchField) { | ||
245 | 263 | pageStack._nextItemInFocusChain(next, true) | ||
246 | 264 | } | ||
247 | 265 | } | ||
248 | 211 | } | 266 | } |
249 | 212 | 267 | ||
250 | 213 | TextField { | 268 | TextField { |
251 | 214 | id: searchField | 269 | id: searchField |
252 | 215 | 270 | ||
253 | 271 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
254 | 272 | //because of that we need this | ||
255 | 273 | readonly property bool _allowFocus: true | ||
256 | 274 | |||
257 | 216 | anchors { | 275 | anchors { |
260 | 217 | left: parent.left | 276 | left: parent ? parent.left : undefined |
261 | 218 | right: parent.right | 277 | right: parent ? parent.right : undefined |
262 | 219 | rightMargin: units.gu(2) | 278 | rightMargin: units.gu(2) |
263 | 220 | } | 279 | } |
265 | 221 | focus: false | 280 | |
266 | 222 | visible: false | 281 | visible: false |
267 | 223 | onTextChanged: contactList.currentIndex = -1 | ||
268 | 224 | inputMethodHints: Qt.ImhNoPredictiveText | 282 | inputMethodHints: Qt.ImhNoPredictiveText |
269 | 225 | placeholderText: i18n.tr("Search...") | 283 | placeholderText: i18n.tr("Search...") |
273 | 226 | onFocusChanged: { | 284 | onVisibleChanged: { |
274 | 227 | if (visible && focus) | 285 | if (visible) { |
275 | 228 | searchField.forceActiveFocus() | 286 | if (activeFocus) { |
276 | 287 | Qt.inputMethod.show() | ||
277 | 288 | } else { | ||
278 | 289 | searchField.forceActiveFocus() | ||
279 | 290 | } | ||
280 | 291 | } | ||
281 | 229 | } | 292 | } |
282 | 293 | |||
283 | 294 | Keys.onTabPressed: contactList.forceActiveFocus() | ||
284 | 295 | Keys.onDownPressed: contactList.forceActiveFocus() | ||
285 | 230 | } | 296 | } |
286 | 231 | 297 | ||
287 | 232 | Connections { | 298 | Connections { |
288 | @@ -265,6 +331,8 @@ | |||
289 | 265 | text: i18n.tr("Search") | 331 | text: i18n.tr("Search") |
290 | 266 | iconName: "search" | 332 | iconName: "search" |
291 | 267 | visible: !mainPage.isEmpty | 333 | visible: !mainPage.isEmpty |
292 | 334 | enabled: mainPage.state === "default" | ||
293 | 335 | shortcut: "Ctrl+F" | ||
294 | 268 | onTriggered: { | 336 | onTriggered: { |
295 | 269 | mainPage.state = (mainPage.state === "newphone" ? "newphoneSearching" : "searching") | 337 | mainPage.state = (mainPage.state === "newphone" ? "newphoneSearching" : "searching") |
296 | 270 | contactList.showAllContacts() | 338 | contactList.showAllContacts() |
297 | @@ -287,9 +355,21 @@ | |||
298 | 287 | Action { | 355 | Action { |
299 | 288 | text: i18n.tr("Settings") | 356 | text: i18n.tr("Settings") |
300 | 289 | iconName: "settings" | 357 | iconName: "settings" |
304 | 290 | onTriggered: pageStack.addPageToNextColumn(mainPage, | 358 | onTriggered:{ |
305 | 291 | Qt.resolvedUrl("./Settings/SettingsPage.qml"), | 359 | var incubator = pageStack.addPageToNextColumn(mainPage, |
306 | 292 | {"contactListModel": contactList.listModel}) | 360 | Qt.resolvedUrl("./Settings/SettingsPage.qml"), |
307 | 361 | {"contactListModel": contactList.listModel}) | ||
308 | 362 | incubator.onStatusChanged = function(status) { | ||
309 | 363 | if (status === Component.Ready) { | ||
310 | 364 | incubator.object.onActiveChanged.connect(function(active) { | ||
311 | 365 | console.debug("Active:" + incubator.object.active) | ||
312 | 366 | if (!incubator.object.active) { | ||
313 | 367 | mainPage.reloadContact() | ||
314 | 368 | } | ||
315 | 369 | }) | ||
316 | 370 | } | ||
317 | 371 | } | ||
318 | 372 | } | ||
319 | 293 | } | 373 | } |
320 | 294 | ] | 374 | ] |
321 | 295 | PropertyChanges { | 375 | PropertyChanges { |
322 | @@ -303,6 +383,10 @@ | |||
323 | 303 | target: searchField | 383 | target: searchField |
324 | 304 | text: "" | 384 | text: "" |
325 | 305 | } | 385 | } |
326 | 386 | PropertyChanges { | ||
327 | 387 | target: bottomEdgeLoader | ||
328 | 388 | enabled: true | ||
329 | 389 | } | ||
330 | 306 | }, | 390 | }, |
331 | 307 | PageHeadState { | 391 | PageHeadState { |
332 | 308 | id: searchingState | 392 | id: searchingState |
333 | @@ -311,6 +395,8 @@ | |||
334 | 311 | backAction: Action { | 395 | backAction: Action { |
335 | 312 | iconName: "back" | 396 | iconName: "back" |
336 | 313 | text: i18n.tr("Cancel") | 397 | text: i18n.tr("Cancel") |
337 | 398 | enabled: mainPage.state === "searching" && !mainPage.bottomEdgeOpenOnNextCollumn | ||
338 | 399 | shortcut:"Esc" | ||
339 | 314 | onTriggered: { | 400 | onTriggered: { |
340 | 315 | contactList.forceActiveFocus() | 401 | contactList.forceActiveFocus() |
341 | 316 | mainPage.head.sections.selectedIndex = 0 | 402 | mainPage.head.sections.selectedIndex = 0 |
342 | @@ -319,7 +405,7 @@ | |||
343 | 319 | } | 405 | } |
344 | 320 | 406 | ||
345 | 321 | PropertyChanges { | 407 | PropertyChanges { |
347 | 322 | target: bottomEdge | 408 | target: bottomEdgeLoader |
348 | 323 | enabled: false | 409 | enabled: false |
349 | 324 | } | 410 | } |
350 | 325 | 411 | ||
351 | @@ -347,7 +433,9 @@ | |||
352 | 347 | backAction: Action { | 433 | backAction: Action { |
353 | 348 | text: i18n.tr("Cancel selection") | 434 | text: i18n.tr("Cancel selection") |
354 | 349 | iconName: "back" | 435 | iconName: "back" |
355 | 436 | enabled: mainPage.state === "selection" | ||
356 | 350 | onTriggered: contactList.cancelSelection() | 437 | onTriggered: contactList.cancelSelection() |
357 | 438 | shortcut: "Esc" | ||
358 | 351 | } | 439 | } |
359 | 352 | actions: [ | 440 | actions: [ |
360 | 353 | Action { | 441 | Action { |
361 | @@ -405,7 +493,7 @@ | |||
362 | 405 | actions: selectionState.actions | 493 | actions: selectionState.actions |
363 | 406 | } | 494 | } |
364 | 407 | PropertyChanges { | 495 | PropertyChanges { |
366 | 408 | target: bottomEdge | 496 | target: bottomEdgeLoader |
367 | 409 | enabled: false | 497 | enabled: false |
368 | 410 | } | 498 | } |
369 | 411 | }, | 499 | }, |
370 | @@ -440,7 +528,7 @@ | |||
371 | 440 | showAddNewButton: true | 528 | showAddNewButton: true |
372 | 441 | } | 529 | } |
373 | 442 | PropertyChanges { | 530 | PropertyChanges { |
375 | 443 | target: bottomEdge | 531 | target: bottomEdgeLoader |
376 | 444 | enabled: false | 532 | enabled: false |
377 | 445 | } | 533 | } |
378 | 446 | }, | 534 | }, |
379 | @@ -462,7 +550,7 @@ | |||
380 | 462 | backAction: vcardImportedState.backAction | 550 | backAction: vcardImportedState.backAction |
381 | 463 | } | 551 | } |
382 | 464 | PropertyChanges { | 552 | PropertyChanges { |
384 | 465 | target: bottomEdge | 553 | target: bottomEdgeLoader |
385 | 466 | enabled: false | 554 | enabled: false |
386 | 467 | } | 555 | } |
387 | 468 | PropertyChanges { | 556 | PropertyChanges { |
388 | @@ -493,8 +581,11 @@ | |||
389 | 493 | if (active && contactList.showAddNewButton) { | 581 | if (active && contactList.showAddNewButton) { |
390 | 494 | contactList.positionViewAtBeginning() | 582 | contactList.positionViewAtBeginning() |
391 | 495 | } | 583 | } |
392 | 584 | |||
393 | 496 | if (active && (state === "searching")) { | 585 | if (active && (state === "searching")) { |
394 | 497 | searchField.forceActiveFocus() | 586 | searchField.forceActiveFocus() |
395 | 587 | } else if (active) { | ||
396 | 588 | contactList.forceActiveFocus() | ||
397 | 498 | } | 589 | } |
398 | 499 | } | 590 | } |
399 | 500 | 591 | ||
400 | @@ -517,8 +608,8 @@ | |||
401 | 517 | !contactList.favouritesIsSelected && | 608 | !contactList.favouritesIsSelected && |
402 | 518 | mainPage.isEmpty && | 609 | mainPage.isEmpty && |
403 | 519 | (mainPage.newPhoneToAdd === "") && | 610 | (mainPage.newPhoneToAdd === "") && |
406 | 520 | !(contactList.filterTerm && contactList.filterTerm !== "")) && | 611 | !(contactList.filterTerm && contactList.filterTerm !== "")) |
407 | 521 | bottomEdge.visible | 612 | //&& bottomEdge.visible |
408 | 522 | 613 | ||
409 | 523 | Behavior on visible { | 614 | Behavior on visible { |
410 | 524 | SequentialAnimation { | 615 | SequentialAnimation { |
411 | @@ -643,111 +734,34 @@ | |||
412 | 643 | } | 734 | } |
413 | 644 | } | 735 | } |
414 | 645 | 736 | ||
512 | 646 | Component { | 737 | Loader { |
513 | 647 | id: editorPageBottomEdge | 738 | id: bottomEdgeLoader |
514 | 648 | ABContactEditorPage { | 739 | |
515 | 649 | backIconName: "down" | 740 | enabled: false |
516 | 650 | implicitWidth: mainPage.width | 741 | active: (pageStack.columns === 1) && bottomEdgeLoader.enabled |
517 | 651 | implicitHeight: mainPage.height | 742 | sourceComponent: ABNewContactBottomEdge { |
518 | 652 | model: contactList.listModel | 743 | pageStack: mainPage.pageStack |
519 | 653 | contact: ContactsJS.createEmptyContact("", mainPage) | 744 | parent: mainPage |
520 | 654 | initialFocusSection: "name" | 745 | hint.flickable: contactList.view |
521 | 655 | enabled: false | 746 | } |
522 | 656 | } | 747 | } |
523 | 657 | } | 748 | |
524 | 658 | 749 | Binding { | |
525 | 659 | Component { | 750 | target: pageStack |
526 | 660 | id: emptyContact | 751 | property: 'bottomEdge' |
527 | 661 | ContactsUI.ContactDelegate { | 752 | value: bottomEdgeLoader.item |
528 | 662 | property Contact contact: Contact { | 753 | when: bottomEdgeLoader.status == Loader.Ready |
432 | 663 | Name { | ||
433 | 664 | firstName: i18n.tr("New contact") | ||
434 | 665 | } | ||
435 | 666 | Avatar { | ||
436 | 667 | imageUrl: "image://theme/contact" | ||
437 | 668 | } | ||
438 | 669 | } | ||
439 | 670 | width: mainPage.width | ||
440 | 671 | } | ||
441 | 672 | } | ||
442 | 673 | |||
443 | 674 | BottomEdge { | ||
444 | 675 | id: bottomEdge | ||
445 | 676 | objectName: "bottomEdge" | ||
446 | 677 | |||
447 | 678 | property var incubator | ||
448 | 679 | |||
449 | 680 | // FIXME: this is a workaround for the lack of fully asynchronous loading | ||
450 | 681 | // of Pages in AdaptativePageLayout | ||
451 | 682 | function createObjectAsynchronously(url, properties, callback) { | ||
452 | 683 | var component = Qt.createComponent(url, Component.Asynchronous); | ||
453 | 684 | if (component.status == Component.Ready) { | ||
454 | 685 | incubateObject(component, properties, callback); | ||
455 | 686 | } else { | ||
456 | 687 | component.onStatusChanged.connect(function(status) { | ||
457 | 688 | if (status == Component.Ready) { | ||
458 | 689 | incubateObject(component, properties, callback); | ||
459 | 690 | } | ||
460 | 691 | }); | ||
461 | 692 | } | ||
462 | 693 | } | ||
463 | 694 | |||
464 | 695 | function incubateObject(component, properties, callback) { | ||
465 | 696 | if (component.status == Component.Ready) { | ||
466 | 697 | incubator = component.incubateObject(null, | ||
467 | 698 | properties, | ||
468 | 699 | Qt.Asynchronous); | ||
469 | 700 | incubator.onStatusChanged = function(status) { | ||
470 | 701 | if (status == Component.Ready) { | ||
471 | 702 | callback(incubator.object); | ||
472 | 703 | incubator = null; | ||
473 | 704 | } | ||
474 | 705 | } | ||
475 | 706 | } | ||
476 | 707 | } | ||
477 | 708 | |||
478 | 709 | function loadEditorPage() { | ||
479 | 710 | var newContact = ContactsJS.createEmptyContact("", mainPage); | ||
480 | 711 | createObjectAsynchronously(Qt.resolvedUrl("ABContactEditorPage.qml"), | ||
481 | 712 | {model: contactList.listModel, | ||
482 | 713 | contact: newContact, | ||
483 | 714 | initialFocusSection: "name"}, | ||
484 | 715 | showContactEditorPage); | ||
485 | 716 | } | ||
486 | 717 | |||
487 | 718 | anchors.fill: parent | ||
488 | 719 | contentComponent: pageStack.columns == 1 ? editorPageBottomEdge : emptyContact | ||
489 | 720 | flickable: contactList | ||
490 | 721 | iconName: "contact-new" | ||
491 | 722 | enabled: !contactList.isInSelectionMode | ||
492 | 723 | backGroundEffectEnabled: pageStack.columns === 1 | ||
493 | 724 | |||
494 | 725 | onOpenBegin: { | ||
495 | 726 | contactList.prepareNewContact = true; | ||
496 | 727 | contactList.positionViewAtBeginning(); | ||
497 | 728 | if (pageStack.columns > 1) { | ||
498 | 729 | loadEditorPage(); | ||
499 | 730 | } | ||
500 | 731 | } | ||
501 | 732 | onOpenEnd: { | ||
502 | 733 | bottomEdge.visible = false; | ||
503 | 734 | contactList.showNewContact = true; | ||
504 | 735 | if (pageStack.columns <= 1) { | ||
505 | 736 | showContactEditorPage(bottomEdge.content); | ||
506 | 737 | } | ||
507 | 738 | } | ||
508 | 739 | |||
509 | 740 | onClicked: { | ||
510 | 741 | bottomEdge.open(); | ||
511 | 742 | } | ||
529 | 743 | } | 754 | } |
530 | 744 | 755 | ||
531 | 745 | Connections { | 756 | Connections { |
532 | 746 | target: mainPage.contactModel | 757 | target: mainPage.contactModel |
533 | 758 | |||
534 | 747 | onContactsChanged: { | 759 | onContactsChanged: { |
535 | 748 | if (contactIndex) { | 760 | if (contactIndex) { |
536 | 749 | contactList.positionViewAtContact(mainPage.contactIndex) | 761 | contactList.positionViewAtContact(mainPage.contactIndex) |
537 | 750 | mainPage.contactIndex = null | 762 | mainPage.contactIndex = null |
538 | 763 | // at this point the operation has finished already | ||
539 | 764 | mainPage._creatingContact = false | ||
540 | 751 | } | 765 | } |
541 | 752 | } | 766 | } |
542 | 753 | onImportCompleted: { | 767 | onImportCompleted: { |
543 | @@ -775,23 +789,4 @@ | |||
544 | 775 | } | 789 | } |
545 | 776 | } | 790 | } |
546 | 777 | } | 791 | } |
547 | 778 | |||
548 | 779 | Connections { | ||
549 | 780 | target: mainPage.contactViewPage | ||
550 | 781 | onEditContact: { | ||
551 | 782 | openEditPage(editPageProperties, mainPage.contactViewPage); | ||
552 | 783 | } | ||
553 | 784 | } | ||
554 | 785 | |||
555 | 786 | Connections { | ||
556 | 787 | target: mainPage.contactEditorPage | ||
557 | 788 | onActiveChanged: { | ||
558 | 789 | if (!mainPage.contactEditorPage.active) { | ||
559 | 790 | contactList.prepareNewContact = false; | ||
560 | 791 | contactList.showNewContact = false; | ||
561 | 792 | bottomEdge.visible = true; | ||
562 | 793 | bottomEdge.close(); | ||
563 | 794 | } | ||
564 | 795 | } | ||
565 | 796 | } | ||
566 | 797 | } | 792 | } |
567 | 798 | 793 | ||
568 | === modified file 'src/imports/ABContactViewPage.qml' | |||
569 | --- src/imports/ABContactViewPage.qml 2015-10-28 01:08:39 +0000 | |||
570 | +++ src/imports/ABContactViewPage.qml 2015-12-04 15:09:43 +0000 | |||
571 | @@ -1,4 +1,4 @@ | |||
573 | 1 | /* | 1 | /* |
574 | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. |
575 | 3 | * | 3 | * |
576 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
577 | @@ -28,6 +28,7 @@ | |||
578 | 28 | objectName: "contactViewPage" | 28 | objectName: "contactViewPage" |
579 | 29 | 29 | ||
580 | 30 | property string addPhoneToContact: "" | 30 | property string addPhoneToContact: "" |
581 | 31 | property var editorPage: null | ||
582 | 31 | signal editContact(var editPageProperties) | 32 | signal editContact(var editPageProperties) |
583 | 32 | 33 | ||
584 | 33 | head.actions: [ | 34 | head.actions: [ |
585 | @@ -50,9 +51,14 @@ | |||
586 | 50 | 51 | ||
587 | 51 | text: i18n.tr("Edit") | 52 | text: i18n.tr("Edit") |
588 | 52 | iconName: "edit" | 53 | iconName: "edit" |
589 | 54 | enabled: root.active | ||
590 | 55 | shortcut: "Ctrl+e" | ||
591 | 53 | onTriggered: { | 56 | onTriggered: { |
594 | 54 | editContact({model: root.model, | 57 | pageStack.addPageToCurrentColumn(root, |
595 | 55 | contact: root.contact}); | 58 | Qt.resolvedUrl("ABContactEditorPage.qml"), |
596 | 59 | { model: root.model, | ||
597 | 60 | contact: root.contact, | ||
598 | 61 | backIconName: 'back'}) | ||
599 | 56 | } | 62 | } |
600 | 57 | } | 63 | } |
601 | 58 | ] | 64 | ] |
602 | @@ -100,4 +106,26 @@ | |||
603 | 100 | id: contactShareComponent | 106 | id: contactShareComponent |
604 | 101 | ContactSharePage {} | 107 | ContactSharePage {} |
605 | 102 | } | 108 | } |
606 | 109 | |||
607 | 110 | Loader { | ||
608 | 111 | id: bottomEdgeLoader | ||
609 | 112 | |||
610 | 113 | active: root.pageStack && root.pageStack.columns > 1 | ||
611 | 114 | sourceComponent: ABNewContactBottomEdge { | ||
612 | 115 | id: bottomEdge | ||
613 | 116 | |||
614 | 117 | parent: root | ||
615 | 118 | pageStack: root.pageStack | ||
616 | 119 | hint.flickable: root.flickable | ||
617 | 120 | } | ||
618 | 121 | |||
619 | 122 | Binding { | ||
620 | 123 | target: pageStack | ||
621 | 124 | property: 'bottomEdge' | ||
622 | 125 | value: bottomEdgeLoader.item | ||
623 | 126 | when: bottomEdgeLoader.status == Loader.Ready | ||
624 | 127 | } | ||
625 | 128 | } | ||
626 | 129 | |||
627 | 130 | Component.onDestruction: console.debug("VIEW DESTROYED") | ||
628 | 103 | } | 131 | } |
629 | 104 | 132 | ||
630 | === added file 'src/imports/ABNewContactBottomEdge.qml' | |||
631 | --- src/imports/ABNewContactBottomEdge.qml 1970-01-01 00:00:00 +0000 | |||
632 | +++ src/imports/ABNewContactBottomEdge.qml 2015-12-04 15:09:43 +0000 | |||
633 | @@ -0,0 +1,67 @@ | |||
634 | 1 | /* | ||
635 | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. | ||
636 | 3 | * | ||
637 | 4 | * This program is free software; you can redistribute it and/or modify | ||
638 | 5 | * it under the terms of the GNU General Public License as published by | ||
639 | 6 | * the Free Software Foundation; version 3. | ||
640 | 7 | * | ||
641 | 8 | * This program is distributed in the hope that it will be useful, | ||
642 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
643 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
644 | 11 | * GNU General Public License for more details. | ||
645 | 12 | * | ||
646 | 13 | * You should have received a copy of the GNU General Public License | ||
647 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
648 | 15 | */ | ||
649 | 16 | |||
650 | 17 | import QtQuick 2.4 | ||
651 | 18 | import Ubuntu.Components 1.3 | ||
652 | 19 | import Ubuntu.Contacts 0.1 as ContactsUI | ||
653 | 20 | |||
654 | 21 | BottomEdge { | ||
655 | 22 | id: bottomEdge | ||
656 | 23 | objectName: "bottomEdge" | ||
657 | 24 | |||
658 | 25 | property var pageStack: null | ||
659 | 26 | property var _contactToEdit: null | ||
660 | 27 | property var _modelToEdit: null | ||
661 | 28 | |||
662 | 29 | function editContact(contact, model) | ||
663 | 30 | { | ||
664 | 31 | _contactToEdit = contact | ||
665 | 32 | _modelToEdit = model | ||
666 | 33 | commit() | ||
667 | 34 | } | ||
668 | 35 | |||
669 | 36 | hint { | ||
670 | 37 | action: Action { | ||
671 | 38 | iconName: "contact-new" | ||
672 | 39 | onTriggered: bottomEdge.commit() | ||
673 | 40 | shortcut: "ctrl+n" | ||
674 | 41 | enabled: bottomEdge.enabled | ||
675 | 42 | } | ||
676 | 43 | } | ||
677 | 44 | contentComponent: editorPageBottomEdge | ||
678 | 45 | onCommitCompleted: { | ||
679 | 46 | var editorPage = bottomEdge.contentItem | ||
680 | 47 | bottomEdge.pageStack.addPageToCurrentColumn(bottomEdge.parent, bottomEdge.contentItem) | ||
681 | 48 | editorPage.contact = bottomEdge._contactToEdit | ||
682 | 49 | editorPage.model = bottomEdge._modelToEdit | ||
683 | 50 | bottomEdge._contactToEdit = null | ||
684 | 51 | bottomEdge._modelToEdit = null | ||
685 | 52 | } | ||
686 | 53 | |||
687 | 54 | Component { | ||
688 | 55 | id: editorPageBottomEdge | ||
689 | 56 | |||
690 | 57 | ABContactEditorPage { | ||
691 | 58 | implicitWidth: mainPage.width | ||
692 | 59 | implicitHeight: bottomEdge.height | ||
693 | 60 | contact: ContactsUI.ContactsJS.createEmptyContact("", bottomEdge) | ||
694 | 61 | initialFocusSection: "name" | ||
695 | 62 | enabled: false | ||
696 | 63 | visible: bottomEdge.satus != BottomEdge.Hidden | ||
697 | 64 | onCanceled: bottomEdge.collapse() | ||
698 | 65 | } | ||
699 | 66 | } | ||
700 | 67 | } | ||
701 | 0 | 68 | ||
702 | === removed file 'src/imports/BottomEdge.qml' | |||
703 | --- src/imports/BottomEdge.qml 2015-11-19 01:02:12 +0000 | |||
704 | +++ src/imports/BottomEdge.qml 1970-01-01 00:00:00 +0000 | |||
705 | @@ -1,321 +0,0 @@ | |||
706 | 1 | /* | ||
707 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
708 | 3 | * | ||
709 | 4 | * This program is free software; you can redistribute it and/or modify | ||
710 | 5 | * it under the terms of the GNU General Public License as published by | ||
711 | 6 | * the Free Software Foundation; version 3. | ||
712 | 7 | * | ||
713 | 8 | * This program is distributed in the hope that it will be useful, | ||
714 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
715 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
716 | 11 | * GNU General Public License for more details. | ||
717 | 12 | * | ||
718 | 13 | * You should have received a copy of the GNU General Public License | ||
719 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
720 | 15 | */ | ||
721 | 16 | |||
722 | 17 | import QtQuick 2.4 | ||
723 | 18 | import Ubuntu.Components 1.3 | ||
724 | 19 | |||
725 | 20 | Item { | ||
726 | 21 | id: bottomEdge | ||
727 | 22 | |||
728 | 23 | readonly property alias content: bottomEdgeLoader.item | ||
729 | 24 | readonly property bool fullLoaded: bottomEdgeLoader.status == Loader.Ready | ||
730 | 25 | |||
731 | 26 | property bool opened: false | ||
732 | 27 | property Component contentComponent | ||
733 | 28 | property string iconName | ||
734 | 29 | property Item flickable | ||
735 | 30 | property alias backGroundEffectEnabled: darkBg.visible | ||
736 | 31 | |||
737 | 32 | signal openBegin | ||
738 | 33 | signal openEnd | ||
739 | 34 | signal clicked | ||
740 | 35 | visible: enabled | ||
741 | 36 | |||
742 | 37 | function open() { | ||
743 | 38 | bottomEdge.state = "expanded"; | ||
744 | 39 | } | ||
745 | 40 | |||
746 | 41 | function close() { | ||
747 | 42 | bottomEdge.state = "collapsed"; | ||
748 | 43 | } | ||
749 | 44 | |||
750 | 45 | Rectangle { | ||
751 | 46 | id: darkBg | ||
752 | 47 | |||
753 | 48 | anchors.fill: parent | ||
754 | 49 | color: "black" | ||
755 | 50 | opacity: 0.0 | ||
756 | 51 | } | ||
757 | 52 | |||
758 | 53 | Item { | ||
759 | 54 | id: bottomEdgeBody | ||
760 | 55 | anchors { | ||
761 | 56 | left: parent.left | ||
762 | 57 | right: parent.right | ||
763 | 58 | } | ||
764 | 59 | height: bottomEdgeContent.height | ||
765 | 60 | |||
766 | 61 | Item { | ||
767 | 62 | id: bottomEdgeContent | ||
768 | 63 | anchors { | ||
769 | 64 | left: parent.left | ||
770 | 65 | right: parent.right | ||
771 | 66 | } | ||
772 | 67 | height: bottomEdgeLoader.height | ||
773 | 68 | |||
774 | 69 | Item { | ||
775 | 70 | id: bottomEdgeShadows | ||
776 | 71 | anchors.fill: bottomEdgeContent | ||
777 | 72 | |||
778 | 73 | BottomEdgeShadow { | ||
779 | 74 | anchors.bottom: parent.top | ||
780 | 75 | } | ||
781 | 76 | |||
782 | 77 | BottomEdgeShadow { | ||
783 | 78 | anchors.top: parent.bottom | ||
784 | 79 | rotation: 180 | ||
785 | 80 | } | ||
786 | 81 | } | ||
787 | 82 | |||
788 | 83 | Rectangle { | ||
789 | 84 | anchors.fill: parent | ||
790 | 85 | color: Theme.palette.normal.background | ||
791 | 86 | } | ||
792 | 87 | |||
793 | 88 | Loader { | ||
794 | 89 | id: bottomEdgeLoader | ||
795 | 90 | sourceComponent: bottomEdge.contentComponent | ||
796 | 91 | asynchronous: true | ||
797 | 92 | active: bottomEdge.enabled | ||
798 | 93 | } | ||
799 | 94 | } | ||
800 | 95 | |||
801 | 96 | BottomEdgeHint { | ||
802 | 97 | id: bottomEdgeHint | ||
803 | 98 | |||
804 | 99 | anchors.bottom: bottomEdgeBody.top | ||
805 | 100 | iconName: bottomEdge.iconName | ||
806 | 101 | onClicked: bottomEdge.clicked() | ||
807 | 102 | |||
808 | 103 | Connections { | ||
809 | 104 | target: bottomEdgeDragArea | ||
810 | 105 | onClosedChanged: { | ||
811 | 106 | if (!bottomEdgeDragArea.closed) { | ||
812 | 107 | bottomEdgeHint.state = "Visible"; | ||
813 | 108 | } | ||
814 | 109 | } | ||
815 | 110 | } | ||
816 | 111 | |||
817 | 112 | Connections { | ||
818 | 113 | target: flickable | ||
819 | 114 | onVerticalVelocityChanged: { | ||
820 | 115 | if (!bottomEdgeDragArea.closed) { | ||
821 | 116 | return; | ||
822 | 117 | } | ||
823 | 118 | |||
824 | 119 | if (flickable.verticalVelocity > 0) { | ||
825 | 120 | bottomEdgeHint.state = "Hidden"; | ||
826 | 121 | } else if (flickable.verticalVelocity < 0) { | ||
827 | 122 | bottomEdgeHint.state = "Visible"; | ||
828 | 123 | } | ||
829 | 124 | } | ||
830 | 125 | } | ||
831 | 126 | } | ||
832 | 127 | } | ||
833 | 128 | |||
834 | 129 | |||
835 | 130 | state: "collapsed" | ||
836 | 131 | states: [ | ||
837 | 132 | State { | ||
838 | 133 | name: "collapsed" | ||
839 | 134 | ParentChange { | ||
840 | 135 | target: bottomEdgeContent | ||
841 | 136 | parent: bottomEdgeBody | ||
842 | 137 | x: 0 | ||
843 | 138 | y: 0 | ||
844 | 139 | } | ||
845 | 140 | PropertyChanges { | ||
846 | 141 | target: bottomEdgeBody | ||
847 | 142 | y: bottomEdgeDragArea.drag.maximumY | ||
848 | 143 | } | ||
849 | 144 | PropertyChanges { | ||
850 | 145 | target: bottomEdgeContent | ||
851 | 146 | opacity: 0.0 | ||
852 | 147 | } | ||
853 | 148 | PropertyChanges { | ||
854 | 149 | target: darkBg | ||
855 | 150 | opacity: 0.0 | ||
856 | 151 | } | ||
857 | 152 | }, | ||
858 | 153 | State { | ||
859 | 154 | name: "expanded" | ||
860 | 155 | ParentChange { | ||
861 | 156 | target: bottomEdgeContent | ||
862 | 157 | parent: bottomEdge | ||
863 | 158 | x: 0 | ||
864 | 159 | y: 0 | ||
865 | 160 | } | ||
866 | 161 | PropertyChanges { | ||
867 | 162 | target: bottomEdgeContent | ||
868 | 163 | opacity: 1.0 | ||
869 | 164 | } | ||
870 | 165 | PropertyChanges { | ||
871 | 166 | target: bottomEdgeBody | ||
872 | 167 | y: 0 | ||
873 | 168 | } | ||
874 | 169 | PropertyChanges { | ||
875 | 170 | target: bottomEdgeShadows | ||
876 | 171 | opacity: 0.0 | ||
877 | 172 | visible: true | ||
878 | 173 | } | ||
879 | 174 | PropertyChanges { | ||
880 | 175 | target: darkBg | ||
881 | 176 | opacity: 0.8 | ||
882 | 177 | } | ||
883 | 178 | }, | ||
884 | 179 | State { | ||
885 | 180 | name: "floating" | ||
886 | 181 | when: bottomEdgeDragArea.drag.active | ||
887 | 182 | PropertyChanges { | ||
888 | 183 | target: bottomEdgeContent | ||
889 | 184 | opacity: 1.0 | ||
890 | 185 | } | ||
891 | 186 | PropertyChanges { | ||
892 | 187 | target: darkBg | ||
893 | 188 | opacity: bottomEdgeBody.y > 0 ? 0.8 - (bottomEdgeBody.y / bottomEdgeDragArea.drag.maximumY) : 0.8 | ||
894 | 189 | } | ||
895 | 190 | } | ||
896 | 191 | ] | ||
897 | 192 | |||
898 | 193 | transitions: [ | ||
899 | 194 | Transition { | ||
900 | 195 | to: "collapsed" | ||
901 | 196 | SequentialAnimation { | ||
902 | 197 | alwaysRunToEnd: true | ||
903 | 198 | ParallelAnimation { | ||
904 | 199 | ParentAnimation { | ||
905 | 200 | UbuntuNumberAnimation { | ||
906 | 201 | properties: "x,y" | ||
907 | 202 | duration: UbuntuAnimation.SlowDuration | ||
908 | 203 | target: bottomEdgeContent | ||
909 | 204 | } | ||
910 | 205 | } | ||
911 | 206 | UbuntuNumberAnimation { | ||
912 | 207 | target: bottomEdgeBody | ||
913 | 208 | property: "y" | ||
914 | 209 | duration: UbuntuAnimation.SlowDuration | ||
915 | 210 | } | ||
916 | 211 | UbuntuNumberAnimation { | ||
917 | 212 | target: darkBg | ||
918 | 213 | property: "opacity" | ||
919 | 214 | duration: UbuntuAnimation.SlowDuration | ||
920 | 215 | } | ||
921 | 216 | } | ||
922 | 217 | PropertyAction { | ||
923 | 218 | target: bottomEdgeContent | ||
924 | 219 | property: "opacity" | ||
925 | 220 | } | ||
926 | 221 | ScriptAction { | ||
927 | 222 | script: { | ||
928 | 223 | bottomEdgeLoader.active = false | ||
929 | 224 | bottomEdgeLoader.active = true | ||
930 | 225 | bottomEdge.opened = false | ||
931 | 226 | } | ||
932 | 227 | } | ||
933 | 228 | } | ||
934 | 229 | }, | ||
935 | 230 | Transition { | ||
936 | 231 | to: "expanded" | ||
937 | 232 | SequentialAnimation { | ||
938 | 233 | alwaysRunToEnd: true | ||
939 | 234 | ParallelAnimation { | ||
940 | 235 | ScriptAction { | ||
941 | 236 | script: bottomEdge.openBegin() | ||
942 | 237 | } | ||
943 | 238 | ParentAnimation { | ||
944 | 239 | UbuntuNumberAnimation { | ||
945 | 240 | properties: "x,y" | ||
946 | 241 | duration: UbuntuAnimation.SlowDuration | ||
947 | 242 | target: bottomEdgeContent | ||
948 | 243 | } | ||
949 | 244 | } | ||
950 | 245 | UbuntuNumberAnimation { | ||
951 | 246 | target: bottomEdgeShadows | ||
952 | 247 | property: "opacity" | ||
953 | 248 | duration: UbuntuAnimation.SlowDuration | ||
954 | 249 | } | ||
955 | 250 | UbuntuNumberAnimation { | ||
956 | 251 | target: darkBg | ||
957 | 252 | property: "opacity" | ||
958 | 253 | duration: UbuntuAnimation.SlowDuration | ||
959 | 254 | } | ||
960 | 255 | } | ||
961 | 256 | UbuntuNumberAnimation { | ||
962 | 257 | target: bottomEdgeContent | ||
963 | 258 | property: "opacity" | ||
964 | 259 | duration: UbuntuAnimation.FastDuration | ||
965 | 260 | } | ||
966 | 261 | ScriptAction { | ||
967 | 262 | script: { | ||
968 | 263 | bottomEdge.opened = true | ||
969 | 264 | bottomEdge.openEnd() | ||
970 | 265 | } | ||
971 | 266 | |||
972 | 267 | } | ||
973 | 268 | } | ||
974 | 269 | } | ||
975 | 270 | ] | ||
976 | 271 | |||
977 | 272 | MouseArea { | ||
978 | 273 | id: bottomEdgeDragArea | ||
979 | 274 | objectName: "bottomEdgeDragArea" | ||
980 | 275 | |||
981 | 276 | property real previousY: -1 | ||
982 | 277 | property string dragDirection: "None" | ||
983 | 278 | property bool closed: drag.target.y == bottomEdgeDragArea.drag.maximumY | ||
984 | 279 | && !bottomEdgeDragArea.pressed | ||
985 | 280 | |||
986 | 281 | preventStealing: true | ||
987 | 282 | propagateComposedEvents: true | ||
988 | 283 | drag { | ||
989 | 284 | axis: Drag.YAxis | ||
990 | 285 | target: bottomEdgeBody | ||
991 | 286 | minimumY: 0 | ||
992 | 287 | maximumY: bottomEdge.height | ||
993 | 288 | } | ||
994 | 289 | |||
995 | 290 | anchors { | ||
996 | 291 | left: parent.left | ||
997 | 292 | right: parent.right | ||
998 | 293 | bottom: parent.bottom | ||
999 | 294 | } | ||
1000 | 295 | height: bottomEdgeHint.height | ||
1001 | 296 | |||
1002 | 297 | onPressed: { | ||
1003 | 298 | previousY = mouse.y; | ||
1004 | 299 | } | ||
1005 | 300 | |||
1006 | 301 | onReleased: { | ||
1007 | 302 | if (dragDirection === "BottomToTop") { | ||
1008 | 303 | bottomEdge.state = "expanded"; | ||
1009 | 304 | } else { | ||
1010 | 305 | bottomEdge.state = "collapsed"; | ||
1011 | 306 | } | ||
1012 | 307 | previousY = -1; | ||
1013 | 308 | dragDirection = "None"; | ||
1014 | 309 | } | ||
1015 | 310 | |||
1016 | 311 | onMouseYChanged: { | ||
1017 | 312 | var yOffset = previousY - mouseY; | ||
1018 | 313 | // skip if was a small move | ||
1019 | 314 | if (Math.abs(yOffset) <= units.gu(2)) { | ||
1020 | 315 | return; | ||
1021 | 316 | } | ||
1022 | 317 | previousY = mouseY; | ||
1023 | 318 | dragDirection = yOffset > 0 ? "BottomToTop" : "TopToBottom"; | ||
1024 | 319 | } | ||
1025 | 320 | } | ||
1026 | 321 | } | ||
1027 | 322 | 0 | ||
1028 | === removed file 'src/imports/BottomEdgeShadow.qml' | |||
1029 | --- src/imports/BottomEdgeShadow.qml 2015-09-10 14:47:38 +0000 | |||
1030 | +++ src/imports/BottomEdgeShadow.qml 1970-01-01 00:00:00 +0000 | |||
1031 | @@ -1,31 +0,0 @@ | |||
1032 | 1 | /* | ||
1033 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
1034 | 3 | * | ||
1035 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1036 | 5 | * it under the terms of the GNU General Public License as published by | ||
1037 | 6 | * the Free Software Foundation; version 3. | ||
1038 | 7 | * | ||
1039 | 8 | * This program is distributed in the hope that it will be useful, | ||
1040 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1041 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1042 | 11 | * GNU General Public License for more details. | ||
1043 | 12 | * | ||
1044 | 13 | * You should have received a copy of the GNU General Public License | ||
1045 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1046 | 15 | */ | ||
1047 | 16 | |||
1048 | 17 | import QtQuick 2.4 | ||
1049 | 18 | import Ubuntu.Components 1.3 | ||
1050 | 19 | |||
1051 | 20 | Rectangle { | ||
1052 | 21 | id: bottomEdgeShadow | ||
1053 | 22 | anchors { | ||
1054 | 23 | left: parent.left | ||
1055 | 24 | right: parent.right | ||
1056 | 25 | } | ||
1057 | 26 | height: units.gu(1) | ||
1058 | 27 | gradient: Gradient { | ||
1059 | 28 | GradientStop { position: 0.0; color: Qt.rgba(0.0, 0.0, 0.0, 0.0) } | ||
1060 | 29 | GradientStop { position: 1.0; color: Qt.rgba(0.0, 0.0, 0.0, 0.3) } | ||
1061 | 30 | } | ||
1062 | 31 | } | ||
1063 | 32 | 0 | ||
1064 | === modified file 'src/imports/CMakeLists.txt' | |||
1065 | --- src/imports/CMakeLists.txt 2015-11-19 14:41:18 +0000 | |||
1066 | +++ src/imports/CMakeLists.txt 2015-12-04 15:09:43 +0000 | |||
1067 | @@ -4,10 +4,9 @@ | |||
1068 | 4 | ABContactListPage.qml | 4 | ABContactListPage.qml |
1069 | 5 | ABContactEditorPage.qml | 5 | ABContactEditorPage.qml |
1070 | 6 | ABContactViewPage.qml | 6 | ABContactViewPage.qml |
1071 | 7 | ABNewContactBottomEdge.qml | ||
1072 | 7 | ContentHubProxy.qml | 8 | ContentHubProxy.qml |
1073 | 8 | MainWindow.qml | 9 | MainWindow.qml |
1074 | 9 | BottomEdgeShadow.qml | ||
1075 | 10 | BottomEdge.qml | ||
1076 | 11 | ) | 10 | ) |
1077 | 12 | 11 | ||
1078 | 13 | install(FILES ${ADDRESS_BOOK_APP_QMLS} | 12 | install(FILES ${ADDRESS_BOOK_APP_QMLS} |
1079 | 14 | 13 | ||
1080 | === modified file 'src/imports/MainWindow.qml' | |||
1081 | --- src/imports/MainWindow.qml 2015-10-26 13:18:11 +0000 | |||
1082 | +++ src/imports/MainWindow.qml 2015-12-04 15:09:43 +0000 | |||
1083 | @@ -101,18 +101,41 @@ | |||
1084 | 101 | width: units.gu(90) | 101 | width: units.gu(90) |
1085 | 102 | height: units.gu(71) | 102 | height: units.gu(71) |
1086 | 103 | anchorToKeyboard: false | 103 | anchorToKeyboard: false |
1087 | 104 | focus: false | ||
1088 | 104 | 105 | ||
1089 | 105 | AdaptivePageLayout { | 106 | AdaptivePageLayout { |
1090 | 106 | id: mainStack | 107 | id: mainStack |
1091 | 107 | 108 | ||
1092 | 108 | primaryPage: contactPage | ||
1093 | 109 | property var contactListPage: null | 109 | property var contactListPage: null |
1094 | 110 | property var bottomEdge: null | ||
1095 | 110 | 111 | ||
1096 | 111 | function resetStack() | 112 | function resetStack() |
1097 | 112 | { | 113 | { |
1098 | 113 | mainStack.removePages(primaryPage); | 114 | mainStack.removePages(primaryPage); |
1099 | 114 | } | 115 | } |
1100 | 115 | 116 | ||
1101 | 117 | function _nextItemInFocusChain(item, foward) | ||
1102 | 118 | { | ||
1103 | 119 | var next = item.nextItemInFocusChain(foward) | ||
1104 | 120 | var first = next | ||
1105 | 121 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
1106 | 122 | //because of that we need this | ||
1107 | 123 | while (!next || !next.hasOwnProperty("_allowFocus")) { | ||
1108 | 124 | next = next.nextItemInFocusChain(foward) | ||
1109 | 125 | |||
1110 | 126 | // avoid loop | ||
1111 | 127 | if (next === first) { | ||
1112 | 128 | next = null | ||
1113 | 129 | break | ||
1114 | 130 | } | ||
1115 | 131 | } | ||
1116 | 132 | if (next) { | ||
1117 | 133 | next.forceActiveFocus() | ||
1118 | 134 | } | ||
1119 | 135 | return next | ||
1120 | 136 | } | ||
1121 | 137 | |||
1122 | 138 | primaryPage: contactPage | ||
1123 | 116 | onContactListPageChanged: { | 139 | onContactListPageChanged: { |
1124 | 117 | if (contentHubLoader.status === Loader.Ready) { | 140 | if (contentHubLoader.status === Loader.Ready) { |
1125 | 118 | contentHubLoader.item.pageStack = mainStack | 141 | contentHubLoader.item.pageStack = mainStack |
1126 | @@ -141,6 +164,7 @@ | |||
1127 | 141 | } | 164 | } |
1128 | 142 | } | 165 | } |
1129 | 143 | ] | 166 | ] |
1130 | 167 | |||
1131 | 144 | } | 168 | } |
1132 | 145 | 169 | ||
1133 | 146 | ABContactListPage { | 170 | ABContactListPage { |
1134 | @@ -196,6 +220,10 @@ | |||
1135 | 196 | 220 | ||
1136 | 197 | // If application was called from uri handler and lost the focus reset the app to normal state | 221 | // If application was called from uri handler and lost the focus reset the app to normal state |
1137 | 198 | onAppActiveChanged: { | 222 | onAppActiveChanged: { |
1138 | 223 | if (appActive) { | ||
1139 | 224 | mainStack.forceActiveFocus() | ||
1140 | 225 | } | ||
1141 | 226 | |||
1142 | 199 | if (!appActive && mainStack.contactListPage) { | 227 | if (!appActive && mainStack.contactListPage) { |
1143 | 200 | mainStack.contactListPage.returnToNormalState() | 228 | mainStack.contactListPage.returnToNormalState() |
1144 | 201 | } | 229 | } |
1145 | 202 | 230 | ||
1146 | === modified file 'src/imports/Settings/SettingsPage.qml' | |||
1147 | --- src/imports/Settings/SettingsPage.qml 2015-10-26 13:18:11 +0000 | |||
1148 | +++ src/imports/Settings/SettingsPage.qml 2015-12-04 15:09:43 +0000 | |||
1149 | @@ -1,4 +1,4 @@ | |||
1151 | 1 | /* | 1 | /* |
1152 | 2 | * Copyright (C) 2015 Canonical, Ltd. | 2 | * Copyright (C) 2015 Canonical, Ltd. |
1153 | 3 | * | 3 | * |
1154 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
1155 | @@ -64,15 +64,56 @@ | |||
1156 | 64 | onCountChanged: numberFlickable.contentY = 0 | 64 | onCountChanged: numberFlickable.contentY = 0 |
1157 | 65 | } | 65 | } |
1158 | 66 | ListItem.Standard { | 66 | ListItem.Standard { |
1159 | 67 | id: addGoogleAccountItem | ||
1160 | 68 | |||
1161 | 69 | function activate() | ||
1162 | 70 | { | ||
1163 | 71 | onlineAccountsHelper.setupExec() | ||
1164 | 72 | } | ||
1165 | 73 | |||
1166 | 67 | text: i18n.tr("Add Google account") | 74 | text: i18n.tr("Add Google account") |
1167 | 68 | progression: true | 75 | progression: true |
1169 | 69 | onClicked: onlineAccountsHelper.setupExec() | 76 | |
1170 | 77 | onClicked: addGoogleAccountItem.activate() | ||
1171 | 78 | Keys.onRightPressed: addGoogleAccountItem.activate() | ||
1172 | 79 | Keys.onDownPressed: { | ||
1173 | 80 | if (importFromSimItem.enabled) { | ||
1174 | 81 | importFromSimItem.forceActiveFocus() | ||
1175 | 82 | } | ||
1176 | 83 | } | ||
1177 | 84 | |||
1178 | 85 | // selection visual feedback | ||
1179 | 86 | __foregroundColor: (activeFocus && (pageStack.columns > 1)) ? "white" : Theme.palette.normal.foreground | ||
1180 | 87 | Rectangle { | ||
1181 | 88 | color: UbuntuColors.orange | ||
1182 | 89 | anchors.fill: parent | ||
1183 | 90 | visible:addGoogleAccountItem.activeFocus | ||
1184 | 91 | z: -1 | ||
1185 | 92 | } | ||
1186 | 70 | } | 93 | } |
1187 | 71 | ListItem.Standard { | 94 | ListItem.Standard { |
1188 | 95 | id: importFromSimItem | ||
1189 | 96 | |||
1190 | 97 | function activate() | ||
1191 | 98 | { | ||
1192 | 99 | pageStack.addPageToCurrentColumn(root, simCardImportPageComponent) | ||
1193 | 100 | } | ||
1194 | 101 | |||
1195 | 72 | text: i18n.tr("Import from SIM") | 102 | text: i18n.tr("Import from SIM") |
1196 | 73 | progression: true | 103 | progression: true |
1197 | 74 | onClicked: pageStack.addPageToCurrentColumn(root, simCardImportPageComponent) | ||
1198 | 75 | enabled: (simList.sims.length > 0) && (simList.present.length > 0) | 104 | enabled: (simList.sims.length > 0) && (simList.present.length > 0) |
1199 | 105 | onClicked: importFromSimItem.activate() | ||
1200 | 106 | Keys.onRightPressed: importFromSimItem.activate() | ||
1201 | 107 | Keys.onUpPressed: addGoogleAccountItem.forceActiveFocus() | ||
1202 | 108 | |||
1203 | 109 | // selection visual feedback | ||
1204 | 110 | __foregroundColor: (activeFocus && (pageStack.columns > 1)) ? "white" : Theme.palette.normal.foreground | ||
1205 | 111 | Rectangle { | ||
1206 | 112 | color: UbuntuColors.orange | ||
1207 | 113 | anchors.fill: parent | ||
1208 | 114 | visible: importFromSimItem.activeFocus | ||
1209 | 115 | z: -1 | ||
1210 | 116 | } | ||
1211 | 76 | } | 117 | } |
1212 | 77 | } | 118 | } |
1213 | 78 | } | 119 | } |
1214 | @@ -89,4 +130,14 @@ | |||
1215 | 89 | sims: simList.sims | 130 | sims: simList.sims |
1216 | 90 | } | 131 | } |
1217 | 91 | } | 132 | } |
1218 | 133 | |||
1219 | 134 | Keys.onDownPressed: addGoogleAccountItem.forceActiveFocus() | ||
1220 | 135 | Keys.onRightPressed: addGoogleAccountItem.forceActiveFocus() | ||
1221 | 136 | Keys.onLeftPressed: pageStack.removePages(root) | ||
1222 | 137 | Keys.onEscapePressed: pageStack.removePages(root) | ||
1223 | 138 | onActiveChanged: { | ||
1224 | 139 | if (active) { | ||
1225 | 140 | root.forceActiveFocus() | ||
1226 | 141 | } | ||
1227 | 142 | } | ||
1228 | 92 | } | 143 | } |
1229 | 93 | 144 | ||
1230 | === modified file 'src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml' | |||
1231 | --- src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-10-26 13:18:11 +0000 | |||
1232 | +++ src/imports/Ubuntu/AddressBook/Base/ContactDetailBase.qml 2015-12-04 15:09:43 +0000 | |||
1233 | @@ -18,15 +18,19 @@ | |||
1234 | 18 | import QtContacts 5.0 as QtContacts | 18 | import QtContacts 5.0 as QtContacts |
1235 | 19 | import Ubuntu.Components.ListItems 1.3 as ListItem | 19 | import Ubuntu.Components.ListItems 1.3 as ListItem |
1236 | 20 | 20 | ||
1238 | 21 | ListItem.Empty { | 21 | FocusScope { |
1239 | 22 | id: root | 22 | id: root |
1240 | 23 | objectName: detail ? "base_" + detailToString(detail.type, -1) + "_" + index : "" | 23 | objectName: detail ? "base_" + detailToString(detail.type, -1) + "_" + index : "" |
1241 | 24 | 24 | ||
1242 | 25 | property variant action: null | ||
1243 | 25 | property QtObject contact: null | 26 | property QtObject contact: null |
1244 | 26 | property QtObject detail: null | 27 | property QtObject detail: null |
1245 | 27 | property variant fields: null | 28 | property variant fields: null |
1246 | 28 | // help to test used to retrieve the correct element | 29 | // help to test used to retrieve the correct element |
1247 | 29 | property int index: -1 | 30 | property int index: -1 |
1248 | 31 | property alias highlightOnFocus: highlight.visible | ||
1249 | 32 | |||
1250 | 33 | signal clicked() | ||
1251 | 30 | 34 | ||
1252 | 31 | function detailToString(detail, field) | 35 | function detailToString(detail, field) |
1253 | 32 | { | 36 | { |
1254 | @@ -98,13 +102,24 @@ | |||
1255 | 98 | } | 102 | } |
1256 | 99 | } | 103 | } |
1257 | 100 | 104 | ||
1258 | 101 | highlightWhenPressed: false | ||
1259 | 102 | showDivider: false | ||
1260 | 103 | |||
1261 | 104 | Rectangle { | 105 | Rectangle { |
1262 | 106 | id: highlight | ||
1263 | 107 | |||
1264 | 105 | anchors.fill: parent | 108 | anchors.fill: parent |
1265 | 106 | opacity: 0.1 | 109 | opacity: 0.1 |
1267 | 107 | visible: root.selected | 110 | visible: root.activeFocus |
1268 | 111 | color: "black" | ||
1269 | 108 | z: 100 | 112 | z: 100 |
1270 | 109 | } | 113 | } |
1271 | 114 | |||
1272 | 115 | MouseArea { | ||
1273 | 116 | anchors.fill: parent | ||
1274 | 117 | |||
1275 | 118 | onClicked: { | ||
1276 | 119 | if (action) { | ||
1277 | 120 | action.triggered(action) | ||
1278 | 121 | } | ||
1279 | 122 | root.clicked() | ||
1280 | 123 | } | ||
1281 | 124 | } | ||
1282 | 110 | } | 125 | } |
1283 | 111 | 126 | ||
1284 | === modified file 'src/imports/Ubuntu/AddressBook/Base/ContactDetailGroupBase.qml' | |||
1285 | --- src/imports/Ubuntu/AddressBook/Base/ContactDetailGroupBase.qml 2015-10-26 13:18:11 +0000 | |||
1286 | +++ src/imports/Ubuntu/AddressBook/Base/ContactDetailGroupBase.qml 2015-12-04 15:09:43 +0000 | |||
1287 | @@ -33,6 +33,7 @@ | |||
1288 | 33 | property int minimumHeight: 0 | 33 | property int minimumHeight: 0 |
1289 | 34 | property bool loaded: false | 34 | property bool loaded: false |
1290 | 35 | property bool showEmpty: true | 35 | property bool showEmpty: true |
1291 | 36 | property bool forceFocusOnFieldCreation: false | ||
1292 | 36 | 37 | ||
1293 | 37 | signal newFieldAdded(var index) | 38 | signal newFieldAdded(var index) |
1294 | 38 | 39 | ||
1295 | @@ -146,7 +147,7 @@ | |||
1296 | 146 | newFields.push(detailItem.item) | 147 | newFields.push(detailItem.item) |
1297 | 147 | root.newFieldAdded(detailItem.item) | 148 | root.newFieldAdded(detailItem.item) |
1298 | 148 | root.inputFields = newFields | 149 | root.inputFields = newFields |
1300 | 149 | if (root.loaded) { | 150 | if (root.loaded && root.forceFocusOnFieldCreation) { |
1301 | 150 | item.forceActiveFocus() | 151 | item.forceActiveFocus() |
1302 | 151 | } | 152 | } |
1303 | 152 | } | 153 | } |
1304 | 153 | 154 | ||
1305 | === modified file 'src/imports/Ubuntu/AddressBook/Base/RemoveContactsDialog.qml' | |||
1306 | --- src/imports/Ubuntu/AddressBook/Base/RemoveContactsDialog.qml 2015-10-26 13:18:11 +0000 | |||
1307 | +++ src/imports/Ubuntu/AddressBook/Base/RemoveContactsDialog.qml 2015-12-04 15:09:43 +0000 | |||
1308 | @@ -53,6 +53,7 @@ | |||
1309 | 53 | } | 53 | } |
1310 | 54 | 54 | ||
1311 | 55 | Button { | 55 | Button { |
1312 | 56 | id: acceptButton | ||
1313 | 56 | objectName: "removeContactsDialog.Yes" | 57 | objectName: "removeContactsDialog.Yes" |
1314 | 57 | anchors { | 58 | anchors { |
1315 | 58 | left: parent.left | 59 | left: parent.left |
1316 | @@ -61,10 +62,16 @@ | |||
1317 | 61 | } | 62 | } |
1318 | 62 | text: i18n.dtr("address-book-app", "Yes") | 63 | text: i18n.dtr("address-book-app", "Yes") |
1319 | 63 | color: UbuntuColors.green | 64 | color: UbuntuColors.green |
1321 | 64 | onClicked: accepted() | 65 | action: Action { |
1322 | 66 | shortcut: "return" | ||
1323 | 67 | onTriggered: { | ||
1324 | 68 | accepted() | ||
1325 | 69 | } | ||
1326 | 70 | } | ||
1327 | 65 | } | 71 | } |
1328 | 66 | 72 | ||
1329 | 67 | Button { | 73 | Button { |
1330 | 74 | id: cancelButton | ||
1331 | 68 | objectName: "removeContactsDialog.No" | 75 | objectName: "removeContactsDialog.No" |
1332 | 69 | anchors { | 76 | anchors { |
1333 | 70 | left: parent.left | 77 | left: parent.left |
1334 | @@ -73,6 +80,16 @@ | |||
1335 | 73 | } | 80 | } |
1336 | 74 | text: i18n.dtr("address-book-app", "No") | 81 | text: i18n.dtr("address-book-app", "No") |
1337 | 75 | color: UbuntuColors.red | 82 | color: UbuntuColors.red |
1339 | 76 | onClicked: canceled() | 83 | action: Action { |
1340 | 84 | shortcut: "esc" | ||
1341 | 85 | onTriggered: { | ||
1342 | 86 | canceled() | ||
1343 | 87 | } | ||
1344 | 88 | } | ||
1345 | 89 | } | ||
1346 | 90 | |||
1347 | 91 | Component.onDestruction: { | ||
1348 | 92 | cancelButton.action.shortcut = "" | ||
1349 | 93 | acceptButton.action.shortcut = "" | ||
1350 | 77 | } | 94 | } |
1351 | 78 | } | 95 | } |
1352 | 79 | 96 | ||
1353 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailAvatarEditor.qml' | |||
1354 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailAvatarEditor.qml 2015-10-29 18:11:08 +0000 | |||
1355 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailAvatarEditor.qml 2015-12-04 15:09:43 +0000 | |||
1356 | @@ -68,6 +68,7 @@ | |||
1357 | 68 | detail: contact ? contact.detail(ContactDetail.Avatar) : null | 68 | detail: contact ? contact.detail(ContactDetail.Avatar) : null |
1358 | 69 | implicitHeight: units.gu(8) | 69 | implicitHeight: units.gu(8) |
1359 | 70 | implicitWidth: units.gu(8) | 70 | implicitWidth: units.gu(8) |
1360 | 71 | highlightOnFocus: false | ||
1361 | 71 | 72 | ||
1362 | 72 | UbuntuShape { | 73 | UbuntuShape { |
1363 | 73 | id: avatar | 74 | id: avatar |
1364 | 74 | 75 | ||
1365 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailGroupWithTypeEditor.qml' | |||
1366 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailGroupWithTypeEditor.qml 2015-10-26 13:18:11 +0000 | |||
1367 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailGroupWithTypeEditor.qml 2015-12-04 15:09:43 +0000 | |||
1368 | @@ -98,29 +98,19 @@ | |||
1369 | 98 | return changed | 98 | return changed |
1370 | 99 | } | 99 | } |
1371 | 100 | 100 | ||
1373 | 101 | headerDelegate: Empty { | 101 | forceFocusOnFieldCreation: true |
1374 | 102 | headerDelegate: Label { | ||
1375 | 102 | id: header | 103 | id: header |
1397 | 103 | highlightWhenPressed: false | 104 | |
1398 | 104 | 105 | width: root.width - units.gu(4) | |
1399 | 105 | width: root.width | 106 | x: units.gu(2) |
1400 | 106 | height: units.gu(5) | 107 | height: units.gu(4) |
1401 | 107 | // disable listview mouse area | 108 | text: root.title |
1402 | 108 | __mouseArea.visible: false | 109 | // style |
1403 | 109 | divider.anchors.leftMargin: units.gu(2) | 110 | fontSize: "medium" |
1404 | 110 | divider.anchors.rightMargin: units.gu(2) | 111 | verticalAlignment: Text.AlignVCenter |
1405 | 111 | 112 | ThinDivider { | |
1406 | 112 | Label { | 113 | anchors.bottom: parent.bottom |
1386 | 113 | anchors { | ||
1387 | 114 | verticalCenter: parent.verticalCenter | ||
1388 | 115 | left: parent.left | ||
1389 | 116 | right: parent.right | ||
1390 | 117 | margins: units.gu(2) | ||
1391 | 118 | } | ||
1392 | 119 | |||
1393 | 120 | text: root.title | ||
1394 | 121 | |||
1395 | 122 | // style | ||
1396 | 123 | fontSize: "medium" | ||
1407 | 124 | } | 114 | } |
1408 | 125 | } | 115 | } |
1409 | 126 | 116 | ||
1410 | @@ -157,7 +147,6 @@ | |||
1411 | 157 | fields: root.fields | 147 | fields: root.fields |
1412 | 158 | height: implicitHeight | 148 | height: implicitHeight |
1413 | 159 | width: root.width | 149 | width: root.width |
1414 | 160 | selected: activeFocus | ||
1415 | 161 | 150 | ||
1416 | 162 | inputMethodHints: root.inputMethodHints | 151 | inputMethodHints: root.inputMethodHints |
1417 | 163 | onDetailChanged: updateCombo(false) | 152 | onDetailChanged: updateCombo(false) |
1418 | 164 | 153 | ||
1419 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailNameEditor.qml' | |||
1420 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailNameEditor.qml 2015-10-26 13:18:11 +0000 | |||
1421 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailNameEditor.qml 2015-12-04 15:09:43 +0000 | |||
1422 | @@ -55,6 +55,7 @@ | |||
1423 | 55 | spacing: units.gu(1) | 55 | spacing: units.gu(1) |
1424 | 56 | detail: root.contact ? root.contact.name : null | 56 | detail: root.contact ? root.contact.name : null |
1425 | 57 | fields: [ Name.FirstName, Name.LastName ] | 57 | fields: [ Name.FirstName, Name.LastName ] |
1426 | 58 | highlightOnFocus: false | ||
1427 | 58 | 59 | ||
1428 | 59 | fieldDelegate: TextInputDetail { | 60 | fieldDelegate: TextInputDetail { |
1429 | 60 | id: textInputDetail | 61 | id: textInputDetail |
1430 | 61 | 62 | ||
1431 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml' | |||
1432 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-10-26 13:18:11 +0000 | |||
1433 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailSyncTargetEditor.qml 2015-12-04 15:09:43 +0000 | |||
1434 | @@ -87,7 +87,8 @@ | |||
1435 | 87 | property real myHeight: sources.currentlyExpanded ? sources.containerHeight + units.gu(6) + label.height : sources.itemHeight + units.gu(6) + label.height | 87 | property real myHeight: sources.currentlyExpanded ? sources.containerHeight + units.gu(6) + label.height : sources.itemHeight + units.gu(6) + label.height |
1436 | 88 | 88 | ||
1437 | 89 | detail: root.contact ? contact.detail(ContactDetail.SyncTarget) : null | 89 | detail: root.contact ? contact.detail(ContactDetail.SyncTarget) : null |
1439 | 90 | implicitHeight: root.isNewContact && sources.model && (sources.model.count > 1) ? myHeight : 0 | 90 | height: root.isNewContact && sources.model && (sources.model.count > 1) ? myHeight : 0 |
1440 | 91 | visible: height > 0 | ||
1441 | 91 | 92 | ||
1442 | 92 | ContactModel { | 93 | ContactModel { |
1443 | 93 | id: sourceModel | 94 | id: sourceModel |
1444 | @@ -144,8 +145,12 @@ | |||
1445 | 144 | ThinDivider { | 145 | ThinDivider { |
1446 | 145 | id: divider | 146 | id: divider |
1447 | 146 | 147 | ||
1450 | 147 | anchors.top: label.bottom | 148 | anchors { |
1451 | 148 | } | 149 | top: label.bottom |
1452 | 150 | leftMargin: units.gu(2) | ||
1453 | 151 | rightMargin: units.gu(2) | ||
1454 | 152 | } | ||
1455 | 153 | } | ||
1456 | 149 | 154 | ||
1457 | 150 | OptionSelector { | 155 | OptionSelector { |
1458 | 151 | id: sources | 156 | id: sources |
1459 | 152 | 157 | ||
1460 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailWithTypeEditor.qml' | |||
1461 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailWithTypeEditor.qml 2015-10-26 13:18:11 +0000 | |||
1462 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactDetailWithTypeEditor.qml 2015-12-04 15:09:43 +0000 | |||
1463 | @@ -70,7 +70,6 @@ | |||
1464 | 70 | } | 70 | } |
1465 | 71 | 71 | ||
1466 | 72 | // disable listview mouse area | 72 | // disable listview mouse area |
1467 | 73 | __mouseArea.visible: false | ||
1468 | 74 | enabled: root.detail ? !root.detail.readOnly : false | 73 | enabled: root.detail ? !root.detail.readOnly : false |
1469 | 75 | implicitHeight: detailTypeSelector.height + fieldValues.height + units.gu(2) | 74 | implicitHeight: detailTypeSelector.height + fieldValues.height + units.gu(2) |
1470 | 76 | opacity: enabled ? 1.0 : 0.5 | 75 | opacity: enabled ? 1.0 : 0.5 |
1471 | 77 | 76 | ||
1472 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml' | |||
1473 | --- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-10-26 13:18:11 +0000 | |||
1474 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2015-12-04 15:09:43 +0000 | |||
1475 | @@ -31,7 +31,6 @@ | |||
1476 | 31 | property QtObject model: null | 31 | property QtObject model: null |
1477 | 32 | property QtObject activeItem: null | 32 | property QtObject activeItem: null |
1478 | 33 | 33 | ||
1479 | 34 | |||
1480 | 35 | property string initialFocusSection: "" | 34 | property string initialFocusSection: "" |
1481 | 36 | property var newDetails: [] | 35 | property var newDetails: [] |
1482 | 37 | 36 | ||
1483 | @@ -39,9 +38,7 @@ | |||
1484 | 39 | readonly property bool isContactValid: !avatarEditor.busy && (!nameEditor.isEmpty() || !phonesEditor.isEmpty()) | 38 | readonly property bool isContactValid: !avatarEditor.busy && (!nameEditor.isEmpty() || !phonesEditor.isEmpty()) |
1485 | 40 | 39 | ||
1486 | 41 | signal contactSaved(var contact); | 40 | signal contactSaved(var contact); |
1490 | 42 | 41 | signal canceled() | |
1488 | 43 | // priv | ||
1489 | 44 | property bool _edgeReady: false | ||
1491 | 45 | 42 | ||
1492 | 46 | function cancel() { | 43 | function cancel() { |
1493 | 47 | for (var i = 0; i < contactEditor.newDetails.length; ++i) { | 44 | for (var i = 0; i < contactEditor.newDetails.length; ++i) { |
1494 | @@ -60,6 +57,7 @@ | |||
1495 | 60 | } else { | 57 | } else { |
1496 | 61 | pageStack.pop() | 58 | pageStack.pop() |
1497 | 62 | } | 59 | } |
1498 | 60 | contactEditor.canceled() | ||
1499 | 63 | } | 61 | } |
1500 | 64 | 62 | ||
1501 | 65 | function save() { | 63 | function save() { |
1502 | @@ -105,7 +103,7 @@ | |||
1503 | 105 | } | 103 | } |
1504 | 106 | 104 | ||
1505 | 107 | function makeMeVisible(item) { | 105 | function makeMeVisible(item) { |
1507 | 108 | if (!_edgeReady || !item) { | 106 | if (!enabled || !item) { |
1508 | 109 | return | 107 | return |
1509 | 110 | } | 108 | } |
1510 | 111 | 109 | ||
1511 | @@ -133,8 +131,6 @@ | |||
1512 | 133 | function ready() | 131 | function ready() |
1513 | 134 | { | 132 | { |
1514 | 135 | enabled = true | 133 | enabled = true |
1515 | 136 | _edgeReady = true | ||
1516 | 137 | |||
1517 | 138 | switch (contactEditor.initialFocusSection) | 134 | switch (contactEditor.initialFocusSection) |
1518 | 139 | { | 135 | { |
1519 | 140 | case "phones": | 136 | case "phones": |
1520 | @@ -153,6 +149,7 @@ | |||
1521 | 153 | } | 149 | } |
1522 | 154 | 150 | ||
1523 | 155 | title: isNewContact ? i18n.dtr("address-book-app", "New contact") : i18n.dtr("address-book-app", "Edit") | 151 | title: isNewContact ? i18n.dtr("address-book-app", "New contact") : i18n.dtr("address-book-app", "Edit") |
1524 | 152 | enabled: false | ||
1525 | 156 | 153 | ||
1526 | 157 | Timer { | 154 | Timer { |
1527 | 158 | id: focusTimer | 155 | id: focusTimer |
1528 | @@ -181,7 +178,9 @@ | |||
1529 | 181 | contentWidth: parent.width | 178 | contentWidth: parent.width |
1530 | 182 | 179 | ||
1531 | 183 | //after add a new field we need to wait for the contentHeight to change to scroll to the correct position | 180 | //after add a new field we need to wait for the contentHeight to change to scroll to the correct position |
1533 | 184 | onContentHeightChanged: contactEditor.makeMeVisible(contactEditor.activeItem) | 181 | onContentHeightChanged: { |
1534 | 182 | contactEditor.makeMeVisible(contactEditor.activeItem) | ||
1535 | 183 | } | ||
1536 | 185 | 184 | ||
1537 | 186 | Column { | 185 | Column { |
1538 | 187 | id: contents | 186 | id: contents |
1539 | @@ -195,6 +194,7 @@ | |||
1540 | 195 | height: childrenRect.height | 194 | height: childrenRect.height |
1541 | 196 | 195 | ||
1542 | 197 | Row { | 196 | Row { |
1543 | 197 | id: editEditor | ||
1544 | 198 | function save() | 198 | function save() |
1545 | 199 | { | 199 | { |
1546 | 200 | var avatarSave = avatarEditor.save() | 200 | var avatarSave = avatarEditor.save() |
1547 | @@ -213,7 +213,7 @@ | |||
1548 | 213 | leftMargin: units.gu(2) | 213 | leftMargin: units.gu(2) |
1549 | 214 | right: parent.right | 214 | right: parent.right |
1550 | 215 | } | 215 | } |
1552 | 216 | height: Math.max(avatarEditor.height, nameEditor.height) - units.gu(4) | 216 | height: Math.max(avatarEditor.height, nameEditor.height) - units.gu(2) |
1553 | 217 | 217 | ||
1554 | 218 | ContactDetailAvatarEditor { | 218 | ContactDetailAvatarEditor { |
1555 | 219 | id: avatarEditor | 219 | id: avatarEditor |
1556 | @@ -221,6 +221,7 @@ | |||
1557 | 221 | contact: contactEditor.contact | 221 | contact: contactEditor.contact |
1558 | 222 | height: implicitHeight | 222 | height: implicitHeight |
1559 | 223 | width: implicitWidth | 223 | width: implicitWidth |
1560 | 224 | anchors.verticalCenter: editEditor.verticalCenter | ||
1561 | 224 | } | 225 | } |
1562 | 225 | 226 | ||
1563 | 226 | ContactDetailNameEditor { | 227 | ContactDetailNameEditor { |
1564 | @@ -232,6 +233,7 @@ | |||
1565 | 232 | } | 233 | } |
1566 | 233 | } | 234 | } |
1567 | 234 | 235 | ||
1568 | 236 | |||
1569 | 235 | ContactDetailPhoneNumbersEditor { | 237 | ContactDetailPhoneNumbersEditor { |
1570 | 236 | id: phonesEditor | 238 | id: phonesEditor |
1571 | 237 | objectName: "phones" | 239 | objectName: "phones" |
1572 | @@ -301,8 +303,6 @@ | |||
1573 | 301 | left: parent.left | 303 | left: parent.left |
1574 | 302 | right: parent.right | 304 | right: parent.right |
1575 | 303 | } | 305 | } |
1576 | 304 | height: implicitHeight | ||
1577 | 305 | |||
1578 | 306 | onChanged: { | 306 | onChanged: { |
1579 | 307 | if (contactEditor.enabled && | 307 | if (contactEditor.enabled && |
1580 | 308 | !contactEditor.isNewContact && | 308 | !contactEditor.isNewContact && |
1581 | @@ -383,9 +383,13 @@ | |||
1582 | 383 | right: parent.right | 383 | right: parent.right |
1583 | 384 | margins: units.gu(2) | 384 | margins: units.gu(2) |
1584 | 385 | } | 385 | } |
1588 | 386 | onClicked: { | 386 | action: Action { |
1589 | 387 | var dialog = PopupUtils.open(removeContactDialog, null) | 387 | enabled: contactEditor.active && deleteButton.visible |
1590 | 388 | dialog.contacts = [contactEditor.contact] | 388 | shortcut: "Ctrl+Delete" |
1591 | 389 | onTriggered: { | ||
1592 | 390 | var dialog = PopupUtils.open(removeContactDialog, null) | ||
1593 | 391 | dialog.contacts = [contactEditor.contact] | ||
1594 | 392 | } | ||
1595 | 389 | } | 393 | } |
1596 | 390 | } | 394 | } |
1597 | 391 | 395 | ||
1598 | @@ -410,8 +414,8 @@ | |||
1599 | 410 | } | 414 | } |
1600 | 411 | } | 415 | } |
1601 | 412 | 416 | ||
1604 | 413 | Component.onCompleted: { | 417 | onActiveChanged: { |
1605 | 414 | if (!enabled) { | 418 | if (!active) { |
1606 | 415 | return | 419 | return |
1607 | 416 | } | 420 | } |
1608 | 417 | 421 | ||
1609 | @@ -475,10 +479,14 @@ | |||
1610 | 475 | } | 479 | } |
1611 | 476 | 480 | ||
1612 | 477 | // hide virtual keyboard if necessary | 481 | // hide virtual keyboard if necessary |
1614 | 478 | Component.onCompleted: Qt.inputMethod.hide() | 482 | Component.onCompleted: { |
1615 | 483 | contactEditor.enabled = false | ||
1616 | 484 | Qt.inputMethod.hide() | ||
1617 | 485 | } | ||
1618 | 479 | 486 | ||
1619 | 480 | // WORKAROUND: SDK element crash if pop the page where the dialog was created | 487 | // WORKAROUND: SDK element crash if pop the page where the dialog was created |
1620 | 481 | Component.onDestruction: { | 488 | Component.onDestruction: { |
1621 | 489 | contactEditor.enabled = true | ||
1622 | 482 | if (popPages) { | 490 | if (popPages) { |
1623 | 483 | if (contactEditor.pageStack.removePages) { | 491 | if (contactEditor.pageStack.removePages) { |
1624 | 484 | contactEditor.pageStack.removePages(contactEditor) | 492 | contactEditor.pageStack.removePages(contactEditor) |
1625 | 485 | 493 | ||
1626 | === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml' | |||
1627 | --- src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2015-10-26 13:18:11 +0000 | |||
1628 | +++ src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2015-12-04 15:09:43 +0000 | |||
1629 | @@ -25,7 +25,11 @@ | |||
1630 | 25 | FocusScope { | 25 | FocusScope { |
1631 | 26 | id: root | 26 | id: root |
1632 | 27 | 27 | ||
1633 | 28 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
1634 | 29 | //because of that we need this | ||
1635 | 30 | readonly property bool _allowFocus: true | ||
1636 | 28 | readonly property bool isTextField: true | 31 | readonly property bool isTextField: true |
1637 | 32 | |||
1638 | 29 | property QtObject detail | 33 | property QtObject detail |
1639 | 30 | property int field: -1 | 34 | property int field: -1 |
1640 | 31 | property variant originalValue: root.detail && (root.field >= 0) ? root.detail.value(root.field) : null | 35 | property variant originalValue: root.detail && (root.field >= 0) ? root.detail.value(root.field) : null |
1641 | @@ -67,6 +71,22 @@ | |||
1642 | 67 | PhoneNumberField { | 71 | PhoneNumberField { |
1643 | 68 | id: field | 72 | id: field |
1644 | 69 | 73 | ||
1645 | 74 | //WORKAROUND: Due the SDK bug #1514822, #1514850 we can not disable focus for some items | ||
1646 | 75 | //because of that we keep the focus only for textFields. This will block the user | ||
1647 | 76 | //to use keyboard on "add-field" combo box and some other functionalities | ||
1648 | 77 | function forceActiveFocusForNextField(keyEvent) | ||
1649 | 78 | { | ||
1650 | 79 | var backward = (keyEvent.modifiers & Qt.ShiftModifier) | ||
1651 | 80 | var next = field.nextItemInFocusChain(!backward) | ||
1652 | 81 | // only focus on TextInputDetails | ||
1653 | 82 | while (!next || !next.hasOwnProperty("isTextField")) { | ||
1654 | 83 | next = next.nextItemInFocusChain(!backward) | ||
1655 | 84 | } | ||
1656 | 85 | if (next) { | ||
1657 | 86 | next.forceActiveFocus() | ||
1658 | 87 | } | ||
1659 | 88 | } | ||
1660 | 89 | |||
1661 | 70 | anchors.fill: parent | 90 | anchors.fill: parent |
1662 | 71 | defaultRegion: PhoneUtils.defaultRegion | 91 | defaultRegion: PhoneUtils.defaultRegion |
1663 | 72 | autoFormat: false | 92 | autoFormat: false |
1664 | @@ -93,15 +113,9 @@ | |||
1665 | 93 | family: "Ubuntu" | 113 | family: "Ubuntu" |
1666 | 94 | pixelSize: activeFocus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium") | 114 | pixelSize: activeFocus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium") |
1667 | 95 | } | 115 | } |
1678 | 96 | Keys.onReturnPressed: { | 116 | |
1679 | 97 | var next = field.nextItemInFocusChain(true) | 117 | Keys.onReturnPressed: forceActiveFocusForNextField(event) |
1680 | 98 | // only focus on TextInputDetails | 118 | Keys.onTabPressed: forceActiveFocusForNextField(event) |
1681 | 99 | while (!next || !next.hasOwnProperty("isTextField")) { | 119 | Keys.onBacktabPressed: forceActiveFocusForNextField(event) |
1672 | 100 | next = next.nextItemInFocusChain(true) | ||
1673 | 101 | } | ||
1674 | 102 | if (next) { | ||
1675 | 103 | next.forceActiveFocus() | ||
1676 | 104 | } | ||
1677 | 105 | } | ||
1682 | 106 | } | 120 | } |
1683 | 107 | } | 121 | } |
1684 | 108 | 122 | ||
1685 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ActionButton.qml' | |||
1686 | --- src/imports/Ubuntu/AddressBook/ContactView/ActionButton.qml 2015-10-26 13:18:11 +0000 | |||
1687 | +++ src/imports/Ubuntu/AddressBook/ContactView/ActionButton.qml 2015-12-04 15:09:43 +0000 | |||
1688 | @@ -30,5 +30,6 @@ | |||
1689 | 30 | anchors.centerIn: parent | 30 | anchors.centerIn: parent |
1690 | 31 | height: root.iconSize | 31 | height: root.iconSize |
1691 | 32 | width: root.iconSize | 32 | width: root.iconSize |
1692 | 33 | color: root.activeFocus ? UbuntuColors.orange : "gray" | ||
1693 | 33 | } | 34 | } |
1694 | 34 | } | 35 | } |
1695 | 35 | 36 | ||
1696 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml' | |||
1697 | --- src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2015-10-26 13:18:11 +0000 | |||
1698 | +++ src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2015-12-04 15:09:43 +0000 | |||
1699 | @@ -27,6 +27,8 @@ | |||
1700 | 27 | property variant fields: null | 27 | property variant fields: null |
1701 | 28 | property int parentIndex: -1 | 28 | property int parentIndex: -1 |
1702 | 29 | 29 | ||
1703 | 30 | focus: false | ||
1704 | 31 | activeFocusOnTab: false | ||
1705 | 30 | implicitHeight: typeLabel.height + fieldValues.height + units.gu(2) | 32 | implicitHeight: typeLabel.height + fieldValues.height + units.gu(2) |
1706 | 31 | 33 | ||
1707 | 32 | Column { | 34 | Column { |
1708 | 33 | 35 | ||
1709 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailAvatarView.qml' | |||
1710 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailAvatarView.qml 2015-11-16 20:12:41 +0000 | |||
1711 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailAvatarView.qml 2015-12-04 15:09:43 +0000 | |||
1712 | @@ -29,6 +29,8 @@ | |||
1713 | 29 | 29 | ||
1714 | 30 | implicitHeight: units.gu(12) | 30 | implicitHeight: units.gu(12) |
1715 | 31 | implicitWidth: parent.width | 31 | implicitWidth: parent.width |
1716 | 32 | activeFocusOnTab: false | ||
1717 | 33 | focus: false | ||
1718 | 32 | 34 | ||
1719 | 33 | Connections { | 35 | Connections { |
1720 | 34 | id: connections | 36 | id: connections |
1721 | 35 | 37 | ||
1722 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml' | |||
1723 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-10-26 13:18:11 +0000 | |||
1724 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailGroupWithTypeView.qml 2015-12-04 15:09:43 +0000 | |||
1725 | @@ -18,8 +18,7 @@ | |||
1726 | 18 | import QtContacts 5.0 as QtContacts | 18 | import QtContacts 5.0 as QtContacts |
1727 | 19 | 19 | ||
1728 | 20 | import Ubuntu.Components 1.3 | 20 | import Ubuntu.Components 1.3 |
1731 | 21 | import Ubuntu.Components.ListItems 1.3 as ListItem | 21 | import Ubuntu.Components.ListItems 1.3 |
1730 | 22 | |||
1732 | 23 | import Ubuntu.AddressBook.Base 0.1 | 22 | import Ubuntu.AddressBook.Base 0.1 |
1733 | 24 | 23 | ||
1734 | 25 | ContactDetailGroupWithTypeBase { | 24 | ContactDetailGroupWithTypeBase { |
1735 | @@ -29,25 +28,18 @@ | |||
1736 | 29 | signal actionTrigerred(string actionName, QtObject detail) | 28 | signal actionTrigerred(string actionName, QtObject detail) |
1737 | 30 | 29 | ||
1738 | 31 | showEmpty: false | 30 | showEmpty: false |
1758 | 32 | headerDelegate: ListItem.Empty { | 31 | headerDelegate: Label { |
1759 | 33 | highlightWhenPressed: false | 32 | id: header |
1760 | 34 | 33 | ||
1761 | 35 | divider.anchors.leftMargin: units.gu(2) | 34 | width: root.width - units.gu(4) |
1762 | 36 | divider.anchors.rightMargin: units.gu(2) | 35 | x: units.gu(2) |
1763 | 37 | width: root.width | 36 | height: units.gu(4) |
1764 | 38 | height: units.gu(5) | 37 | text: root.title |
1765 | 39 | Label { | 38 | // style |
1766 | 40 | anchors { | 39 | fontSize: "medium" |
1767 | 41 | verticalCenter: parent.verticalCenter | 40 | verticalAlignment: Text.AlignVCenter |
1768 | 42 | left: parent.left | 41 | ThinDivider { |
1769 | 43 | right: parent.right | 42 | anchors.bottom: parent.bottom |
1751 | 44 | margins: units.gu(2) | ||
1752 | 45 | } | ||
1753 | 46 | |||
1754 | 47 | text: root.title | ||
1755 | 48 | |||
1756 | 49 | // style | ||
1757 | 50 | fontSize: "medium" | ||
1770 | 51 | } | 43 | } |
1771 | 52 | } | 44 | } |
1772 | 53 | 45 | ||
1773 | 54 | 46 | ||
1774 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailNameView.qml' | |||
1775 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailNameView.qml 2015-10-26 13:18:11 +0000 | |||
1776 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailNameView.qml 2015-12-04 15:09:43 +0000 | |||
1777 | @@ -25,7 +25,8 @@ | |||
1778 | 25 | 25 | ||
1779 | 26 | detail: root.contact ? root.contact.name : null | 26 | detail: root.contact ? root.contact.name : null |
1780 | 27 | implicitHeight: label.paintedHeight + (label.anchors.margins * 2) | 27 | implicitHeight: label.paintedHeight + (label.anchors.margins * 2) |
1782 | 28 | 28 | activeFocusOnTab: false | |
1783 | 29 | focus: false | ||
1784 | 29 | 30 | ||
1785 | 30 | Label { | 31 | Label { |
1786 | 31 | id: label | 32 | id: label |
1787 | 32 | 33 | ||
1788 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml' | |||
1789 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml 2015-10-26 13:18:11 +0000 | |||
1790 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailSyncTargetView.qml 2015-12-04 15:09:43 +0000 | |||
1791 | @@ -50,6 +50,7 @@ | |||
1792 | 50 | defaultIcon: "image://theme/contact-group" | 50 | defaultIcon: "image://theme/contact-group" |
1793 | 51 | detailType: ContactDetail.SyncTarget | 51 | detailType: ContactDetail.SyncTarget |
1794 | 52 | typeModel: null | 52 | typeModel: null |
1795 | 53 | activeFocusOnTab: false | ||
1796 | 53 | 54 | ||
1797 | 54 | fields: [ SyncTarget.SyncTarget ] | 55 | fields: [ SyncTarget.SyncTarget ] |
1798 | 55 | 56 | ||
1799 | @@ -76,7 +77,7 @@ | |||
1800 | 76 | 77 | ||
1801 | 77 | height: implicitHeight | 78 | height: implicitHeight |
1802 | 78 | width: root.width | 79 | width: root.width |
1804 | 79 | 80 | activeFocusOnTab: false | |
1805 | 80 | onClicked: root.actionTrigerred(root.defaultAction.name, detail) | 81 | onClicked: root.actionTrigerred(root.defaultAction.name, detail) |
1806 | 81 | 82 | ||
1807 | 82 | function overrideValue(detail, field) | 83 | function overrideValue(detail, field) |
1808 | 83 | 84 | ||
1809 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml' | |||
1810 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-10-26 13:18:11 +0000 | |||
1811 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactDetailWithTypeView.qml 2015-12-04 15:09:43 +0000 | |||
1812 | @@ -43,6 +43,8 @@ | |||
1813 | 43 | return detail.value(field) | 43 | return detail.value(field) |
1814 | 44 | } | 44 | } |
1815 | 45 | 45 | ||
1816 | 46 | activeFocusOnTab: icon.visible | ||
1817 | 47 | focus: false | ||
1818 | 46 | implicitHeight: view.implicitHeight | 48 | implicitHeight: view.implicitHeight |
1819 | 47 | onIsReadyChanged: populateValues() | 49 | onIsReadyChanged: populateValues() |
1820 | 48 | 50 | ||
1821 | @@ -78,5 +80,7 @@ | |||
1822 | 78 | width: root.action && (root.action.iconName !== "") ? units.gu(2.5) : 0 | 80 | width: root.action && (root.action.iconName !== "") ? units.gu(2.5) : 0 |
1823 | 79 | height: width | 81 | height: width |
1824 | 80 | name: root.action ? root.action.iconName : "" | 82 | name: root.action ? root.action.iconName : "" |
1825 | 83 | color: root.activeFocus ? UbuntuColors.orange : "gray" | ||
1826 | 84 | visible: width > 0 | ||
1827 | 81 | } | 85 | } |
1828 | 82 | } | 86 | } |
1829 | 83 | 87 | ||
1830 | === modified file 'src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml' | |||
1831 | --- src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-11-16 15:44:43 +0000 | |||
1832 | +++ src/imports/Ubuntu/AddressBook/ContactView/ContactViewPage.qml 2015-12-04 15:09:43 +0000 | |||
1833 | @@ -41,6 +41,7 @@ | |||
1834 | 41 | } | 41 | } |
1835 | 42 | } | 42 | } |
1836 | 43 | 43 | ||
1837 | 44 | focus: false | ||
1838 | 44 | title: contact ? ContactsJS.formatToDisplay(contact, i18n.dtr("address-book-app", "No name")) : "" | 45 | title: contact ? ContactsJS.formatToDisplay(contact, i18n.dtr("address-book-app", "No name")) : "" |
1839 | 45 | 46 | ||
1840 | 46 | Connections { | 47 | Connections { |
1841 | 47 | 48 | ||
1842 | === modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml' | |||
1843 | --- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2015-10-26 13:18:11 +0000 | |||
1844 | +++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2015-12-04 15:09:43 +0000 | |||
1845 | @@ -32,6 +32,7 @@ | |||
1846 | 32 | signal clicked(int index, QtObject contact) | 32 | signal clicked(int index, QtObject contact) |
1847 | 33 | signal pressAndHold(int index, QtObject contact) | 33 | signal pressAndHold(int index, QtObject contact) |
1848 | 34 | 34 | ||
1849 | 35 | focus: false | ||
1850 | 35 | implicitHeight: defaultHeight | 36 | implicitHeight: defaultHeight |
1851 | 36 | width: parent ? parent.width : 0 | 37 | width: parent ? parent.width : 0 |
1852 | 37 | 38 | ||
1853 | 38 | 39 | ||
1854 | === modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml' | |||
1855 | --- src/imports/Ubuntu/Contacts/ContactListView.qml 2015-11-16 22:12:29 +0000 | |||
1856 | +++ src/imports/Ubuntu/Contacts/ContactListView.qml 2015-12-04 15:09:43 +0000 | |||
1857 | @@ -42,7 +42,7 @@ | |||
1858 | 42 | } | 42 | } |
1859 | 43 | \endqml | 43 | \endqml |
1860 | 44 | */ | 44 | */ |
1862 | 45 | Item { | 45 | FocusScope { |
1863 | 46 | id: root | 46 | id: root |
1864 | 47 | 47 | ||
1865 | 48 | readonly property alias view: view | 48 | readonly property alias view: view |
1866 | @@ -202,12 +202,6 @@ | |||
1867 | 202 | */ | 202 | */ |
1868 | 203 | property bool showAddNewButton: false | 203 | property bool showAddNewButton: false |
1869 | 204 | /*! | 204 | /*! |
1870 | 205 | \qmlproperty bool prepareNewContact | ||
1871 | 206 | |||
1872 | 207 | This property holds if space for a draft new contact should be made available or not | ||
1873 | 208 | */ | ||
1874 | 209 | property bool prepareNewContact: false | ||
1875 | 210 | /*! | ||
1876 | 211 | \qmlproperty bool showNewContact | 205 | \qmlproperty bool showNewContact |
1877 | 212 | 206 | ||
1878 | 213 | This property holds if a draft new contact should be visible or not | 207 | This property holds if a draft new contact should be visible or not |
1879 | @@ -253,6 +247,10 @@ | |||
1880 | 253 | 247 | ||
1881 | 254 | property var _busyDialog: null | 248 | property var _busyDialog: null |
1882 | 255 | 249 | ||
1883 | 250 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
1884 | 251 | //because of that we need this | ||
1885 | 252 | property bool _allowFocus: true | ||
1886 | 253 | |||
1887 | 256 | /*! | 254 | /*! |
1888 | 257 | This handler is called when the selection mode is finished without be canceled | 255 | This handler is called when the selection mode is finished without be canceled |
1889 | 258 | */ | 256 | */ |
1890 | @@ -372,6 +370,8 @@ | |||
1891 | 372 | buteoSync.startSyncByCategory("contacts") | 370 | buteoSync.startSyncByCategory("contacts") |
1892 | 373 | } | 371 | } |
1893 | 374 | 372 | ||
1894 | 373 | focus: true | ||
1895 | 374 | |||
1896 | 375 | ContactSimpleListView { | 375 | ContactSimpleListView { |
1897 | 376 | id: view | 376 | id: view |
1898 | 377 | 377 | ||
1899 | @@ -401,6 +401,7 @@ | |||
1900 | 401 | } | 401 | } |
1901 | 402 | anchors.fill: parent | 402 | anchors.fill: parent |
1902 | 403 | 403 | ||
1903 | 404 | |||
1904 | 404 | // WORKAROUND: The SDK header causes the contactY to move to a wrong postion | 405 | // WORKAROUND: The SDK header causes the contactY to move to a wrong postion |
1905 | 405 | // calling the positionViewAtBeginning after the list created fix that | 406 | // calling the positionViewAtBeginning after the list created fix that |
1906 | 406 | Timer { | 407 | Timer { |
1907 | @@ -418,15 +419,18 @@ | |||
1908 | 418 | right: parent.right | 419 | right: parent.right |
1909 | 419 | } | 420 | } |
1910 | 420 | 421 | ||
1920 | 421 | Connections { | 422 | Binding { |
1921 | 422 | target: root | 423 | target: view |
1922 | 423 | onPrepareNewContactChanged: { | 424 | property: 'contentY' |
1923 | 424 | if (root.prepareNewContact) { | 425 | value: -view.headerItem.height |
1924 | 425 | view.contentY = Qt.binding(function() {return -view.headerItem.height}); | 426 | when: root.showNewContact |
1925 | 426 | } else { | 427 | } |
1926 | 427 | view.contentY = view.contentY; | 428 | |
1927 | 428 | } | 429 | Binding { |
1928 | 429 | } | 430 | target: view |
1929 | 431 | property: 'currentIndex' | ||
1930 | 432 | value: -1 | ||
1931 | 433 | when: root.showNewContact | ||
1932 | 430 | } | 434 | } |
1933 | 431 | 435 | ||
1934 | 432 | // AddNewButton | 436 | // AddNewButton |
1935 | @@ -455,10 +459,9 @@ | |||
1936 | 455 | } | 459 | } |
1937 | 456 | } | 460 | } |
1938 | 457 | selected: true | 461 | selected: true |
1941 | 458 | visible: root.prepareNewContact | 462 | visible: root.showNewContact |
1942 | 459 | height: root.prepareNewContact ? defaultHeight : 0 | 463 | height: root.showNewContact ? defaultHeight : 0 |
1943 | 460 | Behavior on height {UbuntuNumberAnimation {}} | 464 | Behavior on height {UbuntuNumberAnimation {}} |
1944 | 461 | opacity: root.showNewContact ? 1.0 : 0.0 | ||
1945 | 462 | } | 465 | } |
1946 | 463 | 466 | ||
1947 | 464 | Column { | 467 | Column { |
1948 | @@ -624,4 +627,23 @@ | |||
1949 | 624 | !view.favouritesIsSelected && | 627 | !view.favouritesIsSelected && |
1950 | 625 | !isSearching ? sourceFile : "" | 628 | !isSearching ? sourceFile : "" |
1951 | 626 | } | 629 | } |
1952 | 630 | |||
1953 | 631 | Keys.onUpPressed: { | ||
1954 | 632 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
1955 | 633 | //because of that we need this | ||
1956 | 634 | if (view.currentIndex == 0) { | ||
1957 | 635 | pageStack._nextItemInFocusChain(view, false) | ||
1958 | 636 | } else { | ||
1959 | 637 | view.currentIndex -= 1 | ||
1960 | 638 | } | ||
1961 | 639 | } | ||
1962 | 640 | Keys.onDownPressed: { | ||
1963 | 641 | //WORKAROUND: SDK does not allow us to disable focus for items due bug: #1514822 | ||
1964 | 642 | //because of that we need this | ||
1965 | 643 | if (view.currentIndex == (view.count - 1)) { | ||
1966 | 644 | //DO nothing | ||
1967 | 645 | } else { | ||
1968 | 646 | view.currentIndex += 1 | ||
1969 | 647 | } | ||
1970 | 648 | } | ||
1971 | 627 | } | 649 | } |
1972 | 628 | 650 | ||
1973 | === modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml' | |||
1974 | --- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-11-16 22:12:29 +0000 | |||
1975 | +++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-12-04 15:09:43 +0000 | |||
1976 | @@ -204,7 +204,8 @@ | |||
1977 | 204 | */ | 204 | */ |
1978 | 205 | function positionViewAtContact(contact) | 205 | function positionViewAtContact(contact) |
1979 | 206 | { | 206 | { |
1981 | 207 | positionViewAtIndex(getIndex(contact), ListView.Center) | 207 | currentIndex = getIndex(contact) |
1982 | 208 | positionViewAtIndex(currentIndex, ListView.Center) | ||
1983 | 208 | } | 209 | } |
1984 | 209 | 210 | ||
1985 | 210 | /*! | 211 | /*! |
1986 | @@ -213,7 +214,9 @@ | |||
1987 | 213 | */ | 214 | */ |
1988 | 214 | function _fetchContact(index, contact) | 215 | function _fetchContact(index, contact) |
1989 | 215 | { | 216 | { |
1991 | 216 | contactFetch.fetchContact(contact.contactId) | 217 | if (contact) { |
1992 | 218 | contactFetch.fetchContact(contact.contactId) | ||
1993 | 219 | } | ||
1994 | 217 | } | 220 | } |
1995 | 218 | 221 | ||
1996 | 219 | function _updateSwipeState(item) | 222 | function _updateSwipeState(item) |
1997 | @@ -235,7 +238,6 @@ | |||
1998 | 235 | } | 238 | } |
1999 | 236 | 239 | ||
2000 | 237 | highlightFollowsCurrentItem: true | 240 | highlightFollowsCurrentItem: true |
2001 | 238 | currentIndex: -1 | ||
2002 | 239 | section { | 241 | section { |
2003 | 240 | property: showSections ? "contact.tag.tag" : "" | 242 | property: showSections ? "contact.tag.tag" : "" |
2004 | 241 | criteria: ViewSection.FirstCharacter | 243 | criteria: ViewSection.FirstCharacter |
2005 | @@ -255,7 +257,6 @@ | |||
2006 | 255 | dirtyModel.restart() | 257 | dirtyModel.restart() |
2007 | 256 | } | 258 | } |
2008 | 257 | 259 | ||
2009 | 258 | onFlickStarted: view.currentIndex = -1 | ||
2010 | 259 | listDelegate: ContactDelegate { | 260 | listDelegate: ContactDelegate { |
2011 | 260 | id: contactDelegate | 261 | id: contactDelegate |
2012 | 261 | 262 | ||
2013 | @@ -270,6 +271,7 @@ | |||
2014 | 270 | width: parent.width | 271 | width: parent.width |
2015 | 271 | selected: (contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate)) | 272 | selected: (contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate)) |
2016 | 272 | || (contactListView.highlightSelected && (contactListView.currentIndex == index)) | 273 | || (contactListView.highlightSelected && (contactListView.currentIndex == index)) |
2017 | 274 | selectedColor: contactListView.parent.activeFocus && !contactListView.isInSelectionMode ? UbuntuColors.orange : "#E6E6E6" | ||
2018 | 273 | selectionMode: contactListView.isInSelectionMode | 275 | selectionMode: contactListView.isInSelectionMode |
2019 | 274 | defaultAvatarUrl: contactListView.defaultAvatarImageUrl | 276 | defaultAvatarUrl: contactListView.defaultAvatarImageUrl |
2020 | 275 | isCurrentItem: ListView.isCurrentItem | 277 | isCurrentItem: ListView.isCurrentItem |
2021 | @@ -371,13 +373,4 @@ | |||
2022 | 371 | property int pendingTargetIndex: 0 | 373 | property int pendingTargetIndex: 0 |
2023 | 372 | property variant pendingTargetMode: null | 374 | property variant pendingTargetMode: null |
2024 | 373 | } | 375 | } |
2025 | 374 | |||
2026 | 375 | Connections { | ||
2027 | 376 | target: Qt.application | ||
2028 | 377 | onActiveChanged: { | ||
2029 | 378 | if (!Qt.application.active) { | ||
2030 | 379 | currentIndex = -1 | ||
2031 | 380 | } | ||
2032 | 381 | } | ||
2033 | 382 | } | ||
2034 | 383 | } | 376 | } |
2035 | 384 | 377 | ||
2036 | === modified file 'src/imports/Ubuntu/Contacts/FastScroll.qml' | |||
2037 | --- src/imports/Ubuntu/Contacts/FastScroll.qml 2015-10-26 13:18:11 +0000 | |||
2038 | +++ src/imports/Ubuntu/Contacts/FastScroll.qml 2015-12-04 15:09:43 +0000 | |||
2039 | @@ -71,19 +71,11 @@ | |||
2040 | 71 | } | 71 | } |
2041 | 72 | } | 72 | } |
2042 | 73 | 73 | ||
2043 | 74 | Connections { | ||
2044 | 75 | target: listView | ||
2045 | 76 | onCurrentIndexChanged: { | ||
2046 | 77 | if (currentIndex != -1) { | ||
2047 | 78 | rail.opacity = 0.0 | ||
2048 | 79 | } | ||
2049 | 80 | } | ||
2050 | 81 | } | ||
2051 | 82 | 74 | ||
2052 | 83 | Rectangle { | 75 | Rectangle { |
2053 | 84 | id: magnified | 76 | id: magnified |
2054 | 85 | 77 | ||
2056 | 86 | color: Theme.palette.normal.overlay | 78 | color: Theme.palette.normal.foreground |
2057 | 87 | radius: height * 0.3 | 79 | radius: height * 0.3 |
2058 | 88 | height: pinSize * 2 | 80 | height: pinSize * 2 |
2059 | 89 | width: height | 81 | width: height |
2060 | @@ -99,6 +91,7 @@ | |||
2061 | 99 | } | 91 | } |
2062 | 100 | 92 | ||
2063 | 101 | Label { | 93 | Label { |
2064 | 94 | color: "white" | ||
2065 | 102 | anchors.fill: parent | 95 | anchors.fill: parent |
2066 | 103 | horizontalAlignment: Text.AlignHCenter | 96 | horizontalAlignment: Text.AlignHCenter |
2067 | 104 | verticalAlignment: Text.AlignVCenter | 97 | verticalAlignment: Text.AlignVCenter |
2068 | @@ -141,8 +134,7 @@ | |||
2069 | 141 | id: rail | 134 | id: rail |
2070 | 142 | 135 | ||
2071 | 143 | property bool isVisible: root.enabled && | 136 | property bool isVisible: root.enabled && |
2074 | 144 | (listView.flicking || dragArea.pressed) && | 137 | (listView.flicking || dragArea.pressed) |
2073 | 145 | (listView.currentIndex == -1) | ||
2075 | 146 | anchors { | 138 | anchors { |
2076 | 147 | right: parent.right | 139 | right: parent.right |
2077 | 148 | rightMargin: units.gu(2) | 140 | rightMargin: units.gu(2) |