Merge lp:~mzanetti/reminders-app/edit-note-improvements into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 381
Merged at revision: 392
Proposed branch: lp:~mzanetti/reminders-app/edit-note-improvements
Merge into: lp:reminders-app
Diff against target: 460 lines (+127/-150)
4 files modified
src/app/qml/components/RtfButton.qml (+25/-16)
src/app/qml/ui/EditNotePage.qml (+0/-1)
src/app/qml/ui/EditNoteView.qml (+102/-131)
src/app/qml/ui/NotesPage.qml (+0/-2)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/edit-note-improvements
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Approve
Review via email: mp+253010@code.launchpad.net

Commit message

Further improve edit dialog. More space for the actual content, implicitly save the note.

Description of the change

Further improve edit dialog. More space for the actual content, implicitly save the note.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:381
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mzanetti/reminders-app/edit-note-improvements/+merge/253010/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/717/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-utopic/2354
        deb: http://91.189.93.70:8080/job/generic-mediumtests-utopic/2354/artifact/work/output/*zip*/output.zip
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-utopic-amd64-ci/319
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/138

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

What a nice improvement :-)

Cool, congrats!

The only problem I found (but if you want we can fix in a later branch) is in the bottom edge: it's reported as notebook a random notebook, and not the one in which the note will be create.

Just let me know if you want to fix later (and so I approve this) or you'll do it here

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> What a nice improvement :-)
>
> Cool, congrats!
>
> The only problem I found (but if you want we can fix in a later branch) is in
> the bottom edge: it's reported as notebook a random notebook, and not the one
> in which the note will be create.
>
> Just let me know if you want to fix later (and so I approve this) or you'll do
> it here

