17 #include <QCloseEvent> 
   18 #include <QFileDialog> 
   19 #include <QMessageBox> 
   20 #include <QPushButton> 
   21 #include <QTextStream> 
   23 #include "qgssettings.h" 
   29   , mFileName( fileName )
 
   31   , mConnectionType( type )
 
   36   QPushButton *pb = 
nullptr;
 
   37   pb = 
new QPushButton( tr( 
"Select all" ) );
 
   38   buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
 
   41   pb = 
new QPushButton( tr( 
"Clear selection" ) );
 
   42   buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
 
   45   if ( mDialogMode == 
Import )
 
   47     label->setText( tr( 
"Select connections to import" ) );
 
   48     buttonBox->button( QDialogButtonBox::Ok )->setText( tr( 
"Import" ) );
 
   49     buttonBox->button( QDialogButtonBox::Ok )->setEnabled( 
false );
 
   54     buttonBox->button( QDialogButtonBox::Ok )->setText( tr( 
"Export" ) );
 
   55     buttonBox->button( QDialogButtonBox::Ok )->setEnabled( 
false );
 
   58   if ( !populateConnections() )
 
   60     QApplication::postEvent( 
this, 
new QCloseEvent() );
 
   64   disconnect( buttonBox, &QDialogButtonBox::accepted, 
this, &QDialog::accept );
 
   72   buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
 
   77   QList<QListWidgetItem *> selection = listConnections->selectedItems();
 
   78   if ( selection.isEmpty() )
 
   80     QMessageBox::warning( 
this, tr( 
"Export/Import Error" ),
 
   81                           tr( 
"You should select at least one connection from list." ) );
 
   86   items.reserve( selection.size() );
 
   87   for ( 
int i = 0; i < selection.size(); ++i )
 
   89     items.append( selection.at( i )->text() );
 
   92   if ( mDialogMode == 
Export )
 
   94     QString fileName = QFileDialog::getSaveFileName( 
this, tr( 
"Save Connections" ), QDir::homePath(),
 
   95                        tr( 
"XML files (*.xml *.XML)" ) );
 
   96     if ( fileName.isEmpty() )
 
  102     if ( !fileName.endsWith( QLatin1String( 
".xml" ), Qt::CaseInsensitive ) )
 
  104       fileName += QLatin1String( 
".xml" );
 
  107     mFileName = fileName;
 
  110     switch ( mConnectionType )
 
  113         doc = saveOWSConnections( items, QStringLiteral( 
"WMS" ) );
 
  116         doc = saveWfsConnections( items );
 
  119         doc = savePgConnections( items );
 
  122         doc = saveMssqlConnections( items );
 
  125         doc = saveOWSConnections( items, QStringLiteral( 
"WCS" ) );
 
  128         doc = saveOracleConnections( items );
 
  131         doc = saveDb2Connections( items );
 
  134         doc = saveHanaConnections( items );
 
  137         doc = saveGeonodeConnections( items );
 
  140         doc = saveXyzTilesConnections( items );
 
  143         doc = saveArcgisConnections( items, QStringLiteral( 
"ARCGISMAPSERVER" ) );
 
  146         doc = saveArcgisConnections( items, QStringLiteral( 
"ARCGISFEATURESERVER" ) );
 
  149         doc = saveVectorTileConnections( items );
 
  153     QFile file( mFileName );
 
  154     if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
 
  156       QMessageBox::warning( 
this, tr( 
"Saving Connections" ),
 
  157                             tr( 
"Cannot write file %1:\n%2." )
 
  159                                   file.errorString() ) );
 
  163     QTextStream out( &file );
 
  168     QFile file( mFileName );
 
  169     if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
 
  171       QMessageBox::warning( 
this, tr( 
"Loading Connections" ),
 
  172                             tr( 
"Cannot read file %1:\n%2." )
 
  174                                   file.errorString() ) );
 
  183     if ( !doc.setContent( &file, 
true, &errorStr, &errorLine, &errorColumn ) )
 
  185       QMessageBox::warning( 
this, tr( 
"Loading Connections" ),
 
  186                             tr( 
"Parse error at line %1, column %2:\n%3" )
 
  193     switch ( mConnectionType )
 
  196         loadOWSConnections( doc, items, QStringLiteral( 
"WMS" ) );
 
  199         loadWfsConnections( doc, items );
 
  202         loadPgConnections( doc, items );
 
  205         loadMssqlConnections( doc, items );
 
  208         loadOWSConnections( doc, items, QStringLiteral( 
"WCS" ) );
 
  211         loadOracleConnections( doc, items );
 
  214         loadDb2Connections( doc, items );
 
  217         loadHanaConnections( doc, items );
 
  220         loadGeonodeConnections( doc, items );
 
  223         loadXyzTilesConnections( doc, items );
 
  226         loadArcgisConnections( doc, items, QStringLiteral( 
"ARCGISMAPSERVER" ) );
 
  229         loadArcgisConnections( doc, items, QStringLiteral( 
"ARCGISFEATURESERVER" ) );
 
  232         loadVectorTileConnections( doc, items );
 
  236     listConnections->clear();
 
  243 bool QgsManageConnectionsDialog::populateConnections()
 
  246   if ( mDialogMode == 
Export )
 
  248     QgsSettings settings;
 
  249     switch ( mConnectionType )
 
  252         settings.beginGroup( QStringLiteral( 
"/qgis/connections-wms" ) );
 
  255         settings.beginGroup( QStringLiteral( 
"/qgis/connections-wfs" ) );
 
  258         settings.beginGroup( QStringLiteral( 
"/qgis/connections-wcs" ) );
 
  261         settings.beginGroup( QStringLiteral( 
"/PostgreSQL/connections" ) );
 
  264         settings.beginGroup( QStringLiteral( 
"/MSSQL/connections" ) );
 
  267         settings.beginGroup( QStringLiteral( 
"/Oracle/connections" ) );
 
  270         settings.beginGroup( QStringLiteral( 
"/DB2/connections" ) );
 
  273         settings.beginGroup( QStringLiteral( 
"/HANA/connections" ) );
 
  276         settings.beginGroup( QStringLiteral( 
"/qgis/connections-geonode" ) );
 
  279         settings.beginGroup( QStringLiteral( 
"/qgis/connections-xyz" ) );
 
  282         settings.beginGroup( QStringLiteral( 
"/qgis/connections-arcgismapserver" ) );
 
  285         settings.beginGroup( QStringLiteral( 
"/qgis/connections-arcgisfeatureserver" ) );
 
  288         settings.beginGroup( QStringLiteral( 
"/qgis/connections-vector-tile" ) );
 
  291     QStringList keys = settings.childGroups();
 
  292     QStringList::Iterator it = keys.begin();
 
  293     while ( it != keys.end() )
 
  295       QListWidgetItem *item = 
new QListWidgetItem();
 
  296       item->setText( *it );
 
  297       listConnections->addItem( item );
 
  305     QFile file( mFileName );
 
  306     if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
 
  308       QMessageBox::warning( 
this, tr( 
"Loading Connections" ),
 
  309                             tr( 
"Cannot read file %1:\n%2." )
 
  311                                   file.errorString() ) );
 
  320     if ( !doc.setContent( &file, 
true, &errorStr, &errorLine, &errorColumn ) )
 
  322       QMessageBox::warning( 
this, tr( 
"Loading Connections" ),
 
  323                             tr( 
"Parse error at line %1, column %2:\n%3" )
 
  330     QDomElement root = doc.documentElement();
 
  331     switch ( mConnectionType )
 
  334         if ( root.tagName() != QLatin1String( 
"qgsWMSConnections" ) )
 
  336           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  337                                     tr( 
"The file is not a WMS connections exchange file." ) );
 
  343         if ( root.tagName() != QLatin1String( 
"qgsWFSConnections" ) )
 
  345           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  346                                     tr( 
"The file is not a WFS connections exchange file." ) );
 
  352         if ( root.tagName() != QLatin1String( 
"qgsWCSConnections" ) )
 
  354           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  355                                     tr( 
"The file is not a WCS connections exchange file." ) );
 
  361         if ( root.tagName() != QLatin1String( 
"qgsPgConnections" ) )
 
  363           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  364                                     tr( 
"The file is not a PostGIS connections exchange file." ) );
 
  370         if ( root.tagName() != QLatin1String( 
"qgsMssqlConnections" ) )
 
  372           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  373                                     tr( 
"The file is not a MSSQL connections exchange file." ) );
 
  378         if ( root.tagName() != QLatin1String( 
"qgsOracleConnections" ) )
 
  380           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  381                                     tr( 
"The file is not an Oracle connections exchange file." ) );
 
  386         if ( root.tagName() != QLatin1String( 
"qgsDb2Connections" ) )
 
  388           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  389                                     tr( 
"The file is not a DB2 connections exchange file." ) );
 
  394         if ( root.tagName() != QLatin1String( 
"qgsHanaConnections" ) )
 
  396           QMessageBox::warning( 
this, tr( 
"Loading Connections" ),
 
  397                                 tr( 
"The file is not a HANA connections exchange file." ) );
 
  402         if ( root.tagName() != QLatin1String( 
"qgsGeoNodeConnections" ) )
 
  404           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  405                                     tr( 
"The file is not a GeoNode connections exchange file." ) );
 
  410         if ( root.tagName() != QLatin1String( 
"qgsXYZTilesConnections" ) )
 
  412           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  413                                     tr( 
"The file is not a XYZ Tiles connections exchange file." ) );
 
  418         if ( root.tagName() != QLatin1String( 
"qgsARCGISMAPSERVERConnections" ) )
 
  420           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  421                                     tr( 
"The file is not a ArcGIS Map Service connections exchange file." ) );
 
  426         if ( root.tagName() != QLatin1String( 
"qgsARCGISFEATURESERVERConnections" ) )
 
  428           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  429                                     tr( 
"The file is not a ArcGIS Feature Service connections exchange file." ) );
 
  434         if ( root.tagName() != QLatin1String( 
"qgsVectorTileConnections" ) )
 
  436           QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  437                                     tr( 
"The file is not a Vector Tile connections exchange file." ) );
 
  443     QDomElement child = root.firstChildElement();
 
  444     while ( !child.isNull() )
 
  446       QListWidgetItem *item = 
