diff options
-rw-r--r-- | qrtclient/user.hxx | 325 | ||||
-rw-r--r-- | user.cxx | 302 |
2 files changed, 313 insertions, 314 deletions
diff --git a/qrtclient/user.hxx b/qrtclient/user.hxx index e4a1c45..d258820 100644 --- a/qrtclient/user.hxx +++ b/qrtclient/user.hxx @@ -8,176 +8,177 @@ struct rtclient_user; namespace RTClient { - class User : public QObject - { - Q_OBJECT - Q_PROPERTY(unsigned int id READ id WRITE setId NOTIFY idChanged) - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) - Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged) - Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged) - Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged) - Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) - 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 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 contactInfo READ contactInfo WRITE setContactInfo NOTIFY contactInfoChanged) - Q_PROPERTY(QString comments READ comments WRITE setComments NOTIFY commentsChanged) - Q_PROPERTY(QString signature READ signature WRITE setSignature NOTIFY signatureChanged) - Q_PROPERTY(QString gecos READ gecos WRITE setGecos NOTIFY gecosChanged) - Q_PROPERTY(rtclient_user_lang lang READ lang WRITE setLang NOTIFY langChanged) - Q_PROPERTY(rtclient_user_timezone timezone READ timezone WRITE setTimeZone NOTIFY timezoneChanged) - Q_PROPERTY(bool privileged READ privileged WRITE setPrivileged NOTIFY privilegedChanged) - Q_PROPERTY(bool disabled READ disabled WRITE setDisabled NOTIFY disabledChanged) +class User : public QObject +{ + Q_OBJECT + Q_PROPERTY(unsigned int id READ id WRITE setId NOTIFY idChanged) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) + Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged) + Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged) + Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged) + Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) + 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 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 contactInfo READ contactInfo WRITE setContactInfo NOTIFY contactInfoChanged) + Q_PROPERTY(QString comments READ comments WRITE setComments NOTIFY commentsChanged) + Q_PROPERTY(QString signature READ signature WRITE setSignature NOTIFY signatureChanged) + Q_PROPERTY(QString gecos READ gecos WRITE setGecos NOTIFY gecosChanged) + Q_PROPERTY(rtclient_user_lang lang READ lang WRITE setLang NOTIFY langChanged) + Q_PROPERTY(rtclient_user_timezone timezone READ timezone WRITE setTimeZone NOTIFY timezoneChanged) + Q_PROPERTY(bool privileged READ privileged WRITE setPrivileged NOTIFY privilegedChanged) + Q_PROPERTY(bool disabled READ disabled WRITE setDisabled NOTIFY disabledChanged) - public: - explicit User(QObject* parent = nullptr) - : QObject{parent} - , m_id{0} - , m_name{""} - , m_password{""} - , m_emailAddress{""} - , m_realName{""} - , m_nickName{""} - , m_organization{""} - , m_address1{""} - , m_address2{""} - , m_city{""} - , m_state{""} - , m_zip{""} - , m_country{""} - , m_homePhone{""} - , m_workPhone{""} - , m_mobilePhone{""} - , m_pagerPhone{""} - , m_contactInfo{""} - , m_comments{""} - , m_signature{""} - , m_gecos{""} - , m_lang{RTCLIENT_USER_LANG_NONE} - , m_timezone{RTCLIENT_USER_TIMEZONE_NONE} - , m_privileged{false} - , m_disabled{true} - {} - ~User() {} + public: + User(struct rtclient_user* user, QObject* parent = nullptr) : + QObject{parent}, + m_id{user->id}, + m_name{QString{user->name}}, + m_password{QString{user->password}}, + m_emailAddress{user->email_address + ? QString{user->email_address} + : ""}, + m_realName{QString{user->real_name}}, + m_nickName{QString{user->nick_name}}, + m_organization{QString{user->organization}}, + m_address1{QString{user->address1}}, + m_address2{QString{user->address2}}, + m_city{QString{user->city}}, + m_state{QString{user->state}}, + m_zip{QString{user->zip}}, + m_country{QString{user->country}}, + m_homePhone{QString{user->home_phone}}, + m_workPhone{QString{user->work_phone}}, + m_mobilePhone{QString{user->mobile_phone}}, + m_pagerPhone{QString{user->pager_phone}}, + m_contactInfo{QString{user->contact_info}}, + m_comments{QString{user->comments}}, + m_signature{QString{user->signature}}, + m_gecos{QString{user->gecos}}, + m_lang{user->lang}, + m_timezone{user->timezone}, + m_privileged{user->privileged}, + m_disabled{user->disabled} + {} + ~User() {} - unsigned int id() const { return m_id; } - QString const& name() const { return m_name; } - QString const& password() const { return m_password; } - QString const& emailAddress() const { return m_emailAddress; } - QString const& realName() const { return m_realName; } - QString const& nickName() const { return m_nickName; } - QString const& organization() const { return m_organization; } - QString const& address1() const { return m_address1; } - QString const& address2() const { return m_address2; } - QString const& city() const { return m_city; } - QString const& state() const { return m_state; } - QString const& zip() const { return m_zip; } - QString const& country() const { return m_country; } - QString const& homePhone() const { return m_homePhone; } - QString const& workPhone() const { return m_workPhone; } - QString const& mobilePhone() const { return m_mobilePhone; } - QString const& pagerPhone() const { return m_pagerPhone; } - QString const& contactInfo() const { return m_contactInfo; } - QString const& comments() const { return m_comments; } - QString const& signature() const { return m_signature; } - QString const& gecos() const { return m_gecos; } - rtclient_user_lang lang() const { return m_lang; } - rtclient_user_timezone timezone() const { return m_timezone; } - bool privileged() const { return m_privileged; } - bool disabled() const { return m_disabled; } - - void setId(unsigned int id); - void setName(QString const& name); - void setPassword(QString const& password); - void setEmailAddress(QString const& emailAddress); - void setRealName(QString const& realName); - void setNickName(QString const& nickName); - void setOrganization(QString const& organization); - 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 setHomePhone(QString const& homePhone); - void setWorkPhone(QString const& workPhone); - void setMobilePhone(QString const& mobilePhone); - void setPagerPhone(QString const& pagerPhone); - void setContactInfo(QString const& contactInfo); - void setComments(QString const& comments); - void setSignature(QString const& signature); - void setGecos(QString const& gecos); - void setLang(rtclient_user_lang lang); - void setTimeZone(rtclient_user_timezone timezone); - void setPrivileged(bool privileged); - void setDisabled(bool disabled); + unsigned int id() const { return m_id; } + QString const& name() const { return m_name; } + QString const& password() const { return m_password; } + QString const& emailAddress() const { return m_emailAddress; } + QString const& realName() const { return m_realName; } + QString const& nickName() const { return m_nickName; } + QString const& organization() const { return m_organization; } + QString const& address1() const { return m_address1; } + QString const& address2() const { return m_address2; } + QString const& city() const { return m_city; } + QString const& state() const { return m_state; } + QString const& zip() const { return m_zip; } + QString const& country() const { return m_country; } + QString const& homePhone() const { return m_homePhone; } + QString const& workPhone() const { return m_workPhone; } + QString const& mobilePhone() const { return m_mobilePhone; } + QString const& pagerPhone() const { return m_pagerPhone; } + QString const& contactInfo() const { return m_contactInfo; } + QString const& comments() const { return m_comments; } + QString const& signature() const { return m_signature; } + QString const& gecos() const { return m_gecos; } + rtclient_user_lang lang() const { return m_lang; } + rtclient_user_timezone timezone() const { return m_timezone; } + bool privileged() const { return m_privileged; } + bool disabled() const { return m_disabled; } + void setId(unsigned int id); + void setName(QString const& name); + void setPassword(QString const& password); + void setEmailAddress(QString const& emailAddress); + void setRealName(QString const& realName); + void setNickName(QString const& nickName); + void setOrganization(QString const& organization); + 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 setHomePhone(QString const& homePhone); + void setWorkPhone(QString const& workPhone); + void setMobilePhone(QString const& mobilePhone); + void setPagerPhone(QString const& pagerPhone); + void setContactInfo(QString const& contactInfo); + void setComments(QString const& comments); + void setSignature(QString const& signature); + void setGecos(QString const& gecos); + void setLang(rtclient_user_lang lang); + void setTimeZone(rtclient_user_timezone timezone); + void setPrivileged(bool privileged); + void setDisabled(bool disabled); public slots: void update(rtclient_user* user); - signals: - void idChanged(); - void nameChanged(); - void passwordChanged(); - void emailAddressChanged(); - void realNameChanged(); - void nickNameChanged(); - void organizationChanged(); - void address1Changed(); - void address2Changed(); - void cityChanged(); - void stateChanged(); - void zipChanged(); - void countryChanged(); - void homePhoneChanged(); - void workPhoneChanged(); - void mobilePhoneChanged(); - void pagerPhoneChanged(); - void contactInfoChanged(); - void commentsChanged(); - void signatureChanged(); - void gecosChanged(); - void langChanged(); - void timezoneChanged(); - void privilegedChanged(); - void disabledChanged(); + signals: + void idChanged(); + void nameChanged(); + void passwordChanged(); + void emailAddressChanged(); + void realNameChanged(); + void nickNameChanged(); + void organizationChanged(); + void address1Changed(); + void address2Changed(); + void cityChanged(); + void stateChanged(); + void zipChanged(); + void countryChanged(); + void homePhoneChanged(); + void workPhoneChanged(); + void mobilePhoneChanged(); + void pagerPhoneChanged(); + void contactInfoChanged(); + void commentsChanged(); + void signatureChanged(); + void gecosChanged(); + void langChanged(); + void timezoneChanged(); + void privilegedChanged(); + void disabledChanged(); - private: - unsigned int m_id; - QString m_name; - QString m_password; - QString m_emailAddress; - QString m_realName; - QString m_nickName; - QString m_organization; - QString m_address1; - QString m_address2; - QString m_city; - QString m_state; - QString m_zip; - QString m_country; - QString m_homePhone; - QString m_workPhone; - QString m_mobilePhone; - QString m_pagerPhone; - QString m_contactInfo; - QString m_comments; - QString m_signature; - QString m_gecos; - rtclient_user_lang m_lang; - rtclient_user_timezone m_timezone; - bool m_privileged; - bool m_disabled; + private: + unsigned int m_id; + QString m_name; + QString m_password; + QString m_emailAddress; + QString m_realName; + QString m_nickName; + QString m_organization; + QString m_address1; + QString m_address2; + QString m_city; + QString m_state; + QString m_zip; + QString m_country; + QString m_homePhone; + QString m_workPhone; + QString m_mobilePhone; + QString m_pagerPhone; + QString m_contactInfo; + QString m_comments; + QString m_signature; + QString m_gecos; + rtclient_user_lang m_lang; + rtclient_user_timezone m_timezone; + bool m_privileged; + bool m_disabled; }; } -#endif // QRTCLIENT_USER_HXX +#endif @@ -4,206 +4,203 @@ namespace RTClient { - void User::setId(unsigned int id) - { - if (m_id != id) { - m_id = id; - emit idChanged(); - } +void User::setId(unsigned int id) +{ + if (m_id != id) { + m_id = id; + emit idChanged(); } +} - void User::setName(QString const& name) - { - if (m_name != name) { - m_name = name; - emit nameChanged(); - } +void User::setName(QString const& name) +{ + if (m_name != name) { + m_name = name; + emit nameChanged(); } +} - void User::setPassword(QString const& password) - { - if (m_password != password) { - m_password = password; - emit passwordChanged(); - } +void User::setPassword(QString const& password) +{ + if (m_password != password) { + m_password = password; + emit passwordChanged(); } +} - void User::setEmailAddress(QString const& emailAddress) - { - if (m_emailAddress != emailAddress) { - m_emailAddress = emailAddress; - emit emailAddressChanged(); - } +void User::setEmailAddress(QString const& emailAddress) +{ + if (m_emailAddress != emailAddress) { + m_emailAddress = emailAddress; + emit emailAddressChanged(); } +} - void User::setRealName(QString const& realName) - { - if (m_realName != realName) { - m_realName = realName; - emit realNameChanged(); - } +void User::setRealName(QString const& realName) +{ + if (m_realName != realName) { + m_realName = realName; + emit realNameChanged(); } +} - void User::setNickName(QString const& nickName) - { - if (m_nickName != nickName) { - m_nickName = nickName; - emit nickNameChanged(); - } - } - - void User::setOrganization(QString const& organization) - { - if (m_organization != organization) { - m_organization = organization; - emit organizationChanged(); - } +void User::setNickName(QString const& nickName) +{ + if (m_nickName != nickName) { + m_nickName = nickName; + emit nickNameChanged(); } +} - void User::setAddress1(QString const& address1) - { - if (m_address1 != address1) { - m_address1 = address1; - emit address1Changed(); - } +void User::setOrganization(QString const& organization) +{ + if (m_organization != organization) { + m_organization = organization; + emit organizationChanged(); } +} - void User::setAddress2(QString const& address2) - { - if (m_address2 != address2) { - m_address2 = address2; - emit address2Changed(); - } +void User::setAddress1(QString const& address1) +{ + if (m_address1 != address1) { + m_address1 = address1; + emit address1Changed(); } +} - void User::setCity(QString const& city) - { - if (m_city != city) { - m_city = city; - emit cityChanged(); - } +void User::setAddress2(QString const& address2) +{ + if (m_address2 != address2) { + m_address2 = address2; + emit address2Changed(); } +} - void User::setState(QString const& state) - { - if (m_state != state) { - m_state = state; - emit stateChanged(); - } +void User::setCity(QString const& city) +{ + if (m_city != city) { + m_city = city; + emit cityChanged(); } +} - void User::setZip(QString const& zip) - { - if (m_zip != zip) { - m_zip = zip; - emit zipChanged(); - } +void User::setState(QString const& state) +{ + if (m_state != state) { + m_state = state; + emit stateChanged(); } +} - void User::setCountry(QString const& country) - { - if (m_country != country) { - m_country = country; - emit countryChanged(); - } +void User::setZip(QString const& zip) +{ + if (m_zip != zip) { + m_zip = zip; + emit zipChanged(); } +} - void User::setHomePhone(QString const& homePhone) - { - if (m_homePhone != homePhone) { - m_homePhone = homePhone; - emit homePhoneChanged(); - } +void User::setCountry(QString const& country) +{ + if (m_country != country) { + m_country = country; + emit countryChanged(); } +} - void User::setWorkPhone(QString const& workPhone) - { - if (m_workPhone != workPhone) { - m_workPhone = workPhone; - emit workPhoneChanged(); - } +void User::setHomePhone(QString const& homePhone) +{ + if (m_homePhone != homePhone) { + m_homePhone = homePhone; + emit homePhoneChanged(); } +} - void User::setMobilePhone(QString const& mobilePhone) - { - if (m_mobilePhone != mobilePhone) { - m_mobilePhone = mobilePhone; - emit mobilePhoneChanged(); - } +void User::setWorkPhone(QString const& workPhone) +{ + if (m_workPhone != workPhone) { + m_workPhone = workPhone; + emit workPhoneChanged(); } +} - void User::setPagerPhone(QString const& pagerPhone) - { - if (m_pagerPhone != pagerPhone) { - m_pagerPhone = pagerPhone; - emit pagerPhoneChanged(); - } +void User::setMobilePhone(QString const& mobilePhone) +{ + if (m_mobilePhone != mobilePhone) { + m_mobilePhone = mobilePhone; + emit mobilePhoneChanged(); } +} - void User::setContactInfo(QString const& contactInfo) - { - if (m_contactInfo != contactInfo) { - m_contactInfo = contactInfo; - emit contactInfoChanged(); - } +void User::setPagerPhone(QString const& pagerPhone) +{ + if (m_pagerPhone != pagerPhone) { + m_pagerPhone = pagerPhone; + emit pagerPhoneChanged(); } +} - void User::setComments(QString const& comments) - { - if (m_comments != comments) { - m_comments = comments; - emit commentsChanged(); - } +void User::setContactInfo(QString const& contactInfo) +{ + if (m_contactInfo != contactInfo) { + m_contactInfo = contactInfo; + emit contactInfoChanged(); } +} - void User::setSignature(QString const& signature) - { - if (m_signature != signature) { - m_signature = signature; - emit signatureChanged(); - } +void User::setComments(QString const& comments) +{ + if (m_comments != comments) { + m_comments = comments; + emit commentsChanged(); } +} - void User::setGecos(QString const& gecos) - { - if (m_gecos != gecos) { - m_gecos = gecos; - emit gecosChanged(); - } +void User::setSignature(QString const& signature) +{ + if (m_signature != signature) { + m_signature = signature; + emit signatureChanged(); } +} - void User::setLang(rtclient_user_lang lang) - { - if (m_lang != lang) { - m_lang = lang; - emit langChanged(); - } +void User::setGecos(QString const& gecos) +{ + if (m_gecos != gecos) { + m_gecos = gecos; + emit gecosChanged(); } +} - void User::setTimeZone(rtclient_user_timezone timezone) - { - if (m_timezone != timezone) { - m_timezone = timezone; - emit timezoneChanged(); - } +void User::setLang(rtclient_user_lang lang) +{ + if (m_lang != lang) { + m_lang = lang; + emit langChanged(); } +} - void User::setPrivileged(bool privileged) - { - if (m_privileged != privileged) { - m_privileged = privileged; - emit privilegedChanged(); - } +void User::setTimeZone(rtclient_user_timezone timezone) +{ + if (m_timezone != timezone) { + m_timezone = timezone; + emit timezoneChanged(); } +} - void User::setDisabled(bool disabled) - { - if (m_disabled != disabled) { - m_disabled = disabled; - emit disabledChanged(); - } +void User::setPrivileged(bool privileged) +{ + if (m_privileged != privileged) { + m_privileged = privileged; + emit privilegedChanged(); } +} +void User::setDisabled(bool disabled) +{ + if (m_disabled != disabled) { + m_disabled = disabled; + emit disabledChanged(); void User::update(rtclient_user* user) { if (user) { @@ -316,5 +313,6 @@ namespace RTClient { m_disabled = true; } } +} } |