Skip to content
Permalink
Browse files

ows data items: populate data items of other providers (fixes #7857)

  • Loading branch information
jef-n committed Jun 30, 2013
1 parent f9d9b34 commit dcdcd12c721c1126be707ebe07149b41a1c95603
@@ -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;

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

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

@@ -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 );
}
@@ -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;
@@ -17,7 +17,6 @@
#include "qgsowsprovider.h"
#include "qgslogger.h"
#include "qgsdatasourceuri.h"
//#include "qgsowssourceselect.h"
#include "qgsowsconnection.h"
#include "qgsnewhttpconnection.h"

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

QVector<QgsDataItem*> serviceItems;

int layerCount = 0;
@@ -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 )
@@ -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 )
@@ -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
}


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

QVector<QgsDataItem*>QgsOWSRootItem::createChildren()
QVector<QgsDataItem*> QgsOWSRootItem::createChildren()
{
QgsDebugMsg( "Entered" );
QVector<QgsDataItem*> connections;
@@ -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()
@@ -217,14 +220,14 @@ void QgsOWSRootItem::connectionsChanged()

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

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


@@ -217,4 +217,3 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )

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

@@ -232,7 +232,7 @@ QgsWMSRootItem::~QgsWMSRootItem()
{
}

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

0 comments on commit dcdcd12

Please sign in to comment.
You can’t perform that action at this time.