Merge lp:~mzanetti/reminders-app/notesdelegate into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 27
Merged at revision: 21
Proposed branch: lp:~mzanetti/reminders-app/notesdelegate
Merge into: lp:reminders-app
Prerequisite: lp:~mzanetti/reminders-app/find-notes
Diff against target: 262 lines (+112/-6)
11 files modified
src/app/app.pro (+1/-0)
src/app/qml/components/NotesDelegate.qml (+56/-0)
src/app/qml/ui/NotePage.qml (+2/-0)
src/app/qml/ui/NotesPage.qml (+5/-2)
src/app/qml/ui/SearchNotesPage.qml (+9/-2)
src/plugin/Evernote/jobs/fetchnotejob.cpp (+1/-1)
src/plugin/Evernote/note.cpp (+9/-0)
src/plugin/Evernote/note.h (+5/-0)
src/plugin/Evernote/notesstore.cpp (+0/-1)
src/plugin/Evernote/utils/html2enmlconverter.cpp (+22/-0)
src/plugin/Evernote/utils/html2enmlconverter.h (+2/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/notesdelegate
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Notes app developers Pending
Review via email: mp+199013@code.launchpad.net

This proposal supersedes a proposal from 2013-12-13.

Commit message

added a NotesDelegate to roughly reflect design wireframe

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:27
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/notesdelegate/+merge/199013/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/39/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-trusty/442
    FAILURE: http://91.189.93.70:8080/job/reminders-app-saucy-amd64-ci/39/console
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-trusty-amd64-ci/39

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

review: Needs Fixing (continuous-integration)
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
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/app.pro'
--- src/app/app.pro 2013-12-14 00:08:13 +0000
+++ src/app/app.pro 2013-12-14 00:08:13 +0000
@@ -13,6 +13,7 @@
13 qml/ui/NotePage.qml \13 qml/ui/NotePage.qml \
14 qml/ui/SearchNotesPage.qml \14 qml/ui/SearchNotesPage.qml \
15 qml/components/ToolbarSpacer.qml \15 qml/components/ToolbarSpacer.qml \
16 qml/components/NotesDelegate.qml \
1617
17# Copy qml to build dir for running with qtcreator18# Copy qml to build dir for running with qtcreator
18qmlfolder.source = src/app/qml19qmlfolder.source = src/app/qml
1920
=== added file 'src/app/qml/components/NotesDelegate.qml'
--- src/app/qml/components/NotesDelegate.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/components/NotesDelegate.qml 2013-12-14 00:08:13 +0000
@@ -0,0 +1,56 @@
1/*
2 * Copyright: 2013 Canonical, Ltd
3 *
4 * This file is part of reminders-app
5 *
6 * reminders-app is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * reminders-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 0.1
21import Ubuntu.Components.ListItems 0.1
22
23Empty {
24 id: root
25 height: units.gu(9)
26
27 property string title
28 property date creationDate
29 property string content
30
31 Column {
32 id: contentColumn
33 spacing: units.gu(1)
34 anchors {
35 top: parent.top
36 topMargin: units.gu(1)
37 left: parent.left
38 leftMargin: units.gu(2)
39 right: parent.right
40 rightMargin: units.gu(2)
41 }
42 Label {
43 anchors { left: parent.left; right: parent.right }
44 text: root.title
45 font.bold: true
46 elide: Text.ElideRight
47 }
48 Label {
49 anchors { left: parent.left; right: parent.right }
50 text: "<font color=\"#dd4814\">"+ Qt.formatDate(root.creationDate) + "</font> " + root.content
51 wrapMode: Text.WordWrap
52 textFormat: Text.StyledText
53 maximumLineCount: 2
54 }
55 }
56}
057
=== modified file 'src/app/qml/ui/NotePage.qml'
--- src/app/qml/ui/NotePage.qml 2013-11-26 17:18:33 +0000
+++ src/app/qml/ui/NotePage.qml 2013-12-14 00:08:13 +0000
@@ -24,6 +24,8 @@
24 title: note.title24 title: note.title
25 property var note25 property var note
2626
27 Component.onCompleted: NotesStore.refreshNoteContent(note.guid)
28
27 Column {29 Column {
28 anchors.fill: parent30 anchors.fill: parent
29 spacing: units.gu(1)31 spacing: units.gu(1)
3032
=== modified file 'src/app/qml/ui/NotesPage.qml'
--- src/app/qml/ui/NotesPage.qml 2013-12-14 00:08:13 +0000
+++ src/app/qml/ui/NotesPage.qml 2013-12-14 00:08:13 +0000
@@ -65,9 +65,12 @@
65 anchors { left: parent.left; right: parent.right }65 anchors { left: parent.left; right: parent.right }
66 height: parent.height - y66 height: parent.height - y
67 model: notes67 model: notes
68 clip: true
6869
69 delegate: Standard {70 delegate: NotesDelegate {
70 text: title71 title: model.title
72 creationDate: model.created
73 content: NotesStore.note(model.guid).plaintextContent
7174
72 onClicked: {75 onClicked: {
73 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})76 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
7477
=== modified file 'src/app/qml/ui/SearchNotesPage.qml'
--- src/app/qml/ui/SearchNotesPage.qml 2013-12-14 00:08:13 +0000
+++ src/app/qml/ui/SearchNotesPage.qml 2013-12-14 00:08:13 +0000
@@ -59,13 +59,20 @@
59 ListView {59 ListView {
60 anchors { left: parent.left; right: parent.right }60 anchors { left: parent.left; right: parent.right }
61 height: parent.height - y61 height: parent.height - y
62 clip: true
6263
63 model: Notes {64 model: Notes {
64 onlySearchResults: true65 onlySearchResults: true
65 }66 }
6667
67 delegate: Standard {68 delegate: NotesDelegate {
68 text: title69 title: model.title
70 creationDate: model.created
71 content: NotesStore.note(model.guid).plaintextContent
72
73 onClicked: {
74 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
75 }
69 }76 }
70 }77 }
7178
7279
=== modified file 'src/plugin/Evernote/jobs/fetchnotejob.cpp'
--- src/plugin/Evernote/jobs/fetchnotejob.cpp 2013-12-14 00:08:13 +0000
+++ src/plugin/Evernote/jobs/fetchnotejob.cpp 2013-12-14 00:08:13 +0000
@@ -28,7 +28,7 @@
2828
29void FetchNoteJob::startJob()29void FetchNoteJob::startJob()
30{30{
31 client()->getNote(m_result, token().toStdString(), m_guid.toStdString(), true, true, false, false);31 client()->getNote(m_result, token().toStdString(), m_guid.toStdString(), true, false, false, false);
32}32}
3333
34void FetchNoteJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage)34void FetchNoteJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage)
3535
=== modified file 'src/plugin/Evernote/note.cpp'
--- src/plugin/Evernote/note.cpp 2013-12-14 00:08:13 +0000
+++ src/plugin/Evernote/note.cpp 2013-12-14 00:08:13 +0000
@@ -21,8 +21,10 @@
21#include "note.h"21#include "note.h"
2222
23#include "notesstore.h"23#include "notesstore.h"
24#include "utils/html2enmlconverter.h"
2425
25#include <QDateTime>26#include <QDateTime>
27#include <QDebug>
2628
27Note::Note(const QString &guid, const QDateTime &created, QObject *parent) :29Note::Note(const QString &guid, const QDateTime &created, QObject *parent) :
28 QObject(parent),30 QObject(parent),
@@ -77,10 +79,17 @@
77{79{
78 if (m_content != content) {80 if (m_content != content) {
79 m_content = content;81 m_content = content;
82 m_plaintextContent = Html2EnmlConverter::enml2plaintext(content);
83 qDebug() << "plaintext content is" << m_plaintextContent;
80 emit contentChanged();84 emit contentChanged();
81 }85 }
82}86}
8387
88QString Note::plaintextContent() const
89{
90 return m_plaintextContent;
91}
92
84bool Note::reminder() const93bool Note::reminder() const
85{94{
86 return m_reminderOrder > 0;95 return m_reminderOrder > 0;
8796
=== modified file 'src/plugin/Evernote/note.h'
--- src/plugin/Evernote/note.h 2013-12-14 00:08:13 +0000
+++ src/plugin/Evernote/note.h 2013-12-14 00:08:13 +0000
@@ -15,6 +15,7 @@
15 Q_PROPERTY(QDateTime created READ created CONSTANT)15 Q_PROPERTY(QDateTime created READ created CONSTANT)
16 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)16 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
17 Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged)17 Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged)
18 Q_PROPERTY(QString plaintextContent READ plaintextContent NOTIFY contentChanged)
18 Q_PROPERTY(bool reminder READ reminder WRITE setReminder NOTIFY reminderChanged)19 Q_PROPERTY(bool reminder READ reminder WRITE setReminder NOTIFY reminderChanged)
19 Q_PROPERTY(QDateTime reminderTime READ reminderTime WRITE setReminderTime NOTIFY reminderTimeChanged)20 Q_PROPERTY(QDateTime reminderTime READ reminderTime WRITE setReminderTime NOTIFY reminderTimeChanged)
20 Q_PROPERTY(bool reminderDone READ reminderDone WRITE setReminderDone NOTIFY reminderDoneChanged)21 Q_PROPERTY(bool reminderDone READ reminderDone WRITE setReminderDone NOTIFY reminderDoneChanged)
@@ -38,6 +39,9 @@
38 QString content() const;39 QString content() const;
39 void setContent(const QString &content);40 void setContent(const QString &content);
4041
42 QString plaintextContent() const;
43 void setPlaintextContent(const QString &plaintextContent);
44
41 // This is the QML representation as we don't want to deal with timestamps there.45 // This is the QML representation as we don't want to deal with timestamps there.
42 // setting it to false will reset the reminderOrder to 0, setting it to true will46 // setting it to false will reset the reminderOrder to 0, setting it to true will
43 // create a new timestamp for it.47 // create a new timestamp for it.
@@ -83,6 +87,7 @@
83 QDateTime m_created;87 QDateTime m_created;
84 QString m_title;88 QString m_title;
85 QString m_content;89 QString m_content;
90 QString m_plaintextContent;
86 qint64 m_reminderOrder;91 qint64 m_reminderOrder;
87 QDateTime m_reminderTime;92 QDateTime m_reminderTime;
88 QDateTime m_reminderDoneTime;93 QDateTime m_reminderDoneTime;
8994
=== modified file 'src/plugin/Evernote/notesstore.cpp'
--- src/plugin/Evernote/notesstore.cpp 2013-12-14 00:08:13 +0000
+++ src/plugin/Evernote/notesstore.cpp 2013-12-14 00:08:13 +0000
@@ -113,7 +113,6 @@
113113
114Note *NotesStore::note(const QString &guid)114Note *NotesStore::note(const QString &guid)
115{115{
116 refreshNoteContent(guid);
117 return m_notesHash.value(guid);116 return m_notesHash.value(guid);
118}117}
119118
120119
=== modified file 'src/plugin/Evernote/utils/html2enmlconverter.cpp'
--- src/plugin/Evernote/utils/html2enmlconverter.cpp 2013-11-25 19:06:38 +0000
+++ src/plugin/Evernote/utils/html2enmlconverter.cpp 2013-12-14 00:08:13 +0000
@@ -82,3 +82,25 @@
8282
83 return evml;83 return evml;
84}84}
85
86QString Html2EnmlConverter::enml2plaintext(const QString &enml)
87{
88 // output
89 QString plaintext;
90
91 // input
92 QXmlStreamReader reader(enml);
93
94 while (!reader.atEnd() && !reader.hasError()) {
95 QXmlStreamReader::TokenType token = reader.readNext();
96
97 // Write all normal text inside <body> </body> to output
98 if (token == QXmlStreamReader::Characters) {
99 plaintext.append(reader.text().toString());
100 plaintext.append(' ');
101 }
102 }
103
104 plaintext.remove('\n');
105 return plaintext;
106}
85107
=== modified file 'src/plugin/Evernote/utils/html2enmlconverter.h'
--- src/plugin/Evernote/utils/html2enmlconverter.h 2013-11-25 19:06:38 +0000
+++ src/plugin/Evernote/utils/html2enmlconverter.h 2013-12-14 00:08:13 +0000
@@ -9,6 +9,8 @@
9 Html2EnmlConverter();9 Html2EnmlConverter();
1010
11 static QString html2enml(const QString &html);11 static QString html2enml(const QString &html);
12
13 static QString enml2plaintext(const QString &enml);
12};14};
1315
14#endif // HTML2ENMLCONVERTER_H16#endif // HTML2ENMLCONVERTER_H

Subscribers

People subscribed via source and target branches