Skip to content
Permalink
Browse files

harmonize all providers to use lowercase qgis as settings key (#4252)

(fixes ArcGisRest browser / connection dialog)
  • Loading branch information
nirvn committed Mar 13, 2017
1 parent 5c02c8a commit 1ca73f4f29093cbd64c7c9dbed192d01fba2e93c
@@ -42,8 +42,8 @@ QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connN

QgsSettings settings;

QString key = "/Qgis/connections-" + mService.toLower() + '/' + mConnName;
QString credentialsKey = "/Qgis/" + mService + '/' + mConnName;
QString key = "qgis//connections-" + mService.toLower() + '/' + mConnName;
QString credentialsKey = "qgis//" + mService + '/' + mConnName;

QStringList connStringParts;

@@ -99,25 +99,25 @@ QgsDataSourceUri QgsOwsConnection::uri() const
QStringList QgsOwsConnection::connectionList( const QString &service )
{
QgsSettings settings;
settings.beginGroup( "/Qgis/connections-" + service.toLower() );
settings.beginGroup( "qgis//connections-" + service.toLower() );
return settings.childGroups();
}

QString QgsOwsConnection::selectedConnection( const QString &service )
{
QgsSettings settings;
return settings.value( "/Qgis/connections-" + service.toLower() + "/selected" ).toString();
return settings.value( "qgis//connections-" + service.toLower() + "/selected" ).toString();
}

void QgsOwsConnection::setSelectedConnection( const QString &service, const QString &name )
{
QgsSettings settings;
settings.setValue( "/Qgis/connections-" + service.toLower() + "/selected", name );
settings.setValue( "qgis//connections-" + service.toLower() + "/selected", name );
}

void QgsOwsConnection::deleteConnection( const QString &service, const QString &name )
{
QgsSettings settings;
settings.remove( "/Qgis/connections-" + service.toLower() + '/' + name );
settings.remove( "/Qgis/" + service + '/' + name );
settings.remove( "qgis//connections-" + service.toLower() + '/' + name );
settings.remove( "qgis//" + service + '/' + name );
}
@@ -69,7 +69,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
QgsSettings settings;

QString key = mBaseKey + connName;
QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + '/' + connName;
QString credentialsKey = "qgis//" + mCredentialsBaseKey + '/' + connName;
txtName->setText( connName );
txtUrl->setText( settings.value( key + "/url" ).toString() );

@@ -124,23 +124,23 @@ QgsNewHttpConnection::QgsNewHttpConnection(
}
}

if ( mBaseKey != QLatin1String( "/Qgis/connections-wms/" ) )
if ( mBaseKey != QLatin1String( "qgis//connections-wms/" ) )
{
if ( mBaseKey != QLatin1String( "/Qgis/connections-wcs/" ) &&
mBaseKey != QLatin1String( "/Qgis/connections-wfs/" ) )
if ( mBaseKey != QLatin1String( "qgis//connections-wcs/" ) &&
mBaseKey != QLatin1String( "qgis//connections-wfs/" ) )
{
cbxIgnoreAxisOrientation->setVisible( false );
cbxInvertAxisOrientation->setVisible( false );
mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation );
mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation );
}

if ( mBaseKey == QLatin1String( "/Qgis/connections-wfs/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wfs/" ) )
{
cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation (WFS 1.1/WFS 2.0)" ) );
}

if ( mBaseKey == QLatin1String( "/Qgis/connections-wcs/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wcs/" ) )
{
cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) );
cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) );
@@ -167,7 +167,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
mGroupBox->layout()->removeWidget( lblReferer );
}

