Commit cb3191c5 authored by Volker Krause's avatar Volker Krause
Browse files

Remove support for legacy messaging address fields in favor of Impp

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D22449
parent a14ceb65
......@@ -19,8 +19,6 @@
#include "contactgrantleewrapper.h"
#include <contacteditor/improtocols.h>
#include <Libkleo/Enum>
#include <KLocalizedString>
......@@ -135,30 +133,4 @@ QString ContactGrantleeWrapper::formattedAnniversary() const
return QLocale().toString(anniversary());
}
static QVariantHash imAddressHash(const QString &typeKey, const QString &imAddress)
{
QVariantHash addressObject;
addressObject.insert(QStringLiteral("serviceLabel"), IMProtocols::self()->name(typeKey));
addressObject.insert(QStringLiteral("address"), imAddress);
addressObject.insert(QStringLiteral("serviceIcon"), IMProtocols::self()->icon(typeKey));
return addressObject;
}
QVariantList ContactGrantleeWrapper::imAddresses() const
{
QVariantList imAddrs;
const QStringList customs = this->customs();
for (const QString &custom : customs) {
if (custom.startsWith(QLatin1String("messaging/"))) {
const int pos = custom.indexOf(QLatin1Char(':'));
QString key = custom.left(pos);
key.remove(QStringLiteral("-All"));
const QString value = custom.mid(pos + 1);
imAddrs.append(imAddressHash(key, value));
}
}
return imAddrs;
}
#include "moc_contactgrantleewrapper.cpp"
......@@ -55,9 +55,6 @@ class ContactGrantleeWrapper : public KContacts::Addressee
Q_PROPERTY(QString formattedBirthday READ formattedBirthday)
Q_PROPERTY(QString formattedAnniversary READ formattedAnniversary)
// ### this is temporary, until KContacts::Impp takes over this part
Q_PROPERTY(QVariantList imAddresses READ imAddresses)
public:
ContactGrantleeWrapper();
ContactGrantleeWrapper(const KContacts::Addressee &addr);
......
......@@ -59,6 +59,7 @@ using namespace KAddressBookGrantlee;
GRANTLEE_MAKE_GADGET(KContacts::Address)
GRANTLEE_MAKE_GADGET(KContacts::Email)
GRANTLEE_MAKE_GADGET(KContacts::Impp)
GRANTLEE_MAKE_GADGET(KContacts::PhoneNumber)
GRANTLEE_MAKE_GADGET(KContacts::ResourceLocatorUrl)
GRANTLEE_MAKE_GADGET(KAddressBookGrantlee::ContactGrantleeWrapper)
......@@ -66,6 +67,8 @@ GRANTLEE_MAKE_GADGET(KAddressBookGrantlee::ContactGrantleeWrapper)
GRANTLEE_BEGIN_LOOKUP(QUrl)
if (property == QLatin1String("scheme")) {
return object.scheme();
} else if (property == QLatin1String("path")) {
return object.path();
}
GRANTLEE_END_LOOKUP
......@@ -121,6 +124,7 @@ GrantleeContactFormatter::GrantleeContactFormatter()
{
Grantlee::registerMetaType<KContacts::Address>();
Grantlee::registerMetaType<KContacts::Email>();
Grantlee::registerMetaType<KContacts::Impp>();
Grantlee::registerMetaType<KContacts::PhoneNumber>();
Grantlee::registerMetaType<KContacts::ResourceLocatorUrl>();
Grantlee::registerMetaType<ContactGrantleeWrapper>();
......
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