Merge lp:~mzanetti/reminders-app/sort-order into lp:reminders-app
- sort-order
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Alan Pope πΊπ§π± π¦ | ||||
Approved revision: | 344 | ||||
Merged at revision: | 345 | ||||
Proposed branch: | lp:~mzanetti/reminders-app/sort-order | ||||
Merge into: | lp:reminders-app | ||||
Diff against target: |
367 lines (+230/-8) 7 files modified
src/app/qml/components/NotesDelegate.qml (+2/-5) src/app/qml/components/SortingDialog.qml (+49/-0) src/app/qml/images/sorting.svg (+95/-0) src/app/qml/ui/NotesPage.qml (+24/-2) src/libqtevernote/notes.cpp (+43/-1) src/libqtevernote/notes.h (+16/-0) src/libqtevernote/notesstore.cpp (+1/-0) |
||||
To merge this branch: | bzr merge lp:~mzanetti/reminders-app/sort-order | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Riccardo Padovani | Approve | ||
Review via email: mp+249576@code.launchpad.net |
Commit message
add sort order header action
Description of the change
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Riccardo Padovani (rpadovani) wrote : | # |
IMO the preference about the sort order has to be saved, so at every start users haven't to change the sort order again
Michael Zanetti (mzanetti) wrote : | # |
> IMO the preference about the sort order has to be saved, so at every start
> users haven't to change the sort order again
fixed. thanks
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:342
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Riccardo Padovani (rpadovani) wrote : | # |
lgtm now, thanks
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:342
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 343. By Michael Zanetti
-
try shuffling the order
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:343
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 344. By Michael Zanetti
-
really don't know why jenkins wouldn't allow me to import Popups from NotesPage.qml
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:344
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'src/app/qml/components/NotesDelegate.qml' |
2 | --- src/app/qml/components/NotesDelegate.qml 2015-02-12 23:47:43 +0000 |
3 | +++ src/app/qml/components/NotesDelegate.qml 2015-02-21 14:13:56 +0000 |
4 | @@ -28,8 +28,7 @@ |
5 | width: parent.width |
6 | |
7 | property string title |
8 | - property date creationDate |
9 | - property date changedDate |
10 | + property string date |
11 | property string content |
12 | property string resource |
13 | property string tags |
14 | @@ -124,10 +123,8 @@ |
15 | Label { |
16 | Layout.fillWidth: true |
17 | Layout.fillHeight: true |
18 | - // TRANSLATORS: the argument is a modification date that follows this format: |
19 | - // http://qt-project.org/doc/qt-5/qml-qtqml-date.html |
20 | text: "<font color=\"" + root.notebookColor + "\">" + |
21 | - Qt.formatDateTime(root.creationDate, i18n.tr("yyyy/mm/dd hh:mm")) + |
22 | + Qt.formatDateTime(root.date, Qt.LocalDate) + |
23 | " </font>" + root.content |
24 | wrapMode: Text.WordWrap |
25 | textFormat: Text.StyledText |
26 | |
27 | === added file 'src/app/qml/components/SortingDialog.qml' |
28 | --- src/app/qml/components/SortingDialog.qml 1970-01-01 00:00:00 +0000 |
29 | +++ src/app/qml/components/SortingDialog.qml 2015-02-21 14:13:56 +0000 |
30 | @@ -0,0 +1,49 @@ |
31 | +import QtQuick 2.2 |
32 | +import Ubuntu.Components 1.0 |
33 | +import Ubuntu.Components.Popups 1.0 |
34 | +import Ubuntu.Components.ListItems 1.0 |
35 | +import reminders 1.0 |
36 | + |
37 | +Item { |
38 | + id: root |
39 | + |
40 | + property int sortOrder |
41 | + |
42 | + signal accepted(); |
43 | + |
44 | + Component.onCompleted: PopupUtils.open(dialogComponent, root, {sortOrder: root.sortOrder}) |
45 | + |
46 | + Component { |
47 | + id: dialogComponent |
48 | + Dialog { |
49 | + id: dialog |
50 | + title: i18n.tr("Sort by") |
51 | + |
52 | + property alias sortOrder: optionSelector.selectedIndex |
53 | + |
54 | + |
55 | + OptionSelector { |
56 | + id: optionSelector |
57 | + expanded: true |
58 | + model: [ |
59 | + i18n.tr("Date created (newest first)"), |
60 | + i18n.tr("Date created (oldest first)"), |
61 | + i18n.tr("Date updated (newest first)"), |
62 | + i18n.tr("Date updated (oldest first)"), |
63 | + i18n.tr("Title (ascending)"), |
64 | + i18n.tr("Title (descending)") |
65 | + ] |
66 | + } |
67 | + |
68 | + Button { |
69 | + text: i18n.tr("Close") |
70 | + onClicked: { |
71 | + root.sortOrder = optionSelector.selectedIndex |
72 | + root.accepted(); |
73 | + PopupUtils.close(dialog); |
74 | + } |
75 | + } |
76 | + } |
77 | + } |
78 | +} |
79 | + |
80 | |
81 | === added file 'src/app/qml/images/sorting.svg' |
82 | --- src/app/qml/images/sorting.svg 1970-01-01 00:00:00 +0000 |
83 | +++ src/app/qml/images/sorting.svg 2015-02-21 14:13:56 +0000 |
84 | @@ -0,0 +1,95 @@ |
85 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
86 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
87 | + |
88 | +<svg |
89 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
90 | + xmlns:cc="http://creativecommons.org/ns#" |
91 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
92 | + xmlns:svg="http://www.w3.org/2000/svg" |
93 | + xmlns="http://www.w3.org/2000/svg" |
94 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
95 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
96 | + id="svg4874" |
97 | + height="90" |
98 | + viewBox="0 0 90 90.000001" |
99 | + width="90" |
100 | + version="1.1" |
101 | + inkscape:version="0.48.5 r10040" |
102 | + sodipodi:docname="user-switch.svg"> |
103 | + <defs |
104 | + id="defs14" /> |
105 | + <sodipodi:namedview |
106 | + pagecolor="#ffffff" |
107 | + bordercolor="#666666" |
108 | + borderopacity="1" |
109 | + objecttolerance="10" |
110 | + gridtolerance="10" |
111 | + guidetolerance="10" |
112 | + inkscape:pageopacity="0" |
113 | + inkscape:pageshadow="2" |
114 | + inkscape:window-width="2880" |
115 | + inkscape:window-height="1752" |
116 | + id="namedview12" |
117 | + showgrid="false" |
118 | + inkscape:zoom="2.6222222" |
119 | + inkscape:cx="45" |
120 | + inkscape:cy="45" |
121 | + inkscape:window-x="0" |
122 | + inkscape:window-y="48" |
123 | + inkscape:window-maximized="1" |
124 | + inkscape:current-layer="svg4874" /> |
125 | + <metadata |
126 | + id="metadata4879"> |
127 | + <rdf:RDF> |
128 | + <cc:Work |
129 | + rdf:about=""> |
130 | + <dc:format>image/svg+xml</dc:format> |
131 | + <dc:type |
132 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
133 | + <dc:title /> |
134 | + </cc:Work> |
135 | + </rdf:RDF> |
136 | + </metadata> |
137 | + <g |
138 | + id="layer1" |
139 | + transform="matrix(0,1,-1,0,174.505,67.856999)"> |
140 | + <g |
141 | + id="g4115"> |
142 | + <rect |
143 | + id="rect4198-7" |
144 | + style="color:#000000;fill:none" |
145 | + height="90" |
146 | + width="90" |
147 | + y="84.504997" |
148 | + x="-67.857002" /> |
149 | + <rect |
150 | + id="rect3049" |
151 | + style="color:#000000;fill:none" |
152 | + transform="scale(-1,1)" |
153 | + height="90" |
154 | + width="90" |
155 | + y="84.504997" |
156 | + x="-22.143" /> |
157 | + <path |
158 | + id="rect3765" |
159 | + style="color:#000000;fill:#808080" |
160 | + d="m -33.857,152.51 h 36 l 9.2e-6,-9 -36.0000002,1e-5 z" |
161 | + inkscape:connector-curvature="0" /> |
162 | + <path |
163 | + id="path4130" |
164 | + style="color:#000000;fill:#808080" |
165 | + d="m -30.717,162.59 c 0,0 -13.63,-5.962 -25.549,-14.552 0,-0.002 0,-0.004 0.0051,-0.009 0,-0.002 0.0051,-0.007 0.006,-0.01 0,-0.002 0.0051,-0.007 0.006,-0.01 0,-0.002 0.0051,-0.007 0.0051,-0.01 12.573,-8.8638 25.532,-14.498 25.532,-14.498 z" |
166 | + inkscape:connector-curvature="0" /> |
167 | + <path |
168 | + id="path4118" |
169 | + style="color:#000000;fill:#808080" |
170 | + d="m -11.857,115.51 h -36 l -9e-6,-9 36,10e-6 z" |
171 | + inkscape:connector-curvature="0" /> |
172 | + <path |
173 | + id="path4120" |
174 | + style="color:#000000;fill:#808080" |
175 | + d="m -14.998,125.59 c 0,0 13.63,-5.962 25.549,-14.552 0,-0.002 0,-0.004 -0.0051,-0.009 0,-0.002 -0.0051,-0.007 -0.006,-0.01 0,-0.002 -0.0051,-0.007 -0.006,-0.01 0,-0.002 -0.0051,-0.007 -0.0051,-0.01 -12.573,-8.8638 -25.532,-14.498 -25.532,-14.498 z" |
176 | + inkscape:connector-curvature="0" /> |
177 | + </g> |
178 | + </g> |
179 | +</svg> |
180 | |
181 | === modified file 'src/app/qml/ui/NotesPage.qml' |
182 | --- src/app/qml/ui/NotesPage.qml 2015-02-12 23:47:43 +0000 |
183 | +++ src/app/qml/ui/NotesPage.qml 2015-02-21 14:13:56 +0000 |
184 | @@ -23,6 +23,7 @@ |
185 | import Ubuntu.Components.Popups 1.0 |
186 | import Evernote 0.1 |
187 | import "../components" |
188 | +import Qt.labs.settings 1.0 |
189 | |
190 | PageWithBottomEdge { |
191 | id: root |
192 | @@ -80,6 +81,22 @@ |
193 | |
194 | ToolbarButton { |
195 | action: Action { |
196 | + iconSource: "../images/sorting.svg" |
197 | + text: i18n.tr("Sorting") |
198 | + onTriggered: { |
199 | + var popupComponent = Qt.createComponent(Qt.resolvedUrl("../components/SortingDialog.qml")); |
200 | + var popup = popupComponent.createObject(root, {sortOrder: notes.sortOrder} ) |
201 | + popup.accepted.connect( function() { |
202 | + notes.sortOrder = popup.sortOrder |
203 | + popup.destroy(); |
204 | + }) |
205 | + popup.sortOrder = notes.sortOrder; |
206 | + } |
207 | + } |
208 | + } |
209 | + |
210 | + ToolbarButton { |
211 | + action: Action { |
212 | text: i18n.tr("Accounts") |
213 | iconName: "contacts-app-symbolic" |
214 | onTriggered: { |
215 | @@ -127,6 +144,10 @@ |
216 | } |
217 | } |
218 | |
219 | + Settings { |
220 | + property alias sortOrder: notes.sortOrder |
221 | + } |
222 | + |
223 | Notes { |
224 | id: notes |
225 | } |
226 | @@ -146,8 +167,9 @@ |
227 | |
228 | delegate: NotesDelegate { |
229 | title: model.title |
230 | - creationDate: model.created |
231 | - changedDate: model.updated |
232 | + date: notes.sortOrder == Notes.SortOrderUpdatedOldest || notes.sortOrder == Notes.SortOrderUpdatedNewest ? |
233 | + model.updated : model.created |
234 | + |
235 | content: model.tagline |
236 | triggerActionOnMouseRelease: true |
237 | tags: { |
238 | |
239 | === modified file 'src/libqtevernote/notes.cpp' |
240 | --- src/libqtevernote/notes.cpp 2014-12-10 22:27:42 +0000 |
241 | +++ src/libqtevernote/notes.cpp 2015-02-21 14:13:56 +0000 |
242 | @@ -26,7 +26,8 @@ |
243 | Notes::Notes(QObject *parent) : |
244 | QSortFilterProxyModel(parent), |
245 | m_onlyReminders(false), |
246 | - m_showDeleted(false) |
247 | + m_showDeleted(false), |
248 | + m_sortOrder(SortOrderDateCreatedNewest) |
249 | { |
250 | connect(NotesStore::instance(), &NotesStore::loadingChanged, this, &Notes::loadingChanged); |
251 | connect(NotesStore::instance(), &NotesStore::errorChanged, this, &Notes::errorChanged); |
252 | @@ -154,6 +155,47 @@ |
253 | return count; |
254 | } |
255 | |
256 | +Notes::SortOrder Notes::sortOrder() const |
257 | +{ |
258 | + return m_sortOrder; |
259 | +} |
260 | + |
261 | +void Notes::setSortOrder(Notes::SortOrder sortOrder) |
262 | +{ |
263 | + if (m_sortOrder != sortOrder) { |
264 | + emit layoutAboutToBeChanged(); |
265 | + switch (sortOrder) { |
266 | + case SortOrderDateCreatedNewest: |
267 | + setSortRole(NotesStore::RoleCreated); |
268 | + sort(0, Qt::DescendingOrder); |
269 | + break; |
270 | + case SortOrderDateCreatedOldest: |
271 | + setSortRole(NotesStore::RoleCreated); |
272 | + sort(0, Qt::AscendingOrder); |
273 | + break; |
274 | + case SortOrderDateUpdatedNewest: |
275 | + setSortRole(NotesStore::RoleUpdated); |
276 | + sort(0, Qt::DescendingOrder); |
277 | + break; |
278 | + case SortOrderDateUpdatedOldest: |
279 | + setSortRole(NotesStore::RoleUpdated); |
280 | + sort(0, Qt::AscendingOrder); |
281 | + break; |
282 | + case SortOrderTitleAscending: |
283 | + setSortRole(NotesStore::RoleTitle); |
284 | + sort(0, Qt::AscendingOrder); |
285 | + break; |
286 | + case SortOrderTitleDescending: |
287 | + setSortRole(NotesStore::RoleTitle); |
288 | + sort(0, Qt::DescendingOrder); |
289 | + break; |
290 | + } |
291 | + m_sortOrder = sortOrder; |
292 | + emit sortOrderChanged(); |
293 | + emit layoutChanged(); |
294 | + } |
295 | +} |
296 | + |
297 | bool Notes::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const |
298 | { |
299 | QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent); |
300 | |
301 | === modified file 'src/libqtevernote/notes.h' |
302 | --- src/libqtevernote/notes.h 2014-12-08 10:25:48 +0000 |
303 | +++ src/libqtevernote/notes.h 2015-02-21 14:13:56 +0000 |
304 | @@ -28,6 +28,7 @@ |
305 | class Notes : public QSortFilterProxyModel |
306 | { |
307 | Q_OBJECT |
308 | + Q_ENUMS(SortOrder) |
309 | Q_PROPERTY(QString filterNotebookGuid READ filterNotebookGuid WRITE setFilterNotebookGuid NOTIFY filterNotebookGuidChanged) |
310 | Q_PROPERTY(QString filterTagGuid READ filterTagGuid WRITE setFilterTagGuid NOTIFY filterTagGuidChanged) |
311 | Q_PROPERTY(bool onlyReminders READ onlyReminders WRITE setOnlyReminders NOTIFY onlyRemindersChanged) |
312 | @@ -36,8 +37,18 @@ |
313 | Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged) |
314 | Q_PROPERTY(QString error READ error NOTIFY errorChanged) |
315 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
316 | + Q_PROPERTY(SortOrder sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) |
317 | |
318 | public: |
319 | + enum SortOrder { |
320 | + SortOrderDateCreatedNewest, |
321 | + SortOrderDateCreatedOldest, |
322 | + SortOrderDateUpdatedNewest, |
323 | + SortOrderDateUpdatedOldest, |
324 | + SortOrderTitleAscending, |
325 | + SortOrderTitleDescending |
326 | + }; |
327 | + |
328 | explicit Notes(QObject *parent = 0); |
329 | |
330 | QString filterNotebookGuid() const; |
331 | @@ -63,6 +74,9 @@ |
332 | |
333 | Q_INVOKABLE int sectionCount(const QString §ionRole, const QString §ion); |
334 | |
335 | + SortOrder sortOrder() const; |
336 | + void setSortOrder(SortOrder sortOrder); |
337 | + |
338 | protected: |
339 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; |
340 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; |
341 | @@ -76,6 +90,7 @@ |
342 | void loadingChanged(); |
343 | void errorChanged(); |
344 | void countChanged(); |
345 | + void sortOrderChanged(); |
346 | |
347 | private: |
348 | QString m_filterNotebookGuid; |
349 | @@ -83,6 +98,7 @@ |
350 | bool m_onlyReminders; |
351 | bool m_onlySearchResults; |
352 | bool m_showDeleted; |
353 | + SortOrder m_sortOrder; |
354 | }; |
355 | |
356 | #endif // NOTES_H |
357 | |
358 | === modified file 'src/libqtevernote/notesstore.cpp' |
359 | --- src/libqtevernote/notesstore.cpp 2014-12-16 21:01:28 +0000 |
360 | +++ src/libqtevernote/notesstore.cpp 2015-02-21 14:13:56 +0000 |
361 | @@ -1142,6 +1142,7 @@ |
362 | return; |
363 | } |
364 | note->setUpdateSequenceNumber(note->updateSequenceNumber()+1); |
365 | + note->setUpdated(QDateTime::currentDateTime()); |
366 | syncToCacheFile(note); |
367 | note->syncToCacheFile(); |
368 |
PASSED: Continuous integration, rev:341 91.189. 93.70:8080/ job/reminders- app-ci/ 644/ 91.189. 93.70:8080/ job/generic- mediumtests- vivid/1057 91.189. 93.70:8080/ job/generic- mediumtests- vivid/1057/ artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/reminders- app-vivid- amd64-ci/ 65
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 644/rebuild
http://