diff --git a/src/addressee.h b/src/addressee.h --- a/src/addressee.h +++ b/src/addressee.h @@ -1059,6 +1059,97 @@ void setClientPidMapList(const ClientPidMap::List &clientpidmaplist); void insertClientPidMap(const ClientPidMap &clientpidmap); + /** + * Returns the contact's anniversary date. + * @note This is a non-standard extension using the @c X-Anniversary field. + * @since 5.12 + */ + QDate anniversary() const; + /** + * Sets the contact's anniversary date. + * @note This is a non-standard extension using the @c X-Anniversary field. + * @since 5.12 + */ + void setAnniversary(const QDate &anniversary); + + /** + * Returns the contact's assistant's name. + * @note This is a non-standard extension using the @c X-AssistantsName field. + * @since 5.12 + */ + QString assistantsName() const; + /** + * Set the contact's assistant's name. + * @note This is a non-standard extension using the @c X-AssistantsName field. + * @since 5.12 + */ + void setAssistantsName(const QString &assistantsName); + + /** + * Returns the contact's blog feed. + * @note This is a non-standard extension using the @c BlogFeed field. + * @since 5.12 + */ + QString blogFeed() const; + /** + * Set the contact's blog feed. + * @note This is a non-standard extension using the @c BlogFeed field. + * @since 5.12 + */ + void setBlogFeed(const QString &blogFeed); + + /** + * Returns the contact's manager's name. + * @note This is a non-standard extension using the @c X-ManagersName field. + * @since 5.12 + */ + QString managersName() const; + /** + * Set the contact's manager's name. + * @note This is a non-standard extension using the @c X-ManagersName field. + * @since 5.12 + */ + void setManagersName(const QString &managersName); + + /** + * Returns the contact's office. + * @note This is a non-standard extension using the @c X-Office field. + * @since 5.12 + */ + QString office() const; + /** + * Set the contact's office. + * @note This is a non-standard extension using the @c X-Office field. + * @since 5.12 + */ + void setOffice(const QString &office); + + /** + * Returns the contact's profession. + * @note This is a non-standard extension using the @c X-Profession field. + * @since 5.12 + */ + QString profession() const; + /** + * Set the contact's profession. + * @note This is a non-standard extension using the @c X-Profession field. + * @since 5.12 + */ + void setProfession(const QString &profession); + + /** + * Returns the contact's spouse's name. + * @note This is a non-standard extension using the @c X-SpousesName field. + * @since 5.12 + */ + QString spousesName() const; + /** + * Set the contact's spouse's name. + * @note This is a non-standard extension using the @c X-SpousesName field. + * @since 5.12 + */ + void setSpousesName(const QString &spousesName); + private: class Private; QSharedDataPointer d; diff --git a/src/addressee.cpp b/src/addressee.cpp --- a/src/addressee.cpp +++ b/src/addressee.cpp @@ -20,6 +20,7 @@ Boston, MA 02110-1301, USA. */ +#include #include #include #include @@ -2147,6 +2148,113 @@ return d->mRelationShips; } +static const auto VENDOR_ID = QStringLiteral("KADDRESSBOOK"); +static const auto X_ANNIVERSARY = QStringLiteral("X-Anniversary"); +static const auto X_ASSISTANTSNAME = QStringLiteral("X-AssistantsName"); +static const auto BLOGFEED = QStringLiteral("BlogFeed"); +static const auto X_MANAGERSNAME = QStringLiteral("X-ManagersName"); +static const auto X_OFFICE = QStringLiteral("X-Office"); +static const auto X_PROFESSION = QStringLiteral("X-Profession"); +static const auto X_SPOUSESNAME = QStringLiteral("X-SpousesName"); + +QDate Addressee::anniversary() const +{ + return QDate::fromString(custom(VENDOR_ID, X_ANNIVERSARY), Qt::ISODate); +} + +void Addressee::setAnniversary(const QDate &anniversary) +{ + if (anniversary.isValid()) { + insertCustom(VENDOR_ID, X_ANNIVERSARY, anniversary.toString(Qt::ISODate)); + } else { + removeCustom(VENDOR_ID, X_ANNIVERSARY); + } +} + +QString Addressee::assistantsName() const +{ + return custom(VENDOR_ID, X_ASSISTANTSNAME); +} + +void Addressee::setAssistantsName(const QString &assistantsName) +{ + if (!assistantsName.isEmpty()) { + insertCustom(VENDOR_ID, X_ASSISTANTSNAME, assistantsName); + } else { + removeCustom(VENDOR_ID, X_ASSISTANTSNAME); + } +} + +QString Addressee::blogFeed() const +{ + return custom(VENDOR_ID, BLOGFEED); +} + +void Addressee::setBlogFeed(const QString &blogFeed) +{ + if (!blogFeed.isEmpty()) { + insertCustom(VENDOR_ID, BLOGFEED, blogFeed); + } else { + removeCustom(VENDOR_ID, BLOGFEED); + } +} + +QString Addressee::managersName() const +{ + return custom(VENDOR_ID, X_MANAGERSNAME); +} + +void Addressee::setManagersName(const QString &managersName) +{ + if (!managersName.isEmpty()) { + insertCustom(VENDOR_ID, X_MANAGERSNAME, managersName); + } else { + removeCustom(VENDOR_ID, X_MANAGERSNAME); + } +} + +QString Addressee::office() const +{ + return custom(VENDOR_ID, X_OFFICE); +} + +void Addressee::setOffice(const QString &office) +{ + if (!office.isEmpty()) { + insertCustom(VENDOR_ID, X_OFFICE, office); + } else { + removeCustom(VENDOR_ID, X_OFFICE); + } +} + +QString Addressee::profession() const +{ + return custom(VENDOR_ID, X_PROFESSION); +} + +void Addressee::setProfession(const QString &profession) +{ + if (!profession.isEmpty()) { + insertCustom(VENDOR_ID, X_PROFESSION, profession); + } else { + removeCustom(VENDOR_ID, X_PROFESSION); + } +} + +QString Addressee::spousesName() const +{ + return custom(VENDOR_ID, X_SPOUSESNAME); +} + +void Addressee::setSpousesName(const QString &spousesName) +{ + if (!spousesName.isEmpty()) { + insertCustom(VENDOR_ID, X_SPOUSESNAME, spousesName); + } else { + removeCustom(VENDOR_ID, X_SPOUSESNAME); + } +} + void Addressee::insertCustom(const QString &app, const QString &name, const QString &value) { if (value.isEmpty() || name.isEmpty() || app.isEmpty()) {