Commit 0402c47c authored by Laurent Montel's avatar Laurent Montel 😁

Add more object type

parent b9bf2d00
......@@ -36,6 +36,17 @@ AddressGrantleeObject::~AddressGrantleeObject()
}
QString AddressGrantleeObject::formattedAddress() const
{
QString str;
if (mAddress.label().isEmpty()) {
str = mAddress.formattedAddress().trimmed().toHtmlEscaped();
} else {
str = mAddress.label().toHtmlEscaped();
}
return str;
}
QString AddressGrantleeObject::removeAddressAction() const
{
//TODO
......@@ -47,3 +58,14 @@ QString AddressGrantleeObject::modifyAddressAction() const
//TODO
return {};
}
QString AddressGrantleeObject::type() const
{
//TODO
return {};
}
bool AddressGrantleeObject::preferredAddress() const
{
return (mAddress.type() & KContacts::Address::Pref);
}
......@@ -30,12 +30,18 @@ class AddressGrantleeObject : public QObject
Q_OBJECT
Q_PROPERTY(QString removeAddressAction READ removeAddressAction)
Q_PROPERTY(QString modifyAddressAction READ modifyAddressAction)
Q_PROPERTY(QString formattedAddress READ formattedAddress)
Q_PROPERTY(QString type READ type)
Q_PROPERTY(bool preferredAddress READ preferredAddress)
public:
explicit AddressGrantleeObject(const KContacts::Address &address, int addressIndex, QObject *parent = Q_NULLPTR);
~AddressGrantleeObject();
QString removeAddressAction() const;
QString modifyAddressAction() const;
QString formattedAddress() const;
QString type() const;
bool preferredAddress() const;
private:
KContacts::Address mAddress;
int mAddressIndex;
......
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