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