Откл-е запр-в на EditorTrainees EditorInstructors

This commit is contained in:
2026-01-22 16:42:03 +03:00
parent ebbfc484b4
commit a43a547631
7 changed files with 105 additions and 37 deletions

View File

@@ -11,6 +11,7 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
messangerController(messangerController),
dlgRedactor(nullptr),
dlgCardTrainee(nullptr),
flTryEditorTrainees(false),
ui(new Ui::ViewerTrainees)
{
ui->setupUi(this);
@@ -32,6 +33,8 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
setNotLoggedInVisible(true);
ui->btnEditorTrainees->setVisible(false);
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, this, &ViewerTrainees::slot_checkTryBlockResult);
}
ViewerTrainees::~ViewerTrainees()
@@ -79,6 +82,8 @@ void ViewerTrainees::deactivate()
if(dlgCardTrainee)
dlgCardTrainee->close();
flTryEditorTrainees = false;
CommonView::deactivate();
ammTasksWidgetCommon->deactivate();
@@ -109,23 +114,31 @@ void ViewerTrainees::slot_receiveMessage(ClientMessage clientMessage)
slot_NeedUpdateUI(false, true);
}
void ViewerTrainees::slot_checkTryBlockResult(bool result, QString type)
{
if(flTryEditorTrainees)
{
if(type == "EditorTrainees")
{
if(result)
{//Одобрено
dialog_EditorTrainees();
}
else
{//Отказ
SpecMsgBox::WarningClose(this, tr("The server rejected your request to access trainees control.\nAnother instructor is managing trainees.\nPlease try again later."));
}
flTryEditorTrainees = false;
}
}
}
void ViewerTrainees::on_btnEditorTrainees_clicked()
{
connectorToServer->sendQueryBlockAuth(true, "EditorTrainees");
flTryEditorTrainees = true;
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
dlgRedactor->exec();
if(dlgRedactor)
{
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(authComplited)
loadTraineesFromDB();
connectorToServer->sendQueryBlockAuth(false, "EditorTrainees");
connectorToServer->sendQueryBlockAuth(true, "EditorTrainees");
}
void ViewerTrainees::on_btnPersonalCard_clicked()
@@ -236,3 +249,20 @@ void ViewerTrainees::updateButtons()
ui->btnEditorTrainees->setEnabled(false);
}
}
void ViewerTrainees::dialog_EditorTrainees()
{
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
dlgRedactor->exec();
if(dlgRedactor)
{
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(authComplited)
loadTraineesFromDB();
connectorToServer->sendQueryBlockAuth(false, "EditorTrainees");
}