|
18 | 18 | #include "qgslogger.h"
|
19 | 19 | #include "qgsdatasourceuri.h"
|
20 | 20 |
|
21 |
| -const QString QgsGeoNodeConnection::sPathGeoNodeConnection = "qgis/connections-geonode"; |
22 |
| -const QString QgsGeoNodeConnection::sPathGeoNodeConnectionDetails = "qgis/GeoNode"; |
| 21 | +const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnection = "qgis/connections-geonode"; |
| 22 | +const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnectionDetails = "qgis/GeoNode"; |
23 | 23 |
|
24 | 24 | QgsGeoNodeConnection::QgsGeoNodeConnection( const QString &connName )
|
25 | 25 | : mConnName( connName )
|
26 | 26 | {
|
27 | 27 | QgsSettings settings;
|
28 | 28 |
|
29 |
| - |
30 | 29 | // settings.Section
|
31 |
| - QString key = sPathGeoNodeConnection + QStringLiteral( "/" ) + mConnName; |
32 |
| - QString credentialsKey = sPathGeoNodeConnectionDetails + QStringLiteral( "/" ) + mConnName; |
| 30 | + QString key = QgsGeoNodeConnectionUtils::pathGeoNodeConnection() + QStringLiteral( "/" ) + mConnName; |
| 31 | + QString credentialsKey = QgsGeoNodeConnectionUtils::pathGeoNodeConnectionDetails() + QStringLiteral( "/" ) + mConnName; |
33 | 32 |
|
34 | 33 | mUri.setParam( QStringLiteral( "url" ), settings.value( key + QStringLiteral( "/url" ), QString(), QgsSettings::Providers ).toString() );
|
35 | 34 |
|
@@ -61,55 +60,61 @@ QgsDataSourceUri QgsGeoNodeConnection::uri() const
|
61 | 60 | return mUri;
|
62 | 61 | }
|
63 | 62 |
|
64 |
| -QStringList QgsGeoNodeConnection::connectionList() |
| 63 | +QString QgsGeoNodeConnection::connName() const |
| 64 | +{ |
| 65 | + return mConnName; |
| 66 | +} |
| 67 | + |
| 68 | +void QgsGeoNodeConnection::setConnName( const QString &connName ) |
| 69 | +{ |
| 70 | + mConnName = connName; |
| 71 | +} |
| 72 | + |
| 73 | +void QgsGeoNodeConnection::setUri( const QgsDataSourceUri &uri ) |
| 74 | +{ |
| 75 | + mUri = uri; |
| 76 | +} |
| 77 | + |
| 78 | + |
| 79 | +// |
| 80 | +// QgsGeoNodeConnectionUtils |
| 81 | +// |
| 82 | + |
| 83 | + |
| 84 | +QStringList QgsGeoNodeConnectionUtils::connectionList() |
65 | 85 | {
|
66 | 86 | QgsSettings settings;
|
67 | 87 | // Add Section manually
|
68 | 88 | settings.beginGroup( QStringLiteral( "providers/qgis/connections-geonode" ) );
|
69 | 89 | return settings.childGroups();
|
70 | 90 | }
|
71 | 91 |
|
72 |
| -void QgsGeoNodeConnection::deleteConnection( const QString &name ) |
| 92 | +void QgsGeoNodeConnectionUtils::deleteConnection( const QString &name ) |
73 | 93 | {
|
74 | 94 | QgsSettings settings;
|
75 | 95 | // Add Section manually
|
76 | 96 | settings.remove( QStringLiteral( "providers/qgis/connections-geonode/" ) + name );
|
77 | 97 | settings.remove( QStringLiteral( "providers/qgis/geonode/" ) + name );
|
78 | 98 | }
|
79 | 99 |
|
80 |
| -QString QgsGeoNodeConnection::selectedConnection() |
| 100 | +QString QgsGeoNodeConnectionUtils::selectedConnection() |
81 | 101 | {
|
82 | 102 | QgsSettings settings;
|
83 | 103 | return settings.value( QStringLiteral( "qgis/connections-geonode/selected" ), QString(), QgsSettings::Providers ).toString();
|
84 | 104 | }
|
85 | 105 |
|
86 |
| -void QgsGeoNodeConnection::setSelectedConnection( const QString &name ) |
| 106 | +void QgsGeoNodeConnectionUtils::setSelectedConnection( const QString &name ) |
87 | 107 | {
|
88 | 108 | QgsSettings settings;
|
89 | 109 | settings.setValue( QStringLiteral( "qgis/connections-geonode/selected" ), name, QgsSettings::Providers );
|
90 | 110 | }
|
91 | 111 |
|
92 |
| -QString QgsGeoNodeConnection::pathGeoNodeConnection() |
| 112 | +QString QgsGeoNodeConnectionUtils::pathGeoNodeConnection() |
93 | 113 | {
|
94 | 114 | return sPathGeoNodeConnection;
|
95 | 115 | }
|
96 | 116 |
|
97 |
| -QString QgsGeoNodeConnection::pathGeoNodeConnectionDetails() |
| 117 | +QString QgsGeoNodeConnectionUtils::pathGeoNodeConnectionDetails() |
98 | 118 | {
|
99 | 119 | return sPathGeoNodeConnectionDetails;
|
100 | 120 | }
|
101 |
| - |
102 |
| -QString QgsGeoNodeConnection::connName() const |
103 |
| -{ |
104 |
| - return mConnName; |
105 |
| -} |
106 |
| - |
107 |
| -void QgsGeoNodeConnection::setConnName( const QString &connName ) |
108 |
| -{ |
109 |
| - mConnName = connName; |
110 |
| -} |
111 |
| - |
112 |
| -void QgsGeoNodeConnection::setUri( const QgsDataSourceUri &uri ) |
113 |
| -{ |
114 |
| - mUri = uri; |
115 |
| -} |
|
0 commit comments