Commit c9878f99 authored by Laurent Montel's avatar Laurent Montel 😁

Continue to port

parent 9cf4125e
......@@ -205,19 +205,19 @@ int fromAddressType(int kabcType, bool &pref)
{
int type = 0;
if (kabcType & KContacts::Address::Dom) {
Warning() << "domestic address is not supported";
qCWarning(PIMKOLAB_LOG) <<"domestic address is not supported";
}
if (kabcType & KContacts::Address::Intl) {
Warning() << "international address is not supported";
qCWarning(PIMKOLAB_LOG) <<"international address is not supported";
}
if (kabcType & KContacts::Address::Pref) {
pref = true;
}
if (kabcType & KContacts::Address::Postal) {
Warning() << "postal address is not supported";
qCWarning(PIMKOLAB_LOG) <<"postal address is not supported";
}
if (kabcType & KContacts::Address::Parcel) {
Warning() << "parcel is not supported";
qCWarning(PIMKOLAB_LOG) <<"parcel is not supported";
}
if (kabcType & KContacts::Address::Home) {
type |= Kolab::Address::Home;
......@@ -271,16 +271,16 @@ int fromPhoneType(int kabcType, bool &pref)
type |= Kolab::Telephone::Video;
}
if (kabcType & KContacts::PhoneNumber::Bbs) {
Warning() << "mailbox number is not supported";
qCWarning(PIMKOLAB_LOG) <<"mailbox number is not supported";
}
if (kabcType & KContacts::PhoneNumber::Modem) {
Warning() << "modem is not supported";
qCWarning(PIMKOLAB_LOG) <<"modem is not supported";
}
if (kabcType & KContacts::PhoneNumber::Car) {
type |= Kolab::Telephone::Car;
}
if (kabcType & KContacts::PhoneNumber::Isdn) {
Warning() << "isdn number is not supported";
qCWarning(PIMKOLAB_LOG) <<"isdn number is not supported";
}
if (kabcType & KContacts::PhoneNumber::Pcs) {
type |= Kolab::Telephone::Text;
......@@ -382,13 +382,13 @@ KContacts::Picture toPicture(const std::string &data, const std::string &mimetyp
ret = img.loadFromData(QByteArray::fromRawData(data.data(), data.size()));
}
if (!ret) {
Warning() << "failed to load picture";
qCWarning(PIMKOLAB_LOG) <<"failed to load picture";
return KContacts::Picture();
}
KContacts::Picture logo(img);
if (logo.isEmpty()) {
Warning() << "failed to read picture";
qCWarning(PIMKOLAB_LOG) <<"failed to read picture";
return KContacts::Picture();
}
return logo;
......@@ -611,7 +611,7 @@ KContacts::Addressee toKABC(const Kolab::Contact &contact)
if (rel.relationTypes() & Kolab::Related::Spouse) {
addressee.insertCustom(QLatin1String("KADDRESSBOOK"), QLatin1String("X-SpousesName"), fromStdString(rel.text())); //TODO support multiple
} else {
Warning() << "relation not supported";
qCWarning(PIMKOLAB_LOG) <<"relation not supported";
continue;
}
}
......@@ -844,7 +844,7 @@ Kolab::Contact fromKABC(const KContacts::Addressee &addressee)
c.setKeys(keys);
if (!addressee.sound().isEmpty()) {
Warning() << "sound is not supported";
qCWarning(PIMKOLAB_LOG) <<"sound is not supported";
}
const std::string &profession = toStdString(addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Profession")));
......
......@@ -453,7 +453,7 @@ KCalCore::RecurrenceRule::PeriodType toRecurrenceType(Kolab::RecurrenceRule::Fre
{
switch (freq) {
case Kolab::RecurrenceRule::FreqNone:
Warning() << "no recurrence?";
qCWarning(PIMKOLAB_LOG) <<"no recurrence?";
break;
case Kolab::RecurrenceRule::Yearly:
return KCalCore::RecurrenceRule::rYearly;
......@@ -480,7 +480,7 @@ Kolab::RecurrenceRule::Frequency fromRecurrenceType(KCalCore::RecurrenceRule::Pe
{
switch (freq) {
case KCalCore::RecurrenceRule::rNone:
Warning() << "no recurrence?";
qCWarning(PIMKOLAB_LOG) <<"no recurrence?";
break;
case KCalCore::RecurrenceRule::rYearly:
return Kolab::RecurrenceRule::Yearly;
......@@ -589,7 +589,7 @@ void getRecurrence(T &i, const I &e)
KCalCore::Recurrence *rec = e.recurrence();
KCalCore::RecurrenceRule *defaultRR = rec->defaultRRule(false);
if (!defaultRR) {
Warning() << "no recurrence";
qCWarning(PIMKOLAB_LOG) <<"no recurrence";
return;
}
Q_ASSERT(defaultRR);
......@@ -643,7 +643,7 @@ void getRecurrence(T &i, const I &e)
i.setExceptionDates(exdates);
if (!rec->exRules().empty()) {
Warning() << "exrules are not supported";
qCWarning(PIMKOLAB_LOG) <<"exrules are not supported";
}
}
......@@ -721,7 +721,7 @@ void getTodoEvent(T &i, const I &e)
//TODO KCalCore disables alarms using KCalCore::Alarm::enabled() (X-KDE-KCALCORE-ENABLED) We should either delete the alarm, or store the attribute .
//Ideally we would store the alarm somewhere and temporarily delete it, so we can restore it when parsing. For now we just remove disabled alarms.
if (!a->enabled()) {
Warning() << "skipping disabled alarm";
qCWarning(PIMKOLAB_LOG) <<"skipping disabled alarm";
continue;
}
switch (a->type()) {
......
......@@ -38,7 +38,7 @@ QString TimezoneConverter::normalizeTimezone(const QString &tz)
if (guessedTimezone.isEmpty()) {
guessedTimezone = fromGMTOffsetTimezone(tz);
}
Debug() << "Guessed timezone and found: " << guessedTimezone;
qCDebug(PIMKOLAB_LOG) << "Guessed timezone and found: " << guessedTimezone;
return guessedTimezone;
}
......
......@@ -20,6 +20,7 @@
#include "kolabdefinitions.h"
#include "errorhandler.h"
#include "libkolab-version.h"
#include "pimkolab_debug.h"
#include "kolabbase.h"
#include <kolabformatV2/journal.h>
......@@ -139,12 +140,12 @@ RelationMember parseMemberUrl(const QString &string)
isShared = true;
}
if (start < 0) {
Warning() << "Couldn't find \"user\" or \"shared\" in path: " << path;
qCWarning(PIMKOLAB_LOG) <<"Couldn't find \"user\" or \"shared\" in path: " << path;
return RelationMember();
}
path = path.mid(start + 1);
if (path.size() < 2) {
Warning() << "Incomplete path: " << path;
qCWarning(PIMKOLAB_LOG) <<"Incomplete path: " << path;
return RelationMember();
}
RelationMember member;
......@@ -261,8 +262,8 @@ void KolabObjectReader::setVersion(Version version)
void printMessageDebugInfo(const KMime::Message::Ptr &msg)
{
//TODO replace by Debug stream for Mimemessage
Debug() << "MessageId: " << msg->messageID()->asUnicodeString();
Debug() << "Subject: " << msg->subject()->asUnicodeString();
qCDebug(PIMKOLAB_LOG) << "MessageId: " << msg->messageID()->asUnicodeString();
qCDebug(PIMKOLAB_LOG) << "Subject: " << msg->subject()->asUnicodeString();
// Debug() << msg->encodedContent();
}
......@@ -271,7 +272,7 @@ ObjectType KolabObjectReader::parseMimeMessage(const KMime::Message::Ptr &msg)
ErrorHandler::clearErrors();
d->mObjectType = InvalidObject;
if (msg->contents().isEmpty()) {
Critical() << "message has no contents (we likely failed to parse it correctly)";
qCCritical(PIMKOLAB_LOG) << "message has no contents (we likely failed to parse it correctly)";
printMessageDebugInfo(msg);
return InvalidObject;
}
......@@ -363,17 +364,17 @@ ObjectType KolabObjectReader::parseMimeMessage(const KMime::Message::Ptr &msg)
d->mTagMembers << Conversion::fromStdString(member);
}
} else {
Critical() << "generic relation had wrong number of members:" << relation.members().size();
qCCritical(PIMKOLAB_LOG) << "generic relation had wrong number of members:" << relation.members().size();
printMessageDebugInfo(msg);
}
} else {
Critical() << "unknown configuration object type" << relation.type();
qCCritical(PIMKOLAB_LOG) << "unknown configuration object type" << relation.type();
printMessageDebugInfo(msg);
}
break;
}
default:
Critical() << "no kolab object found ";
qCCritical(PIMKOLAB_LOG) << "no kolab object found ";
printMessageDebugInfo(msg);
break;
}
......@@ -473,7 +474,7 @@ KMime::Message::Ptr KolabObjectWriter::writeEvent(const KCalCore::Event::Ptr &i,
{
ErrorHandler::clearErrors();
if (!i) {
Critical() << "passed a null pointer";
qCCritical(PIMKOLAB_LOG) << "passed a null pointer";
return KMime::Message::Ptr();
}
const Kolab::Event &event = Kolab::Conversion::fromKCalCore(*i);
......@@ -486,7 +487,7 @@ KMime::Message::Ptr KolabObjectWriter::writeTodo(const KCalCore::Todo::Ptr &i, V
{
ErrorHandler::clearErrors();
if (!i) {
Critical() << "passed a null pointer";
qCCritical(PIMKOLAB_LOG) << "passed a null pointer";
return KMime::Message::Ptr();
}
const Kolab::Todo &todo = Kolab::Conversion::fromKCalCore(*i);
......@@ -499,7 +500,7 @@ KMime::Message::Ptr KolabObjectWriter::writeJournal(const KCalCore::Journal::Ptr
{
ErrorHandler::clearErrors();
if (!i) {
Critical() << "passed a null pointer";
qCCritical(PIMKOLAB_LOG) << "passed a null pointer";
return KMime::Message::Ptr();
}
const Kolab::Journal &journal = Kolab::Conversion::fromKCalCore(*i);
......@@ -511,7 +512,7 @@ KMime::Message::Ptr KolabObjectWriter::writeJournal(const KCalCore::Journal::Ptr
KMime::Message::Ptr KolabObjectWriter::writeIncidence(const KCalCore::Incidence::Ptr &i, Version v, const QString &productId, const QString &tz)
{
if (!i) {
Critical() << "passed a null pointer";
qCCritical(PIMKOLAB_LOG) << "passed a null pointer";
return KMime::Message::Ptr();
}
switch (i->type()) {
......@@ -522,7 +523,7 @@ KMime::Message::Ptr KolabObjectWriter::writeIncidence(const KCalCore::Incidence:
case KCalCore::IncidenceBase::TypeJournal:
return writeJournal(i.dynamicCast<KCalCore::Journal>(), v, productId, tz);
default:
Critical() << "unknown incidence type";
qCCritical(PIMKOLAB_LOG) << "unknown incidence type";
}
return KMime::Message::Ptr();
}
......@@ -549,7 +550,7 @@ KMime::Message::Ptr KolabObjectWriter::writeNote(const KMime::Message::Ptr &n, V
{
ErrorHandler::clearErrors();
if (!n) {
Critical() << "passed a null pointer";
qCCritical(PIMKOLAB_LOG) << "passed a null pointer";
return KMime::Message::Ptr();
}
const Kolab::Note &note = Kolab::Conversion::fromNote(n);
......@@ -598,7 +599,7 @@ KMime::Message::Ptr KolabObjectWriter::writeTag(const Akonadi::Tag &tag, const Q
{
ErrorHandler::clearErrors();
if (v != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
}
Kolab::Relation relation(Conversion::toStdString(tag.name()), "tag");
......@@ -616,11 +617,11 @@ KMime::Message::Ptr KolabObjectWriter::writeRelation(const Akonadi::Relation &re
{
ErrorHandler::clearErrors();
if (v != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
}
if (items.size() != 2) {
Critical() << "Wrong number of members for generic relation.";
qCCritical(PIMKOLAB_LOG) << "Wrong number of members for generic relation.";
return KMime::Message::Ptr();
}
......
......@@ -140,7 +140,7 @@ static Kolab::ObjectType getObjectType(const std::string &type)
} else if (type == relationKolabType()) {
return RelationConfigurationObject;
}
Warning() << "Unknown object type: " << type;
qCWarning(PIMKOLAB_LOG) <<"Unknown object type: " << type;
return Kolab::InvalidObject;
}
......@@ -166,7 +166,7 @@ static QByteArray getTypeString(Kolab::ObjectType type)
case RelationConfigurationObject:
return KOLAB_TYPE_RELATION;
default:
Critical() << "unknown type "<< type;
qCCritical(PIMKOLAB_LOG) << "unknown type "<< type;
}
return QByteArray();
}
......@@ -187,7 +187,7 @@ static QByteArray getMimeType(Kolab::ObjectType type)
case RelationConfigurationObject:
return MIME_TYPE_KOLAB;
default:
Critical() << "unknown type "<< type;
qCCritical(PIMKOLAB_LOG) << "unknown type "<< type;
}
return QByteArray();
}
......@@ -206,8 +206,8 @@ static Kolab::ObjectType detectType(const KMime::Message::Ptr &msg)
static void printMessageDebugInfo(const KMime::Message::Ptr &msg)
{
//TODO replace by Debug stream for Mimemessage
Debug() << "MessageId: " << msg->messageID()->asUnicodeString();
Debug() << "Subject: " << msg->subject()->asUnicodeString();
qCDebug(PIMKOLAB_LOG) << "MessageId: " << msg->messageID()->asUnicodeString();
qCDebug(PIMKOLAB_LOG) << "Subject: " << msg->subject()->asUnicodeString();
// Debug() << msg->encodedContent();
}
......@@ -270,7 +270,7 @@ QVariant MIMEObject::Private::readKolabV2(const KMime::Message::Ptr &msg, Kolab:
if (objectType == DictionaryConfigurationObject) {
KMime::Content *xmlContent = Mime::findContentByType(msg, "application/xml");
if (!xmlContent) {
Critical() << "no application/xml part found";
qCCritical(PIMKOLAB_LOG) << "no application/xml part found";
printMessageDebugInfo(msg);
return InvalidObject;
}
......@@ -289,13 +289,13 @@ QVariant MIMEObject::Private::readKolabV2(const KMime::Message::Ptr &msg, Kolab:
}
KMime::Content *xmlContent = Mime::findContentByType(msg, getTypeString(objectType));
if (!xmlContent) {
Critical() << "no part with type" << getTypeString(objectType) << " found";
qCCritical(PIMKOLAB_LOG) << "no part with type" << getTypeString(objectType) << " found";
printMessageDebugInfo(msg);
return QVariant();
}
const QByteArray &xmlData = xmlContent->decodedContent();
if (xmlData.isEmpty()) {
Critical() << "no content in message part with type" << getTypeString(objectType);
qCCritical(PIMKOLAB_LOG) << "no content in message part with type" << getTypeString(objectType);
printMessageDebugInfo(msg);
return QVariant();
}
......@@ -372,7 +372,7 @@ QVariant MIMEObject::Private::readKolabV3(const KMime::Message::Ptr &msg, Kolab:
{
KMime::Content *const xmlContent = Mime::findContentByType(msg, getMimeType(objectType));
if (!xmlContent) {
Critical() << "no " << getMimeType(objectType) << " part found";
qCCritical(PIMKOLAB_LOG) << "no " << getMimeType(objectType) << " part found";
printMessageDebugInfo(msg);
return InvalidObject;
}
......@@ -418,7 +418,7 @@ QVariant MIMEObject::Private::readKolabV3(const KMime::Message::Ptr &msg, Kolab:
variant = QVariant::fromValue<Kolab::Configuration>(Kolab::readConfiguration(xml, false));
break;
default:
Critical() << "no kolab object found ";
qCCritical(PIMKOLAB_LOG) << "no kolab object found ";
printMessageDebugInfo(msg);
break;
}
......@@ -436,7 +436,7 @@ QVariant MIMEObject::Private::parseMimeMessage(const KMime::Message::Ptr &msg)
ErrorHandler::clearErrors();
mObjectType = InvalidObject;
if (msg->contents().isEmpty()) {
Critical() << "message has no contents (we likely failed to parse it correctly)";
qCCritical(PIMKOLAB_LOG) << "message has no contents (we likely failed to parse it correctly)";
printMessageDebugInfo(msg);
return QVariant();
}
......@@ -445,7 +445,7 @@ QVariant MIMEObject::Private::parseMimeMessage(const KMime::Message::Ptr &msg)
if (KMime::Headers::Base *xKolabHeader = msg->headerByType(X_KOLAB_TYPE_HEADER)) {
objectType = getObjectType(xKolabHeader->asUnicodeString().trimmed().toStdString());
} else {
Warning() << "could not find the X-Kolab-Type Header, trying autodetection";
qCWarning(PIMKOLAB_LOG) <<"could not find the X-Kolab-Type Header, trying autodetection";
//This works only for v2 messages atm.
objectType = detectType(msg);
}
......@@ -453,7 +453,7 @@ QVariant MIMEObject::Private::parseMimeMessage(const KMime::Message::Ptr &msg)
objectType = mOverrideObjectType;
}
if (objectType == InvalidObject) {
Critical() << "unable to detect object type";
qCCritical(PIMKOLAB_LOG) << "unable to detect object type";
printMessageDebugInfo(msg);
return QVariant();
}
......@@ -468,7 +468,7 @@ QVariant MIMEObject::Private::parseMimeMessage(const KMime::Message::Ptr &msg)
mVersion = KolabV2;
} else {
if (xKolabVersion->asUnicodeString() != KOLAB_VERSION_V3) { //TODO version compatibility check?
Warning() << "Kolab Version Header available but not on the same version as the implementation: " << xKolabVersion->asUnicodeString();
qCWarning(PIMKOLAB_LOG) <<"Kolab Version Header available but not on the same version as the implementation: " << xKolabVersion->asUnicodeString();
}
mVersion = KolabV3;
}
......@@ -790,7 +790,7 @@ std::string MIMEObject::writeConfiguration(const Configuration &configuration, V
if (version == KolabV3) {
msg = Mime::createMessage(kolabMimeType(), kolabType, xml, true, productId, std::string(), std::string(), configuration.uid());
} else if (version == KolabV2) {
Critical() << "Not available in KolabV2";
qCCritical(PIMKOLAB_LOG) << "Not available in KolabV2";
}
msg->assemble();
return msg->encodedContent().data();
......@@ -812,7 +812,7 @@ std::string MIMEObject::writeFreebusy(const Freebusy &freebusy, Version version,
if (version == KolabV3) {
msg = Mime::createMessage(xCalMimeType(), freebusyKolabType(), xml, true, productId, std::string(), std::string(), freebusy.uid());
} else if (version == KolabV2) {
Critical() << "Not available in KolabV2";
qCCritical(PIMKOLAB_LOG) << "Not available in KolabV2";
}
msg->assemble();
return msg->encodedContent().data();
......
......@@ -47,26 +47,26 @@ void getAttachments(KCalCore::Incidence::Ptr incidence, const QStringList &attac
QByteArray type;
KMime::Content *content = Mime::findContentByName(mimeData, name, type);
if (!content) { // guard against malformed events with non-existent attachments
Warning() << "could not find attachment: "<< name.toUtf8() << type;
qCWarning(PIMKOLAB_LOG) <<"could not find attachment: "<< name.toUtf8() << type;
continue;
}
const QByteArray c = content->decodedContent().toBase64();
KCalCore::Attachment::Ptr attachment(new KCalCore::Attachment(c, QString::fromLatin1(type)));
attachment->setLabel(name);
incidence->addAttachment(attachment);
Debug() << "ATTACHMENT NAME" << name << type;
qCDebug(PIMKOLAB_LOG) << "ATTACHMENT NAME" << name << type;
}
}
static QImage getPicture(const QString &pictureAttachmentName, const KMime::Message::Ptr &data, QByteArray &type)
{
if (!data) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return QImage();
}
KMime::Content *imgContent = Mime::findContentByName(data, pictureAttachmentName /*"kolab-picture.png"*/, type);
if (!imgContent) {
Warning() << "could not find picture: " << pictureAttachmentName;
qCWarning(PIMKOLAB_LOG) <<"could not find picture: " << pictureAttachmentName;
return QImage();
}
QByteArray imgData = imgContent->decodedContent();
......@@ -96,7 +96,7 @@ static QImage getPicture(const QString &pictureAttachmentName, const KMime::Mess
}
buffer.close();
if (!success) {
Warning() << "failed to load picture";
qCWarning(PIMKOLAB_LOG) <<"failed to load picture";
}
return image;
}
......@@ -104,11 +104,11 @@ static QImage getPicture(const QString &pictureAttachmentName, const KMime::Mess
KContacts::Addressee addresseeFromKolab(const QByteArray &xmlData, const KMime::Message::Ptr &data)
{
if (!data) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return KContacts::Addressee();
}
KContacts::Addressee addressee;
// Debug() << "xmlData " << xmlData;
// qCDebug(PIMKOLAB_LOG) << "xmlData " << xmlData;
KolabV2::Contact contact(QString::fromUtf8(xmlData));
QByteArray type;
const QString &pictureAttachmentName = contact.pictureAttachmentName();
......@@ -130,7 +130,7 @@ KContacts::Addressee addresseeFromKolab(const QByteArray &xmlData, const KMime::
const QByteArray &sData = content->decodedContent();
contact.setSound(sData);
} else {
Warning() << "could not find sound: " << soundAttachmentName;
qCWarning(PIMKOLAB_LOG) <<"could not find sound: " << soundAttachmentName;
}
}
contact.saveTo(&addressee);
......@@ -169,7 +169,7 @@ KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact &contact, const
{
KMime::Message::Ptr message = Mime::createMessage(QByteArray(KOLAB_TYPE_CONTACT), false, productId.toLatin1());
if (!message) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return KMime::Message::Ptr();
}
message->subject()->fromUnicodeString(contact.uid(), "utf-8");
......@@ -214,7 +214,7 @@ KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList &distL
{
KMime::Message::Ptr message = Mime::createMessage(KOLAB_TYPE_DISTLIST_V2, false, productId.toLatin1());
if (!message) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return KMime::Message::Ptr();
}
message->subject()->fromUnicodeString(distList.uid(), "utf-8");
......@@ -231,7 +231,7 @@ KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &cr
{
KolabV2::Note j;
if (!j.load(QString::fromUtf8(xmlData))) {
Warning() << "failed to read note";
qCWarning(PIMKOLAB_LOG) <<"failed to read note";
return KMime::Message::Ptr();
}
......@@ -246,7 +246,7 @@ KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &cr
KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr &msg, const QString &productId)
{
if (!msg) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return KMime::Message::Ptr();
}
Akonadi::NoteUtils::NoteMessageWrapper note(msg);
......@@ -256,7 +256,7 @@ KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr &msg, const QString &p
QByteArray noteToKolabXML(const KMime::Message::Ptr &msg)
{
if (!msg) {
Critical() << "empty message";
qCCritical(PIMKOLAB_LOG) << "empty message";
return QByteArray();
}
Akonadi::NoteUtils::NoteMessageWrapper note(msg);
......
......@@ -52,7 +52,7 @@ std::string XMLObject::writeEvent(const Event &event, Version version, const std
if (version == KolabV2) {
const KCalCore::Event::Ptr i = Conversion::toKCalCore(event);
if (!i) {
Critical() << "invalid incidence";
qCCritical(PIMKOLAB_LOG) << "invalid incidence";
return std::string();
}
if (i->uid().isEmpty()) {
......@@ -75,7 +75,7 @@ Event XMLObject::readEvent(const std::string &s, Version version)
QStringList attachments;
const KCalCore::Event::Ptr event = Kolab::fromXML<KCalCore::Event::Ptr, KolabV2::Event>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
if (!event || Kolab::ErrorHandler::errorOccured()) {
Critical() << "failed to read xml";
qCCritical(PIMKOLAB_LOG) << "failed to read xml";
return Event();
}
mAttachments.clear();
......@@ -96,7 +96,7 @@ std::string XMLObject::writeTodo(const Todo &event, Version version, const std::
if (version == KolabV2) {
const KCalCore::Todo::Ptr i = Conversion::toKCalCore(event);
if (!i) {
Critical() << "invalid incidence";
qCCritical(PIMKOLAB_LOG) << "invalid incidence";
return std::string();
}
if (i->uid().isEmpty()) {
......@@ -140,7 +140,7 @@ std::string XMLObject::writeJournal(const Journal &event, Version version, const
if (version == KolabV2) {
const KCalCore::Journal::Ptr i = Conversion::toKCalCore(event);
if (!i) {
Critical() << "invalid journal";
qCCritical(PIMKOLAB_LOG) << "invalid journal";
return std::string();
}
if (i->uid().isEmpty()) {
......@@ -162,7 +162,7 @@ Journal XMLObject::readJournal(const std::string &s, Version version)
QStringList attachments;
const KCalCore::Journal::Ptr event = Kolab::fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
if (!event || Kolab::ErrorHandler::errorOccured()) {
Critical() << "failed to read xml";
qCCritical(PIMKOLAB_LOG) << "failed to read xml";
return Journal();
}
mAttachments.clear();
......@@ -181,7 +181,7 @@ std::string XMLObject::writeFreebusy(const Freebusy &event, Version version, con
{
mWrittenUID.clear();
if (version != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
return std::string();
}
const std::string result = Kolab::writeFreebusy(event, productId);
......@@ -192,7 +192,7 @@ std::string XMLObject::writeFreebusy(const Freebusy &event, Version version, con
Freebusy XMLObject::readFreebusy(const std::string &s, Version version)
{
if (version != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
return Freebusy();
}
return Kolab::readFreebusy(s, false);
......@@ -285,7 +285,7 @@ Note XMLObject::readNote(const std::string &s, Version version)
if (version == KolabV2) {
const KMime::Message::Ptr msg = noteFromKolab(QByteArray(s.c_str(), s.length()), KDateTime());
if (!msg || Kolab::ErrorHandler::errorOccured()) {
Critical() << "failed to read xml";
qCCritical(PIMKOLAB_LOG) << "failed to read xml";
return Note();
}
return Conversion::fromNote(msg);
......@@ -320,7 +320,7 @@ Configuration XMLObject::readConfiguration(const std::string &s, Version version
QString lang;
const QStringList dict = readLegacyDictionaryConfiguration(QByteArray(s.c_str(), s.length()), lang);
if (lang.isEmpty()) {
Critical() << "not a dictionary or not a v2 configuration object";
qCCritical(PIMKOLAB_LOG) << "not a dictionary or not a v2 configuration object";
return Kolab::Configuration();
}
std::vector<std::string> entries;
......@@ -341,7 +341,7 @@ std::string XMLObject::writeConfiguration(const Configuration &configuration, Ve
{
mWrittenUID.clear();
if (version != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
return std::string();
}
const std::string result = Kolab::writeConfiguration(configuration, productId);
......@@ -353,7 +353,7 @@ std::string XMLObject::writeConfiguration(const Configuration &configuration, Ve
File XMLObject::readFile(const std::string &s, Version version)
{
if (version == KolabV2) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
return File();
}
const Kolab::File file = Kolab::readFile(s, false);
......@@ -365,7 +365,7 @@ std::string XMLObject::writeFile(const File &file, Version version, const std::s
{
mWrittenUID.clear();
if (version != KolabV3) {
Critical() << "only v3 implementation available";
qCCritical(PIMKOLAB_LOG) << "only v3 implementation available";
return std::string();
}
const std::string result = Kolab::writeFile(file, productId);
......
......@@ -220,7 +220,7 @@ Kolab::Attachment getAttachmentByName(const QString &name, const KMime::Message:
QByteArray type;
KMime::Content *content = findContentByName(mimeData, name, type);
if (!content) { // guard against malformed events with non-existent attachments
Warning() << "could not find attachment: "<< name.toUtf8() << type;
qCWarning(PIMKOLAB_LOG) <<"could not find attachment: "<< name.toUtf8() << type;
return Kolab::Attachment();
}
Kolab::Attachment attachment;
......
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