new QListWidgetItem();
 
  447       item->setText( child.attribute( QStringLiteral( 
"name" ) ) );
 
  448       listConnections->addItem( item );
 
  449       child = child.nextSiblingElement();
 
  455 QDomDocument QgsManageConnectionsDialog::saveOWSConnections( 
const QStringList &connections, 
const QString &service )
 
  457   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  458   QDomElement root = doc.createElement( 
"qgs" + service.toUpper() + 
"Connections" );
 
  459   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  460   doc.appendChild( root );
 
  462   QgsSettings settings;
 
  464   for ( 
int i = 0; i < connections.count(); ++i )
 
  466     path = 
"/qgis/connections-" + service.toLower() + 
'/';
 
  467     QDomElement el = doc.createElement( service.toLower() );
 
  468     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  469     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + connections[ i ] + 
"/url" ).toString() );
 
  471     if ( service == QLatin1String( 
"WMS" ) )
 
  473       el.setAttribute( QStringLiteral( 
"ignoreGetMapURI" ), settings.value( path + connections[i] + 
"/ignoreGetMapURI", 
false ).toBool() ? 
"true" : 
"false" );
 
  474       el.setAttribute( QStringLiteral( 
"ignoreGetFeatureInfoURI" ), settings.value( path + connections[i] + 
"/ignoreGetFeatureInfoURI", 
false ).toBool() ? 
"true" : 
"false" );
 
  475       el.setAttribute( QStringLiteral( 
"ignoreAxisOrientation" ), settings.value( path + connections[i] + 
"/ignoreAxisOrientation", 
false ).toBool() ? 
"true" : 
"false" );
 
  476       el.setAttribute( QStringLiteral( 
"invertAxisOrientation" ), settings.value( path + connections[i] + 
"/invertAxisOrientation", 
false ).toBool() ? 
"true" : 
"false" );
 
  477       el.setAttribute( QStringLiteral( 
"referer" ), settings.value( path + connections[ i ] + 
"/referer" ).toString() );
 
  478       el.setAttribute( QStringLiteral( 
"smoothPixmapTransform" ), settings.value( path + connections[i] + 
"/smoothPixmapTransform", 
false ).toBool() ? 
"true" : 
"false" );
 
  479       el.setAttribute( QStringLiteral( 
"dpiMode" ), settings.value( path + connections[i] + 
"/dpiMode", 
"7" ).toInt() );
 
  482     path = 
"/qgis/" + service.toUpper() + 
'/';
 
  483     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + connections[ i ] + 
"/username" ).toString() );
 
  484     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + connections[ i ] + 
"/password" ).toString() );
 
  485     root.appendChild( el );
 
  491 QDomDocument QgsManageConnectionsDialog::saveWfsConnections( 
const QStringList &connections )
 
  493   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  494   QDomElement root = doc.createElement( QStringLiteral( 
"qgsWFSConnections" ) );
 
  495   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.1" ) );
 
  496   doc.appendChild( root );
 
  498   QgsSettings settings;
 
  500   for ( 
int i = 0; i < connections.count(); ++i )
 
  502     path = QStringLiteral( 
"/qgis/connections-wfs/" );
 
  503     QDomElement el = doc.createElement( QStringLiteral( 
"wfs" ) );
 
  504     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  505     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + connections[ i ] + 
"/url" ).toString() );
 
  507     el.setAttribute( QStringLiteral( 
"version" ), settings.value( path + connections[ i ] + 
"/version" ).toString() );
 
  508     el.setAttribute( QStringLiteral( 
"maxnumfeatures" ), settings.value( path + connections[ i ] + 
"/maxnumfeatures" ).toString() );
 
  509     el.setAttribute( QStringLiteral( 
"pagesize" ), settings.value( path + connections[ i ] + 
"/pagesize" ).toString() );
 
  510     el.setAttribute( QStringLiteral( 
"pagingenabled" ), settings.value( path + connections[ i ] + 
"/pagingenabled", 
false ).toString() );
 
  511     el.setAttribute( QStringLiteral( 
"ignoreAxisOrientation" ), settings.value( path + connections[ i ] + 
"/ignoreAxisOrientation", 
false ).toString() );
 
  512     el.setAttribute( QStringLiteral( 
"invertAxisOrientation" ), settings.value( path + connections[ i ] + 
"/invertAxisOrientation", 
false ).toString() );
 
  514     path = QStringLiteral( 
"/qgis/WFS/" );
 
  515     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + connections[ i ] + 
"/username" ).toString() );
 
  516     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + connections[ i ] + 
"/password" ).toString() );
 
  517     root.appendChild( el );
 
  523 QDomDocument QgsManageConnectionsDialog::savePgConnections( 
const QStringList &connections )
 
  525   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  526   QDomElement root = doc.createElement( QStringLiteral( 
"qgsPgConnections" ) );
 
  527   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  528   doc.appendChild( root );
 
  530   QgsSettings settings;
 
  532   for ( 
int i = 0; i < connections.count(); ++i )
 
  534     path = 
