Merge lp:~rpadovani/reminders-app/betterGradient into lp:reminders-app

Proposed by Riccardo Padovani
Status: Superseded
Proposed branch: lp:~rpadovani/reminders-app/betterGradient
Merge into: lp:reminders-app
Diff against target: 1316 lines (+573/-266)
24 files modified
debian/control (+1/-0)
manifest.json (+1/-1)
src/app/CMakeLists.txt (+1/-1)
src/app/main.cpp (+3/-3)
src/app/preferences.cpp (+38/-5)
src/app/preferences.h (+10/-4)
src/app/qml/components/NotebooksDelegate.qml (+60/-32)
src/app/qml/components/NotesDelegate.qml (+108/-34)
src/app/qml/components/RemindersDelegate.qml (+90/-159)
src/app/qml/reminders.qml (+12/-5)
src/app/qml/ui/NotePage.qml (+1/-2)
src/app/qml/ui/NotebooksPage.qml (+1/-4)
src/app/qml/ui/NotesPage.qml (+6/-6)
src/app/qml/ui/RemindersPage.qml (+27/-4)
src/app/qml/ui/SetReminderPage.qml (+35/-0)
src/app/qml/ui/SetReminderView.qml (+82/-0)
src/plugin/Evernote/note.cpp (+8/-1)
src/plugin/Evernote/notebook.cpp (+40/-0)
src/plugin/Evernote/notebook.h (+10/-0)
src/plugin/Evernote/notebooks.cpp (+7/-1)
src/plugin/Evernote/notebooks.h (+3/-1)
src/plugin/Evernote/notes.cpp (+3/-2)
src/plugin/Evernote/notesstore.cpp (+23/-0)
src/plugin/Evernote/notesstore.h (+3/-1)
To merge this branch: bzr merge lp:~rpadovani/reminders-app/betterGradient
Reviewer Review Type Date Requested Status
Ubuntu Notes app developers Pending
Review via email: mp+219003@code.launchpad.net

This proposal has been superseded by a proposal from 2014-05-09.

Commit message

Better gradient on preview images

Description of the change

Better gradient on preview images

To post a comment you must log in.
105. By Riccardo Padovani

