Skip to content

Commit d25f85d

Browse files
committedFeb 2, 2014
add checkbox in db conn dialog in order to keep the window open after adding a table
1 parent 983b1c9 commit d25f85d

File tree

5 files changed

+60
-17
lines changed

5 files changed

+60
-17
lines changed
 

‎src/providers/mssql/qgsmssqlsourceselect.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WFlags fl, bool
183183
mSearchColumnComboBox->setCurrentIndex( 2 );
184184

185185
restoreGeometry( settings.value( "/Windows/MSSQLSourceSelect/geometry" ).toByteArray() );
186+
mHoldDialogOpen->setChecked( settings.value( "/Windows/MSSQLSourceSelect/HoldDialogOpen", false ).toBool() );
186187

187188
for ( int i = 0; i < mTableModel.columnCount(); i++ )
188189
{
@@ -396,6 +397,7 @@ QgsMssqlSourceSelect::~QgsMssqlSourceSelect()
396397

397398
QSettings settings;
398399
settings.setValue( "/Windows/MSSQLSourceSelect/geometry", saveGeometry() );
400+
settings.setValue( "/Windows/MSSQLSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );
399401

400402
for ( int i = 0; i < mTableModel.columnCount(); i++ )
401403
{
@@ -448,7 +450,10 @@ void QgsMssqlSourceSelect::addTables()
448450
else
449451
{
450452
emit addDatabaseLayers( mSelectedTables, "mssql" );
451-
accept();
453+
if ( !mHoldDialogOpen->isChecked() )
454+
{
455+
accept();
456+
}
452457
}
453458
}
454459

‎src/providers/oracle/qgsoraclesourceselect.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ QgsOracleSourceSelect::QgsOracleSourceSelect( QWidget *parent, Qt::WFlags fl, bo
235235
mSearchColumnComboBox->setCurrentIndex( 2 );
236236

237237
restoreGeometry( settings.value( "/Windows/OracleSourceSelect/geometry" ).toByteArray() );
238+
mHoldDialogOpen->setChecked( settings.value( "/Windows/OracleSourceSelect/HoldDialogOpen", false ).toBool() );
238239

239240
for ( int i = 0; i < mTableModel.columnCount(); i++ )
240241
{
@@ -430,6 +431,7 @@ QgsOracleSourceSelect::~QgsOracleSourceSelect()
430431

431432
QSettings settings;
432433
settings.setValue( "/Windows/OracleSourceSelect/geometry", saveGeometry() );
434+
settings.setValue( "/Windows/OracleSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );
433435

434436
for ( int i = 0; i < mTableModel.columnCount(); i++ )
435437
{
@@ -476,7 +478,10 @@ void QgsOracleSourceSelect::addTables()
476478
else
477479
{
478480
emit addDatabaseLayers( mSelectedTables, "oracle" );
479-
accept();
481+
if ( !mHoldDialogOpen->isChecked() )
482+
{
483+
accept();
484+
}
480485
}
481486
}
482487

‎src/providers/postgres/qgspgsourceselect.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WFlags fl, bool manag
214214
QAbstractItemView::ExtendedSelection :
215215
QAbstractItemView::MultiSelection );
216216

217-
218217
//for Qt < 4.3.2, passing -1 to include all model columns
219218
//in search does not seem to work
220219
mSearchColumnComboBox->setCurrentIndex( 2 );
221220

222221
restoreGeometry( settings.value( "/Windows/PgSourceSelect/geometry" ).toByteArray() );
222+
mHoldDialogOpen->setChecked( settings.value( "/Windows/PgSourceSelect/HoldDialogOpen", false ).toBool() );
223223

224224
for ( int i = 0; i < mTableModel.columnCount(); i++ )
225225
{
@@ -414,6 +414,7 @@ QgsPgSourceSelect::~QgsPgSourceSelect()
414414

415415
QSettings settings;
416416
settings.setValue( "/Windows/PgSourceSelect/geometry", saveGeometry() );
417+
settings.setValue( "/Windows/PgSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );
417418

418419
for ( int i = 0; i < mTableModel.columnCount(); i++ )
419420
{
@@ -460,7 +461,10 @@ void QgsPgSourceSelect::addTables()
460461
else
461462
{
462463
emit addDatabaseLayers( mSelectedTables, "postgres" );
463-
accept();
464+
if ( !mHoldDialogOpen->isChecked() )
465+
{
466+
accept();
467+
}
464468
}
465469
}
466470

‎src/providers/spatialite/qgsspatialitesourceselect.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget * parent, Qt::WFla
4646

4747
QSettings settings;
4848
restoreGeometry( settings.value( "/Windows/SpatiaLiteSourceSelect/geometry" ).toByteArray() );
49+
mHoldDialogOpen->setChecked( settings.value( "/Windows/SpatiaLiteSourceSelect/HoldDialogOpen", false ).toBool() );
4950

5051
setWindowTitle( tr( "Add SpatiaLite Table(s)" ) );
5152
connectionsGroupBox->setTitle( tr( "Databases" ) );
@@ -116,6 +117,7 @@ QgsSpatiaLiteSourceSelect::~QgsSpatiaLiteSourceSelect()
116117
{
117118
QSettings settings;
118119
settings.setValue( "/Windows/SpatiaLiteSourceSelect/geometry", saveGeometry() );
120+
settings.setValue( "/Windows/SpatiaLiteSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );
119121
}
120122

121123
// Slot for performing action when the Add button is clicked
@@ -408,7 +410,10 @@ void QgsSpatiaLiteSourceSelect::addTables()
408410
else
409411
{
410412
emit addDatabaseLayers( m_selectedTables, "spatialite" );
411-
accept();
413+
if ( !mHoldDialogOpen->isChecked() )
414+
{
415+
accept();
416+
}
412417
}
413418
}
414419

‎src/ui/qgsdbsourceselectbase.ui

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>586</width>
9+
<width>592</width>
1010
<height>476</height>
1111
</rect>
1212
</property>
@@ -24,8 +24,8 @@
2424
<property name="modal">
2525
<bool>true</bool>
2626
</property>
27-
<layout class="QVBoxLayout" name="verticalLayout">
28-
<item>
27+
<layout class="QGridLayout" name="gridLayout_2">
28+
<item row="0" column="0">
2929
<widget class="QGroupBox" name="connectionsGroupBox">
3030
<property name="title">
3131
<string>Connections</string>
@@ -99,21 +99,45 @@
9999
</layout>
100100
</widget>
101101
</item>
102-
<item>
102+
<item row="1" column="0">
103103
<widget class="QTreeView" name="mTablesTreeView">
104104
<property name="selectionMode">
105105
<enum>QAbstractItemView::ExtendedSelection</enum>
106106
</property>
107107
</widget>
108108
</item>
109-
<item>
110-
<widget class="QCheckBox" name="cbxAllowGeometrylessTables">
111-
<property name="text">
112-
<string>Also list tables with no geometry</string>
113-
</property>
114-
</widget>
109+
<item row="2" column="0">
110+
<layout class="QHBoxLayout" name="horizontalLayout_2">
111+
<item>
112+
<widget class="QCheckBox" name="cbxAllowGeometrylessTables">
113+
<property name="text">
114+
<string>Also list tables with no geometry</string>
115+
</property>
116+
</widget>
117+
</item>
118+
<item>
119+
<spacer name="horizontalSpacer_2">
120+
<property name="orientation">
121+
<enum>Qt::Horizontal</enum>
122+
</property>
123+
<property name="sizeHint" stdset="0">
124+
<size>
125+
<width>40</width>
126+
<height>20</height>
127+
</size>
128+
</property>
129+
</spacer>
130+
</item>
131+
<item>
132+
<widget class="QCheckBox" name="mHoldDialogOpen">
133+
<property name="text">
134+
<string>Hold dialog open</string>
135+
</property>
136+
</widget>
137+
</item>
138+
</layout>
115139
</item>
116-
<item>
140+
<item row="3" column="0">
117141
<widget class="QGroupBox" name="mSearchGroupBox">
118142
<property name="title">
119143
<string>Search options</string>
@@ -197,7 +221,7 @@
197221
</layout>
198222
</widget>
199223
</item>
200-
<item>
224+
<item row="4" column="0">
201225
<widget class="QDialogButtonBox" name="buttonBox">
202226
<property name="standardButtons">
203227
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>

0 commit comments

Comments
 (0)
Please sign in to comment.