"/PostgreSQL/connections/" + connections[ i ];
 
  535     QDomElement el = doc.createElement( QStringLiteral( 
"postgis" ) );
 
  536     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  537     el.setAttribute( QStringLiteral( 
"host" ), settings.value( path + 
"/host" ).toString() );
 
  538     el.setAttribute( QStringLiteral( 
"port" ), settings.value( path + 
"/port" ).toString() );
 
  539     el.setAttribute( QStringLiteral( 
"database" ), settings.value( path + 
"/database" ).toString() );
 
  540     el.setAttribute( QStringLiteral( 
"service" ), settings.value( path + 
"/service" ).toString() );
 
  541     el.setAttribute( QStringLiteral( 
"sslmode" ), settings.value( path + 
"/sslmode", 
"1" ).toString() );
 
  542     el.setAttribute( QStringLiteral( 
"estimatedMetadata" ), settings.value( path + 
"/estimatedMetadata", 
"0" ).toString() );
 
  544     el.setAttribute( QStringLiteral( 
"saveUsername" ), settings.value( path + 
"/saveUsername", 
"false" ).toString() );
 
  546     if ( settings.value( path + 
"/saveUsername", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  548       el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  551     el.setAttribute( QStringLiteral( 
"savePassword" ), settings.value( path + 
"/savePassword", 
"false" ).toString() );
 
  553     if ( settings.value( path + 
"/savePassword", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  555       el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  558     root.appendChild( el );
 
  564 QDomDocument QgsManageConnectionsDialog::saveMssqlConnections( 
const QStringList &connections )
 
  566   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  567   QDomElement root = doc.createElement( QStringLiteral( 
"qgsMssqlConnections" ) );
 
  568   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  569   doc.appendChild( root );
 
  571   QgsSettings settings;
 
  573   for ( 
int i = 0; i < connections.count(); ++i )
 
  575     path = 
"/MSSQL/connections/" + connections[ i ];
 
  576     QDomElement el = doc.createElement( QStringLiteral( 
"mssql" ) );
 
  577     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  578     el.setAttribute( QStringLiteral( 
"host" ), settings.value( path + 
"/host" ).toString() );
 
  579     el.setAttribute( QStringLiteral( 
"port" ), settings.value( path + 
"/port" ).toString() );
 
  580     el.setAttribute( QStringLiteral( 
"database" ), settings.value( path + 
"/database" ).toString() );
 
  581     el.setAttribute( QStringLiteral( 
"service" ), settings.value( path + 
"/service" ).toString() );
 
  582     el.setAttribute( QStringLiteral( 
"sslmode" ), settings.value( path + 
"/sslmode", 
"1" ).toString() );
 
  583     el.setAttribute( QStringLiteral( 
"estimatedMetadata" ), settings.value( path + 
"/estimatedMetadata", 
"0" ).toString() );
 
  585     el.setAttribute( QStringLiteral( 
"saveUsername" ), settings.value( path + 
"/saveUsername", 
"false" ).toString() );
 
  587     if ( settings.value( path + 
"/saveUsername", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  589       el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  592     el.setAttribute( QStringLiteral( 
"savePassword" ), settings.value( path + 
"/savePassword", 
"false" ).toString() );
 
  594     if ( settings.value( path + 
"/savePassword", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  596       el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  599     root.appendChild( el );
 
  605 QDomDocument QgsManageConnectionsDialog::saveOracleConnections( 
const QStringList &connections )
 
  607   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  608   QDomElement root = doc.createElement( QStringLiteral( 
"qgsOracleConnections" ) );
 
  609   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  610   doc.appendChild( root );
 
  612   QgsSettings settings;
 
  614   for ( 
int i = 0; i < connections.count(); ++i )
 
  616     path = 
"/Oracle/connections/" + connections[ i ];
 
  617     QDomElement el = doc.createElement( QStringLiteral( 
"oracle" ) );
 
  618     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  619     el.setAttribute( QStringLiteral( 
"host" ), settings.value( path + 
"/host" ).toString() );
 
  620     el.setAttribute( QStringLiteral( 
"port" ), settings.value( path + 
"/port" ).toString() );
 
  621     el.setAttribute( QStringLiteral( 
"database" ), settings.value( path + 
"/database" ).toString() );
 
  622     el.setAttribute( QStringLiteral( 
"dboptions" ), settings.value( path + 
"/dboptions" ).toString() );
 
  623     el.setAttribute( QStringLiteral( 
"dbworkspace" ), settings.value( path + 
"/dbworkspace" ).toString() );
 
  624     el.setAttribute( QStringLiteral( 
"schema" ), settings.value( path + 
"/schema" ).toString() );
 
  625     el.setAttribute( QStringLiteral( 
"estimatedMetadata" ), settings.value( path + 
"/estimatedMetadata", 
"0" ).toString() );
 
  626     el.setAttribute( QStringLiteral( 
"userTablesOnly" ), settings.value( path + 
"/userTablesOnly", 
"0" ).toString() );
 
  627     el.setAttribute( QStringLiteral( 
"geometryColumnsOnly" ), settings.value( path + 
"/geometryColumnsOnly", 
"0" ).toString() );
 
  628     el.setAttribute( QStringLiteral( 
"allowGeometrylessTables" ), settings.value( path + 
"/allowGeometrylessTables", 
"0" ).toString() );
 
  630     el.setAttribute( QStringLiteral( 
"saveUsername" ), settings.value( path + 
"/saveUsername", 
"false" ).toString() );
 
  632     if ( settings.value( path + 
"/saveUsername", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  634       el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  637     el.setAttribute( QStringLiteral( 
"savePassword" ), settings.value( path + 
"/savePassword", 
"false" ).toString() );
 
  639     if ( settings.value( path + 
"/savePassword", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  641       el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  644     root.appendChild( el );
 
  650 QDomDocument QgsManageConnectionsDialog::saveDb2Connections( 
const QStringList &connections )
 
  652   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  653   QDomElement root = doc.createElement( QStringLiteral( 
"qgsDb2Connections" ) );
 
  654   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  655   doc.appendChild( root );
 
  657   QgsSettings settings;
 
  659   for ( 
int i = 0; i < connections.count(); ++i )
 
  661     path = 
"/DB2/connections/" + connections[ i ];
 
  662     QDomElement el = doc.createElement( QStringLiteral( 
"db2" ) );
 
  663     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  664     el.setAttribute( QStringLiteral( 
"host" ), settings.value( path + 
"/host" ).toString() );
 
  665     el.setAttribute( QStringLiteral( 
"port" ), settings.value( path + 
"/port" ).toString() );
 
  666     el.setAttribute( QStringLiteral( 
"database" ), settings.value( path + 
"/database" ).toString() );
 
  667     el.setAttribute( QStringLiteral( 
"service" ), settings.value( path + 
"/service" ).toString() );
 
  668     el.setAttribute( QStringLiteral( 
"sslmode" ), settings.value( path + 
"/sslmode", 
"1" ).toString() );
 
  669     el.setAttribute( QStringLiteral( 
"estimatedMetadata" ), settings.value( path + 
"/estimatedMetadata", 
"0" ).toString() );
 
  671     el.setAttribute( QStringLiteral( 
"saveUsername" ), settings.value( path + 
"/saveUsername", 
"false" ).toString() );
 
  673     if ( settings.value( path + 
"/saveUsername", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  675       el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  678     el.setAttribute( QStringLiteral( 
"savePassword" ), settings.value( path + 
"/savePassword", 
"false" ).toString() );
 
  680     if ( settings.value( path + 
"/savePassword", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  682       el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  685     root.appendChild( el );
 
  691 QDomDocument QgsManageConnectionsDialog::saveHanaConnections( 
const QStringList &connections )
 
  693   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  694   QDomElement root = doc.createElement( QStringLiteral( 
"qgsHanaConnections" ) );
 
  695   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  696   doc.appendChild( root );
 
  698   QgsSettings settings;
 
  700   for ( 
int i = 0; i < connections.count(); ++i )
 
  702     path = 
"/HANA/connections/" + connections[i];
 
  703     QDomElement el = doc.createElement( QStringLiteral( 
"hana" ) );
 
  704     el.setAttribute( QStringLiteral( 
"name" ), connections[i] );
 
  705     el.setAttribute( QStringLiteral( 
"driver" ), settings.value( path + 
"/driver", QString() ).toString() );
 
  706     el.setAttribute( QStringLiteral( 
"host" ), settings.value( path + 
"/host", QString() ).toString() );
 
  707     el.setAttribute( QStringLiteral( 
"identifierType" ), settings.value( path + 
"/identifierType", QString() ).toString() );
 
  708     el.setAttribute( QStringLiteral( 
"identifier" ), settings.value( path + 
"/identifier", QString() ).toString() );
 
  709     el.setAttribute( QStringLiteral( 
"multitenant" ), settings.value( path + 
"/multitenant", QString() ).toString() );
 
  710     el.setAttribute( QStringLiteral( 
"database" ), settings.value( path + 
"/database", QString() ).toString() );
 
  711     el.setAttribute( QStringLiteral( 
"schema" ), settings.value( path + 
"/schema", QString() ).toString() );
 
  712     el.setAttribute( QStringLiteral( 
"userTablesOnly" ), settings.value( path + 
"/userTablesOnly", QStringLiteral( 
"0" ) ).toString() );
 
  713     el.setAttribute( QStringLiteral( 
"allowGeometrylessTables" ), settings.value( path + 
"/allowGeometrylessTables", QStringLiteral( 
"0" ) ).toString() );
 
  715     el.setAttribute( QStringLiteral( 
"saveUsername" ), settings.value( path + 
"/saveUsername", QStringLiteral( 
"false" ) ).toString() );
 
  716     if ( settings.value( path + 
"/saveUsername", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  718       el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username", QString() ).toString() );
 
  721     el.setAttribute( QStringLiteral( 
"savePassword" ), settings.value( path + 
"/savePassword", QStringLiteral( 
"false" ) ).toString() );
 
  722     if ( settings.value( path + 
"/savePassword", 
"false" ).toString() == QLatin1String( 
"true" ) )
 
  724       el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password", QString() ).toString() );
 
  727     el.setAttribute( QStringLiteral( 
"sslEnabled" ), settings.value( path + 
"/sslEnabled", QStringLiteral( 
"false" ) ).toString() );
 
  728     el.setAttribute( QStringLiteral( 
"sslCryptoProvider" ), settings.value( path + 
"/sslCryptoProvider", QStringLiteral( 
"openssl" ) ).toString() );
 
  729     el.setAttribute( QStringLiteral( 
"sslKeyStore" ), settings.value( path + 
"/sslKeyStore", QString() ).toString() );
 
  730     el.setAttribute( QStringLiteral( 
"sslTrustStore" ), settings.value( path + 
"/sslTrustStore", QString() ).toString() );
 
  731     el.setAttribute( QStringLiteral( 
"sslValidateCertificate" ), settings.value( path + 
"/sslValidateCertificate", QStringLiteral( 
"false" ) ).toString() );
 
  732     el.setAttribute( QStringLiteral( 
"sslHostNameInCertificate" ), settings.value( path + 
"/sslHostNameInCertificate", QString() ).toString() );
 
  734     root.appendChild( el );
 
  740 QDomDocument QgsManageConnectionsDialog::saveGeonodeConnections( 
const QStringList &connections )
 
  742   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  743   QDomElement root = doc.createElement( QStringLiteral( 
"qgsGeoNodeConnections" ) );
 
  744   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  745   doc.appendChild( root );
 
  747   QgsSettings settings;
 
  749   for ( 
int i = 0; i < connections.count(); ++i )
 
  751     path = QStringLiteral( 
"/qgis/connections-geonode/" );
 
  752     QDomElement el = doc.createElement( QStringLiteral( 
"geonode" ) );
 
  753     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  754     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + connections[ i ] + 
"/url" ).toString() );
 
  756     path = QStringLiteral( 
"/qgis/GeoNode/" );
 
  757     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + connections[ i ] + 
"/username" ).toString() );
 
  758     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + connections[ i ] + 
"/password" ).toString() );
 
  759     root.appendChild( el );
 
  765 QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( 
const QStringList &connections )
 
  767   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  768   QDomElement root = doc.createElement( QStringLiteral( 
"qgsXYZTilesConnections" ) );
 
  769   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  770   doc.appendChild( root );
 
  772   QgsSettings settings;
 
  774   for ( 
int i = 0; i < connections.count(); ++i )
 
  776     path = 
"qgis/connections-xyz/" + connections[ i ];
 
  777     QDomElement el = doc.createElement( QStringLiteral( 
"xyztiles" ) );
 
  779     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  780     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + 
"/url" ).toString() );
 
  781     el.setAttribute( QStringLiteral( 
"zmin" ), settings.value( path + 
"/zmin", -1 ).toInt() );
 
  782     el.setAttribute( QStringLiteral( 
"zmax" ), settings.value( path + 
"/zmax", -1 ).toInt() );
 
  783     el.setAttribute( QStringLiteral( 
"authcfg" ), settings.value( path + 
"/authcfg" ).toString() );
 
  784     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  785     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  786     el.setAttribute( QStringLiteral( 
"referer" ), settings.value( path + 
"/referer" ).toString() );
 
  787     el.setAttribute( QStringLiteral( 
"tilePixelRatio" ), settings.value( path + 
"/tilePixelRatio", 0 ).toDouble() );
 
  789     root.appendChild( el );
 
  795 QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( 
const QStringList &connections, 
const QString &service )
 
  797   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  798   QDomElement root = doc.createElement( 
"qgs" + service.toUpper() + 
"Connections" );
 
  799   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  800   doc.appendChild( root );
 
  802   QgsSettings settings;
 
  804   for ( 
int i = 0; i < connections.count(); ++i )
 
  806     path = 
"/qgis/connections-" + service.toLower() + 
'/';
 
  807     QDomElement el = doc.createElement( service.toLower() );
 
  808     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  809     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + connections[ i ] + 
"/url" ).toString() );
 
  810     el.setAttribute( QStringLiteral( 
"referer" ), settings.value( path + connections[ i ] + 
"/referer" ).toString() );
 
  812     path = 
"/qgis/" + service.toUpper() + 
'/';
 
  813     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + connections[ i ] + 
"/username" ).toString() );
 
  814     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + connections[ i ] + 
"/password" ).toString() );
 
  815     el.setAttribute( QStringLiteral( 
"authcfg" ), settings.value( path + connections[ i ] + 
"/authcfg" ).toString() );
 
  816     root.appendChild( el );
 
  822 QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( 
const QStringList &connections )
 
  824   QDomDocument doc( QStringLiteral( 
"connections" ) );
 
  825   QDomElement root = doc.createElement( QStringLiteral( 
"qgsVectorTileConnections" ) );
 
  826   root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0" ) );
 
  827   doc.appendChild( root );
 
  829   QgsSettings settings;
 
  831   for ( 
int i = 0; i < connections.count(); ++i )
 
  833     path = 
"qgis/connections-vector-tile/" + connections[ i ];
 
  834     QDomElement el = doc.createElement( QStringLiteral( 
"vectortile" ) );
 
  836     el.setAttribute( QStringLiteral( 
"name" ), connections[ i ] );
 
  837     el.setAttribute( QStringLiteral( 
"url" ), settings.value( path + 
"/url" ).toString() );
 
  838     el.setAttribute( QStringLiteral( 
"zmin" ), settings.value( path + 
"/zmin", -1 ).toInt() );
 
  839     el.setAttribute( QStringLiteral( 
"zmax" ), settings.value( path + 
"/zmax", -1 ).toInt() );
 
  840     el.setAttribute( QStringLiteral( 
"serviceType" ), settings.value( path + 
"/serviceType", -1 ).toInt() );
 
  841     el.setAttribute( QStringLiteral( 
"authcfg" ), settings.value( path + 
"/authcfg" ).toString() );
 
  842     el.setAttribute( QStringLiteral( 
"username" ), settings.value( path + 
"/username" ).toString() );
 
  843     el.setAttribute( QStringLiteral( 
"password" ), settings.value( path + 
"/password" ).toString() );
 
  844     el.setAttribute( QStringLiteral( 
"referer" ), settings.value( path + 
"/referer" ).toString() );
 
  845     el.setAttribute( QStringLiteral( 
"styleUrl" ), settings.value( path + 
"/styleUrl" ).toString() );
 
  847     root.appendChild( el );
 
  853 void QgsManageConnectionsDialog::loadOWSConnections( 
const QDomDocument &doc, 
const QStringList &items, 
const QString &service )
 
  855   QDomElement root = doc.documentElement();
 
  856   if ( root.tagName() != 
"qgs" + service.toUpper() + 
"Connections" )
 
  858     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  859                               tr( 
"The file is not a %1 connections exchange file." ).arg( service ) );
 
  863   QString connectionName;
 
  864   QgsSettings settings;
 
  865   settings.beginGroup( 
"/qgis/connections-" + service.toLower() );
 
  866   QStringList keys = settings.childGroups();
 
  868   QDomElement child = root.firstChildElement();
 
  870   bool overwrite = 
true;
 
  872   while ( !child.isNull() )
 
  874     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
  875     if ( !items.contains( connectionName ) )
 
  877       child = child.nextSiblingElement();
 
  882     if ( keys.contains( connectionName ) && prompt )
 
  884       int res = QMessageBox::warning( 
this,
 
  885                                       tr( 
"Loading Connections" ),
 
  886                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
  887                                       .arg( connectionName ),
 
  888                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
  892         case QMessageBox::Cancel:
 
  894         case QMessageBox::No:
 
  895           child = child.nextSiblingElement();
 
  897         case QMessageBox::Yes:
 
  900         case QMessageBox::YesToAll:
 
  904         case QMessageBox::NoToAll:
 
  911     if ( keys.contains( connectionName ) )
 
  915         child = child.nextSiblingElement();
 
  921       keys << connectionName;
 
  925     settings.beginGroup( 
"/qgis/connections-" + service.toLower() );
 
  926     settings.setValue( QString( 
'/' + connectionName + 
"/url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
  927     settings.setValue( QString( 
'/' + connectionName + 
"/ignoreGetMapURI" ), child.attribute( QStringLiteral( 
"ignoreGetMapURI" ) ) == QLatin1String( 
"true" ) );
 
  928     settings.setValue( QString( 
'/' + connectionName + 
"/ignoreGetFeatureInfoURI" ), child.attribute( QStringLiteral( 
"ignoreGetFeatureInfoURI" ) ) == QLatin1String( 
"true" ) );
 
  929     settings.setValue( QString( 
'/' + connectionName + 
"/ignoreAxisOrientation" ), child.attribute( QStringLiteral( 
"ignoreAxisOrientation" ) ) == QLatin1String( 
"true" ) );
 
  930     settings.setValue( QString( 
'/' + connectionName + 
"/invertAxisOrientation" ), child.attribute( QStringLiteral( 
"invertAxisOrientation" ) ) == QLatin1String( 
"true" ) );
 
  931     settings.setValue( QString( 
'/' + connectionName + 
"/referer" ), child.attribute( QStringLiteral( 
"referer" ) ) );
 
  932     settings.setValue( QString( 
'/' + connectionName + 
"/smoothPixmapTransform" ), child.attribute( QStringLiteral( 
"smoothPixmapTransform" ) ) == QLatin1String( 
"true" ) );
 
  933     settings.setValue( QString( 
'/' + connectionName + 
"/dpiMode" ), child.attribute( QStringLiteral( 
"dpiMode" ), QStringLiteral( 
"7" ) ).toInt() );
 
  936     if ( !child.attribute( QStringLiteral( 
"username" ) ).isEmpty() )
 
  938       settings.beginGroup( 
"/qgis/" + service.toUpper() + 
'/' + connectionName );
 
  939       settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
  940       settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
  943     child = child.nextSiblingElement();
 
  947 void QgsManageConnectionsDialog::loadWfsConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
  949   QDomElement root = doc.documentElement();
 
  950   if ( root.tagName() != QLatin1String( 
"qgsWFSConnections" ) )
 
  952     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
  953                               tr( 
"The file is not a WFS connections exchange file." ) );
 
  957   QString connectionName;
 
  958   QgsSettings settings;
 
  959   settings.beginGroup( QStringLiteral( 
"/qgis/connections-wfs" ) );
 
  960   QStringList keys = settings.childGroups();
 
  962   QDomElement child = root.firstChildElement();
 
  964   bool overwrite = 
true;
 
  966   while ( !child.isNull() )
 
  968     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
  969     if ( !items.contains( connectionName ) )
 
  971       child = child.nextSiblingElement();
 
  976     if ( keys.contains( connectionName ) && prompt )
 
  978       int res = QMessageBox::warning( 
this,
 
  979                                       tr( 
"Loading Connections" ),
 
  980                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
  981                                       .arg( connectionName ),
 
  982                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
  986         case QMessageBox::Cancel:
 
  988         case QMessageBox::No:
 
  989           child = child.nextSiblingElement();
 
  991         case QMessageBox::Yes:
 
  994         case QMessageBox::YesToAll:
 
  998         case QMessageBox::NoToAll:
 
 1005     if ( keys.contains( connectionName ) )
 
 1009         child = child.nextSiblingElement();
 
 1015       keys << connectionName;
 
 1019     settings.beginGroup( QStringLiteral( 
"/qgis/connections-wfs" ) );
 
 1020     settings.setValue( QString( 
'/' + connectionName + 
"/url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
 1022     settings.setValue( QString( 
'/' + connectionName + 
"/version" ), child.attribute( QStringLiteral( 
"version" ) ) );
 
 1023     settings.setValue( QString( 
'/' + connectionName + 
"/maxnumfeatures" ), child.attribute( QStringLiteral( 
"maxnumfeatures" ) ) );
 
 1024     settings.setValue( QString( 
'/' + connectionName + 
"/pagesize" ), child.attribute( QStringLiteral( 
"pagesize" ) ) );
 
 1025     settings.setValue( QString( 
'/' + connectionName + 
"/pagingenabled" ), child.attribute( QStringLiteral( 
"pagingenabled" ) ) );
 
 1026     settings.setValue( QString( 
'/' + connectionName + 
"/ignoreAxisOrientation" ), child.attribute( QStringLiteral( 
"ignoreAxisOrientation" ) ) );
 
 1027     settings.setValue( QString( 
'/' + connectionName + 
"/invertAxisOrientation" ), child.attribute( QStringLiteral( 
"invertAxisOrientation" ) ) );
 
 1028     settings.endGroup();
 
 1030     if ( !child.attribute( QStringLiteral( 
"username" ) ).isEmpty() )
 
 1032       settings.beginGroup( 
"/qgis/WFS/" + connectionName );
 
 1033       settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1034       settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1035       settings.endGroup();
 
 1037     child = child.nextSiblingElement();
 
 1041 void QgsManageConnectionsDialog::loadPgConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1043   QDomElement root = doc.documentElement();
 
 1044   if ( root.tagName() != QLatin1String( 
"qgsPgConnections" ) )
 
 1046     QMessageBox::information( 
this,
 
 1047                               tr( 
"Loading Connections" ),
 
 1048                               tr( 
"The file is not a PostGIS connections exchange file." ) );
 
 1052   QString connectionName;
 
 1053   QgsSettings settings;
 
 1054   settings.beginGroup( QStringLiteral( 
"/PostgreSQL/connections" ) );
 
 1055   QStringList keys = settings.childGroups();
 
 1056   settings.endGroup();
 
 1057   QDomElement child = root.firstChildElement();
 
 1059   bool overwrite = 
true;
 
 1061   while ( !child.isNull() )
 
 1063     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1064     if ( !items.contains( connectionName ) )
 
 1066       child = child.nextSiblingElement();
 
 1071     if ( keys.contains( connectionName ) && prompt )
 
 1073       int res = QMessageBox::warning( 
this,
 
 1074                                       tr( 
"Loading Connections" ),
 
 1075                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1076                                       .arg( connectionName ),
 
 1077                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1080         case QMessageBox::Cancel:
 
 1082         case QMessageBox::No:
 
 1083           child = child.nextSiblingElement();
 
 1085         case QMessageBox::Yes:
 
 1088         case QMessageBox::YesToAll:
 
 1092         case QMessageBox::NoToAll:
 
 1099     if ( keys.contains( connectionName ) )
 
 1103         child = child.nextSiblingElement();
 
 1109       keys << connectionName;
 
 1113     settings.beginGroup( 
"/PostgreSQL/connections/" + connectionName );
 
 1115     settings.setValue( QStringLiteral( 
"/host" ), child.attribute( QStringLiteral( 
"host" ) ) );
 
 1116     settings.setValue( QStringLiteral( 
"/port" ), child.attribute( QStringLiteral( 
"port" ) ) );
 
 1117     settings.setValue( QStringLiteral( 
"/database" ), child.attribute( QStringLiteral( 
"database" ) ) );
 
 1118     if ( child.hasAttribute( QStringLiteral( 
"service" ) ) )
 
 1120       settings.setValue( QStringLiteral( 
"/service" ), child.attribute( QStringLiteral( 
"service" ) ) );
 
 1124       settings.setValue( QStringLiteral( 
"/service" ), 
"" );
 
 1126     settings.setValue( QStringLiteral( 
"/sslmode" ), child.attribute( QStringLiteral( 
"sslmode" ) ) );
 
 1127     settings.setValue( QStringLiteral( 
"/estimatedMetadata" ), child.attribute( QStringLiteral( 
"estimatedMetadata" ) ) );
 
 1128     settings.setValue( QStringLiteral( 
"/saveUsername" ), child.attribute( QStringLiteral( 
"saveUsername" ) ) );
 
 1129     settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1130     settings.setValue( QStringLiteral( 
"/savePassword" ), child.attribute( QStringLiteral( 
"savePassword" ) ) );
 
 1131     settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1132     settings.endGroup();
 
 1134     child = child.nextSiblingElement();
 
 1138 void QgsManageConnectionsDialog::loadMssqlConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1140   QDomElement root = doc.documentElement();
 
 1141   if ( root.tagName() != QLatin1String( 
"qgsMssqlConnections" ) )
 
 1143     QMessageBox::information( 
this,
 
 1144                               tr( 
"Loading Connections" ),
 
 1145                               tr( 
"The file is not a MSSQL connections exchange file." ) );
 
 1149   QString connectionName;
 
 1150   QgsSettings settings;
 
 1151   settings.beginGroup( QStringLiteral( 
"/MSSQL/connections" ) );
 
 1152   QStringList keys = settings.childGroups();
 
 1153   settings.endGroup();
 
 1154   QDomElement child = root.firstChildElement();
 
 1156   bool overwrite = 
true;
 
 1158   while ( !child.isNull() )
 
 1160     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1161     if ( !items.contains( connectionName ) )
 
 1163       child = child.nextSiblingElement();
 
 1168     if ( keys.contains( connectionName ) && prompt )
 
 1170       int res = QMessageBox::warning( 
this,
 
 1171                                       tr( 
"Loading Connections" ),
 
 1172                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1173                                       .arg( connectionName ),
 
 1174                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1177         case QMessageBox::Cancel:
 
 1179         case QMessageBox::No:
 
 1180           child = child.nextSiblingElement();
 
 1182         case QMessageBox::Yes:
 
 1185         case QMessageBox::YesToAll:
 
 1189         case QMessageBox::NoToAll:
 
 1196     if ( keys.contains( connectionName ) )
 
 1200         child = child.nextSiblingElement();
 
 1206       keys << connectionName;
 
 1210     settings.beginGroup( 
"/MSSQL/connections/" + connectionName );
 
 1212     settings.setValue( QStringLiteral( 
"/host" ), child.attribute( QStringLiteral( 
"host" ) ) );
 
 1213     settings.setValue( QStringLiteral( 
"/port" ), child.attribute( QStringLiteral( 
"port" ) ) );
 
 1214     settings.setValue( QStringLiteral( 
"/database" ), child.attribute( QStringLiteral( 
"database" ) ) );
 
 1215     if ( child.hasAttribute( QStringLiteral( 
"service" ) ) )
 
 1217       settings.setValue( QStringLiteral( 
"/service" ), child.attribute( QStringLiteral( 
"service" ) ) );
 
 1221       settings.setValue( QStringLiteral( 
"/service" ), 
"" );
 
 1223     settings.setValue( QStringLiteral( 
"/sslmode" ), child.attribute( QStringLiteral( 
"sslmode" ) ) );
 
 1224     settings.setValue( QStringLiteral( 
"/estimatedMetadata" ), child.attribute( QStringLiteral( 
"estimatedMetadata" ) ) );
 
 1225     settings.setValue( QStringLiteral( 
"/saveUsername" ), child.attribute( QStringLiteral( 
"saveUsername" ) ) );
 
 1226     settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1227     settings.setValue( QStringLiteral( 
"/savePassword" ), child.attribute( QStringLiteral( 
"savePassword" ) ) );
 
 1228     settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1229     settings.endGroup();
 
 1231     child = child.nextSiblingElement();
 
 1235 void QgsManageConnectionsDialog::loadOracleConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1237   QDomElement root = doc.documentElement();
 
 1238   if ( root.tagName() != QLatin1String( 
"qgsOracleConnections" ) )
 
 1240     QMessageBox::information( 
this,
 
 1241                               tr( 
"Loading Connections" ),
 
 1242                               tr( 
"The file is not an Oracle connections exchange file." ) );
 
 1246   QString connectionName;
 
 1247   QgsSettings settings;
 
 1248   settings.beginGroup( QStringLiteral( 
"/Oracle/connections" ) );
 
 1249   QStringList keys = settings.childGroups();
 
 1250   settings.endGroup();
 
 1251   QDomElement child = root.firstChildElement();
 
 1253   bool overwrite = 
true;
 
 1255   while ( !child.isNull() )
 
 1257     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1258     if ( !items.contains( connectionName ) )
 
 1260       child = child.nextSiblingElement();
 
 1265     if ( keys.contains( connectionName ) && prompt )
 
 1267       int res = QMessageBox::warning( 
this,
 
 1268                                       tr( 
"Loading Connections" ),
 
 1269                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1270                                       .arg( connectionName ),
 
 1271                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1274         case QMessageBox::Cancel:
 
 1276         case QMessageBox::No:
 
 1277           child = child.nextSiblingElement();
 
 1279         case QMessageBox::Yes:
 
 1282         case QMessageBox::YesToAll:
 
 1286         case QMessageBox::NoToAll:
 
 1293     if ( keys.contains( connectionName ) )
 
 1297         child = child.nextSiblingElement();
 
 1303       keys << connectionName;
 
 1307     settings.beginGroup( 
"/Oracle/connections/" + connectionName );
 
 1309     settings.setValue( QStringLiteral( 
"/host" ), child.attribute( QStringLiteral( 
"host" ) ) );
 
 1310     settings.setValue( QStringLiteral( 
"/port" ), child.attribute( QStringLiteral( 
"port" ) ) );
 
 1311     settings.setValue( QStringLiteral( 
"/database" ), child.attribute( QStringLiteral( 
"database" ) ) );
 
 1312     settings.setValue( QStringLiteral( 
"/dboptions" ), child.attribute( QStringLiteral( 
"dboptions" ) ) );
 
 1313     settings.setValue( QStringLiteral( 
"/dbworkspace" ), child.attribute( QStringLiteral( 
"dbworkspace" ) ) );
 
 1314     settings.setValue( QStringLiteral( 
"/schema" ), child.attribute( QStringLiteral( 
"schema" ) ) );
 
 1315     settings.setValue( QStringLiteral( 
"/estimatedMetadata" ), child.attribute( QStringLiteral( 
"estimatedMetadata" ) ) );
 
 1316     settings.setValue( QStringLiteral( 
"/userTablesOnly" ), child.attribute( QStringLiteral( 
"userTablesOnly" ) ) );
 
 1317     settings.setValue( QStringLiteral( 
"/geometryColumnsOnly" ), child.attribute( QStringLiteral( 
"geometryColumnsOnly" ) ) );
 
 1318     settings.setValue( QStringLiteral( 
"/allowGeometrylessTables" ), child.attribute( QStringLiteral( 
"allowGeometrylessTables" ) ) );
 
 1319     settings.setValue( QStringLiteral( 
"/saveUsername" ), child.attribute( QStringLiteral( 
"saveUsername" ) ) );
 
 1320     settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1321     settings.setValue( QStringLiteral( 
"/savePassword" ), child.attribute( QStringLiteral( 
"savePassword" ) ) );
 
 1322     settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1323     settings.endGroup();
 
 1325     child = child.nextSiblingElement();
 
 1329 void QgsManageConnectionsDialog::loadDb2Connections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1331   QDomElement root = doc.documentElement();
 
 1332   if ( root.tagName() != QLatin1String( 
"qgsDb2Connections" ) )
 
 1334     QMessageBox::information( 
this,
 
 1335                               tr( 
"Loading Connections" ),
 
 1336                               tr( 
"The file is not a DB2 connections exchange file." ) );
 
 1340   QString connectionName;
 
 1341   QgsSettings settings;
 
 1342   settings.beginGroup( QStringLiteral( 
"/DB2/connections" ) );
 
 1343   QStringList keys = settings.childGroups();
 
 1344   settings.endGroup();
 
 1345   QDomElement child = root.firstChildElement();
 
 1347   bool overwrite = 
true;
 
 1349   while ( !child.isNull() )
 
 1351     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1352     if ( !items.contains( connectionName ) )
 
 1354       child = child.nextSiblingElement();
 
 1359     if ( keys.contains( connectionName ) && prompt )
 
 1361       int res = QMessageBox::warning( 
this,
 
 1362                                       tr( 
"Loading Connections" ),
 
 1363                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1364                                       .arg( connectionName ),
 
 1365                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1368         case QMessageBox::Cancel:
 
 1370         case QMessageBox::No:
 
 1371           child = child.nextSiblingElement();
 
 1373         case QMessageBox::Yes:
 
 1376         case QMessageBox::YesToAll:
 
 1380         case QMessageBox::NoToAll:
 
 1387     if ( keys.contains( connectionName ) )
 
 1391         child = child.nextSiblingElement();
 
 1397       keys << connectionName;
 
 1401     settings.beginGroup( 
"/DB2/connections/" + connectionName );
 
 1403     settings.setValue( QStringLiteral( 
"/host" ), child.attribute( QStringLiteral( 
"host" ) ) );
 
 1404     settings.setValue( QStringLiteral( 
"/port" ), child.attribute( QStringLiteral( 
"port" ) ) );
 
 1405     settings.setValue( QStringLiteral( 
"/database" ), child.attribute( QStringLiteral( 
"database" ) ) );
 
 1406     if ( child.hasAttribute( QStringLiteral( 
"service" ) ) )
 
 1408       settings.setValue( QStringLiteral( 
"/service" ), child.attribute( QStringLiteral( 
"service" ) ) );
 
 1412       settings.setValue( QStringLiteral( 
"/service" ), 
"" );
 
 1414     settings.setValue( QStringLiteral( 
"/sslmode" ), child.attribute( QStringLiteral( 
"sslmode" ) ) );
 
 1415     settings.setValue( QStringLiteral( 
"/estimatedMetadata" ), child.attribute( QStringLiteral( 
"estimatedMetadata" ) ) );
 
 1416     settings.setValue( QStringLiteral( 
"/saveUsername" ), child.attribute( QStringLiteral( 
"saveUsername" ) ) );
 
 1417     settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1418     settings.setValue( QStringLiteral( 
"/savePassword" ), child.attribute( QStringLiteral( 
"savePassword" ) ) );
 
 1419     settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1420     settings.endGroup();
 
 1422     child = child.nextSiblingElement();
 
 1426 void QgsManageConnectionsDialog::loadHanaConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1428   QDomElement root = doc.documentElement();
 
 1429   if ( root.tagName() != QLatin1String( 
"qgsHanaConnections" ) )
 
 1431     QMessageBox::warning( 
this,
 
 1432                           tr( 
"Loading Connections" ),
 
 1433                           tr( 
"The file is not a HANA connections exchange file." ) );
 
 1437   QDomAttr version = root.attributeNode( 
"version" );
 
 1438   if ( version.value() != QLatin1String( 
"1.0" ) )
 
 1440     QMessageBox::warning( 
this,
 
 1441                           tr( 
"Loading Connections" ),
 
 1442                           tr( 
"The HANA connections exchange file version '%1' is not supported." ).arg( version.value() ) );
 
 1446   QgsSettings settings;
 
 1447   settings.beginGroup( QStringLiteral( 
"/HANA/connections" ) );
 
 1448   QStringList keys = settings.childGroups();
 
 1449   settings.endGroup();
 
 1450   QDomElement child = root.firstChildElement();
 
 1452   bool overwrite = 
true;
 
 1454   while ( !child.isNull() )
 
 1456     QString connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1457     if ( !items.contains( connectionName ) )
 
 1459       child = child.nextSiblingElement();
 
 1464     if ( keys.contains( connectionName ) && prompt )
 
 1466       int res = QMessageBox::warning( 
this,
 
 1467                                       tr( 
"Loading Connections" ),
 
 1468                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1469                                       .arg( connectionName ),
 
 1470                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1473         case QMessageBox::Cancel:
 
 1475         case QMessageBox::No:
 
 1476           child = child.nextSiblingElement();
 
 1478         case QMessageBox::Yes:
 
 1481         case QMessageBox::YesToAll:
 
 1485         case QMessageBox::NoToAll:
 
 1492     if ( keys.contains( connectionName ) )
 
 1496         child = child.nextSiblingElement();
 
 1502       keys << connectionName;
 
 1506     settings.beginGroup( 
"/HANA/connections/" + connectionName );
 
 1508     for ( 
const QString param :
 
 1509           {
"driver", 
"host", 
"database", 
"identifierType", 
"identifier", 
"multitenant", 
"schema", 
"userTablesOnly",
 
 1510            "allowGeometrylessTables", 
"saveUsername", 
"username", 
"savePassword", 
"password", 
"sslEnabled",
 
 1511            "sslCryptoProvider", 
"sslKeyStore", 
"sslTrustStore", 
"sslValidateCertificate", 
"sslHostNameInCertificate" 
 1513       settings.setValue( QStringLiteral( 
"/" ) + param, child.attribute( param ) );
 
 1515     settings.endGroup();
 
 1517     child = child.nextSiblingElement();
 
 1521 void QgsManageConnectionsDialog::loadGeonodeConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1523   QDomElement root = doc.documentElement();
 
 1524   if ( root.tagName() != QLatin1String( 
"qgsGeoNodeConnections" ) )
 
 1526     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
 1527                               tr( 
"The file is not a GeoNode connections exchange file." ) );
 
 1531   QString connectionName;
 
 1532   QgsSettings settings;
 
 1533   settings.beginGroup( QStringLiteral( 
"/qgis/connections-geonode" ) );
 
 1534   QStringList keys = settings.childGroups();
 
 1535   settings.endGroup();
 
 1536   QDomElement child = root.firstChildElement();
 
 1538   bool overwrite = 
true;
 
 1540   while ( !child.isNull() )
 
 1542     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1543     if ( !items.contains( connectionName ) )
 
 1545       child = child.nextSiblingElement();
 
 1550     if ( keys.contains( connectionName ) && prompt )
 
 1552       int res = QMessageBox::warning( 
this,
 
 1553                                       tr( 
"Loading Connections" ),
 
 1554                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1555                                       .arg( connectionName ),
 
 1556                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1560         case QMessageBox::Cancel:
 
 1562         case QMessageBox::No:
 
 1563           child = child.nextSiblingElement();
 
 1565         case QMessageBox::Yes:
 
 1568         case QMessageBox::YesToAll:
 
 1572         case QMessageBox::NoToAll:
 
 1579     if ( keys.contains( connectionName ) )
 
 1583         child = child.nextSiblingElement();
 
 1589       keys << connectionName;
 
 1593     settings.beginGroup( QStringLiteral( 
"/qgis/connections-geonode" ) );
 
 1594     settings.setValue( QString( 
'/' + connectionName + 
"/url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
 1595     settings.endGroup();
 
 1597     if ( !child.attribute( QStringLiteral( 
"username" ) ).isEmpty() )
 
 1599       settings.beginGroup( 
"/qgis/GeoNode/" + connectionName );
 
 1600       settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1601       settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1602       settings.endGroup();
 
 1604     child = child.nextSiblingElement();
 
 1608 void QgsManageConnectionsDialog::loadXyzTilesConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1610   QDomElement root = doc.documentElement();
 
 1611   if ( root.tagName() != QLatin1String( 
"qgsXYZTilesConnections" ) )
 
 1613     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
 1614                               tr( 
"The file is not a XYZ Tiles connections exchange file." ) );
 
 1618   QString connectionName;
 
 1619   QgsSettings settings;
 
 1620   settings.beginGroup( QStringLiteral( 
"/qgis/connections-xyz" ) );
 
 1621   QStringList keys = settings.childGroups();
 
 1622   settings.endGroup();
 
 1623   QDomElement child = root.firstChildElement();
 
 1625   bool overwrite = 
true;
 
 1627   while ( !child.isNull() )
 
 1629     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1630     if ( !items.contains( connectionName ) )
 
 1632       child = child.nextSiblingElement();
 
 1637     if ( keys.contains( connectionName ) && prompt )
 
 1639       int res = QMessageBox::warning( 
this,
 
 1640                                       tr( 
"Loading Connections" ),
 
 1641                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1642                                       .arg( connectionName ),
 
 1643                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1647         case QMessageBox::Cancel:
 
 1649         case QMessageBox::No:
 
 1650           child = child.nextSiblingElement();
 
 1652         case QMessageBox::Yes:
 
 1655         case QMessageBox::YesToAll:
 
 1659         case QMessageBox::NoToAll:
 
 1666     if ( keys.contains( connectionName ) )
 
 1670         child = child.nextSiblingElement();
 
 1676       keys << connectionName;
 
 1679     settings.beginGroup( 
"qgis/connections-xyz/" + connectionName );
 
 1680     settings.setValue( QStringLiteral( 
"url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
 1681     settings.setValue( QStringLiteral( 
"zmin" ), child.attribute( QStringLiteral( 
"zmin" ) ) );
 
 1682     settings.setValue( QStringLiteral( 
"zmax" ), child.attribute( QStringLiteral( 
"zmax" ) ) );
 
 1683     settings.setValue( QStringLiteral( 
"authcfg" ), child.attribute( QStringLiteral( 
"authcfg" ) ) );
 
 1684     settings.setValue( QStringLiteral( 
"username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1685     settings.setValue( QStringLiteral( 
"password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1686     settings.setValue( QStringLiteral( 
"referer" ), child.attribute( QStringLiteral( 
"referer" ) ) );
 
 1687     settings.setValue( QStringLiteral( 
"tilePixelRatio" ), child.attribute( QStringLiteral( 
"tilePixelRatio" ) ) );
 
 1688     settings.endGroup();
 
 1690     child = child.nextSiblingElement();
 
 1694 void QgsManageConnectionsDialog::loadArcgisConnections( 
const QDomDocument &doc, 
const QStringList &items, 
const QString &service )
 
 1696   QDomElement root = doc.documentElement();
 
 1697   if ( root.tagName() != 
"qgs" + service.toUpper() + 
"Connections" )
 
 1699     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
 1700                               tr( 
"The file is not a %1 connections exchange file." ).arg( service ) );
 
 1704   QString connectionName;
 
 1705   QgsSettings settings;
 
 1706   settings.beginGroup( 
"/qgis/connections-" + service.toLower() );
 
 1707   QStringList keys = settings.childGroups();
 
 1708   settings.endGroup();
 
 1709   QDomElement child = root.firstChildElement();
 
 1711   bool overwrite = 
true;
 
 1713   while ( !child.isNull() )
 
 1715     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1716     if ( !items.contains( connectionName ) )
 
 1718       child = child.nextSiblingElement();
 
 1723     if ( keys.contains( connectionName ) && prompt )
 
 1725       int res = QMessageBox::warning( 
this,
 
 1726                                       tr( 
"Loading Connections" ),
 
 1727                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1728                                       .arg( connectionName ),
 
 1729                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1733         case QMessageBox::Cancel:
 
 1735         case QMessageBox::No:
 
 1736           child = child.nextSiblingElement();
 
 1738         case QMessageBox::Yes:
 
 1741         case QMessageBox::YesToAll:
 
 1745         case QMessageBox::NoToAll:
 
 1752     if ( keys.contains( connectionName ) )
 
 1756         child = child.nextSiblingElement();
 
 1762       keys << connectionName;
 
 1766     settings.beginGroup( 
"/qgis/connections-" + service.toLower() );
 
 1767     settings.setValue( QString( 
'/' + connectionName + 
"/url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
 1768     settings.setValue( QString( 
'/' + connectionName + 
"/referer" ), child.attribute( QStringLiteral( 
"referer" ) ) );
 
 1769     settings.endGroup();
 
 1771     settings.beginGroup( 
"/qgis/" + service.toUpper() + 
'/' + connectionName );
 
 1772     settings.setValue( QStringLiteral( 
"/username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1773     settings.setValue( QStringLiteral( 
"/password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1774     settings.setValue( QStringLiteral( 
"/authcfg" ), child.attribute( QStringLiteral( 
"authcfg" ) ) );
 
 1775     settings.endGroup();
 
 1777     child = child.nextSiblingElement();
 
 1781 void QgsManageConnectionsDialog::loadVectorTileConnections( 
const QDomDocument &doc, 
const QStringList &items )
 
 1783   QDomElement root = doc.documentElement();
 
 1784   if ( root.tagName() != QLatin1String( 
"qgsVectorTileConnections" ) )
 
 1786     QMessageBox::information( 
this, tr( 
"Loading Connections" ),
 
 1787                               tr( 
"The file is not a Vector Tile connections exchange file." ) );
 
 1791   QString connectionName;
 
 1792   QgsSettings settings;
 
 1793   settings.beginGroup( QStringLiteral( 
"/qgis/connections-vector-tile" ) );
 
 1794   QStringList keys = settings.childGroups();
 
 1795   settings.endGroup();
 
 1796   QDomElement child = root.firstChildElement();
 
 1798   bool overwrite = 
true;
 
 1800   while ( !child.isNull() )
 
 1802     connectionName = child.attribute( QStringLiteral( 
"name" ) );
 
 1803     if ( !items.contains( connectionName ) )
 
 1805       child = child.nextSiblingElement();
 
 1810     if ( keys.contains( connectionName ) && prompt )
 
 1812       int res = QMessageBox::warning( 
this,
 
 1813                                       tr( 
"Loading Connections" ),
 
 1814                                       tr( 
"Connection with name '%1' already exists. Overwrite?" )
 
 1815                                       .arg( connectionName ),
 
 1816                                       QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
 
 1820         case QMessageBox::Cancel:
 
 1822         case QMessageBox::No:
 
 1823           child = child.nextSiblingElement();
 
 1825         case QMessageBox::Yes:
 
 1828         case QMessageBox::YesToAll:
 
 1832         case QMessageBox::NoToAll:
 
 1839     if ( keys.contains( connectionName ) )
 
 1843         child = child.nextSiblingElement();
 
 1849       keys << connectionName;
 
 1852     settings.beginGroup( 
"qgis/connections-vector-tile/" + connectionName );
 
 1853     settings.setValue( QStringLiteral( 
"url" ), child.attribute( QStringLiteral( 
"url" ) ) );
 
 1854     settings.setValue( QStringLiteral( 
"zmin" ), child.attribute( QStringLiteral( 
"zmin" ) ) );
 
 1855     settings.setValue( QStringLiteral( 
"zmax" ), child.attribute( QStringLiteral( 
"zmax" ) ) );
 
 1856     settings.setValue( QStringLiteral( 
"serviceType" ), child.attribute( QStringLiteral( 
"serviceType" ) ) );
 
 1857     settings.setValue( QStringLiteral( 
"authcfg" ), child.attribute( QStringLiteral( 
"authcfg" ) ) );
 
 1858     settings.setValue( QStringLiteral( 
"username" ), child.attribute( QStringLiteral( 
"username" ) ) );
 
 1859     settings.setValue( QStringLiteral( 
"password" ), child.attribute( QStringLiteral( 
"password" ) ) );
 
 1860     settings.setValue( QStringLiteral( 
"referer" ), child.attribute( QStringLiteral( 
"referer" ) ) );
 
 1861     settings.setValue( QStringLiteral( 
"styleUrl" ), child.attribute( QStringLiteral( 
"styleUrl" ) ) );
 
 1863     settings.endGroup();
 
 1865     child = child.nextSiblingElement();
 
 1871   listConnections->selectAll();
 
 1872   buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
 
 1877   listConnections->clearSelection();
 
 1878   buttonBox->button( QDialogButtonBox::Ok )->setEnabled( 
false );
 
QgsManageConnectionsDialog(QWidget *parent=nullptr, Mode mode=Export, Type type=WMS, const QString &fileName=QString())
Constructor for QgsManageConnectionsDialog.