Fixes #38979 : Fix oracle new connection greyed ok button

This commit is contained in:
Julien Cabieces 2020-10-02 09:41:34 +02:00 committed by Nyall Dawson
parent 7f8c0365b1
commit a3c4fe44ab
2 changed files with 11 additions and 2 deletions

View File

@ -195,6 +195,11 @@ void QgsOracleNewConnection::showHelp()
void QgsOracleNewConnection::updateOkButtonState() void QgsOracleNewConnection::updateOkButtonState()
{ {
bool enabled = !txtName->text().isEmpty() && !txtHost->text().isEmpty() && !txtPort->text().isEmpty() && !txtDatabase->text().isEmpty(); // User can set database without host and port, meaning he is using a service (tnsnames.ora)
// if he sets host, port has to be set also (and vice versa)
// https://github.com/qgis/QGIS/issues/38979
bool enabled = !txtName->text().isEmpty() && !txtDatabase->text().isEmpty()
&& ( txtHost->text().isEmpty() == txtPort->text().isEmpty() );
buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled ); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled );
} }

View File

@ -55,7 +55,11 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_1"> <layout class="QGridLayout" name="gridLayout_1">
<item row="1" column="1" colspan="2"> <item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="txtDatabase"/> <widget class="QLineEdit" name="txtDatabase">
<property name="toolTip">
<string>Database name, or service name (described in tnsnames.ora) if no host and port has been set</string>
</property>
</widget>
</item> </item>
<item row="3" column="1" colspan="2"> <item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="txtPort"> <widget class="QLineEdit" name="txtPort">