Merge lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 380
Merged at revision: 379
Proposed branch: lp:~mzanetti/reminders-app/cleanup-debug
Merge into: lp:reminders-app
Diff against target: 1979 lines (+286/-294)
34 files modified
src/app/formattinghelper.cpp (+0/-1)
src/app/main.cpp (+49/-7)
src/app/preferences.h (+0/-1)
src/libqtevernote/CMakeLists.txt (+1/-1)
src/libqtevernote/evernoteconnection.cpp (+36/-36)
src/libqtevernote/jobs/createnotebookjob.cpp (+0/-2)
src/libqtevernote/jobs/createnotejob.cpp (+0/-3)
src/libqtevernote/jobs/createtagjob.cpp (+0/-2)
src/libqtevernote/jobs/evernotejob.cpp (+8/-9)
src/libqtevernote/jobs/expungenotebookjob.cpp (+0/-2)
src/libqtevernote/jobs/fetchnotebooksjob.cpp (+0/-2)
src/libqtevernote/jobs/fetchnotesjob.cpp (+0/-2)
src/libqtevernote/jobs/fetchtagsjob.cpp (+0/-2)
src/libqtevernote/jobs/savenotebookjob.cpp (+0/-2)
src/libqtevernote/jobs/savenotejob.cpp (+0/-3)
src/libqtevernote/jobs/savetagjob.cpp (+0/-2)
src/libqtevernote/logging.cpp (+32/-0)
src/libqtevernote/logging.h (+34/-0)
src/libqtevernote/note.cpp (+5/-18)
src/libqtevernote/note.h (+0/-2)
src/libqtevernote/notebook.cpp (+1/-2)
src/libqtevernote/notebooks.cpp (+0/-2)
src/libqtevernote/notes.cpp (+0/-2)
src/libqtevernote/notesstore.cpp (+104/-99)
src/libqtevernote/resource.cpp (+5/-5)
src/libqtevernote/resourceimageprovider.cpp (+2/-2)
src/libqtevernote/tag.h (+0/-1)
src/libqtevernote/tags.cpp (+0/-2)
src/libqtevernote/userstore.cpp (+2/-3)
src/libqtevernote/utils/enmldocument.cpp (+3/-3)
src/libqtevernote/utils/organizeradapter.cpp (+4/-4)
src/libqtevernote/utils/textformat.cpp (+0/-25)
src/libqtevernote/utils/textformat.h (+0/-43)
src/plugin/Evernote/evernoteplugin.cpp (+0/-4)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/cleanup-debug
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+252050@code.launchpad.net

Commit message

clean up debug prints

To post a comment you must log in.
376. By Michael Zanetti

drop qdebug includes

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
377. By Michael Zanetti

some more improvements

378. By Michael Zanetti

disable jobqueue output by default

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) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

How is this supposed to work?

./reminders qml no Warnings no Sync no Application no JobQueue no Organizer no Connection no Enml no NotesStore no

Application: Running against the production server
Application: Using main qml file from: "/home/rpadovani/Documents/ubuntu/touch/core-apps/reminders-app/cleanup-debug/builddir/src/app/qml/reminders.qml"
NotesStore: Creating NotesStore instance.

and so on... I have all usual debug messages

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Mhh, I see I forgot the -d, but anyway, also with
./reminders -d qml no Warnings no Sync no Application no JobQueue no Organizer no Connection no Enml no NotesStore no

I have all usuals debug output

379. By Michael Zanetti

improve -h

Revision history for this message
Michael Zanetti (mzanetti) wrote :

I've improved the --help output a bit. Let's see if that makes it more clear.

380. By Michael Zanetti

