Skip to content

Commit dcdcd12

Browse files
committedJun 30, 2013
ows data items: populate data items of other providers (fixes #7857)
1 parent f9d9b34 commit dcdcd12

File tree

5 files changed

+33
-44
lines changed

5 files changed

+33
-44
lines changed
 

‎src/core/qgsowsconnection.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ QgsOWSConnection::QgsOWSConnection( const QString & theService, const QString &
4343

4444
QSettings settings;
4545

46-
// WMS (providers/wfs/qgswmsconnection.cpp):
47-
//QString key = "/Qgis/connections-wms/" + mConnName;
48-
//QString credentialsKey = "/Qgis/WMS/" + mConnName;
49-
50-
// WFS (providers/wfs/qgswfsconnection.cpp):
51-
//QString key = "/Qgis/connections-wfs/" + mConnName + "/url";
52-
53-
// WCS - there was no WCS before
54-
5546
QString key = "/Qgis/connections-" + mService.toLower() + "/" + mConnName;
5647
QString credentialsKey = "/Qgis/" + mService + "/" + mConnName;
5748

@@ -113,8 +104,9 @@ QgsDataSourceURI QgsOWSConnection::uri()
113104
{
114105
return mUri;
115106
}
116-
/*
117-
QgsDataProvider * QgsOWSConnection::provider( )
107+
108+
#if 0
109+
QgsDataProvider * QgsOWSConnection::provider()
118110
{
119111
// TODO: remove completely from this class?
120112

@@ -128,36 +120,31 @@ QgsDataProvider * QgsOWSConnection::provider( )
128120

129121
return provider;
130122
}
131-
*/
123+
#endif
132124

133125

134126
QStringList QgsOWSConnection::connectionList( const QString & theService )
135127
{
136128
QSettings settings;
137-
//settings.beginGroup( "/Qgis/connections-wms" );
138129
settings.beginGroup( "/Qgis/connections-" + theService.toLower() );
139130
return settings.childGroups();
140131
}
141132

142133
QString QgsOWSConnection::selectedConnection( const QString & theService )
143134
{
144135
QSettings settings;
145-
//return settings.value( "/Qgis/connections-wms/selected" ).toString();
146136
return settings.value( "/Qgis/connections-" + theService.toLower() + "/selected" ).toString();
147137
}
148138

149139
void QgsOWSConnection::setSelectedConnection( const QString & theService, const QString & name )
150140
{
151141
QSettings settings;
152-
//settings.setValue( "/Qgis/connections-wms/selected", name );
153142
settings.setValue( "/Qgis/connections-" + theService.toLower() + "/selected", name );
154143
}
155144

156145
void QgsOWSConnection::deleteConnection( const QString & theService, const QString & name )
157146
{
158147
QSettings settings;
159-
//settings.remove( "/Qgis/connections-wms/" + name );
160-
//settings.remove( "/Qgis/WMS/" + name );
161148
settings.remove( "/Qgis/connections-" + theService.toLower() + "/" + name );
162149
settings.remove( "/Qgis/" + theService + "/" + name );
163150
}

‎src/providers/gdal/qgsgdaldataitems.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool QgsGdalLayerItem::setCrs( QgsCoordinateReferenceSystem crs )
7676
return true;
7777
}
7878

79-
QVector<QgsDataItem*> QgsGdalLayerItem::createChildren( )
79+
QVector<QgsDataItem*> QgsGdalLayerItem::createChildren()
8080
{
8181
QgsDebugMsg( "Entered, path=" + path() );
8282
QVector<QgsDataItem*> children;

‎src/providers/ows/qgsowsdataitems.cpp

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "qgsowsprovider.h"
1818
#include "qgslogger.h"
1919
#include "qgsdatasourceuri.h"
20-
//#include "qgsowssourceselect.h"
2120
#include "qgsowsconnection.h"
2221
#include "qgsnewhttpconnection.h"
2322

@@ -40,7 +39,6 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
4039
{
4140
QgsDebugMsg( "Entered" );
4241
QVector<QgsDataItem*> children;
43-
4442
QVector<QgsDataItem*> serviceItems;
4543

4644
int layerCount = 0;
@@ -49,7 +47,8 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
4947
{
5048
QgsDebugMsg( "Add connection for provider " + key );
5149
QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
52-
if ( !library ) continue;
50+
if ( !library )
51+
continue;
5352

5453
dataItem_t * dItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );
5554
if ( !dItem )
@@ -59,7 +58,10 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
5958
}
6059

6160
QgsDataItem *item = dItem( mPath, this ); // empty path -> top level
62-
if ( !item ) continue;
61+
if ( !item )
62+
continue;
63+
64+
item->populate();
6365

6466
layerCount += item->rowCount();
6567
if ( item->rowCount() > 0 )
@@ -123,24 +125,24 @@ QList<QAction*> QgsOWSConnectionItem::actions()
123125

124126
void QgsOWSConnectionItem::editConnection()
125127
{
126-
/*
127-
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/", mName );
128+
#if 0
129+
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/", mName );
128130

129-
if ( nc.exec() )
130-
{
131-
// the parent should be updated
132-
mParent->refresh();
133-
}
134-
*/
131+
if ( nc.exec() )
132+
{
133+
// the parent should be updated
134+
mParent->refresh();
135+
}
136+
#endif
135137
}
136138

137139
void QgsOWSConnectionItem::deleteConnection()
138140
{
139-
/*
140-
QgsOWSConnection::deleteConnection( "OWS", mName );
141-
// the parent should be updated
142-
mParent->refresh();
143-
*/
141+
#if 0
142+
QgsOWSConnection::deleteConnection( "OWS", mName );
143+
// the parent should be updated
144+
mParent->refresh();
145+
#endif
144146
}
145147

146148

@@ -159,7 +161,7 @@ QgsOWSRootItem::~QgsOWSRootItem()
159161
{
160162
}
161163

162-
QVector<QgsDataItem*>QgsOWSRootItem::createChildren()
164+
QVector<QgsDataItem*> QgsOWSRootItem::createChildren()
163165
{
164166
QgsDebugMsg( "Entered" );
165167
QVector<QgsDataItem*> connections;
@@ -192,22 +194,23 @@ QList<QAction*> QgsOWSRootItem::actions()
192194
{
193195
QList<QAction*> lst;
194196

195-
/*
197+
#if 0
196198
QAction* actionNew = new QAction( tr( "New Connection..." ), this );
197199
connect( actionNew, SIGNAL( triggered() ), this, SLOT( newConnection() ) );
198200
lst.append( actionNew );
199-
*/
201+
#endif
202+
200203
return lst;
201204
}
202205

203206

204207
QWidget * QgsOWSRootItem::paramWidget()
205208
{
206-
/*
209+
#if 0
207210
QgsOWSSourceSelect *select = new QgsOWSSourceSelect( 0, 0, true, true );
208211
connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) );
209212
return select;
210-
*/
213+
#endif
211214
return 0;
212215
}
213216
void QgsOWSRootItem::connectionsChanged()
@@ -217,14 +220,14 @@ void QgsOWSRootItem::connectionsChanged()
217220

218221
void QgsOWSRootItem::newConnection()
219222
{
220-
/*
223+
#if 0
221224
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/" );
222225

223226
if ( nc.exec() )
224227
{
225228
refresh();
226229
}
227-
*/
230+
#endif
228231
}
229232

230233

‎src/providers/wfs/qgswfsdataitems.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,3 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
217217

218218
return new QgsWFSConnectionItem( parentItem, "WFS", thePath );
219219
}
220-

‎src/providers/wms/qgswmsdataitems.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ QgsWMSRootItem::~QgsWMSRootItem()
232232
{
233233
}
234234

235-
QVector<QgsDataItem*>QgsWMSRootItem::createChildren()
235+
QVector<QgsDataItem*> QgsWMSRootItem::createChildren()
236236
{
237237
QVector<QgsDataItem*> connections;
238238

0 commit comments

Comments
 (0)
Please sign in to comment.