Skip to content
Permalink
Browse files

[mssql] Don't allow creating connection only when both Host and Provi…

…der/DSN are empty

Adds the possibility to create a connection when Provider/DSN parameter is specified and the Host parameter is empty.
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Sep 2, 2020
1 parent ccd7ed3 commit a7859915d063d691569e41186c77578cb80206fe
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/providers/mssql/qgsmssqlnewconnection.cpp
@@ -41,6 +41,7 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString &co

buttonBox->button( QDialogButtonBox::Ok )->setDisabled( true );
connect( txtName, &QLineEdit::textChanged, this, &QgsMssqlNewConnection::updateOkButtonState );
connect( txtService, &QLineEdit::textChanged, this, &QgsMssqlNewConnection::updateOkButtonState );
connect( txtHost, &QLineEdit::textChanged, this, &QgsMssqlNewConnection::updateOkButtonState );
connect( listDatabase, &QListWidget::currentItemChanged, this, &QgsMssqlNewConnection::updateOkButtonState );

@@ -252,6 +253,6 @@ void QgsMssqlNewConnection::showHelp()
void QgsMssqlNewConnection::updateOkButtonState()
{
QListWidgetItem *item = listDatabase->currentItem();
bool enabled = !txtName->text().isEmpty() && !txtHost->text().isEmpty() && item;
buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled );
bool disabled = txtName->text().isEmpty() || ( txtService->text().isEmpty() && txtHost->text().isEmpty() ) || !item;
buttonBox->button( QDialogButtonBox::Ok )->setDisabled( disabled );
}

0 comments on commit a785991

Please sign in to comment.
You can’t perform that action at this time.