@@ -390,26 +390,37 @@ void QgsProcessingLayerOutputDestinationWidget::saveToGeopackage()
390
390
391
391
void QgsProcessingLayerOutputDestinationWidget::saveToPostGIS ()
392
392
{
393
- QgsNewDatabaseTableNameDialog dlg ( mBrowserModel , QStringList () << QStringLiteral ( " postgres" ), this );
394
- dlg.setWindowTitle ( tr ( " Save to PostGIS Table" ) );
395
- if ( dlg.exec () && dlg.isValid () )
393
+ if ( QgsPanelWidget *panel = QgsPanelWidget::findParentPanel ( this ) )
396
394
{
397
- mUseTemporary = false ;
395
+ QgsNewDatabaseTableNameWidget *widget = new QgsNewDatabaseTableNameWidget ( mBrowserModel , QStringList () << QStringLiteral ( " postgres" ), this );
396
+ widget->setPanelTitle ( tr ( " Save “%1” to PostGIS Table" ).arg ( mParameter ->description () ) );
398
397
399
- QgsDataSourceUri uri = QgsDataSourceUri ( dlg. uri () );
398
+ panel-> openPanel ( widget );
400
399
401
- QString geomColumn;
402
- if ( const QgsProcessingParameterFeatureSink *sink = dynamic_cast < const QgsProcessingParameterFeatureSink * >( mParameter ) )
400
+ auto changed = [ = ]
403
401
{
404
- if ( sink->hasGeometry () )
405
- geomColumn = QStringLiteral ( " geom" );
406
- }
407
- uri.setGeometryColumn ( geomColumn );
402
+ mUseTemporary = false ;
408
403
409
- leText-> setText ( QStringLiteral ( " postgis:%1 " ). arg ( uri. uri () ) );
404
+ QgsDataSourceUri uri = QgsDataSourceUri ( widget-> uri ( ) );
410
405
411
- emit skipOutputChanged ( false );
412
- emit destinationChanged ();
406
+ QString geomColumn;
407
+ if ( const QgsProcessingParameterFeatureSink *sink = dynamic_cast < const QgsProcessingParameterFeatureSink * >( mParameter ) )
408
+ {
409
+ if ( sink->hasGeometry () )
410
+ geomColumn = QStringLiteral ( " geom" );
411
+ }
412
+ uri.setGeometryColumn ( geomColumn );
413
+
414
+ leText->setText ( QStringLiteral ( " postgis:%1" ).arg ( uri.uri () ) );
415
+
416
+ emit skipOutputChanged ( false );
417
+ emit destinationChanged ();
418
+ };
419
+
420
+ connect ( widget, &QgsNewDatabaseTableNameWidget::tableNameChanged, this , [ = ] { changed (); } );
421
+ connect ( widget, &QgsNewDatabaseTableNameWidget::schemaNameChanged, this , [ = ] { changed (); } );
422
+ connect ( widget, &QgsNewDatabaseTableNameWidget::validationChanged, this , [ = ] { changed (); } );
423
+ connect ( widget, &QgsNewDatabaseTableNameWidget::providerKeyChanged, this , [ = ] { changed (); } );
413
424
}
414
425
}
415
426
0 commit comments