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
1=== modified file 'src/app/app.pro'
2--- src/app/app.pro 2013-12-14 00:08:13 +0000
3+++ src/app/app.pro 2013-12-14 00:08:13 +0000
4@@ -13,6 +13,7 @@
5 qml/ui/NotePage.qml \
6 qml/ui/SearchNotesPage.qml \
7 qml/components/ToolbarSpacer.qml \
8+ qml/components/NotesDelegate.qml \
9
10 # Copy qml to build dir for running with qtcreator
11 qmlfolder.source = src/app/qml
12
13=== added file 'src/app/qml/components/NotesDelegate.qml'
14--- src/app/qml/components/NotesDelegate.qml 1970-01-01 00:00:00 +0000
15+++ src/app/qml/components/NotesDelegate.qml 2013-12-14 00:08:13 +0000
16@@ -0,0 +1,56 @@
17+/*
18+ * Copyright: 2013 Canonical, Ltd
19+ *
20+ * This file is part of reminders-app
21+ *
22+ * reminders-app is free software: you can redistribute it and/or modify
23+ * it under the terms of the GNU General Public License as published by
24+ * the Free Software Foundation; version 3.
25+ *
26+ * reminders-app is distributed in the hope that it will be useful,
27+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+ * GNU General Public License for more details.
30+ *
31+ * You should have received a copy of the GNU General Public License
32+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33+ */
34+
35+import QtQuick 2.0
36+import Ubuntu.Components 0.1
37+import Ubuntu.Components.ListItems 0.1
38+
39+Empty {
40+ id: root
41+ height: units.gu(9)
42+
43+ property string title
44+ property date creationDate
45+ property string content
46+
47+ Column {
48+ id: contentColumn
49+ spacing: units.gu(1)
50+ anchors {
51+ top: parent.top
52+ topMargin: units.gu(1)
53+ left: parent.left
54+ leftMargin: units.gu(2)
55+ right: parent.right
56+ rightMargin: units.gu(2)
57+ }
58+ Label {
59+ anchors { left: parent.left; right: parent.right }
60+ text: root.title
61+ font.bold: true
62+ elide: Text.ElideRight
63+ }
64+ Label {
65+ anchors { left: parent.left; right: parent.right }
66+ text: "<font color=\"#dd4814\">"+ Qt.formatDate(root.creationDate) + "</font> " + root.content
67+ wrapMode: Text.WordWrap
68+ textFormat: Text.StyledText
69+ maximumLineCount: 2
70+ }
71+ }
72+}
73
74=== modified file 'src/app/qml/ui/NotePage.qml'
75--- src/app/qml/ui/NotePage.qml 2013-11-26 17:18:33 +0000
76+++ src/app/qml/ui/NotePage.qml 2013-12-14 00:08:13 +0000
77@@ -24,6 +24,8 @@
78 title: note.title
79 property var note
80
81+ Component.onCompleted: NotesStore.refreshNoteContent(note.guid)
82+
83 Column {
84 anchors.fill: parent
85 spacing: units.gu(1)
86
87=== modified file 'src/app/qml/ui/NotesPage.qml'
88--- src/app/qml/ui/NotesPage.qml 2013-12-14 00:08:13 +0000
89+++ src/app/qml/ui/NotesPage.qml 2013-12-14 00:08:13 +0000
90@@ -65,9 +65,12 @@
91 anchors { left: parent.left; right: parent.right }
92 height: parent.height - y
93 model: notes
94+ clip: true
95
96- delegate: Standard {
97- text: title
98+ delegate: NotesDelegate {
99+ title: model.title
100+ creationDate: model.created
101+ content: NotesStore.note(model.guid).plaintextContent
102
103 onClicked: {
104 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
105
106=== modified file 'src/app/qml/ui/SearchNotesPage.qml'
107--- src/app/qml/ui/SearchNotesPage.qml 2013-12-14 00:08:13 +0000
108+++ src/app/qml/ui/SearchNotesPage.qml 2013-12-14 00:08:13 +0000
109@@ -59,13 +59,20 @@
110 ListView {
111 anchors { left: parent.left; right: parent.right }
112 height: parent.height - y
113+ clip: true
114
115 model: Notes {
116 onlySearchResults: true
117 }
118
119- delegate: Standard {
120- text: title
121+ delegate: NotesDelegate {
122+ title: model.title
123+ creationDate: model.created
124+ content: NotesStore.note(model.guid).plaintextContent
125+
126+ onClicked: {
127+ pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
128+ }
129 }
130 }
131
132
133=== modified file 'src/plugin/Evernote/jobs/fetchnotejob.cpp'
134--- src/plugin/Evernote/jobs/fetchnotejob.cpp 2013-12-14 00:08:13 +0000
135+++ src/plugin/Evernote/jobs/fetchnotejob.cpp 2013-12-14 00:08:13 +0000
136@@ -28,7 +28,7 @@
137
138 void FetchNoteJob::startJob()
139 {
140- client()->getNote(m_result, token().toStdString(), m_guid.toStdString(), true, true, false, false);
141+ client()->getNote(m_result, token().toStdString(), m_guid.toStdString(), true, false, false, false);
142 }
143
144 void FetchNoteJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage)
145
146=== modified file 'src/plugin/Evernote/note.cpp'
147--- src/plugin/Evernote/note.cpp 2013-12-14 00:08:13 +0000
148+++ src/plugin/Evernote/note.cpp 2013-12-14 00:08:13 +0000
149@@ -21,8 +21,10 @@
150 #include "note.h"
151
152 #include "notesstore.h"
153+#include "utils/html2enmlconverter.h"
154
155 #include <QDateTime>
156+#include <QDebug>
157
158 Note::Note(const QString &guid, const QDateTime &created, QObject *parent) :
159 QObject(parent),
160@@ -77,10 +79,17 @@
161 {
162 if (m_content != content) {
163 m_content = content;
164+ m_plaintextContent = Html2EnmlConverter::enml2plaintext(content);
165+ qDebug() << "plaintext content is" << m_plaintextContent;
166 emit contentChanged();
167 }
168 }
169
170+QString Note::plaintextContent() const
171+{
172+ return m_plaintextContent;
173+}
174+
175 bool Note::reminder() const
176 {
177 return m_reminderOrder > 0;
178
179=== modified file 'src/plugin/Evernote/note.h'
180--- src/plugin/Evernote/note.h 2013-12-14 00:08:13 +0000
181+++ src/plugin/Evernote/note.h 2013-12-14 00:08:13 +0000
182@@ -15,6 +15,7 @@
183 Q_PROPERTY(QDateTime created READ created CONSTANT)
184 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
185 Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged)
186+ Q_PROPERTY(QString plaintextContent READ plaintextContent NOTIFY contentChanged)
187 Q_PROPERTY(bool reminder READ reminder WRITE setReminder NOTIFY reminderChanged)
188 Q_PROPERTY(QDateTime reminderTime READ reminderTime WRITE setReminderTime NOTIFY reminderTimeChanged)
189 Q_PROPERTY(bool reminderDone READ reminderDone WRITE setReminderDone NOTIFY reminderDoneChanged)
190@@ -38,6 +39,9 @@
191 QString content() const;
192 void setContent(const QString &content);
193
194+ QString plaintextContent() const;
195+ void setPlaintextContent(const QString &plaintextContent);
196+
197 // This is the QML representation as we don't want to deal with timestamps there.
198 // setting it to false will reset the reminderOrder to 0, setting it to true will
199 // create a new timestamp for it.
200@@ -83,6 +87,7 @@
201 QDateTime m_created;
202 QString m_title;
203 QString m_content;
204+ QString m_plaintextContent;
205 qint64 m_reminderOrder;
206 QDateTime m_reminderTime;
207 QDateTime m_reminderDoneTime;
208
209=== modified file 'src/plugin/Evernote/notesstore.cpp'
210--- src/plugin/Evernote/notesstore.cpp 2013-12-14 00:08:13 +0000
211+++ src/plugin/Evernote/notesstore.cpp 2013-12-14 00:08:13 +0000
212@@ -113,7 +113,6 @@
213
214 Note *NotesStore::note(const QString &guid)
215 {
216- refreshNoteContent(guid);
217 return m_notesHash.value(guid);
218 }
219
220
221=== modified file 'src/plugin/Evernote/utils/html2enmlconverter.cpp'
222--- src/plugin/Evernote/utils/html2enmlconverter.cpp 2013-11-25 19:06:38 +0000
223+++ src/plugin/Evernote/utils/html2enmlconverter.cpp 2013-12-14 00:08:13 +0000
224@@ -82,3 +82,25 @@
225
226 return evml;
227 }
228+
229+QString Html2EnmlConverter::enml2plaintext(const QString &enml)
230+{
231+ // output
232+ QString plaintext;
233+
234+ // input
235+ QXmlStreamReader reader(enml);
236+
237+ while (!reader.atEnd() && !reader.hasError()) {
238+ QXmlStreamReader::TokenType token = reader.readNext();
239+
240+ // Write all normal text inside <body> </body> to output
241+ if (token == QXmlStreamReader::Characters) {
242+ plaintext.append(reader.text().toString());
243+ plaintext.append(' ');
244+ }
245+ }
246+
247+ plaintext.remove('\n');
248+ return plaintext;
249+}
250
251=== modified file 'src/plugin/Evernote/utils/html2enmlconverter.h'
252--- src/plugin/Evernote/utils/html2enmlconverter.h 2013-11-25 19:06:38 +0000
253+++ src/plugin/Evernote/utils/html2enmlconverter.h 2013-12-14 00:08:13 +0000
254@@ -9,6 +9,8 @@
255 Html2EnmlConverter();
256
257 static QString html2enml(const QString &html);
258+
259+ static QString enml2plaintext(const QString &enml);
260 };
261
262 #endif // HTML2ENMLCONVERTER_H

Subscribers

People subscribed via source and target branches