Skip to content
Permalink
Browse files

More refactoring

  • Loading branch information
nyalldawson committed Oct 8, 2018
1 parent ad25261 commit 7464575f2c04a8dd388704c96dc5df36a967fed9
@@ -16,6 +16,7 @@
***************************************************************************/

#include "qgsmssqldataitems.h"
#include "qgsmssqlconnection.h"

#include "qgsmssqlgeomcolumntypethread.h"
#include "qgslogger.h"
@@ -71,9 +72,9 @@ void QgsMssqlConnectionItem::readConnectionSettings()
mPassword = settings.value( key + "/password" ).toString();
}

mUseGeometryColumns = settings.value( key + "/geometryColumns", false ).toBool();
mUseEstimatedMetadata = settings.value( key + "/estimatedMetadata", false ).toBool();
mAllowGeometrylessTables = settings.value( key + "/allowGeometrylessTables", true ).toBool();
mUseGeometryColumns = QgsMssqlConnection::useEstimatedMetadata( mName );
mUseEstimatedMetadata = QgsMssqlConnection::useEstimatedMetadata( mName );
mAllowGeometrylessTables = QgsMssqlConnection::allowGeometrylessTables( mName );

mConnInfo = "dbname='" + mDatabase + "' host='" + mHost + "' user='" + mUsername + "' password='" + mPassword + '\'';
if ( !mService.isEmpty() )
@@ -356,12 +357,10 @@ QList<QAction *> QgsMssqlConnectionItem::actions( QWidget *parent )
return lst;
}

void QgsMssqlConnectionItem::setAllowGeometrylessTables( bool allow )
void QgsMssqlConnectionItem::setAllowGeometrylessTables( const bool allow )
{
mAllowGeometrylessTables = allow;
QString key = "/MSSQL/connections/" + mName;
QgsSettings settings;
settings.setValue( key + "/allowGeometrylessTables", allow );
QgsMssqlConnection::setAllowGeometrylessTables( mName, allow );
refresh();
}

@@ -50,7 +50,7 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString &co
listDatabase->addItem( settings.value( key + "/database" ).toString() );
listDatabase->setCurrentRow( 0 );
cb_geometryColumns->setChecked( QgsMssqlConnection::geometryColumnsOnly( connName ) );
cb_allowGeometrylessTables->setChecked( QgsMssqlConnection::geometryColumnsOnly( connName ) );
cb_allowGeometrylessTables->setChecked( QgsMssqlConnection::allowGeometrylessTables( connName ) );
cb_useEstimatedMetadata->setChecked( QgsMssqlConnection::useEstimatedMetadata( connName ) );

if ( settings.value( key + "/saveUsername" ).toString() == QLatin1String( "true" ) )
@@ -293,7 +293,7 @@ void QgsMssqlSourceSelect::cmbConnections_activated( int )
settings.setValue( QStringLiteral( "MSSQL/connections/selected" ), cmbConnections->currentText() );

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

@@ -495,11 +495,9 @@ void QgsMssqlSourceSelect::btnConnect_clicked()
password = settings.value( key + "/password" ).toString();
}

bool useGeometryColumns = settings.value( key + "/geometryColumns", false ).toBool();

bool useGeometryColumns = QgsMssqlConnection::geometryColumnsOnly( cmbConnections->currentText() );
bool allowGeometrylessTables = cbxAllowGeometrylessTables->isChecked();

bool estimateMetadata = settings.value( key + "/estimatedMetadata", true ).toBool();
bool estimateMetadata = QgsMssqlConnection::useEstimatedMetadata( cmbConnections->currentText() );

mConnInfo = "dbname='" + database + '\'';
if ( !host.isEmpty() )

0 comments on commit 7464575

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