diff options
Diffstat (limited to 'user.cxx')
-rw-r--r-- | user.cxx | 168 |
1 files changed, 117 insertions, 51 deletions
@@ -1,5 +1,14 @@ +#include "rtclient.h" #include "user.hxx" +void User::setId(QString const& id) +{ + if (m_id != id) { + m_id = id; + emit idChanged(); + } +} + void User::setName(QString const& name) { if (m_name != name) { @@ -24,14 +33,6 @@ void User::setEmailAddress(QString const& emailAddress) } } -void User::setOrganization(QString const& organization) -{ - if (m_organization != organization) { - m_organization = organization; - emit organizationChanged(); - } -} - void User::setRealName(QString const& realName) { if (m_realName != realName) { @@ -48,43 +49,11 @@ void User::setNickName(QString const& nickName) } } -void User::setLang(QString const& lang) -{ - if (m_lang != lang) { - m_lang = lang; - emit langChanged(); - } -} - -void User::setHomePhone(QString const& homePhone) -{ - if (m_homePhone != homePhone) { - m_homePhone = homePhone; - emit homePhoneChanged(); - } -} - -void User::setWorkPhone(QString const& workPhone) -{ - if (m_workPhone != workPhone) { - m_workPhone = workPhone; - emit workPhoneChanged(); - } -} - -void User::setMobilePhone(QString const& mobilePhone) -{ - if (m_mobilePhone != mobilePhone) { - m_mobilePhone = mobilePhone; - emit mobilePhoneChanged(); - } -} - -void User::setPagerPhone(QString const& pagerPhone) +void User::setOrganization(QString const& organization) { - if (m_pagerPhone != pagerPhone) { - m_pagerPhone = pagerPhone; - emit pagerPhoneChanged(); + if (m_organization != organization) { + m_organization = organization; + emit organizationChanged(); } } @@ -136,18 +105,115 @@ void User::setCountry(QString const& country) } } -void User::setTimeZone(QString const& timeZone) +void User::setHomePhone(QString const& homePhone) { - if (m_timeZone != timeZone) { - m_timeZone = timeZone; - emit timeZoneChanged(); + if (m_homePhone != homePhone) { + m_homePhone = homePhone; + emit homePhoneChanged(); } } -void User::setLoggedIn(bool isLoggedIn) +void User::setWorkPhone(QString const& workPhone) { - if (m_isLoggedIn != isLoggedIn) { - m_isLoggedIn = isLoggedIn; + if (m_workPhone != workPhone) { + m_workPhone = workPhone; + emit workPhoneChanged(); + } +} + +void User::setMobilePhone(QString const& mobilePhone) +{ + if (m_mobilePhone != mobilePhone) { + m_mobilePhone = mobilePhone; + emit mobilePhoneChanged(); + } +} + +void User::setPagerPhone(QString const& pagerPhone) +{ + if (m_pagerPhone != pagerPhone) { + m_pagerPhone = pagerPhone; + emit pagerPhoneChanged(); + } +} + +void User::setLang(QString const& 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::setDisabled(bool disabled) +{ + if (m_disabled != disabled) { + m_disabled = disabled; + emit disabledChanged(); + } +} + +void User::setLoggedIn(bool loggedIn) +{ + if (m_loggedIn != loggedIn) { + m_loggedIn = loggedIn; emit loggedInChanged(); } } + +void User::update(rt_user* user) +{ + if (user) { + m_id = user->id; + m_emailAddress = user->emailaddress; + m_realName = user->realname; + m_nickName = user->nickname; + m_gecos = user->gecos; + m_organization = user->organization; + m_address1 = user->address1; + m_address2 = user->address2; + m_city = user->city; + m_state = user->state; + m_zip = user->zip; + m_country = user->country; + m_homePhone = user->homephone; + m_workPhone = user->workphone; + m_mobilePhone = user->mobilephone; + m_pagerPhone = user->pagerphone; + m_lang = user->lang; + m_privileged = user->privileged; + m_disabled = user->disabled; + m_loggedIn = true; + rtclient_userfree(user); + } else { + m_id = ""; + 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_lang = ""; + m_privileged = false; + m_disabled = true; + m_loggedIn = false; + } +} |