Commit 431cc5ea authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile with last kcontact api

parent 1f2f62d9
Pipeline #91008 failed with stage
in 25 minutes and 4 seconds
......@@ -7,10 +7,10 @@
#include "kabcconversion.h"
#include "commonconversion.h"
#include "pimkolab_debug.h"
#include <QBuffer>
#include <QImageReader>
#include "pimkolab_debug.h"
#include <kcontacts_version.h>
namespace Kolab
{
namespace Conversion
......@@ -461,7 +461,13 @@ KContacts::Addressee toKABC(const Kolab::Contact &contact)
} else {
preferredEmail = fromStdString(contact.emailAddresses().at(0).address());
}
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
addressee.insertEmail(preferredEmail, true);
#else
KContacts::Email email(preferredEmail);
email.setPreferred(true);
addressee.addEmail(email);
#endif
}
if (!contact.freeBusyUrl().empty()) {
......
......@@ -18,7 +18,7 @@
#include <QDomElement>
#include <QImage>
#include <QRegularExpression>
#include <kcontacts_version.h>
using namespace OXA;
void OXA::ContactUtils::parseContact(const QDomElement &propElement, Object &object)
......@@ -183,9 +183,20 @@ void OXA::ContactUtils::parseContact(const QDomElement &propElement, Object &obj
contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Office"), text);
// communication
} else if (tagName == QLatin1String("email1")) {
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact.insertEmail(text, true);
#else
KContacts::Email email(text);
email.setPreferred(true);
contact.addEmail(email);
#endif
} else if (tagName == QLatin1String("email2") || tagName == QLatin1String("email3")) {
#if KContacts_VERSION < QT_VERSION_CHECK(5, 88, 0)
contact.insertEmail(text);
#else
KContacts::Email email(text);
contact.addEmail(email);
#endif
} else if (tagName == QLatin1String("mobile1")) {
contact.insertPhoneNumber(KContacts::PhoneNumber(text, KContacts::PhoneNumber::Cell));
} else if (tagName == QLatin1String("instant_messenger")) {
......
Supports Markdown
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