summaryrefslogtreecommitdiff
path: root/user.hxx
blob: 98d5f68164e5817d374bcbb2d2eab7d06d782487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef USER_HXX
#define USER_HXX

#include <QObject>
#include "rtuser.h"

class User : public QObject
{
	Q_OBJECT
	Q_PROPERTY(QString name READ name)
	Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged)
	Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged)
	Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
	Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged)
	Q_PROPERTY(QString lang READ lang WRITE setLang NOTIFY langChanged)
	Q_PROPERTY(QString homePhone READ homePhone WRITE setHomePhone NOTIFY homePhoneChanged)
	Q_PROPERTY(QString workPhone READ workPhone WRITE setWorkPhone NOTIFY workPhoneChanged)
	Q_PROPERTY(QString mobilePhone READ mobilePhone WRITE setMobilePhone NOTIFY mobilePhoneChanged)
	Q_PROPERTY(QString pagerPhone READ pagerPhone WRITE setPagerPhone NOTIFY pagerPhoneChanged)
	Q_PROPERTY(QString address1 READ address1 WRITE setAddress1 NOTIFY address1Changed)
	Q_PROPERTY(QString address2 READ address2 WRITE setAddress2 NOTIFY address2Changed)
	Q_PROPERTY(QString city READ city WRITE setCity NOTIFY cityChanged)
	Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
	Q_PROPERTY(QString zip READ zip WRITE setZip NOTIFY zipChanged)
	Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged)
	Q_PROPERTY(QString timeZone READ timeZone WRITE setTimeZone NOTIFY timeZoneChanged)
	Q_PROPERTY(bool isLoggedIn READ isLoggedIn WRITE setLoggedIn NOTIFY loggedInChanged)

	public:
		explicit User(bool isLoggedIn = false, QObject* parent = nullptr) :
			QObject{parent},
			m_isLoggedIn{isLoggedIn}
		{}
		~User() {}

		QString const name() const { return QString{m_user.name}; }
		QString const emailAddress() const { return QString{m_user.emailaddress}; }
		QString const organization() const { return QString{m_user.organization}; }
		QString const realName() const { return QString{m_user.realname}; }
		QString const nickName() const { return QString{m_user.nickname}; }
		QString const lang() const { return QString{m_user.lang}; }
		QString const homePhone() const { return QString{m_user.homephone}; }
		QString const workPhone() const { return QString{m_user.workphone}; }
		QString const mobilePhone() const { return QString{m_user.mobilephone}; }
		QString const pagerPhone() const { return QString{m_user.pagerphone}; }
		QString const address1() const { return QString{m_user.address1}; }
		QString const address2() const { return QString{m_user.address2}; }
		QString const city() const { return QString{m_user.city}; }
		QString const state() const { return QString{m_user.state}; }
		QString const zip() const { return QString{m_user.zip}; }
		QString const country() const { return QString{m_user.country}; }
		QString const timeZone() const { return QString{m_user.timezone}; }
		bool isLoggedIn() const { return m_isLoggedIn; }

		void setName(QString const& name);
		void setEmailAddress(QString const& emailAddress);
		void setOrganization(QString const& organization);
		void setRealName(QString const& realName);
		void setNickName(QString const& nickName);
		void setLang(QString const& lang);
		void setHomePhone(QString const& homePhone);
		void setWorkPhone(QString const& workPhone);
		void setMobilePhone(QString const& mobilePhone);
		void setPagerPhone(QString const& pagerPhone);
		void setAddress1(QString const& address1);
		void setAddress2(QString const& address2);
		void setCity(QString const& city);
		void setState(QString const& state);
		void setZip(QString const& zip);
		void setCountry(QString const& country);
		void setTimeZone(QString const& timeZone);
		void setLoggedIn(bool isLoggedIn);

	signals:
		void nameChanged();
		void emailAddressChanged();
		void organizationChanged();
		void realNameChanged();
		void nickNameChanged();
		void langChanged();
		void homePhoneChanged();
		void workPhoneChanged();
		void mobilePhoneChanged();
		void pagerPhoneChanged();
		void address1Changed();
		void address2Changed();
		void cityChanged();
		void stateChanged();
		void zipChanged();
		void countryChanged();
		void timeZoneChanged();
		void loggedInChanged();

	private:
		rt_user m_user;
		bool m_isLoggedIn;
};

#endif // USER_HXX