Skip to content

Commit

Permalink
ows data items: populate data items of other providers (fixes #7857)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 30, 2013
1 parent f9d9b34 commit dcdcd12
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 44 deletions.
21 changes: 4 additions & 17 deletions src/core/qgsowsconnection.cpp
Expand Up @@ -43,15 +43,6 @@ QgsOWSConnection::QgsOWSConnection( const QString & theService, const QString &

QSettings settings;

// WMS (providers/wfs/qgswmsconnection.cpp):
//QString key = "/Qgis/connections-wms/" + mConnName;
//QString credentialsKey = "/Qgis/WMS/" + mConnName;

// WFS (providers/wfs/qgswfsconnection.cpp):
//QString key = "/Qgis/connections-wfs/" + mConnName + "/url";

// WCS - there was no WCS before

QString key = "/Qgis/connections-" + mService.toLower() + "/" + mConnName;
QString credentialsKey = "/Qgis/" + mService + "/" + mConnName;

Expand Down Expand Up @@ -113,8 +104,9 @@ QgsDataSourceURI QgsOWSConnection::uri()
{
return mUri;
}
/*
QgsDataProvider * QgsOWSConnection::provider( )

#if 0
QgsDataProvider * QgsOWSConnection::provider()
{
// TODO: remove completely from this class?

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

return provider;
}
*/
#endif


QStringList QgsOWSConnection::connectionList( const QString & theService )
{
QSettings settings;
//settings.beginGroup( "/Qgis/connections-wms" );
settings.beginGroup( "/Qgis/connections-" + theService.toLower() );
return settings.childGroups();
}

QString QgsOWSConnection::selectedConnection( const QString & theService )
{
QSettings settings;
//return settings.value( "/Qgis/connections-wms/selected" ).toString();
return settings.value( "/Qgis/connections-" + theService.toLower() + "/selected" ).toString();
}

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

void QgsOWSConnection::deleteConnection( const QString & theService, const QString & name )
{
QSettings settings;
//settings.remove( "/Qgis/connections-wms/" + name );
//settings.remove( "/Qgis/WMS/" + name );
settings.remove( "/Qgis/connections-" + theService.toLower() + "/" + name );
settings.remove( "/Qgis/" + theService + "/" + name );
}
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdaldataitems.cpp
Expand Up @@ -76,7 +76,7 @@ bool QgsGdalLayerItem::setCrs( QgsCoordinateReferenceSystem crs )
return true;
}

QVector<QgsDataItem*> QgsGdalLayerItem::createChildren( )
QVector<QgsDataItem*> QgsGdalLayerItem::createChildren()
{
QgsDebugMsg( "Entered, path=" + path() );
QVector<QgsDataItem*> children;
Expand Down
51 changes: 27 additions & 24 deletions src/providers/ows/qgsowsdataitems.cpp
Expand Up @@ -17,7 +17,6 @@
#include "qgsowsprovider.h"
#include "qgslogger.h"
#include "qgsdatasourceuri.h"
//#include "qgsowssourceselect.h"
#include "qgsowsconnection.h"
#include "qgsnewhttpconnection.h"

Expand All @@ -40,7 +39,6 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
{
QgsDebugMsg( "Entered" );
QVector<QgsDataItem*> children;

QVector<QgsDataItem*> serviceItems;

int layerCount = 0;
Expand All @@ -49,7 +47,8 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
{
QgsDebugMsg( "Add connection for provider " + key );
QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
if ( !library ) continue;
if ( !library )
continue;

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

QgsDataItem *item = dItem( mPath, this ); // empty path -> top level
if ( !item ) continue;
if ( !item )
continue;

item->populate();

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

void QgsOWSConnectionItem::editConnection()
{
/*
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/", mName );
#if 0
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/", mName );

if ( nc.exec() )
{
// the parent should be updated
mParent->refresh();
}
*/
if ( nc.exec() )
{
// the parent should be updated
mParent->refresh();
}
#endif
}

void QgsOWSConnectionItem::deleteConnection()
{
/*
QgsOWSConnection::deleteConnection( "OWS", mName );
// the parent should be updated
mParent->refresh();
*/
#if 0
QgsOWSConnection::deleteConnection( "OWS", mName );
// the parent should be updated
mParent->refresh();
#endif
}


Expand All @@ -159,7 +161,7 @@ QgsOWSRootItem::~QgsOWSRootItem()
{
}

QVector<QgsDataItem*>QgsOWSRootItem::createChildren()
QVector<QgsDataItem*> QgsOWSRootItem::createChildren()
{
QgsDebugMsg( "Entered" );
QVector<QgsDataItem*> connections;
Expand Down Expand Up @@ -192,22 +194,23 @@ QList<QAction*> QgsOWSRootItem::actions()
{
QList<QAction*> lst;

/*
#if 0
QAction* actionNew = new QAction( tr( "New Connection..." ), this );
connect( actionNew, SIGNAL( triggered() ), this, SLOT( newConnection() ) );
lst.append( actionNew );
*/
#endif

return lst;
}


QWidget * QgsOWSRootItem::paramWidget()
{
/*
#if 0
QgsOWSSourceSelect *select = new QgsOWSSourceSelect( 0, 0, true, true );
connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) );
return select;
*/
#endif
return 0;
}
void QgsOWSRootItem::connectionsChanged()
Expand All @@ -217,14 +220,14 @@ void QgsOWSRootItem::connectionsChanged()

void QgsOWSRootItem::newConnection()
{
/*
#if 0
QgsNewHttpConnection nc( 0, "/Qgis/connections-ows/" );

if ( nc.exec() )
{
refresh();
}
*/
#endif
}


Expand Down
1 change: 0 additions & 1 deletion src/providers/wfs/qgswfsdataitems.cpp
Expand Up @@ -217,4 +217,3 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )

return new QgsWFSConnectionItem( parentItem, "WFS", thePath );
}

2 changes: 1 addition & 1 deletion src/providers/wms/qgswmsdataitems.cpp
Expand Up @@ -232,7 +232,7 @@ QgsWMSRootItem::~QgsWMSRootItem()
{
}

QVector<QgsDataItem*>QgsWMSRootItem::createChildren()
QVector<QgsDataItem*> QgsWMSRootItem::createChildren()
{
QVector<QgsDataItem*> connections;

Expand Down

0 comments on commit dcdcd12

Please sign in to comment.