Merge lp:~mzanetti/reminders-app/improve-edit-focus into lp:reminders-app

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
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

To post a comment you must log in.
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Lgtm, thanks

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

PASSED: Continuous integration, rev:486
http://91.189.93.70:8080/job/reminders-app-ci/781/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/203

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/781/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/qml/components/Header.qml'
--- src/app/qml/components/Header.qml 2015-07-25 01:52:22 +0000
+++ src/app/qml/components/Header.qml 2015-09-10 21:53:52 +0000
@@ -6,10 +6,10 @@
6import Evernote 0.16import Evernote 0.1
77
88
9Column {9FocusScope {
10 id: root10 id: root
11 width: parent.width11 width: parent.width
12 height: childrenRect.height12 height: column.height
1313
14 property var note: null14 property var note: null
1515
@@ -19,16 +19,16 @@
1919
20 signal editReminders();20 signal editReminders();
21 signal editTags();21 signal editTags();
22
23 Notebooks {22 Notebooks {
24 id: notebooks23 id: notebooks
25 }24 }
26
27 Component.onCompleted: setNotebookTimer.start();25 Component.onCompleted: setNotebookTimer.start();
28 onNoteChanged: setNotebookTimer.start();26 onNoteChanged: setNotebookTimer.start();
29 // in case note is set during creation, the animation breaks if we set selectedIndex. Wait for a eventloop pass27 // in case note is set during creation, the animation breaks if we set selectedIndex. Wait for a eventloop pass
30 Timer { id: setNotebookTimer; interval: 1; repeat: false; onTriggered: updateNotebook(); }28 Timer { id: setNotebookTimer; interval: 1; repeat: false; onTriggered: updateNotebook(); }
3129
30 onFocusChanged: if (focus) titleTextField.forceActiveFocus();
31
32 function updateNotebook() {32 function updateNotebook() {
33 if (!root.note) return;33 if (!root.note) return;
34 for (var i = 0; i < notebooks.count; i++) {34 for (var i = 0; i < notebooks.count; i++) {
@@ -39,103 +39,109 @@
39 }39 }
40 }40 }
41 }41 }
4242 Column {
43 TextField {43 id: column
44 id: titleTextField44 width: parent.width
45 height: units.gu(6)45 height: childrenRect.height
46 width: parent.width46
47 text: root.note ? root.note.title : ""47 TextField {
48 placeholderText: i18n.tr("Untitled")48 id: titleTextField
49 font.pixelSize: units.gu(4)49 height: units.gu(6)
50 visible: root.editingEnabled50 width: parent.width
51 style: TextFieldStyle {51 text: root.note ? root.note.title : ""
52 background: null52 placeholderText: i18n.tr("Untitled")
53 }53 font.pixelSize: units.gu(4)
54 }54 visible: root.editingEnabled
5555 style: TextFieldStyle {
56 Label {56 background: null
57 height: units.gu(6)57 }
58 anchors.left: parent.left58 }
59 anchors.right: parent.right59
60 anchors.margins: units.gu(1)60 Label {
61 text: root.note ? root.note.title : ""61 height: units.gu(6)
62 visible: !root.editingEnabled62 anchors.left: parent.left
63 font.pixelSize: units.gu(4)63 anchors.right: parent.right
64 verticalAlignment: Text.AlignVCenter64 anchors.margins: units.gu(1)
65 }65 text: root.note ? root.note.title : ""
6666 visible: !root.editingEnabled
67 ThinDivider {}67 font.pixelSize: units.gu(4)
6868 verticalAlignment: Text.AlignVCenter
69 ItemSelector {69 }
70 id: notebookSelector70
71 width: parent.width71 ThinDivider {}
72 model: notebooks72
7373 ItemSelector {
74 onDelegateClicked: {74 id: notebookSelector
75 var newNotebookGuid = model.notebook(index).guid;75 width: parent.width
76 if (newNotebookGuid != root.note.notebookGuid) {76 model: notebooks
77 root.note.notebookGuid = newNotebookGuid;77
78 NotesStore.saveNote(root.note.guid)78 onDelegateClicked: {
79 }79 var newNotebookGuid = model.notebook(index).guid;
80 }80 if (newNotebookGuid != root.note.notebookGuid) {
8181 root.note.notebookGuid = newNotebookGuid;
82 delegate: OptionSelectorDelegate {82 NotesStore.saveNote(root.note.guid)
83 Rectangle {83 }
84 anchors.fill: parent84 }
85 color: "white"85
8686 delegate: OptionSelectorDelegate {
87 RowLayout {87 Rectangle {
88 anchors {88 anchors.fill: parent
89 fill: parent89 color: "white"
90 leftMargin: units.gu(1)90
91 rightMargin: units.gu(1)91 RowLayout {
92 topMargin: units.gu(0.5)92 anchors {
93 bottomMargin: units.gu(0.5)93 fill: parent
94 }94 leftMargin: units.gu(1)
9595 rightMargin: units.gu(1)
96 Item {96 topMargin: units.gu(0.5)
97 height: parent.height97 bottomMargin: units.gu(0.5)
98 width: height98 }
99 Icon {99
100 anchors.fill: parent100 Item {
101 anchors.margins: units.gu(0.5)101 height: parent.height
102 name: "notebook"102 width: height
103 Icon {
104 anchors.fill: parent
105 anchors.margins: units.gu(0.5)
106 name: "notebook"
107 color: preferences.colorForNotebook(model.guid)
108 }
109 }
110
111 Label {
112 text: model.name
113 Layout.fillWidth: true
103 color: preferences.colorForNotebook(model.guid)114 color: preferences.colorForNotebook(model.guid)
104 }115 }
105 }116 RtfButton {
106117 iconName: root.note && root.note.reminder ? "reminder" : "reminder-new"
107 Label {118 height: parent.height
108 text: model.name119 width: height
109 Layout.fillWidth: true120 iconColor: root.note && note.reminder ? UbuntuColors.blue : Qt.rgba(0.0, 0.0, 0.0, 0.0)
110 color: preferences.colorForNotebook(model.guid)121 visible: index == notebookSelector.selectedIndex
111 }122 onClicked: {
112 RtfButton {123 Qt.inputMethod.hide();
113 iconName: root.note && root.note.reminder ? "reminder" : "reminder-new"124 root.editReminders();
114 height: parent.height125 }
115 width: height
116 iconColor: root.note && note.reminder ? UbuntuColors.blue : Qt.rgba(0.0, 0.0, 0.0, 0.0)
117 visible: index == notebookSelector.selectedIndex
118 onClicked: {
119 Qt.inputMethod.hide();
120 root.editReminders();
121 }126 }
122 }127 RtfButton {
123 RtfButton {128 id: tagsButton
124 id: tagsButton129 iconSource: "../images/tags.svg"
125 iconSource: "../images/tags.svg"130 height: parent.height
126 height: parent.height131 width: height
127 width: height132 visible: index == notebookSelector.selectedIndex
128 visible: index == notebookSelector.selectedIndex133 onClicked: {
129 onClicked: {134 Qt.inputMethod.hide();
130 Qt.inputMethod.hide();135 root.editTags();
131 root.editTags();136 }
132 }137 }
133 }138 }
134 }139 }
135 }140 }
136 }141 }
142
143 ThinDivider {}
137 }144 }
138
139 ThinDivider {}
140}145}
141146
147
142148
=== modified file 'src/app/qml/reminders.qml'
--- src/app/qml/reminders.qml 2015-09-08 18:10:48 +0000
+++ src/app/qml/reminders.qml 2015-09-10 21:53:52 +0000
@@ -480,12 +480,13 @@
480 var note = NotesStore.note(guid);480 var note = NotesStore.note(guid);
481 print("note created:", note.guid);481 print("note created:", note.guid);
482 if (root.narrowMode) {482 if (root.narrowMode) {
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});
484 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();});484 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();});
485 } else {485 } else {
486 notesPage.selectedNote = note;486 notesPage.selectedNote = note;
487 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"));487 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"));
488 view.note = note;488 view.note = note;
489 view.newNote = true;
489 view.exitEditMode.connect(function(note) {root.displayNote(note)});490 view.exitEditMode.connect(function(note) {root.displayNote(note)});
490 }491 }
491 }492 }
492493
=== modified file 'src/app/qml/ui/EditNotePage.qml'
--- src/app/qml/ui/EditNotePage.qml 2015-07-25 01:52:22 +0000
+++ src/app/qml/ui/EditNotePage.qml 2015-09-10 21:53:52 +0000
@@ -25,6 +25,8 @@
25Page {25Page {
26 id: root26 id: root
27 property alias note: editNoteView.note27 property alias note: editNoteView.note
28 property alias newNote: editNoteView.newNote
29 property alias isBottomEdge: editNoteView.isBottomEdge
2830
29 signal exitEditMode(var note)31 signal exitEditMode(var note)
3032
3133
=== modified file 'src/app/qml/ui/EditNoteView.qml'
--- src/app/qml/ui/EditNoteView.qml 2015-07-25 01:52:22 +0000
+++ src/app/qml/ui/EditNoteView.qml 2015-09-10 21:53:52 +0000
@@ -30,6 +30,8 @@
30Item {30Item {
31 id: root31 id: root
32 property var note32 property var note
33 property bool newNote: false
34 property bool isBottomEdge: false
3335
34 onNoteChanged: {36 onNoteChanged: {
35 note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 237 note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 2
@@ -51,6 +53,28 @@
51 }53 }
52 }54 }
5355
56 Component.onCompleted: {
57 init();
58 }
59
60 onNewNoteChanged: {
61 init();
62 }
63
64 function init() {
65 if (root.isBottomEdge) {
66 return;
67 }
68
69 if (root.newNote) {
70 header.title = "";
71 header.forceActiveFocus();
72 } else {
73 noteTextArea.forceActiveFocus();
74 }
75 }
76
77
54 QtObject {78 QtObject {
55 id: priv79 id: priv
56 property int insertPosition80 property int insertPosition
@@ -134,6 +158,7 @@
134 Header {158 Header {
135 id: header159 id: header
136 note: root.note160 note: root.note
161 focus: root.newNote
137162
138 onEditReminders: {163 onEditReminders: {
139 pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note});164 pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note});
140165
=== modified file 'src/app/qml/ui/NotesPage.qml'
--- src/app/qml/ui/NotesPage.qml 2015-07-25 01:52:22 +0000
+++ src/app/qml/ui/NotesPage.qml 2015-09-10 21:53:52 +0000
@@ -42,6 +42,7 @@
42 bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading)42 bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading)
43 bottomEdgeTitle: i18n.tr("Add note")43 bottomEdgeTitle: i18n.tr("Add note")
44 bottomEdgePageComponent: EditNotePage {44 bottomEdgePageComponent: EditNotePage {
45 isBottomEdge: true
45 MouseArea {46 MouseArea {
46 anchors.fill: parent47 anchors.fill: parent
47 }48 }

Subscribers

People subscribed via source and target branches