if ( mBaseKey != QLatin1String( "/Qgis/connections-wfs/" ) )
if ( mBaseKey != QLatin1String( "qgis//connections-wfs/" ) )
{
cmbVersion->setVisible( false );
mGroupBox->layout()->removeWidget( cmbVersion );
@@ -201,7 +201,7 @@ void QgsNewHttpConnection::accept()
{
QgsSettings settings;
QString key = mBaseKey + txtName->text();
QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + '/' + txtName->text();
QString credentialsKey = "qgis//" + mCredentialsBaseKey + '/' + txtName->text();

// warn if entry was renamed to an existing connection
if ( ( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) &&
@@ -227,7 +227,7 @@ void QgsNewHttpConnection::accept()
if ( !mOriginalConnName.isNull() && mOriginalConnName != key )
{
settings.remove( mBaseKey + mOriginalConnName );
settings.remove( "/Qgis/" + mCredentialsBaseKey + '/' + mOriginalConnName );
settings.remove( "qgis//" + mCredentialsBaseKey + '/' + mOriginalConnName );
settings.sync();
}

@@ -255,15 +255,15 @@ void QgsNewHttpConnection::accept()

settings.setValue( key + "/url", url.toString() );

if ( mBaseKey == QLatin1String( "/Qgis/connections-wms/" ) ||
mBaseKey == QLatin1String( "/Qgis/connections-wcs/" ) ||
mBaseKey == QLatin1String( "/Qgis/connections-wfs/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wms/" ) ||
mBaseKey == QLatin1String( "qgis//connections-wcs/" ) ||
mBaseKey == QLatin1String( "qgis//connections-wfs/" ) )
{
settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() );
settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() );
}

if ( mBaseKey == QLatin1String( "/Qgis/connections-wms/" ) || mBaseKey == QLatin1String( "/Qgis/connections-wcs/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wms/" ) || mBaseKey == QLatin1String( "qgis//connections-wcs/" ) )
{
settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
settings.setValue( key + "/smoothPixmapTransform", cbxSmoothPixmapTransform->isChecked() );
@@ -290,11 +290,11 @@ void QgsNewHttpConnection::accept()

settings.setValue( key + "/dpiMode", dpiMode );
}
if ( mBaseKey == QLatin1String( "/Qgis/connections-wms/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wms/" ) )
{
settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
}
if ( mBaseKey == QLatin1String( "/Qgis/connections-wfs/" ) )
if ( mBaseKey == QLatin1String( "qgis//connections-wfs/" ) )
{
QString version = QStringLiteral( "auto" );
switch ( cmbVersion->currentIndex() )
@@ -33,7 +33,7 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo

public:
//! Constructor
QgsNewHttpConnection( QWidget *parent = nullptr, const QString &baseKey = "/Qgis/connections-wms/", const QString &connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
QgsNewHttpConnection( QWidget *parent = nullptr, const QString &baseKey = "qgis/connections-wms/", const QString &connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );

public slots:
// Saves the connection to ~/.qt/qgisrc
@@ -220,7 +220,7 @@ QString QgsSourceSelectDialog::getPreferredCrs( const QSet<QString> &crsSet ) co
void QgsSourceSelectDialog::addEntryToServerList()
{

QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-%1/" ).arg( mServiceName.toLower() ) );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ) );
nc.setWindowTitle( tr( "Create a new %1 connection" ).arg( mServiceName ) );

if ( nc.exec() )
@@ -232,7 +232,7 @@ void QgsSourceSelectDialog::addEntryToServerList()

void QgsSourceSelectDialog::modifyEntryOfServerList()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-%1/" ).arg( mServiceName.toLower() ), cmbConnections->currentText() );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ), cmbConnections->currentText() );
nc.setWindowTitle( tr( "Modify %1 connection" ).arg( mServiceName ) );

if ( nc.exec() )
@@ -67,7 +67,7 @@ void QgsAfsRootItem::connectionsChanged()

void QgsAfsRootItem::newConnection()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-arcgisfeatureserver/" ) );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-arcgisfeatureserver/" ) );
nc.setWindowTitle( tr( "Create a new ArcGisFeatureServer connection" ) );

if ( nc.exec() )
@@ -130,7 +130,7 @@ QList<QAction *> QgsAfsConnectionItem::actions()

void QgsAfsConnectionItem::editConnection()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-arcgisfeatureserver/" ), mName );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-arcgisfeatureserver/" ), mName );
nc.setWindowTitle( tr( "Modify ArcGisFeatureServer connection" ) );

if ( nc.exec() )
@@ -64,7 +64,7 @@ void QgsAmsRootItem::connectionsChanged()

void QgsAmsRootItem::newConnection()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-arcgismapserver/" ) );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-arcgismapserver/" ) );
nc.setWindowTitle( tr( "Create a new ArcGisMapServer connection" ) );

if ( nc.exec() )
@@ -145,7 +145,7 @@ QList<QAction *> QgsAmsConnectionItem::actions()