I've tried to fix that now but it's not as easy. It would require some reworking of how the bottom edge is created etc. Let's not do that until we have a clearer idea what will happen to the bottom edge in the convergenced world.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Yes, I agree: then I top approve this branch, it's very cool :-)

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
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/RtfButton.qml'
--- src/app/qml/components/RtfButton.qml 2014-11-10 23:31:45 +0000
+++ src/app/qml/components/RtfButton.qml 2015-03-16 00:46:37 +0000
@@ -17,14 +17,17 @@
17 */17 */
1818
19import QtQuick 2.319import QtQuick 2.3
20import QtQuick.Layouts 1.1
20import Ubuntu.Components 1.121import Ubuntu.Components 1.1
2122
22Item {23Item {
23 id: root24 id: root
25 implicitWidth: Math.max(height, contentRow.width + units.gu(1))
24 property alias text: textField.text26 property alias text: textField.text
25 property alias iconName: icon.name27 property alias iconName: icon.name
26 property alias iconSource: icon.source28 property alias iconSource: icon.source
27 property string color: "transparent"29 property string color: "transparent"
30 property alias iconColor: icon.color
28 property alias horizontalAlignment: textField.horizontalAlignment31 property alias horizontalAlignment: textField.horizontalAlignment
2932
30 property alias font: textField.font33 property alias font: textField.font
@@ -36,6 +39,7 @@
36 opacity: enabled ? 1 : 0.539 opacity: enabled ? 1 : 0.5
3740
38 MouseArea {41 MouseArea {
42 id: mouseArea
39 anchors.fill: parent43 anchors.fill: parent
40 onClicked: root.clicked()44 onClicked: root.clicked()
41 }45 }
@@ -43,22 +47,27 @@
43 Rectangle {47 Rectangle {
44 anchors.fill: parent48 anchors.fill: parent
45 color: UbuntuColors.darkGrey49 color: UbuntuColors.darkGrey
46 opacity: root.active ? 0.2 : 050 opacity: root.active || mouseArea.pressed ? 0.2 : 0
47 }51 }
4852
49 Label {53 Row {
50 id: textField54 id: contentRow
51 anchors { top: parent.top; bottom: parent.bottom; left: parent.left }55 anchors { top: parent.top; bottom: parent.bottom; left: parent.left; leftMargin: units.gu(0.5) }
52 verticalAlignment: Text.AlignVCenter56 spacing: units.gu(0.5)
53 horizontalAlignment: Text.AlignHCenter57 Icon {
54 width: parent.width58 id: icon
55 elide: Text.ElideRight59 anchors { top: parent.top; bottom: parent.bottom; margins: units.gu(0.5) }
56 }60 width: height
5761 visible: source.toString().length > 0
58 Icon {62 }
59 id: icon63 Label {
60 anchors.fill: parent64 id: textField
61 anchors.margins: units.gu(0.5)65 anchors { top: parent.top; bottom: parent.bottom; margins: units.gu(0.5) }
66 verticalAlignment: Text.AlignVCenter
67 horizontalAlignment: Text.AlignHCenter
68 elide: Text.ElideRight
69 width: Math.min(implicitWidth, root.width)
70 }
62 }71 }
6372
64 UbuntuShape {73 UbuntuShape {
6574
=== modified file 'src/app/qml/ui/EditNotePage.qml'
--- src/app/qml/ui/EditNotePage.qml 2014-09-23 12:39:27 +0000
+++ src/app/qml/ui/EditNotePage.qml 2015-03-16 00:46:37 +0000
@@ -25,7 +25,6 @@
25Page {25Page {
26 id: root26 id: root
27 property alias note: editNoteView.note27 property alias note: editNoteView.note
28 property alias isBottomEdge: editNoteView.isBottomEdge
2928
30 signal exitEditMode(var note)29 signal exitEditMode(var note)
3130
3231
=== modified file 'src/app/qml/ui/EditNoteView.qml'
--- src/app/qml/ui/EditNoteView.qml 2015-03-05 18:23:25 +0000
+++ src/app/qml/ui/EditNoteView.qml 2015-03-16 00:46:37 +0000
@@ -30,7 +30,6 @@
30Item {30Item {
31 id: root31 id: root
32 property var note32 property var note
33 property bool isBottomEdge: false
3433
35 onNoteChanged: {34 onNoteChanged: {
36 for (var i = 0; i < notebookSelector.values.count; i++) {35 for (var i = 0; i < notebookSelector.values.count; i++) {
@@ -81,62 +80,17 @@
81 }80 }
82 }81 }
8382
84 Binding {83 Connections {
85 target: note84 target: noteTextArea
86 property: "renderWidth"85 onWidthChanged: {
87 value: noteTextArea.width - noteTextArea.textMargin * 286 note.richTextContent = noteTextArea.text;
87 note.renderWidth = noteTextArea.width - noteTextArea.textMargin
88 }
88 }89 }
8990
90 Column {91 Column {
91 anchors { left: parent.left; top: parent.top; right: parent.right; bottom: toolbox.top }92 anchors { left: parent.left; top: parent.top; right: parent.right; bottom: toolbox.top }
9293
93 Row {
94 visible: !root.isBottomEdge
95 anchors { left: parent.left; right: parent.right; margins: units.gu(1) }
96 height: units.gu(7)
97 spacing: units.gu(2)
98 AbstractButton {
99 id: backIcon
100 height: units.gu(3)
101 width: height
102 anchors.verticalCenter: parent.verticalCenter
103 Icon {
104 name: "back"
105 anchors.fill: parent
106 }
107 onClicked: {
108 root.exitEditMode(root.note);
109 }
110 }
111
112 TextField {
113 id: titleTextField
114 text: root.note ? root.note.title : ""
115 placeholderText: i18n.tr("Untitled")
116 height: units.gu(4)
117 width: parent.width - (backIcon.width + parent.spacing) * 2
118 anchors.verticalCenter: parent.verticalCenter
119 }
120 AbstractButton {
121 height: units.gu(3)
122 width: height
123 anchors.verticalCenter: parent.verticalCenter
124 Icon {
125 name: "save"
126 anchors.fill: parent
127 }
128 onClicked: {
129 saveNote();
130 root.exitEditMode(root.note);
131 }
132 }
133 }
134
135 Divider {
136 visible: !root.isBottomEdge
137 height: units.gu(2)
138 }
139
140 Rectangle {94 Rectangle {
141 anchors { left: parent.left; right: parent.right }95 anchors { left: parent.left; right: parent.right }
142 height: parent.height - y96 height: parent.height - y
@@ -152,14 +106,16 @@
152106
153 function ensureVisible(r)107 function ensureVisible(r)
154 {108 {
109 var staticHeight = titleTextField.height + notebookSelector.height
155 if (contentX >= r.x)110 if (contentX >= r.x)
156 contentX = r.x;111 contentX = r.x;
157 else if (contentX+width <= r.x+r.width)112 else if (contentX +width <= r.x+r.width)
158 contentX = r.x+r.width-width;113 contentX = r.x+r.width-width;
159 if (contentY >= r.y)114 if (contentY >= r.y)
160 contentY = r.y;115 contentY = r.y;
161 else if (contentY+height-notebookSelector.height <= r.y+r.height)116 else if (contentY + height <= r.y + staticHeight + r.height) {
162 contentY = r.y+r.height-height+notebookSelector.height;117 contentY = r.y + r.height - staticHeight;
118 }
163 }119 }
164120
165 Column {121 Column {
@@ -167,17 +123,84 @@
167 width: parent.width123 width: parent.width
168 height: childrenRect.height124 height: childrenRect.height
169125
126 TextField {
127 id: titleTextField
128 height: units.gu(6)
129 width: parent.width
130 text: root.note ? root.note.title : ""
131 placeholderText: i18n.tr("Untitled")
132 font.pixelSize: units.gu(4)
133 style: TextFieldStyle {
134 background: null
135 }
136 }
137
138 ThinDivider {}
139
170 ValueSelector {140 ValueSelector {
171 id: notebookSelector141 id: notebookSelector
142 width: parent.width
172 text: values.notebook(selectedIndex).name143 text: values.notebook(selectedIndex).name
173 property string selectedGuid: values.notebook(selectedIndex) ? values.notebook(selectedIndex).guid : ""144 property string selectedGuid: values.notebook(selectedIndex) ? values.notebook(selectedIndex).guid : ""
174 values: Notebooks {}145 values: Notebooks {}
146
147 // The ValueSelector is not customizable enough, yet we wanna use the expanstion it provides. Let's just paint on top of it
148
149 Rectangle {
150 anchors { left: parent.left; right: parent.right; top: parent.top }
151 height: units.gu(6)
152 color: "white"
153
154 RowLayout {
155 anchors.fill: parent
156 anchors.margins: units.gu(1)
157
158 Item {
159 height: parent.height
160 width: height
161 Icon {
162 anchors.fill: parent
163 anchors.margins: units.gu(0.5)
164 name: "notebook"
165 color: preferences.colorForNotebook(notebookSelector.values.notebook(notebookSelector.selectedIndex).guid)
166 }
167 }
168
169 Label {
170 text: notebookSelector.values.notebook(notebookSelector.selectedIndex).name
171 Layout.fillWidth: true
172 color: preferences.colorForNotebook(notebookSelector.values.notebook(notebookSelector.selectedIndex).guid)
173 }
174 RtfButton {
175 iconName: root.note && root.note.reminder ? "reminder" : "reminder-new"
176 height: parent.height
177 width: height
178 iconColor: root.note && note.reminder ? UbuntuColors.blue : Qt.rgba(0.0, 0.0, 0.0, 0.0)
179 onClicked: {
180 Qt.inputMethod.hide();
181 pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note});
182 }
183 }
184 RtfButton {
185 id: tagsButton
186 iconSource: "../images/tags.svg"
187 height: parent.height
188 width: height
189 onClicked: {
190 Qt.inputMethod.hide();
191 PopupUtils.open(tagsDialog)
192 }
193 }
194 }
195 }
175 }196 }
176197
198 ThinDivider {}
199
177 TextEdit {200 TextEdit {
178 id: noteTextArea201 id: noteTextArea
179 width: flick.width202 width: flick.width
180 height: Math.max(flick.height - notebookSelector.height, paintedHeight)203 height: Math.max(flick.height - notebookSelector.height - titleTextField.height, paintedHeight)
181 focus: true204 focus: true
182 wrapMode: TextEdit.Wrap205 wrapMode: TextEdit.Wrap
183 textFormat: TextEdit.RichText206 textFormat: TextEdit.RichText
@@ -193,7 +216,6 @@
193 Timer {216 Timer {
194 id: setFocusTimer217 id: setFocusTimer
195 interval: 1218 interval: 1
196 running: !root.isBottomEdge
197 repeat: false219 repeat: false
198 onTriggered: {220 onTriggered: {
199 noteTextArea.cursorPosition = noteTextArea.length;221 noteTextArea.cursorPosition = noteTextArea.length;
@@ -390,7 +412,6 @@
390412
391 property bool charFormatExpanded: false413 property bool charFormatExpanded: false
392 property bool blockFormatExpanded: false414 property bool blockFormatExpanded: false
393 property bool tagsRowExpanded: false
394415
395 Behavior on height { UbuntuNumberAnimation {} }416 Behavior on height { UbuntuNumberAnimation {} }
396417
@@ -429,6 +450,7 @@
429 horizontalAlignment: Text.AlignLeft450 horizontalAlignment: Text.AlignLeft
430 Layout.fillWidth: true451 Layout.fillWidth: true
431 onClicked: {452 onClicked: {
453 Qt.inputMethod.hide();
432 PopupUtils.open(fontPopoverComponent, fontButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})454 PopupUtils.open(fontPopoverComponent, fontButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})
433 }455 }
434 }456 }
@@ -439,6 +461,7 @@
439 height: parent.height461 height: parent.height
440 width: height462 width: height
441 onClicked: {463 onClicked: {
464 Qt.inputMethod.hide();
442 PopupUtils.open(fontSizePopoverComponent, fontSizeButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})465 PopupUtils.open(fontSizePopoverComponent, fontSizeButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})
443 }466 }
444 }467 }
@@ -448,6 +471,7 @@
448 width: height471 width: height
449 color: formattingHelper.color472 color: formattingHelper.color
450 onClicked: {473 onClicked: {
474 Qt.inputMethod.hide();
451 PopupUtils.open(colorPopoverComponent, colorButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})475 PopupUtils.open(colorPopoverComponent, colorButton, {selectionStart: noteTextArea.selectionStart, selectionEnd: noteTextArea.selectionEnd})
452 }476 }
453 }477 }
@@ -587,56 +611,9 @@
587 formattingHelper.alignment = Qt.AlignRight611 formattingHelper.alignment = Qt.AlignRight
588 }612 }
589 }613 }
590 }614 Item {
591615 Layout.fillWidth: true
592 Row {616 Layout.fillHeight: true
593 anchors { left: parent.left; right: parent.right; rightMargin: units.gu(1) }
594 height: units.gu(4)
595 visible: toolbox.tagsRowExpanded
596 spacing: units.gu(1)
597
598 Rectangle {
599 z: 100
600 color: "#efefef"
601 height: parent.height
602 width: height + units.gu(1)
603 RtfButton {
604 id: editTagsButton
605 iconName: "edit"
606 height: parent.height
607 width: height
608 anchors.horizontalCenter: parent.horizontalCenter
609 onClicked: {
610 PopupUtils.open(tagsDialog)
611 }
612 }
613 }
614
615 ListView {
616 width: parent.width - editTagsButton.width - units.gu(1)
617 height: units.gu(4)
618
619 model: root.note ? root.note.tagGuids.length : undefined
620 orientation: ListView.Horizontal
621 spacing: units.gu(1)
622
623
624 delegate: Rectangle {
625 id: rectangle
626 radius: units.gu(1)
627 color: "white"
628 border.color: preferences.colorForNotebook(root.note.notebookGuid)
629 anchors.verticalCenter: parent.verticalCenter
630 Text {
631 text: NotesStore.tag(root.note.tagGuids[index]).name
632 color: preferences.colorForNotebook(root.note.notebookGuid)
633 Component.onCompleted: {
634 rectangle.width = width + units.gu(2)
635 rectangle.height = height + units.gu(1)
636 anchors.centerIn = parent
637 }
638 }
639 }
640 }617 }
641 }618 }
642619
@@ -646,6 +623,20 @@
646 height: units.gu(4)623 height: units.gu(4)
647624
648 RtfButton {625 RtfButton {
626 iconName: "tick"
627 // TRANSLATORS: Button to close the edit mode
628 text: i18n.tr("Done")
629 height: parent.height
630 iconColor: UbuntuColors.green
631 onClicked: {
632 saveNote();
633 root.exitEditMode(root.note);
634 }
635 }
636
637 RtfSeparator { }
638
639 RtfButton {
649 iconName: "undo"640 iconName: "undo"
650 height: parent.height641 height: parent.height
651 width: height642 width: height
@@ -670,6 +661,8 @@
670 Layout.fillWidth: true661 Layout.fillWidth: true
671 }662 }
672663
664 RtfSeparator {}
665
673 RtfButton {666 RtfButton {
674 iconName: "select"667 iconName: "select"
675 height: parent.height668 height: parent.height
@@ -681,15 +674,6 @@
681 }674 }
682 }675 }
683676
684 RtfButton {
685 iconName: note.reminder ? "reminder" : "reminder-new"
686 height: parent.height
687 width: height
688 onClicked: {
689 pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), { note: root.note});
690 }
691 }
692
693// TextEdit can't display horizontal lines yet :/677// TextEdit can't display horizontal lines yet :/
694// https://bugreports.qt-project.org/browse/QTBUG-42545678// https://bugreports.qt-project.org/browse/QTBUG-42545
695// RtfButton {679// RtfButton {
@@ -709,18 +693,7 @@
709 priv.insertPosition = noteTextArea.cursorPosition;693 priv.insertPosition = noteTextArea.cursorPosition;
710 note.richTextContent = noteTextArea.text;694 note.richTextContent = noteTextArea.text;
711 importPicker.visible = true;695 importPicker.visible = true;
712 }696 Qt.inputMethod.hide();
713 }
714
715 RtfSeparator {}
716
717 RtfButton {
718 iconSource: "../images/tags.svg"
719 height: parent.height
720 width: height
721 active: toolbox.tagsRowExpanded
722 onClicked: {
723 toolbox.tagsRowExpanded = !toolbox.tagsRowExpanded
724 }697 }
725 }698 }
726699
@@ -736,8 +709,6 @@
736 }709 }
737 }710 }
738711
739 RtfSeparator {}
740
741 RtfButton {712 RtfButton {
742 iconName: "edit-select-all"713 iconName: "edit-select-all"
743 height: parent.height714 height: parent.height
744715
=== modified file 'src/app/qml/ui/NotesPage.qml'
--- src/app/qml/ui/NotesPage.qml 2015-03-08 18:47:51 +0000
+++ src/app/qml/ui/NotesPage.qml 2015-03-16 00:46:37 +0000
@@ -41,8 +41,6 @@
41 bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading)41 bottomEdgeLabelVisible: narrowMode && (!notes.filterNotebookGuid || !notes.loading)
42 bottomEdgeTitle: i18n.tr("Add note")42 bottomEdgeTitle: i18n.tr("Add note")
43 bottomEdgePageComponent: EditNotePage {43 bottomEdgePageComponent: EditNotePage {
44 isBottomEdge: true;
45
46 MouseArea {44 MouseArea {
47 anchors.fill: parent45 anchors.fill: parent
48 }46 }

Subscribers

People subscribed via source and target branches