summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Prabowo Kamal <erik@darapsa.co.id>2019-08-30 16:43:48 +0800
committerErik Prabowo Kamal <erik@darapsa.co.id>2019-08-30 16:43:48 +0800
commit014d9ca7e0cdc1ef4b633a28ba9befddb2951179 (patch)
tree3897d86bbdfd3060351e8a20c59b5ce04bb7fe4d
parentb15e02739052557480bc272920f251cc4eed00b0 (diff)
User password member
-rw-r--r--pages/Password.qml6
-rw-r--r--user.cxx8
-rw-r--r--user.hxx5
3 files changed, 19 insertions, 0 deletions
diff --git a/pages/Password.qml b/pages/Password.qml
index 7cd3d16..0edb294 100644
--- a/pages/Password.qml
+++ b/pages/Password.qml
@@ -9,4 +9,10 @@ PasswordForm {
stackView.pop()
}
}
+
+ createPassButton {
+ onClicked: {
+ User.password = passTextField.text
+ }
+ }
}
diff --git a/user.cxx b/user.cxx
index 3da2c33..3762f81 100644
--- a/user.cxx
+++ b/user.cxx
@@ -8,6 +8,14 @@ void User::setName(QString const& name)
}
}
+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) {
diff --git a/user.hxx b/user.hxx
index 36ade7e..68abbc7 100644
--- a/user.hxx
+++ b/user.hxx
@@ -7,6 +7,7 @@ class User : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
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)
@@ -33,6 +34,7 @@ class User : public QObject
~User() {}
QString const& name() const { return m_name; }
+ QString const& password() const { return m_password; }
QString const& emailAddress() const { return m_emailAddress; }
QString const& organization() const { return m_organization; }
QString const& realName() const { return m_realName; }
@@ -52,6 +54,7 @@ class User : public QObject
bool isLoggedIn() const { return m_isLoggedIn; }
void setName(QString const& name);
+ void setPassword(QString const& password);
void setEmailAddress(QString const& emailAddress);
void setOrganization(QString const& organization);
void setRealName(QString const& realName);
@@ -72,6 +75,7 @@ class User : public QObject
signals:
void nameChanged();
+ void passwordChanged();
void emailAddressChanged();
void organizationChanged();
void realNameChanged();
@@ -92,6 +96,7 @@ class User : public QObject
private:
QString m_name;
+ QString m_password;
QString m_emailAddress;
QString m_organization;
QString m_realName;