Skip to content

Commit

Permalink
allow switching between geometry and all tables in the selection dialog
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15281 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 27, 2011
1 parent ed9af81 commit e4bcb6a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/app/postgres/qgspgsourceselect.cpp
Expand Up @@ -117,6 +117,8 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WFlags fl )
mSearchModeComboBox->setVisible( false );
mSearchModeLabel->setVisible( false );
mSearchTableEdit->setVisible( false );

cbxAllowGeometrylessTables->setDisabled( true );
}
/** Autoconnected SLOTS **/
// Slot for adding a new connection
Expand Down Expand Up @@ -147,6 +149,7 @@ void QgsPgSourceSelect::on_btnDelete_clicked()
settings.remove( key + "/sslmode" );
settings.remove( key + "/publicOnly" );
settings.remove( key + "/geometryColumnsOnly" );
settings.remove( key + "/allowGeometrylessTables" );
settings.remove( key + "/estimatedMetadata" );
settings.remove( key + "/saveUsername" );
settings.remove( key + "/savePassword" );
Expand Down Expand Up @@ -194,6 +197,15 @@ void QgsPgSourceSelect::on_cmbConnections_activated( int )
// Remember which database was selected.
QSettings settings;
settings.setValue( "/PostgreSQL/connections/selected", cmbConnections->currentText() );

cbxAllowGeometrylessTables->blockSignals( true );
cbxAllowGeometrylessTables->setChecked( settings.value( "/PostgreSQL/connections/" + cmbConnections->currentText() + "/allowGeometrylessTables", false ).toBool() );
cbxAllowGeometrylessTables->blockSignals( false );
}

void QgsPgSourceSelect::on_cbxAllowGeometrylessTables_stateChanged( int )
{
on_btnConnect_clicked();
}

void QgsPgSourceSelect::on_btnBuildQuery_clicked()
Expand Down Expand Up @@ -410,6 +422,8 @@ void QgsPgSourceSelect::addTables()

void QgsPgSourceSelect::on_btnConnect_clicked()
{
cbxAllowGeometrylessTables->setEnabled( true );

if ( mColumnTypeThread )
{
mColumnTypeThread->stop();
Expand Down Expand Up @@ -444,7 +458,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()

bool searchPublicOnly = settings.value( key + "/publicOnly" ).toBool();
bool searchGeometryColumnsOnly = settings.value( key + "/geometryColumnsOnly" ).toBool();
bool allowGeometrylessTables = settings.value( key + "/allowGeometrylessTables", false ).toBool();
bool allowGeometrylessTables = cbxAllowGeometrylessTables->isChecked();
mUseEstimatedMetadata = settings.value( key + "/estimatedMetadata" ).toBool();
// Need to escape the password to allow for single quotes and backslashes

Expand Down
1 change: 1 addition & 0 deletions src/app/postgres/qgspgsourceselect.h
Expand Up @@ -124,6 +124,7 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
* Once connected, available layers are displayed.
*/
void on_btnConnect_clicked();
void on_cbxAllowGeometrylessTables_stateChanged( int );
//! Opens the create connection dialog to build a new connection
void on_btnNew_clicked();
//! Opens a dialog to edit an existing connection
Expand Down
1 change: 1 addition & 0 deletions src/app/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -84,6 +84,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags
mSearchModeComboBox->setVisible( false );
mSearchModeLabel->setVisible( false );
mSearchTableEdit->setVisible( false );
cbxAllowGeometrylessTables->setVisible( false );
}

// Slot for performing action when the Add button is clicked
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsdbsourceselectbase.ui
Expand Up @@ -76,6 +76,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxAllowGeometrylessTables">
<property name="text">
<string>Allow geometryless tables</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBuildQuery">
<property name="enabled">
Expand Down

0 comments on commit e4bcb6a

Please sign in to comment.