add a warning if a non existing debug category was given

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) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Definitely better, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/formattinghelper.cpp'
--- src/app/formattinghelper.cpp 2014-11-12 22:14:59 +0000
+++ src/app/formattinghelper.cpp 2015-03-06 18:02:44 +0000
@@ -21,7 +21,6 @@
2121
22#include "formattinghelper.h"22#include "formattinghelper.h"
2323
24#include <QDebug>
25#include <QTextBlock>24#include <QTextBlock>
26#include <QTextObject>25#include <QTextObject>
27#include <QTextCharFormat>26#include <QTextCharFormat>
2827
=== modified file 'src/app/main.cpp'
--- src/app/main.cpp 2015-02-24 18:55:55 +0000
+++ src/app/main.cpp 2015-03-06 18:02:44 +0000
@@ -29,7 +29,22 @@
29#include <QLibrary>29#include <QLibrary>
30#include <QCommandLineParser>30#include <QCommandLineParser>
31#include <QCommandLineOption>31#include <QCommandLineOption>
32#include <QDebug>32#include <QLoggingCategory>
33
34QHash<QString, bool> s_loggingFilters;
35QLoggingCategory dcApplication("Application");
36
37void loggingCategoryFilter(QLoggingCategory *category)
38{
39 if (s_loggingFilters.contains(category->categoryName())) {
40 bool debugEnabled = s_loggingFilters.value(category->categoryName());
41 category->setEnabled(QtDebugMsg, debugEnabled);
42 category->setEnabled(QtWarningMsg, debugEnabled || s_loggingFilters.value("Warnings"));
43 } else {
44 category->setEnabled(QtDebugMsg, false);
45 category->setEnabled(QtWarningMsg, s_loggingFilters.value("qml") || s_loggingFilters.value("Warnings"));
46 }
47}
3348
34int main(int argc, char *argv[])49int main(int argc, char *argv[])
35{50{
@@ -37,6 +52,16 @@
37 QQuickView view;52 QQuickView view;
38 view.setResizeMode(QQuickView::SizeRootObjectToView);53 view.setResizeMode(QQuickView::SizeRootObjectToView);
3954
55 s_loggingFilters.insert("Warnings", true);
56 s_loggingFilters.insert("Application", true);
57 s_loggingFilters.insert("NotesStore", true);
58 s_loggingFilters.insert("JobQueue", false);
59 s_loggingFilters.insert("Sync", true);
60 s_loggingFilters.insert("Connection", true);
61 s_loggingFilters.insert("Enml", false);
62 s_loggingFilters.insert("Organizer", false);
63 s_loggingFilters.insert("qml", true);
64
40 // Set up import paths65 // Set up import paths
41 QStringList importPathList = view.engine()->importPathList();66 QStringList importPathList = view.engine()->importPathList();
42 // Prepend the location of the plugin in the build dir,67 // Prepend the location of the plugin in the build dir,
@@ -50,10 +75,16 @@
50 cmdLineParser.addOption(phoneFactorOption);75 cmdLineParser.addOption(phoneFactorOption);
51 QCommandLineOption tabletFactorOption(QStringList() << "t" << "tablet", "If running on Desktop, start in a tablet sized window.");76 QCommandLineOption tabletFactorOption(QStringList() << "t" << "tablet", "If running on Desktop, start in a tablet sized window.");
52 cmdLineParser.addOption(tabletFactorOption);77 cmdLineParser.addOption(tabletFactorOption);
53 QCommandLineOption importPathOption("I", "Give a path for an additional QML import directory. May be used multiple times.", "paths");78 QCommandLineOption importPathOption("I", "Give a path for an additional QML import directory. May be used multiple times.", "path");
54 cmdLineParser.addOption(importPathOption);79 cmdLineParser.addOption(importPathOption);
55 QCommandLineOption sandboxOption(QStringList() << "s" << "sandbox", "Use sandbox.evernote.com instead of www.evernote.com.");80 QCommandLineOption sandboxOption(QStringList() << "s" << "sandbox", "Use sandbox.evernote.com instead of www.evernote.com.");
56 cmdLineParser.addOption(sandboxOption);81 cmdLineParser.addOption(sandboxOption);
82 QString debugDescription = QString("Debug categories to enable. Prefix with \"No\" to disable. Warnings from all categories will be printed unless explicitly muted with \"NoWarnings\". May be used multiple times. Categories are:");
83 foreach (const QString &filterName, s_loggingFilters.keys()) {
84 debugDescription += "\n" + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
85 }
86 QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "[No]DebugCategory");
87 cmdLineParser.addOption(debugOption);
57 QCommandLineOption testabilityOption("testability", "Load the testability driver.");88 QCommandLineOption testabilityOption("testability", "Load the testability driver.");
58 cmdLineParser.addOption(testabilityOption);89 cmdLineParser.addOption(testabilityOption);
59 cmdLineParser.addPositionalArgument("uri", "Uri to start the application in a specific mode. E.g. evernote://newnote to directly create and edit a new note.");90 cmdLineParser.addPositionalArgument("uri", "Uri to start the application in a specific mode. E.g. evernote://newnote to directly create and edit a new note.");
@@ -61,6 +92,17 @@
6192
62 cmdLineParser.process(a);93 cmdLineParser.process(a);
6394
95 foreach (QString debugArea, cmdLineParser.values(debugOption)) {
96 bool enable = !debugArea.startsWith("No");
97 debugArea.remove(QRegExp("^No"));
98 if (s_loggingFilters.contains(debugArea)) {
99 s_loggingFilters[debugArea] = enable;
100 } else {
101 qWarning() << "No such debug category:" << debugArea;
102 }
103 }
104 QLoggingCategory::installFilter(loggingCategoryFilter);
105
64 foreach (QString addedPath, cmdLineParser.values(importPathOption)) {106 foreach (QString addedPath, cmdLineParser.values(importPathOption)) {
65 if (addedPath == "." || addedPath.startsWith("./")) {107 if (addedPath == "." || addedPath.startsWith("./")) {
66 addedPath = addedPath.right(addedPath.length() - 1);108 addedPath = addedPath.right(addedPath.length() - 1);
@@ -86,20 +128,20 @@
86128
87 if (cmdLineParser.isSet(sandboxOption)) {129 if (cmdLineParser.isSet(sandboxOption)) {
88 view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(true));130 view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(true));
89 qDebug() << "Running against the sandbox server";131 qCDebug(dcApplication) << "Running against the sandbox server";
90 } else {132 } else {
91 view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(false));133 view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(false));
92 qDebug() << "Running against the production server";134 qCDebug(dcApplication) << "Running against the production server";
93 }135 }
94136
95 view.engine()->rootContext()->setContextProperty("tablet", QVariant(false));137 view.engine()->rootContext()->setContextProperty("tablet", QVariant(false));
96 view.engine()->rootContext()->setContextProperty("phone", QVariant(false));138 view.engine()->rootContext()->setContextProperty("phone", QVariant(false));
97139
98 if (cmdLineParser.isSet(tabletFactorOption)) {140 if (cmdLineParser.isSet(tabletFactorOption)) {
99 qDebug() << "running in tablet mode";141 qCDebug(dcApplication) << "Running in tablet mode";
100 view.engine()->rootContext()->setContextProperty("tablet", QVariant(true));142 view.engine()->rootContext()->setContextProperty("tablet", QVariant(true));
101 } else if (cmdLineParser.isSet(phoneFactorOption)){143 } else if (cmdLineParser.isSet(phoneFactorOption)){
102 qDebug() << "running in phone mode";144 qCDebug(dcApplication) << "Running in phone mode";
103 view.engine()->rootContext()->setContextProperty("phone", QVariant(true));145 view.engine()->rootContext()->setContextProperty("phone", QVariant(true));
104 } else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") {146 } else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") {
105 // Default to tablet size on X11147 // Default to tablet size on X11
@@ -140,7 +182,7 @@
140 // So if you want to change it, make sure to find all the places where it is set, not just here :D182 // So if you want to change it, make sure to find all the places where it is set, not just here :D
141 QCoreApplication::setApplicationName("com.ubuntu.reminders");183 QCoreApplication::setApplicationName("com.ubuntu.reminders");
142184
143 qDebug() << "using main qml file from:" << qmlfile;185 qCDebug(dcApplication) << "Using main qml file from:" << qmlfile;
144 view.setSource(QUrl::fromLocalFile(qmlfile));186 view.setSource(QUrl::fromLocalFile(qmlfile));
145 view.show();187 view.show();
146188
147189
=== modified file 'src/app/preferences.h'
--- src/app/preferences.h 2015-02-23 18:00:46 +0000
+++ src/app/preferences.h 2015-03-06 18:02:44 +0000
@@ -26,7 +26,6 @@
26#include <QSettings>26#include <QSettings>
27#include <QStandardPaths>27#include <QStandardPaths>
28#include <QObject>28#include <QObject>
29#include <QDebug>
30#include <QList>29#include <QList>
31#include <QColor>30#include <QColor>
3231
3332
=== modified file 'src/libqtevernote/CMakeLists.txt'
--- src/libqtevernote/CMakeLists.txt 2014-12-06 22:35:01 +0000
+++ src/libqtevernote/CMakeLists.txt 2015-03-06 18:02:44 +0000
@@ -14,6 +14,7 @@
14 notebook.cpp14 notebook.cpp
15 tag.cpp15 tag.cpp
16 tags.cpp16 tags.cpp
17 logging.cpp
17 jobs/fetchnotesjob.cpp18 jobs/fetchnotesjob.cpp
18 jobs/fetchnotebooksjob.cpp19 jobs/fetchnotebooksjob.cpp
19 jobs/fetchnotejob.cpp20 jobs/fetchnotejob.cpp
@@ -33,7 +34,6 @@
33 jobs/savetagjob.cpp34 jobs/savetagjob.cpp
34 resourceimageprovider.cpp35 resourceimageprovider.cpp
35 utils/enmldocument.cpp36 utils/enmldocument.cpp
36 utils/textformat.cpp
37 utils/organizeradapter.cpp37 utils/organizeradapter.cpp
38)38)
3939
4040
=== modified file 'src/libqtevernote/evernoteconnection.cpp'
--- src/libqtevernote/evernoteconnection.cpp 2015-02-27 21:32:29 +0000
+++ src/libqtevernote/evernoteconnection.cpp 2015-03-06 18:02:44 +0000
@@ -21,6 +21,7 @@
2121
22#include "evernoteconnection.h"22#include "evernoteconnection.h"
23#include "jobs/evernotejob.h"23#include "jobs/evernotejob.h"
24#include "logging.h"
2425
25// Thrift26// Thrift
26#include <arpa/inet.h> // seems thrift forgot this one27#include <arpa/inet.h> // seems thrift forgot this one
@@ -36,7 +37,6 @@
36#include <UserStore_constants.h>37#include <UserStore_constants.h>
37#include <Errors_types.h>38#include <Errors_types.h>
3839
39#include <QDebug>
40#include <QUrl>40#include <QUrl>
4141
42#include <libintl.h>42#include <libintl.h>
@@ -79,11 +79,11 @@
79 if (m_useSSL) {79 if (m_useSSL) {
80 boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());80 boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
81 socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);81 socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);
82 qDebug() << "created UserStore SSL socket to host " << m_hostname;82 qCDebug(dcConnection) << "created UserStore SSL socket to host " << m_hostname;
83 } else {83 } else {
84 // Create a non-secure socket84 // Create a non-secure socket
85 socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));85 socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));
86 qDebug() << "created insecure UserStore socket to host " << m_hostname;86 qCDebug(dcConnection) << "created insecure UserStore socket to host " << m_hostname;
87 }87 }
8888
89 // setup UserStore client89 // setup UserStore client
@@ -108,11 +108,11 @@
108 if (m_useSSL) {108 if (m_useSSL) {
109 boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());109 boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
110 socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);110 socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);
111 qDebug() << "created NotesStore SSL socket to host " << m_hostname;111 qCDebug(dcConnection) << "created NotesStore SSL socket to host " << m_hostname;
112 } else {112 } else {
113 // Create a non-secure socket113 // Create a non-secure socket
114 socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));114 socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));
115 qDebug() << "created insecure NotesStore socket to host " << m_hostname;115 qCDebug(dcConnection) << "created insecure NotesStore socket to host " << m_hostname;
116 }116 }
117117
118 // setup NotesStore client118 // setup NotesStore client
@@ -147,9 +147,9 @@
147147
148void EvernoteConnection::disconnectFromEvernote()148void EvernoteConnection::disconnectFromEvernote()
149{149{
150 qDebug() << "[Connection] Disconnecting from Evernote.";150 qCDebug(dcConnection) << "Disconnecting from Evernote.";
151 if (!isConnected()) {151 if (!isConnected()) {
152 qWarning() << "Not connected. Can't disconnect.";152 qCWarning(dcConnection()) << "Not connected. Can't disconnect.";
153 return;153 return;
154 }154 }
155155
@@ -198,38 +198,38 @@
198void EvernoteConnection::connectToEvernote()198void EvernoteConnection::connectToEvernote()
199{199{
200 if (isConnected()) {200 if (isConnected()) {
201 qWarning() << "Already connected.";201 qCWarning(dcConnection) << "Already connected.";
202 return;202 return;
203 }203 }
204204
205 qDebug() << "[Connection] Connecting to Evernote:" << m_hostname;205 qCDebug(dcConnection) << "Connecting to Evernote:" << m_hostname;
206206
207 m_errorMessage.clear();207 m_errorMessage.clear();
208 emit errorChanged();208 emit errorChanged();
209209
210 if (m_token.isEmpty()) {210 if (m_token.isEmpty()) {
211 qWarning() << "[Connection] Can't connect to Evernote. No token set.";211 qCWarning(dcConnection) << "Can't connect to Evernote. No token set.";
212 return;212 return;
213 }213 }
214 if (m_hostname.isEmpty()) {214 if (m_hostname.isEmpty()) {
215 qWarning() << "[Connection] Can't connect to Evernote. No hostname set.";215 qCWarning(dcConnection) << "Can't connect to Evernote. No hostname set.";
216 }216 }
217217
218 setupUserStore();218 setupUserStore();
219 bool ok = connectUserStore();219 bool ok = connectUserStore();
220 if (!ok) {220 if (!ok) {
221 qWarning() << "[Connection] Error connecting User Store. Cannot continue.";221 qCWarning(dcConnection) << "Error connecting User Store. Cannot continue.";
222 return;222 return;
223 }223 }
224 setupNotesStore();224 setupNotesStore();
225 ok = connectNotesStore();225 ok = connectNotesStore();
226226
227 if (!ok) {227 if (!ok) {
228 qWarning() << "[Connection] Error connecting Notes Store. Cannot continue.";228 qCWarning(dcConnection) << "Error connecting Notes Store. Cannot continue.";
229 return;229 return;
230 }230 }
231231
232 qDebug() << "[Connection] Connected!";232 qCDebug(dcConnection) << "Connected!";
233 emit isConnectedChanged();233 emit isConnectedChanged();
234234
235}235}
@@ -242,14 +242,14 @@
242242
243 try {243 try {
244 m_userStoreHttpClient->open();244 m_userStoreHttpClient->open();
245 qDebug() << "UserStoreClient socket opened.";245 qCDebug(dcConnection) << "UserStoreClient socket opened.";
246 } catch (const TTransportException & e) {246 } catch (const TTransportException & e) {
247 qWarning() << "Failed to open connection:" << e.what() << e.getType();247 qCWarning(dcConnection) << "Failed to open connection:" << e.what() << e.getType();
248 m_errorMessage = gettext("Offline mode");248 m_errorMessage = gettext("Offline mode");
249 emit errorChanged();249 emit errorChanged();
250 return false;250 return false;
251 } catch (const TException & e) {251 } catch (const TException & e) {
252 qWarning() << "Generic Thrift exception when opening the connection:" << e.what();252 qCWarning(dcConnection) << "Generic Thrift exception when opening the connection:" << e.what();
253 m_errorMessage = gettext("Unknown error connecting to Evernote.");253 m_errorMessage = gettext("Unknown error connecting to Evernote.");
254 emit errorChanged();254 emit errorChanged();
255 return false;255 return false;
@@ -262,28 +262,28 @@
262 constants.EDAM_VERSION_MINOR);262 constants.EDAM_VERSION_MINOR);
263263
264 if (!versionOk) {264 if (!versionOk) {
265 qWarning() << "Server version mismatch! This application should be updated!";265 qCWarning(dcConnection) << "Server version mismatch! This application should be updated!";
266 m_errorMessage = QString(gettext("Error connecting to Evernote: Server version does not match app version. Please update the application."));266 m_errorMessage = QString(gettext("Error connecting to Evernote: Server version does not match app version. Please update the application."));
267 emit errorChanged();267 emit errorChanged();
268 return false;268 return false;
269 }269 }
270 } catch (const evernote::edam::EDAMUserException e) {270 } catch (const evernote::edam::EDAMUserException e) {
271 qWarning() << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode;271 qCWarning(dcConnection) << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode;
272 m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);272 m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);
273 emit errorChanged();273 emit errorChanged();
274 return false;274 return false;
275 } catch (const evernote::edam::EDAMSystemException e) {275 } catch (const evernote::edam::EDAMSystemException e) {
276 qWarning() << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode;276 qCWarning(dcConnection) << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode;
277 m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);277 m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);
278 emit errorChanged();278 emit errorChanged();
279 return false;279 return false;
280 } catch (const TTransportException & e) {280 } catch (const TTransportException & e) {
281 qWarning() << "Failed to fetch server version:" << e.what();281 qCWarning(dcConnection) << "Failed to fetch server version:" << e.what();
282 m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download version information from server."));282 m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download version information from server."));
283 emit errorChanged();283 emit errorChanged();
284 return false;284 return false;
285 } catch (const TException & e) {285 } catch (const TException & e) {
286 qWarning() << "Generic Thrift exception when fetching server version:" << e.what();286 qCWarning(dcConnection) << "Generic Thrift exception when fetching server version:" << e.what();
287 m_errorMessage = QString(gettext("Unknown error connecting to Evernote"));287 m_errorMessage = QString(gettext("Unknown error connecting to Evernote"));
288 emit errorChanged();288 emit errorChanged();
289 return false;289 return false;
@@ -291,24 +291,24 @@
291291
292 try {292 try {
293 std::string notesStoreUrl;293 std::string notesStoreUrl;
294 qDebug() << "getting ntoe store url with token" << m_token;294 qCDebug(dcConnection) << "getting ntoe store url with token" << m_token;
295 m_userstoreClient->getNoteStoreUrl(notesStoreUrl, m_token.toStdString());295 m_userstoreClient->getNoteStoreUrl(notesStoreUrl, m_token.toStdString());
296296
297 m_notesStorePath = QUrl(QString::fromStdString(notesStoreUrl)).path();297 m_notesStorePath = QUrl(QString::fromStdString(notesStoreUrl)).path();
298298
299 if (m_notesStorePath.isEmpty()) {299 if (m_notesStorePath.isEmpty()) {
300 qWarning() << "Failed to fetch notesstore path from server. Fetching notes will not work.";300 qCWarning(dcConnection) << "Failed to fetch notesstore path from server. Fetching notes will not work.";
301 m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download server information."));301 m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download server information."));
302 emit errorChanged();302 emit errorChanged();
303 return false;303 return false;
304 }304 }
305 } catch (const TTransportException & e) {305 } catch (const TTransportException & e) {
306 qWarning() << "Failed to fetch notestore path:" << e.what();306 qCWarning(dcConnection) << "Failed to fetch notestore path:" << e.what();
307 m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure when downloading server information."));307 m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure when downloading server information."));
308 emit errorChanged();308 emit errorChanged();
309 return false;309 return false;
310 } catch (const TException & e) {310 } catch (const TException & e) {
311 qWarning() << "Generic Thrift exception when fetching notestore path:" << e.what();311 qCWarning(dcConnection) << "Generic Thrift exception when fetching notestore path:" << e.what();
312 m_errorMessage = gettext("Unknown error connecting to Evernote");312 m_errorMessage = gettext("Unknown error connecting to Evernote");
313 emit errorChanged();313 emit errorChanged();
314 return false;314 return false;
@@ -325,15 +325,15 @@
325325
326 try {326 try {
327 m_notesStoreHttpClient->open();327 m_notesStoreHttpClient->open();
328 qDebug() << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen();328 qCDebug(dcConnection) << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen();
329 return true;329 return true;
330330
331 } catch (const TTransportException & e) {331 } catch (const TTransportException & e) {
332 qWarning() << "Failed to open connection:" << e.what();332 qCWarning(dcConnection) << "Failed to open connection:" << e.what();
333 m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure"));333 m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure"));
334 emit errorChanged();334 emit errorChanged();
335 } catch (const TException & e) {335 } catch (const TException & e) {
336 qWarning() << "Generic Thrift exception when opening the NotesStore connection:" << e.what();336 qCWarning(dcConnection) << "Generic Thrift exception when opening the NotesStore connection:" << e.what();
337 m_errorMessage = QString(gettext("Unknown Error connecting to Evernote"));337 m_errorMessage = QString(gettext("Unknown Error connecting to Evernote"));
338 emit errorChanged();338 emit errorChanged();
339 }339 }
@@ -354,7 +354,7 @@
354void EvernoteConnection::enqueue(EvernoteJob *job)354void EvernoteConnection::enqueue(EvernoteJob *job)
355{355{
356 if (!isConnected()) {356 if (!isConnected()) {
357 qWarning() << "[JobQueue] Not connected to evernote. Can't enqueue job.";357 qCWarning(dcJobQueue) << "Not connected to evernote. Can't enqueue job.";
358 job->emitJobDone(ErrorCodeConnectionLost, gettext("Disconnected from Evernote."));358 job->emitJobDone(ErrorCodeConnectionLost, gettext("Disconnected from Evernote."));
359 job->deleteLater();359 job->deleteLater();
360 return;360 return;
@@ -364,9 +364,9 @@
364 job->attachToDuplicate(duplicate);364 job->attachToDuplicate(duplicate);
365 connect(duplicate, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);365 connect(duplicate, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);
366 // reprioritze the repeated request366 // reprioritze the repeated request
367 qDebug() << "[JobQueue] Duplicate job already queued:" << job->toString();367 qCDebug(dcJobQueue) << "Duplicate job already queued:" << job->toString();
368 if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {368 if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {
369 qDebug() << "[JobQueue] Reprioritising duplicate job:" << job->toString();369 qCDebug(dcJobQueue) << "Reprioritising duplicate job:" << job->toString();
370 duplicate->setJobPriority(job->jobPriority());370 duplicate->setJobPriority(job->jobPriority());
371 m_jobQueue.prepend(m_jobQueue.takeAt(m_jobQueue.indexOf(duplicate)));371 m_jobQueue.prepend(m_jobQueue.takeAt(m_jobQueue.indexOf(duplicate)));
372 }372 }
@@ -374,10 +374,10 @@
374 connect(job, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);374 connect(job, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);
375 connect(job, &EvernoteJob::finished, this, &EvernoteConnection::startNextJob);375 connect(job, &EvernoteJob::finished, this, &EvernoteConnection::startNextJob);
376 if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {376 if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {
377 qDebug() << "[JobQueue] Prepending high priority job request:" << job->toString();377 qCDebug(dcJobQueue) << "Prepending high priority job request:" << job->toString();
378 m_jobQueue.prepend(job);378 m_jobQueue.prepend(job);
379 } else {379 } else {
380 qDebug() << "[JobQueue] Appending low priority job request:" << job->toString();380 qCDebug(dcJobQueue) << "Appending low priority job request:" << job->toString();
381 m_jobQueue.append(job);381 m_jobQueue.append(job);
382 }382 }
383 startJobQueue();383 startJobQueue();
@@ -410,13 +410,13 @@
410 }410 }
411411
412 m_currentJob = m_jobQueue.takeFirst();412 m_currentJob = m_jobQueue.takeFirst();
413 qDebug() << "[JobQueue] Starting job:" << m_currentJob->toString();413 qCDebug(dcJobQueue) << "Starting job:" << m_currentJob->toString();
414 m_currentJob->start();414 m_currentJob->start();
415}415}
416416
417void EvernoteConnection::startNextJob()417void EvernoteConnection::startNextJob()
418{418{
419 qDebug() << "[JobQueue] Job done:" << m_currentJob->toString();419 qCDebug(dcJobQueue) << "Job done:" << m_currentJob->toString();
420 m_currentJob = 0;420 m_currentJob = 0;
421 startJobQueue();421 startJobQueue();
422}422}
423423
=== modified file 'src/libqtevernote/jobs/createnotebookjob.cpp'
--- src/libqtevernote/jobs/createnotebookjob.cpp 2014-12-08 20:43:10 +0000
+++ src/libqtevernote/jobs/createnotebookjob.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "createnotebookjob.h"21#include "createnotebookjob.h"
22#include "notebook.h"22#include "notebook.h"
2323
24#include <QDebug>
25
26CreateNotebookJob::CreateNotebookJob(Notebook *notebook, QObject *parent) :24CreateNotebookJob::CreateNotebookJob(Notebook *notebook, QObject *parent) :
27 NotesStoreJob(parent),25 NotesStoreJob(parent),
28 m_notebook(notebook->clone())26 m_notebook(notebook->clone())
2927
=== modified file 'src/libqtevernote/jobs/createnotejob.cpp'
--- src/libqtevernote/jobs/createnotejob.cpp 2014-12-14 02:40:47 +0000
+++ src/libqtevernote/jobs/createnotejob.cpp 2015-03-06 18:02:44 +0000
@@ -20,8 +20,6 @@
2020
21#include "createnotejob.h"21#include "createnotejob.h"
2222
23#include <QDebug>
24
25CreateNoteJob::CreateNoteJob(Note *note, QObject *parent) :23CreateNoteJob::CreateNoteJob(Note *note, QObject *parent) :
26 NotesStoreJob(parent)24 NotesStoreJob(parent)
27{25{
@@ -46,7 +44,6 @@
4644
47void CreateNoteJob::startJob()45void CreateNoteJob::startJob()
48{46{
49 qDebug() << "creating note:" << m_note->guid() << m_note->enmlContent() << m_note->notebookGuid() << m_note->title();
50 evernote::edam::Note input;47 evernote::edam::Note input;
51 input.updateSequenceNum = m_note->updateSequenceNumber();48 input.updateSequenceNum = m_note->updateSequenceNumber();
52 input.__isset.updateSequenceNum = true;49 input.__isset.updateSequenceNum = true;
5350
=== modified file 'src/libqtevernote/jobs/createtagjob.cpp'
--- src/libqtevernote/jobs/createtagjob.cpp 2014-12-10 21:08:38 +0000
+++ src/libqtevernote/jobs/createtagjob.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "createtagjob.h"21#include "createtagjob.h"
22#include "tag.h"22#include "tag.h"
2323
24#include <QDebug>
25
26CreateTagJob::CreateTagJob(Tag *tag, QObject *parent) :24CreateTagJob::CreateTagJob(Tag *tag, QObject *parent) :
27 NotesStoreJob(parent),25 NotesStoreJob(parent),
28 m_tag(tag->clone())26 m_tag(tag->clone())
2927
=== modified file 'src/libqtevernote/jobs/evernotejob.cpp'
--- src/libqtevernote/jobs/evernotejob.cpp 2015-02-27 21:32:29 +0000
+++ src/libqtevernote/jobs/evernotejob.cpp 2015-03-06 18:02:44 +0000
@@ -20,6 +20,7 @@
2020
21#include "evernotejob.h"21#include "evernotejob.h"
22#include "evernoteconnection.h"22#include "evernoteconnection.h"
23#include "logging.h"
2324
24// Thrift25// Thrift
25#include <arpa/inet.h> // seems thrift forgot this one26#include <arpa/inet.h> // seems thrift forgot this one
@@ -33,8 +34,6 @@
3334
34#include <libintl.h>35#include <libintl.h>
3536
36#include <QDebug>
37
38using namespace apache::thrift;37using namespace apache::thrift;
39using namespace apache::thrift::protocol;38using namespace apache::thrift::protocol;
40using namespace apache::thrift::transport;39using namespace apache::thrift::transport;
@@ -63,7 +62,7 @@
63void EvernoteJob::run()62void EvernoteJob::run()
64{63{
65 if (!EvernoteConnection::instance()->isConnected()) {64 if (!EvernoteConnection::instance()->isConnected()) {
66 qWarning() << "EvernoteConnection is not connected. (" << this->metaObject()->className() << ")";65 qCWarning(dcJobQueue) << "EvernoteConnection is not connected. (" << toString() << ")";
67 emitJobDone(EvernoteConnection::ErrorCodeUserException, QStringLiteral("Not connected."));66 emitJobDone(EvernoteConnection::ErrorCodeUserException, QStringLiteral("Not connected."));
68 return;67 return;
69 }68 }
@@ -76,9 +75,9 @@
76 startJob();75 startJob();
77 emitJobDone(EvernoteConnection::ErrorCodeNoError, QString());76 emitJobDone(EvernoteConnection::ErrorCodeNoError, QString());
78 } catch (const TTransportException & e) {77 } catch (const TTransportException & e) {
79 qWarning() << "TTransportException in" << metaObject()->className() << e.what();78 qCWarning(dcJobQueue) << "TTransportException in" << metaObject()->className() << e.what();
80 if (tryCount < 2) {79 if (tryCount < 2) {
81 qWarning() << "[JobQueue] Resetting connection...";80 qCWarning(dcJobQueue) << "Resetting connection...";
82 try {81 try {
83 resetConnection();82 resetConnection();
84 } catch(...) {}83 } catch(...) {}
@@ -87,9 +86,9 @@
87 emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what());86 emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what());
88 }87 }
89 } catch (const TApplicationException &e) {88 } catch (const TApplicationException &e) {
90 qWarning() << "TApplicationException in " << metaObject()->className() << e.what();89 qCWarning(dcJobQueue) << "TApplicationException in " << metaObject()->className() << e.what();
91 if (tryCount < 2) {90 if (tryCount < 2) {
92 qWarning() << "Resetting connection...";91 qCWarning(dcJobQueue) << "Resetting connection...";
93 try {92 try {
94 resetConnection();93 resetConnection();
95 } catch(...) {}94 } catch(...) {}
@@ -159,10 +158,10 @@
159 break;158 break;
160 }159 }
161 message = message.arg(QString::fromStdString(e.parameter));160 message = message.arg(QString::fromStdString(e.parameter));
162 qWarning() << metaObject()->className() << "EDAMUserException:" << message;161 qCWarning(dcJobQueue) << metaObject()->className() << "EDAMUserException:" << message;
163 emitJobDone(EvernoteConnection::ErrorCodeUserException, message);162 emitJobDone(EvernoteConnection::ErrorCodeUserException, message);
164 } catch (const evernote::edam::EDAMSystemException &e) {163 } catch (const evernote::edam::EDAMSystemException &e) {
165 qWarning() << "EDAMSystemException in" << metaObject()->className() << e.what() << e.errorCode << QString::fromStdString(e.message);164 qCWarning(dcJobQueue) << "EDAMSystemException in" << metaObject()->className() << e.what() << e.errorCode << QString::fromStdString(e.message);
166 QString message;165 QString message;
167 EvernoteConnection::ErrorCode errorCode;166 EvernoteConnection::ErrorCode errorCode;
168 switch (e.errorCode) {167 switch (e.errorCode) {
169168
=== modified file 'src/libqtevernote/jobs/expungenotebookjob.cpp'
--- src/libqtevernote/jobs/expungenotebookjob.cpp 2014-09-19 21:31:39 +0000
+++ src/libqtevernote/jobs/expungenotebookjob.cpp 2015-03-06 18:02:44 +0000
@@ -20,8 +20,6 @@
2020
21#include "expungenotebookjob.h"21#include "expungenotebookjob.h"
2222
23#include <QDebug>
24
25ExpungeNotebookJob::ExpungeNotebookJob(const QString &guid, QObject *parent) :23ExpungeNotebookJob::ExpungeNotebookJob(const QString &guid, QObject *parent) :
26 NotesStoreJob(parent),24 NotesStoreJob(parent),
27 m_guid(guid)25 m_guid(guid)
2826
=== modified file 'src/libqtevernote/jobs/fetchnotebooksjob.cpp'
--- src/libqtevernote/jobs/fetchnotebooksjob.cpp 2014-09-19 21:31:39 +0000
+++ src/libqtevernote/jobs/fetchnotebooksjob.cpp 2015-03-06 18:02:44 +0000
@@ -20,8 +20,6 @@
2020
21#include "fetchnotebooksjob.h"21#include "fetchnotebooksjob.h"
2222
23#include <QDebug>
24
25FetchNotebooksJob::FetchNotebooksJob(QObject *parent) :23FetchNotebooksJob::FetchNotebooksJob(QObject *parent) :
26 NotesStoreJob(parent)24 NotesStoreJob(parent)
27{25{
2826
=== modified file 'src/libqtevernote/jobs/fetchnotesjob.cpp'
--- src/libqtevernote/jobs/fetchnotesjob.cpp 2015-02-26 22:47:10 +0000
+++ src/libqtevernote/jobs/fetchnotesjob.cpp 2015-03-06 18:02:44 +0000
@@ -25,8 +25,6 @@
25// evernote sdk25// evernote sdk
26#include "Limits_constants.h"26#include "Limits_constants.h"
2727
28#include <QDebug>
29
30FetchNotesJob::FetchNotesJob(const QString &filterNotebookGuid, const QString &searchWords, int startIndex, int chunkSize, QObject *parent) :28FetchNotesJob::FetchNotesJob(const QString &filterNotebookGuid, const QString &searchWords, int startIndex, int chunkSize, QObject *parent) :
31 NotesStoreJob(parent),29 NotesStoreJob(parent),
32 m_filterNotebookGuid(filterNotebookGuid),30 m_filterNotebookGuid(filterNotebookGuid),
3331
=== modified file 'src/libqtevernote/jobs/fetchtagsjob.cpp'
--- src/libqtevernote/jobs/fetchtagsjob.cpp 2014-10-09 00:08:52 +0000
+++ src/libqtevernote/jobs/fetchtagsjob.cpp 2015-03-06 18:02:44 +0000
@@ -20,8 +20,6 @@
2020
21#include "fetchtagsjob.h"21#include "fetchtagsjob.h"
2222
23#include <QDebug>
24
25FetchTagsJob::FetchTagsJob(QObject *parent) :23FetchTagsJob::FetchTagsJob(QObject *parent) :
26 NotesStoreJob(parent)24 NotesStoreJob(parent)
27{25{
2826
=== modified file 'src/libqtevernote/jobs/savenotebookjob.cpp'
--- src/libqtevernote/jobs/savenotebookjob.cpp 2015-03-04 00:23:45 +0000
+++ src/libqtevernote/jobs/savenotebookjob.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "savenotebookjob.h"21#include "savenotebookjob.h"
22#include "notebook.h"22#include "notebook.h"
2323
24#include <QDebug>
25
26SaveNotebookJob::SaveNotebookJob(Notebook *notebook, QObject *parent) :24SaveNotebookJob::SaveNotebookJob(Notebook *notebook, QObject *parent) :
27 NotesStoreJob(parent)25 NotesStoreJob(parent)
28{26{
2927
=== modified file 'src/libqtevernote/jobs/savenotejob.cpp'
--- src/libqtevernote/jobs/savenotejob.cpp 2015-02-27 22:15:02 +0000
+++ src/libqtevernote/jobs/savenotejob.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "savenotejob.h"21#include "savenotejob.h"
22#include "note.h"22#include "note.h"
2323
24#include <QDebug>
25
26SaveNoteJob::SaveNoteJob(Note *note, QObject *parent) :24SaveNoteJob::SaveNoteJob(Note *note, QObject *parent) :
27 NotesStoreJob(parent)25 NotesStoreJob(parent)
28{26{
@@ -86,7 +84,6 @@
86 note.attributes.reminderDoneTime = m_note->reminderDoneTime().toMSecsSinceEpoch();84 note.attributes.reminderDoneTime = m_note->reminderDoneTime().toMSecsSinceEpoch();
87 note.attributes.__isset.reminderDoneTime = true;85 note.attributes.__isset.reminderDoneTime = true;
8886
89 qDebug() << "*** needs content sync" << m_note->needsContentSync();
90 if (m_note->needsContentSync()) {87 if (m_note->needsContentSync()) {
91 note.content = m_note->enmlContent().toStdString();88 note.content = m_note->enmlContent().toStdString();
92 note.__isset.content = true;89 note.__isset.content = true;
9390
=== modified file 'src/libqtevernote/jobs/savetagjob.cpp'
--- src/libqtevernote/jobs/savetagjob.cpp 2014-12-13 03:55:52 +0000
+++ src/libqtevernote/jobs/savetagjob.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "savetagjob.h"21#include "savetagjob.h"
22#include "tag.h"22#include "tag.h"
2323
24#include <QDebug>
25
26SaveTagJob::SaveTagJob(Tag *tag, QObject *parent) :24SaveTagJob::SaveTagJob(Tag *tag, QObject *parent) :
27 NotesStoreJob(parent)25 NotesStoreJob(parent)
28{26{
2927
=== added file 'src/libqtevernote/logging.cpp'
--- src/libqtevernote/logging.cpp 1970-01-01 00:00:00 +0000
+++ src/libqtevernote/logging.cpp 2015-03-06 18:02:44 +0000
@@ -0,0 +1,32 @@
1/*
2 * Copyright: 2015 Canonical, Ltd
3 *
4 * This file is part of reminders
5 *
6 * reminders 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 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 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
19 * Riccardo Padovani <rpadovani@ubuntu.com>
20 */
21
22#include "logging.h"
23
24#include <QLoggingCategory>
25
26Q_LOGGING_CATEGORY(dcNotesStore, "NotesStore")
27Q_LOGGING_CATEGORY(dcJobQueue,"JobQueue")
28Q_LOGGING_CATEGORY(dcConnection,"Connection")
29Q_LOGGING_CATEGORY(dcSync,"Sync")
30Q_LOGGING_CATEGORY(dcStorage,"Storage")
31Q_LOGGING_CATEGORY(dcEnml,"Enml")
32Q_LOGGING_CATEGORY(dcOrganizer,"Organizer")
033
=== added file 'src/libqtevernote/logging.h'
--- src/libqtevernote/logging.h 1970-01-01 00:00:00 +0000
+++ src/libqtevernote/logging.h 2015-03-06 18:02:44 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright: 2015 Canonical, Ltd
3 *
4 * This file is part of reminders
5 *
6 * reminders 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 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 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
19 * Riccardo Padovani <rpadovani@ubuntu.com>
20 */
21
22#ifndef LOGGING_H
23#define LOGGING_H
24
25#include <QLoggingCategory>
26
27Q_DECLARE_LOGGING_CATEGORY(dcNotesStore)
28Q_DECLARE_LOGGING_CATEGORY(dcJobQueue)
29Q_DECLARE_LOGGING_CATEGORY(dcConnection)
30Q_DECLARE_LOGGING_CATEGORY(dcSync)
31Q_DECLARE_LOGGING_CATEGORY(dcEnml)
32Q_DECLARE_LOGGING_CATEGORY(dcOrganizer)
33
34#endif
035
=== modified file 'src/libqtevernote/note.cpp'
--- src/libqtevernote/note.cpp 2015-03-05 18:23:25 +0000
+++ src/libqtevernote/note.cpp 2015-03-06 18:02:44 +0000
@@ -21,6 +21,7 @@
21#include "note.h"21#include "note.h"
2222
23#include "notesstore.h"23#include "notesstore.h"
24#include "logging.h"
2425
25#include <libintl.h>26#include <libintl.h>
2627
@@ -28,7 +29,6 @@
28#include <QUrl>29#include <QUrl>
29#include <QUrlQuery>30#include <QUrlQuery>
30#include <QStandardPaths>31#include <QStandardPaths>
31#include <QDebug>
32#include <QCryptographicHash>32#include <QCryptographicHash>
33#include <QFile>33#include <QFile>
3434
@@ -71,15 +71,13 @@
71 infoFile.endGroup();71 infoFile.endGroup();
72 } else {72 } else {
73 // uh oh... have a resource description without file... reset sequence number to indicate we need a sync73 // uh oh... have a resource description without file... reset sequence number to indicate we need a sync
74 qWarning() << "Have a resource description but no resource file for it";74 qCWarning(dcNotesStore) << "Have a resource description but no resource file for it";
75 }75 }
76 }76 }
77 infoFile.endGroup();77 infoFile.endGroup();
7878
79 connect(NotesStore::instance(), &NotesStore::notebookGuidChanged, this, &Note::slotNotebookGuidChanged);79 connect(NotesStore::instance(), &NotesStore::notebookGuidChanged, this, &Note::slotNotebookGuidChanged);
80 connect(NotesStore::instance(), &NotesStore::tagGuidChanged, this, &Note::slotTagGuidChanged);80 connect(NotesStore::instance(), &NotesStore::tagGuidChanged, this, &Note::slotTagGuidChanged);
81
82 qDebug() << "Note created:" << m_guid << m_title << m_tagline << m_content.enml();
83}81}
8482
85Note::~Note()83Note::~Note()
@@ -122,7 +120,6 @@
122 m_guid = guid;120 m_guid = guid;
123 QString newCacheFileName = NotesStore::instance()->storageLocation() + "note-" + guid + ".enml";121 QString newCacheFileName = NotesStore::instance()->storageLocation() + "note-" + guid + ".enml";
124 if (m_cacheFile.exists()) {122 if (m_cacheFile.exists()) {
125 qDebug() << "renaming cachefile from" << m_cacheFile.fileName() << "to" << newCacheFileName;
126 m_cacheFile.rename(newCacheFileName);123 m_cacheFile.rename(newCacheFileName);
127 } else {124 } else {
128 m_cacheFile.setFileName(newCacheFileName);125 m_cacheFile.setFileName(newCacheFileName);
@@ -266,9 +263,7 @@
266263
267QString Note::htmlContent() const264QString Note::htmlContent() const
268{265{
269 qDebug() << "html content asked;";
270 load();266 load();
271 qDebug() << "returning" << m_content.toHtml(m_guid);
272 return m_content.toHtml(m_guid);267 return m_content.toHtml(m_guid);
273}268}
274269
@@ -430,9 +425,7 @@
430425
431void Note::setDeleted(bool deleted)426void Note::setDeleted(bool deleted)
432{427{
433 qDebug() << "note" << this << "isDelted:" << m_deleted << "setting to" << deleted;
434 if (m_deleted != deleted) {428 if (m_deleted != deleted) {
435 qDebug() << "setting m_deleted to to" << deleted;
436 m_deleted = deleted;429 m_deleted = deleted;
437 emit deletedChanged();430 emit deletedChanged();
438 }431 }
@@ -518,7 +511,6 @@
518 return m_resources.value(hash);511 return m_resources.value(hash);
519 }512 }
520513
521 qDebug() << "adding resource" << fileName << type;
522 Resource *resource = new Resource(data, hash, fileName, type, this);514 Resource *resource = new Resource(data, hash, fileName, type, this);
523 m_resources.insert(hash, resource);515 m_resources.insert(hash, resource);
524 emit resourcesChanged();516 emit resourcesChanged();
@@ -544,7 +536,7 @@
544{536{
545 QFile importedFile(fileName.path());537 QFile importedFile(fileName.path());
546 if (!importedFile.exists()) {538 if (!importedFile.exists()) {
547 qWarning() << "File doesn't exist. Cannot attach.";539 qCWarning(dcNotesStore) << "File doesn't exist. Cannot attach.";
548 return;540 return;
549 }541 }
550542
@@ -562,11 +554,6 @@
562 m_needsContentSync = true;554 m_needsContentSync = true;
563}555}
564556
565void Note::format(int startPos, int endPos, TextFormat::Format format)
566{
567 qDebug() << "Should format from" << startPos << "to" << endPos << "with format:" << format;
568}
569
570void Note::addTag(const QString &tagGuid)557void Note::addTag(const QString &tagGuid)
571{558{
572 NotesStore::instance()->tagNote(m_guid, tagGuid);559 NotesStore::instance()->tagNote(m_guid, tagGuid);
@@ -700,9 +687,9 @@
700 m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed());687 m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed());
701 m_tagline = m_content.toPlaintext().left(100);688 m_tagline = m_content.toPlaintext().left(100);
702 m_cacheFile.close();689 m_cacheFile.close();
703 qDebug() << "[Storage] Loaded note from storage:" << m_guid;690 qCDebug(dcNotesStore) << "Loaded note content from disk:" << m_guid;
704 } else {691 } else {
705 qDebug() << "[Storage] Failed attempt to load note from storage:" << m_guid;692 qCDebug(dcNotesStore) << "Failed attempt to load note content from disk:" << m_guid;
706 }693 }
707 m_loaded = true;694 m_loaded = true;
708}695}
709696
=== modified file 'src/libqtevernote/note.h'
--- src/libqtevernote/note.h 2015-03-05 18:23:25 +0000
+++ src/libqtevernote/note.h 2015-03-06 18:02:44 +0000
@@ -23,7 +23,6 @@
2323
24#include "utils/enmldocument.h"24#include "utils/enmldocument.h"
25#include "resource.h"25#include "resource.h"
26#include "utils/textformat.h"
2726
28#include <QObject>27#include <QObject>
29#include <QDateTime>28#include <QDateTime>
@@ -162,7 +161,6 @@
162161
163 Q_INVOKABLE void markTodo(const QString &todoId, bool checked);162 Q_INVOKABLE void markTodo(const QString &todoId, bool checked);
164 Q_INVOKABLE void attachFile(int position, const QUrl &fileName);163 Q_INVOKABLE void attachFile(int position, const QUrl &fileName);
165 Q_INVOKABLE void format(int startPos, int endPos, TextFormat::Format format);
166 Q_INVOKABLE void addTag(const QString &tagGuid);164 Q_INVOKABLE void addTag(const QString &tagGuid);
167 Q_INVOKABLE void removeTag(const QString &tagGuid);165 Q_INVOKABLE void removeTag(const QString &tagGuid);
168166
169167
=== modified file 'src/libqtevernote/notebook.cpp'
--- src/libqtevernote/notebook.cpp 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/notebook.cpp 2015-03-06 18:02:44 +0000
@@ -24,7 +24,7 @@
2424
25#include <libintl.h>25#include <libintl.h>
2626
27#include <QDebug>27#include <QLocale>
28#include <QStandardPaths>28#include <QStandardPaths>
2929
30Notebook::Notebook(QString guid, quint32 updateSequenceNumber, QObject *parent) :30Notebook::Notebook(QString guid, quint32 updateSequenceNumber, QObject *parent) :
@@ -191,7 +191,6 @@
191 }191 }
192 } else {192 } else {
193 if (!m_notesList.contains(noteGuid)) {193 if (!m_notesList.contains(noteGuid)) {
194 qDebug() << "****** appending to notebook";
195 m_notesList.append(noteGuid);194 m_notesList.append(noteGuid);
196 emit noteCountChanged();195 emit noteCountChanged();
197 }196 }
198197
=== modified file 'src/libqtevernote/notebooks.cpp'
--- src/libqtevernote/notebooks.cpp 2015-03-04 00:23:45 +0000
+++ src/libqtevernote/notebooks.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "notebooks.h"21#include "notebooks.h"
22#include "notebook.h"22#include "notebook.h"
2323
24#include <QDebug>
25
26Notebooks::Notebooks(QObject *parent) :24Notebooks::Notebooks(QObject *parent) :
27 QAbstractListModel(parent)25 QAbstractListModel(parent)
28{26{
2927
=== modified file 'src/libqtevernote/notes.cpp'
--- src/libqtevernote/notes.cpp 2015-03-04 23:50:24 +0000
+++ src/libqtevernote/notes.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "notes.h"21#include "notes.h"
22#include "note.h"22#include "note.h"
2323
24#include <QDebug>
25
26Notes::Notes(QObject *parent) :24Notes::Notes(QObject *parent) :
27 QSortFilterProxyModel(parent),25 QSortFilterProxyModel(parent),
28 m_onlyReminders(false),26 m_onlyReminders(false),
2927
=== modified file 'src/libqtevernote/notesstore.cpp'
--- src/libqtevernote/notesstore.cpp 2015-03-04 23:24:54 +0000
+++ src/libqtevernote/notesstore.cpp 2015-03-06 18:02:44 +0000
@@ -27,6 +27,7 @@
27#include "utils/enmldocument.h"27#include "utils/enmldocument.h"
28#include "utils/organizeradapter.h"28#include "utils/organizeradapter.h"
29#include "userstore.h"29#include "userstore.h"
30#include "logging.h"
3031
31#include "jobs/fetchnotesjob.h"32#include "jobs/fetchnotesjob.h"
32#include "jobs/fetchnotebooksjob.h"33#include "jobs/fetchnotebooksjob.h"
@@ -44,7 +45,6 @@
44#include "libintl.h"45#include "libintl.h"
4546
46#include <QImage>47#include <QImage>
47#include <QDebug>
48#include <QStandardPaths>48#include <QStandardPaths>
49#include <QUuid>49#include <QUuid>
50#include <QPointer>50#include <QPointer>
@@ -59,6 +59,7 @@
59 m_notebooksLoading(false),59 m_notebooksLoading(false),
60 m_tagsLoading(false)60 m_tagsLoading(false)
61{61{
62 qCDebug(dcNotesStore) << "Creating NotesStore instance.";
62 connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected);63 connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected);
6364
64 qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList");65 qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList");
@@ -72,7 +73,7 @@
7273
73 QDir storageDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first());74 QDir storageDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first());
74 if (!storageDir.exists()) {75 if (!storageDir.exists()) {
75 qDebug() << "creating storage directory:" << storageDir.absolutePath();76 qCDebug(dcNotesStore) << "Creating storage directory:" << storageDir.absolutePath();
76 storageDir.mkpath(storageDir.absolutePath());77 storageDir.mkpath(storageDir.absolutePath());
77 }78 }
78}79}
@@ -97,7 +98,7 @@
97 return;98 return;
98 }99 }
99 if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) {100 if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) {
100 qWarning() << "Logged in to Evernote. Can't change account manually. User EvernoteConnection to log in to another account or log out and change this manually.";101 qCWarning(dcNotesStore) << "Logged in to Evernote. Can't change account manually. User EvernoteConnection to log in to another account or log out and change this manually.";
101 return;102 return;
102 }103 }
103104
@@ -106,7 +107,7 @@
106 emit usernameChanged();107 emit usernameChanged();
107108
108 m_cacheFile = storageLocation() + "notes.cache";109 m_cacheFile = storageLocation() + "notes.cache";
109 qDebug() << "initialized cacheFile" << m_cacheFile;110 qCDebug(dcNotesStore) << "Initialized cacheFile:" << m_cacheFile;
110 loadFromCacheFile();111 loadFromCacheFile();
111 }112 }
112}113}
@@ -118,7 +119,7 @@
118119
119void NotesStore::userStoreConnected(const QString &username)120void NotesStore::userStoreConnected(const QString &username)
120{121{
121 qDebug() << "User store connected!" << username;122 qCDebug(dcNotesStore) << "User store connected! Using username:" << username;
122 setUsername(username);123 setUsername(username);
123124
124 refreshNotebooks();125 refreshNotebooks();
@@ -274,6 +275,7 @@
274{275{
275 QString newGuid = QUuid::createUuid().toString();276 QString newGuid = QUuid::createUuid().toString();
276 newGuid.remove("{").remove("}");277 newGuid.remove("{").remove("}");
278 qCDebug(dcNotesStore) << "Creating notebook:" << newGuid;
277 Notebook *notebook = new Notebook(newGuid, 1, this);279 Notebook *notebook = new Notebook(newGuid, 1, this);
278 notebook->setName(name);280 notebook->setName(name);
279 if (m_notebooks.isEmpty()) {281 if (m_notebooks.isEmpty()) {
@@ -287,6 +289,7 @@
287 syncToCacheFile(notebook);289 syncToCacheFile(notebook);
288290
289 if (EvernoteConnection::instance()->isConnected()) {291 if (EvernoteConnection::instance()->isConnected()) {
292 qCDebug(dcSync) << "Creating notebook on server:" << notebook->guid();
290 notebook->setLoading(true);293 notebook->setLoading(true);
291 CreateNotebookJob *job = new CreateNotebookJob(notebook);294 CreateNotebookJob *job = new CreateNotebookJob(notebook);
292 connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);295 connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);
@@ -298,19 +301,21 @@
298{301{
299 Notebook *notebook = m_notebooksHash.value(tmpGuid);302 Notebook *notebook = m_notebooksHash.value(tmpGuid);
300 if (!notebook) {303 if (!notebook) {
301 qWarning() << "Cannot find temporary notebook after create finished";304 qCWarning(dcSync) << "Cannot find temporary notebook after create finished";
302 return;305 return;
303 }306 }
304307
305 notebook->setLoading(false);308 notebook->setLoading(false);
306309
307 if (errorCode != EvernoteConnection::ErrorCodeNoError) {310 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
308 qWarning() << "Error creating notebook:" << errorMessage;311 qCWarning(dcSync) << "Error creating notebook:" << errorMessage;
309 notebook->setSyncError(true);312 notebook->setSyncError(true);
310 return;313 return;
311 }314 }
312 QString guid = QString::fromStdString(result.guid);315 QString guid = QString::fromStdString(result.guid);
313 qDebug() << "create notebooks job done2";316
317 qCDebug(dcSync) << "Notebook created on server. Old guid:" << tmpGuid << "New guid:" << guid;
318 qCDebug(dcNotesStore) << "Changing notebook guid. Old guid:" << tmpGuid << "New guid:" << guid;
314319
315 m_notebooksHash.insert(guid, notebook);320 m_notebooksHash.insert(guid, notebook);
316 notebook->setGuid(QString::fromStdString(result.guid));321 notebook->setGuid(QString::fromStdString(result.guid));
@@ -338,7 +343,7 @@
338{343{
339 Notebook *notebook = m_notebooksHash.value(guid);344 Notebook *notebook = m_notebooksHash.value(guid);
340 if (!notebook) {345 if (!notebook) {
341 qWarning() << "Can't save notebook. Guid not found:" << guid;346 qCWarning(dcNotesStore) << "Can't save notebook. Guid not found:" << guid;
342 return;347 return;
343 }348 }
344349
@@ -358,11 +363,11 @@
358{363{
359 Notebook *notebook = m_notebooksHash.value(guid);364 Notebook *notebook = m_notebooksHash.value(guid);
360 if (!notebook) {365 if (!notebook) {
361 qWarning() << "[NotesStore] Notebook guid not found:" << guid;366 qCWarning(dcNotesStore) << "Notebook guid not found:" << guid;
362 return;367 return;
363 }368 }
364369
365 qDebug() << "[NotesStore] Setting default notebook:" << guid;370 qCDebug(dcNotesStore) << "Setting default notebook:" << guid;
366 foreach (Notebook *tmp, m_notebooks) {371 foreach (Notebook *tmp, m_notebooks) {
367 if (tmp->isDefaultNotebook()) {372 if (tmp->isDefaultNotebook()) {
368 tmp->setIsDefaultNotebook(false);373 tmp->setIsDefaultNotebook(false);
@@ -379,7 +384,7 @@
379{384{
380 Tag *tag = m_tagsHash.value(guid);385 Tag *tag = m_tagsHash.value(guid);
381 if (!tag) {386 if (!tag) {
382 qWarning() << "Can't save tag. Guid not found:" << guid;387 qCWarning(dcNotesStore) << "Can't save tag. Guid not found:" << guid;
383 return;388 return;
384 }389 }
385390
@@ -398,7 +403,7 @@
398void NotesStore::expungeNotebook(const QString &guid)403void NotesStore::expungeNotebook(const QString &guid)
399{404{
400 if (m_username != "@local") {405 if (m_username != "@local") {
401 qWarning() << "[NotesStore] Account managed by Evernote. Cannot delete notebooks.";406 qCWarning(dcNotesStore) << "Account managed by Evernote. Cannot delete notebooks.";
402 m_errorQueue.append(QString(gettext("This account is managed by Evernote. Use the Evernote website to delete notebooks.")));407 m_errorQueue.append(QString(gettext("This account is managed by Evernote. Use the Evernote website to delete notebooks.")));
403 emit errorChanged();408 emit errorChanged();
404 return;409 return;
@@ -406,12 +411,12 @@
406411
407 Notebook* notebook = m_notebooksHash.value(guid);412 Notebook* notebook = m_notebooksHash.value(guid);
408 if (!notebook) {413 if (!notebook) {
409 qWarning() << "[NotesStore] Cannot delete notebook. Notebook not found for guid:" << guid;414 qCWarning(dcNotesStore) << "Cannot delete notebook. Notebook not found for guid:" << guid;
410 return;415 return;
411 }416 }
412417
413 if (notebook->isDefaultNotebook()) {418 if (notebook->isDefaultNotebook()) {
414 qWarning() << "[NotesStore] Cannot delete the default notebook.";419 qCWarning(dcNotesStore) << "Cannot delete the default notebook.";
415 m_errorQueue.append(QString(gettext("Cannot delete the default notebook. Set another notebook to be the default first.")));420 m_errorQueue.append(QString(gettext("Cannot delete the default notebook. Set another notebook to be the default first.")));
416 emit errorChanged();421 emit errorChanged();
417 return;422 return;
@@ -426,7 +431,7 @@
426 }431 }
427 }432 }
428 if (defaultNotebook.isEmpty()) {433 if (defaultNotebook.isEmpty()) {
429 qWarning() << "[NotesStore] No default notebook set. Can't delete notebooks.";434 qCWarning(dcNotesStore) << "No default notebook set. Can't delete notebooks.";
430 return;435 return;
431 }436 }
432437
@@ -434,11 +439,11 @@
434 QString noteGuid = notebook->noteAt(0);439 QString noteGuid = notebook->noteAt(0);
435 Note *note = m_notesHash.value(noteGuid);440 Note *note = m_notesHash.value(noteGuid);
436 if (!note) {441 if (!note) {
437 qWarning() << "[NotesStore] Notebook holds a noteGuid which cannot be found in notes store";442 qCWarning(dcNotesStore) << "Notebook holds a noteGuid which cannot be found in notes store";
438 Q_ASSERT(false);443 Q_ASSERT(false);
439 continue;444 continue;
440 }445 }
441 qDebug() << "[NotesStore] Moving note" << noteGuid << "to default Notebook";446 qCDebug(dcNotesStore) << "Moving note" << noteGuid << "to default Notebook";
442 note->setNotebookGuid(defaultNotebook);447 note->setNotebookGuid(defaultNotebook);
443 saveNote(note->guid());448 saveNote(note->guid());
444 emit noteChanged(note->guid(), defaultNotebook);449 emit noteChanged(note->guid(), defaultNotebook);
@@ -491,16 +496,15 @@
491496
492void NotesStore::createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result)497void NotesStore::createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result)
493{498{
494 qDebug() << "CreateTagJob done";
495 Tag *tag = m_tagsHash.value(tmpGuid);499 Tag *tag = m_tagsHash.value(tmpGuid);
496 if (!tag) {500 if (!tag) {
497 qWarning() << "Create Tag job done but tag can't be found any more";501 qCWarning(dcSync) << "Create Tag job done but tag can't be found any more";
498 return;502 return;
499 }503 }
500504
501 tag->setLoading(false);505 tag->setLoading(false);
502 if (errorCode != EvernoteConnection::ErrorCodeNoError) {506 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
503 qWarning() << "Error creating tag:" << errorMessage;507 qCWarning(dcSync) << "Error creating tag on server:" << errorMessage;
504 tag->setSyncError(true);508 tag->setSyncError(true);
505 emit tagChanged(tag->guid());509 emit tagChanged(tag->guid());
506 return;510 return;
@@ -532,12 +536,12 @@
532{536{
533 Tag *tag = m_tagsHash.value(QString::fromStdString(result.guid));537 Tag *tag = m_tagsHash.value(QString::fromStdString(result.guid));
534 if (!tag) {538 if (!tag) {
535 qWarning() << "Save tag job finished, but tag can't be found any more";539 qCWarning(dcSync) << "Save tag job finished, but tag can't be found any more";
536 return;540 return;
537 }541 }
538 tag->setLoading(false);542 tag->setLoading(false);
539 if (errorCode != EvernoteConnection::ErrorCodeNoError) {543 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
540 qWarning() << "error updating tag" << errorMessage;544 qCWarning(dcSync) << "Error updating tag on server" << errorMessage;
541 tag->setSyncError(true);545 tag->setSyncError(true);
542 emit tagChanged(tag->guid());546 emit tagChanged(tag->guid());
543 return;547 return;
@@ -554,18 +558,18 @@
554{558{
555 Note *note = m_notesHash.value(noteGuid);559 Note *note = m_notesHash.value(noteGuid);
556 if (!note) {560 if (!note) {
557 qWarning() << "No such note" << noteGuid;561 qCWarning(dcNotesStore) << "No such note" << noteGuid;
558 return;562 return;
559 }563 }
560564
561 Tag *tag = m_tagsHash.value(tagGuid);565 Tag *tag = m_tagsHash.value(tagGuid);
562 if (!tag) {566 if (!tag) {
563 qWarning() << "No such tag" << tagGuid;567 qCWarning(dcNotesStore) << "No such tag" << tagGuid;
564 return;568 return;
565 }569 }
566570
567 if (note->tagGuids().contains(tagGuid)) {571 if (note->tagGuids().contains(tagGuid)) {
568 qWarning() << "Note" << noteGuid << "already tagged with tag" << tagGuid;572 qCWarning(dcNotesStore) << "Note" << noteGuid << "already tagged with tag" << tagGuid;
569 return;573 return;
570 }574 }
571575
@@ -577,18 +581,18 @@
577{581{
578 Note *note = m_notesHash.value(noteGuid);582 Note *note = m_notesHash.value(noteGuid);
579 if (!note) {583 if (!note) {
580 qWarning() << "No such note" << noteGuid;584 qCWarning(dcNotesStore) << "No such note" << noteGuid;
581 return;585 return;
582 }586 }
583587
584 Tag *tag = m_tagsHash.value(tagGuid);588 Tag *tag = m_tagsHash.value(tagGuid);
585 if (!tag) {589 if (!tag) {
586 qWarning() << "No such tag" << tagGuid;590 qCWarning(dcNotesStore) << "No such tag" << tagGuid;
587 return;591 return;
588 }592 }
589593
590 if (!note->tagGuids().contains(tagGuid)) {594 if (!note->tagGuids().contains(tagGuid)) {
591 qWarning() << "Note" << noteGuid << "is not tagged with tag" << tagGuid;595 qCWarning(dcNotesStore) << "Note" << noteGuid << "is not tagged with tag" << tagGuid;
592 return;596 return;
593 }597 }
594598
@@ -601,7 +605,7 @@
601void NotesStore::refreshNotes(const QString &filterNotebookGuid, int startIndex)605void NotesStore::refreshNotes(const QString &filterNotebookGuid, int startIndex)
602{606{
603 if (m_loading && startIndex == 0) {607 if (m_loading && startIndex == 0) {
604 qWarning() << "Still busy with refreshing...";608 qCWarning(dcSync) << "Still busy with refreshing...";
605 return;609 return;
606 }610 }
607611
@@ -626,22 +630,22 @@
626 // All is well...630 // All is well...
627 break;631 break;
628 case EvernoteConnection::ErrorCodeUserException:632 case EvernoteConnection::ErrorCodeUserException:
629 qWarning() << "FetchNotesJobDone: EDAMUserException:" << errorMessage;633 qCWarning(dcSync) << "FetchNotesJobDone: EDAMUserException:" << errorMessage;
630 m_loading = false;634 m_loading = false;
631 emit loadingChanged();635 emit loadingChanged();
632 return; // silently discarding...636 return; // silently discarding...
633 case EvernoteConnection::ErrorCodeConnectionLost:637 case EvernoteConnection::ErrorCodeConnectionLost:
634 qWarning() << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage;638 qCWarning(dcSync) << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage;
635 m_loading = false;639 m_loading = false;
636 emit loadingChanged();640 emit loadingChanged();
637 return; // silently discarding...641 return; // silently discarding...
638 case EvernoteConnection::ErrorCodeNotFoundExcpetion:642 case EvernoteConnection::ErrorCodeNotFoundExcpetion:
639 qWarning() << "FetchNotesJobDone: Item not found on server:" << errorMessage;643 qCWarning(dcSync) << "FetchNotesJobDone: Item not found on server:" << errorMessage;
640 m_loading = false;644 m_loading = false;
641 emit loadingChanged();645 emit loadingChanged();
642 return; // silently discarding...646 return; // silently discarding...
643 default:647 default:
644 qWarning() << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode;648 qCWarning(dcSync) << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
645 m_loading = false;649 m_loading = false;
646 emit loadingChanged();650 emit loadingChanged();
647 return;651 return;
@@ -654,7 +658,7 @@
654 QVector<int> changedRoles;658 QVector<int> changedRoles;
655 bool newNote = note == 0;659 bool newNote = note == 0;
656 if (newNote) {660 if (newNote) {
657 qDebug() << "FetchNotesJobDone: Found new note on server.";661 qCDebug(dcSync) << "Found new note on server. Creating local copy:" << QString::fromStdString(result.guid);
658 note = new Note(QString::fromStdString(result.guid), 0, this);662 note = new Note(QString::fromStdString(result.guid), 0, this);
659 connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged);663 connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged);
660 connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged);664 connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged);
@@ -671,7 +675,7 @@
671 } else if (note->synced()) {675 } else if (note->synced()) {
672 // Local note did not change. Check if we need to refresh from server.676 // Local note did not change. Check if we need to refresh from server.
673 if (note->updateSequenceNumber() < result.updateSequenceNum) {677 if (note->updateSequenceNumber() < result.updateSequenceNum) {
674 qDebug() << "refreshing note from network. suequence number changed: " << note->updateSequenceNumber() << "->" << result.updateSequenceNum;678 qCDebug(dcSync) << "refreshing note from network. suequence number changed: " << note->updateSequenceNumber() << "->" << result.updateSequenceNum;
675 changedRoles = updateFromEDAM(result, note);679 changedRoles = updateFromEDAM(result, note);
676 refreshNoteContent(note->guid(), FetchNoteJob::LoadContent, EvernoteJob::JobPriorityLow);680 refreshNoteContent(note->guid(), FetchNoteJob::LoadContent, EvernoteJob::JobPriorityLow);
677 syncToCacheFile(note);681 syncToCacheFile(note);
@@ -679,7 +683,7 @@
679 } else {683 } else {
680 // Local note changed. See if we can push our changes.684 // Local note changed. See if we can push our changes.
681 if (note->lastSyncedSequenceNumber() == result.updateSequenceNum) {685 if (note->lastSyncedSequenceNumber() == result.updateSequenceNum) {
682 qDebug() << "Local note" << note->guid() << "has changed while server note did not. Pushing changes.";686 qCDebug(dcSync) << "Local note" << note->guid() << "has changed while server note did not. Pushing changes.";
683687
684 // Make sure we have everything loaded from cache before saving to server688 // Make sure we have everything loaded from cache before saving to server
685 if (!note->loaded() && note->isCached()) {689 if (!note->loaded() && note->isCached()) {
@@ -692,10 +696,10 @@
692 connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone);696 connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone);
693 EvernoteConnection::instance()->enqueue(job);697 EvernoteConnection::instance()->enqueue(job);
694 } else {698 } else {
695 qWarning() << "CONFLICT: Note has been changed on server and locally!";699 qCWarning(dcSync) << "CONFLICT: Note has been changed on server and locally!";
696 qWarning() << "local note sequence:" << note->updateSequenceNumber();700 qCWarning(dcSync) << "local note sequence:" << note->updateSequenceNumber();
697 qWarning() << "last synced sequence:" << note->lastSyncedSequenceNumber();701 qCWarning(dcSync) << "last synced sequence:" << note->lastSyncedSequenceNumber();
698 qWarning() << "remote sequence:" << result.updateSequenceNum;702 qCWarning(dcSync) << "remote sequence:" << result.updateSequenceNum;
699 note->setConflicting(true);703 note->setConflicting(true);
700 changedRoles << RoleConflicting;704 changedRoles << RoleConflicting;
701 }705 }
@@ -714,10 +718,10 @@
714 }718 }
715719
716 if (results.startIndex + (int32_t)results.notes.size() < results.totalNotes) {720 if (results.startIndex + (int32_t)results.notes.size() < results.totalNotes) {
717 qDebug() << "FetchNotesJobDone: Not all notes fetched yet. Fetching next batch.";721 qCDebug(dcSync) << "Not all notes fetched yet. Fetching next batch.";
718 refreshNotes(filterNotebookGuid, results.startIndex + results.notes.size());722 refreshNotes(filterNotebookGuid, results.startIndex + results.notes.size());
719 } else {723 } else {
720 qDebug() << "Fetched all notes. Starting merge...";724 qCDebug(dcSync) << "Fetched all notes from Evernote. Starting merge of local changes...";
721 m_organizerAdapter->startSync();725 m_organizerAdapter->startSync();
722 m_loading = false;726 m_loading = false;
723 emit loadingChanged();727 emit loadingChanged();
@@ -728,7 +732,7 @@
728 if (!note) {732 if (!note) {
729 continue; // Note might be deleted locally by now733 continue; // Note might be deleted locally by now
730 }734 }
731 qDebug() << "Have a local note that's not available on server!" << note->guid();735 qCDebug(dcSync) << "Have a local note that's not available on server!" << note->guid();
732 if (note->lastSyncedSequenceNumber() == 0) {736 if (note->lastSyncedSequenceNumber() == 0) {
733 // This note hasn't been created on the server yet. Do that now.737 // This note hasn't been created on the server yet. Do that now.
734 bool hasUnsyncedTag = false;738 bool hasUnsyncedTag = false;
@@ -741,15 +745,15 @@
741 }745 }
742 }746 }
743 if (hasUnsyncedTag) {747 if (hasUnsyncedTag) {
744 qDebug() << "Not syncing note to server yet. Have a tag that needs sync first";748 qCDebug(dcSync) << "Not syncing note to server yet. Have a tag that needs sync first";
745 continue;749 continue;
746 }750 }
747 Notebook *notebook = m_notebooksHash.value(note->notebookGuid());751 Notebook *notebook = m_notebooksHash.value(note->notebookGuid());
748 if (notebook && notebook->lastSyncedSequenceNumber() == 0) {752 if (notebook && notebook->lastSyncedSequenceNumber() == 0) {
749 qDebug() << "Not syncing note to server yet. The notebook needs to be synced first";753 qCDebug(dcSync) << "Not syncing note to server yet. The notebook needs to be synced first";
750 continue;754 continue;
751 }755 }
752 qDebug() << "Creating note on server:" << note->guid();756 qCDebug(dcSync) << "Creating note on server:" << note->guid();
753757
754 // Make sure we have everything loaded from cache before saving to server758 // Make sure we have everything loaded from cache before saving to server
755 if (!note->loaded() && note->isCached()) {759 if (!note->loaded() && note->isCached()) {
@@ -782,18 +786,19 @@
782 }786 }
783 }787 }
784 }788 }
789 qCDebug(dcSync) << "Local changes merged.";
785 }790 }
786}791}
787792
788void NotesStore::refreshNoteContent(const QString &guid, FetchNoteJob::LoadWhat what, EvernoteJob::JobPriority priority)793void NotesStore::refreshNoteContent(const QString &guid, FetchNoteJob::LoadWhat what, EvernoteJob::JobPriority priority)
789{794{
790 qDebug() << "fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image");
791 Note *note = m_notesHash.value(guid);795 Note *note = m_notesHash.value(guid);
792 if (!note) {796 if (!note) {
793 qWarning() << "RefreshNoteContent: Can't refresn note content. Note guid not found:" << guid;797 qCWarning(dcSync) << "RefreshNoteContent: Can't refresn note content. Note guid not found:" << guid;
794 return;798 return;
795 }799 }
796 if (EvernoteConnection::instance()->isConnected()) {800 if (EvernoteConnection::instance()->isConnected()) {
801 qCDebug(dcNotesStore) << "Fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image");
797 FetchNoteJob *job = new FetchNoteJob(guid, what, this);802 FetchNoteJob *job = new FetchNoteJob(guid, what, this);
798 job->setJobPriority(priority);803 job->setJobPriority(priority);
799 connect(job, &FetchNoteJob::resultReady, this, &NotesStore::fetchNoteJobDone);804 connect(job, &FetchNoteJob::resultReady, this, &NotesStore::fetchNoteJobDone);
@@ -810,7 +815,7 @@
810 FetchNoteJob *job = static_cast<FetchNoteJob*>(sender());815 FetchNoteJob *job = static_cast<FetchNoteJob*>(sender());
811 Note *note = m_notesHash.value(QString::fromStdString(result.guid));816 Note *note = m_notesHash.value(QString::fromStdString(result.guid));
812 if (!note) {817 if (!note) {
813 qWarning() << "can't find note for this update... ignoring...";818 qCWarning(dcSync) << "can't find note for this update... ignoring...";
814 return;819 return;
815 }820 }
816 QModelIndex noteIndex = index(m_notes.indexOf(note));821 QModelIndex noteIndex = index(m_notes.indexOf(note));
@@ -825,19 +830,19 @@
825 emit dataChanged(noteIndex, noteIndex, roles);830 emit dataChanged(noteIndex, noteIndex, roles);
826 break;831 break;
827 case EvernoteConnection::ErrorCodeUserException:832 case EvernoteConnection::ErrorCodeUserException:
828 qWarning() << "FetchNoteJobDone: EDAMUserException:" << errorMessage;833 qCWarning(dcSync) << "FetchNoteJobDone: EDAMUserException:" << errorMessage;
829 emit dataChanged(noteIndex, noteIndex, roles);834 emit dataChanged(noteIndex, noteIndex, roles);
830 return; // silently discarding...835 return; // silently discarding...
831 case EvernoteConnection::ErrorCodeConnectionLost:836 case EvernoteConnection::ErrorCodeConnectionLost:
832 qWarning() << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage;837 qCWarning(dcSync) << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage;
833 emit dataChanged(noteIndex, noteIndex, roles);838 emit dataChanged(noteIndex, noteIndex, roles);
834 return; // silently discarding...839 return; // silently discarding...
835 case EvernoteConnection::ErrorCodeNotFoundExcpetion:840 case EvernoteConnection::ErrorCodeNotFoundExcpetion:
836 qWarning() << "FetchNoteJobDone: Item not found on server:" << errorMessage;841 qCWarning(dcSync) << "FetchNoteJobDone: Item not found on server:" << errorMessage;
837 emit dataChanged(noteIndex, noteIndex, roles);842 emit dataChanged(noteIndex, noteIndex, roles);
838 return; // silently discarding...843 return; // silently discarding...
839 default:844 default:
840 qWarning() << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode;845 qCWarning(dcSync) << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode;
841 note->setSyncError(true);846 note->setSyncError(true);
842 roles << RoleSyncError;847 roles << RoleSyncError;
843 emit dataChanged(noteIndex, noteIndex, roles);848 emit dataChanged(noteIndex, noteIndex, roles);
@@ -861,7 +866,7 @@
861 // data in the cache, let's refresh the note again with resource data.866 // data in the cache, let's refresh the note again with resource data.
862 bool refreshWithResourceData = false;867 bool refreshWithResourceData = false;
863868
864 qDebug() << "got note content" << note->guid() << (what == FetchNoteJob::LoadContent ? "content" : "image") << result.resources.size();869 qCDebug(dcSync) << "got note content" << note->guid() << (what == FetchNoteJob::LoadContent ? "content" : "image") << result.resources.size();
865 // Resources need to be set before the content because otherwise the image provider won't find them when the content is updated in the ui870 // Resources need to be set before the content because otherwise the image provider won't find them when the content is updated in the ui
866 for (unsigned int i = 0; i < result.resources.size(); ++i) {871 for (unsigned int i = 0; i < result.resources.size(); ++i) {
867872
@@ -872,14 +877,14 @@
872 QString mime = QString::fromStdString(resource.mime);877 QString mime = QString::fromStdString(resource.mime);
873878
874 if (what == FetchNoteJob::LoadResources) {879 if (what == FetchNoteJob::LoadResources) {
875 qDebug() << "[Sync] Resource fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;880 qCDebug(dcSync) << "Resource fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
876 QByteArray resourceData = QByteArray(resource.data.body.data(), resource.data.size);881 QByteArray resourceData = QByteArray(resource.data.body.data(), resource.data.size);
877 note->addResource(resourceData, hash, fileName, mime);882 note->addResource(resourceData, hash, fileName, mime);
878 } else if (Resource::isCached(hash)) {883 } else if (Resource::isCached(hash)) {
879 qDebug() << "[Sync] Resource already cached for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;884 qCDebug(dcSync) << "Resource already cached for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
880 note->addResource(QByteArray(), hash, fileName, mime);885 note->addResource(QByteArray(), hash, fileName, mime);
881 } else {886 } else {
882 qDebug() << "[Sync] Resource not yet fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;887 qCDebug(dcSync) << "Resource not yet fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
883 refreshWithResourceData = true;888 refreshWithResourceData = true;
884 }889 }
885 roles << RoleHtmlContent << RoleEnmlContent << RoleResourceUrls;890 roles << RoleHtmlContent << RoleEnmlContent << RoleResourceUrls;
@@ -915,7 +920,7 @@
915 emit dataChanged(noteIndex, noteIndex, roles);920 emit dataChanged(noteIndex, noteIndex, roles);
916921
917 if (refreshWithResourceData) {922 if (refreshWithResourceData) {
918 qDebug() << "refreshWithResourceData";923 qCDebug(dcSync) << "Fetching Note resources:" << note->guid();
919 refreshNoteContent(note->guid(), FetchNoteJob::LoadResources, job->jobPriority());924 refreshNoteContent(note->guid(), FetchNoteJob::LoadResources, job->jobPriority());
920 } else {925 } else {
921 syncToCacheFile(note); // Syncs into the list cache926 syncToCacheFile(note); // Syncs into the list cache
@@ -926,7 +931,7 @@
926void NotesStore::refreshNotebooks()931void NotesStore::refreshNotebooks()
927{932{
928 if (!EvernoteConnection::instance()->isConnected()) {933 if (!EvernoteConnection::instance()->isConnected()) {
929 qWarning() << "Not connected. Cannot fetch notebooks from server.";934 qCWarning(dcSync) << "Not connected. Cannot fetch notebooks from server.";
930 return;935 return;
931 }936 }
932937
@@ -947,27 +952,27 @@
947 // All is well...952 // All is well...
948 break;953 break;
949 case EvernoteConnection::ErrorCodeUserException:954 case EvernoteConnection::ErrorCodeUserException:
950 qWarning() << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage;955 qCWarning(dcSync) << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage;
951 // silently discarding...956 // silently discarding...
952 return;957 return;
953 case EvernoteConnection::ErrorCodeConnectionLost:958 case EvernoteConnection::ErrorCodeConnectionLost:
954 qWarning() << "FetchNotebooksJobDone: Connection lost:" << errorMessage;959 qCWarning(dcSync) << "FetchNotebooksJobDone: Connection lost:" << errorMessage;
955 return; // silently discarding960 return; // silently discarding
956 default:961 default:
957 qWarning() << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode;962 qCWarning(dcSync) << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
958 return; // silently discarding963 return; // silently discarding
959 }964 }
960965
961 QList<Notebook*> unhandledNotebooks = m_notebooks;966 QList<Notebook*> unhandledNotebooks = m_notebooks;
962967
963 qDebug() << "[NotesStore] Have" << results.size() << "from Evernote.";968 qCDebug(dcSync) << "Received" << results.size() << "notebooks from Evernote.";
964 for (unsigned int i = 0; i < results.size(); ++i) {969 for (unsigned int i = 0; i < results.size(); ++i) {
965 evernote::edam::Notebook result = results.at(i);970 evernote::edam::Notebook result = results.at(i);
966 Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));971 Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));
967 unhandledNotebooks.removeAll(notebook);972 unhandledNotebooks.removeAll(notebook);
968 bool newNotebook = notebook == 0;973 bool newNotebook = notebook == 0;
969 if (newNotebook) {974 if (newNotebook) {
970 qDebug() << "[NotesStore] Found new notebook on Evernote:" << QString::fromStdString(result.guid);975 qCDebug(dcSync) << "Found new notebook on Evernote:" << QString::fromStdString(result.guid);
971 notebook = new Notebook(QString::fromStdString(result.guid), 0, this);976 notebook = new Notebook(QString::fromStdString(result.guid), 0, this);
972 updateFromEDAM(result, notebook);977 updateFromEDAM(result, notebook);
973 m_notebooksHash.insert(notebook->guid(), notebook);978 m_notebooksHash.insert(notebook->guid(), notebook);
@@ -976,25 +981,23 @@
976 syncToCacheFile(notebook);981 syncToCacheFile(notebook);
977 } else if (notebook->synced()) {982 } else if (notebook->synced()) {
978 if (notebook->updateSequenceNumber() < result.updateSequenceNum) {983 if (notebook->updateSequenceNumber() < result.updateSequenceNum) {
979 qDebug() << "[NotesStore] Notebook on Evernote is newer than local copy. Updating:" << notebook->guid();984 qCDebug(dcSync) << "Notebook on Evernote is newer than local copy. Updating:" << notebook->guid();
980 updateFromEDAM(result, notebook);985 updateFromEDAM(result, notebook);
981 emit notebookChanged(notebook->guid());986 emit notebookChanged(notebook->guid());
982 syncToCacheFile(notebook);987 syncToCacheFile(notebook);
983 } else {
984 qDebug() << "[NotesStore] Notebook is in sync:" << notebook->guid();
985 }988 }
986 } else {989 } else {
987 // Local notebook changed. See if we can push our changes990 // Local notebook changed. See if we can push our changes
988 if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) {991 if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) {
989 qDebug() << "[NotesStore] Local Notebook changed. Uploading changes to Evernote:" << notebook->guid();992 qCDebug(dcNotesStore) << "Local Notebook changed. Uploading changes to Evernote:" << notebook->guid();
990 SaveNotebookJob *job = new SaveNotebookJob(notebook);993 SaveNotebookJob *job = new SaveNotebookJob(notebook);
991 connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone);994 connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone);
992 EvernoteConnection::instance()->enqueue(job);995 EvernoteConnection::instance()->enqueue(job);
993 notebook->setLoading(true);996 notebook->setLoading(true);
994 emit notebookChanged(notebook->guid());997 emit notebookChanged(notebook->guid());
995 } else {998 } else {
996 qWarning() << "[NotesStore] Sync conflict in notebook:" << notebook->name();999 qCWarning(dcNotesStore) << "Sync conflict in notebook:" << notebook->name();
997 qWarning() << "[NotesStore] Resolving of sync conflicts is not implemented yet.";1000 qCWarning(dcNotesStore) << "Resolving of sync conflicts is not implemented yet.";
998 notebook->setSyncError(true);1001 notebook->setSyncError(true);
999 emit notebookChanged(notebook->guid());1002 emit notebookChanged(notebook->guid());
1000 }1003 }
@@ -1003,14 +1006,14 @@
10031006
1004 foreach (Notebook *notebook, unhandledNotebooks) {1007 foreach (Notebook *notebook, unhandledNotebooks) {
1005 if (notebook->lastSyncedSequenceNumber() == 0) {1008 if (notebook->lastSyncedSequenceNumber() == 0) {
1006 qDebug() << "[NotesStore] Have a local notebook that doesn't exist on Evernote. Creating on server:" << notebook->guid();1009 qCDebug(dcSync) << "Have a local notebook that doesn't exist on Evernote. Creating on server:" << notebook->guid();
1007 notebook->setLoading(true);1010 notebook->setLoading(true);
1008 CreateNotebookJob *job = new CreateNotebookJob(notebook);1011 CreateNotebookJob *job = new CreateNotebookJob(notebook);
1009 connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);1012 connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);
1010 EvernoteConnection::instance()->enqueue(job);1013 EvernoteConnection::instance()->enqueue(job);
1011 emit notebookChanged(notebook->guid());1014 emit notebookChanged(notebook->guid());
1012 } else {1015 } else {
1013 qDebug() << "[NotesStore] Notebook has been deleted on the server. Deleting local copy:" << notebook->guid();1016 qCDebug(dcSync) << "Notebook has been deleted on the server. Deleting local copy:" << notebook->guid();
1014 m_notebooks.removeAll(notebook);1017 m_notebooks.removeAll(notebook);
1015 m_notebooksHash.remove(notebook->guid());1018 m_notebooksHash.remove(notebook->guid());
1016 emit notebookRemoved(notebook->guid());1019 emit notebookRemoved(notebook->guid());
@@ -1029,7 +1032,7 @@
1029void NotesStore::refreshTags()1032void NotesStore::refreshTags()
1030{1033{
1031 if (!EvernoteConnection::instance()->isConnected()) {1034 if (!EvernoteConnection::instance()->isConnected()) {
1032 qWarning() << "Not connected. Cannot fetch tags from server.";1035 qCWarning(dcSync) << "Not connected. Cannot fetch tags from server.";
1033 return;1036 return;
1034 }1037 }
1035 m_tagsLoading = true;1038 m_tagsLoading = true;
@@ -1057,14 +1060,14 @@
1057 // All is well...1060 // All is well...
1058 break;1061 break;
1059 case EvernoteConnection::ErrorCodeUserException:1062 case EvernoteConnection::ErrorCodeUserException:
1060 qWarning() << "FetchTagsJobDone: EDAMUserException:" << errorMessage;1063 qCWarning(dcSync) << "FetchTagsJobDone: EDAMUserException:" << errorMessage;
1061 // silently discarding...1064 // silently discarding...
1062 return;1065 return;
1063 case EvernoteConnection::ErrorCodeConnectionLost:1066 case EvernoteConnection::ErrorCodeConnectionLost:
1064 qWarning() << "FetchTagsJobDone: Connection lost:" << errorMessage;1067 qCWarning(dcSync) << "FetchTagsJobDone: Connection lost:" << errorMessage;
1065 return; // silently discarding1068 return; // silently discarding
1066 default:1069 default:
1067 qWarning() << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode;1070 qCWarning(dcSync) << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
1068 return; // silently discarding1071 return; // silently discarding
1069 }1072 }
10701073
@@ -1077,7 +1080,7 @@
1077 if (newTag) {1080 if (newTag) {
1078 tag = new Tag(QString::fromStdString(result.guid), result.updateSequenceNum, this);1081 tag = new Tag(QString::fromStdString(result.guid), result.updateSequenceNum, this);
1079 tag->setLastSyncedSequenceNumber(result.updateSequenceNum);1082 tag->setLastSyncedSequenceNumber(result.updateSequenceNum);
1080 qDebug() << "got new tag with seq:" << result.updateSequenceNum << tag->synced() << tag->updateSequenceNumber() << tag->lastSyncedSequenceNumber();1083 qCDebug(dcSync) << "got new tag with seq:" << result.updateSequenceNum << tag->synced() << tag->updateSequenceNumber() << tag->lastSyncedSequenceNumber();
1081 tag->setName(QString::fromStdString(result.name));1084 tag->setName(QString::fromStdString(result.name));
1082 m_tagsHash.insert(tag->guid(), tag);1085 m_tagsHash.insert(tag->guid(), tag);
1083 m_tags.append(tag);1086 m_tags.append(tag);
@@ -1100,7 +1103,7 @@
1100 tag->setLoading(true);1103 tag->setLoading(true);
1101 emit tagChanged(tag->guid());1104 emit tagChanged(tag->guid());
1102 } else {1105 } else {
1103 qWarning() << "CONFLICT in tag" << tag->name();1106 qCWarning(dcSync) << "CONFLICT in tag" << tag->name();
1104 tag->setSyncError(true);1107 tag->setSyncError(true);
1105 emit tagChanged(tag->guid());1108 emit tagChanged(tag->guid());
1106 }1109 }
@@ -1183,7 +1186,7 @@
1183{1186{
1184 Note *note = m_notesHash.value(tmpGuid);1187 Note *note = m_notesHash.value(tmpGuid);
1185 if (!note) {1188 if (!note) {
1186 qWarning() << "Cannot find temporary note after create operation!";1189 qCWarning(dcSync) << "Cannot find temporary note after create operation!";
1187 return;1190 return;
1188 }1191 }
1189 int idx = m_notes.indexOf(note);1192 int idx = m_notes.indexOf(note);
@@ -1193,7 +1196,7 @@
1193 roles << RoleLoading;1196 roles << RoleLoading;
11941197
1195 if (errorCode != EvernoteConnection::ErrorCodeNoError) {1198 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
1196 qWarning() << "Error creating note:" << tmpGuid << errorMessage;1199 qCWarning(dcSync) << "Error creating note on server:" << tmpGuid << errorMessage;
1197 note->setSyncError(true);1200 note->setSyncError(true);
1198 roles << RoleSyncError;1201 roles << RoleSyncError;
1199 emit dataChanged(index(idx), index(idx), roles);1202 emit dataChanged(index(idx), index(idx), roles);
@@ -1206,7 +1209,7 @@
1206 }1209 }
12071210
1208 QString guid = QString::fromStdString(result.guid);1211 QString guid = QString::fromStdString(result.guid);
1209 qDebug() << "Note created on server. Old guid:" << tmpGuid << "New guid:" << guid;1212 qCDebug(dcSync) << "Note created on server. Old guid:" << tmpGuid << "New guid:" << guid;
1210 m_notesHash.insert(guid, note);1213 m_notesHash.insert(guid, note);
1211 note->setGuid(guid);1214 note->setGuid(guid);
1212 m_notesHash.remove(tmpGuid);1215 m_notesHash.remove(tmpGuid);
@@ -1252,7 +1255,7 @@
1252{1255{
1253 Note *note = m_notesHash.value(guid);1256 Note *note = m_notesHash.value(guid);
1254 if (!note) {1257 if (!note) {
1255 qWarning() << "Can't save note. Guid not found:" << guid;1258 qCWarning(dcNotesStore) << "Can't save note. Guid not found:" << guid;
1256 return;1259 return;
1257 }1260 }
1258 note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);1261 note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);
@@ -1283,10 +1286,10 @@
12831286
1284void NotesStore::saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result)1287void NotesStore::saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result)
1285{1288{
1286 qDebug() << "saveNoteJobDone. guid:" << QString::fromStdString(result.guid);1289 qCDebug(dcSync) << "Note saved to server:" << QString::fromStdString(result.guid);
1287 Note *note = m_notesHash.value(QString::fromStdString(result.guid));1290 Note *note = m_notesHash.value(QString::fromStdString(result.guid));
1288 if (!note) {1291 if (!note) {
1289 qWarning() << "Got a save note job result, but note has disappeared locally.";1292 qCWarning(dcSync) << "Got a save note job result, but note has disappeared locally.";
1290 return;1293 return;
1291 }1294 }
12921295
@@ -1294,7 +1297,7 @@
1294 note->setLoading(false);1297 note->setLoading(false);
12951298
1296 if (errorCode != EvernoteConnection::ErrorCodeNoError) {1299 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
1297 qWarning() << "Error saving note:" << errorMessage;1300 qCWarning(dcSync) << "Error saving note:" << errorMessage;
1298 note->setSyncError(true);1301 note->setSyncError(true);
1299 emit dataChanged(index(idx), index(idx), QVector<int>() << RoleLoading << RoleSyncError);1302 emit dataChanged(index(idx), index(idx), QVector<int>() << RoleLoading << RoleSyncError);
1300 return;1303 return;
@@ -1317,16 +1320,16 @@
1317void NotesStore::saveNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result)1320void NotesStore::saveNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result)
1318{1321{
1319 if (errorCode != EvernoteConnection::ErrorCodeNoError) {1322 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
1320 qWarning() << "error saving notebook" << errorMessage;1323 qCWarning(dcSync) << "Error saving notebook to server" << errorMessage;
1321 return;1324 return;
1322 }1325 }
13231326
1324 Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));1327 Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));
1325 if (!notebook) {1328 if (!notebook) {
1326 qWarning() << "Save notebook job done but notebook can't be found any more!";1329 qCWarning(dcSync) << "Save notebook job done but notebook can't be found any more!";
1327 return;1330 return;
1328 }1331 }
1329 qDebug() << "save notebook done for:" << notebook->name() << notebook->lastSyncedSequenceNumber() << notebook->updateSequenceNumber() << result.updateSequenceNum;1332 qCDebug(dcSync) << "Notebooks saved to server:" << notebook->guid();
1330 updateFromEDAM(result, notebook);1333 updateFromEDAM(result, notebook);
1331 notebook->setLoading(false);1334 notebook->setLoading(false);
1332 emit notebookChanged(notebook->guid());1335 emit notebookChanged(notebook->guid());
@@ -1337,7 +1340,7 @@
1337{1340{
1338 Note *note = m_notesHash.value(guid);1341 Note *note = m_notesHash.value(guid);
1339 if (!note) {1342 if (!note) {
1340 qWarning() << "Note not found. Can't delete";1343 qCWarning(dcNotesStore) << "Note not found. Can't delete";
1341 return;1344 return;
1342 }1345 }
13431346
@@ -1354,7 +1357,7 @@
1354 note->deleteLater();1357 note->deleteLater();
1355 } else {1358 } else {
13561359
1357 qDebug() << "setting note" << note << "to deleted" << idx;1360 qCDebug(dcNotesStore) << "Setting note to deleted:" << note->guid();
1358 note->setDeleted(true);1361 note->setDeleted(true);
1359 note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);1362 note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);
1360 emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted);1363 emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted);
@@ -1400,7 +1403,7 @@
1400void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)1403void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
1401{1404{
1402 if (errorCode != EvernoteConnection::ErrorCodeNoError) {1405 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
1403 qWarning() << "Cannot delete note:" << errorMessage;1406 qCWarning(dcSync) << "Cannot delete note from server:" << errorMessage;
1404 return;1407 return;
1405 }1408 }
1406 Note *note = m_notesHash.value(guid);1409 Note *note = m_notesHash.value(guid);
@@ -1420,7 +1423,7 @@
1420void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)1423void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
1421{1424{
1422 if (errorCode != EvernoteConnection::ErrorCodeNoError) {1425 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
1423 qWarning() << "Error expunging notebook:" << errorMessage;1426 qCWarning(dcSync) << "Error expunging notebook:" << errorMessage;
1424 return;1427 return;
1425 }1428 }
1426 emit notebookRemoved(guid);1429 emit notebookRemoved(guid);
@@ -1465,7 +1468,7 @@
14651468
1466void NotesStore::syncToCacheFile(Note *note)1469void NotesStore::syncToCacheFile(Note *note)
1467{1470{
1468 qDebug() << "syncToCacheFile for note" << note->guid();1471 qCDebug(dcNotesStore) << "Syncing note to disk:" << note->guid();
1469 QSettings cacheFile(m_cacheFile, QSettings::IniFormat);1472 QSettings cacheFile(m_cacheFile, QSettings::IniFormat);
1470 cacheFile.beginGroup("notes");1473 cacheFile.beginGroup("notes");
1471 cacheFile.setValue(note->guid(), note->updateSequenceNumber());1474 cacheFile.setValue(note->guid(), note->updateSequenceNumber());
@@ -1515,6 +1518,7 @@
1515 }1518 }
1516 }1519 }
1517 cacheFile.endGroup();1520 cacheFile.endGroup();
1521 qCDebug(dcNotesStore) << "Loaded" << m_notebooks.count() << "notebooks from disk.";
15181522
1519 cacheFile.beginGroup("tags");1523 cacheFile.beginGroup("tags");
1520 if (cacheFile.allKeys().count() > 0) {1524 if (cacheFile.allKeys().count() > 0) {
@@ -1526,13 +1530,14 @@
1526 }1530 }
1527 }1531 }
1528 cacheFile.endGroup();1532 cacheFile.endGroup();
1533 qCDebug(dcNotesStore) << "Loaded" << m_tags.count() << "tags from disk.";
15291534
1530 cacheFile.beginGroup("notes");1535 cacheFile.beginGroup("notes");
1531 if (cacheFile.allKeys().count() > 0) {1536 if (cacheFile.allKeys().count() > 0) {
1532 beginInsertRows(QModelIndex(), 0, cacheFile.allKeys().count()-1);1537 beginInsertRows(QModelIndex(), 0, cacheFile.allKeys().count()-1);
1533 foreach (const QString &key, cacheFile.allKeys()) {1538 foreach (const QString &key, cacheFile.allKeys()) {
1534 if (m_notesHash.contains(key)) {1539 if (m_notesHash.contains(key)) {
1535 qWarning() << "already have note. Not reloading from cache.";1540 qCWarning(dcNotesStore) << "already have note. Not reloading from cache.";
1536 continue;1541 continue;
1537 }1542 }
1538 Note *note = new Note(key, cacheFile.value(key).toUInt(), this);1543 Note *note = new Note(key, cacheFile.value(key).toUInt(), this);
@@ -1543,6 +1548,7 @@
1543 endInsertRows();1548 endInsertRows();
1544 }1549 }
1545 cacheFile.endGroup();1550 cacheFile.endGroup();
1551 qCDebug(dcNotesStore) << "Loaded" << m_notes.count() << "notes from disk.";
1546}1552}
15471553
1548QVector<int> NotesStore::updateFromEDAM(const evernote::edam::NoteMetadata &evNote, Note *note)1554QVector<int> NotesStore::updateFromEDAM(const evernote::edam::NoteMetadata &evNote, Note *note)
@@ -1623,7 +1629,6 @@
1623 if (evNotebook.__isset.published && evNotebook.published != notebook->published()) {1629 if (evNotebook.__isset.published && evNotebook.published != notebook->published()) {
1624 notebook->setPublished(evNotebook.published);1630 notebook->setPublished(evNotebook.published);
1625 }1631 }
1626 qDebug() << "readong from evernote:" << evNotebook.__isset.defaultNotebook << evNotebook.defaultNotebook << notebook->name();
1627 if (evNotebook.__isset.defaultNotebook && evNotebook.defaultNotebook != notebook->isDefaultNotebook()) {1632 if (evNotebook.__isset.defaultNotebook && evNotebook.defaultNotebook != notebook->isDefaultNotebook()) {
1628 notebook->setIsDefaultNotebook(evNotebook.defaultNotebook);1633 notebook->setIsDefaultNotebook(evNotebook.defaultNotebook);
1629 }1634 }
@@ -1634,7 +1639,7 @@
1634void NotesStore::expungeTag(const QString &guid)1639void NotesStore::expungeTag(const QString &guid)
1635{1640{
1636 if (m_username != "@local") {1641 if (m_username != "@local") {
1637 qWarning() << "This account is managed by Evernote. Cannot delete tags.";1642 qCWarning(dcNotesStore) << "This account is managed by Evernote. Cannot delete tags.";
1638 m_errorQueue.append(gettext("This account is managed by Evernote. Please use the Evernote website to delete tags."));1643 m_errorQueue.append(gettext("This account is managed by Evernote. Please use the Evernote website to delete tags."));
1639 emit errorChanged();1644 emit errorChanged();
1640 return;1645 return;
@@ -1642,7 +1647,7 @@
16421647
1643 Tag *tag = m_tagsHash.value(guid);1648 Tag *tag = m_tagsHash.value(guid);
1644 if (!tag) {1649 if (!tag) {
1645 qWarning() << "[NotesStore] No tag with guid" << guid;1650 qCWarning(dcNotesStore) << "No tag with guid" << guid;
1646 return;1651 return;
1647 }1652 }
16481653
@@ -1650,7 +1655,7 @@
1650 QString noteGuid = tag->noteAt(0);1655 QString noteGuid = tag->noteAt(0);
1651 Note *note = m_notesHash.value(noteGuid);1656 Note *note = m_notesHash.value(noteGuid);
1652 if (!note) {1657 if (!note) {
1653 qWarning() << "[NotesStore] Tag holds note" << noteGuid << "which hasn't been found in Notes Store";1658 qCWarning(dcNotesStore) << "Tag holds note" << noteGuid << "which hasn't been found in Notes Store";
1654 continue;1659 continue;
1655 }1660 }
1656 untagNote(noteGuid, guid);1661 untagNote(noteGuid, guid);
16571662
=== modified file 'src/libqtevernote/resource.cpp'
--- src/libqtevernote/resource.cpp 2015-02-27 00:43:59 +0000
+++ src/libqtevernote/resource.cpp 2015-03-06 18:02:44 +0000
@@ -20,10 +20,10 @@
2020
21#include "resource.h"21#include "resource.h"
22#include "notesstore.h"22#include "notesstore.h"
23#include "logging.h"
2324
24#include <QFile>25#include <QFile>
25#include <QStandardPaths>26#include <QStandardPaths>
26#include <QDebug>
27#include <QCryptographicHash>27#include <QCryptographicHash>
28#include <QFileInfo>28#include <QFileInfo>
29#include <QDir>29#include <QDir>
@@ -44,7 +44,7 @@
44 if (!data.isEmpty() && !file.exists()) {44 if (!data.isEmpty() && !file.exists()) {
4545
46 if (!file.open(QFile::WriteOnly)) {46 if (!file.open(QFile::WriteOnly)) {
47 qWarning() << "error writing file" << m_filePath;47 qCWarning(dcNotesStore) << "error writing file" << m_filePath;
48 return;48 return;
49 }49 }
50 file.write(data);50 file.write(data);
@@ -69,7 +69,7 @@
6969
70 QFile file(path);70 QFile file(path);
71 if (!file.open(QFile::ReadOnly)) {71 if (!file.open(QFile::ReadOnly)) {
72 qWarning() << "Cannot open file for reading...";72 qCWarning(dcNotesStore) << "Cannot open file for reading...";
73 return;73 return;
74 }74 }
75 QByteArray fileContent = file.readAll();75 QByteArray fileContent = file.readAll();
@@ -84,7 +84,7 @@
84 } else if (m_fileName.endsWith(".gif")) {84 } else if (m_fileName.endsWith(".gif")) {
85 m_type = "image/gif";85 m_type = "image/gif";
86 } else {86 } else {
87 qWarning() << "cannot determine mime type of file" << m_fileName;87 qCWarning(dcNotesStore) << "cannot determine mime type of file" << m_fileName;
88 }88 }
8989
90 m_filePath = NotesStore::instance()->storageLocation() + m_hash + "." + m_fileName.split('.').last();90 m_filePath = NotesStore::instance()->storageLocation() + m_hash + "." + m_fileName.split('.').last();
@@ -93,7 +93,7 @@
93 if (!copy.exists()) {93 if (!copy.exists()) {
9494
95 if (!copy.open(QFile::WriteOnly)) {95 if (!copy.open(QFile::WriteOnly)) {
96 qWarning() << "error writing file" << m_filePath;96 qCWarning(dcNotesStore) << "error writing file" << m_filePath;
97 return;97 return;
98 }98 }
99 copy.write(fileContent);99 copy.write(fileContent);
100100
=== modified file 'src/libqtevernote/resourceimageprovider.cpp'
--- src/libqtevernote/resourceimageprovider.cpp 2015-02-20 22:35:03 +0000
+++ src/libqtevernote/resourceimageprovider.cpp 2015-03-06 18:02:44 +0000
@@ -1,10 +1,10 @@
1#include "resourceimageprovider.h"1#include "resourceimageprovider.h"
2#include "logging.h"
23
3#include <notesstore.h>4#include <notesstore.h>
4#include <note.h>5#include <note.h>
56
6#include <QUrlQuery>7#include <QUrlQuery>
7#include <QDebug>
88
9ResourceImageProvider::ResourceImageProvider():9ResourceImageProvider::ResourceImageProvider():
10 QQuickImageProvider(QQuickImageProvider::Image)10 QQuickImageProvider(QQuickImageProvider::Image)
@@ -20,7 +20,7 @@
20 QString resourceHash = arguments.queryItemValue("hash");20 QString resourceHash = arguments.queryItemValue("hash");
21 Note *note = NotesStore::instance()->note(noteGuid);21 Note *note = NotesStore::instance()->note(noteGuid);
22 if (!note) {22 if (!note) {
23 qWarning() << "Unable to find note for resource:" << id;23 qCWarning(dcNotesStore) << "Unable to find note for resource:" << id;
24 return QImage();24 return QImage();
25 }25 }
2626
2727
=== modified file 'src/libqtevernote/tag.h'
--- src/libqtevernote/tag.h 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/tag.h 2015-03-06 18:02:44 +0000
@@ -23,7 +23,6 @@
2323
24#include "utils/enmldocument.h"24#include "utils/enmldocument.h"
25#include "resource.h"25#include "resource.h"
26#include "utils/textformat.h"
2726
28#include <QObject>27#include <QObject>
29#include <QDateTime>28#include <QDateTime>
3029
=== modified file 'src/libqtevernote/tags.cpp'
--- src/libqtevernote/tags.cpp 2015-03-04 00:23:45 +0000
+++ src/libqtevernote/tags.cpp 2015-03-06 18:02:44 +0000
@@ -21,8 +21,6 @@
21#include "tags.h"21#include "tags.h"
22#include "tag.h"22#include "tag.h"
2323
24#include <QDebug>
25
26Tags::Tags(QObject *parent) :24Tags::Tags(QObject *parent) :
27 QAbstractListModel(parent)25 QAbstractListModel(parent)
28{26{
2927
=== modified file 'src/libqtevernote/userstore.cpp'
--- src/libqtevernote/userstore.cpp 2014-12-09 18:50:55 +0000
+++ src/libqtevernote/userstore.cpp 2015-03-06 18:02:44 +0000
@@ -21,6 +21,7 @@
21#include "userstore.h"21#include "userstore.h"
22#include "evernoteconnection.h"22#include "evernoteconnection.h"
23#include "jobs/fetchusernamejob.h"23#include "jobs/fetchusernamejob.h"
24#include "logging.h"
2425
25// Evernote sdk26// Evernote sdk
26#include <UserStore.h>27#include <UserStore.h>
@@ -34,8 +35,6 @@
34#include <transport/TSSLSocket.h>35#include <transport/TSSLSocket.h>
35#include <Thrift.h>36#include <Thrift.h>
3637
37#include <QDebug>
38
39using namespace apache::thrift;38using namespace apache::thrift;
40using namespace apache::thrift::protocol;39using namespace apache::thrift::protocol;
41using namespace apache::thrift::transport;40using namespace apache::thrift::transport;
@@ -78,7 +77,7 @@
78void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result)77void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result)
79{78{
80 if (errorCode != EvernoteConnection::ErrorCodeNoError) {79 if (errorCode != EvernoteConnection::ErrorCodeNoError) {
81 qWarning() << "Error fetching username:" << errorMessage;80 qCWarning(dcConnection) << "Error fetching username:" << errorMessage;
82 return;81 return;
83 }82 }
8483
8584
=== modified file 'src/libqtevernote/utils/enmldocument.cpp'
--- src/libqtevernote/utils/enmldocument.cpp 2015-03-05 18:23:25 +0000
+++ src/libqtevernote/utils/enmldocument.cpp 2015-03-06 18:02:44 +0000
@@ -21,6 +21,7 @@
21#include "enmldocument.h"21#include "enmldocument.h"
22#include "notesstore.h"22#include "notesstore.h"
23#include "note.h"23#include "note.h"
24#include "logging.h"
2425
25#include <QXmlStreamReader>26#include <QXmlStreamReader>
26#include <QXmlStreamWriter>27#include <QXmlStreamWriter>
@@ -28,7 +29,6 @@
28#include <QUrl>29#include <QUrl>
29#include <QUrlQuery>30#include <QUrlQuery>
30#include <QStandardPaths>31#include <QStandardPaths>
31#include <QDebug>
3232
33// ENML spec: http://xml.evernote.com/pub/enml2.dtd33// ENML spec: http://xml.evernote.com/pub/enml2.dtd
34// QML supported HTML subset: http://qt-project.org/doc/qt-5.0/qtgui/richtext-html-subset.html34// QML supported HTML subset: http://qt-project.org/doc/qt-5.0/qtgui/richtext-html-subset.html
@@ -203,7 +203,7 @@
203 }203 }
204 }204 }
205 } else {205 } else {
206 qDebug() << "unknown mediatype" << mediaType;206 qCWarning(dcEnml) << "Unknown mediatype" << mediaType;
207 if (type == TypeRichText) {207 if (type == TypeRichText) {
208 writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash));208 writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash));
209 } else if (type == TypeHtml) {209 } else if (type == TypeHtml) {
@@ -276,7 +276,7 @@
276276
277 writer.writeEndElement();277 writer.writeEndElement();
278 writer.writeEndDocument();278 writer.writeEndDocument();
279 qDebug() << "converted to html" << html;279 qCDebug(dcEnml) << QString("Converted to %1:").arg(type == TypeHtml ? "HTML" : "RichText") << html;
280 return html;280 return html;
281}281}
282282
283283
=== modified file 'src/libqtevernote/utils/organizeradapter.cpp'
--- src/libqtevernote/utils/organizeradapter.cpp 2015-02-28 02:48:16 +0000
+++ src/libqtevernote/utils/organizeradapter.cpp 2015-03-06 18:02:44 +0000
@@ -1,7 +1,7 @@
1#include "organizeradapter.h"1#include "organizeradapter.h"
2#include "notesstore.h"2#include "notesstore.h"
3#include "logging.h"
34
4#include <QDebug>
5#include <QOrganizerItemVisualReminder>5#include <QOrganizerItemVisualReminder>
6#include <QOrganizerItemAudibleReminder>6#include <QOrganizerItemAudibleReminder>
7#include <QOrganizerItemSaveRequest>7#include <QOrganizerItemSaveRequest>
@@ -47,12 +47,12 @@
47 // EDS requires extra metadata to be set47 // EDS requires extra metadata to be set
48 m_collection.setExtendedMetaData("collection-type", "Task List");48 m_collection.setExtendedMetaData("collection-type", "Task List");
49 if (!m_manager->saveCollection(&m_collection)) {49 if (!m_manager->saveCollection(&m_collection)) {
50 qWarning() << "WARNING: Creating dedicated collection for reminders was not possible, reminders will be saved into the default collection!";50 qCWarning(dcOrganizer) << "WARNING: Creating dedicated collection for reminders was not possible, reminders will be saved into the default collection!";
51 m_collection = m_manager->defaultCollection();51 m_collection = m_manager->defaultCollection();
52 }52 }
53 }53 }
5454
55 qDebug() << "have collection" << m_collection.id().toString();55 qCDebug(dcOrganizer) << "Have Organizer collection" << m_collection.id().toString();
56}56}
5757
58void OrganizerAdapter::startSync()58void OrganizerAdapter::startSync()
@@ -133,7 +133,7 @@
133 }133 }
134134
135 if (state == QOrganizerAbstractRequest::CanceledState) {135 if (state == QOrganizerAbstractRequest::CanceledState) {
136 qWarning() << "Error syncing reminders. Could not read organizer items.";136 qCWarning(dcOrganizer) << "Error syncing reminders. Could not read organizer items.";
137 m_busy = false;137 m_busy = false;
138 request->deleteLater();138 request->deleteLater();
139 return;139 return;
140140
=== removed file 'src/libqtevernote/utils/textformat.cpp'
--- src/libqtevernote/utils/textformat.cpp 2014-01-29 16:04:00 +0000
+++ src/libqtevernote/utils/textformat.cpp 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
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 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
19 */
20
21#include "textformat.h"
22
23TextFormat::TextFormat(QObject *parent): QObject(parent)
24{
25}
260
=== removed file 'src/libqtevernote/utils/textformat.h'
--- src/libqtevernote/utils/textformat.h 2014-01-29 18:27:11 +0000
+++ src/libqtevernote/utils/textformat.h 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
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 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
19 */
20
21#ifndef TEXTFORMAT_H
22#define TEXTFORMAT_H
23
24#include <QObject>
25
26class TextFormat: public QObject
27{
28 Q_OBJECT
29 Q_ENUMS(Format)
30public:
31 enum Format {
32 Bold,
33 Italic,
34 Underlined
35 };
36 Q_DECLARE_FLAGS(Formats, Format)
37
38 TextFormat(QObject *parent = 0);
39};
40Q_DECLARE_OPERATORS_FOR_FLAGS(TextFormat::Formats)
41Q_DECLARE_METATYPE(TextFormat::Format)
42
43#endif
440
=== modified file 'src/plugin/Evernote/evernoteplugin.cpp'
--- src/plugin/Evernote/evernoteplugin.cpp 2014-10-09 00:08:52 +0000
+++ src/plugin/Evernote/evernoteplugin.cpp 2015-03-06 18:02:44 +0000
@@ -32,8 +32,6 @@
32#include "tag.h"32#include "tag.h"
33#include "resourceimageprovider.h"33#include "resourceimageprovider.h"
3434
35#include "utils/textformat.h"
36
37#include <QtQml>35#include <QtQml>
3836
39static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)37static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
@@ -64,8 +62,6 @@
64 qmlRegisterUncreatableType<Notebook>(uri, 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead.");62 qmlRegisterUncreatableType<Notebook>(uri, 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead.");
65 qmlRegisterUncreatableType<Tag>(uri, 0, 1, "Tag", "Cannot create Tags in QML. Use NotesStore.createTag() instead.");63 qmlRegisterUncreatableType<Tag>(uri, 0, 1, "Tag", "Cannot create Tags in QML. Use NotesStore.createTag() instead.");
66 qmlRegisterUncreatableType<Resource>(uri, 0, 1, "Resource", "Cannot create Resources. Use Note.attachFile() instead.");64 qmlRegisterUncreatableType<Resource>(uri, 0, 1, "Resource", "Cannot create Resources. Use Note.attachFile() instead.");
67
68 qmlRegisterUncreatableType<TextFormat>(uri, 0, 1, "TextFormat", "TextFormat is not creatable. It's just here to export enums to QML");
69}65}
7066
71void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri)67void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri)

Subscribers

People subscribed via source and target branches