Skip to content
Permalink
Browse files

Merge pull request #1138 from slarosa/hold_dialog_db_conn

[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 e392efab15c47ba6cf247dfee10f01de3aa8354a
@@ -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++ )
{
@@ -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++ )
{
@@ -448,7 +450,10 @@ void QgsMssqlSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "mssql" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

@@ -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++ )
{
@@ -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++ )
{
@@ -476,7 +478,10 @@ void QgsOracleSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "oracle" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

@@ -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++ )
{
@@ -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++ )
{
@@ -460,7 +461,10 @@ void QgsPgSourceSelect::addTables()
else
{
emit addDatabaseLayers( mSelectedTables, "postgres" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

@@ -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" ) );
@@ -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
@@ -408,7 +410,10 @@ void QgsSpatiaLiteSourceSelect::addTables()
else
{
emit addDatabaseLayers( m_selectedTables, "spatialite" );
accept();
if ( !mHoldDialogOpen->isChecked() )
{
accept();
}
}
}

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<width>592</width>
<height>476</height>
</rect>
</property>
@@ -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>
@@ -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>
@@ -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>

0 comments on commit e392efa

Please sign in to comment.
You can’t perform that action at this time.