Рефакт Администрирование БД

This commit is contained in:
2025-11-05 12:36:11 +03:00
parent e9363c388b
commit 84ea6ca512
8 changed files with 102 additions and 54 deletions

View File

@@ -1,4 +1,5 @@
#include <QXmlStreamReader>
#include <QMessageBox>
#include "dialogsettingstray.h"
#include "Systems/tools.h"
#include "ui_dialogsettingstray.h"
@@ -240,16 +241,39 @@ void DialogSettingsTray::on_editPassword_textChanged(const QString &arg1)
void DialogSettingsTray::on_btnCheckDB_clicked()
{
DialogCheckDB dlgCheckDB(providerDBLMS, this);
dlgCheckDB.setWindowFlags(dlgCheckDB.windowFlags() & ~Qt::WindowContextHelpButtonHint);
switch( dlgCheckDB.exec() )
//Проверяем, установлен ли PostgreSQL
if(!providerDBLMS->checkDriverQPSQLavailable())
{
case QDialog::Accepted:
break;
case QDialog::Rejected:
break;
default:
break;
QMessageBox::critical(this, tr("Error!"), tr("Driver PostgreSQL is not installed!"));
return;
}
//TODO Запрос Логина и Пароля Суперюзера PostgreSQL (postgres)
QString UserNamePostgres;
QString PasswordPostgres;
//Имитация
UserNamePostgres = "postgres";
PasswordPostgres = "12345678";
if(providerDBLMS->setUserPasswordPostgres(UserNamePostgres, PasswordPostgres))
{
DialogCheckDB dlgCheckDB(providerDBLMS, this);
dlgCheckDB.setWindowFlags(dlgCheckDB.windowFlags() & ~Qt::WindowContextHelpButtonHint);
switch( dlgCheckDB.exec() )
{
case QDialog::Accepted:
break;
case QDialog::Rejected:
break;
default:
break;
}
}
else
{
QMessageBox::critical(this, tr("Error!"), tr("The superuser login or password is incorrect!"));
return;
}
}