Changeset View
Changeset View
Standalone View
Standalone View
src/contacts/contactsservice.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <https://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "contactsservice.h" | 21 | #include "contactsservice.h" | ||
22 | #include "contact.h" | 22 | #include "contact.h" | ||
23 | #include "contactsgroup.h" | 23 | #include "contactsgroup.h" | ||
24 | #include "utils.h" | ||||
24 | #include "../debug.h" | 25 | #include "../debug.h" | ||
25 | 26 | | |||
26 | #include <QDomDocument> | 27 | #include <QDomDocument> | ||
27 | #include <QDomElement> | 28 | #include <QDomElement> | ||
28 | #include <QJsonDocument> | 29 | #include <QJsonDocument> | ||
29 | #include <QUrlQuery> | 30 | #include <QUrlQuery> | ||
30 | 31 | | |||
31 | /* Qt::escape() */ | 32 | /* Qt::escape() */ | ||
▲ Show 20 Lines • Show All 682 Lines • ▼ Show 20 Line(s) | 593 | { | |||
714 | const QString im_str = QStringLiteral("<gd:im address=\"%1\" protocol=\"%2\" rel=\"http://schemas.google.com/g/2005#other\" primary=\"%3\"/>"); | 715 | const QString im_str = QStringLiteral("<gd:im address=\"%1\" protocol=\"%2\" rel=\"http://schemas.google.com/g/2005#other\" primary=\"%3\"/>"); | ||
715 | Q_FOREACH(const QString &im, contact->customs()) { | 716 | Q_FOREACH(const QString &im, contact->customs()) { | ||
716 | if (im.startsWith(QLatin1String("messaging/"))) { | 717 | if (im.startsWith(QLatin1String("messaging/"))) { | ||
717 | QString key = im.left(im.indexOf(QLatin1Char(':'))); | 718 | QString key = im.left(im.indexOf(QLatin1Char(':'))); | ||
718 | QString value = im.mid(im.indexOf(QLatin1Char(':')) + 1); | 719 | QString value = im.mid(im.indexOf(QLatin1Char(':')) + 1); | ||
719 | QString proto = key.mid(10); | 720 | QString proto = key.mid(10); | ||
720 | proto.chop(4); | 721 | proto.chop(4); | ||
721 | bool primary = (contact->custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-IMAddress")) == value); | 722 | bool primary = (contact->custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-IMAddress")) == value); | ||
722 | output.append(im_str.arg(value, Contact::IMProtocolNameToScheme(proto), | 723 | output.append(im_str.arg(value, Contact::IMProtocolNameToScheme(proto), Utils::bool2Str(primary)).toUtf8()); | ||
723 | (primary ? QStringLiteral("true") : QStringLiteral("false"))).toUtf8()); | | |||
724 | parsedCustoms << key; | 724 | parsedCustoms << key; | ||
725 | /* X-messaging is probably a new key (?) used by KAddressbook when importing | 725 | /* X-messaging is probably a new key (?) used by KAddressbook when importing | ||
726 | * contacts from vCard. */ | 726 | * contacts from vCard. */ | ||
727 | } else if (im.startsWith(QLatin1String("X-messaging"))) { | 727 | } else if (im.startsWith(QLatin1String("X-messaging"))) { | ||
728 | const QString key = im.left(im.indexOf(QLatin1Char(':'))); | 728 | const QString key = im.left(im.indexOf(QLatin1Char(':'))); | ||
729 | const QString value = im.mid(im.indexOf(QLatin1Char(':')) + 1); | 729 | const QString value = im.mid(im.indexOf(QLatin1Char(':')) + 1); | ||
730 | QString proto = key.mid(12); /* strlen("X-messaging/") */ | 730 | QString proto = key.mid(12); /* strlen("X-messaging/") */ | ||
731 | if (proto.endsWith(QLatin1String("-All"))) { | 731 | if (proto.endsWith(QLatin1String("-All"))) { | ||
▲ Show 20 Lines • Show All 487 Lines • Show Last 20 Lines |