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 29, 2021
1 parent 605cbd2 commit 26ad578
Showing 1 changed file with 90 additions and 27 deletions.
117 changes: 90 additions & 27 deletions src/gui/qgsmanageconnectionsdialog.cpp
Expand Up @@ -1096,10 +1096,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 @@ -1186,10 +1193,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 @@ -1276,10 +1290,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 @@ -1363,10 +1384,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 @@ -1461,10 +1489,17 @@ void QgsManageConnectionsDialog::loadHanaConnections( const QDomDocument &doc, c
}
}

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 @@ -1541,10 +1576,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 @@ -1621,10 +1663,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 @@ -1700,10 +1749,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 @@ -1780,10 +1836,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 26ad578

Please sign in to comment.