void QgsAmsConnectionItem::editConnection()
{
QgsNewHttpConnection nc( 0, QStringLiteral( "/Qgis/connections-arcgismapserver/" ), mName );
QgsNewHttpConnection nc( 0, QStringLiteral( "qgis/connections-arcgismapserver/" ), mName );
nc.setWindowTitle( tr( "Modify ArcGisMapServer connection" ) );

if ( nc.exec() )
@@ -185,8 +185,8 @@ void QgsDb2FeatureIterator::BuildStatement( const QgsFeatureRequest &request )
mCompileStatus = NoCompilation;
if ( request.filterType() == QgsFeatureRequest::FilterExpression )
{
QgsDebugMsg( QString( "compileExpressions: %1" ).arg( QgsSettings().value( "/qgis/compileExpressions", true ).toString() ) );
if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
QgsDebugMsg( QString( "compileExpressions: %1" ).arg( QgsSettings().value( "qgis/compileExpressions", true ).toString() ) );
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
QgsDb2ExpressionCompiler compiler = QgsDb2ExpressionCompiler( mSource );
QgsDebugMsg( "expression dump: " + request.filterExpression()->dump() );
@@ -218,8 +218,8 @@ void QgsDb2FeatureIterator::BuildStatement( const QgsFeatureRequest &request )

QStringList orderByParts;
mOrderByCompiled = true;
QgsDebugMsg( QString( "compileExpressions: %1" ).arg( QgsSettings().value( "/qgis/compileExpressions", true ).toString() ) );
if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() && limitAtProvider )
QgsDebugMsg( QString( "compileExpressions: %1" ).arg( QgsSettings().value( "qgis/compileExpressions", true ).toString() ) );
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() && limitAtProvider )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause &clause, request.orderBy() )
{
@@ -178,7 +178,7 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest &request )
mCompileStatus = NoCompilation;
if ( request.filterType() == QgsFeatureRequest::FilterExpression )
{
if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
QgsMssqlExpressionCompiler compiler = QgsMssqlExpressionCompiler( mSource );
QgsSqlExpressionCompiler::Result result = compiler.compile( request.filterExpression() );
@@ -209,7 +209,7 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest &request )
QStringList orderByParts;
mOrderByCompiled = true;

if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause &clause, request.orderBy() )
{
@@ -115,7 +115,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
}

if ( request.filterType() == QgsFeatureRequest::FilterExpression
&& QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
&& QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
QgsSqlExpressionCompiler *compiler = nullptr;
if ( source->mDriverName == QLatin1String( "SQLite" ) || source->mDriverName == QLatin1String( "GPKG" ) )
@@ -3391,7 +3391,7 @@ void QgsOgrProvider::open( OpenMode mode )
if ( QFileInfo( mFilePath ).suffix().compare( QLatin1String( "gpkg" ), Qt::CaseInsensitive ) == 0 &&
IsLocalFile( mFilePath ) &&
!CPLGetConfigOption( "OGR_SQLITE_JOURNAL", NULL ) &&
QgsSettings().value( QStringLiteral( "/qgis/walForSqlite3" ), true ).toBool() )
QgsSettings().value( QStringLiteral( "qgis/walForSqlite3" ), true ).toBool() )
{
// For GeoPackage, we force opening of the file in WAL (Write Ahead Log)
// mode so as to avoid readers blocking writer(s), and vice-versa.
@@ -169,7 +169,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
bool useFallback = false;
if ( request.filterType() == QgsFeatureRequest::FilterExpression )
{
if ( QgsSettings().value( "/qgis/compileExpressions", true ).toBool() )
if ( QgsSettings().value( "qgis/compileExpressions", true ).toBool() )
{
QgsOracleExpressionCompiler compiler( mSource );
QgsSqlExpressionCompiler::Result result = compiler.compile( mRequest.filterExpression() );
@@ -227,7 +227,7 @@ QgsOracleSourceSelect::QgsOracleSourceSelect( QWidget *parent, Qt::WindowFlags f
connect( mTablesTreeView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ), this, SLOT( treeWidgetSelectionChanged( const QItemSelection &, const QItemSelection & ) ) );

QgsSettings settings;
mTablesTreeView->setSelectionMode( settings.value( "/qgis/addOracleDC", false ).toBool() ?
mTablesTreeView->setSelectionMode( settings.value( "qgis/addOracleDC", false ).toBool() ?
QAbstractItemView::ExtendedSelection :
QAbstractItemView::MultiSelection );

@@ -358,7 +358,7 @@ void QgsOracleSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index
void QgsOracleSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &index )
{
QgsSettings settings;
if ( settings.value( "/qgis/addOracleDC", false ).toBool() )
if ( settings.value( "qgis/addOracleDC", false ).toBool() )
{
addTables();
}
@@ -146,7 +146,7 @@ QList<QAction *> QgsOWSConnectionItem::actions()
void QgsOWSConnectionItem::editConnection()
{
#if 0
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/", mName );
QgsNewHttpConnection nc( 0, "qgis/connections-ows/", mName );

if ( nc.exec() )
{
@@ -235,7 +235,7 @@ void QgsOWSRootItem::connectionsChanged()
void QgsOWSRootItem::newConnection()
{
#if 0
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/" );
QgsNewHttpConnection nc( 0, "qgis/connections-ows/" );

if ( nc.exec() )
{
@@ -96,7 +96,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
}
mFilterRequiresGeometry = request.filterExpression()->needsGeometry();

if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
//IMPORTANT - this MUST be the last clause added!
QgsPostgresExpressionCompiler compiler = QgsPostgresExpressionCompiler( source );
@@ -132,7 +132,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
// SELECT my_int_col::text FROM some_table ORDER BY some_table.my_int_col
// but that's non-trivial
#if 0
if ( QgsSettings().value( "/qgis/compileExpressions", true ).toBool() )
if ( QgsSettings().value( "qgis/compileExpressions", true ).toBool() )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause &clause, request.orderBy() )
{
@@ -98,7 +98,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
mFetchGeometry = true;
}

if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
QgsSQLiteExpressionCompiler compiler = QgsSQLiteExpressionCompiler( source->mFields );

@@ -137,7 +137,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature

mOrderByCompiled = true;

if ( QgsSettings().value( QStringLiteral( "/qgis/compileExpressions" ), true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "qgis/compileExpressions" ), true ).toBool() )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause &clause, request.orderBy() )
{
@@ -98,7 +98,7 @@ QList<QAction *> QgsWCSConnectionItem::actions()

void QgsWCSConnectionItem::editConnection()
{
QgsNewHttpConnection nc( nullptr, QStringLiteral( "/Qgis/connections-wcs/" ), mName );
QgsNewHttpConnection nc( nullptr, QStringLiteral( "qgis/connections-wcs/" ), mName );

if ( nc.exec() )
{
@@ -265,7 +265,7 @@ void QgsWCSRootItem::connectionsChanged()

void QgsWCSRootItem::newConnection()
{
QgsNewHttpConnection nc( nullptr, QStringLiteral( "/Qgis/connections-wcs/" ) );
QgsNewHttpConnection nc( nullptr, QStringLiteral( "qgis/connections-wcs/" ) );

if ( nc.exec() )
{
@@ -482,7 +482,7 @@ QString QgsWfsCapabilities::NormalizeSRSName( QString crsName )
int QgsWfsCapabilities::defaultExpirationInSec()
{
QgsSettings s;
return s.value( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), "24" ).toInt() * 60 * 60;
return s.value( QStringLiteral( "qgis/defaultCapabilitiesExpiry" ), "24" ).toInt() * 60 * 60;
}

void QgsWfsCapabilities::parseSupportedOperations( const QDomElement &operationsElem,
@@ -40,7 +40,7 @@ const QString QgsWFSConstants::URI_PARAM_HIDEDOWNLOADPROGRESSDIALOG( QStringLite

const QString QgsWFSConstants::VERSION_AUTO( QStringLiteral( "auto" ) );

const QString QgsWFSConstants::CONNECTIONS_WFS( QStringLiteral( "/Qgis/connections-wfs/" ) );
const QString QgsWFSConstants::CONNECTIONS_WFS( QStringLiteral( "qgis/connections-wfs/" ) );
const QString QgsWFSConstants::SETTINGS_VERSION( QStringLiteral( "version" ) );
const QString QgsWFSConstants::SETTINGS_MAXNUMFEATURES( QStringLiteral( "maxnumfeatures" ) );

@@ -402,7 +402,7 @@ void QgsWFSFeatureDownloader::run( bool serializeFeatures, int maxFeatures )
bool interrupted = false;
bool truncatedResponse = false;
QgsSettings s;
const int maxRetry = s.value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), "3" ).toInt();
const int maxRetry = s.value( QStringLiteral( "qgis/defaultTileMaxRetry" ), "3" ).toInt();
int retryIter = 0;
int lastValidTotalDownloadedFeatureCount = 0;
int pagingIter = 1;
@@ -2075,7 +2075,7 @@ void QgsWmsCapabilitiesDownload::capabilitiesReplyFinished()
if ( cmd.expirationDate().isNull() )
{
QgsSettings s;
cmd.setExpirationDate( QDateTime::currentDateTime().addSecs( s.value( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), "24" ).toInt() * 60 * 60 ) );
cmd.setExpirationDate( QDateTime::currentDateTime().addSecs( s.value( QStringLiteral( "qgis/defaultCapabilitiesExpiry" ), "24" ).toInt() * 60 * 60 ) );
}

nam->cache()->updateMetaData( cmd );

0 comments on commit 1ca73f4

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