Skip to content
Permalink
Browse files

Merge pull request #5616 from boundlessgeo/datasource-manager-add-close

[gui] Datasource manager remove Ok and add Close
  • Loading branch information
elpaso committed Nov 15, 2017
2 parents b95588c + f177ba3 commit 340f7abbb0c3b4ee81a891ab3561edd1be004f47
@@ -53,11 +53,6 @@ Destructor
being added.
%End

virtual void okButtonClicked();
%Docstring
Triggered when the dialog is accepted, call addButtonClicked() and
emit the accepted() signal
%End

signals:

@@ -38,26 +38,17 @@ const QgsMapCanvas *QgsAbstractDataSourceWidget::mapCanvas() const
void QgsAbstractDataSourceWidget::setupButtons( QDialogButtonBox *buttonBox )
{

if ( mWidgetMode == QgsProviderRegistry::WidgetMode::None )
{
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
buttonBox->addButton( closeButton, QDialogButtonBox::ApplyRole );
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
}

mAddButton = new QPushButton( tr( "&Add" ) );
mAddButton->setToolTip( tr( "Add selected layers to map" ) );
mAddButton->setEnabled( false );
buttonBox->addButton( mAddButton, QDialogButtonBox::ApplyRole );
connect( mAddButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::addButtonClicked );
connect( this, &QgsAbstractDataSourceWidget::enableButtons, mAddButton, &QPushButton::setEnabled );

QPushButton *okButton = new QPushButton( tr( "&Ok" ) );
okButton->setToolTip( tr( "Add selected layers to map and close this dialog" ) );
okButton->setEnabled( false );
buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
connect( okButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::okButtonClicked );
connect( this, &QgsAbstractDataSourceWidget::enableButtons, okButton, &QPushButton::setEnabled );
QPushButton *closeButton = new QPushButton( tr( "&Close" ) );
closeButton->setToolTip( tr( "Close this dialog without adding any layer" ) );
buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole );
connect( closeButton, &QPushButton::clicked, this, &QgsAbstractDataSourceWidget::reject );

}

@@ -67,8 +58,3 @@ void QgsAbstractDataSourceWidget::setMapCanvas( const QgsMapCanvas *mapCanvas )
mMapCanvas = mapCanvas;
}

void QgsAbstractDataSourceWidget::okButtonClicked()
{
addButtonClicked();
emit accepted();
}
@@ -69,11 +69,6 @@ class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
*/
virtual void addButtonClicked() { }

/**
* Triggered when the dialog is accepted, call addButtonClicked() and
* emit the accepted() signal
*/
virtual void okButtonClicked();

signals:

@@ -60,7 +60,7 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsBrowserModel *browser

// Add provider dialogs
const QList<QgsSourceSelectProvider *> sourceSelectProviders = QgsGui::sourceSelectProviderRegistry()->providers( );
for ( const auto provider : sourceSelectProviders )
for ( const auto &provider : sourceSelectProviders )
{
QgsAbstractDataSourceWidget *dlg = provider->createDataSourceWidget( this );
if ( !dlg )

0 comments on commit 340f7ab

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