Merge lp:~mzanetti/reminders-app/improve-edit-focus into lp:reminders-app
- improve-edit-focus
- Merge into trunk
Proposed by
Michael Zanetti
Status: | Merged |
---|---|
Approved by: | Riccardo Padovani |
Approved revision: | 486 |
Merged at revision: | 488 |
Proposed branch: | lp:~mzanetti/reminders-app/improve-edit-focus |
Merge into: | lp:reminders-app |
Diff against target: |
328 lines (+129/-94) 5 files modified
src/app/qml/components/Header.qml (+99/-93) src/app/qml/reminders.qml (+2/-1) src/app/qml/ui/EditNotePage.qml (+2/-0) src/app/qml/ui/EditNoteView.qml (+25/-0) src/app/qml/ui/NotesPage.qml (+1/-0) |
To merge this branch: | bzr merge lp:~mzanetti/reminders-app/improve-edit-focus |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Riccardo Padovani | Approve | ||
Review via email: mp+270755@code.launchpad.net |
Commit message
Improve focus handling when entering EditNoteView
Description of the change
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:486
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/app/qml/components/Header.qml' | |||
2 | --- src/app/qml/components/Header.qml 2015-07-25 01:52:22 +0000 | |||
3 | +++ src/app/qml/components/Header.qml 2015-09-10 21:53:52 +0000 | |||
4 | @@ -6,10 +6,10 @@ | |||
5 | 6 | import Evernote 0.1 | 6 | import Evernote 0.1 |
6 | 7 | 7 | ||
7 | 8 | 8 | ||
9 | 9 | Column { | 9 | FocusScope { |
10 | 10 | id: root | 10 | id: root |
11 | 11 | width: parent.width | 11 | width: parent.width |
13 | 12 | height: childrenRect.height | 12 | height: column.height |
14 | 13 | 13 | ||
15 | 14 | property var note: null | 14 | property var note: null |
16 | 15 | 15 | ||
17 | @@ -19,16 +19,16 @@ | |||
18 | 19 | 19 | ||
19 | 20 | signal editReminders(); | 20 | signal editReminders(); |
20 | 21 | signal editTags(); | 21 | signal editTags(); |
21 | 22 | |||
22 | 23 | Notebooks { | 22 | Notebooks { |
23 | 24 | id: notebooks | 23 | id: notebooks |
24 | 25 | } | 24 | } |
25 | 26 | |||
26 | 27 | Component.onCompleted: setNotebookTimer.start(); | 25 | Component.onCompleted: setNotebookTimer.start(); |
27 | 28 | onNoteChanged: setNotebookTimer.start(); | 26 | onNoteChanged: setNotebookTimer.start(); |
28 | 29 | // in case note is set during creation, the animation breaks if we set selectedIndex. Wait for a eventloop pass | 27 | // in case note is set during creation, the animation breaks if we set selectedIndex. Wait for a eventloop pass |
29 | 30 | Timer { id: setNotebookTimer; interval: 1; repeat: false; onTriggered: updateNotebook(); } | 28 | Timer { id: setNotebookTimer; interval: 1; repeat: false; onTriggered: updateNotebook(); } |
30 | 31 | 29 | ||
31 | 30 | onFocusChanged: if (focus) titleTextField.forceActiveFocus(); | ||
32 | 31 | |||
33 | 32 | function updateNotebook() { | 32 | function updateNotebook() { |
34 | 33 | if (!root.note) return; | 33 | if (!root.note) return; |
35 | 34 | for (var i = 0; i < notebooks.count; i++) { | 34 | for (var i = 0; i < notebooks.count; i++) { |
36 | @@ -39,103 +39,109 @@ | |||
37 | 39 | } | 39 | } |
38 | 40 | } | 40 | } |
39 | 41 | } | 41 | } |
101 | 42 | 42 | Column { | |
102 | 43 | TextField { | 43 | id: column |
103 | 44 | id: titleTextField | 44 | width: parent.width |
104 | 45 | height: units.gu(6) | 45 | height: childrenRect.height |
105 | 46 | width: parent.width | 46 | |
106 | 47 | text: root.note ? root.note.title : "" | 47 | TextField { |
107 | 48 | placeholderText: i18n.tr("Untitled") | 48 | id: titleTextField |
108 | 49 | font.pixelSize: units.gu(4) | 49 | height: units.gu(6) |
109 | 50 | visible: root.editingEnabled | 50 | width: parent.width |
110 | 51 | style: TextFieldStyle { | 51 | text: root.note ? root.note.title : "" |
111 | 52 | background: null | 52 | placeholderText: i18n.tr("Untitled") |
112 | 53 | } | 53 | font.pixelSize: units.gu(4) |
113 | 54 | } | 54 | visible: root.editingEnabled |
114 | 55 | 55 | style: TextFieldStyle { | |
115 | 56 | Label { | 56 | background: null |
116 | 57 | height: units.gu(6) | 57 | } |
117 | 58 | anchors.left: parent.left | 58 | } |
118 | 59 | anchors.right: parent.right | 59 | |
119 | 60 | anchors.margins: units.gu(1) | 60 | Label { |
120 | 61 | text: root.note ? root.note.title : "" | 61 | height: units.gu(6) |
121 | 62 | visible: !root.editingEnabled | 62 | anchors.left: parent.left |
122 | 63 | font.pixelSize: units.gu(4) | 63 | anchors.right: parent.right |
123 | 64 | verticalAlignment: Text.AlignVCenter | 64 | anchors.margins: units.gu(1) |
124 | 65 | } | 65 | text: root.note ? root.note.title : "" |
125 | 66 | 66 | visible: !root.editingEnabled | |
126 | 67 | ThinDivider {} | 67 | font.pixelSize: units.gu(4) |
127 | 68 | 68 | verticalAlignment: Text.AlignVCenter | |
128 | 69 | ItemSelector { | 69 | } |
129 | 70 | id: notebookSelector | 70 | |
130 | 71 | width: parent.width | 71 | ThinDivider {} |
131 | 72 | model: notebooks | 72 | |
132 | 73 | 73 | ItemSelector { | |
133 | 74 | onDelegateClicked: { | 74 | id: notebookSelector |
134 | 75 | var newNotebookGuid = model.notebook(index).guid; | 75 | width: parent.width |
135 | 76 | if (newNotebookGuid != root.note.notebookGuid) { | 76 | model: notebooks |
136 | 77 | root.note.notebookGuid = newNotebookGuid; | 77 | |
137 | 78 | NotesStore.saveNote(root.note.guid) | 78 | onDelegateClicked: { |
138 | 79 | } | 79 | var newNotebookGuid = model.notebook(index).guid; |
139 | 80 | } | 80 | if (newNotebookGuid != root.note.notebookGuid) { |
140 | 81 | 81 | root.note.notebookGuid = newNotebookGuid; | |
141 | 82 | delegate: OptionSelectorDelegate { | 82 | NotesStore.saveNote(root.note.guid) |
142 | 83 | Rectangle { | 83 | } |
143 | 84 | anchors.fill: parent | 84 | } |
144 | 85 | color: "white" | 85 | |
145 | 86 | 86 | delegate: OptionSelectorDelegate { | |
146 | 87 | RowLayout { | 87 | Rectangle { |
147 | 88 | anchors { | 88 | anchors.fill: parent |
148 | 89 | fill: parent | 89 | color: "white" |
149 | 90 | leftMargin: units.gu(1) | 90 | |
150 | 91 | rightMargin: units.gu(1) | 91 | RowLayout { |
151 | 92 | topMargin: units.gu(0.5) | 92 | anchors { |
152 | 93 | bottomMargin: units.gu(0.5) | 93 | fill: parent |
153 | 94 | } | 94 | leftMargin: units.gu(1) |
154 | 95 | 95 | rightMargin: units.gu(1) | |
155 | 96 | Item { | 96 | topMargin: units.gu(0.5) |
156 | 97 | height: parent.height | 97 | bottomMargin: units.gu(0.5) |
157 | 98 | width: height | 98 | } |
158 | 99 | Icon { | 99 | |
159 | 100 | anchors.fill: parent | 100 | Item { |
160 | 101 | anchors.margins: units.gu(0.5) | 101 | height: parent.height |
161 | 102 | name: "notebook" | 102 | width: height |
162 | 103 | Icon { | ||
163 | 104 | anchors.fill: parent | ||
164 | 105 | anchors.margins: units.gu(0.5) | ||
165 | 106 | name: "notebook" | ||
166 | 107 | color: preferences.colorForNotebook(model.guid) | ||
167 | 108 | } | ||
168 | 109 | } | ||
169 | 110 | |||
170 | 111 | Label { | ||
171 | 112 | text: model.name | ||
172 | 113 | Layout.fillWidth: true | ||
173 | 103 | color: preferences.colorForNotebook(model.guid) | 114 | color: preferences.colorForNotebook(model.guid) |
174 | 104 | } | 115 | } |
191 | 105 | } | 116 | RtfButton { |
192 | 106 | 117 | iconName: root.note && root.note.reminder ? "reminder" : "reminder-new" | |
193 | 107 | Label { | 118 | height: parent.height |
194 | 108 | text: model.name | 119 | width: height |
195 | 109 | Layout.fillWidth: true | 120 | iconColor: root.note && note.reminder ? UbuntuColors.blue : Qt.rgba(0.0, 0.0, 0.0, 0.0) |
196 | 110 | color: preferences.colorForNotebook(model.guid) | 121 | visible: index == notebookSelector.selectedIndex |
197 | 111 | } | 122 | onClicked: { |
198 | 112 | RtfButton { | 123 | Qt.inputMethod.hide(); |
199 | 113 | iconName: root.note && root.note.reminder ? "reminder" : "reminder-new" | 124 | root.editReminders(); |
200 | 114 | height: parent.height | 125 | } |
185 | 115 | width: height | ||
186 | 116 | iconColor: root.note && note.reminder ? UbuntuColors.blue : Qt.rgba(0.0, 0.0, 0.0, 0.0) | ||
187 | 117 | visible: index == notebookSelector.selectedIndex | ||
188 | 118 | onClicked: { | ||
189 | 119 | Qt.inputMethod.hide(); | ||
190 | 120 | root.editReminders(); | ||
201 | 121 | } | 126 | } |
212 | 122 | } | 127 | RtfButton { |
213 | 123 | RtfButton { | 128 | id: tagsButton |
214 | 124 | id: tagsButton | 129 | iconSource: "../images/tags.svg" |
215 | 125 | iconSource: "../images/tags.svg" | 130 | height: parent.height |
216 | 126 | height: parent.height | 131 | width: height |
217 | 127 | width: height | 132 | visible: index == notebookSelector.selectedIndex |
218 | 128 | visible: index == notebookSelector.selectedIndex | 133 | onClicked: { |
219 | 129 | onClicked: { | 134 | Qt.inputMethod.hide(); |
220 | 130 | Qt.inputMethod.hide(); | 135 | root.editTags(); |
221 | 131 | root.editTags(); | 136 | } |
222 | 132 | } | 137 | } |
223 | 133 | } | 138 | } |
224 | 134 | } | 139 | } |
225 | 135 | } | 140 | } |
226 | 136 | } | 141 | } |
227 | 142 | |||
228 | 143 | ThinDivider {} | ||
229 | 137 | } | 144 | } |
230 | 138 | |||
231 | 139 | ThinDivider {} | ||
232 | 140 | } | 145 | } |
233 | 141 | 146 | ||
234 | 147 | |||
235 | 142 | 148 | ||
236 | === modified file 'src/app/qml/reminders.qml' | |||
237 | --- src/app/qml/reminders.qml 2015-09-08 18:10:48 +0000 | |||
238 | +++ src/app/qml/reminders.qml 2015-09-10 21:53:52 +0000 | |||
239 | @@ -480,12 +480,13 @@ | |||
240 | 480 | var note = NotesStore.note(guid); | 480 | var note = NotesStore.note(guid); |
241 | 481 | print("note created:", note.guid); | 481 | print("note created:", note.guid); |
242 | 482 | if (root.narrowMode) { | 482 | if (root.narrowMode) { |
244 | 483 | var page = pagestack.push(Qt.resolvedUrl("ui/EditNotePage.qml"), {note: note}); | 483 | var page = pagestack.push(Qt.resolvedUrl("ui/EditNotePage.qml"), {note: note, newNote: true}); |
245 | 484 | page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();}); | 484 | page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();}); |
246 | 485 | } else { | 485 | } else { |
247 | 486 | notesPage.selectedNote = note; | 486 | notesPage.selectedNote = note; |
248 | 487 | var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml")); | 487 | var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml")); |
249 | 488 | view.note = note; | 488 | view.note = note; |
250 | 489 | view.newNote = true; | ||
251 | 489 | view.exitEditMode.connect(function(note) {root.displayNote(note)}); | 490 | view.exitEditMode.connect(function(note) {root.displayNote(note)}); |
252 | 490 | } | 491 | } |
253 | 491 | } | 492 | } |
254 | 492 | 493 | ||
255 | === modified file 'src/app/qml/ui/EditNotePage.qml' | |||
256 | --- src/app/qml/ui/EditNotePage.qml 2015-07-25 01:52:22 +0000 | |||
257 | +++ src/app/qml/ui/EditNotePage.qml 2015-09-10 21:53:52 +0000 | |||
258 | @@ -25,6 +25,8 @@ | |||
259 | 25 | Page { | 25 | Page { |
260 | 26 | id: root | 26 | id: root |
261 | 27 | property alias note: editNoteView.note | 27 | property alias note: editNoteView.note |
262 | 28 | property alias newNote: editNoteView.newNote | ||
263 | 29 | property alias isBottomEdge: editNoteView.isBottomEdge | ||
264 | 28 | 30 | ||
265 | 29 | signal exitEditMode(var note) | 31 | signal exitEditMode(var note) |
266 | 30 | 32 | ||
267 | 31 | 33 | ||
268 | === modified file 'src/app/qml/ui/EditNoteView.qml' | |||
269 | --- src/app/qml/ui/EditNoteView.qml 2015-07-25 01:52:22 +0000 | |||
270 | +++ src/app/qml/ui/EditNoteView.qml 2015-09-10 21:53:52 +0000 | |||
271 | @@ -30,6 +30,8 @@ | |||
272 | 30 | Item { | 30 | Item { |
273 | 31 | id: root | 31 | id: root |
274 | 32 | property var note | 32 | property var note |
275 | 33 | property bool newNote: false | ||
276 | 34 | property bool isBottomEdge: false | ||
277 | 33 | 35 | ||
278 | 34 | onNoteChanged: { | 36 | onNoteChanged: { |
279 | 35 | note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 2 | 37 | note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 2 |
280 | @@ -51,6 +53,28 @@ | |||
281 | 51 | } | 53 | } |
282 | 52 | } | 54 | } |
283 | 53 | 55 | ||
284 | 56 | Component.onCompleted: { | ||
285 | 57 | init(); | ||
286 | 58 | } | ||
287 | 59 | |||
288 | 60 | onNewNoteChanged: { | ||
289 | 61 | init(); | ||
290 | 62 | } | ||
291 | 63 | |||
292 | 64 | function init() { | ||
293 | 65 | if (root.isBottomEdge) { | ||
294 | 66 | return; | ||
295 | 67 | } | ||
296 | 68 | |||
297 | 69 | if (root.newNote) { | ||
298 | 70 | header.title = ""; | ||
299 | 71 | header.forceActiveFocus(); | ||
300 | 72 | } else { | ||
301 | 73 | noteTextArea.forceActiveFocus(); | ||
302 | 74 | } | ||
303 | 75 | } | ||
304 | 76 | |||
305 | 77 | |||
306 | 54 | QtObject { | 78 | QtObject { |
307 | 55 | id: priv | 79 | id: priv |
308 | 56 | property int insertPosition | 80 | property int insertPosition |
309 | @@ -134,6 +158,7 @@ | |||
310 | 134 | Header { | 158 | Header { |
311 | 135 | id: header | 159 | id: header |
312 | 136 | note: root.note | 160 | note: root.note |
313 | 161 | focus: root.newNote | ||
314 | 137 | 162 | ||
315 | 138 | onEditReminders: { | 163 | onEditReminders: { |
316 | 139 | pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note}); | 164 | pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note}); |
317 | 140 | 165 | ||
318 | === modified file 'src/app/qml/ui/NotesPage.qml' | |||
319 | --- src/app/qml/ui/NotesPage.qml 2015-07-25 01:52:22 +0000 | |||
320 | +++ src/app/qml/ui/NotesPage.qml 2015-09-10 21:53:52 +0000 | |||
321 | @@ -42,6 +42,7 @@ | |||
322 | 42 | bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading) | 42 | bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading) |
323 | 43 | bottomEdgeTitle: i18n.tr("Add note") | 43 | bottomEdgeTitle: i18n.tr("Add note") |
324 | 44 | bottomEdgePageComponent: EditNotePage { | 44 | bottomEdgePageComponent: EditNotePage { |
325 | 45 | isBottomEdge: true | ||
326 | 45 | MouseArea { | 46 | MouseArea { |
327 | 46 | anchors.fill: parent | 47 | anchors.fill: parent |
328 | 47 | } | 48 | } |
Lgtm, thanks