Merge lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
- cleanup-debug
- Merge into trunk
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 | ||||
Related bugs: |
|
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
Description of the change
- 376. By Michael Zanetti
-
drop qdebug includes
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 377. By Michael Zanetti
-
some more improvements
- 378. By Michael Zanetti
-
disable jobqueue output by default
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:376
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:378
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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/
NotesStore: Creating NotesStore instance.
and so on... I have all usual debug messages
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
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:379
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:380
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Riccardo Padovani (rpadovani) wrote : | # |
Definitely better, thanks!
Preview Diff
1 | === modified file 'src/app/formattinghelper.cpp' | |||
2 | --- src/app/formattinghelper.cpp 2014-11-12 22:14:59 +0000 | |||
3 | +++ src/app/formattinghelper.cpp 2015-03-06 18:02:44 +0000 | |||
4 | @@ -21,7 +21,6 @@ | |||
5 | 21 | 21 | ||
6 | 22 | #include "formattinghelper.h" | 22 | #include "formattinghelper.h" |
7 | 23 | 23 | ||
8 | 24 | #include <QDebug> | ||
9 | 25 | #include <QTextBlock> | 24 | #include <QTextBlock> |
10 | 26 | #include <QTextObject> | 25 | #include <QTextObject> |
11 | 27 | #include <QTextCharFormat> | 26 | #include <QTextCharFormat> |
12 | 28 | 27 | ||
13 | === modified file 'src/app/main.cpp' | |||
14 | --- src/app/main.cpp 2015-02-24 18:55:55 +0000 | |||
15 | +++ src/app/main.cpp 2015-03-06 18:02:44 +0000 | |||
16 | @@ -29,7 +29,22 @@ | |||
17 | 29 | #include <QLibrary> | 29 | #include <QLibrary> |
18 | 30 | #include <QCommandLineParser> | 30 | #include <QCommandLineParser> |
19 | 31 | #include <QCommandLineOption> | 31 | #include <QCommandLineOption> |
21 | 32 | #include <QDebug> | 32 | #include <QLoggingCategory> |
22 | 33 | |||
23 | 34 | QHash<QString, bool> s_loggingFilters; | ||
24 | 35 | QLoggingCategory dcApplication("Application"); | ||
25 | 36 | |||
26 | 37 | void loggingCategoryFilter(QLoggingCategory *category) | ||
27 | 38 | { | ||
28 | 39 | if (s_loggingFilters.contains(category->categoryName())) { | ||
29 | 40 | bool debugEnabled = s_loggingFilters.value(category->categoryName()); | ||
30 | 41 | category->setEnabled(QtDebugMsg, debugEnabled); | ||
31 | 42 | category->setEnabled(QtWarningMsg, debugEnabled || s_loggingFilters.value("Warnings")); | ||
32 | 43 | } else { | ||
33 | 44 | category->setEnabled(QtDebugMsg, false); | ||
34 | 45 | category->setEnabled(QtWarningMsg, s_loggingFilters.value("qml") || s_loggingFilters.value("Warnings")); | ||
35 | 46 | } | ||
36 | 47 | } | ||
37 | 33 | 48 | ||
38 | 34 | int main(int argc, char *argv[]) | 49 | int main(int argc, char *argv[]) |
39 | 35 | { | 50 | { |
40 | @@ -37,6 +52,16 @@ | |||
41 | 37 | QQuickView view; | 52 | QQuickView view; |
42 | 38 | view.setResizeMode(QQuickView::SizeRootObjectToView); | 53 | view.setResizeMode(QQuickView::SizeRootObjectToView); |
43 | 39 | 54 | ||
44 | 55 | s_loggingFilters.insert("Warnings", true); | ||
45 | 56 | s_loggingFilters.insert("Application", true); | ||
46 | 57 | s_loggingFilters.insert("NotesStore", true); | ||
47 | 58 | s_loggingFilters.insert("JobQueue", false); | ||
48 | 59 | s_loggingFilters.insert("Sync", true); | ||
49 | 60 | s_loggingFilters.insert("Connection", true); | ||
50 | 61 | s_loggingFilters.insert("Enml", false); | ||
51 | 62 | s_loggingFilters.insert("Organizer", false); | ||
52 | 63 | s_loggingFilters.insert("qml", true); | ||
53 | 64 | |||
54 | 40 | // Set up import paths | 65 | // Set up import paths |
55 | 41 | QStringList importPathList = view.engine()->importPathList(); | 66 | QStringList importPathList = view.engine()->importPathList(); |
56 | 42 | // Prepend the location of the plugin in the build dir, | 67 | // Prepend the location of the plugin in the build dir, |
57 | @@ -50,10 +75,16 @@ | |||
58 | 50 | cmdLineParser.addOption(phoneFactorOption); | 75 | cmdLineParser.addOption(phoneFactorOption); |
59 | 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."); |
60 | 52 | cmdLineParser.addOption(tabletFactorOption); | 77 | cmdLineParser.addOption(tabletFactorOption); |
62 | 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"); |
63 | 54 | cmdLineParser.addOption(importPathOption); | 79 | cmdLineParser.addOption(importPathOption); |
64 | 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."); |
65 | 56 | cmdLineParser.addOption(sandboxOption); | 81 | cmdLineParser.addOption(sandboxOption); |
66 | 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:"); | ||
67 | 83 | foreach (const QString &filterName, s_loggingFilters.keys()) { | ||
68 | 84 | debugDescription += "\n" + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")"; | ||
69 | 85 | } | ||
70 | 86 | QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "[No]DebugCategory"); | ||
71 | 87 | cmdLineParser.addOption(debugOption); | ||
72 | 57 | QCommandLineOption testabilityOption("testability", "Load the testability driver."); | 88 | QCommandLineOption testabilityOption("testability", "Load the testability driver."); |
73 | 58 | cmdLineParser.addOption(testabilityOption); | 89 | cmdLineParser.addOption(testabilityOption); |
74 | 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."); |
75 | @@ -61,6 +92,17 @@ | |||
76 | 61 | 92 | ||
77 | 62 | cmdLineParser.process(a); | 93 | cmdLineParser.process(a); |
78 | 63 | 94 | ||
79 | 95 | foreach (QString debugArea, cmdLineParser.values(debugOption)) { | ||
80 | 96 | bool enable = !debugArea.startsWith("No"); | ||
81 | 97 | debugArea.remove(QRegExp("^No")); | ||
82 | 98 | if (s_loggingFilters.contains(debugArea)) { | ||
83 | 99 | s_loggingFilters[debugArea] = enable; | ||
84 | 100 | } else { | ||
85 | 101 | qWarning() << "No such debug category:" << debugArea; | ||
86 | 102 | } | ||
87 | 103 | } | ||
88 | 104 | QLoggingCategory::installFilter(loggingCategoryFilter); | ||
89 | 105 | |||
90 | 64 | foreach (QString addedPath, cmdLineParser.values(importPathOption)) { | 106 | foreach (QString addedPath, cmdLineParser.values(importPathOption)) { |
91 | 65 | if (addedPath == "." || addedPath.startsWith("./")) { | 107 | if (addedPath == "." || addedPath.startsWith("./")) { |
92 | 66 | addedPath = addedPath.right(addedPath.length() - 1); | 108 | addedPath = addedPath.right(addedPath.length() - 1); |
93 | @@ -86,20 +128,20 @@ | |||
94 | 86 | 128 | ||
95 | 87 | if (cmdLineParser.isSet(sandboxOption)) { | 129 | if (cmdLineParser.isSet(sandboxOption)) { |
96 | 88 | view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(true)); | 130 | view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(true)); |
98 | 89 | qDebug() << "Running against the sandbox server"; | 131 | qCDebug(dcApplication) << "Running against the sandbox server"; |
99 | 90 | } else { | 132 | } else { |
100 | 91 | view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(false)); | 133 | view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(false)); |
102 | 92 | qDebug() << "Running against the production server"; | 134 | qCDebug(dcApplication) << "Running against the production server"; |
103 | 93 | } | 135 | } |
104 | 94 | 136 | ||
105 | 95 | view.engine()->rootContext()->setContextProperty("tablet", QVariant(false)); | 137 | view.engine()->rootContext()->setContextProperty("tablet", QVariant(false)); |
106 | 96 | view.engine()->rootContext()->setContextProperty("phone", QVariant(false)); | 138 | view.engine()->rootContext()->setContextProperty("phone", QVariant(false)); |
107 | 97 | 139 | ||
108 | 98 | if (cmdLineParser.isSet(tabletFactorOption)) { | 140 | if (cmdLineParser.isSet(tabletFactorOption)) { |
110 | 99 | qDebug() << "running in tablet mode"; | 141 | qCDebug(dcApplication) << "Running in tablet mode"; |
111 | 100 | view.engine()->rootContext()->setContextProperty("tablet", QVariant(true)); | 142 | view.engine()->rootContext()->setContextProperty("tablet", QVariant(true)); |
112 | 101 | } else if (cmdLineParser.isSet(phoneFactorOption)){ | 143 | } else if (cmdLineParser.isSet(phoneFactorOption)){ |
114 | 102 | qDebug() << "running in phone mode"; | 144 | qCDebug(dcApplication) << "Running in phone mode"; |
115 | 103 | view.engine()->rootContext()->setContextProperty("phone", QVariant(true)); | 145 | view.engine()->rootContext()->setContextProperty("phone", QVariant(true)); |
116 | 104 | } else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") { | 146 | } else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") { |
117 | 105 | // Default to tablet size on X11 | 147 | // Default to tablet size on X11 |
118 | @@ -140,7 +182,7 @@ | |||
119 | 140 | // So if you want to change it, make sure to find all the places where it is set, not just here :D | 182 | // So if you want to change it, make sure to find all the places where it is set, not just here :D |
120 | 141 | QCoreApplication::setApplicationName("com.ubuntu.reminders"); | 183 | QCoreApplication::setApplicationName("com.ubuntu.reminders"); |
121 | 142 | 184 | ||
123 | 143 | qDebug() << "using main qml file from:" << qmlfile; | 185 | qCDebug(dcApplication) << "Using main qml file from:" << qmlfile; |
124 | 144 | view.setSource(QUrl::fromLocalFile(qmlfile)); | 186 | view.setSource(QUrl::fromLocalFile(qmlfile)); |
125 | 145 | view.show(); | 187 | view.show(); |
126 | 146 | 188 | ||
127 | 147 | 189 | ||
128 | === modified file 'src/app/preferences.h' | |||
129 | --- src/app/preferences.h 2015-02-23 18:00:46 +0000 | |||
130 | +++ src/app/preferences.h 2015-03-06 18:02:44 +0000 | |||
131 | @@ -26,7 +26,6 @@ | |||
132 | 26 | #include <QSettings> | 26 | #include <QSettings> |
133 | 27 | #include <QStandardPaths> | 27 | #include <QStandardPaths> |
134 | 28 | #include <QObject> | 28 | #include <QObject> |
135 | 29 | #include <QDebug> | ||
136 | 30 | #include <QList> | 29 | #include <QList> |
137 | 31 | #include <QColor> | 30 | #include <QColor> |
138 | 32 | 31 | ||
139 | 33 | 32 | ||
140 | === modified file 'src/libqtevernote/CMakeLists.txt' | |||
141 | --- src/libqtevernote/CMakeLists.txt 2014-12-06 22:35:01 +0000 | |||
142 | +++ src/libqtevernote/CMakeLists.txt 2015-03-06 18:02:44 +0000 | |||
143 | @@ -14,6 +14,7 @@ | |||
144 | 14 | notebook.cpp | 14 | notebook.cpp |
145 | 15 | tag.cpp | 15 | tag.cpp |
146 | 16 | tags.cpp | 16 | tags.cpp |
147 | 17 | logging.cpp | ||
148 | 17 | jobs/fetchnotesjob.cpp | 18 | jobs/fetchnotesjob.cpp |
149 | 18 | jobs/fetchnotebooksjob.cpp | 19 | jobs/fetchnotebooksjob.cpp |
150 | 19 | jobs/fetchnotejob.cpp | 20 | jobs/fetchnotejob.cpp |
151 | @@ -33,7 +34,6 @@ | |||
152 | 33 | jobs/savetagjob.cpp | 34 | jobs/savetagjob.cpp |
153 | 34 | resourceimageprovider.cpp | 35 | resourceimageprovider.cpp |
154 | 35 | utils/enmldocument.cpp | 36 | utils/enmldocument.cpp |
155 | 36 | utils/textformat.cpp | ||
156 | 37 | utils/organizeradapter.cpp | 37 | utils/organizeradapter.cpp |
157 | 38 | ) | 38 | ) |
158 | 39 | 39 | ||
159 | 40 | 40 | ||
160 | === modified file 'src/libqtevernote/evernoteconnection.cpp' | |||
161 | --- src/libqtevernote/evernoteconnection.cpp 2015-02-27 21:32:29 +0000 | |||
162 | +++ src/libqtevernote/evernoteconnection.cpp 2015-03-06 18:02:44 +0000 | |||
163 | @@ -21,6 +21,7 @@ | |||
164 | 21 | 21 | ||
165 | 22 | #include "evernoteconnection.h" | 22 | #include "evernoteconnection.h" |
166 | 23 | #include "jobs/evernotejob.h" | 23 | #include "jobs/evernotejob.h" |
167 | 24 | #include "logging.h" | ||
168 | 24 | 25 | ||
169 | 25 | // Thrift | 26 | // Thrift |
170 | 26 | #include <arpa/inet.h> // seems thrift forgot this one | 27 | #include <arpa/inet.h> // seems thrift forgot this one |
171 | @@ -36,7 +37,6 @@ | |||
172 | 36 | #include <UserStore_constants.h> | 37 | #include <UserStore_constants.h> |
173 | 37 | #include <Errors_types.h> | 38 | #include <Errors_types.h> |
174 | 38 | 39 | ||
175 | 39 | #include <QDebug> | ||
176 | 40 | #include <QUrl> | 40 | #include <QUrl> |
177 | 41 | 41 | ||
178 | 42 | #include <libintl.h> | 42 | #include <libintl.h> |
179 | @@ -79,11 +79,11 @@ | |||
180 | 79 | if (m_useSSL) { | 79 | if (m_useSSL) { |
181 | 80 | boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory()); | 80 | boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory()); |
182 | 81 | socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443); | 81 | socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443); |
184 | 82 | qDebug() << "created UserStore SSL socket to host " << m_hostname; | 82 | qCDebug(dcConnection) << "created UserStore SSL socket to host " << m_hostname; |
185 | 83 | } else { | 83 | } else { |
186 | 84 | // Create a non-secure socket | 84 | // Create a non-secure socket |
187 | 85 | socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80)); | 85 | socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80)); |
189 | 86 | qDebug() << "created insecure UserStore socket to host " << m_hostname; | 86 | qCDebug(dcConnection) << "created insecure UserStore socket to host " << m_hostname; |
190 | 87 | } | 87 | } |
191 | 88 | 88 | ||
192 | 89 | // setup UserStore client | 89 | // setup UserStore client |
193 | @@ -108,11 +108,11 @@ | |||
194 | 108 | if (m_useSSL) { | 108 | if (m_useSSL) { |
195 | 109 | boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory()); | 109 | boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory()); |
196 | 110 | socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443); | 110 | socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443); |
198 | 111 | qDebug() << "created NotesStore SSL socket to host " << m_hostname; | 111 | qCDebug(dcConnection) << "created NotesStore SSL socket to host " << m_hostname; |
199 | 112 | } else { | 112 | } else { |
200 | 113 | // Create a non-secure socket | 113 | // Create a non-secure socket |
201 | 114 | socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80)); | 114 | socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80)); |
203 | 115 | qDebug() << "created insecure NotesStore socket to host " << m_hostname; | 115 | qCDebug(dcConnection) << "created insecure NotesStore socket to host " << m_hostname; |
204 | 116 | } | 116 | } |
205 | 117 | 117 | ||
206 | 118 | // setup NotesStore client | 118 | // setup NotesStore client |
207 | @@ -147,9 +147,9 @@ | |||
208 | 147 | 147 | ||
209 | 148 | void EvernoteConnection::disconnectFromEvernote() | 148 | void EvernoteConnection::disconnectFromEvernote() |
210 | 149 | { | 149 | { |
212 | 150 | qDebug() << "[Connection] Disconnecting from Evernote."; | 150 | qCDebug(dcConnection) << "Disconnecting from Evernote."; |
213 | 151 | if (!isConnected()) { | 151 | if (!isConnected()) { |
215 | 152 | qWarning() << "Not connected. Can't disconnect."; | 152 | qCWarning(dcConnection()) << "Not connected. Can't disconnect."; |
216 | 153 | return; | 153 | return; |
217 | 154 | } | 154 | } |
218 | 155 | 155 | ||
219 | @@ -198,38 +198,38 @@ | |||
220 | 198 | void EvernoteConnection::connectToEvernote() | 198 | void EvernoteConnection::connectToEvernote() |
221 | 199 | { | 199 | { |
222 | 200 | if (isConnected()) { | 200 | if (isConnected()) { |
224 | 201 | qWarning() << "Already connected."; | 201 | qCWarning(dcConnection) << "Already connected."; |
225 | 202 | return; | 202 | return; |
226 | 203 | } | 203 | } |
227 | 204 | 204 | ||
229 | 205 | qDebug() << "[Connection] Connecting to Evernote:" << m_hostname; | 205 | qCDebug(dcConnection) << "Connecting to Evernote:" << m_hostname; |
230 | 206 | 206 | ||
231 | 207 | m_errorMessage.clear(); | 207 | m_errorMessage.clear(); |
232 | 208 | emit errorChanged(); | 208 | emit errorChanged(); |
233 | 209 | 209 | ||
234 | 210 | if (m_token.isEmpty()) { | 210 | if (m_token.isEmpty()) { |
236 | 211 | qWarning() << "[Connection] Can't connect to Evernote. No token set."; | 211 | qCWarning(dcConnection) << "Can't connect to Evernote. No token set."; |
237 | 212 | return; | 212 | return; |
238 | 213 | } | 213 | } |
239 | 214 | if (m_hostname.isEmpty()) { | 214 | if (m_hostname.isEmpty()) { |
241 | 215 | qWarning() << "[Connection] Can't connect to Evernote. No hostname set."; | 215 | qCWarning(dcConnection) << "Can't connect to Evernote. No hostname set."; |
242 | 216 | } | 216 | } |
243 | 217 | 217 | ||
244 | 218 | setupUserStore(); | 218 | setupUserStore(); |
245 | 219 | bool ok = connectUserStore(); | 219 | bool ok = connectUserStore(); |
246 | 220 | if (!ok) { | 220 | if (!ok) { |
248 | 221 | qWarning() << "[Connection] Error connecting User Store. Cannot continue."; | 221 | qCWarning(dcConnection) << "Error connecting User Store. Cannot continue."; |
249 | 222 | return; | 222 | return; |
250 | 223 | } | 223 | } |
251 | 224 | setupNotesStore(); | 224 | setupNotesStore(); |
252 | 225 | ok = connectNotesStore(); | 225 | ok = connectNotesStore(); |
253 | 226 | 226 | ||
254 | 227 | if (!ok) { | 227 | if (!ok) { |
256 | 228 | qWarning() << "[Connection] Error connecting Notes Store. Cannot continue."; | 228 | qCWarning(dcConnection) << "Error connecting Notes Store. Cannot continue."; |
257 | 229 | return; | 229 | return; |
258 | 230 | } | 230 | } |
259 | 231 | 231 | ||
261 | 232 | qDebug() << "[Connection] Connected!"; | 232 | qCDebug(dcConnection) << "Connected!"; |
262 | 233 | emit isConnectedChanged(); | 233 | emit isConnectedChanged(); |
263 | 234 | 234 | ||
264 | 235 | } | 235 | } |
265 | @@ -242,14 +242,14 @@ | |||
266 | 242 | 242 | ||
267 | 243 | try { | 243 | try { |
268 | 244 | m_userStoreHttpClient->open(); | 244 | m_userStoreHttpClient->open(); |
270 | 245 | qDebug() << "UserStoreClient socket opened."; | 245 | qCDebug(dcConnection) << "UserStoreClient socket opened."; |
271 | 246 | } catch (const TTransportException & e) { | 246 | } catch (const TTransportException & e) { |
273 | 247 | qWarning() << "Failed to open connection:" << e.what() << e.getType(); | 247 | qCWarning(dcConnection) << "Failed to open connection:" << e.what() << e.getType(); |
274 | 248 | m_errorMessage = gettext("Offline mode"); | 248 | m_errorMessage = gettext("Offline mode"); |
275 | 249 | emit errorChanged(); | 249 | emit errorChanged(); |
276 | 250 | return false; | 250 | return false; |
277 | 251 | } catch (const TException & e) { | 251 | } catch (const TException & e) { |
279 | 252 | qWarning() << "Generic Thrift exception when opening the connection:" << e.what(); | 252 | qCWarning(dcConnection) << "Generic Thrift exception when opening the connection:" << e.what(); |
280 | 253 | m_errorMessage = gettext("Unknown error connecting to Evernote."); | 253 | m_errorMessage = gettext("Unknown error connecting to Evernote."); |
281 | 254 | emit errorChanged(); | 254 | emit errorChanged(); |
282 | 255 | return false; | 255 | return false; |
283 | @@ -262,28 +262,28 @@ | |||
284 | 262 | constants.EDAM_VERSION_MINOR); | 262 | constants.EDAM_VERSION_MINOR); |
285 | 263 | 263 | ||
286 | 264 | if (!versionOk) { | 264 | if (!versionOk) { |
288 | 265 | qWarning() << "Server version mismatch! This application should be updated!"; | 265 | qCWarning(dcConnection) << "Server version mismatch! This application should be updated!"; |
289 | 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.")); |
290 | 267 | emit errorChanged(); | 267 | emit errorChanged(); |
291 | 268 | return false; | 268 | return false; |
292 | 269 | } | 269 | } |
293 | 270 | } catch (const evernote::edam::EDAMUserException e) { | 270 | } catch (const evernote::edam::EDAMUserException e) { |
295 | 271 | qWarning() << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode; | 271 | qCWarning(dcConnection) << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode; |
296 | 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); |
297 | 273 | emit errorChanged(); | 273 | emit errorChanged(); |
298 | 274 | return false; | 274 | return false; |
299 | 275 | } catch (const evernote::edam::EDAMSystemException e) { | 275 | } catch (const evernote::edam::EDAMSystemException e) { |
301 | 276 | qWarning() << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode; | 276 | qCWarning(dcConnection) << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode; |
302 | 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); |
303 | 278 | emit errorChanged(); | 278 | emit errorChanged(); |
304 | 279 | return false; | 279 | return false; |
305 | 280 | } catch (const TTransportException & e) { | 280 | } catch (const TTransportException & e) { |
307 | 281 | qWarning() << "Failed to fetch server version:" << e.what(); | 281 | qCWarning(dcConnection) << "Failed to fetch server version:" << e.what(); |
308 | 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.")); |
309 | 283 | emit errorChanged(); | 283 | emit errorChanged(); |
310 | 284 | return false; | 284 | return false; |
311 | 285 | } catch (const TException & e) { | 285 | } catch (const TException & e) { |
313 | 286 | qWarning() << "Generic Thrift exception when fetching server version:" << e.what(); | 286 | qCWarning(dcConnection) << "Generic Thrift exception when fetching server version:" << e.what(); |
314 | 287 | m_errorMessage = QString(gettext("Unknown error connecting to Evernote")); | 287 | m_errorMessage = QString(gettext("Unknown error connecting to Evernote")); |
315 | 288 | emit errorChanged(); | 288 | emit errorChanged(); |
316 | 289 | return false; | 289 | return false; |
317 | @@ -291,24 +291,24 @@ | |||
318 | 291 | 291 | ||
319 | 292 | try { | 292 | try { |
320 | 293 | std::string notesStoreUrl; | 293 | std::string notesStoreUrl; |
322 | 294 | qDebug() << "getting ntoe store url with token" << m_token; | 294 | qCDebug(dcConnection) << "getting ntoe store url with token" << m_token; |
323 | 295 | m_userstoreClient->getNoteStoreUrl(notesStoreUrl, m_token.toStdString()); | 295 | m_userstoreClient->getNoteStoreUrl(notesStoreUrl, m_token.toStdString()); |
324 | 296 | 296 | ||
325 | 297 | m_notesStorePath = QUrl(QString::fromStdString(notesStoreUrl)).path(); | 297 | m_notesStorePath = QUrl(QString::fromStdString(notesStoreUrl)).path(); |
326 | 298 | 298 | ||
327 | 299 | if (m_notesStorePath.isEmpty()) { | 299 | if (m_notesStorePath.isEmpty()) { |
329 | 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."; |
330 | 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.")); |
331 | 302 | emit errorChanged(); | 302 | emit errorChanged(); |
332 | 303 | return false; | 303 | return false; |
333 | 304 | } | 304 | } |
334 | 305 | } catch (const TTransportException & e) { | 305 | } catch (const TTransportException & e) { |
336 | 306 | qWarning() << "Failed to fetch notestore path:" << e.what(); | 306 | qCWarning(dcConnection) << "Failed to fetch notestore path:" << e.what(); |
337 | 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.")); |
338 | 308 | emit errorChanged(); | 308 | emit errorChanged(); |
339 | 309 | return false; | 309 | return false; |
340 | 310 | } catch (const TException & e) { | 310 | } catch (const TException & e) { |
342 | 311 | qWarning() << "Generic Thrift exception when fetching notestore path:" << e.what(); | 311 | qCWarning(dcConnection) << "Generic Thrift exception when fetching notestore path:" << e.what(); |
343 | 312 | m_errorMessage = gettext("Unknown error connecting to Evernote"); | 312 | m_errorMessage = gettext("Unknown error connecting to Evernote"); |
344 | 313 | emit errorChanged(); | 313 | emit errorChanged(); |
345 | 314 | return false; | 314 | return false; |
346 | @@ -325,15 +325,15 @@ | |||
347 | 325 | 325 | ||
348 | 326 | try { | 326 | try { |
349 | 327 | m_notesStoreHttpClient->open(); | 327 | m_notesStoreHttpClient->open(); |
351 | 328 | qDebug() << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen(); | 328 | qCDebug(dcConnection) << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen(); |
352 | 329 | return true; | 329 | return true; |
353 | 330 | 330 | ||
354 | 331 | } catch (const TTransportException & e) { | 331 | } catch (const TTransportException & e) { |
356 | 332 | qWarning() << "Failed to open connection:" << e.what(); | 332 | qCWarning(dcConnection) << "Failed to open connection:" << e.what(); |
357 | 333 | m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure")); | 333 | m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure")); |
358 | 334 | emit errorChanged(); | 334 | emit errorChanged(); |
359 | 335 | } catch (const TException & e) { | 335 | } catch (const TException & e) { |
361 | 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(); |
362 | 337 | m_errorMessage = QString(gettext("Unknown Error connecting to Evernote")); | 337 | m_errorMessage = QString(gettext("Unknown Error connecting to Evernote")); |
363 | 338 | emit errorChanged(); | 338 | emit errorChanged(); |
364 | 339 | } | 339 | } |
365 | @@ -354,7 +354,7 @@ | |||
366 | 354 | void EvernoteConnection::enqueue(EvernoteJob *job) | 354 | void EvernoteConnection::enqueue(EvernoteJob *job) |
367 | 355 | { | 355 | { |
368 | 356 | if (!isConnected()) { | 356 | if (!isConnected()) { |
370 | 357 | qWarning() << "[JobQueue] Not connected to evernote. Can't enqueue job."; | 357 | qCWarning(dcJobQueue) << "Not connected to evernote. Can't enqueue job."; |
371 | 358 | job->emitJobDone(ErrorCodeConnectionLost, gettext("Disconnected from Evernote.")); | 358 | job->emitJobDone(ErrorCodeConnectionLost, gettext("Disconnected from Evernote.")); |
372 | 359 | job->deleteLater(); | 359 | job->deleteLater(); |
373 | 360 | return; | 360 | return; |
374 | @@ -364,9 +364,9 @@ | |||
375 | 364 | job->attachToDuplicate(duplicate); | 364 | job->attachToDuplicate(duplicate); |
376 | 365 | connect(duplicate, &EvernoteJob::finished, job, &EvernoteJob::deleteLater); | 365 | connect(duplicate, &EvernoteJob::finished, job, &EvernoteJob::deleteLater); |
377 | 366 | // reprioritze the repeated request | 366 | // reprioritze the repeated request |
379 | 367 | qDebug() << "[JobQueue] Duplicate job already queued:" << job->toString(); | 367 | qCDebug(dcJobQueue) << "Duplicate job already queued:" << job->toString(); |
380 | 368 | if (job->jobPriority() == EvernoteJob::JobPriorityHigh) { | 368 | if (job->jobPriority() == EvernoteJob::JobPriorityHigh) { |
382 | 369 | qDebug() << "[JobQueue] Reprioritising duplicate job:" << job->toString(); | 369 | qCDebug(dcJobQueue) << "Reprioritising duplicate job:" << job->toString(); |
383 | 370 | duplicate->setJobPriority(job->jobPriority()); | 370 | duplicate->setJobPriority(job->jobPriority()); |
384 | 371 | m_jobQueue.prepend(m_jobQueue.takeAt(m_jobQueue.indexOf(duplicate))); | 371 | m_jobQueue.prepend(m_jobQueue.takeAt(m_jobQueue.indexOf(duplicate))); |
385 | 372 | } | 372 | } |
386 | @@ -374,10 +374,10 @@ | |||
387 | 374 | connect(job, &EvernoteJob::finished, job, &EvernoteJob::deleteLater); | 374 | connect(job, &EvernoteJob::finished, job, &EvernoteJob::deleteLater); |
388 | 375 | connect(job, &EvernoteJob::finished, this, &EvernoteConnection::startNextJob); | 375 | connect(job, &EvernoteJob::finished, this, &EvernoteConnection::startNextJob); |
389 | 376 | if (job->jobPriority() == EvernoteJob::JobPriorityHigh) { | 376 | if (job->jobPriority() == EvernoteJob::JobPriorityHigh) { |
391 | 377 | qDebug() << "[JobQueue] Prepending high priority job request:" << job->toString(); | 377 | qCDebug(dcJobQueue) << "Prepending high priority job request:" << job->toString(); |
392 | 378 | m_jobQueue.prepend(job); | 378 | m_jobQueue.prepend(job); |
393 | 379 | } else { | 379 | } else { |
395 | 380 | qDebug() << "[JobQueue] Appending low priority job request:" << job->toString(); | 380 | qCDebug(dcJobQueue) << "Appending low priority job request:" << job->toString(); |
396 | 381 | m_jobQueue.append(job); | 381 | m_jobQueue.append(job); |
397 | 382 | } | 382 | } |
398 | 383 | startJobQueue(); | 383 | startJobQueue(); |
399 | @@ -410,13 +410,13 @@ | |||
400 | 410 | } | 410 | } |
401 | 411 | 411 | ||
402 | 412 | m_currentJob = m_jobQueue.takeFirst(); | 412 | m_currentJob = m_jobQueue.takeFirst(); |
404 | 413 | qDebug() << "[JobQueue] Starting job:" << m_currentJob->toString(); | 413 | qCDebug(dcJobQueue) << "Starting job:" << m_currentJob->toString(); |
405 | 414 | m_currentJob->start(); | 414 | m_currentJob->start(); |
406 | 415 | } | 415 | } |
407 | 416 | 416 | ||
408 | 417 | void EvernoteConnection::startNextJob() | 417 | void EvernoteConnection::startNextJob() |
409 | 418 | { | 418 | { |
411 | 419 | qDebug() << "[JobQueue] Job done:" << m_currentJob->toString(); | 419 | qCDebug(dcJobQueue) << "Job done:" << m_currentJob->toString(); |
412 | 420 | m_currentJob = 0; | 420 | m_currentJob = 0; |
413 | 421 | startJobQueue(); | 421 | startJobQueue(); |
414 | 422 | } | 422 | } |
415 | 423 | 423 | ||
416 | === modified file 'src/libqtevernote/jobs/createnotebookjob.cpp' | |||
417 | --- src/libqtevernote/jobs/createnotebookjob.cpp 2014-12-08 20:43:10 +0000 | |||
418 | +++ src/libqtevernote/jobs/createnotebookjob.cpp 2015-03-06 18:02:44 +0000 | |||
419 | @@ -21,8 +21,6 @@ | |||
420 | 21 | #include "createnotebookjob.h" | 21 | #include "createnotebookjob.h" |
421 | 22 | #include "notebook.h" | 22 | #include "notebook.h" |
422 | 23 | 23 | ||
423 | 24 | #include <QDebug> | ||
424 | 25 | |||
425 | 26 | CreateNotebookJob::CreateNotebookJob(Notebook *notebook, QObject *parent) : | 24 | CreateNotebookJob::CreateNotebookJob(Notebook *notebook, QObject *parent) : |
426 | 27 | NotesStoreJob(parent), | 25 | NotesStoreJob(parent), |
427 | 28 | m_notebook(notebook->clone()) | 26 | m_notebook(notebook->clone()) |
428 | 29 | 27 | ||
429 | === modified file 'src/libqtevernote/jobs/createnotejob.cpp' | |||
430 | --- src/libqtevernote/jobs/createnotejob.cpp 2014-12-14 02:40:47 +0000 | |||
431 | +++ src/libqtevernote/jobs/createnotejob.cpp 2015-03-06 18:02:44 +0000 | |||
432 | @@ -20,8 +20,6 @@ | |||
433 | 20 | 20 | ||
434 | 21 | #include "createnotejob.h" | 21 | #include "createnotejob.h" |
435 | 22 | 22 | ||
436 | 23 | #include <QDebug> | ||
437 | 24 | |||
438 | 25 | CreateNoteJob::CreateNoteJob(Note *note, QObject *parent) : | 23 | CreateNoteJob::CreateNoteJob(Note *note, QObject *parent) : |
439 | 26 | NotesStoreJob(parent) | 24 | NotesStoreJob(parent) |
440 | 27 | { | 25 | { |
441 | @@ -46,7 +44,6 @@ | |||
442 | 46 | 44 | ||
443 | 47 | void CreateNoteJob::startJob() | 45 | void CreateNoteJob::startJob() |
444 | 48 | { | 46 | { |
445 | 49 | qDebug() << "creating note:" << m_note->guid() << m_note->enmlContent() << m_note->notebookGuid() << m_note->title(); | ||
446 | 50 | evernote::edam::Note input; | 47 | evernote::edam::Note input; |
447 | 51 | input.updateSequenceNum = m_note->updateSequenceNumber(); | 48 | input.updateSequenceNum = m_note->updateSequenceNumber(); |
448 | 52 | input.__isset.updateSequenceNum = true; | 49 | input.__isset.updateSequenceNum = true; |
449 | 53 | 50 | ||
450 | === modified file 'src/libqtevernote/jobs/createtagjob.cpp' | |||
451 | --- src/libqtevernote/jobs/createtagjob.cpp 2014-12-10 21:08:38 +0000 | |||
452 | +++ src/libqtevernote/jobs/createtagjob.cpp 2015-03-06 18:02:44 +0000 | |||
453 | @@ -21,8 +21,6 @@ | |||
454 | 21 | #include "createtagjob.h" | 21 | #include "createtagjob.h" |
455 | 22 | #include "tag.h" | 22 | #include "tag.h" |
456 | 23 | 23 | ||
457 | 24 | #include <QDebug> | ||
458 | 25 | |||
459 | 26 | CreateTagJob::CreateTagJob(Tag *tag, QObject *parent) : | 24 | CreateTagJob::CreateTagJob(Tag *tag, QObject *parent) : |
460 | 27 | NotesStoreJob(parent), | 25 | NotesStoreJob(parent), |
461 | 28 | m_tag(tag->clone()) | 26 | m_tag(tag->clone()) |
462 | 29 | 27 | ||
463 | === modified file 'src/libqtevernote/jobs/evernotejob.cpp' | |||
464 | --- src/libqtevernote/jobs/evernotejob.cpp 2015-02-27 21:32:29 +0000 | |||
465 | +++ src/libqtevernote/jobs/evernotejob.cpp 2015-03-06 18:02:44 +0000 | |||
466 | @@ -20,6 +20,7 @@ | |||
467 | 20 | 20 | ||
468 | 21 | #include "evernotejob.h" | 21 | #include "evernotejob.h" |
469 | 22 | #include "evernoteconnection.h" | 22 | #include "evernoteconnection.h" |
470 | 23 | #include "logging.h" | ||
471 | 23 | 24 | ||
472 | 24 | // Thrift | 25 | // Thrift |
473 | 25 | #include <arpa/inet.h> // seems thrift forgot this one | 26 | #include <arpa/inet.h> // seems thrift forgot this one |
474 | @@ -33,8 +34,6 @@ | |||
475 | 33 | 34 | ||
476 | 34 | #include <libintl.h> | 35 | #include <libintl.h> |
477 | 35 | 36 | ||
478 | 36 | #include <QDebug> | ||
479 | 37 | |||
480 | 38 | using namespace apache::thrift; | 37 | using namespace apache::thrift; |
481 | 39 | using namespace apache::thrift::protocol; | 38 | using namespace apache::thrift::protocol; |
482 | 40 | using namespace apache::thrift::transport; | 39 | using namespace apache::thrift::transport; |
483 | @@ -63,7 +62,7 @@ | |||
484 | 63 | void EvernoteJob::run() | 62 | void EvernoteJob::run() |
485 | 64 | { | 63 | { |
486 | 65 | if (!EvernoteConnection::instance()->isConnected()) { | 64 | if (!EvernoteConnection::instance()->isConnected()) { |
488 | 66 | qWarning() << "EvernoteConnection is not connected. (" << this->metaObject()->className() << ")"; | 65 | qCWarning(dcJobQueue) << "EvernoteConnection is not connected. (" << toString() << ")"; |
489 | 67 | emitJobDone(EvernoteConnection::ErrorCodeUserException, QStringLiteral("Not connected.")); | 66 | emitJobDone(EvernoteConnection::ErrorCodeUserException, QStringLiteral("Not connected.")); |
490 | 68 | return; | 67 | return; |
491 | 69 | } | 68 | } |
492 | @@ -76,9 +75,9 @@ | |||
493 | 76 | startJob(); | 75 | startJob(); |
494 | 77 | emitJobDone(EvernoteConnection::ErrorCodeNoError, QString()); | 76 | emitJobDone(EvernoteConnection::ErrorCodeNoError, QString()); |
495 | 78 | } catch (const TTransportException & e) { | 77 | } catch (const TTransportException & e) { |
497 | 79 | qWarning() << "TTransportException in" << metaObject()->className() << e.what(); | 78 | qCWarning(dcJobQueue) << "TTransportException in" << metaObject()->className() << e.what(); |
498 | 80 | if (tryCount < 2) { | 79 | if (tryCount < 2) { |
500 | 81 | qWarning() << "[JobQueue] Resetting connection..."; | 80 | qCWarning(dcJobQueue) << "Resetting connection..."; |
501 | 82 | try { | 81 | try { |
502 | 83 | resetConnection(); | 82 | resetConnection(); |
503 | 84 | } catch(...) {} | 83 | } catch(...) {} |
504 | @@ -87,9 +86,9 @@ | |||
505 | 87 | emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what()); | 86 | emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what()); |
506 | 88 | } | 87 | } |
507 | 89 | } catch (const TApplicationException &e) { | 88 | } catch (const TApplicationException &e) { |
509 | 90 | qWarning() << "TApplicationException in " << metaObject()->className() << e.what(); | 89 | qCWarning(dcJobQueue) << "TApplicationException in " << metaObject()->className() << e.what(); |
510 | 91 | if (tryCount < 2) { | 90 | if (tryCount < 2) { |
512 | 92 | qWarning() << "Resetting connection..."; | 91 | qCWarning(dcJobQueue) << "Resetting connection..."; |
513 | 93 | try { | 92 | try { |
514 | 94 | resetConnection(); | 93 | resetConnection(); |
515 | 95 | } catch(...) {} | 94 | } catch(...) {} |
516 | @@ -159,10 +158,10 @@ | |||
517 | 159 | break; | 158 | break; |
518 | 160 | } | 159 | } |
519 | 161 | message = message.arg(QString::fromStdString(e.parameter)); | 160 | message = message.arg(QString::fromStdString(e.parameter)); |
521 | 162 | qWarning() << metaObject()->className() << "EDAMUserException:" << message; | 161 | qCWarning(dcJobQueue) << metaObject()->className() << "EDAMUserException:" << message; |
522 | 163 | emitJobDone(EvernoteConnection::ErrorCodeUserException, message); | 162 | emitJobDone(EvernoteConnection::ErrorCodeUserException, message); |
523 | 164 | } catch (const evernote::edam::EDAMSystemException &e) { | 163 | } catch (const evernote::edam::EDAMSystemException &e) { |
525 | 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); |
526 | 166 | QString message; | 165 | QString message; |
527 | 167 | EvernoteConnection::ErrorCode errorCode; | 166 | EvernoteConnection::ErrorCode errorCode; |
528 | 168 | switch (e.errorCode) { | 167 | switch (e.errorCode) { |
529 | 169 | 168 | ||
530 | === modified file 'src/libqtevernote/jobs/expungenotebookjob.cpp' | |||
531 | --- src/libqtevernote/jobs/expungenotebookjob.cpp 2014-09-19 21:31:39 +0000 | |||
532 | +++ src/libqtevernote/jobs/expungenotebookjob.cpp 2015-03-06 18:02:44 +0000 | |||
533 | @@ -20,8 +20,6 @@ | |||
534 | 20 | 20 | ||
535 | 21 | #include "expungenotebookjob.h" | 21 | #include "expungenotebookjob.h" |
536 | 22 | 22 | ||
537 | 23 | #include <QDebug> | ||
538 | 24 | |||
539 | 25 | ExpungeNotebookJob::ExpungeNotebookJob(const QString &guid, QObject *parent) : | 23 | ExpungeNotebookJob::ExpungeNotebookJob(const QString &guid, QObject *parent) : |
540 | 26 | NotesStoreJob(parent), | 24 | NotesStoreJob(parent), |
541 | 27 | m_guid(guid) | 25 | m_guid(guid) |
542 | 28 | 26 | ||
543 | === modified file 'src/libqtevernote/jobs/fetchnotebooksjob.cpp' | |||
544 | --- src/libqtevernote/jobs/fetchnotebooksjob.cpp 2014-09-19 21:31:39 +0000 | |||
545 | +++ src/libqtevernote/jobs/fetchnotebooksjob.cpp 2015-03-06 18:02:44 +0000 | |||
546 | @@ -20,8 +20,6 @@ | |||
547 | 20 | 20 | ||
548 | 21 | #include "fetchnotebooksjob.h" | 21 | #include "fetchnotebooksjob.h" |
549 | 22 | 22 | ||
550 | 23 | #include <QDebug> | ||
551 | 24 | |||
552 | 25 | FetchNotebooksJob::FetchNotebooksJob(QObject *parent) : | 23 | FetchNotebooksJob::FetchNotebooksJob(QObject *parent) : |
553 | 26 | NotesStoreJob(parent) | 24 | NotesStoreJob(parent) |
554 | 27 | { | 25 | { |
555 | 28 | 26 | ||
556 | === modified file 'src/libqtevernote/jobs/fetchnotesjob.cpp' | |||
557 | --- src/libqtevernote/jobs/fetchnotesjob.cpp 2015-02-26 22:47:10 +0000 | |||
558 | +++ src/libqtevernote/jobs/fetchnotesjob.cpp 2015-03-06 18:02:44 +0000 | |||
559 | @@ -25,8 +25,6 @@ | |||
560 | 25 | // evernote sdk | 25 | // evernote sdk |
561 | 26 | #include "Limits_constants.h" | 26 | #include "Limits_constants.h" |
562 | 27 | 27 | ||
563 | 28 | #include <QDebug> | ||
564 | 29 | |||
565 | 30 | FetchNotesJob::FetchNotesJob(const QString &filterNotebookGuid, const QString &searchWords, int startIndex, int chunkSize, QObject *parent) : | 28 | FetchNotesJob::FetchNotesJob(const QString &filterNotebookGuid, const QString &searchWords, int startIndex, int chunkSize, QObject *parent) : |
566 | 31 | NotesStoreJob(parent), | 29 | NotesStoreJob(parent), |
567 | 32 | m_filterNotebookGuid(filterNotebookGuid), | 30 | m_filterNotebookGuid(filterNotebookGuid), |
568 | 33 | 31 | ||
569 | === modified file 'src/libqtevernote/jobs/fetchtagsjob.cpp' | |||
570 | --- src/libqtevernote/jobs/fetchtagsjob.cpp 2014-10-09 00:08:52 +0000 | |||
571 | +++ src/libqtevernote/jobs/fetchtagsjob.cpp 2015-03-06 18:02:44 +0000 | |||
572 | @@ -20,8 +20,6 @@ | |||
573 | 20 | 20 | ||
574 | 21 | #include "fetchtagsjob.h" | 21 | #include "fetchtagsjob.h" |
575 | 22 | 22 | ||
576 | 23 | #include <QDebug> | ||
577 | 24 | |||
578 | 25 | FetchTagsJob::FetchTagsJob(QObject *parent) : | 23 | FetchTagsJob::FetchTagsJob(QObject *parent) : |
579 | 26 | NotesStoreJob(parent) | 24 | NotesStoreJob(parent) |
580 | 27 | { | 25 | { |
581 | 28 | 26 | ||
582 | === modified file 'src/libqtevernote/jobs/savenotebookjob.cpp' | |||
583 | --- src/libqtevernote/jobs/savenotebookjob.cpp 2015-03-04 00:23:45 +0000 | |||
584 | +++ src/libqtevernote/jobs/savenotebookjob.cpp 2015-03-06 18:02:44 +0000 | |||
585 | @@ -21,8 +21,6 @@ | |||
586 | 21 | #include "savenotebookjob.h" | 21 | #include "savenotebookjob.h" |
587 | 22 | #include "notebook.h" | 22 | #include "notebook.h" |
588 | 23 | 23 | ||
589 | 24 | #include <QDebug> | ||
590 | 25 | |||
591 | 26 | SaveNotebookJob::SaveNotebookJob(Notebook *notebook, QObject *parent) : | 24 | SaveNotebookJob::SaveNotebookJob(Notebook *notebook, QObject *parent) : |
592 | 27 | NotesStoreJob(parent) | 25 | NotesStoreJob(parent) |
593 | 28 | { | 26 | { |
594 | 29 | 27 | ||
595 | === modified file 'src/libqtevernote/jobs/savenotejob.cpp' | |||
596 | --- src/libqtevernote/jobs/savenotejob.cpp 2015-02-27 22:15:02 +0000 | |||
597 | +++ src/libqtevernote/jobs/savenotejob.cpp 2015-03-06 18:02:44 +0000 | |||
598 | @@ -21,8 +21,6 @@ | |||
599 | 21 | #include "savenotejob.h" | 21 | #include "savenotejob.h" |
600 | 22 | #include "note.h" | 22 | #include "note.h" |
601 | 23 | 23 | ||
602 | 24 | #include <QDebug> | ||
603 | 25 | |||
604 | 26 | SaveNoteJob::SaveNoteJob(Note *note, QObject *parent) : | 24 | SaveNoteJob::SaveNoteJob(Note *note, QObject *parent) : |
605 | 27 | NotesStoreJob(parent) | 25 | NotesStoreJob(parent) |
606 | 28 | { | 26 | { |
607 | @@ -86,7 +84,6 @@ | |||
608 | 86 | note.attributes.reminderDoneTime = m_note->reminderDoneTime().toMSecsSinceEpoch(); | 84 | note.attributes.reminderDoneTime = m_note->reminderDoneTime().toMSecsSinceEpoch(); |
609 | 87 | note.attributes.__isset.reminderDoneTime = true; | 85 | note.attributes.__isset.reminderDoneTime = true; |
610 | 88 | 86 | ||
611 | 89 | qDebug() << "*** needs content sync" << m_note->needsContentSync(); | ||
612 | 90 | if (m_note->needsContentSync()) { | 87 | if (m_note->needsContentSync()) { |
613 | 91 | note.content = m_note->enmlContent().toStdString(); | 88 | note.content = m_note->enmlContent().toStdString(); |
614 | 92 | note.__isset.content = true; | 89 | note.__isset.content = true; |
615 | 93 | 90 | ||
616 | === modified file 'src/libqtevernote/jobs/savetagjob.cpp' | |||
617 | --- src/libqtevernote/jobs/savetagjob.cpp 2014-12-13 03:55:52 +0000 | |||
618 | +++ src/libqtevernote/jobs/savetagjob.cpp 2015-03-06 18:02:44 +0000 | |||
619 | @@ -21,8 +21,6 @@ | |||
620 | 21 | #include "savetagjob.h" | 21 | #include "savetagjob.h" |
621 | 22 | #include "tag.h" | 22 | #include "tag.h" |
622 | 23 | 23 | ||
623 | 24 | #include <QDebug> | ||
624 | 25 | |||
625 | 26 | SaveTagJob::SaveTagJob(Tag *tag, QObject *parent) : | 24 | SaveTagJob::SaveTagJob(Tag *tag, QObject *parent) : |
626 | 27 | NotesStoreJob(parent) | 25 | NotesStoreJob(parent) |
627 | 28 | { | 26 | { |
628 | 29 | 27 | ||
629 | === added file 'src/libqtevernote/logging.cpp' | |||
630 | --- src/libqtevernote/logging.cpp 1970-01-01 00:00:00 +0000 | |||
631 | +++ src/libqtevernote/logging.cpp 2015-03-06 18:02:44 +0000 | |||
632 | @@ -0,0 +1,32 @@ | |||
633 | 1 | /* | ||
634 | 2 | * Copyright: 2015 Canonical, Ltd | ||
635 | 3 | * | ||
636 | 4 | * This file is part of reminders | ||
637 | 5 | * | ||
638 | 6 | * reminders is free software: you can redistribute it and/or modify | ||
639 | 7 | * it under the terms of the GNU General Public License as published by | ||
640 | 8 | * the Free Software Foundation; version 3. | ||
641 | 9 | * | ||
642 | 10 | * reminders is distributed in the hope that it will be useful, | ||
643 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
644 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
645 | 13 | * GNU General Public License for more details. | ||
646 | 14 | * | ||
647 | 15 | * You should have received a copy of the GNU General Public License | ||
648 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
649 | 17 | * | ||
650 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
651 | 19 | * Riccardo Padovani <rpadovani@ubuntu.com> | ||
652 | 20 | */ | ||
653 | 21 | |||
654 | 22 | #include "logging.h" | ||
655 | 23 | |||
656 | 24 | #include <QLoggingCategory> | ||
657 | 25 | |||
658 | 26 | Q_LOGGING_CATEGORY(dcNotesStore, "NotesStore") | ||
659 | 27 | Q_LOGGING_CATEGORY(dcJobQueue,"JobQueue") | ||
660 | 28 | Q_LOGGING_CATEGORY(dcConnection,"Connection") | ||
661 | 29 | Q_LOGGING_CATEGORY(dcSync,"Sync") | ||
662 | 30 | Q_LOGGING_CATEGORY(dcStorage,"Storage") | ||
663 | 31 | Q_LOGGING_CATEGORY(dcEnml,"Enml") | ||
664 | 32 | Q_LOGGING_CATEGORY(dcOrganizer,"Organizer") | ||
665 | 0 | 33 | ||
666 | === added file 'src/libqtevernote/logging.h' | |||
667 | --- src/libqtevernote/logging.h 1970-01-01 00:00:00 +0000 | |||
668 | +++ src/libqtevernote/logging.h 2015-03-06 18:02:44 +0000 | |||
669 | @@ -0,0 +1,34 @@ | |||
670 | 1 | /* | ||
671 | 2 | * Copyright: 2015 Canonical, Ltd | ||
672 | 3 | * | ||
673 | 4 | * This file is part of reminders | ||
674 | 5 | * | ||
675 | 6 | * reminders is free software: you can redistribute it and/or modify | ||
676 | 7 | * it under the terms of the GNU General Public License as published by | ||
677 | 8 | * the Free Software Foundation; version 3. | ||
678 | 9 | * | ||
679 | 10 | * reminders is distributed in the hope that it will be useful, | ||
680 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
681 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
682 | 13 | * GNU General Public License for more details. | ||
683 | 14 | * | ||
684 | 15 | * You should have received a copy of the GNU General Public License | ||
685 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
686 | 17 | * | ||
687 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
688 | 19 | * Riccardo Padovani <rpadovani@ubuntu.com> | ||
689 | 20 | */ | ||
690 | 21 | |||
691 | 22 | #ifndef LOGGING_H | ||
692 | 23 | #define LOGGING_H | ||
693 | 24 | |||
694 | 25 | #include <QLoggingCategory> | ||
695 | 26 | |||
696 | 27 | Q_DECLARE_LOGGING_CATEGORY(dcNotesStore) | ||
697 | 28 | Q_DECLARE_LOGGING_CATEGORY(dcJobQueue) | ||
698 | 29 | Q_DECLARE_LOGGING_CATEGORY(dcConnection) | ||
699 | 30 | Q_DECLARE_LOGGING_CATEGORY(dcSync) | ||
700 | 31 | Q_DECLARE_LOGGING_CATEGORY(dcEnml) | ||
701 | 32 | Q_DECLARE_LOGGING_CATEGORY(dcOrganizer) | ||
702 | 33 | |||
703 | 34 | #endif | ||
704 | 0 | 35 | ||
705 | === modified file 'src/libqtevernote/note.cpp' | |||
706 | --- src/libqtevernote/note.cpp 2015-03-05 18:23:25 +0000 | |||
707 | +++ src/libqtevernote/note.cpp 2015-03-06 18:02:44 +0000 | |||
708 | @@ -21,6 +21,7 @@ | |||
709 | 21 | #include "note.h" | 21 | #include "note.h" |
710 | 22 | 22 | ||
711 | 23 | #include "notesstore.h" | 23 | #include "notesstore.h" |
712 | 24 | #include "logging.h" | ||
713 | 24 | 25 | ||
714 | 25 | #include <libintl.h> | 26 | #include <libintl.h> |
715 | 26 | 27 | ||
716 | @@ -28,7 +29,6 @@ | |||
717 | 28 | #include <QUrl> | 29 | #include <QUrl> |
718 | 29 | #include <QUrlQuery> | 30 | #include <QUrlQuery> |
719 | 30 | #include <QStandardPaths> | 31 | #include <QStandardPaths> |
720 | 31 | #include <QDebug> | ||
721 | 32 | #include <QCryptographicHash> | 32 | #include <QCryptographicHash> |
722 | 33 | #include <QFile> | 33 | #include <QFile> |
723 | 34 | 34 | ||
724 | @@ -71,15 +71,13 @@ | |||
725 | 71 | infoFile.endGroup(); | 71 | infoFile.endGroup(); |
726 | 72 | } else { | 72 | } else { |
727 | 73 | // uh oh... have a resource description without file... reset sequence number to indicate we need a sync | 73 | // uh oh... have a resource description without file... reset sequence number to indicate we need a sync |
729 | 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"; |
730 | 75 | } | 75 | } |
731 | 76 | } | 76 | } |
732 | 77 | infoFile.endGroup(); | 77 | infoFile.endGroup(); |
733 | 78 | 78 | ||
734 | 79 | connect(NotesStore::instance(), &NotesStore::notebookGuidChanged, this, &Note::slotNotebookGuidChanged); | 79 | connect(NotesStore::instance(), &NotesStore::notebookGuidChanged, this, &Note::slotNotebookGuidChanged); |
735 | 80 | connect(NotesStore::instance(), &NotesStore::tagGuidChanged, this, &Note::slotTagGuidChanged); | 80 | connect(NotesStore::instance(), &NotesStore::tagGuidChanged, this, &Note::slotTagGuidChanged); |
736 | 81 | |||
737 | 82 | qDebug() << "Note created:" << m_guid << m_title << m_tagline << m_content.enml(); | ||
738 | 83 | } | 81 | } |
739 | 84 | 82 | ||
740 | 85 | Note::~Note() | 83 | Note::~Note() |
741 | @@ -122,7 +120,6 @@ | |||
742 | 122 | m_guid = guid; | 120 | m_guid = guid; |
743 | 123 | QString newCacheFileName = NotesStore::instance()->storageLocation() + "note-" + guid + ".enml"; | 121 | QString newCacheFileName = NotesStore::instance()->storageLocation() + "note-" + guid + ".enml"; |
744 | 124 | if (m_cacheFile.exists()) { | 122 | if (m_cacheFile.exists()) { |
745 | 125 | qDebug() << "renaming cachefile from" << m_cacheFile.fileName() << "to" << newCacheFileName; | ||
746 | 126 | m_cacheFile.rename(newCacheFileName); | 123 | m_cacheFile.rename(newCacheFileName); |
747 | 127 | } else { | 124 | } else { |
748 | 128 | m_cacheFile.setFileName(newCacheFileName); | 125 | m_cacheFile.setFileName(newCacheFileName); |
749 | @@ -266,9 +263,7 @@ | |||
750 | 266 | 263 | ||
751 | 267 | QString Note::htmlContent() const | 264 | QString Note::htmlContent() const |
752 | 268 | { | 265 | { |
753 | 269 | qDebug() << "html content asked;"; | ||
754 | 270 | load(); | 266 | load(); |
755 | 271 | qDebug() << "returning" << m_content.toHtml(m_guid); | ||
756 | 272 | return m_content.toHtml(m_guid); | 267 | return m_content.toHtml(m_guid); |
757 | 273 | } | 268 | } |
758 | 274 | 269 | ||
759 | @@ -430,9 +425,7 @@ | |||
760 | 430 | 425 | ||
761 | 431 | void Note::setDeleted(bool deleted) | 426 | void Note::setDeleted(bool deleted) |
762 | 432 | { | 427 | { |
763 | 433 | qDebug() << "note" << this << "isDelted:" << m_deleted << "setting to" << deleted; | ||
764 | 434 | if (m_deleted != deleted) { | 428 | if (m_deleted != deleted) { |
765 | 435 | qDebug() << "setting m_deleted to to" << deleted; | ||
766 | 436 | m_deleted = deleted; | 429 | m_deleted = deleted; |
767 | 437 | emit deletedChanged(); | 430 | emit deletedChanged(); |
768 | 438 | } | 431 | } |
769 | @@ -518,7 +511,6 @@ | |||
770 | 518 | return m_resources.value(hash); | 511 | return m_resources.value(hash); |
771 | 519 | } | 512 | } |
772 | 520 | 513 | ||
773 | 521 | qDebug() << "adding resource" << fileName << type; | ||
774 | 522 | Resource *resource = new Resource(data, hash, fileName, type, this); | 514 | Resource *resource = new Resource(data, hash, fileName, type, this); |
775 | 523 | m_resources.insert(hash, resource); | 515 | m_resources.insert(hash, resource); |
776 | 524 | emit resourcesChanged(); | 516 | emit resourcesChanged(); |
777 | @@ -544,7 +536,7 @@ | |||
778 | 544 | { | 536 | { |
779 | 545 | QFile importedFile(fileName.path()); | 537 | QFile importedFile(fileName.path()); |
780 | 546 | if (!importedFile.exists()) { | 538 | if (!importedFile.exists()) { |
782 | 547 | qWarning() << "File doesn't exist. Cannot attach."; | 539 | qCWarning(dcNotesStore) << "File doesn't exist. Cannot attach."; |
783 | 548 | return; | 540 | return; |
784 | 549 | } | 541 | } |
785 | 550 | 542 | ||
786 | @@ -562,11 +554,6 @@ | |||
787 | 562 | m_needsContentSync = true; | 554 | m_needsContentSync = true; |
788 | 563 | } | 555 | } |
789 | 564 | 556 | ||
790 | 565 | void Note::format(int startPos, int endPos, TextFormat::Format format) | ||
791 | 566 | { | ||
792 | 567 | qDebug() << "Should format from" << startPos << "to" << endPos << "with format:" << format; | ||
793 | 568 | } | ||
794 | 569 | |||
795 | 570 | void Note::addTag(const QString &tagGuid) | 557 | void Note::addTag(const QString &tagGuid) |
796 | 571 | { | 558 | { |
797 | 572 | NotesStore::instance()->tagNote(m_guid, tagGuid); | 559 | NotesStore::instance()->tagNote(m_guid, tagGuid); |
798 | @@ -700,9 +687,9 @@ | |||
799 | 700 | m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed()); | 687 | m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed()); |
800 | 701 | m_tagline = m_content.toPlaintext().left(100); | 688 | m_tagline = m_content.toPlaintext().left(100); |
801 | 702 | m_cacheFile.close(); | 689 | m_cacheFile.close(); |
803 | 703 | qDebug() << "[Storage] Loaded note from storage:" << m_guid; | 690 | qCDebug(dcNotesStore) << "Loaded note content from disk:" << m_guid; |
804 | 704 | } else { | 691 | } else { |
806 | 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; |
807 | 706 | } | 693 | } |
808 | 707 | m_loaded = true; | 694 | m_loaded = true; |
809 | 708 | } | 695 | } |
810 | 709 | 696 | ||
811 | === modified file 'src/libqtevernote/note.h' | |||
812 | --- src/libqtevernote/note.h 2015-03-05 18:23:25 +0000 | |||
813 | +++ src/libqtevernote/note.h 2015-03-06 18:02:44 +0000 | |||
814 | @@ -23,7 +23,6 @@ | |||
815 | 23 | 23 | ||
816 | 24 | #include "utils/enmldocument.h" | 24 | #include "utils/enmldocument.h" |
817 | 25 | #include "resource.h" | 25 | #include "resource.h" |
818 | 26 | #include "utils/textformat.h" | ||
819 | 27 | 26 | ||
820 | 28 | #include <QObject> | 27 | #include <QObject> |
821 | 29 | #include <QDateTime> | 28 | #include <QDateTime> |
822 | @@ -162,7 +161,6 @@ | |||
823 | 162 | 161 | ||
824 | 163 | Q_INVOKABLE void markTodo(const QString &todoId, bool checked); | 162 | Q_INVOKABLE void markTodo(const QString &todoId, bool checked); |
825 | 164 | Q_INVOKABLE void attachFile(int position, const QUrl &fileName); | 163 | Q_INVOKABLE void attachFile(int position, const QUrl &fileName); |
826 | 165 | Q_INVOKABLE void format(int startPos, int endPos, TextFormat::Format format); | ||
827 | 166 | Q_INVOKABLE void addTag(const QString &tagGuid); | 164 | Q_INVOKABLE void addTag(const QString &tagGuid); |
828 | 167 | Q_INVOKABLE void removeTag(const QString &tagGuid); | 165 | Q_INVOKABLE void removeTag(const QString &tagGuid); |
829 | 168 | 166 | ||
830 | 169 | 167 | ||
831 | === modified file 'src/libqtevernote/notebook.cpp' | |||
832 | --- src/libqtevernote/notebook.cpp 2015-03-04 20:30:55 +0000 | |||
833 | +++ src/libqtevernote/notebook.cpp 2015-03-06 18:02:44 +0000 | |||
834 | @@ -24,7 +24,7 @@ | |||
835 | 24 | 24 | ||
836 | 25 | #include <libintl.h> | 25 | #include <libintl.h> |
837 | 26 | 26 | ||
839 | 27 | #include <QDebug> | 27 | #include <QLocale> |
840 | 28 | #include <QStandardPaths> | 28 | #include <QStandardPaths> |
841 | 29 | 29 | ||
842 | 30 | Notebook::Notebook(QString guid, quint32 updateSequenceNumber, QObject *parent) : | 30 | Notebook::Notebook(QString guid, quint32 updateSequenceNumber, QObject *parent) : |
843 | @@ -191,7 +191,6 @@ | |||
844 | 191 | } | 191 | } |
845 | 192 | } else { | 192 | } else { |
846 | 193 | if (!m_notesList.contains(noteGuid)) { | 193 | if (!m_notesList.contains(noteGuid)) { |
847 | 194 | qDebug() << "****** appending to notebook"; | ||
848 | 195 | m_notesList.append(noteGuid); | 194 | m_notesList.append(noteGuid); |
849 | 196 | emit noteCountChanged(); | 195 | emit noteCountChanged(); |
850 | 197 | } | 196 | } |
851 | 198 | 197 | ||
852 | === modified file 'src/libqtevernote/notebooks.cpp' | |||
853 | --- src/libqtevernote/notebooks.cpp 2015-03-04 00:23:45 +0000 | |||
854 | +++ src/libqtevernote/notebooks.cpp 2015-03-06 18:02:44 +0000 | |||
855 | @@ -21,8 +21,6 @@ | |||
856 | 21 | #include "notebooks.h" | 21 | #include "notebooks.h" |
857 | 22 | #include "notebook.h" | 22 | #include "notebook.h" |
858 | 23 | 23 | ||
859 | 24 | #include <QDebug> | ||
860 | 25 | |||
861 | 26 | Notebooks::Notebooks(QObject *parent) : | 24 | Notebooks::Notebooks(QObject *parent) : |
862 | 27 | QAbstractListModel(parent) | 25 | QAbstractListModel(parent) |
863 | 28 | { | 26 | { |
864 | 29 | 27 | ||
865 | === modified file 'src/libqtevernote/notes.cpp' | |||
866 | --- src/libqtevernote/notes.cpp 2015-03-04 23:50:24 +0000 | |||
867 | +++ src/libqtevernote/notes.cpp 2015-03-06 18:02:44 +0000 | |||
868 | @@ -21,8 +21,6 @@ | |||
869 | 21 | #include "notes.h" | 21 | #include "notes.h" |
870 | 22 | #include "note.h" | 22 | #include "note.h" |
871 | 23 | 23 | ||
872 | 24 | #include <QDebug> | ||
873 | 25 | |||
874 | 26 | Notes::Notes(QObject *parent) : | 24 | Notes::Notes(QObject *parent) : |
875 | 27 | QSortFilterProxyModel(parent), | 25 | QSortFilterProxyModel(parent), |
876 | 28 | m_onlyReminders(false), | 26 | m_onlyReminders(false), |
877 | 29 | 27 | ||
878 | === modified file 'src/libqtevernote/notesstore.cpp' | |||
879 | --- src/libqtevernote/notesstore.cpp 2015-03-04 23:24:54 +0000 | |||
880 | +++ src/libqtevernote/notesstore.cpp 2015-03-06 18:02:44 +0000 | |||
881 | @@ -27,6 +27,7 @@ | |||
882 | 27 | #include "utils/enmldocument.h" | 27 | #include "utils/enmldocument.h" |
883 | 28 | #include "utils/organizeradapter.h" | 28 | #include "utils/organizeradapter.h" |
884 | 29 | #include "userstore.h" | 29 | #include "userstore.h" |
885 | 30 | #include "logging.h" | ||
886 | 30 | 31 | ||
887 | 31 | #include "jobs/fetchnotesjob.h" | 32 | #include "jobs/fetchnotesjob.h" |
888 | 32 | #include "jobs/fetchnotebooksjob.h" | 33 | #include "jobs/fetchnotebooksjob.h" |
889 | @@ -44,7 +45,6 @@ | |||
890 | 44 | #include "libintl.h" | 45 | #include "libintl.h" |
891 | 45 | 46 | ||
892 | 46 | #include <QImage> | 47 | #include <QImage> |
893 | 47 | #include <QDebug> | ||
894 | 48 | #include <QStandardPaths> | 48 | #include <QStandardPaths> |
895 | 49 | #include <QUuid> | 49 | #include <QUuid> |
896 | 50 | #include <QPointer> | 50 | #include <QPointer> |
897 | @@ -59,6 +59,7 @@ | |||
898 | 59 | m_notebooksLoading(false), | 59 | m_notebooksLoading(false), |
899 | 60 | m_tagsLoading(false) | 60 | m_tagsLoading(false) |
900 | 61 | { | 61 | { |
901 | 62 | qCDebug(dcNotesStore) << "Creating NotesStore instance."; | ||
902 | 62 | connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected); | 63 | connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected); |
903 | 63 | 64 | ||
904 | 64 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); | 65 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); |
905 | @@ -72,7 +73,7 @@ | |||
906 | 72 | 73 | ||
907 | 73 | QDir storageDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()); | 74 | QDir storageDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()); |
908 | 74 | if (!storageDir.exists()) { | 75 | if (!storageDir.exists()) { |
910 | 75 | qDebug() << "creating storage directory:" << storageDir.absolutePath(); | 76 | qCDebug(dcNotesStore) << "Creating storage directory:" << storageDir.absolutePath(); |
911 | 76 | storageDir.mkpath(storageDir.absolutePath()); | 77 | storageDir.mkpath(storageDir.absolutePath()); |
912 | 77 | } | 78 | } |
913 | 78 | } | 79 | } |
914 | @@ -97,7 +98,7 @@ | |||
915 | 97 | return; | 98 | return; |
916 | 98 | } | 99 | } |
917 | 99 | if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) { | 100 | if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) { |
919 | 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."; |
920 | 101 | return; | 102 | return; |
921 | 102 | } | 103 | } |
922 | 103 | 104 | ||
923 | @@ -106,7 +107,7 @@ | |||
924 | 106 | emit usernameChanged(); | 107 | emit usernameChanged(); |
925 | 107 | 108 | ||
926 | 108 | m_cacheFile = storageLocation() + "notes.cache"; | 109 | m_cacheFile = storageLocation() + "notes.cache"; |
928 | 109 | qDebug() << "initialized cacheFile" << m_cacheFile; | 110 | qCDebug(dcNotesStore) << "Initialized cacheFile:" << m_cacheFile; |
929 | 110 | loadFromCacheFile(); | 111 | loadFromCacheFile(); |
930 | 111 | } | 112 | } |
931 | 112 | } | 113 | } |
932 | @@ -118,7 +119,7 @@ | |||
933 | 118 | 119 | ||
934 | 119 | void NotesStore::userStoreConnected(const QString &username) | 120 | void NotesStore::userStoreConnected(const QString &username) |
935 | 120 | { | 121 | { |
937 | 121 | qDebug() << "User store connected!" << username; | 122 | qCDebug(dcNotesStore) << "User store connected! Using username:" << username; |
938 | 122 | setUsername(username); | 123 | setUsername(username); |
939 | 123 | 124 | ||
940 | 124 | refreshNotebooks(); | 125 | refreshNotebooks(); |
941 | @@ -274,6 +275,7 @@ | |||
942 | 274 | { | 275 | { |
943 | 275 | QString newGuid = QUuid::createUuid().toString(); | 276 | QString newGuid = QUuid::createUuid().toString(); |
944 | 276 | newGuid.remove("{").remove("}"); | 277 | newGuid.remove("{").remove("}"); |
945 | 278 | qCDebug(dcNotesStore) << "Creating notebook:" << newGuid; | ||
946 | 277 | Notebook *notebook = new Notebook(newGuid, 1, this); | 279 | Notebook *notebook = new Notebook(newGuid, 1, this); |
947 | 278 | notebook->setName(name); | 280 | notebook->setName(name); |
948 | 279 | if (m_notebooks.isEmpty()) { | 281 | if (m_notebooks.isEmpty()) { |
949 | @@ -287,6 +289,7 @@ | |||
950 | 287 | syncToCacheFile(notebook); | 289 | syncToCacheFile(notebook); |
951 | 288 | 290 | ||
952 | 289 | if (EvernoteConnection::instance()->isConnected()) { | 291 | if (EvernoteConnection::instance()->isConnected()) { |
953 | 292 | qCDebug(dcSync) << "Creating notebook on server:" << notebook->guid(); | ||
954 | 290 | notebook->setLoading(true); | 293 | notebook->setLoading(true); |
955 | 291 | CreateNotebookJob *job = new CreateNotebookJob(notebook); | 294 | CreateNotebookJob *job = new CreateNotebookJob(notebook); |
956 | 292 | connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone); | 295 | connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone); |
957 | @@ -298,19 +301,21 @@ | |||
958 | 298 | { | 301 | { |
959 | 299 | Notebook *notebook = m_notebooksHash.value(tmpGuid); | 302 | Notebook *notebook = m_notebooksHash.value(tmpGuid); |
960 | 300 | if (!notebook) { | 303 | if (!notebook) { |
962 | 301 | qWarning() << "Cannot find temporary notebook after create finished"; | 304 | qCWarning(dcSync) << "Cannot find temporary notebook after create finished"; |
963 | 302 | return; | 305 | return; |
964 | 303 | } | 306 | } |
965 | 304 | 307 | ||
966 | 305 | notebook->setLoading(false); | 308 | notebook->setLoading(false); |
967 | 306 | 309 | ||
968 | 307 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 310 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
970 | 308 | qWarning() << "Error creating notebook:" << errorMessage; | 311 | qCWarning(dcSync) << "Error creating notebook:" << errorMessage; |
971 | 309 | notebook->setSyncError(true); | 312 | notebook->setSyncError(true); |
972 | 310 | return; | 313 | return; |
973 | 311 | } | 314 | } |
974 | 312 | QString guid = QString::fromStdString(result.guid); | 315 | QString guid = QString::fromStdString(result.guid); |
976 | 313 | qDebug() << "create notebooks job done2"; | 316 | |
977 | 317 | qCDebug(dcSync) << "Notebook created on server. Old guid:" << tmpGuid << "New guid:" << guid; | ||
978 | 318 | qCDebug(dcNotesStore) << "Changing notebook guid. Old guid:" << tmpGuid << "New guid:" << guid; | ||
979 | 314 | 319 | ||
980 | 315 | m_notebooksHash.insert(guid, notebook); | 320 | m_notebooksHash.insert(guid, notebook); |
981 | 316 | notebook->setGuid(QString::fromStdString(result.guid)); | 321 | notebook->setGuid(QString::fromStdString(result.guid)); |
982 | @@ -338,7 +343,7 @@ | |||
983 | 338 | { | 343 | { |
984 | 339 | Notebook *notebook = m_notebooksHash.value(guid); | 344 | Notebook *notebook = m_notebooksHash.value(guid); |
985 | 340 | if (!notebook) { | 345 | if (!notebook) { |
987 | 341 | qWarning() << "Can't save notebook. Guid not found:" << guid; | 346 | qCWarning(dcNotesStore) << "Can't save notebook. Guid not found:" << guid; |
988 | 342 | return; | 347 | return; |
989 | 343 | } | 348 | } |
990 | 344 | 349 | ||
991 | @@ -358,11 +363,11 @@ | |||
992 | 358 | { | 363 | { |
993 | 359 | Notebook *notebook = m_notebooksHash.value(guid); | 364 | Notebook *notebook = m_notebooksHash.value(guid); |
994 | 360 | if (!notebook) { | 365 | if (!notebook) { |
996 | 361 | qWarning() << "[NotesStore] Notebook guid not found:" << guid; | 366 | qCWarning(dcNotesStore) << "Notebook guid not found:" << guid; |
997 | 362 | return; | 367 | return; |
998 | 363 | } | 368 | } |
999 | 364 | 369 | ||
1001 | 365 | qDebug() << "[NotesStore] Setting default notebook:" << guid; | 370 | qCDebug(dcNotesStore) << "Setting default notebook:" << guid; |
1002 | 366 | foreach (Notebook *tmp, m_notebooks) { | 371 | foreach (Notebook *tmp, m_notebooks) { |
1003 | 367 | if (tmp->isDefaultNotebook()) { | 372 | if (tmp->isDefaultNotebook()) { |
1004 | 368 | tmp->setIsDefaultNotebook(false); | 373 | tmp->setIsDefaultNotebook(false); |
1005 | @@ -379,7 +384,7 @@ | |||
1006 | 379 | { | 384 | { |
1007 | 380 | Tag *tag = m_tagsHash.value(guid); | 385 | Tag *tag = m_tagsHash.value(guid); |
1008 | 381 | if (!tag) { | 386 | if (!tag) { |
1010 | 382 | qWarning() << "Can't save tag. Guid not found:" << guid; | 387 | qCWarning(dcNotesStore) << "Can't save tag. Guid not found:" << guid; |
1011 | 383 | return; | 388 | return; |
1012 | 384 | } | 389 | } |
1013 | 385 | 390 | ||
1014 | @@ -398,7 +403,7 @@ | |||
1015 | 398 | void NotesStore::expungeNotebook(const QString &guid) | 403 | void NotesStore::expungeNotebook(const QString &guid) |
1016 | 399 | { | 404 | { |
1017 | 400 | if (m_username != "@local") { | 405 | if (m_username != "@local") { |
1019 | 401 | qWarning() << "[NotesStore] Account managed by Evernote. Cannot delete notebooks."; | 406 | qCWarning(dcNotesStore) << "Account managed by Evernote. Cannot delete notebooks."; |
1020 | 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."))); |
1021 | 403 | emit errorChanged(); | 408 | emit errorChanged(); |
1022 | 404 | return; | 409 | return; |
1023 | @@ -406,12 +411,12 @@ | |||
1024 | 406 | 411 | ||
1025 | 407 | Notebook* notebook = m_notebooksHash.value(guid); | 412 | Notebook* notebook = m_notebooksHash.value(guid); |
1026 | 408 | if (!notebook) { | 413 | if (!notebook) { |
1028 | 409 | qWarning() << "[NotesStore] Cannot delete notebook. Notebook not found for guid:" << guid; | 414 | qCWarning(dcNotesStore) << "Cannot delete notebook. Notebook not found for guid:" << guid; |
1029 | 410 | return; | 415 | return; |
1030 | 411 | } | 416 | } |
1031 | 412 | 417 | ||
1032 | 413 | if (notebook->isDefaultNotebook()) { | 418 | if (notebook->isDefaultNotebook()) { |
1034 | 414 | qWarning() << "[NotesStore] Cannot delete the default notebook."; | 419 | qCWarning(dcNotesStore) << "Cannot delete the default notebook."; |
1035 | 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."))); |
1036 | 416 | emit errorChanged(); | 421 | emit errorChanged(); |
1037 | 417 | return; | 422 | return; |
1038 | @@ -426,7 +431,7 @@ | |||
1039 | 426 | } | 431 | } |
1040 | 427 | } | 432 | } |
1041 | 428 | if (defaultNotebook.isEmpty()) { | 433 | if (defaultNotebook.isEmpty()) { |
1043 | 429 | qWarning() << "[NotesStore] No default notebook set. Can't delete notebooks."; | 434 | qCWarning(dcNotesStore) << "No default notebook set. Can't delete notebooks."; |
1044 | 430 | return; | 435 | return; |
1045 | 431 | } | 436 | } |
1046 | 432 | 437 | ||
1047 | @@ -434,11 +439,11 @@ | |||
1048 | 434 | QString noteGuid = notebook->noteAt(0); | 439 | QString noteGuid = notebook->noteAt(0); |
1049 | 435 | Note *note = m_notesHash.value(noteGuid); | 440 | Note *note = m_notesHash.value(noteGuid); |
1050 | 436 | if (!note) { | 441 | if (!note) { |
1052 | 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"; |
1053 | 438 | Q_ASSERT(false); | 443 | Q_ASSERT(false); |
1054 | 439 | continue; | 444 | continue; |
1055 | 440 | } | 445 | } |
1057 | 441 | qDebug() << "[NotesStore] Moving note" << noteGuid << "to default Notebook"; | 446 | qCDebug(dcNotesStore) << "Moving note" << noteGuid << "to default Notebook"; |
1058 | 442 | note->setNotebookGuid(defaultNotebook); | 447 | note->setNotebookGuid(defaultNotebook); |
1059 | 443 | saveNote(note->guid()); | 448 | saveNote(note->guid()); |
1060 | 444 | emit noteChanged(note->guid(), defaultNotebook); | 449 | emit noteChanged(note->guid(), defaultNotebook); |
1061 | @@ -491,16 +496,15 @@ | |||
1062 | 491 | 496 | ||
1063 | 492 | void NotesStore::createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result) | 497 | void NotesStore::createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result) |
1064 | 493 | { | 498 | { |
1065 | 494 | qDebug() << "CreateTagJob done"; | ||
1066 | 495 | Tag *tag = m_tagsHash.value(tmpGuid); | 499 | Tag *tag = m_tagsHash.value(tmpGuid); |
1067 | 496 | if (!tag) { | 500 | if (!tag) { |
1069 | 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"; |
1070 | 498 | return; | 502 | return; |
1071 | 499 | } | 503 | } |
1072 | 500 | 504 | ||
1073 | 501 | tag->setLoading(false); | 505 | tag->setLoading(false); |
1074 | 502 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 506 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1076 | 503 | qWarning() << "Error creating tag:" << errorMessage; | 507 | qCWarning(dcSync) << "Error creating tag on server:" << errorMessage; |
1077 | 504 | tag->setSyncError(true); | 508 | tag->setSyncError(true); |
1078 | 505 | emit tagChanged(tag->guid()); | 509 | emit tagChanged(tag->guid()); |
1079 | 506 | return; | 510 | return; |
1080 | @@ -532,12 +536,12 @@ | |||
1081 | 532 | { | 536 | { |
1082 | 533 | Tag *tag = m_tagsHash.value(QString::fromStdString(result.guid)); | 537 | Tag *tag = m_tagsHash.value(QString::fromStdString(result.guid)); |
1083 | 534 | if (!tag) { | 538 | if (!tag) { |
1085 | 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"; |
1086 | 536 | return; | 540 | return; |
1087 | 537 | } | 541 | } |
1088 | 538 | tag->setLoading(false); | 542 | tag->setLoading(false); |
1089 | 539 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 543 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1091 | 540 | qWarning() << "error updating tag" << errorMessage; | 544 | qCWarning(dcSync) << "Error updating tag on server" << errorMessage; |
1092 | 541 | tag->setSyncError(true); | 545 | tag->setSyncError(true); |
1093 | 542 | emit tagChanged(tag->guid()); | 546 | emit tagChanged(tag->guid()); |
1094 | 543 | return; | 547 | return; |
1095 | @@ -554,18 +558,18 @@ | |||
1096 | 554 | { | 558 | { |
1097 | 555 | Note *note = m_notesHash.value(noteGuid); | 559 | Note *note = m_notesHash.value(noteGuid); |
1098 | 556 | if (!note) { | 560 | if (!note) { |
1100 | 557 | qWarning() << "No such note" << noteGuid; | 561 | qCWarning(dcNotesStore) << "No such note" << noteGuid; |
1101 | 558 | return; | 562 | return; |
1102 | 559 | } | 563 | } |
1103 | 560 | 564 | ||
1104 | 561 | Tag *tag = m_tagsHash.value(tagGuid); | 565 | Tag *tag = m_tagsHash.value(tagGuid); |
1105 | 562 | if (!tag) { | 566 | if (!tag) { |
1107 | 563 | qWarning() << "No such tag" << tagGuid; | 567 | qCWarning(dcNotesStore) << "No such tag" << tagGuid; |
1108 | 564 | return; | 568 | return; |
1109 | 565 | } | 569 | } |
1110 | 566 | 570 | ||
1111 | 567 | if (note->tagGuids().contains(tagGuid)) { | 571 | if (note->tagGuids().contains(tagGuid)) { |
1113 | 568 | qWarning() << "Note" << noteGuid << "already tagged with tag" << tagGuid; | 572 | qCWarning(dcNotesStore) << "Note" << noteGuid << "already tagged with tag" << tagGuid; |
1114 | 569 | return; | 573 | return; |
1115 | 570 | } | 574 | } |
1116 | 571 | 575 | ||
1117 | @@ -577,18 +581,18 @@ | |||
1118 | 577 | { | 581 | { |
1119 | 578 | Note *note = m_notesHash.value(noteGuid); | 582 | Note *note = m_notesHash.value(noteGuid); |
1120 | 579 | if (!note) { | 583 | if (!note) { |
1122 | 580 | qWarning() << "No such note" << noteGuid; | 584 | qCWarning(dcNotesStore) << "No such note" << noteGuid; |
1123 | 581 | return; | 585 | return; |
1124 | 582 | } | 586 | } |
1125 | 583 | 587 | ||
1126 | 584 | Tag *tag = m_tagsHash.value(tagGuid); | 588 | Tag *tag = m_tagsHash.value(tagGuid); |
1127 | 585 | if (!tag) { | 589 | if (!tag) { |
1129 | 586 | qWarning() << "No such tag" << tagGuid; | 590 | qCWarning(dcNotesStore) << "No such tag" << tagGuid; |
1130 | 587 | return; | 591 | return; |
1131 | 588 | } | 592 | } |
1132 | 589 | 593 | ||
1133 | 590 | if (!note->tagGuids().contains(tagGuid)) { | 594 | if (!note->tagGuids().contains(tagGuid)) { |
1135 | 591 | qWarning() << "Note" << noteGuid << "is not tagged with tag" << tagGuid; | 595 | qCWarning(dcNotesStore) << "Note" << noteGuid << "is not tagged with tag" << tagGuid; |
1136 | 592 | return; | 596 | return; |
1137 | 593 | } | 597 | } |
1138 | 594 | 598 | ||
1139 | @@ -601,7 +605,7 @@ | |||
1140 | 601 | void NotesStore::refreshNotes(const QString &filterNotebookGuid, int startIndex) | 605 | void NotesStore::refreshNotes(const QString &filterNotebookGuid, int startIndex) |
1141 | 602 | { | 606 | { |
1142 | 603 | if (m_loading && startIndex == 0) { | 607 | if (m_loading && startIndex == 0) { |
1144 | 604 | qWarning() << "Still busy with refreshing..."; | 608 | qCWarning(dcSync) << "Still busy with refreshing..."; |
1145 | 605 | return; | 609 | return; |
1146 | 606 | } | 610 | } |
1147 | 607 | 611 | ||
1148 | @@ -626,22 +630,22 @@ | |||
1149 | 626 | // All is well... | 630 | // All is well... |
1150 | 627 | break; | 631 | break; |
1151 | 628 | case EvernoteConnection::ErrorCodeUserException: | 632 | case EvernoteConnection::ErrorCodeUserException: |
1153 | 629 | qWarning() << "FetchNotesJobDone: EDAMUserException:" << errorMessage; | 633 | qCWarning(dcSync) << "FetchNotesJobDone: EDAMUserException:" << errorMessage; |
1154 | 630 | m_loading = false; | 634 | m_loading = false; |
1155 | 631 | emit loadingChanged(); | 635 | emit loadingChanged(); |
1156 | 632 | return; // silently discarding... | 636 | return; // silently discarding... |
1157 | 633 | case EvernoteConnection::ErrorCodeConnectionLost: | 637 | case EvernoteConnection::ErrorCodeConnectionLost: |
1159 | 634 | qWarning() << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage; | 638 | qCWarning(dcSync) << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage; |
1160 | 635 | m_loading = false; | 639 | m_loading = false; |
1161 | 636 | emit loadingChanged(); | 640 | emit loadingChanged(); |
1162 | 637 | return; // silently discarding... | 641 | return; // silently discarding... |
1163 | 638 | case EvernoteConnection::ErrorCodeNotFoundExcpetion: | 642 | case EvernoteConnection::ErrorCodeNotFoundExcpetion: |
1165 | 639 | qWarning() << "FetchNotesJobDone: Item not found on server:" << errorMessage; | 643 | qCWarning(dcSync) << "FetchNotesJobDone: Item not found on server:" << errorMessage; |
1166 | 640 | m_loading = false; | 644 | m_loading = false; |
1167 | 641 | emit loadingChanged(); | 645 | emit loadingChanged(); |
1168 | 642 | return; // silently discarding... | 646 | return; // silently discarding... |
1169 | 643 | default: | 647 | default: |
1171 | 644 | qWarning() << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode; | 648 | qCWarning(dcSync) << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode; |
1172 | 645 | m_loading = false; | 649 | m_loading = false; |
1173 | 646 | emit loadingChanged(); | 650 | emit loadingChanged(); |
1174 | 647 | return; | 651 | return; |
1175 | @@ -654,7 +658,7 @@ | |||
1176 | 654 | QVector<int> changedRoles; | 658 | QVector<int> changedRoles; |
1177 | 655 | bool newNote = note == 0; | 659 | bool newNote = note == 0; |
1178 | 656 | if (newNote) { | 660 | if (newNote) { |
1180 | 657 | qDebug() << "FetchNotesJobDone: Found new note on server."; | 661 | qCDebug(dcSync) << "Found new note on server. Creating local copy:" << QString::fromStdString(result.guid); |
1181 | 658 | note = new Note(QString::fromStdString(result.guid), 0, this); | 662 | note = new Note(QString::fromStdString(result.guid), 0, this); |
1182 | 659 | connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged); | 663 | connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged); |
1183 | 660 | connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged); | 664 | connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged); |
1184 | @@ -671,7 +675,7 @@ | |||
1185 | 671 | } else if (note->synced()) { | 675 | } else if (note->synced()) { |
1186 | 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. |
1187 | 673 | if (note->updateSequenceNumber() < result.updateSequenceNum) { | 677 | if (note->updateSequenceNumber() < result.updateSequenceNum) { |
1189 | 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; |
1190 | 675 | changedRoles = updateFromEDAM(result, note); | 679 | changedRoles = updateFromEDAM(result, note); |
1191 | 676 | refreshNoteContent(note->guid(), FetchNoteJob::LoadContent, EvernoteJob::JobPriorityLow); | 680 | refreshNoteContent(note->guid(), FetchNoteJob::LoadContent, EvernoteJob::JobPriorityLow); |
1192 | 677 | syncToCacheFile(note); | 681 | syncToCacheFile(note); |
1193 | @@ -679,7 +683,7 @@ | |||
1194 | 679 | } else { | 683 | } else { |
1195 | 680 | // Local note changed. See if we can push our changes. | 684 | // Local note changed. See if we can push our changes. |
1196 | 681 | if (note->lastSyncedSequenceNumber() == result.updateSequenceNum) { | 685 | if (note->lastSyncedSequenceNumber() == result.updateSequenceNum) { |
1198 | 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."; |
1199 | 683 | 687 | ||
1200 | 684 | // Make sure we have everything loaded from cache before saving to server | 688 | // Make sure we have everything loaded from cache before saving to server |
1201 | 685 | if (!note->loaded() && note->isCached()) { | 689 | if (!note->loaded() && note->isCached()) { |
1202 | @@ -692,10 +696,10 @@ | |||
1203 | 692 | connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone); | 696 | connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone); |
1204 | 693 | EvernoteConnection::instance()->enqueue(job); | 697 | EvernoteConnection::instance()->enqueue(job); |
1205 | 694 | } else { | 698 | } else { |
1210 | 695 | qWarning() << "CONFLICT: Note has been changed on server and locally!"; | 699 | qCWarning(dcSync) << "CONFLICT: Note has been changed on server and locally!"; |
1211 | 696 | qWarning() << "local note sequence:" << note->updateSequenceNumber(); | 700 | qCWarning(dcSync) << "local note sequence:" << note->updateSequenceNumber(); |
1212 | 697 | qWarning() << "last synced sequence:" << note->lastSyncedSequenceNumber(); | 701 | qCWarning(dcSync) << "last synced sequence:" << note->lastSyncedSequenceNumber(); |
1213 | 698 | qWarning() << "remote sequence:" << result.updateSequenceNum; | 702 | qCWarning(dcSync) << "remote sequence:" << result.updateSequenceNum; |
1214 | 699 | note->setConflicting(true); | 703 | note->setConflicting(true); |
1215 | 700 | changedRoles << RoleConflicting; | 704 | changedRoles << RoleConflicting; |
1216 | 701 | } | 705 | } |
1217 | @@ -714,10 +718,10 @@ | |||
1218 | 714 | } | 718 | } |
1219 | 715 | 719 | ||
1220 | 716 | if (results.startIndex + (int32_t)results.notes.size() < results.totalNotes) { | 720 | if (results.startIndex + (int32_t)results.notes.size() < results.totalNotes) { |
1222 | 717 | qDebug() << "FetchNotesJobDone: Not all notes fetched yet. Fetching next batch."; | 721 | qCDebug(dcSync) << "Not all notes fetched yet. Fetching next batch."; |
1223 | 718 | refreshNotes(filterNotebookGuid, results.startIndex + results.notes.size()); | 722 | refreshNotes(filterNotebookGuid, results.startIndex + results.notes.size()); |
1224 | 719 | } else { | 723 | } else { |
1226 | 720 | qDebug() << "Fetched all notes. Starting merge..."; | 724 | qCDebug(dcSync) << "Fetched all notes from Evernote. Starting merge of local changes..."; |
1227 | 721 | m_organizerAdapter->startSync(); | 725 | m_organizerAdapter->startSync(); |
1228 | 722 | m_loading = false; | 726 | m_loading = false; |
1229 | 723 | emit loadingChanged(); | 727 | emit loadingChanged(); |
1230 | @@ -728,7 +732,7 @@ | |||
1231 | 728 | if (!note) { | 732 | if (!note) { |
1232 | 729 | continue; // Note might be deleted locally by now | 733 | continue; // Note might be deleted locally by now |
1233 | 730 | } | 734 | } |
1235 | 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(); |
1236 | 732 | if (note->lastSyncedSequenceNumber() == 0) { | 736 | if (note->lastSyncedSequenceNumber() == 0) { |
1237 | 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. |
1238 | 734 | bool hasUnsyncedTag = false; | 738 | bool hasUnsyncedTag = false; |
1239 | @@ -741,15 +745,15 @@ | |||
1240 | 741 | } | 745 | } |
1241 | 742 | } | 746 | } |
1242 | 743 | if (hasUnsyncedTag) { | 747 | if (hasUnsyncedTag) { |
1244 | 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"; |
1245 | 745 | continue; | 749 | continue; |
1246 | 746 | } | 750 | } |
1247 | 747 | Notebook *notebook = m_notebooksHash.value(note->notebookGuid()); | 751 | Notebook *notebook = m_notebooksHash.value(note->notebookGuid()); |
1248 | 748 | if (notebook && notebook->lastSyncedSequenceNumber() == 0) { | 752 | if (notebook && notebook->lastSyncedSequenceNumber() == 0) { |
1250 | 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"; |
1251 | 750 | continue; | 754 | continue; |
1252 | 751 | } | 755 | } |
1254 | 752 | qDebug() << "Creating note on server:" << note->guid(); | 756 | qCDebug(dcSync) << "Creating note on server:" << note->guid(); |
1255 | 753 | 757 | ||
1256 | 754 | // Make sure we have everything loaded from cache before saving to server | 758 | // Make sure we have everything loaded from cache before saving to server |
1257 | 755 | if (!note->loaded() && note->isCached()) { | 759 | if (!note->loaded() && note->isCached()) { |
1258 | @@ -782,18 +786,19 @@ | |||
1259 | 782 | } | 786 | } |
1260 | 783 | } | 787 | } |
1261 | 784 | } | 788 | } |
1262 | 789 | qCDebug(dcSync) << "Local changes merged."; | ||
1263 | 785 | } | 790 | } |
1264 | 786 | } | 791 | } |
1265 | 787 | 792 | ||
1266 | 788 | void NotesStore::refreshNoteContent(const QString &guid, FetchNoteJob::LoadWhat what, EvernoteJob::JobPriority priority) | 793 | void NotesStore::refreshNoteContent(const QString &guid, FetchNoteJob::LoadWhat what, EvernoteJob::JobPriority priority) |
1267 | 789 | { | 794 | { |
1268 | 790 | qDebug() << "fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image"); | ||
1269 | 791 | Note *note = m_notesHash.value(guid); | 795 | Note *note = m_notesHash.value(guid); |
1270 | 792 | if (!note) { | 796 | if (!note) { |
1272 | 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; |
1273 | 794 | return; | 798 | return; |
1274 | 795 | } | 799 | } |
1275 | 796 | if (EvernoteConnection::instance()->isConnected()) { | 800 | if (EvernoteConnection::instance()->isConnected()) { |
1276 | 801 | qCDebug(dcNotesStore) << "Fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image"); | ||
1277 | 797 | FetchNoteJob *job = new FetchNoteJob(guid, what, this); | 802 | FetchNoteJob *job = new FetchNoteJob(guid, what, this); |
1278 | 798 | job->setJobPriority(priority); | 803 | job->setJobPriority(priority); |
1279 | 799 | connect(job, &FetchNoteJob::resultReady, this, &NotesStore::fetchNoteJobDone); | 804 | connect(job, &FetchNoteJob::resultReady, this, &NotesStore::fetchNoteJobDone); |
1280 | @@ -810,7 +815,7 @@ | |||
1281 | 810 | FetchNoteJob *job = static_cast<FetchNoteJob*>(sender()); | 815 | FetchNoteJob *job = static_cast<FetchNoteJob*>(sender()); |
1282 | 811 | Note *note = m_notesHash.value(QString::fromStdString(result.guid)); | 816 | Note *note = m_notesHash.value(QString::fromStdString(result.guid)); |
1283 | 812 | if (!note) { | 817 | if (!note) { |
1285 | 813 | qWarning() << "can't find note for this update... ignoring..."; | 818 | qCWarning(dcSync) << "can't find note for this update... ignoring..."; |
1286 | 814 | return; | 819 | return; |
1287 | 815 | } | 820 | } |
1288 | 816 | QModelIndex noteIndex = index(m_notes.indexOf(note)); | 821 | QModelIndex noteIndex = index(m_notes.indexOf(note)); |
1289 | @@ -825,19 +830,19 @@ | |||
1290 | 825 | emit dataChanged(noteIndex, noteIndex, roles); | 830 | emit dataChanged(noteIndex, noteIndex, roles); |
1291 | 826 | break; | 831 | break; |
1292 | 827 | case EvernoteConnection::ErrorCodeUserException: | 832 | case EvernoteConnection::ErrorCodeUserException: |
1294 | 828 | qWarning() << "FetchNoteJobDone: EDAMUserException:" << errorMessage; | 833 | qCWarning(dcSync) << "FetchNoteJobDone: EDAMUserException:" << errorMessage; |
1295 | 829 | emit dataChanged(noteIndex, noteIndex, roles); | 834 | emit dataChanged(noteIndex, noteIndex, roles); |
1296 | 830 | return; // silently discarding... | 835 | return; // silently discarding... |
1297 | 831 | case EvernoteConnection::ErrorCodeConnectionLost: | 836 | case EvernoteConnection::ErrorCodeConnectionLost: |
1299 | 832 | qWarning() << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage; | 837 | qCWarning(dcSync) << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage; |
1300 | 833 | emit dataChanged(noteIndex, noteIndex, roles); | 838 | emit dataChanged(noteIndex, noteIndex, roles); |
1301 | 834 | return; // silently discarding... | 839 | return; // silently discarding... |
1302 | 835 | case EvernoteConnection::ErrorCodeNotFoundExcpetion: | 840 | case EvernoteConnection::ErrorCodeNotFoundExcpetion: |
1304 | 836 | qWarning() << "FetchNoteJobDone: Item not found on server:" << errorMessage; | 841 | qCWarning(dcSync) << "FetchNoteJobDone: Item not found on server:" << errorMessage; |
1305 | 837 | emit dataChanged(noteIndex, noteIndex, roles); | 842 | emit dataChanged(noteIndex, noteIndex, roles); |
1306 | 838 | return; // silently discarding... | 843 | return; // silently discarding... |
1307 | 839 | default: | 844 | default: |
1309 | 840 | qWarning() << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode; | 845 | qCWarning(dcSync) << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode; |
1310 | 841 | note->setSyncError(true); | 846 | note->setSyncError(true); |
1311 | 842 | roles << RoleSyncError; | 847 | roles << RoleSyncError; |
1312 | 843 | emit dataChanged(noteIndex, noteIndex, roles); | 848 | emit dataChanged(noteIndex, noteIndex, roles); |
1313 | @@ -861,7 +866,7 @@ | |||
1314 | 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. |
1315 | 862 | bool refreshWithResourceData = false; | 867 | bool refreshWithResourceData = false; |
1316 | 863 | 868 | ||
1318 | 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(); |
1319 | 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 ui | 870 | // 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 |
1320 | 866 | for (unsigned int i = 0; i < result.resources.size(); ++i) { | 871 | for (unsigned int i = 0; i < result.resources.size(); ++i) { |
1321 | 867 | 872 | ||
1322 | @@ -872,14 +877,14 @@ | |||
1323 | 872 | QString mime = QString::fromStdString(resource.mime); | 877 | QString mime = QString::fromStdString(resource.mime); |
1324 | 873 | 878 | ||
1325 | 874 | if (what == FetchNoteJob::LoadResources) { | 879 | if (what == FetchNoteJob::LoadResources) { |
1327 | 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; |
1328 | 876 | QByteArray resourceData = QByteArray(resource.data.body.data(), resource.data.size); | 881 | QByteArray resourceData = QByteArray(resource.data.body.data(), resource.data.size); |
1329 | 877 | note->addResource(resourceData, hash, fileName, mime); | 882 | note->addResource(resourceData, hash, fileName, mime); |
1330 | 878 | } else if (Resource::isCached(hash)) { | 883 | } else if (Resource::isCached(hash)) { |
1332 | 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; |
1333 | 880 | note->addResource(QByteArray(), hash, fileName, mime); | 885 | note->addResource(QByteArray(), hash, fileName, mime); |
1334 | 881 | } else { | 886 | } else { |
1336 | 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; |
1337 | 883 | refreshWithResourceData = true; | 888 | refreshWithResourceData = true; |
1338 | 884 | } | 889 | } |
1339 | 885 | roles << RoleHtmlContent << RoleEnmlContent << RoleResourceUrls; | 890 | roles << RoleHtmlContent << RoleEnmlContent << RoleResourceUrls; |
1340 | @@ -915,7 +920,7 @@ | |||
1341 | 915 | emit dataChanged(noteIndex, noteIndex, roles); | 920 | emit dataChanged(noteIndex, noteIndex, roles); |
1342 | 916 | 921 | ||
1343 | 917 | if (refreshWithResourceData) { | 922 | if (refreshWithResourceData) { |
1345 | 918 | qDebug() << "refreshWithResourceData"; | 923 | qCDebug(dcSync) << "Fetching Note resources:" << note->guid(); |
1346 | 919 | refreshNoteContent(note->guid(), FetchNoteJob::LoadResources, job->jobPriority()); | 924 | refreshNoteContent(note->guid(), FetchNoteJob::LoadResources, job->jobPriority()); |
1347 | 920 | } else { | 925 | } else { |
1348 | 921 | syncToCacheFile(note); // Syncs into the list cache | 926 | syncToCacheFile(note); // Syncs into the list cache |
1349 | @@ -926,7 +931,7 @@ | |||
1350 | 926 | void NotesStore::refreshNotebooks() | 931 | void NotesStore::refreshNotebooks() |
1351 | 927 | { | 932 | { |
1352 | 928 | if (!EvernoteConnection::instance()->isConnected()) { | 933 | if (!EvernoteConnection::instance()->isConnected()) { |
1354 | 929 | qWarning() << "Not connected. Cannot fetch notebooks from server."; | 934 | qCWarning(dcSync) << "Not connected. Cannot fetch notebooks from server."; |
1355 | 930 | return; | 935 | return; |
1356 | 931 | } | 936 | } |
1357 | 932 | 937 | ||
1358 | @@ -947,27 +952,27 @@ | |||
1359 | 947 | // All is well... | 952 | // All is well... |
1360 | 948 | break; | 953 | break; |
1361 | 949 | case EvernoteConnection::ErrorCodeUserException: | 954 | case EvernoteConnection::ErrorCodeUserException: |
1363 | 950 | qWarning() << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage; | 955 | qCWarning(dcSync) << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage; |
1364 | 951 | // silently discarding... | 956 | // silently discarding... |
1365 | 952 | return; | 957 | return; |
1366 | 953 | case EvernoteConnection::ErrorCodeConnectionLost: | 958 | case EvernoteConnection::ErrorCodeConnectionLost: |
1368 | 954 | qWarning() << "FetchNotebooksJobDone: Connection lost:" << errorMessage; | 959 | qCWarning(dcSync) << "FetchNotebooksJobDone: Connection lost:" << errorMessage; |
1369 | 955 | return; // silently discarding | 960 | return; // silently discarding |
1370 | 956 | default: | 961 | default: |
1372 | 957 | qWarning() << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode; | 962 | qCWarning(dcSync) << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode; |
1373 | 958 | return; // silently discarding | 963 | return; // silently discarding |
1374 | 959 | } | 964 | } |
1375 | 960 | 965 | ||
1376 | 961 | QList<Notebook*> unhandledNotebooks = m_notebooks; | 966 | QList<Notebook*> unhandledNotebooks = m_notebooks; |
1377 | 962 | 967 | ||
1379 | 963 | qDebug() << "[NotesStore] Have" << results.size() << "from Evernote."; | 968 | qCDebug(dcSync) << "Received" << results.size() << "notebooks from Evernote."; |
1380 | 964 | for (unsigned int i = 0; i < results.size(); ++i) { | 969 | for (unsigned int i = 0; i < results.size(); ++i) { |
1381 | 965 | evernote::edam::Notebook result = results.at(i); | 970 | evernote::edam::Notebook result = results.at(i); |
1382 | 966 | Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid)); | 971 | Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid)); |
1383 | 967 | unhandledNotebooks.removeAll(notebook); | 972 | unhandledNotebooks.removeAll(notebook); |
1384 | 968 | bool newNotebook = notebook == 0; | 973 | bool newNotebook = notebook == 0; |
1385 | 969 | if (newNotebook) { | 974 | if (newNotebook) { |
1387 | 970 | qDebug() << "[NotesStore] Found new notebook on Evernote:" << QString::fromStdString(result.guid); | 975 | qCDebug(dcSync) << "Found new notebook on Evernote:" << QString::fromStdString(result.guid); |
1388 | 971 | notebook = new Notebook(QString::fromStdString(result.guid), 0, this); | 976 | notebook = new Notebook(QString::fromStdString(result.guid), 0, this); |
1389 | 972 | updateFromEDAM(result, notebook); | 977 | updateFromEDAM(result, notebook); |
1390 | 973 | m_notebooksHash.insert(notebook->guid(), notebook); | 978 | m_notebooksHash.insert(notebook->guid(), notebook); |
1391 | @@ -976,25 +981,23 @@ | |||
1392 | 976 | syncToCacheFile(notebook); | 981 | syncToCacheFile(notebook); |
1393 | 977 | } else if (notebook->synced()) { | 982 | } else if (notebook->synced()) { |
1394 | 978 | if (notebook->updateSequenceNumber() < result.updateSequenceNum) { | 983 | if (notebook->updateSequenceNumber() < result.updateSequenceNum) { |
1396 | 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(); |
1397 | 980 | updateFromEDAM(result, notebook); | 985 | updateFromEDAM(result, notebook); |
1398 | 981 | emit notebookChanged(notebook->guid()); | 986 | emit notebookChanged(notebook->guid()); |
1399 | 982 | syncToCacheFile(notebook); | 987 | syncToCacheFile(notebook); |
1400 | 983 | } else { | ||
1401 | 984 | qDebug() << "[NotesStore] Notebook is in sync:" << notebook->guid(); | ||
1402 | 985 | } | 988 | } |
1403 | 986 | } else { | 989 | } else { |
1404 | 987 | // Local notebook changed. See if we can push our changes | 990 | // Local notebook changed. See if we can push our changes |
1405 | 988 | if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) { | 991 | if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) { |
1407 | 989 | qDebug() << "[NotesStore] Local Notebook changed. Uploading changes to Evernote:" << notebook->guid(); | 992 | qCDebug(dcNotesStore) << "Local Notebook changed. Uploading changes to Evernote:" << notebook->guid(); |
1408 | 990 | SaveNotebookJob *job = new SaveNotebookJob(notebook); | 993 | SaveNotebookJob *job = new SaveNotebookJob(notebook); |
1409 | 991 | connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone); | 994 | connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone); |
1410 | 992 | EvernoteConnection::instance()->enqueue(job); | 995 | EvernoteConnection::instance()->enqueue(job); |
1411 | 993 | notebook->setLoading(true); | 996 | notebook->setLoading(true); |
1412 | 994 | emit notebookChanged(notebook->guid()); | 997 | emit notebookChanged(notebook->guid()); |
1413 | 995 | } else { | 998 | } else { |
1416 | 996 | qWarning() << "[NotesStore] Sync conflict in notebook:" << notebook->name(); | 999 | qCWarning(dcNotesStore) << "Sync conflict in notebook:" << notebook->name(); |
1417 | 997 | qWarning() << "[NotesStore] Resolving of sync conflicts is not implemented yet."; | 1000 | qCWarning(dcNotesStore) << "Resolving of sync conflicts is not implemented yet."; |
1418 | 998 | notebook->setSyncError(true); | 1001 | notebook->setSyncError(true); |
1419 | 999 | emit notebookChanged(notebook->guid()); | 1002 | emit notebookChanged(notebook->guid()); |
1420 | 1000 | } | 1003 | } |
1421 | @@ -1003,14 +1006,14 @@ | |||
1422 | 1003 | 1006 | ||
1423 | 1004 | foreach (Notebook *notebook, unhandledNotebooks) { | 1007 | foreach (Notebook *notebook, unhandledNotebooks) { |
1424 | 1005 | if (notebook->lastSyncedSequenceNumber() == 0) { | 1008 | if (notebook->lastSyncedSequenceNumber() == 0) { |
1426 | 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(); |
1427 | 1007 | notebook->setLoading(true); | 1010 | notebook->setLoading(true); |
1428 | 1008 | CreateNotebookJob *job = new CreateNotebookJob(notebook); | 1011 | CreateNotebookJob *job = new CreateNotebookJob(notebook); |
1429 | 1009 | connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone); | 1012 | connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone); |
1430 | 1010 | EvernoteConnection::instance()->enqueue(job); | 1013 | EvernoteConnection::instance()->enqueue(job); |
1431 | 1011 | emit notebookChanged(notebook->guid()); | 1014 | emit notebookChanged(notebook->guid()); |
1432 | 1012 | } else { | 1015 | } else { |
1434 | 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(); |
1435 | 1014 | m_notebooks.removeAll(notebook); | 1017 | m_notebooks.removeAll(notebook); |
1436 | 1015 | m_notebooksHash.remove(notebook->guid()); | 1018 | m_notebooksHash.remove(notebook->guid()); |
1437 | 1016 | emit notebookRemoved(notebook->guid()); | 1019 | emit notebookRemoved(notebook->guid()); |
1438 | @@ -1029,7 +1032,7 @@ | |||
1439 | 1029 | void NotesStore::refreshTags() | 1032 | void NotesStore::refreshTags() |
1440 | 1030 | { | 1033 | { |
1441 | 1031 | if (!EvernoteConnection::instance()->isConnected()) { | 1034 | if (!EvernoteConnection::instance()->isConnected()) { |
1443 | 1032 | qWarning() << "Not connected. Cannot fetch tags from server."; | 1035 | qCWarning(dcSync) << "Not connected. Cannot fetch tags from server."; |
1444 | 1033 | return; | 1036 | return; |
1445 | 1034 | } | 1037 | } |
1446 | 1035 | m_tagsLoading = true; | 1038 | m_tagsLoading = true; |
1447 | @@ -1057,14 +1060,14 @@ | |||
1448 | 1057 | // All is well... | 1060 | // All is well... |
1449 | 1058 | break; | 1061 | break; |
1450 | 1059 | case EvernoteConnection::ErrorCodeUserException: | 1062 | case EvernoteConnection::ErrorCodeUserException: |
1452 | 1060 | qWarning() << "FetchTagsJobDone: EDAMUserException:" << errorMessage; | 1063 | qCWarning(dcSync) << "FetchTagsJobDone: EDAMUserException:" << errorMessage; |
1453 | 1061 | // silently discarding... | 1064 | // silently discarding... |
1454 | 1062 | return; | 1065 | return; |
1455 | 1063 | case EvernoteConnection::ErrorCodeConnectionLost: | 1066 | case EvernoteConnection::ErrorCodeConnectionLost: |
1457 | 1064 | qWarning() << "FetchTagsJobDone: Connection lost:" << errorMessage; | 1067 | qCWarning(dcSync) << "FetchTagsJobDone: Connection lost:" << errorMessage; |
1458 | 1065 | return; // silently discarding | 1068 | return; // silently discarding |
1459 | 1066 | default: | 1069 | default: |
1461 | 1067 | qWarning() << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode; | 1070 | qCWarning(dcSync) << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode; |
1462 | 1068 | return; // silently discarding | 1071 | return; // silently discarding |
1463 | 1069 | } | 1072 | } |
1464 | 1070 | 1073 | ||
1465 | @@ -1077,7 +1080,7 @@ | |||
1466 | 1077 | if (newTag) { | 1080 | if (newTag) { |
1467 | 1078 | tag = new Tag(QString::fromStdString(result.guid), result.updateSequenceNum, this); | 1081 | tag = new Tag(QString::fromStdString(result.guid), result.updateSequenceNum, this); |
1468 | 1079 | tag->setLastSyncedSequenceNumber(result.updateSequenceNum); | 1082 | tag->setLastSyncedSequenceNumber(result.updateSequenceNum); |
1470 | 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(); |
1471 | 1081 | tag->setName(QString::fromStdString(result.name)); | 1084 | tag->setName(QString::fromStdString(result.name)); |
1472 | 1082 | m_tagsHash.insert(tag->guid(), tag); | 1085 | m_tagsHash.insert(tag->guid(), tag); |
1473 | 1083 | m_tags.append(tag); | 1086 | m_tags.append(tag); |
1474 | @@ -1100,7 +1103,7 @@ | |||
1475 | 1100 | tag->setLoading(true); | 1103 | tag->setLoading(true); |
1476 | 1101 | emit tagChanged(tag->guid()); | 1104 | emit tagChanged(tag->guid()); |
1477 | 1102 | } else { | 1105 | } else { |
1479 | 1103 | qWarning() << "CONFLICT in tag" << tag->name(); | 1106 | qCWarning(dcSync) << "CONFLICT in tag" << tag->name(); |
1480 | 1104 | tag->setSyncError(true); | 1107 | tag->setSyncError(true); |
1481 | 1105 | emit tagChanged(tag->guid()); | 1108 | emit tagChanged(tag->guid()); |
1482 | 1106 | } | 1109 | } |
1483 | @@ -1183,7 +1186,7 @@ | |||
1484 | 1183 | { | 1186 | { |
1485 | 1184 | Note *note = m_notesHash.value(tmpGuid); | 1187 | Note *note = m_notesHash.value(tmpGuid); |
1486 | 1185 | if (!note) { | 1188 | if (!note) { |
1488 | 1186 | qWarning() << "Cannot find temporary note after create operation!"; | 1189 | qCWarning(dcSync) << "Cannot find temporary note after create operation!"; |
1489 | 1187 | return; | 1190 | return; |
1490 | 1188 | } | 1191 | } |
1491 | 1189 | int idx = m_notes.indexOf(note); | 1192 | int idx = m_notes.indexOf(note); |
1492 | @@ -1193,7 +1196,7 @@ | |||
1493 | 1193 | roles << RoleLoading; | 1196 | roles << RoleLoading; |
1494 | 1194 | 1197 | ||
1495 | 1195 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 1198 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1497 | 1196 | qWarning() << "Error creating note:" << tmpGuid << errorMessage; | 1199 | qCWarning(dcSync) << "Error creating note on server:" << tmpGuid << errorMessage; |
1498 | 1197 | note->setSyncError(true); | 1200 | note->setSyncError(true); |
1499 | 1198 | roles << RoleSyncError; | 1201 | roles << RoleSyncError; |
1500 | 1199 | emit dataChanged(index(idx), index(idx), roles); | 1202 | emit dataChanged(index(idx), index(idx), roles); |
1501 | @@ -1206,7 +1209,7 @@ | |||
1502 | 1206 | } | 1209 | } |
1503 | 1207 | 1210 | ||
1504 | 1208 | QString guid = QString::fromStdString(result.guid); | 1211 | QString guid = QString::fromStdString(result.guid); |
1506 | 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; |
1507 | 1210 | m_notesHash.insert(guid, note); | 1213 | m_notesHash.insert(guid, note); |
1508 | 1211 | note->setGuid(guid); | 1214 | note->setGuid(guid); |
1509 | 1212 | m_notesHash.remove(tmpGuid); | 1215 | m_notesHash.remove(tmpGuid); |
1510 | @@ -1252,7 +1255,7 @@ | |||
1511 | 1252 | { | 1255 | { |
1512 | 1253 | Note *note = m_notesHash.value(guid); | 1256 | Note *note = m_notesHash.value(guid); |
1513 | 1254 | if (!note) { | 1257 | if (!note) { |
1515 | 1255 | qWarning() << "Can't save note. Guid not found:" << guid; | 1258 | qCWarning(dcNotesStore) << "Can't save note. Guid not found:" << guid; |
1516 | 1256 | return; | 1259 | return; |
1517 | 1257 | } | 1260 | } |
1518 | 1258 | note->setUpdateSequenceNumber(note->updateSequenceNumber()+1); | 1261 | note->setUpdateSequenceNumber(note->updateSequenceNumber()+1); |
1519 | @@ -1283,10 +1286,10 @@ | |||
1520 | 1283 | 1286 | ||
1521 | 1284 | void NotesStore::saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result) | 1287 | void NotesStore::saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result) |
1522 | 1285 | { | 1288 | { |
1524 | 1286 | qDebug() << "saveNoteJobDone. guid:" << QString::fromStdString(result.guid); | 1289 | qCDebug(dcSync) << "Note saved to server:" << QString::fromStdString(result.guid); |
1525 | 1287 | Note *note = m_notesHash.value(QString::fromStdString(result.guid)); | 1290 | Note *note = m_notesHash.value(QString::fromStdString(result.guid)); |
1526 | 1288 | if (!note) { | 1291 | if (!note) { |
1528 | 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."; |
1529 | 1290 | return; | 1293 | return; |
1530 | 1291 | } | 1294 | } |
1531 | 1292 | 1295 | ||
1532 | @@ -1294,7 +1297,7 @@ | |||
1533 | 1294 | note->setLoading(false); | 1297 | note->setLoading(false); |
1534 | 1295 | 1298 | ||
1535 | 1296 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 1299 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1537 | 1297 | qWarning() << "Error saving note:" << errorMessage; | 1300 | qCWarning(dcSync) << "Error saving note:" << errorMessage; |
1538 | 1298 | note->setSyncError(true); | 1301 | note->setSyncError(true); |
1539 | 1299 | emit dataChanged(index(idx), index(idx), QVector<int>() << RoleLoading << RoleSyncError); | 1302 | emit dataChanged(index(idx), index(idx), QVector<int>() << RoleLoading << RoleSyncError); |
1540 | 1300 | return; | 1303 | return; |
1541 | @@ -1317,16 +1320,16 @@ | |||
1542 | 1317 | void NotesStore::saveNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result) | 1320 | void NotesStore::saveNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result) |
1543 | 1318 | { | 1321 | { |
1544 | 1319 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 1322 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1546 | 1320 | qWarning() << "error saving notebook" << errorMessage; | 1323 | qCWarning(dcSync) << "Error saving notebook to server" << errorMessage; |
1547 | 1321 | return; | 1324 | return; |
1548 | 1322 | } | 1325 | } |
1549 | 1323 | 1326 | ||
1550 | 1324 | Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid)); | 1327 | Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid)); |
1551 | 1325 | if (!notebook) { | 1328 | if (!notebook) { |
1553 | 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!"; |
1554 | 1327 | return; | 1330 | return; |
1555 | 1328 | } | 1331 | } |
1557 | 1329 | qDebug() << "save notebook done for:" << notebook->name() << notebook->lastSyncedSequenceNumber() << notebook->updateSequenceNumber() << result.updateSequenceNum; | 1332 | qCDebug(dcSync) << "Notebooks saved to server:" << notebook->guid(); |
1558 | 1330 | updateFromEDAM(result, notebook); | 1333 | updateFromEDAM(result, notebook); |
1559 | 1331 | notebook->setLoading(false); | 1334 | notebook->setLoading(false); |
1560 | 1332 | emit notebookChanged(notebook->guid()); | 1335 | emit notebookChanged(notebook->guid()); |
1561 | @@ -1337,7 +1340,7 @@ | |||
1562 | 1337 | { | 1340 | { |
1563 | 1338 | Note *note = m_notesHash.value(guid); | 1341 | Note *note = m_notesHash.value(guid); |
1564 | 1339 | if (!note) { | 1342 | if (!note) { |
1566 | 1340 | qWarning() << "Note not found. Can't delete"; | 1343 | qCWarning(dcNotesStore) << "Note not found. Can't delete"; |
1567 | 1341 | return; | 1344 | return; |
1568 | 1342 | } | 1345 | } |
1569 | 1343 | 1346 | ||
1570 | @@ -1354,7 +1357,7 @@ | |||
1571 | 1354 | note->deleteLater(); | 1357 | note->deleteLater(); |
1572 | 1355 | } else { | 1358 | } else { |
1573 | 1356 | 1359 | ||
1575 | 1357 | qDebug() << "setting note" << note << "to deleted" << idx; | 1360 | qCDebug(dcNotesStore) << "Setting note to deleted:" << note->guid(); |
1576 | 1358 | note->setDeleted(true); | 1361 | note->setDeleted(true); |
1577 | 1359 | note->setUpdateSequenceNumber(note->updateSequenceNumber()+1); | 1362 | note->setUpdateSequenceNumber(note->updateSequenceNumber()+1); |
1578 | 1360 | emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted); | 1363 | emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted); |
1579 | @@ -1400,7 +1403,7 @@ | |||
1580 | 1400 | void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) | 1403 | void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) |
1581 | 1401 | { | 1404 | { |
1582 | 1402 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 1405 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1584 | 1403 | qWarning() << "Cannot delete note:" << errorMessage; | 1406 | qCWarning(dcSync) << "Cannot delete note from server:" << errorMessage; |
1585 | 1404 | return; | 1407 | return; |
1586 | 1405 | } | 1408 | } |
1587 | 1406 | Note *note = m_notesHash.value(guid); | 1409 | Note *note = m_notesHash.value(guid); |
1588 | @@ -1420,7 +1423,7 @@ | |||
1589 | 1420 | void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) | 1423 | void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) |
1590 | 1421 | { | 1424 | { |
1591 | 1422 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 1425 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1593 | 1423 | qWarning() << "Error expunging notebook:" << errorMessage; | 1426 | qCWarning(dcSync) << "Error expunging notebook:" << errorMessage; |
1594 | 1424 | return; | 1427 | return; |
1595 | 1425 | } | 1428 | } |
1596 | 1426 | emit notebookRemoved(guid); | 1429 | emit notebookRemoved(guid); |
1597 | @@ -1465,7 +1468,7 @@ | |||
1598 | 1465 | 1468 | ||
1599 | 1466 | void NotesStore::syncToCacheFile(Note *note) | 1469 | void NotesStore::syncToCacheFile(Note *note) |
1600 | 1467 | { | 1470 | { |
1602 | 1468 | qDebug() << "syncToCacheFile for note" << note->guid(); | 1471 | qCDebug(dcNotesStore) << "Syncing note to disk:" << note->guid(); |
1603 | 1469 | QSettings cacheFile(m_cacheFile, QSettings::IniFormat); | 1472 | QSettings cacheFile(m_cacheFile, QSettings::IniFormat); |
1604 | 1470 | cacheFile.beginGroup("notes"); | 1473 | cacheFile.beginGroup("notes"); |
1605 | 1471 | cacheFile.setValue(note->guid(), note->updateSequenceNumber()); | 1474 | cacheFile.setValue(note->guid(), note->updateSequenceNumber()); |
1606 | @@ -1515,6 +1518,7 @@ | |||
1607 | 1515 | } | 1518 | } |
1608 | 1516 | } | 1519 | } |
1609 | 1517 | cacheFile.endGroup(); | 1520 | cacheFile.endGroup(); |
1610 | 1521 | qCDebug(dcNotesStore) << "Loaded" << m_notebooks.count() << "notebooks from disk."; | ||
1611 | 1518 | 1522 | ||
1612 | 1519 | cacheFile.beginGroup("tags"); | 1523 | cacheFile.beginGroup("tags"); |
1613 | 1520 | if (cacheFile.allKeys().count() > 0) { | 1524 | if (cacheFile.allKeys().count() > 0) { |
1614 | @@ -1526,13 +1530,14 @@ | |||
1615 | 1526 | } | 1530 | } |
1616 | 1527 | } | 1531 | } |
1617 | 1528 | cacheFile.endGroup(); | 1532 | cacheFile.endGroup(); |
1618 | 1533 | qCDebug(dcNotesStore) << "Loaded" << m_tags.count() << "tags from disk."; | ||
1619 | 1529 | 1534 | ||
1620 | 1530 | cacheFile.beginGroup("notes"); | 1535 | cacheFile.beginGroup("notes"); |
1621 | 1531 | if (cacheFile.allKeys().count() > 0) { | 1536 | if (cacheFile.allKeys().count() > 0) { |
1622 | 1532 | beginInsertRows(QModelIndex(), 0, cacheFile.allKeys().count()-1); | 1537 | beginInsertRows(QModelIndex(), 0, cacheFile.allKeys().count()-1); |
1623 | 1533 | foreach (const QString &key, cacheFile.allKeys()) { | 1538 | foreach (const QString &key, cacheFile.allKeys()) { |
1624 | 1534 | if (m_notesHash.contains(key)) { | 1539 | if (m_notesHash.contains(key)) { |
1626 | 1535 | qWarning() << "already have note. Not reloading from cache."; | 1540 | qCWarning(dcNotesStore) << "already have note. Not reloading from cache."; |
1627 | 1536 | continue; | 1541 | continue; |
1628 | 1537 | } | 1542 | } |
1629 | 1538 | Note *note = new Note(key, cacheFile.value(key).toUInt(), this); | 1543 | Note *note = new Note(key, cacheFile.value(key).toUInt(), this); |
1630 | @@ -1543,6 +1548,7 @@ | |||
1631 | 1543 | endInsertRows(); | 1548 | endInsertRows(); |
1632 | 1544 | } | 1549 | } |
1633 | 1545 | cacheFile.endGroup(); | 1550 | cacheFile.endGroup(); |
1634 | 1551 | qCDebug(dcNotesStore) << "Loaded" << m_notes.count() << "notes from disk."; | ||
1635 | 1546 | } | 1552 | } |
1636 | 1547 | 1553 | ||
1637 | 1548 | QVector<int> NotesStore::updateFromEDAM(const evernote::edam::NoteMetadata &evNote, Note *note) | 1554 | QVector<int> NotesStore::updateFromEDAM(const evernote::edam::NoteMetadata &evNote, Note *note) |
1638 | @@ -1623,7 +1629,6 @@ | |||
1639 | 1623 | if (evNotebook.__isset.published && evNotebook.published != notebook->published()) { | 1629 | if (evNotebook.__isset.published && evNotebook.published != notebook->published()) { |
1640 | 1624 | notebook->setPublished(evNotebook.published); | 1630 | notebook->setPublished(evNotebook.published); |
1641 | 1625 | } | 1631 | } |
1642 | 1626 | qDebug() << "readong from evernote:" << evNotebook.__isset.defaultNotebook << evNotebook.defaultNotebook << notebook->name(); | ||
1643 | 1627 | if (evNotebook.__isset.defaultNotebook && evNotebook.defaultNotebook != notebook->isDefaultNotebook()) { | 1632 | if (evNotebook.__isset.defaultNotebook && evNotebook.defaultNotebook != notebook->isDefaultNotebook()) { |
1644 | 1628 | notebook->setIsDefaultNotebook(evNotebook.defaultNotebook); | 1633 | notebook->setIsDefaultNotebook(evNotebook.defaultNotebook); |
1645 | 1629 | } | 1634 | } |
1646 | @@ -1634,7 +1639,7 @@ | |||
1647 | 1634 | void NotesStore::expungeTag(const QString &guid) | 1639 | void NotesStore::expungeTag(const QString &guid) |
1648 | 1635 | { | 1640 | { |
1649 | 1636 | if (m_username != "@local") { | 1641 | if (m_username != "@local") { |
1651 | 1637 | qWarning() << "This account is managed by Evernote. Cannot delete tags."; | 1642 | qCWarning(dcNotesStore) << "This account is managed by Evernote. Cannot delete tags."; |
1652 | 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.")); |
1653 | 1639 | emit errorChanged(); | 1644 | emit errorChanged(); |
1654 | 1640 | return; | 1645 | return; |
1655 | @@ -1642,7 +1647,7 @@ | |||
1656 | 1642 | 1647 | ||
1657 | 1643 | Tag *tag = m_tagsHash.value(guid); | 1648 | Tag *tag = m_tagsHash.value(guid); |
1658 | 1644 | if (!tag) { | 1649 | if (!tag) { |
1660 | 1645 | qWarning() << "[NotesStore] No tag with guid" << guid; | 1650 | qCWarning(dcNotesStore) << "No tag with guid" << guid; |
1661 | 1646 | return; | 1651 | return; |
1662 | 1647 | } | 1652 | } |
1663 | 1648 | 1653 | ||
1664 | @@ -1650,7 +1655,7 @@ | |||
1665 | 1650 | QString noteGuid = tag->noteAt(0); | 1655 | QString noteGuid = tag->noteAt(0); |
1666 | 1651 | Note *note = m_notesHash.value(noteGuid); | 1656 | Note *note = m_notesHash.value(noteGuid); |
1667 | 1652 | if (!note) { | 1657 | if (!note) { |
1669 | 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"; |
1670 | 1654 | continue; | 1659 | continue; |
1671 | 1655 | } | 1660 | } |
1672 | 1656 | untagNote(noteGuid, guid); | 1661 | untagNote(noteGuid, guid); |
1673 | 1657 | 1662 | ||
1674 | === modified file 'src/libqtevernote/resource.cpp' | |||
1675 | --- src/libqtevernote/resource.cpp 2015-02-27 00:43:59 +0000 | |||
1676 | +++ src/libqtevernote/resource.cpp 2015-03-06 18:02:44 +0000 | |||
1677 | @@ -20,10 +20,10 @@ | |||
1678 | 20 | 20 | ||
1679 | 21 | #include "resource.h" | 21 | #include "resource.h" |
1680 | 22 | #include "notesstore.h" | 22 | #include "notesstore.h" |
1681 | 23 | #include "logging.h" | ||
1682 | 23 | 24 | ||
1683 | 24 | #include <QFile> | 25 | #include <QFile> |
1684 | 25 | #include <QStandardPaths> | 26 | #include <QStandardPaths> |
1685 | 26 | #include <QDebug> | ||
1686 | 27 | #include <QCryptographicHash> | 27 | #include <QCryptographicHash> |
1687 | 28 | #include <QFileInfo> | 28 | #include <QFileInfo> |
1688 | 29 | #include <QDir> | 29 | #include <QDir> |
1689 | @@ -44,7 +44,7 @@ | |||
1690 | 44 | if (!data.isEmpty() && !file.exists()) { | 44 | if (!data.isEmpty() && !file.exists()) { |
1691 | 45 | 45 | ||
1692 | 46 | if (!file.open(QFile::WriteOnly)) { | 46 | if (!file.open(QFile::WriteOnly)) { |
1694 | 47 | qWarning() << "error writing file" << m_filePath; | 47 | qCWarning(dcNotesStore) << "error writing file" << m_filePath; |
1695 | 48 | return; | 48 | return; |
1696 | 49 | } | 49 | } |
1697 | 50 | file.write(data); | 50 | file.write(data); |
1698 | @@ -69,7 +69,7 @@ | |||
1699 | 69 | 69 | ||
1700 | 70 | QFile file(path); | 70 | QFile file(path); |
1701 | 71 | if (!file.open(QFile::ReadOnly)) { | 71 | if (!file.open(QFile::ReadOnly)) { |
1703 | 72 | qWarning() << "Cannot open file for reading..."; | 72 | qCWarning(dcNotesStore) << "Cannot open file for reading..."; |
1704 | 73 | return; | 73 | return; |
1705 | 74 | } | 74 | } |
1706 | 75 | QByteArray fileContent = file.readAll(); | 75 | QByteArray fileContent = file.readAll(); |
1707 | @@ -84,7 +84,7 @@ | |||
1708 | 84 | } else if (m_fileName.endsWith(".gif")) { | 84 | } else if (m_fileName.endsWith(".gif")) { |
1709 | 85 | m_type = "image/gif"; | 85 | m_type = "image/gif"; |
1710 | 86 | } else { | 86 | } else { |
1712 | 87 | qWarning() << "cannot determine mime type of file" << m_fileName; | 87 | qCWarning(dcNotesStore) << "cannot determine mime type of file" << m_fileName; |
1713 | 88 | } | 88 | } |
1714 | 89 | 89 | ||
1715 | 90 | m_filePath = NotesStore::instance()->storageLocation() + m_hash + "." + m_fileName.split('.').last(); | 90 | m_filePath = NotesStore::instance()->storageLocation() + m_hash + "." + m_fileName.split('.').last(); |
1716 | @@ -93,7 +93,7 @@ | |||
1717 | 93 | if (!copy.exists()) { | 93 | if (!copy.exists()) { |
1718 | 94 | 94 | ||
1719 | 95 | if (!copy.open(QFile::WriteOnly)) { | 95 | if (!copy.open(QFile::WriteOnly)) { |
1721 | 96 | qWarning() << "error writing file" << m_filePath; | 96 | qCWarning(dcNotesStore) << "error writing file" << m_filePath; |
1722 | 97 | return; | 97 | return; |
1723 | 98 | } | 98 | } |
1724 | 99 | copy.write(fileContent); | 99 | copy.write(fileContent); |
1725 | 100 | 100 | ||
1726 | === modified file 'src/libqtevernote/resourceimageprovider.cpp' | |||
1727 | --- src/libqtevernote/resourceimageprovider.cpp 2015-02-20 22:35:03 +0000 | |||
1728 | +++ src/libqtevernote/resourceimageprovider.cpp 2015-03-06 18:02:44 +0000 | |||
1729 | @@ -1,10 +1,10 @@ | |||
1730 | 1 | #include "resourceimageprovider.h" | 1 | #include "resourceimageprovider.h" |
1731 | 2 | #include "logging.h" | ||
1732 | 2 | 3 | ||
1733 | 3 | #include <notesstore.h> | 4 | #include <notesstore.h> |
1734 | 4 | #include <note.h> | 5 | #include <note.h> |
1735 | 5 | 6 | ||
1736 | 6 | #include <QUrlQuery> | 7 | #include <QUrlQuery> |
1737 | 7 | #include <QDebug> | ||
1738 | 8 | 8 | ||
1739 | 9 | ResourceImageProvider::ResourceImageProvider(): | 9 | ResourceImageProvider::ResourceImageProvider(): |
1740 | 10 | QQuickImageProvider(QQuickImageProvider::Image) | 10 | QQuickImageProvider(QQuickImageProvider::Image) |
1741 | @@ -20,7 +20,7 @@ | |||
1742 | 20 | QString resourceHash = arguments.queryItemValue("hash"); | 20 | QString resourceHash = arguments.queryItemValue("hash"); |
1743 | 21 | Note *note = NotesStore::instance()->note(noteGuid); | 21 | Note *note = NotesStore::instance()->note(noteGuid); |
1744 | 22 | if (!note) { | 22 | if (!note) { |
1746 | 23 | qWarning() << "Unable to find note for resource:" << id; | 23 | qCWarning(dcNotesStore) << "Unable to find note for resource:" << id; |
1747 | 24 | return QImage(); | 24 | return QImage(); |
1748 | 25 | } | 25 | } |
1749 | 26 | 26 | ||
1750 | 27 | 27 | ||
1751 | === modified file 'src/libqtevernote/tag.h' | |||
1752 | --- src/libqtevernote/tag.h 2015-03-04 20:30:55 +0000 | |||
1753 | +++ src/libqtevernote/tag.h 2015-03-06 18:02:44 +0000 | |||
1754 | @@ -23,7 +23,6 @@ | |||
1755 | 23 | 23 | ||
1756 | 24 | #include "utils/enmldocument.h" | 24 | #include "utils/enmldocument.h" |
1757 | 25 | #include "resource.h" | 25 | #include "resource.h" |
1758 | 26 | #include "utils/textformat.h" | ||
1759 | 27 | 26 | ||
1760 | 28 | #include <QObject> | 27 | #include <QObject> |
1761 | 29 | #include <QDateTime> | 28 | #include <QDateTime> |
1762 | 30 | 29 | ||
1763 | === modified file 'src/libqtevernote/tags.cpp' | |||
1764 | --- src/libqtevernote/tags.cpp 2015-03-04 00:23:45 +0000 | |||
1765 | +++ src/libqtevernote/tags.cpp 2015-03-06 18:02:44 +0000 | |||
1766 | @@ -21,8 +21,6 @@ | |||
1767 | 21 | #include "tags.h" | 21 | #include "tags.h" |
1768 | 22 | #include "tag.h" | 22 | #include "tag.h" |
1769 | 23 | 23 | ||
1770 | 24 | #include <QDebug> | ||
1771 | 25 | |||
1772 | 26 | Tags::Tags(QObject *parent) : | 24 | Tags::Tags(QObject *parent) : |
1773 | 27 | QAbstractListModel(parent) | 25 | QAbstractListModel(parent) |
1774 | 28 | { | 26 | { |
1775 | 29 | 27 | ||
1776 | === modified file 'src/libqtevernote/userstore.cpp' | |||
1777 | --- src/libqtevernote/userstore.cpp 2014-12-09 18:50:55 +0000 | |||
1778 | +++ src/libqtevernote/userstore.cpp 2015-03-06 18:02:44 +0000 | |||
1779 | @@ -21,6 +21,7 @@ | |||
1780 | 21 | #include "userstore.h" | 21 | #include "userstore.h" |
1781 | 22 | #include "evernoteconnection.h" | 22 | #include "evernoteconnection.h" |
1782 | 23 | #include "jobs/fetchusernamejob.h" | 23 | #include "jobs/fetchusernamejob.h" |
1783 | 24 | #include "logging.h" | ||
1784 | 24 | 25 | ||
1785 | 25 | // Evernote sdk | 26 | // Evernote sdk |
1786 | 26 | #include <UserStore.h> | 27 | #include <UserStore.h> |
1787 | @@ -34,8 +35,6 @@ | |||
1788 | 34 | #include <transport/TSSLSocket.h> | 35 | #include <transport/TSSLSocket.h> |
1789 | 35 | #include <Thrift.h> | 36 | #include <Thrift.h> |
1790 | 36 | 37 | ||
1791 | 37 | #include <QDebug> | ||
1792 | 38 | |||
1793 | 39 | using namespace apache::thrift; | 38 | using namespace apache::thrift; |
1794 | 40 | using namespace apache::thrift::protocol; | 39 | using namespace apache::thrift::protocol; |
1795 | 41 | using namespace apache::thrift::transport; | 40 | using namespace apache::thrift::transport; |
1796 | @@ -78,7 +77,7 @@ | |||
1797 | 78 | void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result) | 77 | void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result) |
1798 | 79 | { | 78 | { |
1799 | 80 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | 79 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { |
1801 | 81 | qWarning() << "Error fetching username:" << errorMessage; | 80 | qCWarning(dcConnection) << "Error fetching username:" << errorMessage; |
1802 | 82 | return; | 81 | return; |
1803 | 83 | } | 82 | } |
1804 | 84 | 83 | ||
1805 | 85 | 84 | ||
1806 | === modified file 'src/libqtevernote/utils/enmldocument.cpp' | |||
1807 | --- src/libqtevernote/utils/enmldocument.cpp 2015-03-05 18:23:25 +0000 | |||
1808 | +++ src/libqtevernote/utils/enmldocument.cpp 2015-03-06 18:02:44 +0000 | |||
1809 | @@ -21,6 +21,7 @@ | |||
1810 | 21 | #include "enmldocument.h" | 21 | #include "enmldocument.h" |
1811 | 22 | #include "notesstore.h" | 22 | #include "notesstore.h" |
1812 | 23 | #include "note.h" | 23 | #include "note.h" |
1813 | 24 | #include "logging.h" | ||
1814 | 24 | 25 | ||
1815 | 25 | #include <QXmlStreamReader> | 26 | #include <QXmlStreamReader> |
1816 | 26 | #include <QXmlStreamWriter> | 27 | #include <QXmlStreamWriter> |
1817 | @@ -28,7 +29,6 @@ | |||
1818 | 28 | #include <QUrl> | 29 | #include <QUrl> |
1819 | 29 | #include <QUrlQuery> | 30 | #include <QUrlQuery> |
1820 | 30 | #include <QStandardPaths> | 31 | #include <QStandardPaths> |
1821 | 31 | #include <QDebug> | ||
1822 | 32 | 32 | ||
1823 | 33 | // ENML spec: http://xml.evernote.com/pub/enml2.dtd | 33 | // ENML spec: http://xml.evernote.com/pub/enml2.dtd |
1824 | 34 | // QML supported HTML subset: http://qt-project.org/doc/qt-5.0/qtgui/richtext-html-subset.html | 34 | // QML supported HTML subset: http://qt-project.org/doc/qt-5.0/qtgui/richtext-html-subset.html |
1825 | @@ -203,7 +203,7 @@ | |||
1826 | 203 | } | 203 | } |
1827 | 204 | } | 204 | } |
1828 | 205 | } else { | 205 | } else { |
1830 | 206 | qDebug() << "unknown mediatype" << mediaType; | 206 | qCWarning(dcEnml) << "Unknown mediatype" << mediaType; |
1831 | 207 | if (type == TypeRichText) { | 207 | if (type == TypeRichText) { |
1832 | 208 | writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash)); | 208 | writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash)); |
1833 | 209 | } else if (type == TypeHtml) { | 209 | } else if (type == TypeHtml) { |
1834 | @@ -276,7 +276,7 @@ | |||
1835 | 276 | 276 | ||
1836 | 277 | writer.writeEndElement(); | 277 | writer.writeEndElement(); |
1837 | 278 | writer.writeEndDocument(); | 278 | writer.writeEndDocument(); |
1839 | 279 | qDebug() << "converted to html" << html; | 279 | qCDebug(dcEnml) << QString("Converted to %1:").arg(type == TypeHtml ? "HTML" : "RichText") << html; |
1840 | 280 | return html; | 280 | return html; |
1841 | 281 | } | 281 | } |
1842 | 282 | 282 | ||
1843 | 283 | 283 | ||
1844 | === modified file 'src/libqtevernote/utils/organizeradapter.cpp' | |||
1845 | --- src/libqtevernote/utils/organizeradapter.cpp 2015-02-28 02:48:16 +0000 | |||
1846 | +++ src/libqtevernote/utils/organizeradapter.cpp 2015-03-06 18:02:44 +0000 | |||
1847 | @@ -1,7 +1,7 @@ | |||
1848 | 1 | #include "organizeradapter.h" | 1 | #include "organizeradapter.h" |
1849 | 2 | #include "notesstore.h" | 2 | #include "notesstore.h" |
1850 | 3 | #include "logging.h" | ||
1851 | 3 | 4 | ||
1852 | 4 | #include <QDebug> | ||
1853 | 5 | #include <QOrganizerItemVisualReminder> | 5 | #include <QOrganizerItemVisualReminder> |
1854 | 6 | #include <QOrganizerItemAudibleReminder> | 6 | #include <QOrganizerItemAudibleReminder> |
1855 | 7 | #include <QOrganizerItemSaveRequest> | 7 | #include <QOrganizerItemSaveRequest> |
1856 | @@ -47,12 +47,12 @@ | |||
1857 | 47 | // EDS requires extra metadata to be set | 47 | // EDS requires extra metadata to be set |
1858 | 48 | m_collection.setExtendedMetaData("collection-type", "Task List"); | 48 | m_collection.setExtendedMetaData("collection-type", "Task List"); |
1859 | 49 | if (!m_manager->saveCollection(&m_collection)) { | 49 | if (!m_manager->saveCollection(&m_collection)) { |
1861 | 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!"; |
1862 | 51 | m_collection = m_manager->defaultCollection(); | 51 | m_collection = m_manager->defaultCollection(); |
1863 | 52 | } | 52 | } |
1864 | 53 | } | 53 | } |
1865 | 54 | 54 | ||
1867 | 55 | qDebug() << "have collection" << m_collection.id().toString(); | 55 | qCDebug(dcOrganizer) << "Have Organizer collection" << m_collection.id().toString(); |
1868 | 56 | } | 56 | } |
1869 | 57 | 57 | ||
1870 | 58 | void OrganizerAdapter::startSync() | 58 | void OrganizerAdapter::startSync() |
1871 | @@ -133,7 +133,7 @@ | |||
1872 | 133 | } | 133 | } |
1873 | 134 | 134 | ||
1874 | 135 | if (state == QOrganizerAbstractRequest::CanceledState) { | 135 | if (state == QOrganizerAbstractRequest::CanceledState) { |
1876 | 136 | qWarning() << "Error syncing reminders. Could not read organizer items."; | 136 | qCWarning(dcOrganizer) << "Error syncing reminders. Could not read organizer items."; |
1877 | 137 | m_busy = false; | 137 | m_busy = false; |
1878 | 138 | request->deleteLater(); | 138 | request->deleteLater(); |
1879 | 139 | return; | 139 | return; |
1880 | 140 | 140 | ||
1881 | === removed file 'src/libqtevernote/utils/textformat.cpp' | |||
1882 | --- src/libqtevernote/utils/textformat.cpp 2014-01-29 16:04:00 +0000 | |||
1883 | +++ src/libqtevernote/utils/textformat.cpp 1970-01-01 00:00:00 +0000 | |||
1884 | @@ -1,25 +0,0 @@ | |||
1885 | 1 | /* | ||
1886 | 2 | * Copyright: 2013 Canonical, Ltd | ||
1887 | 3 | * | ||
1888 | 4 | * This file is part of reminders-app | ||
1889 | 5 | * | ||
1890 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
1891 | 7 | * it under the terms of the GNU General Public License as published by | ||
1892 | 8 | * the Free Software Foundation; version 3. | ||
1893 | 9 | * | ||
1894 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
1895 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1896 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1897 | 13 | * GNU General Public License for more details. | ||
1898 | 14 | * | ||
1899 | 15 | * You should have received a copy of the GNU General Public License | ||
1900 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1901 | 17 | * | ||
1902 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
1903 | 19 | */ | ||
1904 | 20 | |||
1905 | 21 | #include "textformat.h" | ||
1906 | 22 | |||
1907 | 23 | TextFormat::TextFormat(QObject *parent): QObject(parent) | ||
1908 | 24 | { | ||
1909 | 25 | } | ||
1910 | 26 | 0 | ||
1911 | === removed file 'src/libqtevernote/utils/textformat.h' | |||
1912 | --- src/libqtevernote/utils/textformat.h 2014-01-29 18:27:11 +0000 | |||
1913 | +++ src/libqtevernote/utils/textformat.h 1970-01-01 00:00:00 +0000 | |||
1914 | @@ -1,43 +0,0 @@ | |||
1915 | 1 | /* | ||
1916 | 2 | * Copyright: 2013 Canonical, Ltd | ||
1917 | 3 | * | ||
1918 | 4 | * This file is part of reminders-app | ||
1919 | 5 | * | ||
1920 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
1921 | 7 | * it under the terms of the GNU General Public License as published by | ||
1922 | 8 | * the Free Software Foundation; version 3. | ||
1923 | 9 | * | ||
1924 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
1925 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1926 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1927 | 13 | * GNU General Public License for more details. | ||
1928 | 14 | * | ||
1929 | 15 | * You should have received a copy of the GNU General Public License | ||
1930 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1931 | 17 | * | ||
1932 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
1933 | 19 | */ | ||
1934 | 20 | |||
1935 | 21 | #ifndef TEXTFORMAT_H | ||
1936 | 22 | #define TEXTFORMAT_H | ||
1937 | 23 | |||
1938 | 24 | #include <QObject> | ||
1939 | 25 | |||
1940 | 26 | class TextFormat: public QObject | ||
1941 | 27 | { | ||
1942 | 28 | Q_OBJECT | ||
1943 | 29 | Q_ENUMS(Format) | ||
1944 | 30 | public: | ||
1945 | 31 | enum Format { | ||
1946 | 32 | Bold, | ||
1947 | 33 | Italic, | ||
1948 | 34 | Underlined | ||
1949 | 35 | }; | ||
1950 | 36 | Q_DECLARE_FLAGS(Formats, Format) | ||
1951 | 37 | |||
1952 | 38 | TextFormat(QObject *parent = 0); | ||
1953 | 39 | }; | ||
1954 | 40 | Q_DECLARE_OPERATORS_FOR_FLAGS(TextFormat::Formats) | ||
1955 | 41 | Q_DECLARE_METATYPE(TextFormat::Format) | ||
1956 | 42 | |||
1957 | 43 | #endif | ||
1958 | 44 | 0 | ||
1959 | === modified file 'src/plugin/Evernote/evernoteplugin.cpp' | |||
1960 | --- src/plugin/Evernote/evernoteplugin.cpp 2014-10-09 00:08:52 +0000 | |||
1961 | +++ src/plugin/Evernote/evernoteplugin.cpp 2015-03-06 18:02:44 +0000 | |||
1962 | @@ -32,8 +32,6 @@ | |||
1963 | 32 | #include "tag.h" | 32 | #include "tag.h" |
1964 | 33 | #include "resourceimageprovider.h" | 33 | #include "resourceimageprovider.h" |
1965 | 34 | 34 | ||
1966 | 35 | #include "utils/textformat.h" | ||
1967 | 36 | |||
1968 | 37 | #include <QtQml> | 35 | #include <QtQml> |
1969 | 38 | 36 | ||
1970 | 39 | static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) | 37 | static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) |
1971 | @@ -64,8 +62,6 @@ | |||
1972 | 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."); |
1973 | 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."); |
1974 | 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."); |
1975 | 67 | |||
1976 | 68 | qmlRegisterUncreatableType<TextFormat>(uri, 0, 1, "TextFormat", "TextFormat is not creatable. It's just here to export enums to QML"); | ||
1977 | 69 | } | 65 | } |
1978 | 70 | 66 | ||
1979 | 71 | void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri) | 67 | void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
PASSED: Continuous integration, rev:375 91.189. 93.70:8080/ job/reminders- app-ci/ 699/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2260 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 2260/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/reminders- app-utopic- amd64-ci/ 301 91.189. 93.70:8080/ job/reminders- app-vivid- amd64-ci/ 120
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 699/rebuild
http://