31
31
#include " qgscontexthelp.h"
32
32
#include " qgsapplication.h"
33
33
34
- QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog ( QWidget *parent, Qt::WindowFlags fl )
35
- : QDialog( parent, fl )
34
+ QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog ( QWidget *parent, Qt::WindowFlags fl, bool embeddedMode )
35
+ : QDialog( parent, fl ),
36
+ mEmbeddedMode( embeddedMode )
36
37
{
37
38
setupUi ( this );
38
39
40
+ if ( mEmbeddedMode )
41
+ {
42
+ buttonBox->removeButton ( buttonBox->button ( QDialogButtonBox::Cancel ) );
43
+ }
39
44
cmbDatabaseTypes->blockSignals ( true );
40
45
cmbConnections->blockSignals ( true );
41
46
radioSrcFile->setChecked ( true );
@@ -49,7 +54,7 @@ QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog( QWidget *parent, Qt::WindowF
49
54
50
55
restoreGeometry ( settings.value ( QStringLiteral ( " Windows/OpenVectorLayer/geometry" ) ).toByteArray () );
51
56
52
- // The specified decoding is added if not existing alread , and then set current.
57
+ // The specified decoding is added if not existing already , and then set current.
53
58
// This should select it.
54
59
int encindex = cmbEncodings->findText ( enc );
55
60
if ( encindex < 0 )
@@ -382,7 +387,14 @@ void QgsOpenVectorLayerDialog::accept()
382
387
// Save the used encoding
383
388
settings.setValue ( QStringLiteral ( " UI/encoding" ), encoding () );
384
389
385
- QDialog::accept ();
390
+ if ( ! mEmbeddedMode )
391
+ {
392
+ QDialog::accept ();
393
+ }
394
+ else if ( ! mDataSources .isEmpty ( ) )
395
+ {
396
+ emit addVectorLayers ( mDataSources , encoding (), dataSourceType ( ) );
397
+ }
386
398
}
387
399
388
400
void QgsOpenVectorLayerDialog::on_radioSrcFile_toggled ( bool checked )
0 commit comments