Merge lp:~mzanetti/reminders-app/textformat-enum into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 40
Merged at revision: 42
Proposed branch: lp:~mzanetti/reminders-app/textformat-enum
Merge into: lp:reminders-app
Diff against target: 147 lines (+80/-0)
6 files modified
src/plugin/Evernote/CMakeLists.txt (+1/-0)
src/plugin/Evernote/evernoteplugin.cpp (+4/-0)
src/plugin/Evernote/note.cpp (+5/-0)
src/plugin/Evernote/note.h (+2/-0)
src/plugin/Evernote/utils/textformat.cpp (+25/-0)
src/plugin/Evernote/utils/textformat.h (+43/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/textformat-enum
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Approve
Review via email: mp+203779@code.launchpad.net

Commit message

This adds a helper class to export TextFormat enums to QML

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: Needs Fixing (continuous-integration)
40. By Michael Zanetti

fix enum for usage in qml with another class

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
Riccardo Padovani (rpadovani) wrote :

Work as expected! Thanks!

review: Approve
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/plugin/Evernote/CMakeLists.txt'
2--- src/plugin/Evernote/CMakeLists.txt 2014-01-24 18:13:04 +0000
3+++ src/plugin/Evernote/CMakeLists.txt 2014-01-29 18:27:37 +0000
4@@ -28,6 +28,7 @@
5 jobs/expungenotebookjob.cpp
6 resourceimageprovider.cpp
7 utils/enmldocument.cpp
8+ utils/textformat.cpp
9 )
10
11 add_library(evernoteplugin MODULE
12
13=== modified file 'src/plugin/Evernote/evernoteplugin.cpp'
14--- src/plugin/Evernote/evernoteplugin.cpp 2014-01-23 09:39:43 +0000
15+++ src/plugin/Evernote/evernoteplugin.cpp 2014-01-29 18:27:37 +0000
16@@ -30,6 +30,8 @@
17 #include "notebook.h"
18 #include "resourceimageprovider.h"
19
20+#include "utils/textformat.h"
21+
22 #include <QtQml>
23
24 static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
25@@ -58,6 +60,8 @@
26 qmlRegisterUncreatableType<Note>("Evernote", 0, 1, "Note", "Cannot create Notes in QML. Use NotesStore.createNote() instead.");
27 qmlRegisterUncreatableType<Notebook>("Evernote", 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead.");
28 qmlRegisterUncreatableType<Resource>("Evernote", 0, 1, "Resource", "Cannot create Resources. Use Note.attachFile() instead.");
29+
30+ qmlRegisterUncreatableType<TextFormat>("Evernote", 0, 1, "TextFormat", "TextFormat is not creatable. It's just here to export enums to QML");
31 }
32
33 void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
34
35=== modified file 'src/plugin/Evernote/note.cpp'
36--- src/plugin/Evernote/note.cpp 2014-01-23 09:46:02 +0000
37+++ src/plugin/Evernote/note.cpp 2014-01-29 18:27:37 +0000
38@@ -247,6 +247,11 @@
39 emit contentChanged();
40 }
41
42+void Note::format(int startPos, int endPos, TextFormat::Format format)
43+{
44+ qDebug() << "Should format from" << startPos << "to" << endPos << "with format:" << format;
45+}
46+
47 Note *Note::clone()
48 {
49 Note *note = new Note(m_guid, m_created);
50
51=== modified file 'src/plugin/Evernote/note.h'
52--- src/plugin/Evernote/note.h 2014-01-24 18:13:04 +0000
53+++ src/plugin/Evernote/note.h 2014-01-29 18:27:37 +0000
54@@ -23,6 +23,7 @@
55
56 #include "utils/enmldocument.h"
57 #include "resource.h"
58+#include "utils/textformat.h"
59
60 #include <QObject>
61 #include <QDateTime>
62@@ -106,6 +107,7 @@
63
64 Q_INVOKABLE void markTodo(const QString &todoId, bool checked);
65 Q_INVOKABLE void attachFile(int position, const QUrl &fileName);
66+ Q_INVOKABLE void format(int startPos, int endPos, TextFormat::Format format);
67
68 Note* clone();
69
70
71=== added file 'src/plugin/Evernote/utils/textformat.cpp'
72--- src/plugin/Evernote/utils/textformat.cpp 1970-01-01 00:00:00 +0000
73+++ src/plugin/Evernote/utils/textformat.cpp 2014-01-29 18:27:37 +0000
74@@ -0,0 +1,25 @@
75+/*
76+ * Copyright: 2013 Canonical, Ltd
77+ *
78+ * This file is part of reminders-app
79+ *
80+ * reminders-app is free software: you can redistribute it and/or modify
81+ * it under the terms of the GNU General Public License as published by
82+ * the Free Software Foundation; version 3.
83+ *
84+ * reminders-app is distributed in the hope that it will be useful,
85+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
86+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87+ * GNU General Public License for more details.
88+ *
89+ * You should have received a copy of the GNU General Public License
90+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
91+ *
92+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
93+ */
94+
95+#include "textformat.h"
96+
97+TextFormat::TextFormat(QObject *parent): QObject(parent)
98+{
99+}
100
101=== added file 'src/plugin/Evernote/utils/textformat.h'
102--- src/plugin/Evernote/utils/textformat.h 1970-01-01 00:00:00 +0000
103+++ src/plugin/Evernote/utils/textformat.h 2014-01-29 18:27:37 +0000
104@@ -0,0 +1,43 @@
105+/*
106+ * Copyright: 2013 Canonical, Ltd
107+ *
108+ * This file is part of reminders-app
109+ *
110+ * reminders-app is free software: you can redistribute it and/or modify
111+ * it under the terms of the GNU General Public License as published by
112+ * the Free Software Foundation; version 3.
113+ *
114+ * reminders-app is distributed in the hope that it will be useful,
115+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
116+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117+ * GNU General Public License for more details.
118+ *
119+ * You should have received a copy of the GNU General Public License
120+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
121+ *
122+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
123+ */
124+
125+#ifndef TEXTFORMAT_H
126+#define TEXTFORMAT_H
127+
128+#include <QObject>
129+
130+class TextFormat: public QObject
131+{
132+ Q_OBJECT
133+ Q_ENUMS(Format)
134+public:
135+ enum Format {
136+ Bold,
137+ Italic,
138+ Underlined
139+ };
140+ Q_DECLARE_FLAGS(Formats, Format)
141+
142+ TextFormat(QObject *parent = 0);
143+};
144+Q_DECLARE_OPERATORS_FOR_FLAGS(TextFormat::Formats)
145+Q_DECLARE_METATYPE(TextFormat::Format)
146+
147+#endif

Subscribers

People subscribed via source and target branches