File indexing completed on 2025-02-16 04:45:49
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <KContacts/Addressee> 0010 0011 namespace KAddressBookGrantlee 0012 { 0013 /** 0014 * Additional properties for the KContacts::Addressee Grantlee model. 0015 */ 0016 class ContactGrantleeWrapper : public KContacts::Addressee 0017 { 0018 Q_GADGET 0019 // ### those probably should eventually become i18n calls in the template itself 0020 Q_PROPERTY(QString addressBookLabel READ addressBookLabel) 0021 Q_PROPERTY(QString anniversaryLabel READ anniversaryLabel) 0022 Q_PROPERTY(QString assistantLabel READ assistantLabel) 0023 Q_PROPERTY(QString birthdayLabel READ birthdayLabel) 0024 Q_PROPERTY(QString departmentLabel READ departmentLabel) 0025 Q_PROPERTY(QString noteLabel READ noteLabel) 0026 Q_PROPERTY(QString managerLabel READ managerLabel) 0027 Q_PROPERTY(QString officeLabel READ officeLabel) 0028 Q_PROPERTY(QString professionLabel READ professionLabel) 0029 Q_PROPERTY(QString spouseLabel READ spouseLabel) 0030 0031 Q_PROPERTY(QString addressBookName READ addressBookName) 0032 Q_PROPERTY(int age READ age) 0033 0034 // ### this shouldn't be returning assembled HTML, that's a job for Grantlee 0035 Q_PROPERTY(QString photo READ photoImgElement) 0036 Q_PROPERTY(QString logo READ logoImgElement) 0037 0038 // ### those two would be unnecessary if we had a proper way for formatting dates in Grantlee 0039 Q_PROPERTY(QString formattedBirthday READ formattedBirthday) 0040 Q_PROPERTY(QString formattedAnniversary READ formattedAnniversary) 0041 0042 public: 0043 ContactGrantleeWrapper(); 0044 ContactGrantleeWrapper(const KContacts::Addressee &addr); 0045 0046 private: 0047 [[nodiscard]] QString addressBookLabel() const; 0048 [[nodiscard]] QString anniversaryLabel() const; 0049 [[nodiscard]] QString assistantLabel() const; 0050 [[nodiscard]] QString managerLabel() const; 0051 [[nodiscard]] QString officeLabel() const; 0052 [[nodiscard]] QString professionLabel() const; 0053 [[nodiscard]] QString spouseLabel() const; 0054 0055 [[nodiscard]] QString addressBookName() const; 0056 [[nodiscard]] int age() const; 0057 0058 [[nodiscard]] QString photoImgElement() const; 0059 [[nodiscard]] QString logoImgElement() const; 0060 0061 [[nodiscard]] QString formattedBirthday() const; 0062 [[nodiscard]] QString formattedAnniversary() const; 0063 }; 0064 0065 }