Delivery point editor done
This commit is contained in:
parent
a6c080d36b
commit
3e196f3574
22 changed files with 379 additions and 74 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "usereditdialog.h"
|
||||
#include "ui_usereditdialog.h"
|
||||
|
||||
|
||||
UserEditDialog::UserEditDialog(QWidget *parent) : QDialog(parent), ui(new Ui::UserEditDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
|
|
@ -12,24 +13,22 @@ UserEditDialog::~UserEditDialog() {
|
|||
delete ui;
|
||||
}
|
||||
|
||||
UserEditDialog::user_data* UserEditDialog::user() const {
|
||||
return this->_user;
|
||||
user_data_struct* UserEditDialog::user_data() const {
|
||||
return this->_user_data;
|
||||
}
|
||||
|
||||
void UserEditDialog::set_user(user_entity* user, bool edit) {
|
||||
if (edit) {
|
||||
this->_user = new UserEditDialog::user_data {
|
||||
user->login(), "", user->role(), true
|
||||
};
|
||||
this->_user_data = new user_data_struct();
|
||||
|
||||
ui->et_login->setText(user->login());
|
||||
ui->et_password->setText("##########UNEDITED##########");
|
||||
ui->cb_role->setCurrentIndex((int)user->role());
|
||||
}
|
||||
else {
|
||||
this->_user = new UserEditDialog::user_data{};
|
||||
this->_user_data = new user_data_struct{};
|
||||
}
|
||||
this->_user->edit = edit;
|
||||
this->_user_data->edit = edit;
|
||||
}
|
||||
|
||||
void UserEditDialog::accept() {
|
||||
|
|
@ -47,7 +46,7 @@ void UserEditDialog::accept() {
|
|||
}
|
||||
bool emptyTitle = ui->et_login->text().trimmed().isEmpty();
|
||||
bool emptyPassword = ui->et_password->text().trimmed().isEmpty();
|
||||
bool lowerank = this->_user->edit && this->_user->role < role;
|
||||
bool lowerank = this->_user_data->edit && this->_user_data->role < role;
|
||||
if (emptyTitle || emptyPassword || lowerank) {
|
||||
QMessageBox errDlg(this);
|
||||
errDlg.setTextFormat(Qt::RichText);
|
||||
|
|
@ -67,11 +66,10 @@ void UserEditDialog::accept() {
|
|||
errDlg.exec();
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
this->_user->login = ui->et_login->text().trimmed();
|
||||
this->_user->password = ui->et_password->text().trimmed();
|
||||
this->_user->role = role;
|
||||
this->_user_data->login = ui->et_login->text().trimmed();
|
||||
this->_user_data->password = ui->et_password->text().trimmed();
|
||||
this->_user_data->role = role;
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue