Skip to content

Commit

Permalink
Fix disabled add button in ogr source select for valid protocols
Browse files Browse the repository at this point in the history
Fixes #17206
  • Loading branch information
nyalldawson committed Oct 18, 2017
1 parent c295c92 commit df0d717
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/providers/ogr/qgsogrsourceselect.cpp
Expand Up @@ -114,7 +114,14 @@ QgsOgrSourceSelect::QgsOgrSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & path )
{
mVectorPath = path;
emit enableButtons( ! mVectorPath.isEmpty() );
if ( radioSrcFile->isChecked() || radioSrcDirectory->isChecked() )
emit enableButtons( ! mVectorPath.isEmpty() );
} );

connect( protocolURI, &QLineEdit::textChanged, this, [ = ]( const QString & text )
{
if ( radioSrcProtocol->isChecked() )
emit enableButtons( !text.isEmpty() );
} );
}

Expand Down Expand Up @@ -378,6 +385,8 @@ void QgsOgrSourceSelect::radioSrcFile_toggled( bool checked )
mFileWidget->setFilePath( QString() );

mDataSourceType = QStringLiteral( "file" );

emit enableButtons( ! mFileWidget->filePath().isEmpty() );
}
}

Expand All @@ -396,6 +405,8 @@ void QgsOgrSourceSelect::radioSrcDirectory_toggled( bool checked )
mFileWidget->setFilePath( QString() );

mDataSourceType = QStringLiteral( "directory" );

emit enableButtons( ! mFileWidget->filePath().isEmpty() );
}
}

Expand All @@ -412,6 +423,8 @@ void QgsOgrSourceSelect::radioSrcDatabase_toggled( bool checked )
populateConnectionList();
setConnectionListPosition();
mDataSourceType = QStringLiteral( "database" );

emit enableButtons( true );
}
}

Expand All @@ -423,6 +436,8 @@ void QgsOgrSourceSelect::radioSrcProtocol_toggled( bool checked )
dbGroupBox->hide();
protocolGroupBox->show();
mDataSourceType = QStringLiteral( "protocol" );

emit enableButtons( ! protocolURI->text().isEmpty() );
}
}

Expand Down

0 comments on commit df0d717

Please sign in to comment.