Commit 0c2e8730 authored by Laurent Montel's avatar Laurent Montel 😁

Add preferred

parent 781ee8c8
......@@ -37,6 +37,13 @@ QString ContactGrantleePrintEmail::email() const
return mAddressee.fullEmail(email);
}
bool ContactGrantleePrintEmail::preferred() const
{
const QStringList value = mEmail.parameters().value(QStringLiteral("type"));
//Validate PREF and pref
return value.contains(QStringLiteral("pref"), Qt::CaseInsensitive);
}
QString ContactGrantleePrintEmail::emailFormatted() const
{
const QString email = mEmail.mail();
......
......@@ -30,12 +30,14 @@ class ContactGrantleePrintEmail : public QObject
Q_OBJECT
Q_PROPERTY(QString emailFormatted READ emailFormatted)
Q_PROPERTY(QString email READ email)
Q_PROPERTY(bool preferred READ preferred)
public:
explicit ContactGrantleePrintEmail(const KContacts::Addressee &addressee, const KContacts::Email &email, QObject *parent = Q_NULLPTR);
~ContactGrantleePrintEmail();
QString emailFormatted() const;
QString email() const;
bool preferred() const;
private:
KContacts::Email mEmail;
KContacts::Addressee mAddressee;
......
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