Commit 9e4c2713 authored by Àlex Fiestas's avatar Àlex Fiestas
Browse files

Show and hide passowrd/verify widgets if account created

If account is created, do not show password/verify widgets, it
it is a new account though, show them.
parent 88d1ed00
......@@ -45,51 +45,12 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Real Name:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Email Address:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Administrator:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="administrator">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Automatic Login:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="automaticLogin">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="username">
<property name="sizePolicy">
......@@ -119,9 +80,19 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Real Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="realName">
<property name="sizePolicy">
......@@ -151,9 +122,19 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Email Address:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widget_5" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="email">
<property name="sizePolicy">
......@@ -180,6 +161,68 @@
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Administrator:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="administrator">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Automatic Login:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="automaticLogin">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="passwordEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Verify:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="verifyEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -110,6 +110,29 @@ void AccountInfo::loadFromModel()
m_info->email->setText(m_model->data(m_index, AccountModel::Email).toString());
m_info->administrator->setChecked(m_model->data(m_index, AccountModel::Administrator).toBool());
m_info->automaticLogin->setChecked(m_model->data(m_index, AccountModel::AutomaticLogin).toBool());
if (m_model->data(m_index, AccountModel::Created).toBool() && m_info->label_3->isVisible()) {
m_info->formLayout->removeWidget(m_info->label_3);
m_info->formLayout->removeWidget(m_info->label_4);
m_info->label_3->setVisible(false);
m_info->label_4->setVisible(false);
m_info->formLayout->removeWidget(m_info->passwordEdit);
m_info->formLayout->removeWidget(m_info->verifyEdit);
m_info->passwordEdit->setVisible(false);
m_info->verifyEdit->setVisible(false);
} else if(!m_model->data(m_index, AccountModel::Created).toBool() && !m_info->label_3->isVisible()) {
int row;
QFormLayout::ItemRole role;
m_info->formLayout->getWidgetPosition(m_info->label_2, &row, &role);
m_info->formLayout->insertRow(row, m_info->label_3, m_info->passwordEdit);
m_info->formLayout->insertRow(row + 1, m_info->label_4, m_info->verifyEdit);
m_info->label_3->setVisible(true);
m_info->label_4->setVisible(true);
m_info->passwordEdit->setVisible(true);
m_info->verifyEdit->setVisible(true);
}
m_info->changePassword->setEnabled(m_model->data(m_index, AccountModel::Created).toBool());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment