QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsmanageconnectionsdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmanageconnectionsdialog.cpp
3  ---------------------
4  begin : Dec 2009
5  copyright : (C) 2009 by Alexander Bruy
6  email : alexander dot bruy at gmail dot com
7 
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include <QCloseEvent>
18 #include <QFileDialog>
19 #include <QMessageBox>
20 #include <QPushButton>
21 #include <QTextStream>
22 
23 #include "qgssettings.h"
25 
26 
27 QgsManageConnectionsDialog::QgsManageConnectionsDialog( QWidget *parent, Mode mode, Type type, const QString &fileName )
28  : QDialog( parent )
29  , mFileName( fileName )
30  , mDialogMode( mode )
31  , mConnectionType( type )
32 {
33  setupUi( this );
34 
35  // additional buttons
36  QPushButton *pb = nullptr;
37  pb = new QPushButton( tr( "Select all" ) );
38  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
39  connect( pb, &QAbstractButton::clicked, this, &QgsManageConnectionsDialog::selectAll );
40 
41  pb = new QPushButton( tr( "Clear selection" ) );
42  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
43  connect( pb, &QAbstractButton::clicked, this, &QgsManageConnectionsDialog::clearSelection );
44 
45  if ( mDialogMode == Import )
46  {
47  label->setText( tr( "Select connections to import" ) );
48  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Import" ) );
49  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
50  }
51  else
52  {
53  //label->setText( tr( "Select connections to export" ) );
54  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Export" ) );
55  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
56  }
57 
58  if ( !populateConnections() )
59  {
60  QApplication::postEvent( this, new QCloseEvent() );
61  }
62 
63  // use OK button for starting import and export operations
64  disconnect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
65  connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsManageConnectionsDialog::doExportImport );
66 
67  connect( listConnections, &QListWidget::itemSelectionChanged, this, &QgsManageConnectionsDialog::selectionChanged );
68 }
69 
71 {
72  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
73 }
74 
76 {
77  QList<QListWidgetItem *> selection = listConnections->selectedItems();
78  if ( selection.isEmpty() )
79  {
80  QMessageBox::warning( this, tr( "Export/Import Error" ),
81  tr( "You should select at least one connection from list." ) );
82  return;
83  }
84 
85  QStringList items;
86  items.reserve( selection.size() );
87  for ( int i = 0; i < selection.size(); ++i )
88  {
89  items.append( selection.at( i )->text() );
90  }
91 
92  if ( mDialogMode == Export )
93  {
94  QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Connections" ), QDir::homePath(),
95  tr( "XML files (*.xml *.XML)" ) );
96  if ( fileName.isEmpty() )
97  {
98  return;
99  }
100 
101  // ensure the user never omitted the extension from the file name
102  if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
103  {
104  fileName += QLatin1String( ".xml" );
105  }
106 
107  mFileName = fileName;
108 
109  QDomDocument doc;
110  switch ( mConnectionType )
111  {
112  case WMS:
113  doc = saveOWSConnections( items, QStringLiteral( "WMS" ) );
114  break;
115  case WFS:
116  doc = saveWfsConnections( items );
117  break;
118  case PostGIS:
119  doc = savePgConnections( items );
120  break;
121  case MSSQL:
122  doc = saveMssqlConnections( items );
123  break;
124  case WCS:
125  doc = saveOWSConnections( items, QStringLiteral( "WCS" ) );
126  break;
127  case Oracle:
128  doc = saveOracleConnections( items );
129  break;
130  case DB2:
131  doc = saveDb2Connections( items );
132  break;
133  case GeoNode:
134  doc = saveGeonodeConnections( items );
135  break;
136  case XyzTiles:
137  doc = saveXyzTilesConnections( items );
138  break;
139  case ArcgisMapServer:
140  doc = saveArcgisConnections( items, QStringLiteral( "ARCGISMAPSERVER" ) );
141  break;
142  case ArcgisFeatureServer:
143  doc = saveArcgisConnections( items, QStringLiteral( "ARCGISFEATURESERVER" ) );
144  break;
145  case VectorTile:
146  doc = saveVectorTileConnections( items );
147  break;
148  }
149 
150  QFile file( mFileName );
151  if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
152  {
153  QMessageBox::warning( this, tr( "Saving Connections" ),
154  tr( "Cannot write file %1:\n%2." )
155  .arg( mFileName,
156  file.errorString() ) );
157  return;
158  }
159 
160  QTextStream out( &file );
161  doc.save( out, 4 );
162  }
163  else // import connections
164  {
165  QFile file( mFileName );
166  if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
167  {
168  QMessageBox::warning( this, tr( "Loading Connections" ),
169  tr( "Cannot read file %1:\n%2." )
170  .arg( mFileName,
171  file.errorString() ) );
172  return;
173  }
174 
175  QDomDocument doc;
176  QString errorStr;
177  int errorLine;
178  int errorColumn;
179 
180  if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
181  {
182  QMessageBox::warning( this, tr( "Loading Connections" ),
183  tr( "Parse error at line %1, column %2:\n%3" )
184  .arg( errorLine )
185  .arg( errorColumn )
186  .arg( errorStr ) );
187  return;
188  }
189 
190  switch ( mConnectionType )
191  {
192  case WMS:
193  loadOWSConnections( doc, items, QStringLiteral( "WMS" ) );
194  break;
195  case WFS:
196  loadWfsConnections( doc, items );
197  break;
198  case PostGIS:
199  loadPgConnections( doc, items );
200  break;
201  case MSSQL:
202  loadMssqlConnections( doc, items );
203  break;
204  case WCS:
205  loadOWSConnections( doc, items, QStringLiteral( "WCS" ) );
206  break;
207  case Oracle:
208  loadOracleConnections( doc, items );
209  break;
210  case DB2:
211  loadDb2Connections( doc, items );
212  break;
213  case GeoNode:
214  loadGeonodeConnections( doc, items );
215  break;
216  case XyzTiles:
217  loadXyzTilesConnections( doc, items );
218  break;
219  case ArcgisMapServer:
220  loadArcgisConnections( doc, items, QStringLiteral( "ARCGISMAPSERVER" ) );
221  break;
222  case ArcgisFeatureServer:
223  loadArcgisConnections( doc, items, QStringLiteral( "ARCGISFEATURESERVER" ) );
224  break;
225  case VectorTile:
226  loadVectorTileConnections( doc, items );
227  break;
228  }
229  // clear connections list and close window
230  listConnections->clear();
231  accept();
232  }
233 
234  mFileName.clear();
235 }
236 
237 bool QgsManageConnectionsDialog::populateConnections()
238 {
239  // Export mode. Populate connections list from settings
240  if ( mDialogMode == Export )
241  {
242  QgsSettings settings;
243  switch ( mConnectionType )
244  {
245  case WMS:
246  settings.beginGroup( QStringLiteral( "/qgis/connections-wms" ) );
247  break;
248  case WFS:
249  settings.beginGroup( QStringLiteral( "/qgis/connections-wfs" ) );
250  break;
251  case WCS:
252  settings.beginGroup( QStringLiteral( "/qgis/connections-wcs" ) );
253  break;
254  case PostGIS:
255  settings.beginGroup( QStringLiteral( "/PostgreSQL/connections" ) );
256  break;
257  case MSSQL:
258  settings.beginGroup( QStringLiteral( "/MSSQL/connections" ) );
259  break;
260  case Oracle:
261  settings.beginGroup( QStringLiteral( "/Oracle/connections" ) );
262  break;
263  case DB2:
264  settings.beginGroup( QStringLiteral( "/DB2/connections" ) );
265  break;
266  case GeoNode:
267  settings.beginGroup( QStringLiteral( "/qgis/connections-geonode" ) );
268  break;
269  case XyzTiles:
270  settings.beginGroup( QStringLiteral( "/qgis/connections-xyz" ) );
271  break;
272  case ArcgisMapServer:
273  settings.beginGroup( QStringLiteral( "/qgis/connections-arcgismapserver" ) );
274  break;
275  case ArcgisFeatureServer:
276  settings.beginGroup( QStringLiteral( "/qgis/connections-arcgisfeatureserver" ) );
277  break;
278  case VectorTile:
279  settings.beginGroup( QStringLiteral( "/qgis/connections-vector-tile" ) );
280  break;
281  }
282  QStringList keys = settings.childGroups();
283  QStringList::Iterator it = keys.begin();
284  while ( it != keys.end() )
285  {
286  QListWidgetItem *item = new QListWidgetItem();
287  item->setText( *it );
288  listConnections->addItem( item );
289  ++it;
290  }
291  settings.endGroup();
292  }
293  // Import mode. Populate connections list from file
294  else
295  {
296  QFile file( mFileName );
297  if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
298  {
299  QMessageBox::warning( this, tr( "Loading Connections" ),
300  tr( "Cannot read file %1:\n%2." )
301  .arg( mFileName,
302  file.errorString() ) );
303  return false;
304  }
305 
306  QDomDocument doc;
307  QString errorStr;
308  int errorLine;
309  int errorColumn;
310 
311  if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
312  {
313  QMessageBox::warning( this, tr( "Loading Connections" ),
314  tr( "Parse error at line %1, column %2:\n%3" )
315  .arg( errorLine )
316  .arg( errorColumn )
317  .arg( errorStr ) );
318  return false;
319  }
320 
321  QDomElement root = doc.documentElement();
322  switch ( mConnectionType )
323  {
324  case WMS:
325  if ( root.tagName() != QLatin1String( "qgsWMSConnections" ) )
326  {
327  QMessageBox::information( this, tr( "Loading Connections" ),
328  tr( "The file is not a WMS connections exchange file." ) );
329  return false;
330  }
331  break;
332 
333  case WFS:
334  if ( root.tagName() != QLatin1String( "qgsWFSConnections" ) )
335  {
336  QMessageBox::information( this, tr( "Loading Connections" ),
337  tr( "The file is not a WFS connections exchange file." ) );
338  return false;
339  }
340  break;
341 
342  case WCS:
343  if ( root.tagName() != QLatin1String( "qgsWCSConnections" ) )
344  {
345  QMessageBox::information( this, tr( "Loading Connections" ),
346  tr( "The file is not a WCS connections exchange file." ) );
347  return false;
348  }
349  break;
350 
351  case PostGIS:
352  if ( root.tagName() != QLatin1String( "qgsPgConnections" ) )
353  {
354  QMessageBox::information( this, tr( "Loading Connections" ),
355  tr( "The file is not a PostGIS connections exchange file." ) );
356  return false;
357  }
358  break;
359 
360  case MSSQL:
361  if ( root.tagName() != QLatin1String( "qgsMssqlConnections" ) )
362  {
363  QMessageBox::information( this, tr( "Loading Connections" ),
364  tr( "The file is not a MSSQL connections exchange file." ) );
365  return false;
366  }
367  break;
368  case Oracle:
369  if ( root.tagName() != QLatin1String( "qgsOracleConnections" ) )
370  {
371  QMessageBox::information( this, tr( "Loading Connections" ),
372  tr( "The file is not an Oracle connections exchange file." ) );
373  return false;
374  }
375  break;
376  case DB2:
377  if ( root.tagName() != QLatin1String( "qgsDb2Connections" ) )
378  {
379  QMessageBox::information( this, tr( "Loading Connections" ),
380  tr( "The file is not a DB2 connections exchange file." ) );
381  return false;
382  }
383  break;
384  case GeoNode:
385  if ( root.tagName() != QLatin1String( "qgsGeoNodeConnections" ) )
386  {
387  QMessageBox::information( this, tr( "Loading Connections" ),
388  tr( "The file is not a GeoNode connections exchange file." ) );
389  return false;
390  }
391  break;
392  case XyzTiles:
393  if ( root.tagName() != QLatin1String( "qgsXYZTilesConnections" ) )
394  {
395  QMessageBox::information( this, tr( "Loading Connections" ),
396  tr( "The file is not a XYZ Tiles connections exchange file." ) );
397  return false;
398  }
399  break;
400  case ArcgisMapServer:
401  if ( root.tagName() != QLatin1String( "qgsARCGISMAPSERVERConnections" ) )
402  {
403  QMessageBox::information( this, tr( "Loading Connections" ),
404  tr( "The file is not a ArcGIS Map Service connections exchange file." ) );
405  return false;
406  }
407  break;
408  case ArcgisFeatureServer:
409  if ( root.tagName() != QLatin1String( "qgsARCGISFEATURESERVERConnections" ) )
410  {
411  QMessageBox::information( this, tr( "Loading Connections" ),
412  tr( "The file is not a ArcGIS Feature Service connections exchange file." ) );
413  return false;
414  }
415  break;
416  case VectorTile:
417  if ( root.tagName() != QLatin1String( "qgsVectorTileConnections" ) )
418  {
419  QMessageBox::information( this, tr( "Loading Connections" ),
420  tr( "The file is not a Vector Tile connections exchange file." ) );
421  return false;
422  }
423  break;
424  }
425 
426  QDomElement child = root.firstChildElement();
427  while ( !child.isNull() )
428  {
429  QListWidgetItem *item = new QListWidgetItem();
430  item->setText( child.attribute( QStringLiteral( "name" ) ) );
431  listConnections->addItem( item );
432  child = child.nextSiblingElement();
433  }
434  }
435  return true;
436 }
437 
438 QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &connections, const QString &service )
439 {
440  QDomDocument doc( QStringLiteral( "connections" ) );
441  QDomElement root = doc.createElement( "qgs" + service.toUpper() + "Connections" );
442  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
443  doc.appendChild( root );
444 
445  QgsSettings settings;
446  QString path;
447  for ( int i = 0; i < connections.count(); ++i )
448  {
449  path = "/qgis/connections-" + service.toLower() + '/';
450  QDomElement el = doc.createElement( service.toLower() );
451  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
452  el.setAttribute( QStringLiteral( "url" ), settings.value( path + connections[ i ] + "/url" ).toString() );
453 
454  if ( service == QLatin1String( "WMS" ) )
455  {
456  el.setAttribute( QStringLiteral( "ignoreGetMapURI" ), settings.value( path + connections[i] + "/ignoreGetMapURI", false ).toBool() ? "true" : "false" );
457  el.setAttribute( QStringLiteral( "ignoreGetFeatureInfoURI" ), settings.value( path + connections[i] + "/ignoreGetFeatureInfoURI", false ).toBool() ? "true" : "false" );
458  el.setAttribute( QStringLiteral( "ignoreAxisOrientation" ), settings.value( path + connections[i] + "/ignoreAxisOrientation", false ).toBool() ? "true" : "false" );
459  el.setAttribute( QStringLiteral( "invertAxisOrientation" ), settings.value( path + connections[i] + "/invertAxisOrientation", false ).toBool() ? "true" : "false" );
460  el.setAttribute( QStringLiteral( "referer" ), settings.value( path + connections[ i ] + "/referer" ).toString() );
461  el.setAttribute( QStringLiteral( "smoothPixmapTransform" ), settings.value( path + connections[i] + "/smoothPixmapTransform", false ).toBool() ? "true" : "false" );
462  el.setAttribute( QStringLiteral( "dpiMode" ), settings.value( path + connections[i] + "/dpiMode", "7" ).toInt() );
463  }
464 
465  path = "/qgis/" + service.toUpper() + '/';
466  el.setAttribute( QStringLiteral( "username" ), settings.value( path + connections[ i ] + "/username" ).toString() );
467  el.setAttribute( QStringLiteral( "password" ), settings.value( path + connections[ i ] + "/password" ).toString() );
468  root.appendChild( el );
469  }
470 
471  return doc;
472 }
473 
474 QDomDocument QgsManageConnectionsDialog::saveWfsConnections( const QStringList &connections )
475 {
476  QDomDocument doc( QStringLiteral( "connections" ) );
477  QDomElement root = doc.createElement( QStringLiteral( "qgsWFSConnections" ) );
478  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.1" ) );
479  doc.appendChild( root );
480 
481  QgsSettings settings;
482  QString path;
483  for ( int i = 0; i < connections.count(); ++i )
484  {
485  path = QStringLiteral( "/qgis/connections-wfs/" );
486  QDomElement el = doc.createElement( QStringLiteral( "wfs" ) );
487  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
488  el.setAttribute( QStringLiteral( "url" ), settings.value( path + connections[ i ] + "/url" ).toString() );
489 
490  el.setAttribute( QStringLiteral( "version" ), settings.value( path + connections[ i ] + "/version" ).toString() );
491  el.setAttribute( QStringLiteral( "maxnumfeatures" ), settings.value( path + connections[ i ] + "/maxnumfeatures" ).toString() );
492  el.setAttribute( QStringLiteral( "pagesize" ), settings.value( path + connections[ i ] + "/pagesize" ).toString() );
493  el.setAttribute( QStringLiteral( "pagingenabled" ), settings.value( path + connections[ i ] + "/pagingenabled", false ).toString() );
494  el.setAttribute( QStringLiteral( "ignoreAxisOrientation" ), settings.value( path + connections[ i ] + "/ignoreAxisOrientation", false ).toString() );
495  el.setAttribute( QStringLiteral( "invertAxisOrientation" ), settings.value( path + connections[ i ] + "/invertAxisOrientation", false ).toString() );
496 
497  path = QStringLiteral( "/qgis/WFS/" );
498  el.setAttribute( QStringLiteral( "username" ), settings.value( path + connections[ i ] + "/username" ).toString() );
499  el.setAttribute( QStringLiteral( "password" ), settings.value( path + connections[ i ] + "/password" ).toString() );
500  root.appendChild( el );
501  }
502 
503  return doc;
504 }
505 
506 QDomDocument QgsManageConnectionsDialog::savePgConnections( const QStringList &connections )
507 {
508  QDomDocument doc( QStringLiteral( "connections" ) );
509  QDomElement root = doc.createElement( QStringLiteral( "qgsPgConnections" ) );
510  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
511  doc.appendChild( root );
512 
513  QgsSettings settings;
514  QString path;
515  for ( int i = 0; i < connections.count(); ++i )
516  {
517  path = "/PostgreSQL/connections/" + connections[ i ];
518  QDomElement el = doc.createElement( QStringLiteral( "postgis" ) );
519  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
520  el.setAttribute( QStringLiteral( "host" ), settings.value( path + "/host" ).toString() );
521  el.setAttribute( QStringLiteral( "port" ), settings.value( path + "/port" ).toString() );
522  el.setAttribute( QStringLiteral( "database" ), settings.value( path + "/database" ).toString() );
523  el.setAttribute( QStringLiteral( "service" ), settings.value( path + "/service" ).toString() );
524  el.setAttribute( QStringLiteral( "sslmode" ), settings.value( path + "/sslmode", "1" ).toString() );
525  el.setAttribute( QStringLiteral( "estimatedMetadata" ), settings.value( path + "/estimatedMetadata", "0" ).toString() );
526 
527  el.setAttribute( QStringLiteral( "saveUsername" ), settings.value( path + "/saveUsername", "false" ).toString() );
528 
529  if ( settings.value( path + "/saveUsername", "false" ).toString() == QLatin1String( "true" ) )
530  {
531  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
532  }
533 
534  el.setAttribute( QStringLiteral( "savePassword" ), settings.value( path + "/savePassword", "false" ).toString() );
535 
536  if ( settings.value( path + "/savePassword", "false" ).toString() == QLatin1String( "true" ) )
537  {
538  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
539  }
540 
541  root.appendChild( el );
542  }
543 
544  return doc;
545 }
546 
547 QDomDocument QgsManageConnectionsDialog::saveMssqlConnections( const QStringList &connections )
548 {
549  QDomDocument doc( QStringLiteral( "connections" ) );
550  QDomElement root = doc.createElement( QStringLiteral( "qgsMssqlConnections" ) );
551  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
552  doc.appendChild( root );
553 
554  QgsSettings settings;
555  QString path;
556  for ( int i = 0; i < connections.count(); ++i )
557  {
558  path = "/MSSQL/connections/" + connections[ i ];
559  QDomElement el = doc.createElement( QStringLiteral( "mssql" ) );
560  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
561  el.setAttribute( QStringLiteral( "host" ), settings.value( path + "/host" ).toString() );
562  el.setAttribute( QStringLiteral( "port" ), settings.value( path + "/port" ).toString() );
563  el.setAttribute( QStringLiteral( "database" ), settings.value( path + "/database" ).toString() );
564  el.setAttribute( QStringLiteral( "service" ), settings.value( path + "/service" ).toString() );
565  el.setAttribute( QStringLiteral( "sslmode" ), settings.value( path + "/sslmode", "1" ).toString() );
566  el.setAttribute( QStringLiteral( "estimatedMetadata" ), settings.value( path + "/estimatedMetadata", "0" ).toString() );
567 
568  el.setAttribute( QStringLiteral( "saveUsername" ), settings.value( path + "/saveUsername", "false" ).toString() );
569 
570  if ( settings.value( path + "/saveUsername", "false" ).toString() == QLatin1String( "true" ) )
571  {
572  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
573  }
574 
575  el.setAttribute( QStringLiteral( "savePassword" ), settings.value( path + "/savePassword", "false" ).toString() );
576 
577  if ( settings.value( path + "/savePassword", "false" ).toString() == QLatin1String( "true" ) )
578  {
579  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
580  }
581 
582  root.appendChild( el );
583  }
584 
585  return doc;
586 }
587 
588 QDomDocument QgsManageConnectionsDialog::saveOracleConnections( const QStringList &connections )
589 {
590  QDomDocument doc( QStringLiteral( "connections" ) );
591  QDomElement root = doc.createElement( QStringLiteral( "qgsOracleConnections" ) );
592  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
593  doc.appendChild( root );
594 
595  QgsSettings settings;
596  QString path;
597  for ( int i = 0; i < connections.count(); ++i )
598  {
599  path = "/Oracle/connections/" + connections[ i ];
600  QDomElement el = doc.createElement( QStringLiteral( "oracle" ) );
601  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
602  el.setAttribute( QStringLiteral( "host" ), settings.value( path + "/host" ).toString() );
603  el.setAttribute( QStringLiteral( "port" ), settings.value( path + "/port" ).toString() );
604  el.setAttribute( QStringLiteral( "database" ), settings.value( path + "/database" ).toString() );
605  el.setAttribute( QStringLiteral( "dboptions" ), settings.value( path + "/dboptions" ).toString() );
606  el.setAttribute( QStringLiteral( "dbworkspace" ), settings.value( path + "/dbworkspace" ).toString() );
607  el.setAttribute( QStringLiteral( "schema" ), settings.value( path + "/schema" ).toString() );
608  el.setAttribute( QStringLiteral( "estimatedMetadata" ), settings.value( path + "/estimatedMetadata", "0" ).toString() );
609  el.setAttribute( QStringLiteral( "userTablesOnly" ), settings.value( path + "/userTablesOnly", "0" ).toString() );
610  el.setAttribute( QStringLiteral( "geometryColumnsOnly" ), settings.value( path + "/geometryColumnsOnly", "0" ).toString() );
611  el.setAttribute( QStringLiteral( "allowGeometrylessTables" ), settings.value( path + "/allowGeometrylessTables", "0" ).toString() );
612 
613  el.setAttribute( QStringLiteral( "saveUsername" ), settings.value( path + "/saveUsername", "false" ).toString() );
614 
615  if ( settings.value( path + "/saveUsername", "false" ).toString() == QLatin1String( "true" ) )
616  {
617  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
618  }
619 
620  el.setAttribute( QStringLiteral( "savePassword" ), settings.value( path + "/savePassword", "false" ).toString() );
621 
622  if ( settings.value( path + "/savePassword", "false" ).toString() == QLatin1String( "true" ) )
623  {
624  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
625  }
626 
627  root.appendChild( el );
628  }
629 
630  return doc;
631 }
632 
633 QDomDocument QgsManageConnectionsDialog::saveDb2Connections( const QStringList &connections )
634 {
635  QDomDocument doc( QStringLiteral( "connections" ) );
636  QDomElement root = doc.createElement( QStringLiteral( "qgsDb2Connections" ) );
637  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
638  doc.appendChild( root );
639 
640  QgsSettings settings;
641  QString path;
642  for ( int i = 0; i < connections.count(); ++i )
643  {
644  path = "/DB2/connections/" + connections[ i ];
645  QDomElement el = doc.createElement( QStringLiteral( "db2" ) );
646  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
647  el.setAttribute( QStringLiteral( "host" ), settings.value( path + "/host" ).toString() );
648  el.setAttribute( QStringLiteral( "port" ), settings.value( path + "/port" ).toString() );
649  el.setAttribute( QStringLiteral( "database" ), settings.value( path + "/database" ).toString() );
650  el.setAttribute( QStringLiteral( "service" ), settings.value( path + "/service" ).toString() );
651  el.setAttribute( QStringLiteral( "sslmode" ), settings.value( path + "/sslmode", "1" ).toString() );
652  el.setAttribute( QStringLiteral( "estimatedMetadata" ), settings.value( path + "/estimatedMetadata", "0" ).toString() );
653 
654  el.setAttribute( QStringLiteral( "saveUsername" ), settings.value( path + "/saveUsername", "false" ).toString() );
655 
656  if ( settings.value( path + "/saveUsername", "false" ).toString() == QLatin1String( "true" ) )
657  {
658  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
659  }
660 
661  el.setAttribute( QStringLiteral( "savePassword" ), settings.value( path + "/savePassword", "false" ).toString() );
662 
663  if ( settings.value( path + "/savePassword", "false" ).toString() == QLatin1String( "true" ) )
664  {
665  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
666  }
667 
668  root.appendChild( el );
669  }
670 
671  return doc;
672 }
673 
674 QDomDocument QgsManageConnectionsDialog::saveGeonodeConnections( const QStringList &connections )
675 {
676  QDomDocument doc( QStringLiteral( "connections" ) );
677  QDomElement root = doc.createElement( QStringLiteral( "qgsGeoNodeConnections" ) );
678  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
679  doc.appendChild( root );
680 
681  QgsSettings settings;
682  QString path;
683  for ( int i = 0; i < connections.count(); ++i )
684  {
685  path = QStringLiteral( "/qgis/connections-geonode/" );
686  QDomElement el = doc.createElement( QStringLiteral( "geonode" ) );
687  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
688  el.setAttribute( QStringLiteral( "url" ), settings.value( path + connections[ i ] + "/url" ).toString() );
689 
690  path = QStringLiteral( "/qgis/GeoNode/" );
691  el.setAttribute( QStringLiteral( "username" ), settings.value( path + connections[ i ] + "/username" ).toString() );
692  el.setAttribute( QStringLiteral( "password" ), settings.value( path + connections[ i ] + "/password" ).toString() );
693  root.appendChild( el );
694  }
695 
696  return doc;
697 }
698 
699 QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( const QStringList &connections )
700 {
701  QDomDocument doc( QStringLiteral( "connections" ) );
702  QDomElement root = doc.createElement( QStringLiteral( "qgsXYZTilesConnections" ) );
703  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
704  doc.appendChild( root );
705 
706  QgsSettings settings;
707  QString path;
708  for ( int i = 0; i < connections.count(); ++i )
709  {
710  path = "qgis/connections-xyz/" + connections[ i ];
711  QDomElement el = doc.createElement( QStringLiteral( "xyztiles" ) );
712 
713  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
714  el.setAttribute( QStringLiteral( "url" ), settings.value( path + "/url" ).toString() );
715  el.setAttribute( QStringLiteral( "zmin" ), settings.value( path + "/zmin", -1 ).toInt() );
716  el.setAttribute( QStringLiteral( "zmax" ), settings.value( path + "/zmax", -1 ).toInt() );
717  el.setAttribute( QStringLiteral( "authcfg" ), settings.value( path + "/authcfg" ).toString() );
718  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
719  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
720  el.setAttribute( QStringLiteral( "referer" ), settings.value( path + "/referer" ).toString() );
721  el.setAttribute( QStringLiteral( "tilePixelRatio" ), settings.value( path + "/tilePixelRatio", 0 ).toDouble() );
722 
723  root.appendChild( el );
724  }
725 
726  return doc;
727 }
728 
729 QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringList &connections, const QString &service )
730 {
731  QDomDocument doc( QStringLiteral( "connections" ) );
732  QDomElement root = doc.createElement( "qgs" + service.toUpper() + "Connections" );
733  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
734  doc.appendChild( root );
735 
736  QgsSettings settings;
737  QString path;
738  for ( int i = 0; i < connections.count(); ++i )
739  {
740  path = "/qgis/connections-" + service.toLower() + '/';
741  QDomElement el = doc.createElement( service.toLower() );
742  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
743  el.setAttribute( QStringLiteral( "url" ), settings.value( path + connections[ i ] + "/url" ).toString() );
744  el.setAttribute( QStringLiteral( "referer" ), settings.value( path + connections[ i ] + "/referer" ).toString() );
745 
746  path = "/qgis/" + service.toUpper() + '/';
747  el.setAttribute( QStringLiteral( "username" ), settings.value( path + connections[ i ] + "/username" ).toString() );
748  el.setAttribute( QStringLiteral( "password" ), settings.value( path + connections[ i ] + "/password" ).toString() );
749  el.setAttribute( QStringLiteral( "authcfg" ), settings.value( path + connections[ i ] + "/authcfg" ).toString() );
750  root.appendChild( el );
751  }
752 
753  return doc;
754 }
755 
756 QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( const QStringList &connections )
757 {
758  QDomDocument doc( QStringLiteral( "connections" ) );
759  QDomElement root = doc.createElement( QStringLiteral( "qgsVectorTileConnections" ) );
760  root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
761  doc.appendChild( root );
762 
763  QgsSettings settings;
764  QString path;
765  for ( int i = 0; i < connections.count(); ++i )
766  {
767  path = "qgis/connections-vector-tile/" + connections[ i ];
768  QDomElement el = doc.createElement( QStringLiteral( "vectortile" ) );
769 
770  el.setAttribute( QStringLiteral( "name" ), connections[ i ] );
771  el.setAttribute( QStringLiteral( "url" ), settings.value( path + "/url" ).toString() );
772  el.setAttribute( QStringLiteral( "zmin" ), settings.value( path + "/zmin", -1 ).toInt() );
773  el.setAttribute( QStringLiteral( "zmax" ), settings.value( path + "/zmax", -1 ).toInt() );
774  el.setAttribute( QStringLiteral( "serviceType" ), settings.value( path + "/serviceType", -1 ).toInt() );
775  el.setAttribute( QStringLiteral( "authcfg" ), settings.value( path + "/authcfg" ).toString() );
776  el.setAttribute( QStringLiteral( "username" ), settings.value( path + "/username" ).toString() );
777  el.setAttribute( QStringLiteral( "password" ), settings.value( path + "/password" ).toString() );
778  el.setAttribute( QStringLiteral( "referer" ), settings.value( path + "/referer" ).toString() );
779  el.setAttribute( QStringLiteral( "styleUrl" ), settings.value( path + "/styleUrl" ).toString() );
780 
781  root.appendChild( el );
782  }
783 
784  return doc;
785 }
786 
787 void QgsManageConnectionsDialog::loadOWSConnections( const QDomDocument &doc, const QStringList &items, const QString &service )
788 {
789  QDomElement root = doc.documentElement();
790  if ( root.tagName() != "qgs" + service.toUpper() + "Connections" )
791  {
792  QMessageBox::information( this, tr( "Loading Connections" ),
793  tr( "The file is not a %1 connections exchange file." ).arg( service ) );
794  return;
795  }
796 
797  QString connectionName;
798  QgsSettings settings;
799  settings.beginGroup( "/qgis/connections-" + service.toLower() );
800  QStringList keys = settings.childGroups();
801  settings.endGroup();
802  QDomElement child = root.firstChildElement();
803  bool prompt = true;
804  bool overwrite = true;
805 
806  while ( !child.isNull() )
807  {
808  connectionName = child.attribute( QStringLiteral( "name" ) );
809  if ( !items.contains( connectionName ) )
810  {
811  child = child.nextSiblingElement();
812  continue;
813  }
814 
815  // check for duplicates
816  if ( keys.contains( connectionName ) && prompt )
817  {
818  int res = QMessageBox::warning( this,
819  tr( "Loading Connections" ),
820  tr( "Connection with name '%1' already exists. Overwrite?" )
821  .arg( connectionName ),
822  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
823 
824  switch ( res )
825  {
826  case QMessageBox::Cancel:
827  return;
828  case QMessageBox::No:
829  child = child.nextSiblingElement();
830  continue;
831  case QMessageBox::Yes:
832  overwrite = true;
833  break;
834  case QMessageBox::YesToAll:
835  prompt = false;
836  overwrite = true;
837  break;
838  case QMessageBox::NoToAll:
839  prompt = false;
840  overwrite = false;
841  break;
842  }
843  }
844 
845  if ( keys.contains( connectionName ) && !overwrite )
846  {
847  child = child.nextSiblingElement();
848  continue;
849  }
850 
851  // no dups detected or overwrite is allowed
852  settings.beginGroup( "/qgis/connections-" + service.toLower() );
853  settings.setValue( QString( '/' + connectionName + "/url" ), child.attribute( QStringLiteral( "url" ) ) );
854  settings.setValue( QString( '/' + connectionName + "/ignoreGetMapURI" ), child.attribute( QStringLiteral( "ignoreGetMapURI" ) ) == QLatin1String( "true" ) );
855  settings.setValue( QString( '/' + connectionName + "/ignoreGetFeatureInfoURI" ), child.attribute( QStringLiteral( "ignoreGetFeatureInfoURI" ) ) == QLatin1String( "true" ) );
856  settings.setValue( QString( '/' + connectionName + "/ignoreAxisOrientation" ), child.attribute( QStringLiteral( "ignoreAxisOrientation" ) ) == QLatin1String( "true" ) );
857  settings.setValue( QString( '/' + connectionName + "/invertAxisOrientation" ), child.attribute( QStringLiteral( "invertAxisOrientation" ) ) == QLatin1String( "true" ) );
858  settings.setValue( QString( '/' + connectionName + "/referer" ), child.attribute( QStringLiteral( "referer" ) ) );
859  settings.setValue( QString( '/' + connectionName + "/smoothPixmapTransform" ), child.attribute( QStringLiteral( "smoothPixmapTransform" ) ) == QLatin1String( "true" ) );
860  settings.setValue( QString( '/' + connectionName + "/dpiMode" ), child.attribute( QStringLiteral( "dpiMode" ), QStringLiteral( "7" ) ).toInt() );
861  settings.endGroup();
862 
863  if ( !child.attribute( QStringLiteral( "username" ) ).isEmpty() )
864  {
865  settings.beginGroup( "/qgis/" + service.toUpper() + '/' + connectionName );
866  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
867  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
868  settings.endGroup();
869  }
870  child = child.nextSiblingElement();
871  }
872 }
873 
874 void QgsManageConnectionsDialog::loadWfsConnections( const QDomDocument &doc, const QStringList &items )
875 {
876  QDomElement root = doc.documentElement();
877  if ( root.tagName() != QLatin1String( "qgsWFSConnections" ) )
878  {
879  QMessageBox::information( this, tr( "Loading Connections" ),
880  tr( "The file is not a WFS connections exchange file." ) );
881  return;
882  }
883 
884  QString connectionName;
885  QgsSettings settings;
886  settings.beginGroup( QStringLiteral( "/qgis/connections-wfs" ) );
887  QStringList keys = settings.childGroups();
888  settings.endGroup();
889  QDomElement child = root.firstChildElement();
890  bool prompt = true;
891  bool overwrite = true;
892 
893  while ( !child.isNull() )
894  {
895  connectionName = child.attribute( QStringLiteral( "name" ) );
896  if ( !items.contains( connectionName ) )
897  {
898  child = child.nextSiblingElement();
899  continue;
900  }
901 
902  // check for duplicates
903  if ( keys.contains( connectionName ) && prompt )
904  {
905  int res = QMessageBox::warning( this,
906  tr( "Loading Connections" ),
907  tr( "Connection with name '%1' already exists. Overwrite?" )
908  .arg( connectionName ),
909  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
910 
911  switch ( res )
912  {
913  case QMessageBox::Cancel:
914  return;
915  case QMessageBox::No:
916  child = child.nextSiblingElement();
917  continue;
918  case QMessageBox::Yes:
919  overwrite = true;
920  break;
921  case QMessageBox::YesToAll:
922  prompt = false;
923  overwrite = true;
924  break;
925  case QMessageBox::NoToAll:
926  prompt = false;
927  overwrite = false;
928  break;
929  }
930  }
931 
932  if ( keys.contains( connectionName ) && !overwrite )
933  {
934  child = child.nextSiblingElement();
935  continue;
936  }
937 
938  // no dups detected or overwrite is allowed
939  settings.beginGroup( QStringLiteral( "/qgis/connections-wfs" ) );
940  settings.setValue( QString( '/' + connectionName + "/url" ), child.attribute( QStringLiteral( "url" ) ) );
941 
942  settings.setValue( QString( '/' + connectionName + "/version" ), child.attribute( QStringLiteral( "version" ) ) );
943  settings.setValue( QString( '/' + connectionName + "/maxnumfeatures" ), child.attribute( QStringLiteral( "maxnumfeatures" ) ) );
944  settings.setValue( QString( '/' + connectionName + "/pagesize" ), child.attribute( QStringLiteral( "pagesize" ) ) );
945  settings.setValue( QString( '/' + connectionName + "/pagingenabled" ), child.attribute( QStringLiteral( "pagingenabled" ) ) );
946  settings.setValue( QString( '/' + connectionName + "/ignoreAxisOrientation" ), child.attribute( QStringLiteral( "ignoreAxisOrientation" ) ) );
947  settings.setValue( QString( '/' + connectionName + "/invertAxisOrientation" ), child.attribute( QStringLiteral( "invertAxisOrientation" ) ) );
948  settings.endGroup();
949 
950  if ( !child.attribute( QStringLiteral( "username" ) ).isEmpty() )
951  {
952  settings.beginGroup( "/qgis/WFS/" + connectionName );
953  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
954  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
955  settings.endGroup();
956  }
957  child = child.nextSiblingElement();
958  }
959 }
960 
961 void QgsManageConnectionsDialog::loadPgConnections( const QDomDocument &doc, const QStringList &items )
962 {
963  QDomElement root = doc.documentElement();
964  if ( root.tagName() != QLatin1String( "qgsPgConnections" ) )
965  {
966  QMessageBox::information( this,
967  tr( "Loading Connections" ),
968  tr( "The file is not a PostGIS connections exchange file." ) );
969  return;
970  }
971 
972  QString connectionName;
973  QgsSettings settings;
974  settings.beginGroup( QStringLiteral( "/PostgreSQL/connections" ) );
975  QStringList keys = settings.childGroups();
976  settings.endGroup();
977  QDomElement child = root.firstChildElement();
978  bool prompt = true;
979  bool overwrite = true;
980 
981  while ( !child.isNull() )
982  {
983  connectionName = child.attribute( QStringLiteral( "name" ) );
984  if ( !items.contains( connectionName ) )
985  {
986  child = child.nextSiblingElement();
987  continue;
988  }
989 
990  // check for duplicates
991  if ( keys.contains( connectionName ) && prompt )
992  {
993  int res = QMessageBox::warning( this,
994  tr( "Loading Connections" ),
995  tr( "Connection with name '%1' already exists. Overwrite?" )
996  .arg( connectionName ),
997  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
998  switch ( res )
999  {
1000  case QMessageBox::Cancel:
1001  return;
1002  case QMessageBox::No:
1003  child = child.nextSiblingElement();
1004  continue;
1005  case QMessageBox::Yes:
1006  overwrite = true;
1007  break;
1008  case QMessageBox::YesToAll:
1009  prompt = false;
1010  overwrite = true;
1011  break;
1012  case QMessageBox::NoToAll:
1013  prompt = false;
1014  overwrite = false;
1015  break;
1016  }
1017  }
1018 
1019  if ( keys.contains( connectionName ) && !overwrite )
1020  {
1021  child = child.nextSiblingElement();
1022  continue;
1023  }
1024 
1025  //no dups detected or overwrite is allowed
1026  settings.beginGroup( "/PostgreSQL/connections/" + connectionName );
1027 
1028  settings.setValue( QStringLiteral( "/host" ), child.attribute( QStringLiteral( "host" ) ) );
1029  settings.setValue( QStringLiteral( "/port" ), child.attribute( QStringLiteral( "port" ) ) );
1030  settings.setValue( QStringLiteral( "/database" ), child.attribute( QStringLiteral( "database" ) ) );
1031  if ( child.hasAttribute( QStringLiteral( "service" ) ) )
1032  {
1033  settings.setValue( QStringLiteral( "/service" ), child.attribute( QStringLiteral( "service" ) ) );
1034  }
1035  else
1036  {
1037  settings.setValue( QStringLiteral( "/service" ), "" );
1038  }
1039  settings.setValue( QStringLiteral( "/sslmode" ), child.attribute( QStringLiteral( "sslmode" ) ) );
1040  settings.setValue( QStringLiteral( "/estimatedMetadata" ), child.attribute( QStringLiteral( "estimatedMetadata" ) ) );
1041  settings.setValue( QStringLiteral( "/saveUsername" ), child.attribute( QStringLiteral( "saveUsername" ) ) );
1042  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1043  settings.setValue( QStringLiteral( "/savePassword" ), child.attribute( QStringLiteral( "savePassword" ) ) );
1044  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1045  settings.endGroup();
1046 
1047  child = child.nextSiblingElement();
1048  }
1049 }
1050 
1051 void QgsManageConnectionsDialog::loadMssqlConnections( const QDomDocument &doc, const QStringList &items )
1052 {
1053  QDomElement root = doc.documentElement();
1054  if ( root.tagName() != QLatin1String( "qgsMssqlConnections" ) )
1055  {
1056  QMessageBox::information( this,
1057  tr( "Loading Connections" ),
1058  tr( "The file is not a MSSQL connections exchange file." ) );
1059  return;
1060  }
1061 
1062  QString connectionName;
1063  QgsSettings settings;
1064  settings.beginGroup( QStringLiteral( "/MSSQL/connections" ) );
1065  QStringList keys = settings.childGroups();
1066  settings.endGroup();
1067  QDomElement child = root.firstChildElement();
1068  bool prompt = true;
1069  bool overwrite = true;
1070 
1071  while ( !child.isNull() )
1072  {
1073  connectionName = child.attribute( QStringLiteral( "name" ) );
1074  if ( !items.contains( connectionName ) )
1075  {
1076  child = child.nextSiblingElement();
1077  continue;
1078  }
1079 
1080  // check for duplicates
1081  if ( keys.contains( connectionName ) && prompt )
1082  {
1083  int res = QMessageBox::warning( this,
1084  tr( "Loading Connections" ),
1085  tr( "Connection with name '%1' already exists. Overwrite?" )
1086  .arg( connectionName ),
1087  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1088  switch ( res )
1089  {
1090  case QMessageBox::Cancel:
1091  return;
1092  case QMessageBox::No:
1093  child = child.nextSiblingElement();
1094  continue;
1095  case QMessageBox::Yes:
1096  overwrite = true;
1097  break;
1098  case QMessageBox::YesToAll:
1099  prompt = false;
1100  overwrite = true;
1101  break;
1102  case QMessageBox::NoToAll:
1103  prompt = false;
1104  overwrite = false;
1105  break;
1106  }
1107  }
1108 
1109  if ( keys.contains( connectionName ) && !overwrite )
1110  {
1111  child = child.nextSiblingElement();
1112  continue;
1113  }
1114 
1115  //no dups detected or overwrite is allowed
1116  settings.beginGroup( "/MSSQL/connections/" + connectionName );
1117 
1118  settings.setValue( QStringLiteral( "/host" ), child.attribute( QStringLiteral( "host" ) ) );
1119  settings.setValue( QStringLiteral( "/port" ), child.attribute( QStringLiteral( "port" ) ) );
1120  settings.setValue( QStringLiteral( "/database" ), child.attribute( QStringLiteral( "database" ) ) );
1121  if ( child.hasAttribute( QStringLiteral( "service" ) ) )
1122  {
1123  settings.setValue( QStringLiteral( "/service" ), child.attribute( QStringLiteral( "service" ) ) );
1124  }
1125  else
1126  {
1127  settings.setValue( QStringLiteral( "/service" ), "" );
1128  }
1129  settings.setValue( QStringLiteral( "/sslmode" ), child.attribute( QStringLiteral( "sslmode" ) ) );
1130  settings.setValue( QStringLiteral( "/estimatedMetadata" ), child.attribute( QStringLiteral( "estimatedMetadata" ) ) );
1131  settings.setValue( QStringLiteral( "/saveUsername" ), child.attribute( QStringLiteral( "saveUsername" ) ) );
1132  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1133  settings.setValue( QStringLiteral( "/savePassword" ), child.attribute( QStringLiteral( "savePassword" ) ) );
1134  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1135  settings.endGroup();
1136 
1137  child = child.nextSiblingElement();
1138  }
1139 }
1140 
1141 void QgsManageConnectionsDialog::loadOracleConnections( const QDomDocument &doc, const QStringList &items )
1142 {
1143  QDomElement root = doc.documentElement();
1144  if ( root.tagName() != QLatin1String( "qgsOracleConnections" ) )
1145  {
1146  QMessageBox::information( this,
1147  tr( "Loading Connections" ),
1148  tr( "The file is not an Oracle connections exchange file." ) );
1149  return;
1150  }
1151 
1152  QString connectionName;
1153  QgsSettings settings;
1154  settings.beginGroup( QStringLiteral( "/Oracle/connections" ) );
1155  QStringList keys = settings.childGroups();
1156  settings.endGroup();
1157  QDomElement child = root.firstChildElement();
1158  bool prompt = true;
1159  bool overwrite = true;
1160 
1161  while ( !child.isNull() )
1162  {
1163  connectionName = child.attribute( QStringLiteral( "name" ) );
1164  if ( !items.contains( connectionName ) )
1165  {
1166  child = child.nextSiblingElement();
1167  continue;
1168  }
1169 
1170  // check for duplicates
1171  if ( keys.contains( connectionName ) && prompt )
1172  {
1173  int res = QMessageBox::warning( this,
1174  tr( "Loading Connections" ),
1175  tr( "Connection with name '%1' already exists. Overwrite?" )
1176  .arg( connectionName ),
1177  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1178  switch ( res )
1179  {
1180  case QMessageBox::Cancel:
1181  return;
1182  case QMessageBox::No:
1183  child = child.nextSiblingElement();
1184  continue;
1185  case QMessageBox::Yes:
1186  overwrite = true;
1187  break;
1188  case QMessageBox::YesToAll:
1189  prompt = false;
1190  overwrite = true;
1191  break;
1192  case QMessageBox::NoToAll:
1193  prompt = false;
1194  overwrite = false;
1195  break;
1196  }
1197  }
1198 
1199  if ( keys.contains( connectionName ) && !overwrite )
1200  {
1201  child = child.nextSiblingElement();
1202  continue;
1203  }
1204 
1205  //no dups detected or overwrite is allowed
1206  settings.beginGroup( "/Oracle/connections/" + connectionName );
1207 
1208  settings.setValue( QStringLiteral( "/host" ), child.attribute( QStringLiteral( "host" ) ) );
1209  settings.setValue( QStringLiteral( "/port" ), child.attribute( QStringLiteral( "port" ) ) );
1210  settings.setValue( QStringLiteral( "/database" ), child.attribute( QStringLiteral( "database" ) ) );
1211  settings.setValue( QStringLiteral( "/dboptions" ), child.attribute( QStringLiteral( "dboptions" ) ) );
1212  settings.setValue( QStringLiteral( "/dbworkspace" ), child.attribute( QStringLiteral( "dbworkspace" ) ) );
1213  settings.setValue( QStringLiteral( "/schema" ), child.attribute( QStringLiteral( "schema" ) ) );
1214  settings.setValue( QStringLiteral( "/estimatedMetadata" ), child.attribute( QStringLiteral( "estimatedMetadata" ) ) );
1215  settings.setValue( QStringLiteral( "/userTablesOnly" ), child.attribute( QStringLiteral( "userTablesOnly" ) ) );
1216  settings.setValue( QStringLiteral( "/geometryColumnsOnly" ), child.attribute( QStringLiteral( "geometryColumnsOnly" ) ) );
1217  settings.setValue( QStringLiteral( "/allowGeometrylessTables" ), child.attribute( QStringLiteral( "allowGeometrylessTables" ) ) );
1218  settings.setValue( QStringLiteral( "/saveUsername" ), child.attribute( QStringLiteral( "saveUsername" ) ) );
1219  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1220  settings.setValue( QStringLiteral( "/savePassword" ), child.attribute( QStringLiteral( "savePassword" ) ) );
1221  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1222  settings.endGroup();
1223 
1224  child = child.nextSiblingElement();
1225  }
1226 }
1227 
1228 void QgsManageConnectionsDialog::loadDb2Connections( const QDomDocument &doc, const QStringList &items )
1229 {
1230  QDomElement root = doc.documentElement();
1231  if ( root.tagName() != QLatin1String( "qgsDb2Connections" ) )
1232  {
1233  QMessageBox::information( this,
1234  tr( "Loading Connections" ),
1235  tr( "The file is not a DB2 connections exchange file." ) );
1236  return;
1237  }
1238 
1239  QString connectionName;
1240  QgsSettings settings;
1241  settings.beginGroup( QStringLiteral( "/DB2/connections" ) );
1242  QStringList keys = settings.childGroups();
1243  settings.endGroup();
1244  QDomElement child = root.firstChildElement();
1245  bool prompt = true;
1246  bool overwrite = true;
1247 
1248  while ( !child.isNull() )
1249  {
1250  connectionName = child.attribute( QStringLiteral( "name" ) );
1251  if ( !items.contains( connectionName ) )
1252  {
1253  child = child.nextSiblingElement();
1254  continue;
1255  }
1256 
1257  // check for duplicates
1258  if ( keys.contains( connectionName ) && prompt )
1259  {
1260  int res = QMessageBox::warning( this,
1261  tr( "Loading Connections" ),
1262  tr( "Connection with name '%1' already exists. Overwrite?" )
1263  .arg( connectionName ),
1264  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1265  switch ( res )
1266  {
1267  case QMessageBox::Cancel:
1268  return;
1269  case QMessageBox::No:
1270  child = child.nextSiblingElement();
1271  continue;
1272  case QMessageBox::Yes:
1273  overwrite = true;
1274  break;
1275  case QMessageBox::YesToAll:
1276  prompt = false;
1277  overwrite = true;
1278  break;
1279  case QMessageBox::NoToAll:
1280  prompt = false;
1281  overwrite = false;
1282  break;
1283  }
1284  }
1285 
1286  if ( keys.contains( connectionName ) && !overwrite )
1287  {
1288  child = child.nextSiblingElement();
1289  continue;
1290  }
1291 
1292  //no dups detected or overwrite is allowed
1293  settings.beginGroup( "/DB2/connections/" + connectionName );
1294 
1295  settings.setValue( QStringLiteral( "/host" ), child.attribute( QStringLiteral( "host" ) ) );
1296  settings.setValue( QStringLiteral( "/port" ), child.attribute( QStringLiteral( "port" ) ) );
1297  settings.setValue( QStringLiteral( "/database" ), child.attribute( QStringLiteral( "database" ) ) );
1298  if ( child.hasAttribute( QStringLiteral( "service" ) ) )
1299  {
1300  settings.setValue( QStringLiteral( "/service" ), child.attribute( QStringLiteral( "service" ) ) );
1301  }
1302  else
1303  {
1304  settings.setValue( QStringLiteral( "/service" ), "" );
1305  }
1306  settings.setValue( QStringLiteral( "/sslmode" ), child.attribute( QStringLiteral( "sslmode" ) ) );
1307  settings.setValue( QStringLiteral( "/estimatedMetadata" ), child.attribute( QStringLiteral( "estimatedMetadata" ) ) );
1308  settings.setValue( QStringLiteral( "/saveUsername" ), child.attribute( QStringLiteral( "saveUsername" ) ) );
1309  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1310  settings.setValue( QStringLiteral( "/savePassword" ), child.attribute( QStringLiteral( "savePassword" ) ) );
1311  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1312  settings.endGroup();
1313 
1314  child = child.nextSiblingElement();
1315  }
1316 }
1317 
1318 void QgsManageConnectionsDialog::loadGeonodeConnections( const QDomDocument &doc, const QStringList &items )
1319 {
1320  QDomElement root = doc.documentElement();
1321  if ( root.tagName() != QLatin1String( "qgsGeoNodeConnections" ) )
1322  {
1323  QMessageBox::information( this, tr( "Loading Connections" ),
1324  tr( "The file is not a GeoNode connections exchange file." ) );
1325  return;
1326  }
1327 
1328  QString connectionName;
1329  QgsSettings settings;
1330  settings.beginGroup( QStringLiteral( "/qgis/connections-geonode" ) );
1331  QStringList keys = settings.childGroups();
1332  settings.endGroup();
1333  QDomElement child = root.firstChildElement();
1334  bool prompt = true;
1335  bool overwrite = true;
1336 
1337  while ( !child.isNull() )
1338  {
1339  connectionName = child.attribute( QStringLiteral( "name" ) );
1340  if ( !items.contains( connectionName ) )
1341  {
1342  child = child.nextSiblingElement();
1343  continue;
1344  }
1345 
1346  // check for duplicates
1347  if ( keys.contains( connectionName ) && prompt )
1348  {
1349  int res = QMessageBox::warning( this,
1350  tr( "Loading Connections" ),
1351  tr( "Connection with name '%1' already exists. Overwrite?" )
1352  .arg( connectionName ),
1353  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1354 
1355  switch ( res )
1356  {
1357  case QMessageBox::Cancel:
1358  return;
1359  case QMessageBox::No:
1360  child = child.nextSiblingElement();
1361  continue;
1362  case QMessageBox::Yes:
1363  overwrite = true;
1364  break;
1365  case QMessageBox::YesToAll:
1366  prompt = false;
1367  overwrite = true;
1368  break;
1369  case QMessageBox::NoToAll:
1370  prompt = false;
1371  overwrite = false;
1372  break;
1373  }
1374  }
1375 
1376  if ( keys.contains( connectionName ) && !overwrite )
1377  {
1378  child = child.nextSiblingElement();
1379  continue;
1380  }
1381 
1382  // no dups detected or overwrite is allowed
1383  settings.beginGroup( QStringLiteral( "/qgis/connections-geonode" ) );
1384  settings.setValue( QString( '/' + connectionName + "/url" ), child.attribute( QStringLiteral( "url" ) ) );
1385  settings.endGroup();
1386 
1387  if ( !child.attribute( QStringLiteral( "username" ) ).isEmpty() )
1388  {
1389  settings.beginGroup( "/qgis/GeoNode/" + connectionName );
1390  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1391  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1392  settings.endGroup();
1393  }
1394  child = child.nextSiblingElement();
1395  }
1396 }
1397 
1398 void QgsManageConnectionsDialog::loadXyzTilesConnections( const QDomDocument &doc, const QStringList &items )
1399 {
1400  QDomElement root = doc.documentElement();
1401  if ( root.tagName() != QLatin1String( "qgsXYZTilesConnections" ) )
1402  {
1403  QMessageBox::information( this, tr( "Loading Connections" ),
1404  tr( "The file is not a XYZ Tiles connections exchange file." ) );
1405  return;
1406  }
1407 
1408  QString connectionName;
1409  QgsSettings settings;
1410  settings.beginGroup( QStringLiteral( "/qgis/connections-xyz" ) );
1411  QStringList keys = settings.childGroups();
1412  settings.endGroup();
1413  QDomElement child = root.firstChildElement();
1414  bool prompt = true;
1415  bool overwrite = true;
1416 
1417  while ( !child.isNull() )
1418  {
1419  connectionName = child.attribute( QStringLiteral( "name" ) );
1420  if ( !items.contains( connectionName ) )
1421  {
1422  child = child.nextSiblingElement();
1423  continue;
1424  }
1425 
1426  // check for duplicates
1427  if ( keys.contains( connectionName ) && prompt )
1428  {
1429  int res = QMessageBox::warning( this,
1430  tr( "Loading Connections" ),
1431  tr( "Connection with name '%1' already exists. Overwrite?" )
1432  .arg( connectionName ),
1433  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1434 
1435  switch ( res )
1436  {
1437  case QMessageBox::Cancel:
1438  return;
1439  case QMessageBox::No:
1440  child = child.nextSiblingElement();
1441  continue;
1442  case QMessageBox::Yes:
1443  overwrite = true;
1444  break;
1445  case QMessageBox::YesToAll:
1446  prompt = false;
1447  overwrite = true;
1448  break;
1449  case QMessageBox::NoToAll:
1450  prompt = false;
1451  overwrite = false;
1452  break;
1453  }
1454  }
1455 
1456  if ( keys.contains( connectionName ) && !overwrite )
1457  {
1458  child = child.nextSiblingElement();
1459  continue;
1460  }
1461 
1462  settings.beginGroup( "qgis/connections-xyz/" + connectionName );
1463  settings.setValue( QStringLiteral( "url" ), child.attribute( QStringLiteral( "url" ) ) );
1464  settings.setValue( QStringLiteral( "zmin" ), child.attribute( QStringLiteral( "zmin" ) ) );
1465  settings.setValue( QStringLiteral( "zmax" ), child.attribute( QStringLiteral( "zmax" ) ) );
1466  settings.setValue( QStringLiteral( "authcfg" ), child.attribute( QStringLiteral( "authcfg" ) ) );
1467  settings.setValue( QStringLiteral( "username" ), child.attribute( QStringLiteral( "username" ) ) );
1468  settings.setValue( QStringLiteral( "password" ), child.attribute( QStringLiteral( "password" ) ) );
1469  settings.setValue( QStringLiteral( "referer" ), child.attribute( QStringLiteral( "referer" ) ) );
1470  settings.setValue( QStringLiteral( "tilePixelRatio" ), child.attribute( QStringLiteral( "tilePixelRatio" ) ) );
1471  settings.endGroup();
1472 
1473  child = child.nextSiblingElement();
1474  }
1475 }
1476 
1477 void QgsManageConnectionsDialog::loadArcgisConnections( const QDomDocument &doc, const QStringList &items, const QString &service )
1478 {
1479  QDomElement root = doc.documentElement();
1480  if ( root.tagName() != "qgs" + service.toUpper() + "Connections" )
1481  {
1482  QMessageBox::information( this, tr( "Loading Connections" ),
1483  tr( "The file is not a %1 connections exchange file." ).arg( service ) );
1484  return;
1485  }
1486 
1487  QString connectionName;
1488  QgsSettings settings;
1489  settings.beginGroup( "/qgis/connections-" + service.toLower() );
1490  QStringList keys = settings.childGroups();
1491  settings.endGroup();
1492  QDomElement child = root.firstChildElement();
1493  bool prompt = true;
1494  bool overwrite = true;
1495 
1496  while ( !child.isNull() )
1497  {
1498  connectionName = child.attribute( QStringLiteral( "name" ) );
1499  if ( !items.contains( connectionName ) )
1500  {
1501  child = child.nextSiblingElement();
1502  continue;
1503  }
1504 
1505  // check for duplicates
1506  if ( keys.contains( connectionName ) && prompt )
1507  {
1508  int res = QMessageBox::warning( this,
1509  tr( "Loading Connections" ),
1510  tr( "Connection with name '%1' already exists. Overwrite?" )
1511  .arg( connectionName ),
1512  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1513 
1514  switch ( res )
1515  {
1516  case QMessageBox::Cancel:
1517  return;
1518  case QMessageBox::No:
1519  child = child.nextSiblingElement();
1520  continue;
1521  case QMessageBox::Yes:
1522  overwrite = true;
1523  break;
1524  case QMessageBox::YesToAll:
1525  prompt = false;
1526  overwrite = true;
1527  break;
1528  case QMessageBox::NoToAll:
1529  prompt = false;
1530  overwrite = false;
1531  break;
1532  }
1533  }
1534 
1535  if ( keys.contains( connectionName ) && !overwrite )
1536  {
1537  child = child.nextSiblingElement();
1538  continue;
1539  }
1540 
1541  // no dups detected or overwrite is allowed
1542  settings.beginGroup( "/qgis/connections-" + service.toLower() );
1543  settings.setValue( QString( '/' + connectionName + "/url" ), child.attribute( QStringLiteral( "url" ) ) );
1544  settings.setValue( QString( '/' + connectionName + "/referer" ), child.attribute( QStringLiteral( "referer" ) ) );
1545  settings.endGroup();
1546 
1547  settings.beginGroup( "/qgis/" + service.toUpper() + '/' + connectionName );
1548  settings.setValue( QStringLiteral( "/username" ), child.attribute( QStringLiteral( "username" ) ) );
1549  settings.setValue( QStringLiteral( "/password" ), child.attribute( QStringLiteral( "password" ) ) );
1550  settings.setValue( QStringLiteral( "/authcfg" ), child.attribute( QStringLiteral( "authcfg" ) ) );
1551  settings.endGroup();
1552 
1553  child = child.nextSiblingElement();
1554  }
1555 }
1556 
1557 void QgsManageConnectionsDialog::loadVectorTileConnections( const QDomDocument &doc, const QStringList &items )
1558 {
1559  QDomElement root = doc.documentElement();
1560  if ( root.tagName() != QLatin1String( "qgsVectorTileConnections" ) )
1561  {
1562  QMessageBox::information( this, tr( "Loading Connections" ),
1563  tr( "The file is not a Vector Tile connections exchange file." ) );
1564  return;
1565  }
1566 
1567  QString connectionName;
1568  QgsSettings settings;
1569  settings.beginGroup( QStringLiteral( "/qgis/connections-vector-tile" ) );
1570  QStringList keys = settings.childGroups();
1571  settings.endGroup();
1572  QDomElement child = root.firstChildElement();
1573  bool prompt = true;
1574  bool overwrite = true;
1575 
1576  while ( !child.isNull() )
1577  {
1578  connectionName = child.attribute( QStringLiteral( "name" ) );
1579  if ( !items.contains( connectionName ) )
1580  {
1581  child = child.nextSiblingElement();
1582  continue;
1583  }
1584 
1585  // check for duplicates
1586  if ( keys.contains( connectionName ) && prompt )
1587  {
1588  int res = QMessageBox::warning( this,
1589  tr( "Loading Connections" ),
1590  tr( "Connection with name '%1' already exists. Overwrite?" )
1591  .arg( connectionName ),
1592  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1593 
1594  switch ( res )
1595  {
1596  case QMessageBox::Cancel:
1597  return;
1598  case QMessageBox::No:
1599  child = child.nextSiblingElement();
1600  continue;
1601  case QMessageBox::Yes:
1602  overwrite = true;
1603  break;
1604  case QMessageBox::YesToAll:
1605  prompt = false;
1606  overwrite = true;
1607  break;
1608  case QMessageBox::NoToAll:
1609  prompt = false;
1610  overwrite = false;
1611  break;
1612  }
1613  }
1614 
1615  if ( keys.contains( connectionName ) && !overwrite )
1616  {
1617  child = child.nextSiblingElement();
1618  continue;
1619  }
1620 
1621  settings.beginGroup( "qgis/connections-vector-tile/" + connectionName );
1622  settings.setValue( QStringLiteral( "url" ), child.attribute( QStringLiteral( "url" ) ) );
1623  settings.setValue( QStringLiteral( "zmin" ), child.attribute( QStringLiteral( "zmin" ) ) );
1624  settings.setValue( QStringLiteral( "zmax" ), child.attribute( QStringLiteral( "zmax" ) ) );
1625  settings.setValue( QStringLiteral( "serviceType" ), child.attribute( QStringLiteral( "serviceType" ) ) );
1626  settings.setValue( QStringLiteral( "authcfg" ), child.attribute( QStringLiteral( "authcfg" ) ) );
1627  settings.setValue( QStringLiteral( "username" ), child.attribute( QStringLiteral( "username" ) ) );
1628  settings.setValue( QStringLiteral( "password" ), child.attribute( QStringLiteral( "password" ) ) );
1629  settings.setValue( QStringLiteral( "referer" ), child.attribute( QStringLiteral( "referer" ) ) );
1630  settings.setValue( QStringLiteral( "styleUrl" ), child.attribute( QStringLiteral( "styleUrl" ) ) );
1631 
1632  settings.endGroup();
1633 
1634  child = child.nextSiblingElement();
1635  }
1636 }
1637 
1639 {
1640  listConnections->selectAll();
1641  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !listConnections->selectedItems().isEmpty() );
1642 }
1643 
1645 {
1646  listConnections->clearSelection();
1647  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
1648 }
QgsManageConnectionsDialog::XyzTiles
@ XyzTiles
Definition: qgsmanageconnectionsdialog.h:52
QgsManageConnectionsDialog::Mode
Mode
Definition: qgsmanageconnectionsdialog.h:37
QgsSettings::endGroup
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
Definition: qgssettings.cpp:97
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition: qgssettings.cpp:174
qgsmanageconnectionsdialog.h
QgsManageConnectionsDialog::MSSQL
@ MSSQL
Definition: qgsmanageconnectionsdialog.h:47
QgsSettings
This class is a composition of two QSettings instances:
Definition: qgssettings.h:62
QgsManageConnectionsDialog::QgsManageConnectionsDialog
QgsManageConnectionsDialog(QWidget *parent=nullptr, Mode mode=Export, Type type=WMS, const QString &fileName=QString())
Constructor for QgsManageConnectionsDialog.
Definition: qgsmanageconnectionsdialog.cpp:27
QgsManageConnectionsDialog::Oracle
@ Oracle
Definition: qgsmanageconnectionsdialog.h:50
QgsManageConnectionsDialog::clearSelection
void clearSelection()
Definition: qgsmanageconnectionsdialog.cpp:1644
QgsManageConnectionsDialog::Import
@ Import
Definition: qgsmanageconnectionsdialog.h:39
QgsManageConnectionsDialog::PostGIS
@ PostGIS
Definition: qgsmanageconnectionsdialog.h:45
QgsManageConnectionsDialog::VectorTile
@ VectorTile
Definition: qgsmanageconnectionsdialog.h:55
QgsManageConnectionsDialog::selectionChanged
void selectionChanged()
Definition: qgsmanageconnectionsdialog.cpp:70
QgsSettings::setValue
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Definition: qgssettings.cpp:289
QgsManageConnectionsDialog::Export
@ Export
Definition: qgsmanageconnectionsdialog.h:38
QgsManageConnectionsDialog::WCS
@ WCS
Definition: qgsmanageconnectionsdialog.h:49
QgsManageConnectionsDialog::ArcgisFeatureServer
@ ArcgisFeatureServer
Definition: qgsmanageconnectionsdialog.h:54
QgsSettings::beginGroup
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
Definition: qgssettings.cpp:87
QgsManageConnectionsDialog::Type
Type
Definition: qgsmanageconnectionsdialog.h:43
QgsManageConnectionsDialog::WMS
@ WMS
Definition: qgsmanageconnectionsdialog.h:44
QgsManageConnectionsDialog::selectAll
void selectAll()
Definition: qgsmanageconnectionsdialog.cpp:1638
QgsManageConnectionsDialog::ArcgisMapServer
@ ArcgisMapServer
Definition: qgsmanageconnectionsdialog.h:53
qgssettings.h
QgsManageConnectionsDialog::doExportImport
void doExportImport()
Definition: qgsmanageconnectionsdialog.cpp:75
QgsManageConnectionsDialog::DB2
@ DB2
Definition: qgsmanageconnectionsdialog.h:48
QgsManageConnectionsDialog::WFS
@ WFS
Definition: qgsmanageconnectionsdialog.h:46
QgsManageConnectionsDialog::GeoNode
@ GeoNode
Definition: qgsmanageconnectionsdialog.h:51
QgsSettings::childGroups
QStringList childGroups() const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
Definition: qgssettings.cpp:144