Skip to content

Commit df0d717

Browse files
committedOct 18, 2017
Fix disabled add button in ogr source select for valid protocols
Fixes #17206
1 parent c295c92 commit df0d717

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

‎src/providers/ogr/qgsogrsourceselect.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ QgsOgrSourceSelect::QgsOgrSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
114114
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & path )
115115
{
116116
mVectorPath = path;
117-
emit enableButtons( ! mVectorPath.isEmpty() );
117+
if ( radioSrcFile->isChecked() || radioSrcDirectory->isChecked() )
118+
emit enableButtons( ! mVectorPath.isEmpty() );
119+
} );
120+
121+
connect( protocolURI, &QLineEdit::textChanged, this, [ = ]( const QString & text )
122+
{
123+
if ( radioSrcProtocol->isChecked() )
124+
emit enableButtons( !text.isEmpty() );
118125
} );
119126
}
120127

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

380387
mDataSourceType = QStringLiteral( "file" );
388+
389+
emit enableButtons( ! mFileWidget->filePath().isEmpty() );
381390
}
382391
}
383392

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

398407
mDataSourceType = QStringLiteral( "directory" );
408+
409+
emit enableButtons( ! mFileWidget->filePath().isEmpty() );
399410
}
400411
}
401412

@@ -412,6 +423,8 @@ void QgsOgrSourceSelect::radioSrcDatabase_toggled( bool checked )
412423
populateConnectionList();
413424
setConnectionListPosition();
414425
mDataSourceType = QStringLiteral( "database" );
426+
427+
emit enableButtons( true );
415428
}
416429
}
417430

@@ -423,6 +436,8 @@ void QgsOgrSourceSelect::radioSrcProtocol_toggled( bool checked )
423436
dbGroupBox->hide();
424437
protocolGroupBox->show();
425438
mDataSourceType = QStringLiteral( "protocol" );
439+
440+
emit enableButtons( ! protocolURI->text().isEmpty() );
426441
}
427442
}
428443

0 commit comments

Comments
 (0)
Please sign in to comment.