mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
SpecMsgBox в процессе исправления
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
|
||||
InstructorsView(connectorToServer, CommonView::TypeView::control, parent),
|
||||
ui(new Ui::EditorInstructors),
|
||||
dlgEditInstructor(nullptr)
|
||||
dlgEditInstructor(nullptr),
|
||||
specialMessageBox(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -41,6 +42,13 @@ EditorInstructors::~EditorInstructors()
|
||||
dlgEditInstructor = nullptr;
|
||||
}
|
||||
|
||||
if(specialMessageBox)
|
||||
{
|
||||
specialMessageBox->close();
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -48,6 +56,9 @@ void EditorInstructors::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if(dlgEditInstructor)
|
||||
dlgEditInstructor->close();
|
||||
|
||||
if(specialMessageBox)
|
||||
specialMessageBox->close();
|
||||
}
|
||||
|
||||
void EditorInstructors::on_btnNewInstructor_clicked()
|
||||
@@ -82,21 +93,39 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
|
||||
|
||||
if(connectorToServer->isAdminInstructor(id))
|
||||
{//Это Админ!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete the Administrator.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot delete the Administrator."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in instructor.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot delete a logged-in instructor."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted)
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
|
||||
if(specialMessageBox->exec() == QDialog::Accepted)
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
|
||||
}
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,7 +156,13 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
{//Не Архивный
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in instructor.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot archive a logged-in instructor."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,7 +199,13 @@ void EditorInstructors::on_btnEdit_clicked()
|
||||
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in instructor.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot edit a logged-in instructor."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,19 +311,37 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
|
||||
|
||||
if(instructor.getName() == QStringLiteral("<name>"))
|
||||
{//Имя не корректно!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(instructor.getLogin() == QStringLiteral("<login>"))
|
||||
{//Логин не корректен!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(instructor.getPassword() == QStringLiteral("<password>"))
|
||||
{//Пароль не корректный!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -291,7 +350,13 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
|
||||
int user_T = connectorToServer->getIdTraineeByLogin(instructor.getLogin());
|
||||
if((user_I && (user_I != instructor.getID())) || (user_T && (user_T != instructor.getID())))
|
||||
{//Логин уже существует!
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec();
|
||||
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
|
||||
specialMessageBox->exec();
|
||||
if(specialMessageBox)
|
||||
{
|
||||
delete specialMessageBox;
|
||||
specialMessageBox = nullptr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user