39
39
MODEL_IDX_WEB_SERVICE
40
40
};
41
41
42
- QgsGeoNodeSourceSelect::QgsGeoNodeSourceSelect ( QWidget *parent, Qt::WindowFlags fl, bool embeddedMode )
43
- : QDialog ( parent, fl )
42
+ QgsGeoNodeSourceSelect::QgsGeoNodeSourceSelect ( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
43
+ : QgsAbstractDataSourceWidget ( parent, fl, widgetMode )
44
44
{
45
45
setupUi ( this );
46
-
47
- if ( embeddedMode != QgsProviderRegistry::WidgetMode::None )
48
- {
49
- // For some obscure reasons hiding does not work!
50
- // buttonBox->button( QDialogButtonBox::Close )->hide();
51
- buttonBox->removeButton ( buttonBox->button ( QDialogButtonBox::Close ) );
52
- }
53
-
54
- mAddButton = new QPushButton ( tr ( " &Add" ) );
55
- mAddButton ->setEnabled ( false );
56
-
57
- buttonBox->addButton ( mAddButton , QDialogButtonBox::ActionRole );
46
+ setupButtons ( buttonBox );
47
+ connect ( buttonBox, &QDialogButtonBox::helpRequested, this , &QgsGeoNodeSourceSelect::showHelp );
58
48
59
49
populateConnectionList ();
60
50
61
- connect ( buttonBox, &QDialogButtonBox::rejected, this , &QgsGeoNodeSourceSelect::reject );
62
51
connect ( btnNew, &QPushButton::clicked, this , &QgsGeoNodeSourceSelect::addConnectionsEntryList );
63
52
connect ( btnEdit, &QPushButton::clicked, this , &QgsGeoNodeSourceSelect::modifyConnectionsEntryList );
64
53
connect ( btnDelete, &QPushButton::clicked, this , &QgsGeoNodeSourceSelect::deleteConnectionsEntryList );
@@ -67,7 +56,6 @@ QgsGeoNodeSourceSelect::QgsGeoNodeSourceSelect( QWidget *parent, Qt::WindowFlags
67
56
connect ( btnLoad, &QPushButton::clicked, this , &QgsGeoNodeSourceSelect::loadGeonodeConnection );
68
57
connect ( lineFilter, &QLineEdit::textChanged, this , &QgsGeoNodeSourceSelect::filterChanged );
69
58
connect ( treeView, &QTreeView::clicked, this , &QgsGeoNodeSourceSelect::treeViewSelectionChanged );
70
- connect ( mAddButton , &QPushButton::clicked, this , &QgsGeoNodeSourceSelect::addButtonClicked );
71
59
72
60
mItemDelegate = new QgsGeonodeItemDelegate ( treeView );
73
61
treeView->setItemDelegate ( mItemDelegate );
@@ -185,6 +173,12 @@ void QgsGeoNodeSourceSelect::setConnectionListPosition()
185
173
}
186
174
}
187
175
176
+ void QgsGeoNodeSourceSelect::showHelp ()
177
+ {
178
+ // TODO - correct URL
179
+ // QgsHelp::openHelp( QStringLiteral( "managing_data_source/opening_data.html#spatialite-layers" ) );
180
+ }
181
+
188
182
void QgsGeoNodeSourceSelect::connectToGeonodeConnection ()
189
183
{
190
184
QApplication::setOverrideCursor ( Qt::BusyCursor );
@@ -366,7 +360,7 @@ void QgsGeoNodeSourceSelect::treeViewSelectionChanged()
366
360
qDebug () << " Current index is invalid" ;
367
361
return ;
368
362
}
369
- mAddButton ->setEnabled ( false );
363
+ addButton () ->setEnabled ( false );
370
364
QModelIndexList modelIndexList = treeView->selectionModel ()->selectedRows ();
371
365
for ( int i = 0 ; i < modelIndexList.size (); i++ )
372
366
{
@@ -380,7 +374,7 @@ void QgsGeoNodeSourceSelect::treeViewSelectionChanged()
380
374
if ( typeItem == tr ( " Layer" ) )
381
375
{
382
376
// Enable if there is a layer selected
383
- mAddButton ->setEnabled ( true );
377
+ addButton () ->setEnabled ( true );
384
378
return ;
385
379
}
386
380
}
0 commit comments