Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9cf4125e authored by Laurent Montel's avatar Laurent Montel 😁

Port to new debug categories

parent 4b40cdae
......@@ -35,7 +35,7 @@
#include "kolabformat/kolabobject.h"
#include "kolabformat/errorhandler.h"
#include "kolabformat/kolabdefinitions.h"
#include "pimkolab_debug.h"
static bool compareMimeMessage(const KMime::Message::Ptr &msg, const KMime::Message::Ptr &expectedMsg)
{
// headers
......
......@@ -19,7 +19,7 @@
#include "kolabformat/xmlobject.h"
#include "kolabformat/errorhandler.h"
#include "testutils.h"
#include "pimkolab_debug.h"
#include <QTest>
#include <fstream>
#include <sstream>
......
......@@ -21,7 +21,7 @@
#include <qbuffer.h>
#include <qimagereader.h>
#include "kolabformat/errorhandler.h"
#include "pimkolab_debug.h"
namespace Kolab {
namespace Conversion {
//The following was copied from kdepim/libkleo/kleo/enum.h,.cpp
......@@ -351,18 +351,18 @@ std::string fromPicture(const KContacts::Picture &pic, std::string &mimetype)
// }
}
if (img.isNull()) {
Error() << "invalid picture";
qCCritical(PIMKOLAB_LOG) << "invalid picture";
return std::string();
}
if (!img.hasAlphaChannel()) {
if (!img.save(&buffer, "JPEG")) {
Error() << "error on jpeg save";
qCCritical(PIMKOLAB_LOG) << "error on jpeg save";
return std::string();
}
mimetype = "image/jpeg";
} else {
if (!img.save(&buffer, "PNG")) {
Error() << "error on png save";
qCCritical(PIMKOLAB_LOG) << "error on png save";
return std::string();
}
mimetype = "image/png";
......@@ -489,7 +489,7 @@ KContacts::Addressee toKABC(const Kolab::Contact &contact)
if (!contact.freeBusyUrl().empty()) {
if (preferredEmail.isEmpty()) {
Error() << "f/b url is set but no email address available, skipping";
qCCritical(PIMKOLAB_LOG) << "f/b url is set but no email address available, skipping";
} else {
addressee.insertCustom(QStringLiteral("KOLAB"), QStringLiteral("FreebusyUrl"), fromStdString(contact.freeBusyUrl()));
}
......@@ -533,7 +533,7 @@ KContacts::Addressee toKABC(const Kolab::Contact &contact)
}
foreach (const Kolab::Related &related, aff.relateds()) {
if (related.type() != Kolab::Related::Text) {
Error() << "invalid relation type";
qCCritical(PIMKOLAB_LOG) << "invalid relation type";
continue;
}
if (related.relationTypes() & Kolab::Related::Assistant) {
......@@ -605,7 +605,7 @@ KContacts::Addressee toKABC(const Kolab::Contact &contact)
if (!contact.relateds().empty()) {
foreach (const Kolab::Related &rel, contact.relateds()) {
if (rel.type() != Kolab::Related::Text) {
Error() << "relation type not supported";
qCCritical(PIMKOLAB_LOG) << "relation type not supported";
continue;
}
if (rel.relationTypes() & Kolab::Related::Spouse) {
......@@ -900,7 +900,7 @@ KContacts::ContactGroup toKABC(const DistList &dl)
cg.append(KContacts::ContactGroup::ContactReference(fromStdString(m.uid())));
break;
default:
Error() << "invalid contact reference";
qCCritical(PIMKOLAB_LOG) << "invalid contact reference";
}
}
......
......@@ -27,7 +27,7 @@
#include "kolabformat/errorhandler.h"
#include "commonconversion.h"
#include "pimkolab_debug.h"
namespace Kolab {
namespace Conversion {
//The uid of a contact which refers to the uuid of a contact in the addressbook
......@@ -83,7 +83,7 @@ KCalCore::Incidence::Secrecy toSecrecy(Kolab::Classification c)
case Kolab::ClassConfidential:
return KCalCore::Incidence::SecrecyConfidential;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return KCalCore::Incidence::SecrecyPublic;
......@@ -99,7 +99,7 @@ Kolab::Classification fromSecrecy(KCalCore::Incidence::Secrecy c)
case KCalCore::Incidence::SecrecyConfidential:
return Kolab::ClassConfidential;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return Kolab::ClassPublic;
......@@ -139,7 +139,7 @@ KCalCore::Incidence::Status toStatus(Kolab::Status s)
case StatusFinal:
return KCalCore::Incidence::StatusFinal;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return KCalCore::Incidence::StatusNone;
......@@ -167,7 +167,7 @@ Kolab::Status fromStatus(KCalCore::Incidence::Status s)
case KCalCore::Incidence::StatusFinal:
return StatusFinal;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return StatusUndefined;
......@@ -187,7 +187,7 @@ KCalCore::Attendee::PartStat toPartStat(Kolab::PartStatus p)
case PartDelegated:
return KCalCore::Attendee::Delegated;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return KCalCore::Attendee::NeedsAction;
......@@ -207,7 +207,7 @@ Kolab::PartStatus fromPartStat(KCalCore::Attendee::PartStat p)
case KCalCore::Attendee::Delegated:
return PartDelegated;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return PartNeedsAction;
......@@ -225,7 +225,7 @@ KCalCore::Attendee::Role toRole(Kolab::Role r)
case NonParticipant:
return KCalCore::Attendee::NonParticipant;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return KCalCore::Attendee::ReqParticipant;
......@@ -243,7 +243,7 @@ Kolab::Role fromRole(KCalCore::Attendee::Role r)
case KCalCore::Attendee::NonParticipant:
return NonParticipant;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return Required;
......@@ -419,7 +419,7 @@ int toWeekDay(Kolab::Weekday wday)
case Kolab::Sunday:
return 7;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return 1;
......@@ -443,7 +443,7 @@ Kolab::Weekday fromWeekDay(int wday)
case 7:
return Kolab::Sunday;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return Kolab::Monday;
......@@ -470,7 +470,7 @@ KCalCore::RecurrenceRule::PeriodType toRecurrenceType(Kolab::RecurrenceRule::Fre
case Kolab::RecurrenceRule::Secondly:
return KCalCore::RecurrenceRule::rSecondly;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return KCalCore::RecurrenceRule::rNone;
......@@ -497,7 +497,7 @@ Kolab::RecurrenceRule::Frequency fromRecurrenceType(KCalCore::RecurrenceRule::Pe
case KCalCore::RecurrenceRule::rSecondly:
return Kolab::RecurrenceRule::Secondly;
default:
Error() << "unhandled";
qCCritical(PIMKOLAB_LOG) << "unhandled";
Q_ASSERT(0);
}
return Kolab::RecurrenceRule::FreqNone;
......@@ -684,7 +684,7 @@ void setTodoEvent(KCalCore::Incidence &i, const T &e)
alarm->setAudioAlarm(fromStdString(a.audioFile().uri()));
break;
default:
Error() << "invalid alarm";
qCCritical(PIMKOLAB_LOG) << "invalid alarm";
}
if (a.start().isValid()) {
......@@ -745,7 +745,7 @@ void getTodoEvent(T &i, const I &e)
break;
}
default:
Error() << "unhandled alarm";
qCCritical(PIMKOLAB_LOG) << "unhandled alarm";
}
if (a->hasTime()) {
......@@ -755,7 +755,7 @@ void getTodoEvent(T &i, const I &e)
} else if (a->hasEndOffset()) {
alarm.setRelativeStart(fromDuration(a->endOffset()), End);
} else {
Error() << "alarm trigger is missing";
qCCritical(PIMKOLAB_LOG) << "alarm trigger is missing";
continue;
}
......@@ -814,7 +814,7 @@ KCalCore::Todo::Ptr toKCalCore(const Todo &todo)
if (!todo.relatedTo().empty()) {
e->setRelatedTo(Conversion::fromStdString(todo.relatedTo().front()), KCalCore::Incidence::RelTypeParent);
if (todo.relatedTo().size() > 1) {
Error() << "only one relation support but got multiple";
qCCritical(PIMKOLAB_LOG) << "only one relation support but got multiple";
}
}
e->setPercentComplete(todo.percentComplete());
......
......@@ -20,7 +20,7 @@
#include <QRegExp>
#include "kolabformat/errorhandler.h"
#include <QTimeZone>
#include "pimkolab_debug.h"
QString TimezoneConverter::normalizeTimezone(const QString &tz)
{
if (QTimeZone::isTimeZoneIdAvailable(tz.toLatin1())) {
......
......@@ -30,7 +30,7 @@
#include <QString>
#include <KRandom>
#include <boost/algorithm/string/predicate.hpp>
#include "pimkolab_debug.h"
Q_DECLARE_METATYPE(Kolab::Event)
Q_DECLARE_METATYPE(Kolab::Todo)
Q_DECLARE_METATYPE(Kolab::Journal)
......
......@@ -28,7 +28,7 @@
#include "kolabformatV2/note.h"
#include "mime/mimeutils.h"
#include "kolabformat/errorhandler.h"
#include "pimkolab_debug.h"
#include <kcontacts/contactgroup.h>
#include <qdom.h>
......@@ -40,7 +40,7 @@ namespace Kolab {
void getAttachments(KCalCore::Incidence::Ptr incidence, const QStringList &attachments, const KMime::Message::Ptr &mimeData)
{
if (!incidence) {
Error() << "Invalid incidence";
qCCritical(PIMKOLAB_LOG) << "Invalid incidence";
return;
}
foreach (const QString &name, attachments) {
......@@ -271,7 +271,7 @@ QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString
QStringList dictionary;
const QDomDocument xmlDoc = KolabV2::KolabBase::loadDocument(QString::fromUtf8(xmlData)); //TODO extract function from V2 format
if (xmlDoc.isNull()) {
Error() << "Failed to read the xml document";
qCCritical(PIMKOLAB_LOG) << "Failed to read the xml document";
return QStringList();
}
......
......@@ -23,6 +23,7 @@
#include "conversion/commonconversion.h"
#include "conversion/kabcconversion.h"
#include <QUuid>
#include "pimkolab_debug.h"
namespace Kolab {
static QString createUuid()
......@@ -118,7 +119,7 @@ Todo XMLObject::readTodo(const std::string &s, Version version)
QStringList attachments;
const KCalCore::Todo::Ptr event = Kolab::fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
if (!event || Kolab::ErrorHandler::errorOccured()) {
Error() << "failed to read xml";
qCCritical(PIMKOLAB_LOG) << "failed to read xml";
return Todo();
}
mAttachments.clear();
......
......@@ -24,13 +24,13 @@
#include "kolabformat/errorhandler.h"
#include <kolabformat.h>
#include "libkolab-version.h"
#include "pimkolab_debug.h"
namespace Kolab {
namespace Mime {
KMime::Content *findContentByType(const KMime::Message::Ptr &data, const QByteArray &type)
{
if (type.isEmpty()) {
Error() << "Empty type";
qCCritical(PIMKOLAB_LOG) << "Empty type";
return nullptr;
}
Q_ASSERT(!data->contents().isEmpty());
......@@ -59,7 +59,7 @@ KMime::Content *findContentByName(const KMime::Message::Ptr &data, const QString
KMime::Content *findContentById(const KMime::Message::Ptr &data, const QByteArray &id, QByteArray &type, QString &name)
{
if (id.isEmpty()) {
Error() << "looking for empty cid";
qCCritical(PIMKOLAB_LOG) << "looking for empty cid";
return 0;
}
Q_ASSERT(!data->contents().isEmpty());
......@@ -198,14 +198,14 @@ KMime::Content *createAttachmentPart(const QByteArray &cid, const QByteArray &mi
Kolab::Attachment getAttachment(const std::string &id, const KMime::Message::Ptr &mimeData)
{
if (!QString::fromStdString(id).contains(QLatin1String("cid:"))) {
Error() << "not a cid reference";
qCCritical(PIMKOLAB_LOG) << "not a cid reference";
return Kolab::Attachment();
}
QByteArray type;
QString name;
KMime::Content *content = findContentById(mimeData, fromCid(QString::fromStdString(id)).toLatin1(), type, name);
if (!content) { // guard against malformed events with non-existent attachments
Error() << "could not find attachment: "<< name << type;
qCCritical(PIMKOLAB_LOG) << "could not find attachment: "<< name << type;
return Kolab::Attachment();
}
// Debug() << id << content->decodedContent().toBase64().toStdString();
......
......@@ -25,7 +25,7 @@
#include <kolabformat.h>
#include "kolabformat/errorhandler.h"
#include "kolabformat/kolabobject.h"
#include "pimkolab_debug.h"
namespace po = boost::program_options;
using namespace std;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment