Skip to content

Commit

Permalink
More connections XML import dialoges: deal properly with duplicate co…
Browse files Browse the repository at this point in the history
…nnection names
  • Loading branch information
pathmapper authored and nyalldawson committed Jan 30, 2021
1 parent c1ac6b8 commit 438d6ae
Showing 1 changed file with 80 additions and 24 deletions.
104 changes: 80 additions & 24 deletions src/gui/qgsmanageconnectionsdialog.cpp
Expand Up @@ -1030,10 +1030,17 @@ void QgsManageConnectionsDialog::loadPgConnections( const QDomDocument &doc, con
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

//no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1120,10 +1127,17 @@ void QgsManageConnectionsDialog::loadMssqlConnections( const QDomDocument &doc,
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

//no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1210,10 +1224,17 @@ void QgsManageConnectionsDialog::loadOracleConnections( const QDomDocument &doc,
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

//no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1297,10 +1318,17 @@ void QgsManageConnectionsDialog::loadDb2Connections( const QDomDocument &doc, co
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

//no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1387,10 +1415,17 @@ void QgsManageConnectionsDialog::loadGeonodeConnections( const QDomDocument &doc
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

// no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1467,10 +1502,17 @@ void QgsManageConnectionsDialog::loadXyzTilesConnections( const QDomDocument &do
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

settings.beginGroup( "qgis/connections-xyz/" + connectionName );
Expand Down Expand Up @@ -1546,10 +1588,17 @@ void QgsManageConnectionsDialog::loadArcgisConnections( const QDomDocument &doc,
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

// no dups detected or overwrite is allowed
Expand Down Expand Up @@ -1626,10 +1675,17 @@ void QgsManageConnectionsDialog::loadVectorTileConnections( const QDomDocument &
}
}

if ( keys.contains( connectionName ) && !overwrite )
if ( keys.contains( connectionName ) )
{
child = child.nextSiblingElement();
continue;
if ( !overwrite )
{
child = child.nextSiblingElement();
continue;
}
}
else
{
keys << connectionName;
}

settings.beginGroup( "qgis/connections-vector-tile/" + connectionName );
Expand Down

0 comments on commit 438d6ae

Please sign in to comment.