35 , mFileName( fileName )
37 , mConnectionType( type )
42 QPushButton *pb =
nullptr;
43 pb =
new QPushButton( tr(
"Select All" ) );
44 buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
47 pb =
new QPushButton( tr(
"Clear Selection" ) );
48 buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
51 if ( mDialogMode ==
Import )
53 label->setText( tr(
"Select connections to import" ) );
54 buttonBox->button( QDialogButtonBox::Ok )->setText( tr(
"Import" ) );
55 buttonBox->button( QDialogButtonBox::Ok )->setEnabled(
false );
60 buttonBox->button( QDialogButtonBox::Ok )->setText( tr(
"Export" ) );
61 buttonBox->button( QDialogButtonBox::Ok )->setEnabled(
false );
64 if ( !populateConnections() )
66 QApplication::postEvent(
this,
new QCloseEvent() );
70 disconnect( buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
78 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
83 const QList<QListWidgetItem *> selection = listConnections->selectedItems();
84 if ( selection.isEmpty() )
86 QMessageBox::warning(
this, tr(
"Export/Import Error" ),
87 tr(
"You should select at least one connection from list." ) );
92 items.reserve( selection.size() );
93 for (
int i = 0; i < selection.size(); ++i )
95 items.append( selection.at( i )->text() );
98 if ( mDialogMode ==
Export )
100 QString fileName = QFileDialog::getSaveFileName(
this, tr(
"Save Connections" ), QDir::homePath(),
101 tr(
"XML files (*.xml *.XML)" ) );
105 if ( fileName.isEmpty() )
111 if ( !fileName.endsWith( QLatin1String(
".xml" ), Qt::CaseInsensitive ) )
113 fileName += QLatin1String(
".xml" );
116 mFileName = fileName;
119 switch ( mConnectionType )
122 doc = saveOWSConnections( items, QStringLiteral(
"WMS" ) );
125 doc = saveWfsConnections( items );
128 doc = savePgConnections( items );
131 doc = saveMssqlConnections( items );
134 doc = saveOWSConnections( items, QStringLiteral(
"WCS" ) );
137 doc = saveOracleConnections( items );
140 doc = saveHanaConnections( items );
143 doc = saveXyzTilesConnections( items );
147 doc = saveArcgisConnections( items );
150 doc = saveVectorTileConnections( items );
153 doc = saveTiledSceneConnections( items );
157 QFile file( mFileName );
158 if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
160 QMessageBox::warning(
this, tr(
"Saving Connections" ),
161 tr(
"Cannot write file %1:\n%2." )
163 file.errorString() ) );
167 QTextStream out( &file );
172 QFile file( mFileName );
173 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
175 QMessageBox::warning(
this, tr(
"Loading Connections" ),
176 tr(
"Cannot read file %1:\n%2." )
178 file.errorString() ) );
187 if ( !doc.setContent( &file,
true, &errorStr, &errorLine, &errorColumn ) )
189 QMessageBox::warning(
this, tr(
"Loading Connections" ),
190 tr(
"Parse error at line %1, column %2:\n%3" )
197 switch ( mConnectionType )
200 loadOWSConnections( doc, items, QStringLiteral(
"WMS" ) );
203 loadWfsConnections( doc, items );
206 loadPgConnections( doc, items );
209 loadMssqlConnections( doc, items );
212 loadOWSConnections( doc, items, QStringLiteral(
"WCS" ) );
215 loadOracleConnections( doc, items );
218 loadHanaConnections( doc, items );
221 loadXyzTilesConnections( doc, items );
224 loadArcgisConnections( doc, items, QStringLiteral(
"ARCGISMAPSERVER" ) );
227 loadArcgisConnections( doc, items, QStringLiteral(
"ARCGISFEATURESERVER" ) );
230 loadVectorTileConnections( doc, items );
233 loadTiledSceneConnections( doc, items );
237 listConnections->clear();
244bool QgsManageConnectionsDialog::populateConnections()
247 if ( mDialogMode ==
Export )
249 QStringList connections;
251 switch ( mConnectionType )
263 settings.
beginGroup( QStringLiteral(
"/PostgreSQL/connections" ) );
267 settings.
beginGroup( QStringLiteral(
"/MSSQL/connections" ) );
271 settings.
beginGroup( QStringLiteral(
"/Oracle/connections" ) );
275 settings.
beginGroup( QStringLiteral(
"/HANA/connections" ) );
286 connections = QgsVectorTileProviderConnection::sTreeConnectionVectorTile->items();
289 connections = QgsTiledSceneProviderConnection::sTreeConnectionTiledScene->items();
292 for (
const QString &connection : std::as_const( connections ) )
294 QListWidgetItem *item =
new QListWidgetItem();
295 item->setText( connection );
296 listConnections->addItem( item );
302 QFile file( mFileName );
303 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
305 QMessageBox::warning(
this, tr(
"Loading Connections" ),
306 tr(
"Cannot read file %1:\n%2." )
308 file.errorString() ) );
317 if ( !doc.setContent( &file,
true, &errorStr, &errorLine, &errorColumn ) )
319 QMessageBox::warning(
this, tr(
"Loading Connections" ),
320 tr(
"Parse error at line %1, column %2:\n%3" )
327 const QDomElement root = doc.documentElement();
328 switch ( mConnectionType )
331 if ( root.tagName() != QLatin1String(
"qgsWMSConnections" ) )
333 QMessageBox::information(
this, tr(
"Loading Connections" ),
334 tr(
"The file is not a WMS connections exchange file." ) );
340 if ( root.tagName() != QLatin1String(
"qgsWFSConnections" ) )
342 QMessageBox::information(
this, tr(
"Loading Connections" ),
343 tr(
"The file is not a WFS connections exchange file." ) );
349 if ( root.tagName() != QLatin1String(
"qgsWCSConnections" ) )
351 QMessageBox::information(
this, tr(
"Loading Connections" ),
352 tr(
"The file is not a WCS connections exchange file." ) );
358 if ( root.tagName() != QLatin1String(
"qgsPgConnections" ) )
360 QMessageBox::information(
this, tr(
"Loading Connections" ),
361 tr(
"The file is not a PostGIS connections exchange file." ) );
367 if ( root.tagName() != QLatin1String(
"qgsMssqlConnections" ) )
369 QMessageBox::information(
this, tr(
"Loading Connections" ),
370 tr(
"The file is not a MS SQL Server connections exchange file." ) );
375 if ( root.tagName() != QLatin1String(
"qgsOracleConnections" ) )
377 QMessageBox::information(
this, tr(
"Loading Connections" ),
378 tr(
"The file is not an Oracle connections exchange file." ) );
383 if ( root.tagName() != QLatin1String(
"qgsHanaConnections" ) )
385 QMessageBox::warning(
this, tr(
"Loading Connections" ),
386 tr(
"The file is not a HANA connections exchange file." ) );
391 if ( root.tagName() != QLatin1String(
"qgsXYZTilesConnections" ) )
393 QMessageBox::information(
this, tr(
"Loading Connections" ),
394 tr(
"The file is not a XYZ Tiles connections exchange file." ) );
399 if ( root.tagName() != QLatin1String(
"qgsARCGISMAPSERVERConnections" ) )
401 QMessageBox::information(
this, tr(
"Loading Connections" ),
402 tr(
"The file is not a ArcGIS Map Service connections exchange file." ) );
407 if ( root.tagName() != QLatin1String(
"qgsARCGISFEATURESERVERConnections" ) )
409 QMessageBox::information(
this, tr(
"Loading Connections" ),
410 tr(
"The file is not a ArcGIS Feature Service connections exchange file." ) );
415 if ( root.tagName() != QLatin1String(
"qgsVectorTileConnections" ) )
417 QMessageBox::information(
this, tr(
"Loading Connections" ),
418 tr(
"The file is not a Vector Tile connections exchange file." ) );
423 if ( root.tagName() != QLatin1String(
"qgsTiledSceneConnections" ) )
425 QMessageBox::information(
this, tr(
"Loading Connections" ),
426 tr(
"The file is not a tiled scene connections exchange file." ) );
432 QDomElement child = root.firstChildElement();
433 while ( !child.isNull() )
435 QListWidgetItem *item =
new QListWidgetItem();
436 item->setText( child.attribute( QStringLiteral(
"name" ) ) );
437 listConnections->addItem( item );
438 child = child.nextSiblingElement();
444QDomDocument QgsManageConnectionsDialog::saveOWSConnections(
const QStringList &connections,
const QString &service )
446 QDomDocument doc( QStringLiteral(
"connections" ) );
447 QDomElement root = doc.createElement(
"qgs" + service.toUpper() +
"Connections" );
448 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
449 doc.appendChild( root );
451 for (
int i = 0; i < connections.count(); ++i )
453 QDomElement el = doc.createElement( service.toLower() );
454 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
457 if ( service == QLatin1String(
"WMS" ) )
467 httpHeader.updateDomElement( el );
472 root.appendChild( el );
478QDomDocument QgsManageConnectionsDialog::saveWfsConnections(
const QStringList &connections )
480 QDomDocument doc( QStringLiteral(
"connections" ) );
481 QDomElement root = doc.createElement( QStringLiteral(
"qgsWFSConnections" ) );
482 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.1" ) );
483 doc.appendChild( root );
485 for (
int i = 0; i < connections.count(); ++i )
487 QDomElement el = doc.createElement( QStringLiteral(
"wfs" ) );
488 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
499 root.appendChild( el );
505QDomDocument QgsManageConnectionsDialog::savePgConnections(
const QStringList &connections )
507 QDomDocument doc( QStringLiteral(
"connections" ) );
508 QDomElement root = doc.createElement( QStringLiteral(
"qgsPgConnections" ) );
509 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
510 doc.appendChild( root );
514 for (
int i = 0; i < connections.count(); ++i )
516 path =
"/PostgreSQL/connections/" + connections[ i ];
517 QDomElement el = doc.createElement( QStringLiteral(
"postgis" ) );
518 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
519 el.setAttribute( QStringLiteral(
"host" ), settings.
value( path +
"/host" ).toString() );
520 el.setAttribute( QStringLiteral(
"port" ), settings.
value( path +
"/port" ).toString() );
521 el.setAttribute( QStringLiteral(
"database" ), settings.
value( path +
"/database" ).toString() );
522 el.setAttribute( QStringLiteral(
"service" ), settings.
value( path +
"/service" ).toString() );
523 el.setAttribute( QStringLiteral(
"sslmode" ), settings.
value( path +
"/sslmode",
"1" ).toString() );
524 el.setAttribute( QStringLiteral(
"estimatedMetadata" ), settings.
value( path +
"/estimatedMetadata",
"0" ).toString() );
525 el.setAttribute( QStringLiteral(
"projectsInDatabase" ), settings.
value( path +
"/projectsInDatabase",
"0" ).toString() );
526 el.setAttribute( QStringLiteral(
"dontResolveType" ), settings.
value( path +
"/dontResolveType",
"0" ).toString() );
527 el.setAttribute( QStringLiteral(
"allowGeometrylessTables" ), settings.
value( path +
"/allowGeometrylessTables",
"0" ).toString() );
528 el.setAttribute( QStringLiteral(
"geometryColumnsOnly" ), settings.
value( path +
"/geometryColumnsOnly",
"0" ).toString() );
529 el.setAttribute( QStringLiteral(
"publicOnly" ), settings.
value( path +
"/publicOnly",
"0" ).toString() );
531 el.setAttribute( QStringLiteral(
"saveUsername" ), settings.
value( path +
"/saveUsername",
"false" ).toString() );
533 if ( settings.
value( path +
"/saveUsername",
"false" ).toString() == QLatin1String(
"true" ) )
535 el.setAttribute( QStringLiteral(
"username" ), settings.
value( path +
"/username" ).toString() );
538 el.setAttribute( QStringLiteral(
"savePassword" ), settings.
value( path +
"/savePassword",
"false" ).toString() );
540 if ( settings.
value( path +
"/savePassword",
"false" ).toString() == QLatin1String(
"true" ) )
542 el.setAttribute( QStringLiteral(
"password" ), settings.
value( path +
"/password" ).toString() );
545 root.appendChild( el );
551QDomDocument QgsManageConnectionsDialog::saveMssqlConnections(
const QStringList &connections )
553 QDomDocument doc( QStringLiteral(
"connections" ) );
554 QDomElement root = doc.createElement( QStringLiteral(
"qgsMssqlConnections" ) );
555 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
556 doc.appendChild( root );
560 for (
int i = 0; i < connections.count(); ++i )
562 path =
"/MSSQL/connections/" + connections[ i ];
563 QDomElement el = doc.createElement( QStringLiteral(
"mssql" ) );
564 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
565 el.setAttribute( QStringLiteral(
"host" ), settings.
value( path +
"/host" ).toString() );
566 el.setAttribute( QStringLiteral(
"port" ), settings.
value( path +
"/port" ).toString() );
567 el.setAttribute( QStringLiteral(
"database" ), settings.
value( path +
"/database" ).toString() );
568 el.setAttribute( QStringLiteral(
"service" ), settings.
value( path +
"/service" ).toString() );
569 el.setAttribute( QStringLiteral(
"sslmode" ), settings.
value( path +
"/sslmode",
"1" ).toString() );
570 el.setAttribute( QStringLiteral(
"estimatedMetadata" ), settings.
value( path +
"/estimatedMetadata",
"0" ).toString() );
572 el.setAttribute( QStringLiteral(
"saveUsername" ), settings.
value( path +
"/saveUsername",
"false" ).toString() );
574 if ( settings.
value( path +
"/saveUsername",
"false" ).toString() == QLatin1String(
"true" ) )
576 el.setAttribute( QStringLiteral(
"username" ), settings.
value( path +
"/username" ).toString() );
579 el.setAttribute( QStringLiteral(
"savePassword" ), settings.
value( path +
"/savePassword",
"false" ).toString() );
581 if ( settings.
value( path +
"/savePassword",
"false" ).toString() == QLatin1String(
"true" ) )
583 el.setAttribute( QStringLiteral(
"password" ), settings.
value( path +
"/password" ).toString() );
586 root.appendChild( el );
592QDomDocument QgsManageConnectionsDialog::saveOracleConnections(
const QStringList &connections )
594 QDomDocument doc( QStringLiteral(
"connections" ) );
595 QDomElement root = doc.createElement( QStringLiteral(
"qgsOracleConnections" ) );
596 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
597 doc.appendChild( root );
601 for (
int i = 0; i < connections.count(); ++i )
603 path =
"/Oracle/connections/" + connections[ i ];
604 QDomElement el = doc.createElement( QStringLiteral(
"oracle" ) );
605 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
606 el.setAttribute( QStringLiteral(
"host" ), settings.
value( path +
"/host" ).toString() );
607 el.setAttribute( QStringLiteral(
"port" ), settings.
value( path +
"/port" ).toString() );
608 el.setAttribute( QStringLiteral(
"database" ), settings.
value( path +
"/database" ).toString() );
609 el.setAttribute( QStringLiteral(
"dboptions" ), settings.
value( path +
"/dboptions" ).toString() );
610 el.setAttribute( QStringLiteral(
"dbworkspace" ), settings.
value( path +
"/dbworkspace" ).toString() );
611 el.setAttribute( QStringLiteral(
"schema" ), settings.
value( path +
"/schema" ).toString() );
612 el.setAttribute( QStringLiteral(
"estimatedMetadata" ), settings.
value( path +
"/estimatedMetadata",
"0" ).toString() );
613 el.setAttribute( QStringLiteral(
"userTablesOnly" ), settings.
value( path +
"/userTablesOnly",
"0" ).toString() );
614 el.setAttribute( QStringLiteral(
"geometryColumnsOnly" ), settings.
value( path +
"/geometryColumnsOnly",
"0" ).toString() );
615 el.setAttribute( QStringLiteral(
"allowGeometrylessTables" ), settings.
value( path +
"/allowGeometrylessTables",
"0" ).toString() );
617 el.setAttribute( QStringLiteral(
"saveUsername" ), settings.
value( path +
"/saveUsername",
"false" ).toString() );
619 if ( settings.
value( path +
"/saveUsername",
"false" ).toString() == QLatin1String(
"true" ) )
621 el.setAttribute( QStringLiteral(
"username" ), settings.
value( path +
"/username" ).toString() );
624 el.setAttribute( QStringLiteral(
"savePassword" ), settings.
value( path +
"/savePassword",
"false" ).toString() );
626 if ( settings.
value( path +
"/savePassword",
"false" ).toString() == QLatin1String(
"true" ) )
628 el.setAttribute( QStringLiteral(
"password" ), settings.
value( path +
"/password" ).toString() );
631 root.appendChild( el );
637QDomDocument QgsManageConnectionsDialog::saveHanaConnections(
const QStringList &connections )
639 QDomDocument doc( QStringLiteral(
"connections" ) );
640 QDomElement root = doc.createElement( QStringLiteral(
"qgsHanaConnections" ) );
641 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
642 doc.appendChild( root );
646 for (
int i = 0; i < connections.count(); ++i )
648 path =
"/HANA/connections/" + connections[i];
649 QDomElement el = doc.createElement( QStringLiteral(
"hana" ) );
650 el.setAttribute( QStringLiteral(
"name" ), connections[i] );
651 el.setAttribute( QStringLiteral(
"driver" ), settings.
value( path +
"/driver", QString() ).toString() );
652 el.setAttribute( QStringLiteral(
"host" ), settings.
value( path +
"/host", QString() ).toString() );
653 el.setAttribute( QStringLiteral(
"identifierType" ), settings.
value( path +
"/identifierType", QString() ).toString() );
654 el.setAttribute( QStringLiteral(
"identifier" ), settings.
value( path +
"/identifier", QString() ).toString() );
655 el.setAttribute( QStringLiteral(
"multitenant" ), settings.
value( path +
"/multitenant", QString() ).toString() );
656 el.setAttribute( QStringLiteral(
"database" ), settings.
value( path +
"/database", QString() ).toString() );
657 el.setAttribute( QStringLiteral(
"schema" ), settings.
value( path +
"/schema", QString() ).toString() );
658 el.setAttribute( QStringLiteral(
"userTablesOnly" ), settings.
value( path +
"/userTablesOnly", QStringLiteral(
"0" ) ).toString() );
659 el.setAttribute( QStringLiteral(
"allowGeometrylessTables" ), settings.
value( path +
"/allowGeometrylessTables", QStringLiteral(
"0" ) ).toString() );
661 el.setAttribute( QStringLiteral(
"saveUsername" ), settings.
value( path +
"/saveUsername", QStringLiteral(
"false" ) ).toString() );
662 if ( settings.
value( path +
"/saveUsername",
"false" ).toString() == QLatin1String(
"true" ) )
664 el.setAttribute( QStringLiteral(
"username" ), settings.
value( path +
"/username", QString() ).toString() );
667 el.setAttribute( QStringLiteral(
"savePassword" ), settings.
value( path +
"/savePassword", QStringLiteral(
"false" ) ).toString() );
668 if ( settings.
value( path +
"/savePassword",
"false" ).toString() == QLatin1String(
"true" ) )
670 el.setAttribute( QStringLiteral(
"password" ), settings.
value( path +
"/password", QString() ).toString() );
673 el.setAttribute( QStringLiteral(
"sslEnabled" ), settings.
value( path +
"/sslEnabled", QStringLiteral(
"false" ) ).toString() );
674 el.setAttribute( QStringLiteral(
"sslCryptoProvider" ), settings.
value( path +
"/sslCryptoProvider", QStringLiteral(
"openssl" ) ).toString() );
675 el.setAttribute( QStringLiteral(
"sslKeyStore" ), settings.
value( path +
"/sslKeyStore", QString() ).toString() );
676 el.setAttribute( QStringLiteral(
"sslTrustStore" ), settings.
value( path +
"/sslTrustStore", QString() ).toString() );
677 el.setAttribute( QStringLiteral(
"sslValidateCertificate" ), settings.
value( path +
"/sslValidateCertificate", QStringLiteral(
"false" ) ).toString() );
678 el.setAttribute( QStringLiteral(
"sslHostNameInCertificate" ), settings.
value( path +
"/sslHostNameInCertificate", QString() ).toString() );
680 root.appendChild( el );
686QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections(
const QStringList &connections )
688 QDomDocument doc( QStringLiteral(
"connections" ) );
689 QDomElement root = doc.createElement( QStringLiteral(
"qgsXYZTilesConnections" ) );
690 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
691 doc.appendChild( root );
693 for (
int i = 0; i < connections.count(); ++i )
696 QDomElement el = doc.createElement( QStringLiteral(
"xyztiles" ) );
698 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
708 httpHeader.updateDomElement( el );
710 root.appendChild( el );
716QDomDocument QgsManageConnectionsDialog::saveArcgisConnections(
const QStringList &connections )
718 QDomDocument doc( QStringLiteral(
"connections" ) );
719 QDomElement root = doc.createElement(
"qgsARCGISFEATURESERVERConnections" );
720 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
721 doc.appendChild( root );
723 for (
const QString &connection : connections )
725 QDomElement el = doc.createElement( QStringLiteral(
"arcgisfeatureserver" ) );
726 el.setAttribute( QStringLiteral(
"name" ), connection );
730 httpHeader.updateDomElement( el );
736 root.appendChild( el );
742QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections(
const QStringList &connections )
744 QDomDocument doc( QStringLiteral(
"connections" ) );
745 QDomElement root = doc.createElement( QStringLiteral(
"qgsVectorTileConnections" ) );
746 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
747 doc.appendChild( root );
749 for (
int i = 0; i < connections.count(); ++i )
751 QDomElement el = doc.createElement( QStringLiteral(
"vectortile" ) );
753 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
754 el.setAttribute( QStringLiteral(
"url" ), QgsVectorTileProviderConnection::settingsUrl->value( connections[ i ] ) );
755 el.setAttribute( QStringLiteral(
"zmin" ), QgsVectorTileProviderConnection::settingsZmin->value( connections[ i ] ) );
756 el.setAttribute( QStringLiteral(
"zmax" ), QgsVectorTileProviderConnection::settingsZmax->value( connections[ i ] ) );
757 el.setAttribute( QStringLiteral(
"serviceType" ), QgsVectorTileProviderConnection::settingsServiceType->value( connections[ i ] ) );
758 el.setAttribute( QStringLiteral(
"authcfg" ), QgsVectorTileProviderConnection::settingsAuthcfg->value( connections[ i ] ) );
759 el.setAttribute( QStringLiteral(
"username" ), QgsVectorTileProviderConnection::settingsUsername->value( connections[ i ] ) );
760 el.setAttribute( QStringLiteral(
"password" ), QgsVectorTileProviderConnection::settingsPassword->value( connections[ i ] ) );
761 el.setAttribute( QStringLiteral(
"styleUrl" ), QgsVectorTileProviderConnection::settingsStyleUrl->value( connections[ i ] ) );
763 QgsHttpHeaders httpHeader( QgsVectorTileProviderConnection::settingsHeaders->value( connections[ i ] ) );
764 httpHeader.updateDomElement( el );
766 root.appendChild( el );
772QDomDocument QgsManageConnectionsDialog::saveTiledSceneConnections(
const QStringList &connections )
774 QDomDocument doc( QStringLiteral(
"connections" ) );
775 QDomElement root = doc.createElement( QStringLiteral(
"qgsTiledSceneConnections" ) );
776 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0" ) );
777 doc.appendChild( root );
779 for (
int i = 0; i < connections.count(); ++i )
781 QDomElement el = doc.createElement( QStringLiteral(
"tiledscene" ) );
783 el.setAttribute( QStringLiteral(
"name" ), connections[ i ] );
784 el.setAttribute( QStringLiteral(
"provider" ), QgsTiledSceneProviderConnection::settingsProvider->value( connections[ i ] ) );
785 el.setAttribute( QStringLiteral(
"url" ), QgsTiledSceneProviderConnection::settingsUrl->value( connections[ i ] ) );
786 el.setAttribute( QStringLiteral(
"authcfg" ), QgsTiledSceneProviderConnection::settingsAuthcfg->value( connections[ i ] ) );
787 el.setAttribute( QStringLiteral(
"username" ), QgsTiledSceneProviderConnection::settingsUsername->value( connections[ i ] ) );
788 el.setAttribute( QStringLiteral(
"password" ), QgsTiledSceneProviderConnection::settingsPassword->value( connections[ i ] ) );
790 QgsHttpHeaders httpHeader( QgsTiledSceneProviderConnection::settingsHeaders->value( connections[ i ] ) );
791 httpHeader.updateDomElement( el );
793 root.appendChild( el );
799void QgsManageConnectionsDialog::loadOWSConnections(
const QDomDocument &doc,
const QStringList &items,
const QString &service )
801 const QDomElement root = doc.documentElement();
802 if ( root.tagName() !=
"qgs" + service.toUpper() +
"Connections" )
804 QMessageBox::information(
this, tr(
"Loading Connections" ),
805 tr(
"The file is not a %1 connections exchange file." ).arg( service ) );
809 QString connectionName;
811 QDomElement child = root.firstChildElement();
813 bool overwrite =
true;
815 while ( !child.isNull() )
817 connectionName = child.attribute( QStringLiteral(
"name" ) );
818 if ( !items.contains( connectionName ) )
820 child = child.nextSiblingElement();
827 const int res = QMessageBox::warning(
this,
828 tr(
"Loading Connections" ),
829 tr(
"Connection with name '%1' already exists. Overwrite?" )
830 .arg( connectionName ),
831 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
835 case QMessageBox::Cancel:
837 case QMessageBox::No:
838 child = child.nextSiblingElement();
840 case QMessageBox::Yes:
843 case QMessageBox::YesToAll:
847 case QMessageBox::NoToAll:
856 child = child.nextSiblingElement();
872 if ( !child.attribute( QStringLiteral(
"username" ) ).isEmpty() )
877 child = child.nextSiblingElement();
881void QgsManageConnectionsDialog::loadWfsConnections(
const QDomDocument &doc,
const QStringList &items )
883 const QDomElement root = doc.documentElement();
884 if ( root.tagName() != QLatin1String(
"qgsWFSConnections" ) )
886 QMessageBox::information(
this, tr(
"Loading Connections" ),
887 tr(
"The file is not a WFS connections exchange file." ) );
891 QString connectionName;
894 QDomElement child = root.firstChildElement();
896 bool overwrite =
true;
898 while ( !child.isNull() )
900 connectionName = child.attribute( QStringLiteral(
"name" ) );
901 if ( !items.contains( connectionName ) )
903 child = child.nextSiblingElement();
908 if ( keys.contains( connectionName ) && prompt )
910 const int res = QMessageBox::warning(
this,
911 tr(
"Loading Connections" ),
912 tr(
"Connection with name '%1' already exists. Overwrite?" )
913 .arg( connectionName ),
914 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
918 case QMessageBox::Cancel:
920 case QMessageBox::No:
921 child = child.nextSiblingElement();
923 case QMessageBox::Yes:
926 case QMessageBox::YesToAll:
930 case QMessageBox::NoToAll:
937 if ( keys.contains( connectionName ) )
941 child = child.nextSiblingElement();
947 keys << connectionName;
960 if ( !child.attribute( QStringLiteral(
"username" ) ).isEmpty() )
965 child = child.nextSiblingElement();
969void QgsManageConnectionsDialog::loadPgConnections(
const QDomDocument &doc,
const QStringList &items )
971 const QDomElement root = doc.documentElement();
972 if ( root.tagName() != QLatin1String(
"qgsPgConnections" ) )
974 QMessageBox::information(
this,
975 tr(
"Loading Connections" ),
976 tr(
"The file is not a PostGIS connections exchange file." ) );
980 QString connectionName;
982 settings.
beginGroup( QStringLiteral(
"/PostgreSQL/connections" ) );
985 QDomElement child = root.firstChildElement();
987 bool overwrite =
true;
989 while ( !child.isNull() )
991 connectionName = child.attribute( QStringLiteral(
"name" ) );
992 if ( !items.contains( connectionName ) )
994 child = child.nextSiblingElement();
999 if ( keys.contains( connectionName ) && prompt )
1001 const int res = QMessageBox::warning(
this,
1002 tr(
"Loading Connections" ),
1003 tr(
"Connection with name '%1' already exists. Overwrite?" )
1004 .arg( connectionName ),
1005 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1008 case QMessageBox::Cancel:
1010 case QMessageBox::No:
1011 child = child.nextSiblingElement();
1013 case QMessageBox::Yes:
1016 case QMessageBox::YesToAll:
1020 case QMessageBox::NoToAll:
1027 if ( keys.contains( connectionName ) )
1031 child = child.nextSiblingElement();
1037 keys << connectionName;
1041 settings.
beginGroup(
"/PostgreSQL/connections/" + connectionName );
1043 settings.
setValue( QStringLiteral(
"/host" ), child.attribute( QStringLiteral(
"host" ) ) );
1044 settings.
setValue( QStringLiteral(
"/port" ), child.attribute( QStringLiteral(
"port" ) ) );
1045 settings.
setValue( QStringLiteral(
"/database" ), child.attribute( QStringLiteral(
"database" ) ) );
1046 if ( child.hasAttribute( QStringLiteral(
"service" ) ) )
1048 settings.
setValue( QStringLiteral(
"/service" ), child.attribute( QStringLiteral(
"service" ) ) );
1052 settings.
setValue( QStringLiteral(
"/service" ),
"" );
1054 settings.
setValue( QStringLiteral(
"/sslmode" ), child.attribute( QStringLiteral(
"sslmode" ) ) );
1055 settings.
setValue( QStringLiteral(
"/estimatedMetadata" ), child.attribute( QStringLiteral(
"estimatedMetadata" ) ) );
1056 settings.
setValue( QStringLiteral(
"/projectsInDatabase" ), child.attribute( QStringLiteral(
"projectsInDatabase" ), 0 ) );
1057 settings.
setValue( QStringLiteral(
"/dontResolveType" ), child.attribute( QStringLiteral(
"dontResolveType" ), 0 ) );
1058 settings.
setValue( QStringLiteral(
"/allowGeometrylessTables" ), child.attribute( QStringLiteral(
"allowGeometrylessTables" ), 0 ) );
1059 settings.
setValue( QStringLiteral(
"/geometryColumnsOnly" ), child.attribute( QStringLiteral(
"geometryColumnsOnly" ), 0 ) );
1060 settings.
setValue( QStringLiteral(
"/publicOnly" ), child.attribute( QStringLiteral(
"publicOnly" ), 0 ) );
1061 settings.
setValue( QStringLiteral(
"/saveUsername" ), child.attribute( QStringLiteral(
"saveUsername" ) ) );
1062 settings.
setValue( QStringLiteral(
"/username" ), child.attribute( QStringLiteral(
"username" ) ) );
1063 settings.
setValue( QStringLiteral(
"/savePassword" ), child.attribute( QStringLiteral(
"savePassword" ) ) );
1064 settings.
setValue( QStringLiteral(
"/password" ), child.attribute( QStringLiteral(
"password" ) ) );
1067 child = child.nextSiblingElement();
1071void QgsManageConnectionsDialog::loadMssqlConnections(
const QDomDocument &doc,
const QStringList &items )
1073 const QDomElement root = doc.documentElement();
1074 if ( root.tagName() != QLatin1String(
"qgsMssqlConnections" ) )
1076 QMessageBox::information(
this,
1077 tr(
"Loading Connections" ),
1078 tr(
"The file is not a MS SQL Server connections exchange file." ) );
1082 QString connectionName;
1084 settings.
beginGroup( QStringLiteral(
"/MSSQL/connections" ) );
1087 QDomElement child = root.firstChildElement();
1089 bool overwrite =
true;
1091 while ( !child.isNull() )
1093 connectionName = child.attribute( QStringLiteral(
"name" ) );
1094 if ( !items.contains( connectionName ) )
1096 child = child.nextSiblingElement();
1101 if ( keys.contains( connectionName ) && prompt )
1103 const int res = QMessageBox::warning(
this,
1104 tr(
"Loading Connections" ),
1105 tr(
"Connection with name '%1' already exists. Overwrite?" )
1106 .arg( connectionName ),
1107 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1110 case QMessageBox::Cancel:
1112 case QMessageBox::No:
1113 child = child.nextSiblingElement();
1115 case QMessageBox::Yes:
1118 case QMessageBox::YesToAll:
1122 case QMessageBox::NoToAll:
1129 if ( keys.contains( connectionName ) )
1133 child = child.nextSiblingElement();
1139 keys << connectionName;
1143 settings.
beginGroup(
"/MSSQL/connections/" + connectionName );
1145 settings.
setValue( QStringLiteral(
"/host" ), child.attribute( QStringLiteral(
"host" ) ) );
1146 settings.
setValue( QStringLiteral(
"/port" ), child.attribute( QStringLiteral(
"port" ) ) );
1147 settings.
setValue( QStringLiteral(
"/database" ), child.attribute( QStringLiteral(
"database" ) ) );
1148 if ( child.hasAttribute( QStringLiteral(
"service" ) ) )
1150 settings.
setValue( QStringLiteral(
"/service" ), child.attribute( QStringLiteral(
"service" ) ) );
1154 settings.
setValue( QStringLiteral(
"/service" ),
"" );
1156 settings.
setValue( QStringLiteral(
"/sslmode" ), child.attribute( QStringLiteral(
"sslmode" ) ) );
1157 settings.
setValue( QStringLiteral(
"/estimatedMetadata" ), child.attribute( QStringLiteral(
"estimatedMetadata" ) ) );
1158 settings.
setValue( QStringLiteral(
"/saveUsername" ), child.attribute( QStringLiteral(
"saveUsername" ) ) );
1159 settings.
setValue( QStringLiteral(
"/username" ), child.attribute( QStringLiteral(
"username" ) ) );
1160 settings.
setValue( QStringLiteral(
"/savePassword" ), child.attribute( QStringLiteral(
"savePassword" ) ) );
1161 settings.
setValue( QStringLiteral(
"/password" ), child.attribute( QStringLiteral(
"password" ) ) );
1164 child = child.nextSiblingElement();
1168void QgsManageConnectionsDialog::loadOracleConnections(
const QDomDocument &doc,
const QStringList &items )
1170 const QDomElement root = doc.documentElement();
1171 if ( root.tagName() != QLatin1String(
"qgsOracleConnections" ) )
1173 QMessageBox::information(
this,
1174 tr(
"Loading Connections" ),
1175 tr(
"The file is not an Oracle connections exchange file." ) );
1179 QString connectionName;
1181 settings.
beginGroup( QStringLiteral(
"/Oracle/connections" ) );
1184 QDomElement child = root.firstChildElement();
1186 bool overwrite =
true;
1188 while ( !child.isNull() )
1190 connectionName = child.attribute( QStringLiteral(
"name" ) );
1191 if ( !items.contains( connectionName ) )
1193 child = child.nextSiblingElement();
1198 if ( keys.contains( connectionName ) && prompt )
1200 const int res = QMessageBox::warning(
this,
1201 tr(
"Loading Connections" ),
1202 tr(
"Connection with name '%1' already exists. Overwrite?" )
1203 .arg( connectionName ),
1204 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1207 case QMessageBox::Cancel:
1209 case QMessageBox::No:
1210 child = child.nextSiblingElement();
1212 case QMessageBox::Yes:
1215 case QMessageBox::YesToAll:
1219 case QMessageBox::NoToAll:
1226 if ( keys.contains( connectionName ) )
1230 child = child.nextSiblingElement();
1236 keys << connectionName;
1240 settings.
beginGroup(
"/Oracle/connections/" + connectionName );
1242 settings.
setValue( QStringLiteral(
"/host" ), child.attribute( QStringLiteral(
"host" ) ) );
1243 settings.
setValue( QStringLiteral(
"/port" ), child.attribute( QStringLiteral(
"port" ) ) );
1244 settings.
setValue( QStringLiteral(
"/database" ), child.attribute( QStringLiteral(
"database" ) ) );
1245 settings.
setValue( QStringLiteral(
"/dboptions" ), child.attribute( QStringLiteral(
"dboptions" ) ) );
1246 settings.
setValue( QStringLiteral(
"/dbworkspace" ), child.attribute( QStringLiteral(
"dbworkspace" ) ) );
1247 settings.
setValue( QStringLiteral(
"/schema" ), child.attribute( QStringLiteral(
"schema" ) ) );
1248 settings.
setValue( QStringLiteral(
"/estimatedMetadata" ), child.attribute( QStringLiteral(
"estimatedMetadata" ) ) );
1249 settings.
setValue( QStringLiteral(
"/userTablesOnly" ), child.attribute( QStringLiteral(
"userTablesOnly" ) ) );
1250 settings.
setValue( QStringLiteral(
"/geometryColumnsOnly" ), child.attribute( QStringLiteral(
"geometryColumnsOnly" ) ) );
1251 settings.
setValue( QStringLiteral(
"/allowGeometrylessTables" ), child.attribute( QStringLiteral(
"allowGeometrylessTables" ) ) );
1252 settings.
setValue( QStringLiteral(
"/saveUsername" ), child.attribute( QStringLiteral(
"saveUsername" ) ) );
1253 settings.
setValue( QStringLiteral(
"/username" ), child.attribute( QStringLiteral(
"username" ) ) );
1254 settings.
setValue( QStringLiteral(
"/savePassword" ), child.attribute( QStringLiteral(
"savePassword" ) ) );
1255 settings.
setValue( QStringLiteral(
"/password" ), child.attribute( QStringLiteral(
"password" ) ) );
1258 child = child.nextSiblingElement();
1262void QgsManageConnectionsDialog::loadHanaConnections(
const QDomDocument &doc,
const QStringList &items )
1264 QDomElement root = doc.documentElement();
1265 if ( root.tagName() != QLatin1String(
"qgsHanaConnections" ) )
1267 QMessageBox::warning(
this,
1268 tr(
"Loading Connections" ),
1269 tr(
"The file is not a HANA connections exchange file." ) );
1273 const QDomAttr version = root.attributeNode(
"version" );
1274 if ( version.value() != QLatin1String(
"1.0" ) )
1276 QMessageBox::warning(
this,
1277 tr(
"Loading Connections" ),
1278 tr(
"The HANA connections exchange file version '%1' is not supported." ).arg( version.value() ) );
1283 settings.
beginGroup( QStringLiteral(
"/HANA/connections" ) );
1286 QDomElement child = root.firstChildElement();
1288 bool overwrite =
true;
1290 while ( !child.isNull() )
1292 const QString connectionName = child.attribute( QStringLiteral(
"name" ) );
1293 if ( !items.contains( connectionName ) )
1295 child = child.nextSiblingElement();
1300 if ( keys.contains( connectionName ) && prompt )
1302 const int res = QMessageBox::warning(
this,
1303 tr(
"Loading Connections" ),
1304 tr(
"Connection with name '%1' already exists. Overwrite?" )
1305 .arg( connectionName ),
1306 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1309 case QMessageBox::Cancel:
1311 case QMessageBox::No:
1312 child = child.nextSiblingElement();
1314 case QMessageBox::Yes:
1317 case QMessageBox::YesToAll:
1321 case QMessageBox::NoToAll:
1328 if ( keys.contains( connectionName ) )
1332 child = child.nextSiblingElement();
1338 keys << connectionName;
1342 settings.
beginGroup(
"/HANA/connections/" + connectionName );
1344 for (
const QString param :
1345 {
"driver",
"host",
"database",
"identifierType",
"identifier",
"multitenant",
"schema",
"userTablesOnly",
1346 "allowGeometrylessTables",
"saveUsername",
"username",
"savePassword",
"password",
"sslEnabled",
1347 "sslCryptoProvider",
"sslKeyStore",
"sslTrustStore",
"sslValidateCertificate",
"sslHostNameInCertificate"
1349 settings.
setValue( QStringLiteral(
"/" ) + param, child.attribute( param ) );
1353 child = child.nextSiblingElement();
1357void QgsManageConnectionsDialog::loadXyzTilesConnections(
const QDomDocument &doc,
const QStringList &items )
1359 const QDomElement root = doc.documentElement();
1360 if ( root.tagName() != QLatin1String(
"qgsXYZTilesConnections" ) )
1362 QMessageBox::information(
this, tr(
"Loading Connections" ),
1363 tr(
"The file is not a XYZ Tiles connections exchange file." ) );
1367 QString connectionName;
1369 QDomElement child = root.firstChildElement();
1371 bool overwrite =
true;
1373 while ( !child.isNull() )
1375 connectionName = child.attribute( QStringLiteral(
"name" ) );
1376 if ( !items.contains( connectionName ) )
1378 child = child.nextSiblingElement();
1383 if ( keys.contains( connectionName ) && prompt )
1385 const int res = QMessageBox::warning(
this,
1386 tr(
"Loading Connections" ),
1387 tr(
"Connection with name '%1' already exists. Overwrite?" )
1388 .arg( connectionName ),
1389 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1393 case QMessageBox::Cancel:
1395 case QMessageBox::No:
1396 child = child.nextSiblingElement();
1398 case QMessageBox::Yes:
1401 case QMessageBox::YesToAll:
1405 case QMessageBox::NoToAll:
1412 if ( keys.contains( connectionName ) )
1416 child = child.nextSiblingElement();
1422 keys << connectionName;
1437 child = child.nextSiblingElement();
1441void QgsManageConnectionsDialog::loadArcgisConnections(
const QDomDocument &doc,
const QStringList &items,
const QString &service )
1443 const QDomElement root = doc.documentElement();
1444 if ( root.tagName() !=
"qgs" + service.toUpper() +
"Connections" )
1446 QMessageBox::information(
this, tr(
"Loading Connections" ),
1447 tr(
"The file is not a %1 connections exchange file." ).arg( service ) );
1451 QString connectionName;
1453 QDomElement child = root.firstChildElement();
1455 bool overwrite =
true;
1457 while ( !child.isNull() )
1459 connectionName = child.attribute( QStringLiteral(
"name" ) );
1460 if ( !items.contains( connectionName ) )
1462 child = child.nextSiblingElement();
1467 if ( keys.contains( connectionName ) && prompt )
1469 const int res = QMessageBox::warning(
this,
1470 tr(
"Loading Connections" ),
1471 tr(
"Connection with name '%1' already exists. Overwrite?" )
1472 .arg( connectionName ),
1473 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1477 case QMessageBox::Cancel:
1479 case QMessageBox::No:
1480 child = child.nextSiblingElement();
1482 case QMessageBox::Yes:
1485 case QMessageBox::YesToAll:
1489 case QMessageBox::NoToAll:
1496 if ( keys.contains( connectionName ) )
1500 child = child.nextSiblingElement();
1506 keys << connectionName;
1519 child = child.nextSiblingElement();
1523void QgsManageConnectionsDialog::loadVectorTileConnections(
const QDomDocument &doc,
const QStringList &items )
1525 const QDomElement root = doc.documentElement();
1526 if ( root.tagName() != QLatin1String(
"qgsVectorTileConnections" ) )
1528 QMessageBox::information(
this, tr(
"Loading Connections" ),
1529 tr(
"The file is not a Vector Tile connections exchange file." ) );
1533 QString connectionName;
1535 settings.
beginGroup( QStringLiteral(
"/qgis/connections-vector-tile" ) );
1538 QDomElement child = root.firstChildElement();
1540 bool overwrite =
true;
1542 while ( !child.isNull() )
1544 connectionName = child.attribute( QStringLiteral(
"name" ) );
1545 if ( !items.contains( connectionName ) )
1547 child = child.nextSiblingElement();
1552 if ( keys.contains( connectionName ) && prompt )
1554 const int res = QMessageBox::warning(
this,
1555 tr(
"Loading Connections" ),
1556 tr(
"Connection with name '%1' already exists. Overwrite?" )
1557 .arg( connectionName ),
1558 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1562 case QMessageBox::Cancel:
1564 case QMessageBox::No:
1565 child = child.nextSiblingElement();
1567 case QMessageBox::Yes:
1570 case QMessageBox::YesToAll:
1574 case QMessageBox::NoToAll:
1581 if ( keys.contains( connectionName ) )
1585 child = child.nextSiblingElement();
1591 keys << connectionName;
1594 QgsVectorTileProviderConnection::settingsUrl->setValue( child.attribute( QStringLiteral(
"url" ) ), connectionName );
1595 QgsVectorTileProviderConnection::settingsZmin->setValue( child.attribute( QStringLiteral(
"zmin" ) ).toInt(), connectionName );
1596 QgsVectorTileProviderConnection::settingsZmax->setValue( child.attribute( QStringLiteral(
"zmax" ) ).toInt(), connectionName );
1597 QgsVectorTileProviderConnection::settingsServiceType->setValue( child.attribute( QStringLiteral(
"serviceType" ) ), connectionName );
1598 QgsVectorTileProviderConnection::settingsAuthcfg->setValue( child.attribute( QStringLiteral(
"authcfg" ) ), connectionName );
1599 QgsVectorTileProviderConnection::settingsUsername->setValue( child.attribute( QStringLiteral(
"username" ) ), connectionName );
1600 QgsVectorTileProviderConnection::settingsPassword->setValue( child.attribute( QStringLiteral(
"password" ) ), connectionName );
1601 QgsVectorTileProviderConnection::settingsStyleUrl->setValue( child.attribute( QStringLiteral(
"styleUrl" ) ), connectionName );
1604 QgsVectorTileProviderConnection::settingsHeaders->setValue( httpHeader.headers(), connectionName );
1606 child = child.nextSiblingElement();
1610void QgsManageConnectionsDialog::loadTiledSceneConnections(
const QDomDocument &doc,
const QStringList &items )
1612 const QDomElement root = doc.documentElement();
1613 if ( root.tagName() != QLatin1String(
"qgsTiledSceneConnections" ) )
1615 QMessageBox::information(
this, tr(
"Loading Connections" ),
1616 tr(
"The file is not a tiled scene connections exchange file." ) );
1620 QString connectionName;
1622 settings.
beginGroup( QStringLiteral(
"/qgis/connections-tiled-scene" ) );
1625 QDomElement child = root.firstChildElement();
1627 bool overwrite =
true;
1629 while ( !child.isNull() )
1631 connectionName = child.attribute( QStringLiteral(
"name" ) );
1632 if ( !items.contains( connectionName ) )
1634 child = child.nextSiblingElement();
1639 if ( keys.contains( connectionName ) && prompt )
1641 const int res = QMessageBox::warning(
this,
1642 tr(
"Loading Connections" ),
1643 tr(
"Connection with name '%1' already exists. Overwrite?" )
1644 .arg( connectionName ),
1645 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1649 case QMessageBox::Cancel:
1651 case QMessageBox::No:
1652 child = child.nextSiblingElement();
1654 case QMessageBox::Yes:
1657 case QMessageBox::YesToAll:
1661 case QMessageBox::NoToAll:
1668 if ( keys.contains( connectionName ) )
1672 child = child.nextSiblingElement();
1678 keys << connectionName;
1681 QgsTiledSceneProviderConnection::settingsProvider->setValue( child.attribute( QStringLiteral(
"provider" ) ), connectionName );
1682 QgsTiledSceneProviderConnection::settingsUrl->setValue( child.attribute( QStringLiteral(
"url" ) ), connectionName );
1683 QgsTiledSceneProviderConnection::settingsAuthcfg->setValue( child.attribute( QStringLiteral(
"authcfg" ) ), connectionName );
1684 QgsTiledSceneProviderConnection::settingsUsername->setValue( child.attribute( QStringLiteral(
"username" ) ), connectionName );
1685 QgsTiledSceneProviderConnection::settingsPassword->setValue( child.attribute( QStringLiteral(
"password" ) ), connectionName );
1688 QgsTiledSceneProviderConnection::settingsHeaders->setValue( httpHeader.headers(), connectionName );
1690 child = child.nextSiblingElement();
1696 listConnections->selectAll();
1697 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
1702 listConnections->clearSelection();
1703 buttonBox->button( QDialogButtonBox::Ok )->setEnabled(
false );
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryVariantMap * settingsHeaders
static QgsSettingsTreeNamedListNode * sTreeConnectionArcgis
static const QgsSettingsEntryString * settingsAuthcfg
QgsManageConnectionsDialog(QWidget *parent=nullptr, Mode mode=Export, Type type=WMS, const QString &fileName=QString())
Constructor for QgsManageConnectionsDialog.
@ TiledScene
Tiled scene connection (since QGIS 3.34)
static const QgsSettingsEntryBool * settingsPagingEnabled
static const QgsSettingsEntryString * settingsMaxNumFeatures
static QgsSettingsTreeNamedListNode * sTreeOwsConnections
static const QgsSettingsEntryBool * settingsIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > * settingsDpiMode
static const QgsSettingsEntryBool * settingsIgnoreAxisOrientation
static const QgsSettingsEntryBool * settingsInvertAxisOrientation
static const QgsSettingsEntryString * settingsVersion
static const QgsSettingsEntryString * settingsPagesize
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryBool * settingsSmoothPixmapTransform
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryBool * settingsIgnoreGetMapURI
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
bool setValue(const T &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
QStringList items(const QStringList &parentsNamedItems=QStringList()) const
Returns the list of items.
This class is a composition of two QSettings instances:
QStringList childGroups(Qgis::SettingsOrigin origin=Qgis::SettingsOrigin::Any) const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static QgsSettingsTreeNamedListNode * sTreeXyzConnections
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryDouble * settingsTilePixelRatio
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsAuthcfg
static const QgsSettingsEntryInteger * settingsZmin
static const QgsSettingsEntryInteger * settingsZmax
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryVariantMap * settingsHeaders