ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #00428
[Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
Michael Zanetti has proposed merging lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app.
Commit message:
clean up debug prints
Requested reviews:
Ubuntu Reminders app developers (reminders-app-dev)
For more details, see:
https://code.launchpad.net/~mzanetti/reminders-app/cleanup-debug/+merge/252050
--
Your team Ubuntu Reminders app developers is requested to review the proposed merge of lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app.
=== modified file 'src/app/main.cpp'
--- src/app/main.cpp 2015-02-24 18:55:55 +0000
+++ src/app/main.cpp 2015-03-06 00:43:39 +0000
@@ -30,6 +30,22 @@
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDebug>
+#include <QLoggingCategory>
+
+QHash<QString, bool> s_loggingFilters;
+QLoggingCategory dcApplication("Application");
+
+void loggingCategoryFilter(QLoggingCategory *category)
+{
+ if (s_loggingFilters.contains(category->categoryName())) {
+ bool debugEnabled = s_loggingFilters.value(category->categoryName());
+ category->setEnabled(QtDebugMsg, debugEnabled);
+ category->setEnabled(QtWarningMsg, debugEnabled || s_loggingFilters.value("Warnings"));
+ } else {
+ category->setEnabled(QtDebugMsg, false);
+ category->setEnabled(QtWarningMsg, s_loggingFilters.value("qml") || s_loggingFilters.value("Warnings"));
+ }
+}
int main(int argc, char *argv[])
{
@@ -37,6 +53,16 @@
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
+ s_loggingFilters.insert("Warnings", true);
+ s_loggingFilters.insert("Application", true);
+ s_loggingFilters.insert("NotesStore", true);
+ s_loggingFilters.insert("JobQueue", true);
+ s_loggingFilters.insert("Sync", true);
+ s_loggingFilters.insert("Connection", true);
+ s_loggingFilters.insert("Enml", false);
+ s_loggingFilters.insert("Organizer", false);
+ s_loggingFilters.insert("qml", true);
+
// Set up import paths
QStringList importPathList = view.engine()->importPathList();
// Prepend the location of the plugin in the build dir,
@@ -54,6 +80,12 @@
cmdLineParser.addOption(importPathOption);
QCommandLineOption sandboxOption(QStringList() << "s" << "sandbox", "Use sandbox.evernote.com instead of www.evernote.com.");
cmdLineParser.addOption(sandboxOption);
+ 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:");
+ foreach (const QString &filterName, s_loggingFilters.keys()) {
+ debugDescription += "\n" + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
+ }
+ QCommandLineOption debugOption(QStringList() << "d" << "debug", debugDescription, "debugAreas");
+ cmdLineParser.addOption(debugOption);
QCommandLineOption testabilityOption("testability", "Load the testability driver.");
cmdLineParser.addOption(testabilityOption);
cmdLineParser.addPositionalArgument("uri", "Uri to start the application in a specific mode. E.g. evernote://newnote to directly create and edit a new note.");
@@ -61,6 +93,15 @@
cmdLineParser.process(a);
+ foreach (QString debugArea, cmdLineParser.values(debugOption)) {
+ bool enable = !debugArea.startsWith("No");
+ debugArea.remove(QRegExp("^No"));
+ if (s_loggingFilters.contains(debugArea)) {
+ s_loggingFilters[debugArea] = enable;
+ }
+ }
+ QLoggingCategory::installFilter(loggingCategoryFilter);
+
foreach (QString addedPath, cmdLineParser.values(importPathOption)) {
if (addedPath == "." || addedPath.startsWith("./")) {
addedPath = addedPath.right(addedPath.length() - 1);
@@ -86,20 +127,20 @@
if (cmdLineParser.isSet(sandboxOption)) {
view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(true));
- qDebug() << "Running against the sandbox server";
+ qCDebug(dcApplication) << "Running against the sandbox server";
} else {
view.engine()->rootContext()->setContextProperty("useSandbox", QVariant(false));
- qDebug() << "Running against the production server";
+ qCDebug(dcApplication) << "Running against the production server";
}
view.engine()->rootContext()->setContextProperty("tablet", QVariant(false));
view.engine()->rootContext()->setContextProperty("phone", QVariant(false));
if (cmdLineParser.isSet(tabletFactorOption)) {
- qDebug() << "running in tablet mode";
+ qCDebug(dcApplication) << "Running in tablet mode";
view.engine()->rootContext()->setContextProperty("tablet", QVariant(true));
} else if (cmdLineParser.isSet(phoneFactorOption)){
- qDebug() << "running in phone mode";
+ qCDebug(dcApplication) << "Running in phone mode";
view.engine()->rootContext()->setContextProperty("phone", QVariant(true));
} else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") {
// Default to tablet size on X11
@@ -140,7 +181,7 @@
// So if you want to change it, make sure to find all the places where it is set, not just here :D
QCoreApplication::setApplicationName("com.ubuntu.reminders");
- qDebug() << "using main qml file from:" << qmlfile;
+ qCDebug(dcApplication) << "Using main qml file from:" << qmlfile;
view.setSource(QUrl::fromLocalFile(qmlfile));
view.show();
=== modified file 'src/libqtevernote/CMakeLists.txt'
--- src/libqtevernote/CMakeLists.txt 2014-12-06 22:35:01 +0000
+++ src/libqtevernote/CMakeLists.txt 2015-03-06 00:43:39 +0000
@@ -14,6 +14,7 @@
notebook.cpp
tag.cpp
tags.cpp
+ logging.cpp
jobs/fetchnotesjob.cpp
jobs/fetchnotebooksjob.cpp
jobs/fetchnotejob.cpp
@@ -33,7 +34,6 @@
jobs/savetagjob.cpp
resourceimageprovider.cpp
utils/enmldocument.cpp
- utils/textformat.cpp
utils/organizeradapter.cpp
)
=== modified file 'src/libqtevernote/evernoteconnection.cpp'
--- src/libqtevernote/evernoteconnection.cpp 2015-02-27 21:32:29 +0000
+++ src/libqtevernote/evernoteconnection.cpp 2015-03-06 00:43:39 +0000
@@ -21,6 +21,7 @@
#include "evernoteconnection.h"
#include "jobs/evernotejob.h"
+#include "logging.h"
// Thrift
#include <arpa/inet.h> // seems thrift forgot this one
@@ -79,11 +80,11 @@
if (m_useSSL) {
boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);
- qDebug() << "created UserStore SSL socket to host " << m_hostname;
+ qCDebug(dcConnection) << "created UserStore SSL socket to host " << m_hostname;
} else {
// Create a non-secure socket
socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));
- qDebug() << "created insecure UserStore socket to host " << m_hostname;
+ qCDebug(dcConnection) << "created insecure UserStore socket to host " << m_hostname;
}
// setup UserStore client
@@ -108,11 +109,11 @@
if (m_useSSL) {
boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
socket = sslSocketFactory->createSocket(m_hostname.toStdString(), 443);
- qDebug() << "created NotesStore SSL socket to host " << m_hostname;
+ qCDebug(dcConnection) << "created NotesStore SSL socket to host " << m_hostname;
} else {
// Create a non-secure socket
socket = boost::shared_ptr<TSocket> (new TSocket(m_hostname.toStdString(), 80));
- qDebug() << "created insecure NotesStore socket to host " << m_hostname;
+ qCDebug(dcConnection) << "created insecure NotesStore socket to host " << m_hostname;
}
// setup NotesStore client
@@ -147,9 +148,9 @@
void EvernoteConnection::disconnectFromEvernote()
{
- qDebug() << "[Connection] Disconnecting from Evernote.";
+ qCDebug(dcConnection) << "Disconnecting from Evernote.";
if (!isConnected()) {
- qWarning() << "Not connected. Can't disconnect.";
+ qCWarning(dcConnection()) << "Not connected. Can't disconnect.";
return;
}
@@ -198,38 +199,38 @@
void EvernoteConnection::connectToEvernote()
{
if (isConnected()) {
- qWarning() << "Already connected.";
+ qCWarning(dcConnection) << "Already connected.";
return;
}
- qDebug() << "[Connection] Connecting to Evernote:" << m_hostname;
+ qCDebug(dcConnection) << "Connecting to Evernote:" << m_hostname;
m_errorMessage.clear();
emit errorChanged();
if (m_token.isEmpty()) {
- qWarning() << "[Connection] Can't connect to Evernote. No token set.";
+ qCWarning(dcConnection) << "Can't connect to Evernote. No token set.";
return;
}
if (m_hostname.isEmpty()) {
- qWarning() << "[Connection] Can't connect to Evernote. No hostname set.";
+ qCWarning(dcConnection) << "Can't connect to Evernote. No hostname set.";
}
setupUserStore();
bool ok = connectUserStore();
if (!ok) {
- qWarning() << "[Connection] Error connecting User Store. Cannot continue.";
+ qCWarning(dcConnection) << "Error connecting User Store. Cannot continue.";
return;
}
setupNotesStore();
ok = connectNotesStore();
if (!ok) {
- qWarning() << "[Connection] Error connecting Notes Store. Cannot continue.";
+ qCWarning(dcConnection) << "Error connecting Notes Store. Cannot continue.";
return;
}
- qDebug() << "[Connection] Connected!";
+ qCDebug(dcConnection) << "Connected!";
emit isConnectedChanged();
}
@@ -242,14 +243,14 @@
try {
m_userStoreHttpClient->open();
- qDebug() << "UserStoreClient socket opened.";
+ qCDebug(dcConnection) << "UserStoreClient socket opened.";
} catch (const TTransportException & e) {
- qWarning() << "Failed to open connection:" << e.what() << e.getType();
+ qCWarning(dcConnection) << "Failed to open connection:" << e.what() << e.getType();
m_errorMessage = gettext("Offline mode");
emit errorChanged();
return false;
} catch (const TException & e) {
- qWarning() << "Generic Thrift exception when opening the connection:" << e.what();
+ qCWarning(dcConnection) << "Generic Thrift exception when opening the connection:" << e.what();
m_errorMessage = gettext("Unknown error connecting to Evernote.");
emit errorChanged();
return false;
@@ -262,28 +263,28 @@
constants.EDAM_VERSION_MINOR);
if (!versionOk) {
- qWarning() << "Server version mismatch! This application should be updated!";
+ qCWarning(dcConnection) << "Server version mismatch! This application should be updated!";
m_errorMessage = QString(gettext("Error connecting to Evernote: Server version does not match app version. Please update the application."));
emit errorChanged();
return false;
}
} catch (const evernote::edam::EDAMUserException e) {
- qWarning() << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode;
+ qCWarning(dcConnection) << "Error fetching server version (EDAMUserException):" << e.what() << e.errorCode;
m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);
emit errorChanged();
return false;
} catch (const evernote::edam::EDAMSystemException e) {
- qWarning() << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode;
+ qCWarning(dcConnection) << "Error fetching server version: (EDAMSystemException):" << e.what() << e.errorCode;
m_errorMessage = QString(gettext("Error connecting to Evernote: Error code %1")).arg(e.errorCode);
emit errorChanged();
return false;
} catch (const TTransportException & e) {
- qWarning() << "Failed to fetch server version:" << e.what();
+ qCWarning(dcConnection) << "Failed to fetch server version:" << e.what();
m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download version information from server."));
emit errorChanged();
return false;
} catch (const TException & e) {
- qWarning() << "Generic Thrift exception when fetching server version:" << e.what();
+ qCWarning(dcConnection) << "Generic Thrift exception when fetching server version:" << e.what();
m_errorMessage = QString(gettext("Unknown error connecting to Evernote"));
emit errorChanged();
return false;
@@ -291,24 +292,24 @@
try {
std::string notesStoreUrl;
- qDebug() << "getting ntoe store url with token" << m_token;
+ qCDebug(dcConnection) << "getting ntoe store url with token" << m_token;
m_userstoreClient->getNoteStoreUrl(notesStoreUrl, m_token.toStdString());
m_notesStorePath = QUrl(QString::fromStdString(notesStoreUrl)).path();
if (m_notesStorePath.isEmpty()) {
- qWarning() << "Failed to fetch notesstore path from server. Fetching notes will not work.";
+ qCWarning(dcConnection) << "Failed to fetch notesstore path from server. Fetching notes will not work.";
m_errorMessage = QString(gettext("Error connecting to Evernote: Cannot download server information."));
emit errorChanged();
return false;
}
} catch (const TTransportException & e) {
- qWarning() << "Failed to fetch notestore path:" << e.what();
+ qCWarning(dcConnection) << "Failed to fetch notestore path:" << e.what();
m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure when downloading server information."));
emit errorChanged();
return false;
} catch (const TException & e) {
- qWarning() << "Generic Thrift exception when fetching notestore path:" << e.what();
+ qCWarning(dcConnection) << "Generic Thrift exception when fetching notestore path:" << e.what();
m_errorMessage = gettext("Unknown error connecting to Evernote");
emit errorChanged();
return false;
@@ -325,15 +326,15 @@
try {
m_notesStoreHttpClient->open();
- qDebug() << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen();
+ qCDebug(dcConnection) << "NotesStoreClient socket opened." << m_notesStoreHttpClient->isOpen();
return true;
} catch (const TTransportException & e) {
- qWarning() << "Failed to open connection:" << e.what();
+ qCWarning(dcConnection) << "Failed to open connection:" << e.what();
m_errorMessage = QString(gettext("Error connecting to Evernote: Connection failure"));
emit errorChanged();
} catch (const TException & e) {
- qWarning() << "Generic Thrift exception when opening the NotesStore connection:" << e.what();
+ qCWarning(dcConnection) << "Generic Thrift exception when opening the NotesStore connection:" << e.what();
m_errorMessage = QString(gettext("Unknown Error connecting to Evernote"));
emit errorChanged();
}
@@ -354,7 +355,7 @@
void EvernoteConnection::enqueue(EvernoteJob *job)
{
if (!isConnected()) {
- qWarning() << "[JobQueue] Not connected to evernote. Can't enqueue job.";
+ qCWarning(dcJobQueue) << "Not connected to evernote. Can't enqueue job.";
job->emitJobDone(ErrorCodeConnectionLost, gettext("Disconnected from Evernote."));
job->deleteLater();
return;
@@ -364,9 +365,9 @@
job->attachToDuplicate(duplicate);
connect(duplicate, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);
// reprioritze the repeated request
- qDebug() << "[JobQueue] Duplicate job already queued:" << job->toString();
+ qCDebug(dcJobQueue) << "Duplicate job already queued:" << job->toString();
if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {
- qDebug() << "[JobQueue] Reprioritising duplicate job:" << job->toString();
+ qCDebug(dcJobQueue) << "Reprioritising duplicate job:" << job->toString();
duplicate->setJobPriority(job->jobPriority());
m_jobQueue.prepend(m_jobQueue.takeAt(m_jobQueue.indexOf(duplicate)));
}
@@ -374,10 +375,10 @@
connect(job, &EvernoteJob::finished, job, &EvernoteJob::deleteLater);
connect(job, &EvernoteJob::finished, this, &EvernoteConnection::startNextJob);
if (job->jobPriority() == EvernoteJob::JobPriorityHigh) {
- qDebug() << "[JobQueue] Prepending high priority job request:" << job->toString();
+ qCDebug(dcJobQueue) << "Prepending high priority job request:" << job->toString();
m_jobQueue.prepend(job);
} else {
- qDebug() << "[JobQueue] Appending low priority job request:" << job->toString();
+ qCDebug(dcJobQueue) << "Appending low priority job request:" << job->toString();
m_jobQueue.append(job);
}
startJobQueue();
@@ -410,13 +411,13 @@
}
m_currentJob = m_jobQueue.takeFirst();
- qDebug() << "[JobQueue] Starting job:" << m_currentJob->toString();
+ qCDebug(dcJobQueue) << "Starting job:" << m_currentJob->toString();
m_currentJob->start();
}
void EvernoteConnection::startNextJob()
{
- qDebug() << "[JobQueue] Job done:" << m_currentJob->toString();
+ qCDebug(dcJobQueue) << "Job done:" << m_currentJob->toString();
m_currentJob = 0;
startJobQueue();
}
=== modified file 'src/libqtevernote/jobs/createnotejob.cpp'
--- src/libqtevernote/jobs/createnotejob.cpp 2014-12-14 02:40:47 +0000
+++ src/libqtevernote/jobs/createnotejob.cpp 2015-03-06 00:43:39 +0000
@@ -46,7 +46,6 @@
void CreateNoteJob::startJob()
{
- qDebug() << "creating note:" << m_note->guid() << m_note->enmlContent() << m_note->notebookGuid() << m_note->title();
evernote::edam::Note input;
input.updateSequenceNum = m_note->updateSequenceNumber();
input.__isset.updateSequenceNum = true;
=== modified file 'src/libqtevernote/jobs/evernotejob.cpp'
--- src/libqtevernote/jobs/evernotejob.cpp 2015-02-27 21:32:29 +0000
+++ src/libqtevernote/jobs/evernotejob.cpp 2015-03-06 00:43:39 +0000
@@ -20,6 +20,7 @@
#include "evernotejob.h"
#include "evernoteconnection.h"
+#include "logging.h"
// Thrift
#include <arpa/inet.h> // seems thrift forgot this one
@@ -33,8 +34,6 @@
#include <libintl.h>
-#include <QDebug>
-
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
@@ -63,7 +62,7 @@
void EvernoteJob::run()
{
if (!EvernoteConnection::instance()->isConnected()) {
- qWarning() << "EvernoteConnection is not connected. (" << this->metaObject()->className() << ")";
+ qCWarning(dcJobQueue) << "EvernoteConnection is not connected. (" << toString() << ")";
emitJobDone(EvernoteConnection::ErrorCodeUserException, QStringLiteral("Not connected."));
return;
}
@@ -76,9 +75,9 @@
startJob();
emitJobDone(EvernoteConnection::ErrorCodeNoError, QString());
} catch (const TTransportException & e) {
- qWarning() << "TTransportException in" << metaObject()->className() << e.what();
+ qCWarning(dcJobQueue) << "TTransportException in" << metaObject()->className() << e.what();
if (tryCount < 2) {
- qWarning() << "[JobQueue] Resetting connection...";
+ qCWarning(dcJobQueue) << "Resetting connection...";
try {
resetConnection();
} catch(...) {}
@@ -87,9 +86,9 @@
emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what());
}
} catch (const TApplicationException &e) {
- qWarning() << "TApplicationException in " << metaObject()->className() << e.what();
+ qCWarning(dcJobQueue) << "TApplicationException in " << metaObject()->className() << e.what();
if (tryCount < 2) {
- qWarning() << "Resetting connection...";
+ qCWarning(dcJobQueue) << "Resetting connection...";
try {
resetConnection();
} catch(...) {}
@@ -159,10 +158,10 @@
break;
}
message = message.arg(QString::fromStdString(e.parameter));
- qWarning() << metaObject()->className() << "EDAMUserException:" << message;
+ qCWarning(dcJobQueue) << metaObject()->className() << "EDAMUserException:" << message;
emitJobDone(EvernoteConnection::ErrorCodeUserException, message);
} catch (const evernote::edam::EDAMSystemException &e) {
- qWarning() << "EDAMSystemException in" << metaObject()->className() << e.what() << e.errorCode << QString::fromStdString(e.message);
+ qCWarning(dcJobQueue) << "EDAMSystemException in" << metaObject()->className() << e.what() << e.errorCode << QString::fromStdString(e.message);
QString message;
EvernoteConnection::ErrorCode errorCode;
switch (e.errorCode) {
=== modified file 'src/libqtevernote/jobs/savenotejob.cpp'
--- src/libqtevernote/jobs/savenotejob.cpp 2015-02-27 22:15:02 +0000
+++ src/libqtevernote/jobs/savenotejob.cpp 2015-03-06 00:43:39 +0000
@@ -86,7 +86,6 @@
note.attributes.reminderDoneTime = m_note->reminderDoneTime().toMSecsSinceEpoch();
note.attributes.__isset.reminderDoneTime = true;
- qDebug() << "*** needs content sync" << m_note->needsContentSync();
if (m_note->needsContentSync()) {
note.content = m_note->enmlContent().toStdString();
note.__isset.content = true;
=== added file 'src/libqtevernote/logging.cpp'
--- src/libqtevernote/logging.cpp 1970-01-01 00:00:00 +0000
+++ src/libqtevernote/logging.cpp 2015-03-06 00:43:39 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright: 2015 Canonical, Ltd
+ *
+ * This file is part of reminders
+ *
+ * reminders is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * reminders is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Michael Zanetti <michael.zanetti@xxxxxxxxxxxxx>
+ * Riccardo Padovani <rpadovani@xxxxxxxxxx>
+ */
+
+#include "logging.h"
+
+#include <QLoggingCategory>
+
+Q_LOGGING_CATEGORY(dcNotesStore, "NotesStore")
+Q_LOGGING_CATEGORY(dcJobQueue,"JobQueue")
+Q_LOGGING_CATEGORY(dcConnection,"Connection")
+Q_LOGGING_CATEGORY(dcSync,"Sync")
+Q_LOGGING_CATEGORY(dcStorage,"Storage")
+Q_LOGGING_CATEGORY(dcEnml,"Enml")
+Q_LOGGING_CATEGORY(dcOrganizer,"Organizer")
=== added file 'src/libqtevernote/logging.h'
--- src/libqtevernote/logging.h 1970-01-01 00:00:00 +0000
+++ src/libqtevernote/logging.h 2015-03-06 00:43:39 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright: 2015 Canonical, Ltd
+ *
+ * This file is part of reminders
+ *
+ * reminders is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * reminders is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Michael Zanetti <michael.zanetti@xxxxxxxxxxxxx>
+ * Riccardo Padovani <rpadovani@xxxxxxxxxx>
+ */
+
+#ifndef LOGGING_H
+#define LOGGING_H
+
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(dcNotesStore)
+Q_DECLARE_LOGGING_CATEGORY(dcJobQueue)
+Q_DECLARE_LOGGING_CATEGORY(dcConnection)
+Q_DECLARE_LOGGING_CATEGORY(dcSync)
+Q_DECLARE_LOGGING_CATEGORY(dcEnml)
+Q_DECLARE_LOGGING_CATEGORY(dcOrganizer)
+
+#endif
=== modified file 'src/libqtevernote/note.cpp'
--- src/libqtevernote/note.cpp 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/note.cpp 2015-03-06 00:43:39 +0000
@@ -21,6 +21,7 @@
#include "note.h"
#include "notesstore.h"
+#include "logging.h"
#include <libintl.h>
@@ -71,15 +72,13 @@
infoFile.endGroup();
} else {
// uh oh... have a resource description without file... reset sequence number to indicate we need a sync
- qWarning() << "Have a resource description but no resource file for it";
+ qCWarning(dcNotesStore) << "Have a resource description but no resource file for it";
}
}
infoFile.endGroup();
connect(NotesStore::instance(), &NotesStore::notebookGuidChanged, this, &Note::slotNotebookGuidChanged);
connect(NotesStore::instance(), &NotesStore::tagGuidChanged, this, &Note::slotTagGuidChanged);
-
- qDebug() << "Note created:" << m_guid << m_title << m_tagline << m_content.enml();
}
Note::~Note()
@@ -122,7 +121,6 @@
m_guid = guid;
QString newCacheFileName = NotesStore::instance()->storageLocation() + "note-" + guid + ".enml";
if (m_cacheFile.exists()) {
- qDebug() << "renaming cachefile from" << m_cacheFile.fileName() << "to" << newCacheFileName;
m_cacheFile.rename(newCacheFileName);
} else {
m_cacheFile.setFileName(newCacheFileName);
@@ -266,9 +264,7 @@
QString Note::htmlContent() const
{
- qDebug() << "html content asked;";
load();
- qDebug() << "returning" << m_content.toHtml(m_guid);
return m_content.toHtml(m_guid);
}
@@ -430,9 +426,7 @@
void Note::setDeleted(bool deleted)
{
- qDebug() << "note" << this << "isDelted:" << m_deleted << "setting to" << deleted;
if (m_deleted != deleted) {
- qDebug() << "setting m_deleted to to" << deleted;
m_deleted = deleted;
emit deletedChanged();
}
@@ -518,7 +512,6 @@
return m_resources.value(hash);
}
- qDebug() << "adding resource" << fileName << type;
Resource *resource = new Resource(data, hash, fileName, type, this);
m_resources.insert(hash, resource);
emit resourcesChanged();
@@ -544,7 +537,7 @@
{
QFile importedFile(fileName.path());
if (!importedFile.exists()) {
- qWarning() << "File doesn't exist. Cannot attach.";
+ qCWarning(dcNotesStore) << "File doesn't exist. Cannot attach.";
return;
}
@@ -562,11 +555,6 @@
m_needsContentSync = true;
}
-void Note::format(int startPos, int endPos, TextFormat::Format format)
-{
- qDebug() << "Should format from" << startPos << "to" << endPos << "with format:" << format;
-}
-
void Note::addTag(const QString &tagGuid)
{
NotesStore::instance()->tagNote(m_guid, tagGuid);
@@ -687,9 +675,9 @@
m_content.setEnml(QString::fromUtf8(m_cacheFile.readAll()).trimmed());
m_tagline = m_content.toPlaintext().left(100);
m_cacheFile.close();
- qDebug() << "[Storage] Loaded note from storage:" << m_guid;
+ qCDebug(dcNotesStore) << "Loaded note from storage:" << m_guid;
} else {
- qDebug() << "[Storage] Failed attempt to load note from storage:" << m_guid;
+ qCDebug(dcNotesStore) << "Failed attempt to load note from storage:" << m_guid;
}
m_loaded = true;
}
=== modified file 'src/libqtevernote/note.h'
--- src/libqtevernote/note.h 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/note.h 2015-03-06 00:43:39 +0000
@@ -23,7 +23,6 @@
#include "utils/enmldocument.h"
#include "resource.h"
-#include "utils/textformat.h"
#include <QObject>
#include <QDateTime>
@@ -156,7 +155,6 @@
Q_INVOKABLE void markTodo(const QString &todoId, bool checked);
Q_INVOKABLE void attachFile(int position, const QUrl &fileName);
- Q_INVOKABLE void format(int startPos, int endPos, TextFormat::Format format);
Q_INVOKABLE void addTag(const QString &tagGuid);
Q_INVOKABLE void removeTag(const QString &tagGuid);
=== modified file 'src/libqtevernote/notebook.cpp'
--- src/libqtevernote/notebook.cpp 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/notebook.cpp 2015-03-06 00:43:39 +0000
@@ -191,7 +191,6 @@
}
} else {
if (!m_notesList.contains(noteGuid)) {
- qDebug() << "****** appending to notebook";
m_notesList.append(noteGuid);
emit noteCountChanged();
}
=== modified file 'src/libqtevernote/notesstore.cpp'
--- src/libqtevernote/notesstore.cpp 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/notesstore.cpp 2015-03-06 00:43:39 +0000
@@ -27,6 +27,7 @@
#include "utils/enmldocument.h"
#include "utils/organizeradapter.h"
#include "userstore.h"
+#include "logging.h"
#include "jobs/fetchnotesjob.h"
#include "jobs/fetchnotebooksjob.h"
@@ -59,6 +60,7 @@
m_notebooksLoading(false),
m_tagsLoading(false)
{
+ qCDebug(dcNotesStore) << "Creating NotesStore instance.";
connect(UserStore::instance(), &UserStore::usernameChanged, this, &NotesStore::userStoreConnected);
qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList");
@@ -72,7 +74,7 @@
QDir storageDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first());
if (!storageDir.exists()) {
- qDebug() << "creating storage directory:" << storageDir.absolutePath();
+ qCDebug(dcNotesStore) << "Creating storage directory:" << storageDir.absolutePath();
storageDir.mkpath(storageDir.absolutePath());
}
}
@@ -97,7 +99,7 @@
return;
}
if (!UserStore::instance()->username().isEmpty() && username != UserStore::instance()->username()) {
- 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.";
+ 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.";
return;
}
@@ -106,7 +108,7 @@
emit usernameChanged();
m_cacheFile = storageLocation() + "notes.cache";
- qDebug() << "initialized cacheFile" << m_cacheFile;
+ qCDebug(dcNotesStore) << "Initialized cacheFile:" << m_cacheFile;
loadFromCacheFile();
}
}
@@ -118,7 +120,7 @@
void NotesStore::userStoreConnected(const QString &username)
{
- qDebug() << "User store connected!" << username;
+ qCDebug(dcNotesStore) << "User store connected! Using username:" << username;
setUsername(username);
refreshNotebooks();
@@ -274,6 +276,7 @@
{
QString newGuid = QUuid::createUuid().toString();
newGuid.remove("{").remove("}");
+ qCDebug(dcNotesStore) << "Creating notebook:" << newGuid;
Notebook *notebook = new Notebook(newGuid, 1, this);
notebook->setName(name);
if (m_notebooks.isEmpty()) {
@@ -287,6 +290,7 @@
syncToCacheFile(notebook);
if (EvernoteConnection::instance()->isConnected()) {
+ qCDebug(dcSync) << "Creating notebook on server:" << notebook->guid();
notebook->setLoading(true);
CreateNotebookJob *job = new CreateNotebookJob(notebook);
connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);
@@ -298,19 +302,21 @@
{
Notebook *notebook = m_notebooksHash.value(tmpGuid);
if (!notebook) {
- qWarning() << "Cannot find temporary notebook after create finished";
+ qCWarning(dcSync) << "Cannot find temporary notebook after create finished";
return;
}
notebook->setLoading(false);
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error creating notebook:" << errorMessage;
+ qCWarning(dcSync) << "Error creating notebook:" << errorMessage;
notebook->setSyncError(true);
return;
}
QString guid = QString::fromStdString(result.guid);
- qDebug() << "create notebooks job done2";
+
+ qCDebug(dcSync) << "Notebook created on server. Old guid:" << tmpGuid << "New guid:" << guid;
+ qCDebug(dcNotesStore) << "Changing notebook guid. Old guid:" << tmpGuid << "New guid:" << guid;
m_notebooksHash.insert(guid, notebook);
notebook->setGuid(QString::fromStdString(result.guid));
@@ -338,7 +344,7 @@
{
Notebook *notebook = m_notebooksHash.value(guid);
if (!notebook) {
- qWarning() << "Can't save notebook. Guid not found:" << guid;
+ qCWarning(dcNotesStore) << "Can't save notebook. Guid not found:" << guid;
return;
}
@@ -358,11 +364,11 @@
{
Notebook *notebook = m_notebooksHash.value(guid);
if (!notebook) {
- qWarning() << "[NotesStore] Notebook guid not found:" << guid;
+ qCWarning(dcNotesStore) << "Notebook guid not found:" << guid;
return;
}
- qDebug() << "[NotesStore] Setting default notebook:" << guid;
+ qCDebug(dcNotesStore) << "Setting default notebook:" << guid;
foreach (Notebook *tmp, m_notebooks) {
if (tmp->isDefaultNotebook()) {
tmp->setIsDefaultNotebook(false);
@@ -379,7 +385,7 @@
{
Tag *tag = m_tagsHash.value(guid);
if (!tag) {
- qWarning() << "Can't save tag. Guid not found:" << guid;
+ qCWarning(dcNotesStore) << "Can't save tag. Guid not found:" << guid;
return;
}
@@ -398,7 +404,7 @@
void NotesStore::expungeNotebook(const QString &guid)
{
if (m_username != "@local") {
- qWarning() << "[NotesStore] Account managed by Evernote. Cannot delete notebooks.";
+ qCWarning(dcNotesStore) << "Account managed by Evernote. Cannot delete notebooks.";
m_errorQueue.append(QString(gettext("This account is managed by Evernote. Use the Evernote website to delete notebooks.")));
emit errorChanged();
return;
@@ -406,12 +412,12 @@
Notebook* notebook = m_notebooksHash.value(guid);
if (!notebook) {
- qWarning() << "[NotesStore] Cannot delete notebook. Notebook not found for guid:" << guid;
+ qCWarning(dcNotesStore) << "Cannot delete notebook. Notebook not found for guid:" << guid;
return;
}
if (notebook->isDefaultNotebook()) {
- qWarning() << "[NotesStore] Cannot delete the default notebook.";
+ qCWarning(dcNotesStore) << "Cannot delete the default notebook.";
m_errorQueue.append(QString(gettext("Cannot delete the default notebook. Set another notebook to be the default first.")));
emit errorChanged();
return;
@@ -426,7 +432,7 @@
}
}
if (defaultNotebook.isEmpty()) {
- qWarning() << "[NotesStore] No default notebook set. Can't delete notebooks.";
+ qCWarning(dcNotesStore) << "No default notebook set. Can't delete notebooks.";
return;
}
@@ -434,11 +440,11 @@
QString noteGuid = notebook->noteAt(0);
Note *note = m_notesHash.value(noteGuid);
if (!note) {
- qWarning() << "[NotesStore] Notebook holds a noteGuid which cannot be found in notes store";
+ qCWarning(dcNotesStore) << "Notebook holds a noteGuid which cannot be found in notes store";
Q_ASSERT(false);
continue;
}
- qDebug() << "[NotesStore] Moving note" << noteGuid << "to default Notebook";
+ qCDebug(dcNotesStore) << "Moving note" << noteGuid << "to default Notebook";
note->setNotebookGuid(defaultNotebook);
saveNote(note->guid());
emit noteChanged(note->guid(), defaultNotebook);
@@ -491,16 +497,15 @@
void NotesStore::createTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &tmpGuid, const evernote::edam::Tag &result)
{
- qDebug() << "CreateTagJob done";
Tag *tag = m_tagsHash.value(tmpGuid);
if (!tag) {
- qWarning() << "Create Tag job done but tag can't be found any more";
+ qCWarning(dcSync) << "Create Tag job done but tag can't be found any more";
return;
}
tag->setLoading(false);
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error creating tag:" << errorMessage;
+ qCWarning(dcSync) << "Error creating tag on server:" << errorMessage;
tag->setSyncError(true);
emit tagChanged(tag->guid());
return;
@@ -532,12 +537,12 @@
{
Tag *tag = m_tagsHash.value(QString::fromStdString(result.guid));
if (!tag) {
- qWarning() << "Save tag job finished, but tag can't be found any more";
+ qCWarning(dcSync) << "Save tag job finished, but tag can't be found any more";
return;
}
tag->setLoading(false);
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "error updating tag" << errorMessage;
+ qCWarning(dcSync) << "Error updating tag on server" << errorMessage;
tag->setSyncError(true);
emit tagChanged(tag->guid());
return;
@@ -554,18 +559,18 @@
{
Note *note = m_notesHash.value(noteGuid);
if (!note) {
- qWarning() << "No such note" << noteGuid;
+ qCWarning(dcNotesStore) << "No such note" << noteGuid;
return;
}
Tag *tag = m_tagsHash.value(tagGuid);
if (!tag) {
- qWarning() << "No such tag" << tagGuid;
+ qCWarning(dcNotesStore) << "No such tag" << tagGuid;
return;
}
if (note->tagGuids().contains(tagGuid)) {
- qWarning() << "Note" << noteGuid << "already tagged with tag" << tagGuid;
+ qCWarning(dcNotesStore) << "Note" << noteGuid << "already tagged with tag" << tagGuid;
return;
}
@@ -577,18 +582,18 @@
{
Note *note = m_notesHash.value(noteGuid);
if (!note) {
- qWarning() << "No such note" << noteGuid;
+ qCWarning(dcNotesStore) << "No such note" << noteGuid;
return;
}
Tag *tag = m_tagsHash.value(tagGuid);
if (!tag) {
- qWarning() << "No such tag" << tagGuid;
+ qCWarning(dcNotesStore) << "No such tag" << tagGuid;
return;
}
if (!note->tagGuids().contains(tagGuid)) {
- qWarning() << "Note" << noteGuid << "is not tagged with tag" << tagGuid;
+ qCWarning(dcNotesStore) << "Note" << noteGuid << "is not tagged with tag" << tagGuid;
return;
}
@@ -601,7 +606,7 @@
void NotesStore::refreshNotes(const QString &filterNotebookGuid, int startIndex)
{
if (m_loading && startIndex == 0) {
- qWarning() << "Still busy with refreshing...";
+ qCWarning(dcSync) << "Still busy with refreshing...";
return;
}
@@ -626,22 +631,22 @@
// All is well...
break;
case EvernoteConnection::ErrorCodeUserException:
- qWarning() << "FetchNotesJobDone: EDAMUserException:" << errorMessage;
+ qCWarning(dcSync) << "FetchNotesJobDone: EDAMUserException:" << errorMessage;
m_loading = false;
emit loadingChanged();
return; // silently discarding...
case EvernoteConnection::ErrorCodeConnectionLost:
- qWarning() << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage;
+ qCWarning(dcSync) << "FetchNotesJobDone: Connection with evernote lost:" << errorMessage;
m_loading = false;
emit loadingChanged();
return; // silently discarding...
case EvernoteConnection::ErrorCodeNotFoundExcpetion:
- qWarning() << "FetchNotesJobDone: Item not found on server:" << errorMessage;
+ qCWarning(dcSync) << "FetchNotesJobDone: Item not found on server:" << errorMessage;
m_loading = false;
emit loadingChanged();
return; // silently discarding...
default:
- qWarning() << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
+ qCWarning(dcSync) << "FetchNotesJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
m_loading = false;
emit loadingChanged();
return;
@@ -654,7 +659,7 @@
QVector<int> changedRoles;
bool newNote = note == 0;
if (newNote) {
- qDebug() << "FetchNotesJobDone: Found new note on server.";
+ qCDebug(dcSync) << "Found new note on server. Creating local copy:" << QString::fromStdString(result.guid);
note = new Note(QString::fromStdString(result.guid), 0, this);
connect(note, &Note::reminderChanged, this, &NotesStore::emitDataChanged);
connect(note, &Note::reminderDoneChanged, this, &NotesStore::emitDataChanged);
@@ -671,7 +676,7 @@
} else if (note->synced()) {
// Local note did not change. Check if we need to refresh from server.
if (note->updateSequenceNumber() < result.updateSequenceNum) {
- qDebug() << "refreshing note from network. suequence number changed: " << note->updateSequenceNumber() << "->" << result.updateSequenceNum;
+ qCDebug(dcSync) << "refreshing note from network. suequence number changed: " << note->updateSequenceNumber() << "->" << result.updateSequenceNum;
changedRoles = updateFromEDAM(result, note);
refreshNoteContent(note->guid(), FetchNoteJob::LoadContent, EvernoteJob::JobPriorityLow);
syncToCacheFile(note);
@@ -679,7 +684,7 @@
} else {
// Local note changed. See if we can push our changes.
if (note->lastSyncedSequenceNumber() == result.updateSequenceNum) {
- qDebug() << "Local note" << note->guid() << "has changed while server note did not. Pushing changes.";
+ qCDebug(dcSync) << "Local note" << note->guid() << "has changed while server note did not. Pushing changes.";
// Make sure we have everything loaded from cache before saving to server
if (!note->loaded() && note->isCached()) {
@@ -692,10 +697,10 @@
connect(job, &SaveNoteJob::jobDone, this, &NotesStore::saveNoteJobDone);
EvernoteConnection::instance()->enqueue(job);
} else {
- qWarning() << "CONFLICT: Note has been changed on server and locally!";
- qWarning() << "local note sequence:" << note->updateSequenceNumber();
- qWarning() << "last synced sequence:" << note->lastSyncedSequenceNumber();
- qWarning() << "remote sequence:" << result.updateSequenceNum;
+ qCWarning(dcSync) << "CONFLICT: Note has been changed on server and locally!";
+ qCWarning(dcSync) << "local note sequence:" << note->updateSequenceNumber();
+ qCWarning(dcSync) << "last synced sequence:" << note->lastSyncedSequenceNumber();
+ qCWarning(dcSync) << "remote sequence:" << result.updateSequenceNum;
note->setConflicting(true);
changedRoles << RoleConflicting;
}
@@ -714,10 +719,10 @@
}
if (results.startIndex + (int32_t)results.notes.size() < results.totalNotes) {
- qDebug() << "FetchNotesJobDone: Not all notes fetched yet. Fetching next batch.";
+ qCDebug(dcSync) << "Not all notes fetched yet. Fetching next batch.";
refreshNotes(filterNotebookGuid, results.startIndex + results.notes.size());
} else {
- qDebug() << "Fetched all notes. Starting merge...";
+ qCDebug(dcSync) << "Fetched all notes. Starting merge...";
m_organizerAdapter->startSync();
m_loading = false;
emit loadingChanged();
@@ -728,7 +733,7 @@
if (!note) {
continue; // Note might be deleted locally by now
}
- qDebug() << "Have a local note that's not available on server!" << note->guid();
+ qCDebug(dcSync) << "Have a local note that's not available on server!" << note->guid();
if (note->lastSyncedSequenceNumber() == 0) {
// This note hasn't been created on the server yet. Do that now.
bool hasUnsyncedTag = false;
@@ -741,15 +746,15 @@
}
}
if (hasUnsyncedTag) {
- qDebug() << "Not syncing note to server yet. Have a tag that needs sync first";
+ qCDebug(dcSync) << "Not syncing note to server yet. Have a tag that needs sync first";
continue;
}
Notebook *notebook = m_notebooksHash.value(note->notebookGuid());
if (notebook && notebook->lastSyncedSequenceNumber() == 0) {
- qDebug() << "Not syncing note to server yet. The notebook needs to be synced first";
+ qCDebug(dcSync) << "Not syncing note to server yet. The notebook needs to be synced first";
continue;
}
- qDebug() << "Creating note on server:" << note->guid();
+ qCDebug(dcSync) << "Creating note on server:" << note->guid();
// Make sure we have everything loaded from cache before saving to server
if (!note->loaded() && note->isCached()) {
@@ -787,13 +792,13 @@
void NotesStore::refreshNoteContent(const QString &guid, FetchNoteJob::LoadWhat what, EvernoteJob::JobPriority priority)
{
- qDebug() << "fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image");
Note *note = m_notesHash.value(guid);
if (!note) {
- qWarning() << "RefreshNoteContent: Can't refresn note content. Note guid not found:" << guid;
+ qCWarning(dcSync) << "RefreshNoteContent: Can't refresn note content. Note guid not found:" << guid;
return;
}
if (EvernoteConnection::instance()->isConnected()) {
+ qCDebug(dcNotesStore) << "Fetching note content from network for note" << guid << (what == FetchNoteJob::LoadContent ? "content" : "image");
FetchNoteJob *job = new FetchNoteJob(guid, what, this);
job->setJobPriority(priority);
connect(job, &FetchNoteJob::resultReady, this, &NotesStore::fetchNoteJobDone);
@@ -810,7 +815,7 @@
FetchNoteJob *job = static_cast<FetchNoteJob*>(sender());
Note *note = m_notesHash.value(QString::fromStdString(result.guid));
if (!note) {
- qWarning() << "can't find note for this update... ignoring...";
+ qCWarning(dcSync) << "can't find note for this update... ignoring...";
return;
}
QModelIndex noteIndex = index(m_notes.indexOf(note));
@@ -825,19 +830,19 @@
emit dataChanged(noteIndex, noteIndex, roles);
break;
case EvernoteConnection::ErrorCodeUserException:
- qWarning() << "FetchNoteJobDone: EDAMUserException:" << errorMessage;
+ qCWarning(dcSync) << "FetchNoteJobDone: EDAMUserException:" << errorMessage;
emit dataChanged(noteIndex, noteIndex, roles);
return; // silently discarding...
case EvernoteConnection::ErrorCodeConnectionLost:
- qWarning() << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage;
+ qCWarning(dcSync) << "FetchNoteJobDone: Connection with evernote lost:" << errorMessage;
emit dataChanged(noteIndex, noteIndex, roles);
return; // silently discarding...
case EvernoteConnection::ErrorCodeNotFoundExcpetion:
- qWarning() << "FetchNoteJobDone: Item not found on server:" << errorMessage;
+ qCWarning(dcSync) << "FetchNoteJobDone: Item not found on server:" << errorMessage;
emit dataChanged(noteIndex, noteIndex, roles);
return; // silently discarding...
default:
- qWarning() << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode;
+ qCWarning(dcSync) << "FetchNoteJobDone: Failed to fetch note content:" << errorMessage << errorCode;
note->setSyncError(true);
roles << RoleSyncError;
emit dataChanged(noteIndex, noteIndex, roles);
@@ -861,7 +866,7 @@
// data in the cache, let's refresh the note again with resource data.
bool refreshWithResourceData = false;
- qDebug() << "got note content" << note->guid() << (what == FetchNoteJob::LoadContent ? "content" : "image") << result.resources.size();
+ qCDebug(dcSync) << "got note content" << note->guid() << (what == FetchNoteJob::LoadContent ? "content" : "image") << result.resources.size();
// 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
for (unsigned int i = 0; i < result.resources.size(); ++i) {
@@ -872,14 +877,14 @@
QString mime = QString::fromStdString(resource.mime);
if (what == FetchNoteJob::LoadResources) {
- qDebug() << "[Sync] Resource fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
+ qCDebug(dcSync) << "Resource fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
QByteArray resourceData = QByteArray(resource.data.body.data(), resource.data.size);
note->addResource(resourceData, hash, fileName, mime);
} else if (Resource::isCached(hash)) {
- qDebug() << "[Sync] Resource already cached for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
+ qCDebug(dcSync) << "Resource already cached for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
note->addResource(QByteArray(), hash, fileName, mime);
} else {
- qDebug() << "[Sync] Resource not yet fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
+ qCDebug(dcSync) << "Resource not yet fetched for note:" << note->guid() << "Filename:" << fileName << "Mimetype:" << mime << "Hash:" << hash;
refreshWithResourceData = true;
}
roles << RoleHtmlContent << RoleEnmlContent << RoleResourceUrls;
@@ -915,7 +920,7 @@
emit dataChanged(noteIndex, noteIndex, roles);
if (refreshWithResourceData) {
- qDebug() << "refreshWithResourceData";
+ qCDebug(dcSync) << "Fetching Note resources:" << note->guid();
refreshNoteContent(note->guid(), FetchNoteJob::LoadResources, job->jobPriority());
} else {
syncToCacheFile(note); // Syncs into the list cache
@@ -926,7 +931,7 @@
void NotesStore::refreshNotebooks()
{
if (!EvernoteConnection::instance()->isConnected()) {
- qWarning() << "Not connected. Cannot fetch notebooks from server.";
+ qCWarning(dcSync) << "Not connected. Cannot fetch notebooks from server.";
return;
}
@@ -947,27 +952,27 @@
// All is well...
break;
case EvernoteConnection::ErrorCodeUserException:
- qWarning() << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage;
+ qCWarning(dcSync) << "FetchNotebooksJobDone: EDAMUserException:" << errorMessage;
// silently discarding...
return;
case EvernoteConnection::ErrorCodeConnectionLost:
- qWarning() << "FetchNotebooksJobDone: Connection lost:" << errorMessage;
+ qCWarning(dcSync) << "FetchNotebooksJobDone: Connection lost:" << errorMessage;
return; // silently discarding
default:
- qWarning() << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
+ qCWarning(dcSync) << "FetchNotebooksJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
return; // silently discarding
}
QList<Notebook*> unhandledNotebooks = m_notebooks;
- qDebug() << "[NotesStore] Have" << results.size() << "from Evernote.";
+ qCDebug(dcSync) << "Have" << results.size() << "notebooks from Evernote.";
for (unsigned int i = 0; i < results.size(); ++i) {
evernote::edam::Notebook result = results.at(i);
Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));
unhandledNotebooks.removeAll(notebook);
bool newNotebook = notebook == 0;
if (newNotebook) {
- qDebug() << "[NotesStore] Found new notebook on Evernote:" << QString::fromStdString(result.guid);
+ qCDebug(dcSync) << "Found new notebook on Evernote:" << QString::fromStdString(result.guid);
notebook = new Notebook(QString::fromStdString(result.guid), 0, this);
updateFromEDAM(result, notebook);
m_notebooksHash.insert(notebook->guid(), notebook);
@@ -976,25 +981,25 @@
syncToCacheFile(notebook);
} else if (notebook->synced()) {
if (notebook->updateSequenceNumber() < result.updateSequenceNum) {
- qDebug() << "[NotesStore] Notebook on Evernote is newer than local copy. Updating:" << notebook->guid();
+ qCDebug(dcSync) << "Notebook on Evernote is newer than local copy. Updating:" << notebook->guid();
updateFromEDAM(result, notebook);
emit notebookChanged(notebook->guid());
syncToCacheFile(notebook);
} else {
- qDebug() << "[NotesStore] Notebook is in sync:" << notebook->guid();
+ qCDebug(dcSync) << "Notebook is in sync:" << notebook->guid();
}
} else {
// Local notebook changed. See if we can push our changes
if (result.updateSequenceNum == notebook->lastSyncedSequenceNumber()) {
- qDebug() << "[NotesStore] Local Notebook changed. Uploading changes to Evernote:" << notebook->guid();
+ qCDebug(dcNotesStore) << "Local Notebook changed. Uploading changes to Evernote:" << notebook->guid();
SaveNotebookJob *job = new SaveNotebookJob(notebook);
connect(job, &SaveNotebookJob::jobDone, this, &NotesStore::saveNotebookJobDone);
EvernoteConnection::instance()->enqueue(job);
notebook->setLoading(true);
emit notebookChanged(notebook->guid());
} else {
- qWarning() << "[NotesStore] Sync conflict in notebook:" << notebook->name();
- qWarning() << "[NotesStore] Resolving of sync conflicts is not implemented yet.";
+ qCWarning(dcNotesStore) << "Sync conflict in notebook:" << notebook->name();
+ qCWarning(dcNotesStore) << "Resolving of sync conflicts is not implemented yet.";
notebook->setSyncError(true);
emit notebookChanged(notebook->guid());
}
@@ -1003,14 +1008,14 @@
foreach (Notebook *notebook, unhandledNotebooks) {
if (notebook->lastSyncedSequenceNumber() == 0) {
- qDebug() << "[NotesStore] Have a local notebook that doesn't exist on Evernote. Creating on server:" << notebook->guid();
+ qCDebug(dcSync) << "Have a local notebook that doesn't exist on Evernote. Creating on server:" << notebook->guid();
notebook->setLoading(true);
CreateNotebookJob *job = new CreateNotebookJob(notebook);
connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone);
EvernoteConnection::instance()->enqueue(job);
emit notebookChanged(notebook->guid());
} else {
- qDebug() << "[NotesStore] Notebook has been deleted on the server. Deleting local copy:" << notebook->guid();
+ qCDebug(dcSync) << "Notebook has been deleted on the server. Deleting local copy:" << notebook->guid();
m_notebooks.removeAll(notebook);
m_notebooksHash.remove(notebook->guid());
emit notebookRemoved(notebook->guid());
@@ -1029,7 +1034,7 @@
void NotesStore::refreshTags()
{
if (!EvernoteConnection::instance()->isConnected()) {
- qWarning() << "Not connected. Cannot fetch tags from server.";
+ qCWarning(dcSync) << "Not connected. Cannot fetch tags from server.";
return;
}
m_tagsLoading = true;
@@ -1057,14 +1062,14 @@
// All is well...
break;
case EvernoteConnection::ErrorCodeUserException:
- qWarning() << "FetchTagsJobDone: EDAMUserException:" << errorMessage;
+ qCWarning(dcSync) << "FetchTagsJobDone: EDAMUserException:" << errorMessage;
// silently discarding...
return;
case EvernoteConnection::ErrorCodeConnectionLost:
- qWarning() << "FetchTagsJobDone: Connection lost:" << errorMessage;
+ qCWarning(dcSync) << "FetchTagsJobDone: Connection lost:" << errorMessage;
return; // silently discarding
default:
- qWarning() << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
+ qCWarning(dcSync) << "FetchTagsJobDone: Failed to fetch notes list:" << errorMessage << errorCode;
return; // silently discarding
}
@@ -1077,7 +1082,7 @@
if (newTag) {
tag = new Tag(QString::fromStdString(result.guid), result.updateSequenceNum, this);
tag->setLastSyncedSequenceNumber(result.updateSequenceNum);
- qDebug() << "got new tag with seq:" << result.updateSequenceNum << tag->synced() << tag->updateSequenceNumber() << tag->lastSyncedSequenceNumber();
+ qCDebug(dcSync) << "got new tag with seq:" << result.updateSequenceNum << tag->synced() << tag->updateSequenceNumber() << tag->lastSyncedSequenceNumber();
tag->setName(QString::fromStdString(result.name));
m_tagsHash.insert(tag->guid(), tag);
m_tags.append(tag);
@@ -1100,7 +1105,7 @@
tag->setLoading(true);
emit tagChanged(tag->guid());
} else {
- qWarning() << "CONFLICT in tag" << tag->name();
+ qCWarning(dcSync) << "CONFLICT in tag" << tag->name();
tag->setSyncError(true);
emit tagChanged(tag->guid());
}
@@ -1183,7 +1188,7 @@
{
Note *note = m_notesHash.value(tmpGuid);
if (!note) {
- qWarning() << "Cannot find temporary note after create operation!";
+ qCWarning(dcSync) << "Cannot find temporary note after create operation!";
return;
}
int idx = m_notes.indexOf(note);
@@ -1193,7 +1198,7 @@
roles << RoleLoading;
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error creating note:" << tmpGuid << errorMessage;
+ qCWarning(dcSync) << "Error creating note on server:" << tmpGuid << errorMessage;
note->setSyncError(true);
roles << RoleSyncError;
emit dataChanged(index(idx), index(idx), roles);
@@ -1206,7 +1211,7 @@
}
QString guid = QString::fromStdString(result.guid);
- qDebug() << "Note created on server. Old guid:" << tmpGuid << "New guid:" << guid;
+ qCDebug(dcSync) << "Note created on server. Old guid:" << tmpGuid << "New guid:" << guid;
m_notesHash.insert(guid, note);
note->setGuid(guid);
m_notesHash.remove(tmpGuid);
@@ -1252,7 +1257,7 @@
{
Note *note = m_notesHash.value(guid);
if (!note) {
- qWarning() << "Can't save note. Guid not found:" << guid;
+ qCWarning(dcNotesStore) << "Can't save note. Guid not found:" << guid;
return;
}
note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);
@@ -1283,10 +1288,10 @@
void NotesStore::saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result)
{
- qDebug() << "saveNoteJobDone. guid:" << QString::fromStdString(result.guid);
+ qCDebug(dcSync) << "Note saved to server:" << QString::fromStdString(result.guid);
Note *note = m_notesHash.value(QString::fromStdString(result.guid));
if (!note) {
- qWarning() << "Got a save note job result, but note has disappeared locally.";
+ qCWarning(dcSync) << "Got a save note job result, but note has disappeared locally.";
return;
}
@@ -1294,7 +1299,7 @@
note->setLoading(false);
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error saving note:" << errorMessage;
+ qCWarning(dcSync) << "Error saving note:" << errorMessage;
note->setSyncError(true);
emit dataChanged(index(idx), index(idx), QVector<int>() << RoleLoading << RoleSyncError);
return;
@@ -1317,16 +1322,16 @@
void NotesStore::saveNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result)
{
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "error saving notebook" << errorMessage;
+ qCWarning(dcSync) << "Error saving notebook to server" << errorMessage;
return;
}
Notebook *notebook = m_notebooksHash.value(QString::fromStdString(result.guid));
if (!notebook) {
- qWarning() << "Save notebook job done but notebook can't be found any more!";
+ qCWarning(dcSync) << "Save notebook job done but notebook can't be found any more!";
return;
}
- qDebug() << "save notebook done for:" << notebook->name() << notebook->lastSyncedSequenceNumber() << notebook->updateSequenceNumber() << result.updateSequenceNum;
+ qCDebug(dcSync) << "Notebooks saved to server:" << notebook->guid();
updateFromEDAM(result, notebook);
notebook->setLoading(false);
emit notebookChanged(notebook->guid());
@@ -1337,7 +1342,7 @@
{
Note *note = m_notesHash.value(guid);
if (!note) {
- qWarning() << "Note not found. Can't delete";
+ qCWarning(dcNotesStore) << "Note not found. Can't delete";
return;
}
@@ -1354,7 +1359,7 @@
note->deleteLater();
} else {
- qDebug() << "setting note" << note << "to deleted" << idx;
+ qCDebug(dcNotesStore) << "Setting note to deleted:" << note->guid();
note->setDeleted(true);
note->setUpdateSequenceNumber(note->updateSequenceNumber()+1);
emit dataChanged(index(idx), index(idx), QVector<int>() << RoleDeleted);
@@ -1395,7 +1400,7 @@
void NotesStore::deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
{
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Cannot delete note:" << errorMessage;
+ qCWarning(dcSync) << "Cannot delete note from server:" << errorMessage;
return;
}
Note *note = m_notesHash.value(guid);
@@ -1415,7 +1420,7 @@
void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid)
{
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error expunging notebook:" << errorMessage;
+ qCWarning(dcSync) << "Error expunging notebook:" << errorMessage;
return;
}
emit notebookRemoved(guid);
@@ -1460,7 +1465,7 @@
void NotesStore::syncToCacheFile(Note *note)
{
- qDebug() << "syncToCacheFile for note" << note->guid();
+ qCDebug(dcNotesStore) << "Syncing note to disk:" << note->guid();
QSettings cacheFile(m_cacheFile, QSettings::IniFormat);
cacheFile.beginGroup("notes");
cacheFile.setValue(note->guid(), note->updateSequenceNumber());
@@ -1527,7 +1532,7 @@
beginInsertRows(QModelIndex(), 0, cacheFile.allKeys().count()-1);
foreach (const QString &key, cacheFile.allKeys()) {
if (m_notesHash.contains(key)) {
- qWarning() << "already have note. Not reloading from cache.";
+ qCWarning(dcNotesStore) << "already have note. Not reloading from cache.";
continue;
}
Note *note = new Note(key, cacheFile.value(key).toUInt(), this);
@@ -1618,7 +1623,6 @@
if (evNotebook.__isset.published && evNotebook.published != notebook->published()) {
notebook->setPublished(evNotebook.published);
}
- qDebug() << "readong from evernote:" << evNotebook.__isset.defaultNotebook << evNotebook.defaultNotebook << notebook->name();
if (evNotebook.__isset.defaultNotebook && evNotebook.defaultNotebook != notebook->isDefaultNotebook()) {
notebook->setIsDefaultNotebook(evNotebook.defaultNotebook);
}
@@ -1629,7 +1633,7 @@
void NotesStore::expungeTag(const QString &guid)
{
if (m_username != "@local") {
- qWarning() << "This account is managed by Evernote. Cannot delete tags.";
+ qCWarning(dcNotesStore) << "This account is managed by Evernote. Cannot delete tags.";
m_errorQueue.append(gettext("This account is managed by Evernote. Please use the Evernote website to delete tags."));
emit errorChanged();
return;
@@ -1637,7 +1641,7 @@
Tag *tag = m_tagsHash.value(guid);
if (!tag) {
- qWarning() << "[NotesStore] No tag with guid" << guid;
+ qCWarning(dcNotesStore) << "No tag with guid" << guid;
return;
}
@@ -1645,7 +1649,7 @@
QString noteGuid = tag->noteAt(0);
Note *note = m_notesHash.value(noteGuid);
if (!note) {
- qWarning() << "[NotesStore] Tag holds note" << noteGuid << "which hasn't been found in Notes Store";
+ qCWarning(dcNotesStore) << "Tag holds note" << noteGuid << "which hasn't been found in Notes Store";
continue;
}
untagNote(noteGuid, guid);
=== modified file 'src/libqtevernote/resource.cpp'
--- src/libqtevernote/resource.cpp 2015-02-27 00:43:59 +0000
+++ src/libqtevernote/resource.cpp 2015-03-06 00:43:39 +0000
@@ -20,6 +20,7 @@
#include "resource.h"
#include "notesstore.h"
+#include "logging.h"
#include <QFile>
#include <QStandardPaths>
@@ -44,7 +45,7 @@
if (!data.isEmpty() && !file.exists()) {
if (!file.open(QFile::WriteOnly)) {
- qWarning() << "error writing file" << m_filePath;
+ qCWarning(dcNotesStore) << "error writing file" << m_filePath;
return;
}
file.write(data);
@@ -69,7 +70,7 @@
QFile file(path);
if (!file.open(QFile::ReadOnly)) {
- qWarning() << "Cannot open file for reading...";
+ qCWarning(dcNotesStore) << "Cannot open file for reading...";
return;
}
QByteArray fileContent = file.readAll();
@@ -84,7 +85,7 @@
} else if (m_fileName.endsWith(".gif")) {
m_type = "image/gif";
} else {
- qWarning() << "cannot determine mime type of file" << m_fileName;
+ qCWarning(dcNotesStore) << "cannot determine mime type of file" << m_fileName;
}
m_filePath = NotesStore::instance()->storageLocation() + m_hash + "." + m_fileName.split('.').last();
@@ -93,7 +94,7 @@
if (!copy.exists()) {
if (!copy.open(QFile::WriteOnly)) {
- qWarning() << "error writing file" << m_filePath;
+ qCWarning(dcNotesStore) << "error writing file" << m_filePath;
return;
}
copy.write(fileContent);
=== modified file 'src/libqtevernote/resourceimageprovider.cpp'
--- src/libqtevernote/resourceimageprovider.cpp 2015-02-20 22:35:03 +0000
+++ src/libqtevernote/resourceimageprovider.cpp 2015-03-06 00:43:39 +0000
@@ -1,4 +1,5 @@
#include "resourceimageprovider.h"
+#include "logging.h"
#include <notesstore.h>
#include <note.h>
@@ -20,7 +21,7 @@
QString resourceHash = arguments.queryItemValue("hash");
Note *note = NotesStore::instance()->note(noteGuid);
if (!note) {
- qWarning() << "Unable to find note for resource:" << id;
+ qCWarning(dcNotesStore) << "Unable to find note for resource:" << id;
return QImage();
}
=== modified file 'src/libqtevernote/tag.h'
--- src/libqtevernote/tag.h 2015-03-04 20:30:55 +0000
+++ src/libqtevernote/tag.h 2015-03-06 00:43:39 +0000
@@ -23,7 +23,6 @@
#include "utils/enmldocument.h"
#include "resource.h"
-#include "utils/textformat.h"
#include <QObject>
#include <QDateTime>
=== modified file 'src/libqtevernote/userstore.cpp'
--- src/libqtevernote/userstore.cpp 2014-12-09 18:50:55 +0000
+++ src/libqtevernote/userstore.cpp 2015-03-06 00:43:39 +0000
@@ -21,6 +21,7 @@
#include "userstore.h"
#include "evernoteconnection.h"
#include "jobs/fetchusernamejob.h"
+#include "logging.h"
// Evernote sdk
#include <UserStore.h>
@@ -78,7 +79,7 @@
void UserStore::fetchUsernameJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &result)
{
if (errorCode != EvernoteConnection::ErrorCodeNoError) {
- qWarning() << "Error fetching username:" << errorMessage;
+ qCWarning(dcConnection) << "Error fetching username:" << errorMessage;
return;
}
=== modified file 'src/libqtevernote/utils/enmldocument.cpp'
--- src/libqtevernote/utils/enmldocument.cpp 2015-02-28 00:45:09 +0000
+++ src/libqtevernote/utils/enmldocument.cpp 2015-03-06 00:43:39 +0000
@@ -21,6 +21,7 @@
#include "enmldocument.h"
#include "notesstore.h"
#include "note.h"
+#include "logging.h"
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
@@ -203,7 +204,7 @@
}
}
} else {
- qDebug() << "unknown mediatype" << mediaType;
+ qCWarning(dcEnml) << "Unknown mediatype" << mediaType;
if (type == TypeRichText) {
writer.writeAttribute("src", composeMediaTypeUrl(mediaType, noteGuid, hash));
} else if (type == TypeHtml) {
@@ -276,7 +277,7 @@
writer.writeEndElement();
writer.writeEndDocument();
- qDebug() << "converted to html" << html;
+ qCDebug(dcEnml) << QString("Converted to %1:").arg(type == TypeHtml ? "HTML" : "RichText") << html;
return html;
}
=== modified file 'src/libqtevernote/utils/organizeradapter.cpp'
--- src/libqtevernote/utils/organizeradapter.cpp 2015-02-28 02:48:16 +0000
+++ src/libqtevernote/utils/organizeradapter.cpp 2015-03-06 00:43:39 +0000
@@ -1,5 +1,6 @@
#include "organizeradapter.h"
#include "notesstore.h"
+#include "logging.h"
#include <QDebug>
#include <QOrganizerItemVisualReminder>
@@ -47,12 +48,12 @@
// EDS requires extra metadata to be set
m_collection.setExtendedMetaData("collection-type", "Task List");
if (!m_manager->saveCollection(&m_collection)) {
- qWarning() << "WARNING: Creating dedicated collection for reminders was not possible, reminders will be saved into the default collection!";
+ qCWarning(dcOrganizer) << "WARNING: Creating dedicated collection for reminders was not possible, reminders will be saved into the default collection!";
m_collection = m_manager->defaultCollection();
}
}
- qDebug() << "have collection" << m_collection.id().toString();
+ qCDebug(dcOrganizer) << "Have Organizer collection" << m_collection.id().toString();
}
void OrganizerAdapter::startSync()
@@ -133,7 +134,7 @@
}
if (state == QOrganizerAbstractRequest::CanceledState) {
- qWarning() << "Error syncing reminders. Could not read organizer items.";
+ qCWarning(dcOrganizer) << "Error syncing reminders. Could not read organizer items.";
m_busy = false;
request->deleteLater();
return;
=== removed file 'src/libqtevernote/utils/textformat.cpp'
--- src/libqtevernote/utils/textformat.cpp 2014-01-29 16:04:00 +0000
+++ src/libqtevernote/utils/textformat.cpp 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright: 2013 Canonical, Ltd
- *
- * This file is part of reminders-app
- *
- * reminders-app is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * reminders-app is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Michael Zanetti <michael.zanetti@xxxxxxxxxxxxx>
- */
-
-#include "textformat.h"
-
-TextFormat::TextFormat(QObject *parent): QObject(parent)
-{
-}
=== removed file 'src/libqtevernote/utils/textformat.h'
--- src/libqtevernote/utils/textformat.h 2014-01-29 18:27:11 +0000
+++ src/libqtevernote/utils/textformat.h 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright: 2013 Canonical, Ltd
- *
- * This file is part of reminders-app
- *
- * reminders-app is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3.
- *
- * reminders-app is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Michael Zanetti <michael.zanetti@xxxxxxxxxxxxx>
- */
-
-#ifndef TEXTFORMAT_H
-#define TEXTFORMAT_H
-
-#include <QObject>
-
-class TextFormat: public QObject
-{
- Q_OBJECT
- Q_ENUMS(Format)
-public:
- enum Format {
- Bold,
- Italic,
- Underlined
- };
- Q_DECLARE_FLAGS(Formats, Format)
-
- TextFormat(QObject *parent = 0);
-};
-Q_DECLARE_OPERATORS_FOR_FLAGS(TextFormat::Formats)
-Q_DECLARE_METATYPE(TextFormat::Format)
-
-#endif
=== modified file 'src/plugin/Evernote/evernoteplugin.cpp'
--- src/plugin/Evernote/evernoteplugin.cpp 2014-10-09 00:08:52 +0000
+++ src/plugin/Evernote/evernoteplugin.cpp 2015-03-06 00:43:39 +0000
@@ -32,8 +32,6 @@
#include "tag.h"
#include "resourceimageprovider.h"
-#include "utils/textformat.h"
-
#include <QtQml>
static QObject* userStoreProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
@@ -64,8 +62,6 @@
qmlRegisterUncreatableType<Notebook>(uri, 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead.");
qmlRegisterUncreatableType<Tag>(uri, 0, 1, "Tag", "Cannot create Tags in QML. Use NotesStore.createTag() instead.");
qmlRegisterUncreatableType<Resource>(uri, 0, 1, "Resource", "Cannot create Resources. Use Note.attachFile() instead.");
-
- qmlRegisterUncreatableType<TextFormat>(uri, 0, 1, "TextFormat", "TextFormat is not creatable. It's just here to export enums to QML");
}
void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
Follow ups
-
[Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: noreply, 2015-03-08
-
[Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Riccardo Padovani, 2015-03-08
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Riccardo Padovani, 2015-03-08
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Michael Zanetti, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Riccardo Padovani, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Riccardo Padovani, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-06
-
Re: [Merge] lp:~mzanetti/reminders-app/cleanup-debug into lp:reminders-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-06