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 3b54d8a7 authored by Laurent Montel's avatar Laurent Montel 😁

Fix error when generate contact

parent 068e7691
......@@ -43,6 +43,8 @@ Q_DECLARE_METATYPE(Kolab::Version)
do { \
if (!(actual.simplified() == expected.simplified())) { \
qDebug() << "Content not the same."; \
qDebug() << "actual." << actual.simplified() << "\n"; \
qDebug() << "expected." << expected.simplified(); \
showDiff(expected, actual); \
QTest::qFail("Compared versions differ.", __FILE__, __LINE__); \
return; \
......@@ -112,6 +114,7 @@ void normalizeMimemessage(QString &content)
content.replace(QRegExp("\\bLibkolab-\\d.\\d.\\d\\b", Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x"));
content.replace(QRegExp("\\bLibkolabxml-\\d.\\d.\\d\\b", Qt::CaseSensitive), QStringLiteral("Libkolabxml-x.x.x"));
content.replace(QRegExp("\\bLibkolab-\\d.\\d\\b", Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x"));
content.replace(QRegExp("\\bkdepim-runtime-\\d.\\d\\b", Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x"));
content.replace(QRegExp("\\bLibkolabxml-\\d.\\d\\b", Qt::CaseSensitive), QStringLiteral("Libkolabxml-x.x.x"));
content.replace(QRegExp("<uri>cid:*@kolab.resource.akonadi</uri>", Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("<uri>cid:id@kolab.resource.akonadi</uri>"));
content.replace(QRegExp("Content-ID: <*@kolab.resource.akonadi>", Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("Content-ID: <id@kolab.resource.akonadi>"));
......
......@@ -758,15 +758,17 @@ Kolab::Contact fromKABC(const KContacts::Addressee &addressee)
int prefEmail = -1;
int count = 0;
std::vector<Kolab::Email> emails;
emails.resize(addressee.emails().count());
emails.reserve(addressee.emails().count());
foreach (const QString &e, addressee.emails()) {
if ((prefEmail == -1) && (e == addressee.preferredEmail())) {
prefEmail = count;
}
count++;
emails.push_back(Kolab::Email(toStdString(e), emailTypesFromStringlist(addressee.custom(QStringLiteral("KOLAB"), QStringLiteral("EmailTypes%1").arg(e)))));
emails.push_back(Kolab::Email(toStdString(e),
emailTypesFromStringlist(addressee.custom(QStringLiteral("KOLAB"), QStringLiteral("EmailTypes%1").arg(e)))));
}
c.setEmailAddresses(emails, prefEmail);
if (addressee.geo().isValid()) {
c.setGPSpos(std::vector<Kolab::Geo>() << Kolab::Geo(addressee.geo().latitude(), addressee.geo().longitude()));
}
......
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