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

Proposed by Michael Zanetti
Status: Merged
Approved by: Michael Zanetti
Approved revision: 452
Merged at revision: 453
Proposed branch: lp:~mzanetti/reminders-app/improve-edit-tags
Merge into: lp:reminders-app
Diff against target: 197 lines (+105/-30)
3 files modified
src/app/qml/components/EditTagsDialog.qml (+98/-29)
src/app/qml/ui/EditNoteView.qml (+1/-1)
src/libqtevernote/notesstore.cpp (+6/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/improve-edit-tags
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Riccardo Padovani Approve
Review via email: mp+261779@code.launchpad.net

Commit message

Improve the edit tags dialog and some other strings

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

Great improvement!
Some feedbacks inline...

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

thanks! Inline replies

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

> Hmm... I tried with a Popover at first, but in this context it didn't feel right. Just having an
> UbuntuShape without the arrow pointing to the input seems odd too. IMO the rectangle fits best here
> but not sure... Maybe we can ask popey for a thirst opinion.

Well, I didn't test it so it was just an idea, you know the UX doesn't run strong in me.
We can indeed ask popey tomorrow.

I approve on my side because code and all other things looks good

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

I found the UI worked as I'd expect. I can easily enter new tags and select (and de-select) from the existing ones. I don't have any particularly strong opinion on the shape of the list, it works, it looks consistent with other apps, it's good. :)

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

Well, then with popey's blessing I land this :-)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
452. By Michael Zanetti

merge trunk

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
1=== modified file 'src/app/qml/components/EditTagsDialog.qml'
2--- src/app/qml/components/EditTagsDialog.qml 2015-02-27 22:43:12 +0000
3+++ src/app/qml/components/EditTagsDialog.qml 2015-06-12 09:48:34 +0000
4@@ -26,6 +26,12 @@
5 Dialog {
6 id: root
7
8+ title: i18n.tr("Edit tags")
9+ text: tags.count == 0 ? noTagsText : haveTagsText
10+
11+ property string noTagsText: i18n.tr("Enter a tag name to attach it to the note.")
12+ property string haveTagsText: i18n.tr("Enter a tag name or select one from the list to attach it to the note.")
13+
14 property var note
15 property int pageHeight
16
17@@ -35,42 +41,105 @@
18 id: tags
19 }
20
21+ SortFilterModel {
22+ id: tagsSortFilterModel
23+ model: tags
24+ filter.property: "name"
25+ filter.pattern: RegExp(textField.text)
26+ }
27+
28 RowLayout {
29 Layout.preferredWidth: parent.width - units.gu(2)
30 Layout.alignment: Qt.AlignHCenter
31+ z: 2
32
33- TextField {
34- id: textField
35+ Item {
36 Layout.fillWidth: true
37- placeholderText: i18n.tr("Create a new tag")
38-
39- onAccepted: accept();
40-
41- function accept() {
42- var tagName = text;
43- text = '';
44-
45- // Check if the tag exists
46- for (var i=0; i < tags.count; i++) {
47- var tag = tags.tag(i);
48- if (tag.name == tagName) {
49- // The tag exists, check if is already selected: if it is,
50- // do nothing, otherwise add to tags of the note
51- if (note.tagGuids.indexOf(tag.guid) === -1) {
52- note.tagGuids.push(tag.guid);
53- }
54- return;
55- }
56- }
57-
58- var newTag = NotesStore.createTag(tagName);
59- print("tag created", newTag.name, "appending to note");
60- note.tagGuids.push(newTag.guid)
61+ Layout.preferredHeight: okButton.height
62+
63+ TextField {
64+ id: textField
65+ placeholderText: i18n.tr("Tag name")
66+ anchors.fill: parent
67+
68+ onAccepted: accept();
69+
70+ function accept() {
71+ var tagName = text;
72+ text = '';
73+
74+ // Check if the tag exists
75+ for (var i=0; i < tags.count; i++) {
76+ var tag = tags.tag(i);
77+ if (tag.name == tagName) {
78+ // The tag exists, check if is already selected: if it is,
79+ // do nothing, otherwise add to tags of the note
80+ if (note.tagGuids.indexOf(tag.guid) === -1) {
81+ note.tagGuids.push(tag.guid);
82+ }
83+ return;
84+ }
85+ }
86+
87+ var newTag = NotesStore.createTag(tagName);
88+ print("tag created", newTag.name, "appending to note");
89+ note.tagGuids.push(newTag.guid)
90+ }
91+
92+ }
93+
94+ Rectangle {
95+ anchors {
96+ left: textField.left
97+ top: textField.bottom
98+ right: textField.right
99+ }
100+ color: "white"
101+ border.width: units.dp(1)
102+ border.color: "black"
103+ height: Math.min(5, tagsListView.count) * units.gu(4)
104+ visible: textField.text.length > 0 && (textField.focus || tagsListView.focus)
105+
106+ ListView {
107+ id: tagsListView
108+ anchors.fill: parent
109+ model: tagsSortFilterModel
110+ clip: true
111+
112+ delegate: Empty {
113+ height: units.gu(4)
114+ RowLayout {
115+ id: tagRow
116+ anchors.fill: parent
117+ anchors.margins: units.gu(1)
118+ spacing: units.gu(1)
119+
120+ property bool used: root.note ? root.note.tagGuids.indexOf(model.guid) !== -1 : false
121+ Label {
122+ text: model.name
123+ color: textField.text === model.name ? UbuntuColors.orange : "black"
124+ Layout.fillHeight: true
125+ Layout.fillWidth: true
126+ }
127+ Icon {
128+ name: "tick"
129+ visible: tagRow.used
130+ Layout.fillHeight: true
131+ }
132+ }
133+
134+ onClicked: {
135+ textField.text = model.name
136+ }
137+ }
138+ }
139 }
140 }
141
142+
143 Button {
144- text: i18n.tr("Create tag")
145+ id: okButton
146+ text: i18n.tr("OK")
147 color: UbuntuColors.orange
148 enabled: textField.text.replace(/\s+/g, '') !== ''; // Not only whitespaces!
149 onClicked: textField.accept()
150@@ -86,7 +155,7 @@
151 currentlyExpanded: true
152 multiSelection: true
153
154- containerHeight: Math.min(root.pageHeight - textField.height - closeButton.height - units.gu(12), tags.count * itemHeight)
155+ containerHeight: Math.min(root.pageHeight / 3, tags.count * itemHeight)
156
157 model: tags
158
159@@ -117,7 +186,7 @@
160
161 color: UbuntuColors.orange
162
163- text: i18n.tr("Done")
164+ text: i18n.tr("Close")
165
166 onClicked: {
167 root.done();
168
169=== modified file 'src/app/qml/ui/EditNoteView.qml'
170--- src/app/qml/ui/EditNoteView.qml 2015-05-30 16:18:42 +0000
171+++ src/app/qml/ui/EditNoteView.qml 2015-06-12 09:48:34 +0000
172@@ -647,7 +647,7 @@
173 RtfButton {
174 iconName: "tick"
175 // TRANSLATORS: Button to close the edit mode
176- text: i18n.tr("Done")
177+ text: i18n.tr("Close")
178 height: parent.height
179 iconColor: UbuntuColors.green
180 onClicked: {
181
182=== modified file 'src/libqtevernote/notesstore.cpp'
183--- src/libqtevernote/notesstore.cpp 2015-06-11 21:38:27 +0000
184+++ src/libqtevernote/notesstore.cpp 2015-06-12 09:48:34 +0000
185@@ -499,6 +499,12 @@
186
187 Tag* NotesStore::createTag(const QString &name)
188 {
189+ foreach (Tag *tag, m_tags) {
190+ if (tag->name() == name) {
191+ return tag;
192+ }
193+ }
194+
195 QString newGuid = QUuid::createUuid().toString();
196 newGuid.remove("{").remove("}");
197 Tag *tag = new Tag(newGuid, 1, this);

Subscribers

People subscribed via source and target branches