Merge with trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-05-08 12:15:21 +0000
3+++ debian/control 2014-05-09 15:03:52 +0000
4@@ -22,6 +22,7 @@
5 qtdeclarative5-evernote0.1,
6 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
7 qtdeclarative5-localstorage-plugin,
8+ qtdeclarative5-quicklayouts-plugin,
9 qtdeclarative5-qtquick2-plugin,
10 signon-plugin-oauth2 (>= 0.19-0~57~),
11 suru-icon-theme | ubuntu-mobile-icons,
12
13=== modified file 'manifest.json'
14--- manifest.json 2014-05-06 14:34:45 +0000
15+++ manifest.json 2014-05-09 15:03:52 +0000
16@@ -19,4 +19,4 @@
17 "x-test": {
18 "autopilot": "reminders"
19 }
20-}
21+}
22\ No newline at end of file
23
24=== modified file 'src/app/CMakeLists.txt'
25--- src/app/CMakeLists.txt 2014-02-15 17:05:32 +0000
26+++ src/app/CMakeLists.txt 2014-05-09 15:03:52 +0000
27@@ -3,7 +3,7 @@
28 set(reminders_SRCS
29 main.cpp
30 camerahelper.cpp
31- accountpreference.cpp
32+ preferences.cpp
33 ${QML_SRCS}
34 )
35
36
37=== modified file 'src/app/main.cpp'
38--- src/app/main.cpp 2014-05-06 17:54:50 +0000
39+++ src/app/main.cpp 2014-05-09 15:03:52 +0000
40@@ -21,7 +21,7 @@
41 */
42
43 #include "camerahelper.h"
44-#include "accountpreference.h"
45+#include "preferences.h"
46
47 #include <QtGui/QGuiApplication>
48 #include <QtQuick/QQuickView>
49@@ -101,8 +101,8 @@
50 view.engine()->rootContext()->setContextProperty("cameraHelper", &helper);
51
52 // Set up account preferences
53- AccountPreference preferences;
54- view.engine()->rootContext()->setContextProperty("accountPreference", &preferences);
55+ Preferences preferences;
56+ view.engine()->rootContext()->setContextProperty("preferences", &preferences);
57
58 QString qmlfile;
59 const QString filePath = QLatin1String("qml/reminders.qml");
60
61=== renamed file 'src/app/accountpreference.cpp' => 'src/app/preferences.cpp'
62--- src/app/accountpreference.cpp 2014-02-08 18:43:27 +0000
63+++ src/app/preferences.cpp 2014-05-09 15:03:52 +0000
64@@ -19,21 +19,54 @@
65 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
66 * Riccardo Padovani <rpadovani@ubuntu.com>
67 */
68-#include "accountpreference.h"
69+#include "preferences.h"
70
71-AccountPreference::AccountPreference(QObject *parent): QObject(parent),
72+Preferences::Preferences(QObject *parent): QObject(parent),
73 m_settings(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).first() + "/com.ubuntu.reminders/reminders.conf", QSettings::IniFormat)
74 {
75-
76+ m_notebookColors.append("#35af44");
77+ m_notebookColors.append("#298bd6");
78+ m_notebookColors.append("#d33781");
79+ m_notebookColors.append("#b68b01");
80+ m_notebookColors.append("#db3131");
81+ m_notebookColors.append("#2ba098");
82 }
83
84-QString AccountPreference::accountName() const
85+QString Preferences::accountName() const
86 {
87 return m_settings.value("accountName").toString();
88 }
89
90-void AccountPreference::setAccountName(const QString &accountName)
91+void Preferences::setAccountName(const QString &accountName)
92 {
93 m_settings.setValue("accountName", accountName);
94 emit accountNameChanged();
95 }
96+
97+
98+QString Preferences::colorForNotebook(const QString &notebookGuid)
99+{
100+ m_settings.beginGroup("notebookColors");
101+ QString colorName = m_settings.value(notebookGuid).toString();
102+
103+ if (colorName.isEmpty()) {
104+ QHash<QString, int> usedColors;
105+ foreach (const QString &tmp, m_settings.allKeys()) {
106+ usedColors[m_settings.value(tmp).toString()]++;
107+ }
108+
109+ while (colorName.isEmpty()) {
110+ foreach (const QString &c, m_notebookColors) {
111+ if (usedColors[c] == 0) {
112+ colorName = c;
113+ break;
114+ }
115+ usedColors[c]--;
116+ }
117+ }
118+
119+ m_settings.setValue(notebookGuid, colorName);
120+ }
121+ m_settings.endGroup();
122+ return colorName;
123+}
124
125=== renamed file 'src/app/accountpreference.h' => 'src/app/preferences.h'
126--- src/app/accountpreference.h 2014-02-08 18:43:27 +0000
127+++ src/app/preferences.h 2014-05-09 15:03:52 +0000
128@@ -20,28 +20,34 @@
129 * Riccardo Padovani <rpadovani@ubuntu.com>
130 */
131
132-#ifndef ACCOUNTPREFERENCE_H
133-#define ACCOUNTPREFERENCE_H
134+#ifndef PREFERENCE_H
135+#define PREFERENCE_H
136
137 #include <QSettings>
138 #include <QStandardPaths>
139 #include <QObject>
140 #include <QDebug>
141+#include <QList>
142+#include <QColor>
143
144-class AccountPreference: public QObject
145+class Preferences: public QObject
146 {
147 Q_OBJECT
148 Q_PROPERTY(QString accountName READ accountName WRITE setAccountName NOTIFY accountNameChanged)
149+
150 public:
151- AccountPreference(QObject *parent = 0);
152+ Preferences(QObject *parent = 0);
153 QString accountName() const;
154 void setAccountName(const QString &accountName);
155
156+ Q_INVOKABLE QString colorForNotebook(const QString &notebookGuid);
157+
158 signals:
159 void accountNameChanged();
160
161 private:
162 QSettings m_settings;
163+ QList<QString> m_notebookColors;
164 };
165
166 #endif
167
168=== modified file 'src/app/qml/components/NotebooksDelegate.qml'
169--- src/app/qml/components/NotebooksDelegate.qml 2014-01-28 08:31:37 +0000
170+++ src/app/qml/components/NotebooksDelegate.qml 2014-05-09 15:03:52 +0000
171@@ -17,44 +17,72 @@
172 */
173
174 import QtQuick 2.0
175+import QtQuick.Layouts 1.0
176 import Ubuntu.Components 0.1
177 import Ubuntu.Components.ListItems 0.1
178
179 Empty {
180 id: root
181- height: units.gu(6)
182-
183- property string name
184- property int noteCount
185- property string shareStatus
186-
187- Column {
188- id: contentColumn
189- anchors {
190- top: parent.top
191- topMargin: units.gu(1)
192- left: parent.left
193- leftMargin: units.gu(2)
194- right: resourceImage.left
195- rightMargin: units.gu(2)
196- }
197- Label {
198- anchors { left: parent.left; right: parent.right }
199- text: root.name
200- font.bold: true
201- elide: Text.ElideRight
202- }
203- Label {
204- anchors { left: parent.left; right: parent.right }
205- text: root.shareStatus
206- wrapMode: Text.WordWrap
207- textFormat: Text.StyledText
208- }
209+ height: units.gu(10)
210+
211+ property string notebookColor: preferences.colorForNotebook(model.guid)
212+
213+ Rectangle {
214+ anchors.fill: parent
215+ color: "#f9f9f9"
216+ anchors.bottomMargin: units.dp(1)
217 }
218
219- Label {
220- id: resourceImage
221- anchors { top: parent.top; right: parent.right; bottom: parent.bottom; topMargin: units.gu(1); rightMargin: units.gu(2) }
222- text: i18n.tr("%1 note", "%1 notes", root.noteCount).arg(root.noteCount)
223+ Base {
224+ anchors.fill: parent
225+ progression: true
226+
227+ onClicked: root.clicked()
228+
229+ RowLayout {
230+ anchors { fill: parent; topMargin: units.gu(1); bottomMargin: units.gu(1) }
231+
232+ Item {
233+ anchors { top: parent.top; bottom: parent.bottom }
234+ width: units.gu(1)
235+ Rectangle {
236+ anchors { top: parent.top; bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; margins: units.gu(1.5) }
237+ width: units.gu(.5)
238+ color: root.notebookColor
239+ radius: width / 2
240+ }
241+ }
242+
243+ ColumnLayout {
244+ height: parent.height
245+ Layout.fillWidth: true
246+
247+ Label {
248+ text: model.name
249+ color: root.notebookColor
250+ fontSize: "large"
251+ }
252+ Label {
253+ text: i18n.tr("Last edited %1").arg(model.lastUpdatedString)
254+ fontSize: "small"
255+ color: "black"
256+ }
257+ Label {
258+ Layout.fillHeight: true
259+ text: model.published ? i18n.tr("Shared") : i18n.tr("Private")
260+ color: model.published ? "black" : "#b3b3b3"
261+ fontSize: "x-small"
262+ verticalAlignment: Text.AlignVCenter
263+ font.bold: model.published
264+ }
265+ }
266+
267+ Label {
268+ Layout.fillHeight: true
269+ verticalAlignment: Text.AlignVCenter
270+ text: "(" + model.noteCount + ")"
271+ color: "#b3b3b3"
272+ }
273+ }
274 }
275 }
276
277=== modified file 'src/app/qml/components/NotesDelegate.qml'
278--- src/app/qml/components/NotesDelegate.qml 2014-05-06 19:30:14 +0000
279+++ src/app/qml/components/NotesDelegate.qml 2014-05-09 15:03:52 +0000
280@@ -17,49 +17,123 @@
281 */
282
283 import QtQuick 2.0
284+import QtQuick.Layouts 1.0
285 import Ubuntu.Components 0.1
286 import Ubuntu.Components.ListItems 0.1
287
288 Empty {
289 id: root
290- height: units.gu(9)
291+ height: units.gu(12)
292
293 property string title
294 property date creationDate
295 property string content
296 property string resource
297-
298- Column {
299- id: contentColumn
300- spacing: units.gu(1)
301- anchors {
302- top: parent.top
303- topMargin: units.gu(1)
304- left: parent.left
305- leftMargin: units.gu(2)
306- right: resourceImage.left
307- rightMargin: units.gu(2)
308- }
309- Label {
310- anchors { left: parent.left; right: parent.right }
311- text: root.title
312- font.bold: true
313- elide: Text.ElideRight
314- }
315- Label {
316- anchors { left: parent.left; right: parent.right }
317- text: "<font color=\"#dd4814\">"+ Qt.formatDate(root.creationDate) + "</font> " + root.content
318- wrapMode: Text.WordWrap
319- textFormat: Text.StyledText
320- maximumLineCount: 2
321- fontSize: "small"
322- }
323- }
324-
325- Image {
326- id: resourceImage
327- anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
328- source: root.resource
329- sourceSize.height: units.gu(9)
330+ property string notebookColor: preferences.colorForNotebook(model.guid)
331+
332+ showDivider: false;
333+
334+ ColumnLayout {
335+ anchors { fill: parent; leftMargin: units.gu(1); rightMargin: units.gu(1) }
336+ spacing: 0
337+
338+ Rectangle {
339+ Layout.fillWidth: true
340+ height: units.gu(0.4)
341+ color: root.notebookColor
342+ }
343+
344+ Rectangle {
345+ Layout.fillWidth: true
346+ Layout.fillHeight: true
347+ color: "white"
348+
349+ RowLayout {
350+ anchors.fill: parent
351+ spacing: 0
352+
353+ Rectangle {
354+ Layout.fillWidth: true
355+ Layout.fillHeight: true
356+
357+ gradient: Gradient {
358+ GradientStop{ position: 0.8; color: "transparent" }
359+ GradientStop{ position: 1; color: "#d9d9d9" }
360+ }
361+
362+ Base {
363+ anchors.fill: parent
364+ progression: true
365+ showDivider: false
366+
367+ onClicked: root.clicked() // Propagate the signal
368+
369+ ColumnLayout {
370+ anchors { fill: parent; topMargin: units.gu(1); bottomMargin: units.gu(1) }
371+
372+ Label {
373+ Layout.fillWidth: true
374+ text: root.title
375+ font.weight: Font.Light
376+ elide: Text.ElideRight
377+ color: root.notebookColor
378+ }
379+
380+ Label {
381+ Layout.fillWidth: true
382+ Layout.fillHeight: true
383+ text: root.content
384+ wrapMode: Text.WordWrap
385+ textFormat: Text.StyledText
386+ maximumLineCount: 2
387+ fontSize: "small"
388+ color: "black"
389+ }
390+
391+ Label {
392+ Layout.minimumWidth: parent.width + units.gu(2)
393+ text: Qt.formatDateTime(root.creationDate, "dddd, hh:mm")
394+ color: "#b3b3b3"
395+ fontSize: "small"
396+ horizontalAlignment: Text.AlignRight
397+ }
398+ }
399+ }
400+ }
401+
402+ Image {
403+ source: root.resource
404+ sourceSize.height: units.gu(11.6)
405+
406+ Layout.maximumWidth: parent.width / 2
407+
408+ Rectangle {
409+ height: parent.width / 4
410+ width: parent.height
411+
412+ anchors {verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: parent.width/2 - height/2 }
413+ rotation: 90
414+
415+ gradient: Gradient {
416+ GradientStop{ position: 0; color: "#383838" }
417+ GradientStop{ position: 1; color: "transparent" }
418+ }
419+ }
420+
421+ Rectangle {
422+ height: parent.width / 4
423+ width: parent.height
424+
425+ anchors {verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: -parent.width/2 + height/2 }
426+ rotation: 270
427+
428+ gradient: Gradient {
429+ GradientStop{ position: 0; color: "#383838" }
430+ GradientStop{ position: 1; color: "transparent" }
431+ }
432+ }
433+ }
434+ }
435+ }
436 }
437 }
438
439=== modified file 'src/app/qml/components/RemindersDelegate.qml'
440--- src/app/qml/components/RemindersDelegate.qml 2014-02-17 23:32:36 +0000
441+++ src/app/qml/components/RemindersDelegate.qml 2014-05-09 15:03:52 +0000
442@@ -17,184 +17,115 @@
443 */
444
445 import QtQuick 2.0
446+import QtQuick.Layouts 1.0
447 import Ubuntu.Components 0.1
448 import Ubuntu.Components.ListItems 0.1
449 import Ubuntu.Components.Popups 0.1
450 import Ubuntu.Components.Pickers 0.1
451+import Evernote 0.1
452
453-Empty {
454+Base {
455 id: root
456- height: expanded ? mainColumn.height : implicitHeight
457+ height: units.gu(10)
458 clip: true
459+ progression: true
460+ removable: true
461+
462+ backgroundIndicator: Row {
463+ x: root.__contents.x > 0 ? root.__contents.x - width : 0
464+ height: childrenRect.height
465+ width: childrenRect.width
466+ anchors.verticalCenter: parent.verticalCenter
467+ spacing: units.gu(1)
468+
469+ Icon {
470+ height: units.gu(3)
471+ width: height
472+ anchors.verticalCenter: parent.verticalCenter
473+ name: root.note.reminderDone ? "clear" : "select"
474+ }
475+
476+ Label {
477+ id: confirmRemovalDialog
478+ anchors.verticalCenter: parent.verticalCenter
479+ text: root.note.reminderDone ? i18n.tr("Clear reminder") : i18n.tr("Mark as done")
480+ }
481+ }
482
483 property var note
484
485- property bool expanded: false
486-
487- onExpandedChanged: {
488- if (expanded) {
489- if (note.hasReminderTime) {
490- datePicker.date.setDate(note.reminderTime.getDate())
491- }
492- } else {
493- note.save();
494- }
495- }
496-
497 Behavior on height {
498 UbuntuNumberAnimation {}
499 }
500
501+ onItemRemoved: {
502+ // Revert "removal"
503+ root.cancelItemRemoval();
504+ root.height = units.gu(10)
505+ print("marking reminder as", !note.reminderDone, " done for note", note.title);
506+ if (!note.reminderDone) {
507+ note.reminderDone = true;
508+ } else {
509+ note.reminder = false;
510+ }
511+
512+ NotesStore.saveNote(note.guid)
513+ }
514+
515 Column {
516 id: mainColumn
517- anchors { left: parent.left; right: parent.right; top: parent.top; leftMargin: units.gu(2); rightMargin: units.gu(2) }
518+ anchors { left: parent.left; right: parent.right; top: parent.top; topMargin: units.gu(1) }
519 spacing: units.gu(2)
520 height: implicitHeight + units.gu(1)
521
522- Row {
523- anchors { left: parent.left; right: parent.right }
524- height: root.implicitHeight
525- spacing: units.gu(1)
526-
527- CheckBox {
528- id: checkBox
529- anchors.verticalCenter: parent.verticalCenter
530- checked: note.reminderDone
531- onClicked: {
532- note.reminderDone = checked;
533- note.save();
534- }
535- }
536-
537- Label {
538- anchors.verticalCenter: parent.verticalCenter
539- text: note.title
540- width: parent.width - checkBox.width - reminderTimeRow.width - parent.spacing * 2
541- }
542- Row {
543- id: reminderTimeRow
544- anchors { top: parent.top; bottom: parent.bottom }
545- spacing: units.gu(2)
546-
547- Label {
548- id: timeLabel
549- anchors.verticalCenter: parent.verticalCenter
550- text: Qt.formatDate(note.reminderTime)
551- visible: note.hasReminderTime
552- Component.onCompleted: print("Got reminder time", note.reminderTime)
553- }
554- Icon {
555- id: alarmIcon
556- anchors.verticalCenter: parent.verticalCenter
557- width: units.gu(4)
558- height: width
559- name: "alarm-clock"
560-
561- MouseArea {
562- anchors.fill: parent
563- onClicked: root.expanded = !root.expanded;
564- }
565- }
566- }
567- }
568-
569-
570- Row {
571- id: datePicker
572- width: childrenRect.width
573- height: monthPicker.height
574- anchors.horizontalCenter: parent.horizontalCenter
575- spacing: units.gu(1)
576-
577- property var date: new Date()
578- property int minYear: 2010
579- property bool editing: false
580-
581- Picker {
582- id: dayPicker
583- model: getDays(monthPicker.selectedIndex, yearPicker.selectedIndex + 2010)
584- function getDays(month, year) {
585- switch(month) {
586- case 1:
587- if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) {
588- return 29;
589- }
590- return 28;
591- case 3:
592- case 5:
593- case 8:
594- case 10:
595- return 30;
596- default:
597- return 31;
598- }
599- }
600- delegate: PickerDelegate {
601- Label {
602- anchors.centerIn: parent
603- text: modelData + 1
604- }
605- }
606- selectedIndex: datePicker.date.getDate() - 1
607- onSelectedIndexChanged: {
608- datePicker.date.setDate(selectedIndex + 1)
609- }
610- }
611- Picker {
612- id: monthPicker
613- model: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"]
614- delegate: PickerDelegate {
615- Label {
616- anchors.centerIn: parent
617- text: modelData
618- }
619- }
620- selectedIndex: datePicker.date.getMonth()
621- onSelectedIndexChanged: {
622- var selectedDay = dayPicker.selectedIndex;
623- datePicker.date.setMonth(selectedIndex)
624- dayPicker.selectedIndex = selectedDay;
625- }
626- }
627- Picker {
628- id: yearPicker
629- model: 100
630- circular: false
631- delegate: PickerDelegate {
632- Label {
633- anchors.centerIn: parent
634- text: datePicker.minYear + modelData
635- }
636- }
637- selectedIndex: datePicker.date.getFullYear() - datePicker.minYear
638- onSelectedIndexChanged: {
639- var selectedDay = dayPicker.selectedIndex;
640- datePicker.date.setFullYear(selectedIndex + datePicker.minYear)
641- dayPicker.selectedIndex = selectedDay;
642- }
643- }
644- }
645-
646- Row {
647- spacing: units.gu(2)
648- anchors { left: parent.left; right: parent.right }
649- height: childrenRect.height
650-
651- Button {
652- text: "Clear"
653- width: (parent.width - parent.spacing) / 2
654- onClicked: {
655- note.hasReminderTime = false;
656- root.expanded = false;
657- }
658- }
659- Button {
660- text: "OK"
661- width: (parent.width - parent.spacing) / 2
662- onClicked: {
663- print("setting date to ", datePicker.date)
664- note.reminderTime = datePicker.date
665- root.expanded = false;
666+ RowLayout {
667+ anchors { left: parent.left; right: parent.right }
668+ height: units.gu(8)
669+ spacing: units.gu(1)
670+
671+ UbuntuShape {
672+ Layout.fillHeight: true
673+ width: height
674+ color: preferences.colorForNotebook(note.notebookGuid)
675+ radius: "medium"
676+
677+ Column {
678+ anchors.centerIn: parent
679+ Label {
680+ text: note.hasReminderTime ? Qt.formatDateTime(note.reminderTime, "hh") : "00"
681+ color: "white"
682+ horizontalAlignment: Text.AlignHCenter
683+ font.bold: true
684+ fontSize: "large"
685+ }
686+ Label {
687+ text: note.hasReminderTime ? Qt.formatDateTime(note.reminderTime, "mm") : "00"
688+ color: "white"
689+ horizontalAlignment: Text.AlignHCenter
690+ fontSize: "large"
691+ }
692+ }
693+ }
694+
695+ Column {
696+ Layout.fillWidth: true
697+ Layout.fillHeight: true
698+ spacing: units.gu(1)
699+
700+ Label {
701+ text: note.title
702+ fontSize: "large"
703+ horizontalAlignment: Text.AlignLeft
704+ color: "black"
705+ }
706+ Label {
707+ text: note.plaintextContent
708+ fontSize: "small"
709+ horizontalAlignment: Text.AlignLeft
710+ maximumLineCount: 2
711+ width: parent.width
712+ wrapMode: Text.WordWrap
713+ color: "black"
714 }
715 }
716 }
717
718=== modified file 'src/app/qml/reminders.qml'
719--- src/app/qml/reminders.qml 2014-05-07 16:07:59 +0000
720+++ src/app/qml/reminders.qml 2014-05-09 15:03:52 +0000
721@@ -55,8 +55,7 @@
722 }
723 }
724
725- // Temporary background color. This can be changed to other suitable backgrounds when we get official mockup designs
726- backgroundColor: UbuntuColors.coolGrey
727+ backgroundColor: "#dddddd"
728
729 property var accountPage;
730
731@@ -100,7 +99,7 @@
732
733 function doLogin() {
734 print("got accounts:", accounts.count)
735- var accountName = accountPreference.accountName;
736+ var accountName = preferences.accountName;
737 if (accountName) {
738 var i;
739 for (i = 0; i < accounts.count; i++) {
740@@ -160,7 +159,7 @@
741 target: UserStore
742 onUsernameChanged: {
743 print("Logged in as user:", UserStore.username);
744- accountPreference.accountName = UserStore.username;
745+ preferences.accountName = UserStore.username;
746 }
747 }
748
749@@ -231,7 +230,7 @@
750 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))
751 var page = component.createObject();
752 print("opening note page for notebook", notebookGuid)
753- pagestack.push(page, {title: title/*, filter: notebookGuid*/});
754+ pagestack.push(page, {title: title, filter: notebookGuid});
755 page.selectedNoteChanged.connect(function() {
756 print("foo", page.selectedNote);
757 if (page.selectedNote) {
758@@ -250,6 +249,14 @@
759 title: i18n.tr("Reminders")
760 page: RemindersPage {
761 id: remindersPage
762+
763+ onSelectedNoteChanged: {
764+ if (selectedNote !== null) {
765+ root.displayNote(selectedNote);
766+ } else {
767+ sideViewLoader.clear();
768+ }
769+ }
770 }
771 }
772 }
773
774=== modified file 'src/app/qml/ui/NotePage.qml'
775--- src/app/qml/ui/NotePage.qml 2014-05-07 07:45:37 +0000
776+++ src/app/qml/ui/NotePage.qml 2014-05-09 15:03:52 +0000
777@@ -42,8 +42,7 @@
778 text: note.reminder ? "Reminder (set)" : "Reminder"
779 iconName: "alarm-clock"
780 onTriggered: {
781- note.reminder = !note.reminder
782- NotesStore.saveNote(note.guid)
783+ pageStack.push(Qt.resolvedUrl("SetReminderPage.qml"), {title: root.title, note: root.note});
784 }
785 }
786 ToolbarButton {
787
788=== modified file 'src/app/qml/ui/NotebooksPage.qml'
789--- src/app/qml/ui/NotebooksPage.qml 2014-04-30 21:53:07 +0000
790+++ src/app/qml/ui/NotebooksPage.qml 2014-05-09 15:03:52 +0000
791@@ -109,12 +109,9 @@
792 model: notebooks
793 anchors { left: parent.left; right: parent.right }
794 height: parent.height - y - buttonRow.height - keyboardRect.height
795+ clip: true
796
797 delegate: NotebooksDelegate {
798- name: model.name
799- noteCount: model.noteCount
800- shareStatus: model.publised ? i18n.tr("Shared") : i18n.tr("Private")
801-
802 onClicked: {
803 print("selected notebook:", model.guid)
804 root.openNotebook(name, model.guid)
805
806=== modified file 'src/app/qml/ui/NotesPage.qml'
807--- src/app/qml/ui/NotesPage.qml 2014-05-07 08:09:41 +0000
808+++ src/app/qml/ui/NotesPage.qml 2014-05-09 15:03:52 +0000
809@@ -17,6 +17,7 @@
810 */
811
812 import QtQuick 2.0
813+import QtQuick.Layouts 1.0
814 import Ubuntu.Components 0.1
815 import Ubuntu.Components.ListItems 0.1
816 import Evernote 0.1
817@@ -119,6 +120,7 @@
818 creationDate: model.created
819 content: model.plaintextContent
820 resource: model.resourceUrls.length > 0 ? model.resourceUrls[0] : ""
821+ notebookColor: preferences.colorForNotebook(model.notebookGuid)
822
823 Component.onCompleted: {
824 if (!model.plaintextContent) {
825@@ -135,17 +137,15 @@
826 section.property: "createdString"
827 section.delegate: Empty {
828 height: units.gu(5)
829- Item {
830- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: units.gu(1) }
831+ showDivider: false
832+ RowLayout {
833+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: units.gu(2) }
834 Label {
835 text: section
836- anchors.left: parent.left
837- anchors.verticalCenter: parent.verticalCenter
838+ Layout.fillWidth: true
839 }
840 Label {
841 text: "(" + notes.sectionCount("createdString", section) + ")"
842- anchors.right: parent.right
843- anchors.verticalCenter: parent.verticalCenter
844 }
845 }
846 }
847
848=== modified file 'src/app/qml/ui/RemindersPage.qml'
849--- src/app/qml/ui/RemindersPage.qml 2014-04-30 21:53:07 +0000
850+++ src/app/qml/ui/RemindersPage.qml 2014-05-09 15:03:52 +0000
851@@ -17,13 +17,16 @@
852 */
853
854 import QtQuick 2.0
855+import QtQuick.Layouts 1.0
856 import Ubuntu.Components 0.1
857 import Ubuntu.Components.ListItems 0.1
858 import Evernote 0.1
859 import "../components"
860
861 Page {
862- id: remindersPage
863+ id: root
864+
865+ property var selectedNote: null
866
867 tools: ToolbarItems {
868 ToolbarButton {
869@@ -63,16 +66,36 @@
870 anchors.fill: parent
871
872 delegate: RemindersDelegate {
873+ width: remindersListView.width
874 note: notes.note(guid)
875+
876+ Component.onCompleted: {
877+ if (!model.plaintextContent) {
878+ NotesStore.refreshNoteContent(model.guid)
879+ }
880+ }
881+
882+ onClicked: {
883+ root.selectedNote = NotesStore.note(guid);
884+ }
885 }
886
887 model: notes
888
889 section.criteria: ViewSection.FullString
890 section.property: "reminderTimeString"
891- section.delegate: Standard {
892- height: units.gu(3)
893- text: section
894+ section.delegate: Empty {
895+ height: units.gu(5)
896+ RowLayout {
897+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: units.gu(2) }
898+ Label {
899+ text: section
900+ Layout.fillWidth: true
901+ }
902+ Label {
903+ text: "(" + notes.sectionCount("reminderTimeString", section) + ")"
904+ }
905+ }
906 }
907
908 ActivityIndicator {
909
910=== added file 'src/app/qml/ui/SetReminderPage.qml'
911--- src/app/qml/ui/SetReminderPage.qml 1970-01-01 00:00:00 +0000
912+++ src/app/qml/ui/SetReminderPage.qml 2014-05-09 15:03:52 +0000
913@@ -0,0 +1,35 @@
914+/*
915+ * Copyright: 2013 Canonical, Ltd
916+ *
917+ * This file is part of reminders
918+ *
919+ * reminders is free software: you can redistribute it and/or modify
920+ * it under the terms of the GNU General Public License as published by
921+ * the Free Software Foundation; version 3.
922+ *
923+ * reminders is distributed in the hope that it will be useful,
924+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
925+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
926+ * GNU General Public License for more details.
927+ *
928+ * You should have received a copy of the GNU General Public License
929+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
930+ */
931+
932+import QtQuick 2.0
933+import Ubuntu.Components 0.1
934+import Evernote 0.1
935+import "../components"
936+
937+Page {
938+ id: root
939+ title: setReminderView.title
940+ property alias note: setReminderView.note
941+
942+ signal editNote(var note)
943+
944+ SetReminderView {
945+ id: setReminderView
946+ anchors.fill: parent
947+ }
948+}
949
950=== added file 'src/app/qml/ui/SetReminderView.qml'
951--- src/app/qml/ui/SetReminderView.qml 1970-01-01 00:00:00 +0000
952+++ src/app/qml/ui/SetReminderView.qml 2014-05-09 15:03:52 +0000
953@@ -0,0 +1,82 @@
954+/*
955+ * Copyright: 2013 Canonical, Ltd
956+ *
957+ * This file is part of reminders
958+ *
959+ * reminders is free software: you can redistribute it and/or modify
960+ * it under the terms of the GNU General Public License as published by
961+ * the Free Software Foundation; version 3.
962+ *
963+ * reminders is distributed in the hope that it will be useful,
964+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
965+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
966+ * GNU General Public License for more details.
967+ *
968+ * You should have received a copy of the GNU General Public License
969+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
970+ */
971+
972+import QtQuick 2.0
973+import QtQuick.Layouts 1.0
974+import Ubuntu.Components 0.1
975+import Ubuntu.Components.Pickers 0.1
976+import Evernote 0.1
977+import "../components"
978+
979+Item {
980+ id: root
981+ property string title: note.title
982+ property var note
983+
984+ ColumnLayout {
985+ anchors { top: parent.top; topMargin: units.gu(2); horizontalCenter: parent.horizontalCenter }
986+ spacing: units.gu(2)
987+
988+ Label {
989+ text: i18n.tr("Select date and time for the reminder:")
990+ Layout.fillWidth: true
991+ }
992+
993+ DatePicker {
994+ id: datePicker
995+ date: note.hasReminderTime ? note.reminderTime : new Date()
996+ }
997+
998+ DatePicker {
999+ id: timePicker
1000+ mode: "Hours|Minutes"
1001+ date: note.hasReminderTime ? note.reminderTime : new Date()
1002+ }
1003+
1004+ RowLayout {
1005+ Layout.fillWidth: true
1006+
1007+ Button {
1008+ text: i18n.tr("Clear reminder")
1009+ Layout.fillWidth: true
1010+ onClicked: {
1011+ note.reminder = false;
1012+ NotesStore.saveNote(note.guid);
1013+ pageStack.pop();
1014+ }
1015+ }
1016+
1017+ Button {
1018+ Layout.fillWidth: true
1019+ text: i18n.tr("Set reminder")
1020+ onClicked: {
1021+ note.reminder = true;
1022+ var date = datePicker.date
1023+ var time = timePicker.date
1024+ date.setHours(time.getHours());
1025+ date.setMinutes(time.getMinutes());
1026+ note.reminderTime = date;
1027+ print("set reminder time to", Qt.formatDate(date))
1028+ NotesStore.saveNote(note.guid)
1029+ pageStack.pop();
1030+ }
1031+ }
1032+
1033+ }
1034+ }
1035+}
1036
1037=== modified file 'src/plugin/Evernote/note.cpp'
1038--- src/plugin/Evernote/note.cpp 2014-05-06 16:44:19 +0000
1039+++ src/plugin/Evernote/note.cpp 2014-05-09 15:03:52 +0000
1040@@ -140,7 +140,7 @@
1041
1042 QString Note::plaintextContent() const
1043 {
1044- return m_content.toPlaintext();
1045+ return m_content.toPlaintext().trimmed();
1046 }
1047
1048 bool Note::reminder() const
1049@@ -223,8 +223,15 @@
1050 return QString();
1051 }
1052
1053+ if (reminderDone()) {
1054+ return gettext("Done");
1055+ }
1056+
1057 QDate reminderDate = m_reminderTime.date();
1058 QDate today = QDate::currentDate();
1059+ if (m_reminderTime.isNull()) {
1060+ return gettext("No date");
1061+ }
1062 if (reminderDate < today) {
1063 return gettext("Overdue");
1064 }
1065
1066=== modified file 'src/plugin/Evernote/notebook.cpp'
1067--- src/plugin/Evernote/notebook.cpp 2014-02-18 14:04:33 +0000
1068+++ src/plugin/Evernote/notebook.cpp 2014-05-09 15:03:52 +0000
1069@@ -22,6 +22,8 @@
1070 #include "notesstore.h"
1071 #include "note.h"
1072
1073+#include <libintl.h>
1074+
1075 #include <QDebug>
1076
1077 Notebook::Notebook(QString guid, QObject *parent) :
1078@@ -75,6 +77,44 @@
1079 }
1080 }
1081
1082+QDateTime Notebook::lastUpdated() const
1083+{
1084+ return m_lastUpdated;
1085+}
1086+
1087+void Notebook::setLastUpdated(const QDateTime &lastUpdated)
1088+{
1089+ if (m_lastUpdated != lastUpdated) {
1090+ m_lastUpdated = lastUpdated;
1091+ emit lastUpdatedChanged();
1092+ }
1093+}
1094+
1095+QString Notebook::lastUpdatedString() const
1096+{
1097+ QDate updateDate = m_lastUpdated.date();
1098+ QDate today = QDate::currentDate();
1099+ if (updateDate == today) {
1100+ // TRANSLATORS: this is part of a longer string - "Last updated: today"
1101+ return gettext("today");
1102+ }
1103+ if (updateDate == today.addDays(-1)) {
1104+ // TRANSLATORS: this is part of a longer string - "Last updated: yesterday"
1105+ return gettext("yesterday");
1106+ }
1107+ if (updateDate <= today.addDays(-7)) {
1108+ // TRANSLATORS: this is part of a longer string - "Last updated: last week"
1109+ return gettext("last week");
1110+ }
1111+ if (updateDate <= today.addDays(-14)) {
1112+ // TRANSLATORS: this is part of a longer string - "Last updated: two weeks ago"
1113+ return gettext("two weeks ago");
1114+ }
1115+ // TRANSLATORS: this is used in the notes list to group notes created on the same month
1116+ // the first parameter refers to a month name and the second to a year
1117+ return QString(gettext("on %1 %2")).arg(QLocale::system().standaloneMonthName(updateDate.month())).arg(updateDate.year());
1118+}
1119+
1120 void Notebook::noteAdded(const QString &noteGuid, const QString &notebookGuid)
1121 {
1122 Q_UNUSED(noteGuid)
1123
1124=== modified file 'src/plugin/Evernote/notebook.h'
1125--- src/plugin/Evernote/notebook.h 2014-01-27 13:00:41 +0000
1126+++ src/plugin/Evernote/notebook.h 2014-05-09 15:03:52 +0000
1127@@ -22,6 +22,7 @@
1128 #define NOTEBOOK_H
1129
1130 #include <QObject>
1131+#include <QDateTime>
1132
1133 class Notebook : public QObject
1134 {
1135@@ -31,6 +32,8 @@
1136 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
1137 Q_PROPERTY(int noteCount READ noteCount NOTIFY noteCountChanged)
1138 Q_PROPERTY(bool published READ published NOTIFY publishedChanged)
1139+ Q_PROPERTY(QDateTime lastUpdated READ lastUpdated NOTIFY lastUpdatedChanged)
1140+ Q_PROPERTY(QString lastUpdatedString READ lastUpdatedString NOTIFY lastUpdatedChanged)
1141
1142 public:
1143 explicit Notebook(QString guid, QObject *parent = 0);
1144@@ -45,10 +48,16 @@
1145 bool published() const;
1146 void setPublished(bool published);
1147
1148+ QDateTime lastUpdated() const;
1149+ void setLastUpdated(const QDateTime &lastUpdated);
1150+
1151+ QString lastUpdatedString() const;
1152+
1153 signals:
1154 void nameChanged();
1155 void noteCountChanged();
1156 void publishedChanged();
1157+ void lastUpdatedChanged();
1158
1159 private slots:
1160 void noteAdded(const QString &noteGuid, const QString &notebookGuid);
1161@@ -59,6 +68,7 @@
1162 QString m_name;
1163 int m_noteCount;
1164 bool m_published;
1165+ QDateTime m_lastUpdated;
1166 };
1167
1168 #endif // NOTEBOOK_H
1169
1170=== modified file 'src/plugin/Evernote/notebooks.cpp'
1171--- src/plugin/Evernote/notebooks.cpp 2014-04-30 21:53:07 +0000
1172+++ src/plugin/Evernote/notebooks.cpp 2014-05-09 15:03:52 +0000
1173@@ -59,6 +59,10 @@
1174 return notebook->noteCount();
1175 case RolePublished:
1176 return notebook->published();
1177+ case RoleLastUpdated:
1178+ return notebook->lastUpdated();
1179+ case RoleLastUpdatedString:
1180+ return notebook->lastUpdatedString();
1181 }
1182 return QVariant();
1183 }
1184@@ -75,7 +79,9 @@
1185 roles.insert(RoleGuid, "guid");
1186 roles.insert(RoleName, "name");
1187 roles.insert(RoleNoteCount, "noteCount");
1188- roles.insert(RolePublished, "publised");
1189+ roles.insert(RolePublished, "published");
1190+ roles.insert(RoleLastUpdated, "lastUpdated");
1191+ roles.insert(RoleLastUpdatedString, "lastUpdatedString");
1192 return roles;
1193 }
1194
1195
1196=== modified file 'src/plugin/Evernote/notebooks.h'
1197--- src/plugin/Evernote/notebooks.h 2014-04-30 21:53:07 +0000
1198+++ src/plugin/Evernote/notebooks.h 2014-05-09 15:03:52 +0000
1199@@ -36,7 +36,9 @@
1200 RoleGuid,
1201 RoleName,
1202 RoleNoteCount,
1203- RolePublished
1204+ RolePublished,
1205+ RoleLastUpdated,
1206+ RoleLastUpdatedString
1207 };
1208 explicit Notebooks(QObject *parent = 0);
1209
1210
1211=== modified file 'src/plugin/Evernote/notes.cpp'
1212--- src/plugin/Evernote/notes.cpp 2014-05-06 16:22:06 +0000
1213+++ src/plugin/Evernote/notes.cpp 2014-05-09 15:03:52 +0000
1214@@ -59,11 +59,12 @@
1215 m_onlyReminders = onlyReminders;
1216 emit onlyRemindersChanged();
1217 if (onlyReminders) {
1218- setSortRole(NotesStore::RoleReminderTime);
1219+ setSortRole(NotesStore::RoleReminderSorting);
1220+ sort(0, Qt::AscendingOrder);
1221 } else {
1222 setSortRole(NotesStore::RoleCreated);
1223+ sort(0, Qt::DescendingOrder);
1224 }
1225- sort(0, Qt::AscendingOrder);
1226
1227 invalidateFilter();
1228 }
1229
1230=== modified file 'src/plugin/Evernote/notesstore.cpp'
1231--- src/plugin/Evernote/notesstore.cpp 2014-05-06 21:21:14 +0000
1232+++ src/plugin/Evernote/notesstore.cpp 2014-05-09 15:03:52 +0000
1233@@ -121,6 +121,10 @@
1234 return m_notes.at(index.row())->plaintextContent();
1235 case RoleResourceUrls:
1236 return m_notes.at(index.row())->resourceUrls();
1237+ case RoleReminderSorting:
1238+ // done reminders get +1000000000000 (this will break sorting in year 2286 :P)
1239+ return QVariant::fromValue(m_notes.at(index.row())->reminderTime().toMSecsSinceEpoch() +
1240+ (m_notes.at(index.row())->reminderDone() ? 10000000000000 : 0));
1241 }
1242 return QVariant();
1243 }
1244@@ -227,6 +231,8 @@
1245 QString guid = QString::fromStdString(result.guid);
1246 QDateTime created = QDateTime::fromMSecsSinceEpoch(result.created);
1247 note = new Note(guid, created, this);
1248+ connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged);
1249+ connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged);
1250 }
1251
1252 note->setTitle(QString::fromStdString(result.title));
1253@@ -377,6 +383,7 @@
1254 }
1255 notebook->setName(QString::fromStdString(result.name));
1256 notebook->setPublished(result.published);
1257+ notebook->setLastUpdated(QDateTime::fromMSecsSinceEpoch(result.serviceUpdated));
1258
1259 if (newNoteNotebook) {
1260 m_notebooksHash.insert(notebook->guid(), notebook);
1261@@ -412,6 +419,8 @@
1262 QString guid = QString::fromStdString(result.guid);
1263 QDateTime created = QDateTime::fromMSecsSinceEpoch(result.created);
1264 Note *note = new Note(guid, created, this);
1265+ connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged);
1266+ connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged);
1267 note->setNotebookGuid(QString::fromStdString(result.notebookGuid));
1268 note->setTitle(QString::fromStdString(result.title));
1269 note->setEnmlContent(QString::fromStdString(result.content));
1270@@ -428,6 +437,10 @@
1271 void NotesStore::saveNote(const QString &guid)
1272 {
1273 Note *note = m_notesHash.value(guid);
1274+ if (!note) {
1275+ qWarning() << "Can't save note. Guid not found:" << guid;
1276+ return;
1277+ }
1278 SaveNoteJob *job = new SaveNoteJob(note, this);
1279 connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone);
1280 EvernoteConnection::instance()->enqueue(job);
1281@@ -512,3 +525,13 @@
1282 m_notebooks.removeAll(notebook);
1283 notebook->deleteLater();
1284 }
1285+
1286+void NotesStore::emitDataChanged()
1287+{
1288+ Note *note = qobject_cast<Note*>(sender());
1289+ if (!note) {
1290+ return;
1291+ }
1292+ int idx = m_notes.indexOf(note);
1293+ emit dataChanged(index(idx), index(idx));
1294+}
1295
1296=== modified file 'src/plugin/Evernote/notesstore.h'
1297--- src/plugin/Evernote/notesstore.h 2014-05-06 21:21:14 +0000
1298+++ src/plugin/Evernote/notesstore.h 2014-05-09 15:03:52 +0000
1299@@ -69,7 +69,8 @@
1300 RoleHtmlContent,
1301 RoleRichTextContent,
1302 RolePlaintextContent,
1303- RoleResourceUrls
1304+ RoleResourceUrls,
1305+ RoleReminderSorting
1306 };
1307
1308 ~NotesStore();
1309@@ -131,6 +132,7 @@
1310 void createNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result);
1311 void expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid);
1312
1313+ void emitDataChanged();
1314 private:
1315 explicit NotesStore(QObject *parent = 0);
1316 static NotesStore *s_instance;

Subscribers

People subscribed via source and target branches