File indexing completed on 2024-12-22 03:46:49
0001 /* 0002 This file is part of the KTextTemplate library 0003 0004 SPDX-FileCopyrightText: 2010 Stephen Kelly <steveire@gmail.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 0008 */ 0009 0010 #ifndef CONTACT_H 0011 #define CONTACT_H 0012 0013 #include <QDate> 0014 #include <QListWidget> 0015 #include <QObject> 0016 0017 class Address : public QObject 0018 { 0019 Q_OBJECT 0020 Q_PROPERTY(int houseNumber READ houseNumber) 0021 Q_PROPERTY(QString streetName READ streetName) 0022 Q_PROPERTY(QString city READ city) 0023 public: 0024 Address(QObject *parent = 0); 0025 0026 int houseNumber() const; 0027 void setHouseNumber(int houseNumber); 0028 0029 QString streetName(); 0030 void setStreetName(const QString &streetName); 0031 0032 QString city(); 0033 void setCity(const QString &city); 0034 0035 private: 0036 int m_houseNumber; 0037 QString m_streetName; 0038 QString m_city; 0039 }; 0040 0041 class Contact : public QObject, public QListWidgetItem 0042 { 0043 Q_OBJECT 0044 Q_PROPERTY(QString name READ name) 0045 Q_PROPERTY(QString email READ email) 0046 Q_PROPERTY(QString phone READ phone) 0047 Q_PROPERTY(QObject *address READ address) 0048 Q_PROPERTY(QString nickname READ nickname) 0049 Q_PROPERTY(double salary READ salary) 0050 Q_PROPERTY(QString salaryCurrency READ salaryCurrency) 0051 Q_PROPERTY(double rating READ rating) 0052 Q_PROPERTY(QDate birthday READ birthday) 0053 Q_PROPERTY(QVariant friends READ friends) 0054 0055 public: 0056 Contact(QObject *parent = 0); 0057 0058 QString name() const; 0059 void setName(const QString &name); 0060 0061 QString email() const; 0062 void setEmail(const QString &email); 0063 0064 QString phone() const; 0065 void setPhone(const QString &phone); 0066 0067 QObject *address() const; 0068 void setAddress(Address *address); 0069 0070 QString nickname() const; 0071 void setNickname(const QString &nickname); 0072 0073 QString salaryCurrency() const; 0074 void setSalaryCurrency(const QString &salaryCurrency); 0075 0076 double salary() const; 0077 void setSalary(double salary); 0078 0079 double rating() const; 0080 void setRating(double rating); 0081 0082 QDate birthday() const; 0083 void setBirthday(const QDate &birthday); 0084 0085 QVariant friends() const; 0086 void setFriends(const QList<QObject *> &friends); 0087 0088 /* reimp */ QVariant data(int role) const; 0089 0090 private: 0091 QString m_name; 0092 QString m_email; 0093 QString m_phone; 0094 Address *m_address; 0095 QString m_nickname; 0096 QString m_salaryCurrency; 0097 double m_salary; 0098 double m_rating; 0099 QDate m_birthday; 0100 QList<QObject *> m_friends; 0101 }; 0102 0103 #endif