DialogEditTrainee (adminMode)

This commit is contained in:
2025-10-17 11:12:57 +03:00
parent b539f9fd2b
commit d643205323
7 changed files with 33 additions and 17 deletions

View File

@@ -4,11 +4,12 @@
#include <QPushButton>
#include <QRegExpValidator>
DialogEditInstructor::DialogEditInstructor(QWidget *parent) :
DialogEditInstructor::DialogEditInstructor(bool adminMode, QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogEditInstructor),
instructorInput(),
flNeedHashPassword(false)
flNeedHashPassword(false),
adminMode(adminMode)
{
ui->setupUi(this);
verify();
@@ -23,9 +24,9 @@ DialogEditInstructor::DialogEditInstructor(QWidget *parent) :
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
ui->editPassword->setEnabled(false);
#ifndef PROJECT_TYPE_DEBUG
//#ifndef PROJECT_TYPE_DEBUG
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
#endif
//#endif
ui->btnViewPassword->setEnabled(false);
ui->btnChangePassword->setEnabled(false);
@@ -61,7 +62,10 @@ void DialogEditInstructor::setInstructor(Instructor instructor)
ui->btnViewPassword->setEnabled(true);
}
else
ui->btnChangePassword->setEnabled(true);
{
if(adminMode)
ui->btnChangePassword->setEnabled(true);
}
ui->btnOK->setEnabled(false);
}
@@ -136,4 +140,6 @@ void DialogEditInstructor::on_btnChangePassword_clicked()
ui->editPassword->setText("");
flNeedHashPassword = true;
ui->editPassword->setFocus();
}

View File

@@ -14,7 +14,7 @@ class DialogEditInstructor : public QDialog
Q_OBJECT
public:
explicit DialogEditInstructor(QWidget *parent = nullptr);
explicit DialogEditInstructor(bool adminMode, QWidget *parent = nullptr);
~DialogEditInstructor();
void setInstructor(Instructor instructor);
@@ -44,6 +44,8 @@ private:
Instructor instructorInput;
bool flNeedHashPassword;
bool adminMode;
};
#endif // DIALOGEDITINSTRUCTOR_H

View File

@@ -292,7 +292,7 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instructor_edit)
{
DialogEditInstructor dlg(this);
DialogEditInstructor dlg(adminMode, this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setInstructor(instructor);