void ProgSettings::openSettingConnection() { DlgSettingConnect *dlg = new DlgSettingConnect(QApplication::activeWindow()); dlg->SetDBType(DBType()); dlg->SetDBName(DBName()); dlg->SetDBHostName(DBHostName()); dlg->SetDBUserName(DBUserName()); dlg->SetDBPassword(DBPassword()); dlg->SetDBPort(DBPort()); if ((dlg->exec() == QDialog::Accepted) && (dlg->IsModified())) { SetDBType(dlg->DBType()); SetDBName(dlg->DBName()); SetDBHostName(dlg->DBHostName()); SetDBUserName(dlg->DBUserName()); SetDBPassword(dlg->DBPassword()); SetDBPort(dlg->DBPort()); if (QSqlDatabase::database().isValid() & QSqlDatabase::database().isOpen()) { QSqlDatabase::database().close(); QSqlDatabase::removeDatabase(QSqlDatabase::database().connectionName()); } } }
/// Database workflow: open and setup. Status setUp() override { DBType().swap(db_); return Status(0); }