Skip to content

Commit

Permalink
Merge pull request #1138 from slarosa/hold_dialog_db_conn
Browse files Browse the repository at this point in the history
[GUI] add checkbox in db conn dialog in order to keep the window open after adding a table
  • Loading branch information
jef-n committed Mar 22, 2014
2 parents 10ede56 + d25f85d commit e392efa
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 17 deletions.
7 changes: 6 additions & 1 deletion src/providers/mssql/qgsmssqlsourceselect.cpp
Expand Up @@ -183,6 +183,7 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WFlags fl, bool
mSearchColumnComboBox->setCurrentIndex( 2 );

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

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

QSettings settings;
settings.setValue( "/Windows/MSSQLSourceSelect/geometry", saveGeometry() );
settings.setValue( "/Windows/MSSQLSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );

for ( int i = 0; i < mTableModel.columnCount(); i++ )
{
Expand Down Expand Up @@ -448,7 +450,10 @@ void QgsMssqlSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "mssql" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/providers/oracle/qgsoraclesourceselect.cpp
Expand Up @@ -235,6 +235,7 @@ QgsOracleSourceSelect::QgsOracleSourceSelect( QWidget *parent, Qt::WFlags fl, bo
mSearchColumnComboBox->setCurrentIndex( 2 );

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

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

QSettings settings;
settings.setValue( "/Windows/OracleSourceSelect/geometry", saveGeometry() );
settings.setValue( "/Windows/OracleSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );

for ( int i = 0; i < mTableModel.columnCount(); i++ )
{
Expand Down Expand Up @@ -476,7 +478,10 @@ void QgsOracleSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "oracle" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/providers/postgres/qgspgsourceselect.cpp
Expand Up @@ -214,12 +214,12 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WFlags fl, bool manag
QAbstractItemView::ExtendedSelection :
QAbstractItemView::MultiSelection );


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

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

for ( int i = 0; i < mTableModel.columnCount(); i++ )
{
Expand Down Expand Up @@ -414,6 +414,7 @@ QgsPgSourceSelect::~QgsPgSourceSelect()

QSettings settings;
settings.setValue( "/Windows/PgSourceSelect/geometry", saveGeometry() );
settings.setValue( "/Windows/PgSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );

for ( int i = 0; i < mTableModel.columnCount(); i++ )
{
Expand Down Expand Up @@ -460,7 +461,10 @@ void QgsPgSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "postgres" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/providers/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -46,6 +46,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget * parent, Qt::WFla

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

setWindowTitle( tr( "Add SpatiaLite Table(s)" ) );
connectionsGroupBox->setTitle( tr( "Databases" ) );
Expand Down Expand Up @@ -116,6 +117,7 @@ QgsSpatiaLiteSourceSelect::~QgsSpatiaLiteSourceSelect()
{
QSettings settings;
settings.setValue( "/Windows/SpatiaLiteSourceSelect/geometry", saveGeometry() );
settings.setValue( "/Windows/SpatiaLiteSourceSelect/HoldDialogOpen", mHoldDialogOpen->isChecked() );
}

// Slot for performing action when the Add button is clicked
Expand Down Expand Up @@ -408,7 +410,10 @@ void QgsSpatiaLiteSourceSelect::addTables()
else
{
emit addDatabaseLayers( m_selectedTables, "spatialite" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

Expand Down
48 changes: 36 additions & 12 deletions src/ui/qgsdbsourceselectbase.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<width>592</width>
<height>476</height>
</rect>
</property>
Expand All @@ -24,8 +24,8 @@
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="connectionsGroupBox">
<property name="title">
<string>Connections</string>
Expand Down Expand Up @@ -99,21 +99,45 @@
</layout>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QTreeView" name="mTablesTreeView">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxAllowGeometrylessTables">
<property name="text">
<string>Also list tables with no geometry</string>
</property>
</widget>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="cbxAllowGeometrylessTables">
<property name="text">
<string>Also list tables with no geometry</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="mHoldDialogOpen">
<property name="text">
<string>Hold dialog open</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<item row="3" column="0">
<widget class="QGroupBox" name="mSearchGroupBox">
<property name="title">
<string>Search options</string>
Expand Down Expand Up @@ -197,7 +221,7 @@
</layout>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
Expand Down

0 comments on commit e392efa

Please sign in to comment.