Skip to content

Commit

Permalink
Fixes #38979 : Fix oracle new connection greyed ok button
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Oct 5, 2020
1 parent 7f8c036 commit a3c4fe4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/providers/oracle/qgsoraclenewconnection.cpp
Expand Up @@ -195,6 +195,11 @@ void QgsOracleNewConnection::showHelp()

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 );
}
6 changes: 5 additions & 1 deletion src/ui/qgsoraclenewconnectionbase.ui
Expand Up @@ -55,7 +55,11 @@
</property>
<layout class="QGridLayout" name="gridLayout_1">
<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 row="3" column="1" colspan="2">
<widget class="QLineEdit" name="txtPort">
Expand Down

0 comments on commit a3c4fe4

Please sign in to comment.