Skip to content
Permalink
Browse files
Merged the source select UIs for both PG and SL to allow to use a sub…
…set query loading a SL layer

git-svn-id: http://svn.osgeo.org/qgis/trunk@15214 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Feb 19, 2011
1 parent 6b68070 commit 05c7708240c3c80c70808f2a1562426a097f81ff
@@ -301,17 +301,16 @@ ENDIF (POSTGRES_FOUND)

IF (HAVE_SPATIALITE)
SET (QGIS_APP_SRCS ${QGIS_APP_SRCS}
qgsspatialitesourceselect.cpp
qgsnewspatialitelayerdialog.cpp
qgsspatialitesridsdialog.cpp
qgsspatialitefilterproxymodel.cpp
qgsspatialitetablemodel.cpp
spatialite/qgsspatialitesourceselect.cpp
spatialite/qgsnewspatialitelayerdialog.cpp
spatialite/qgsspatialitesridsdialog.cpp
spatialite/qgsspatialitetablemodel.cpp
)
SET (QGIS_APP_MOC_HDRS ${QGIS_APP_MOC_HDRS}
qgsspatialitesourceselect.h
qgsnewspatialitelayerdialog.h
qgsspatialitesridsdialog.h
qgsspatialitetablemodel.h
spatialite/qgsspatialitesourceselect.h
spatialite/qgsnewspatialitelayerdialog.h
spatialite/qgsspatialitesridsdialog.h
spatialite/qgsspatialitetablemodel.h
)
ENDIF (HAVE_SPATIALITE)

@@ -17,7 +17,7 @@
/* $Id$ */
#ifndef QGSPGSOURCESELECT_H
#define QGSPGSOURCESELECT_H
#include "ui_qgspgsourceselectbase.h"
#include "ui_qgsdbsourceselectbase.h"
#include "qgisgui.h"
#include "qgsdbfilterproxymodel.h"
#include "qgsdbtablemodel.h"
@@ -99,7 +99,7 @@ class QgsPgSourceSelectDelegate : public QItemDelegate
* for PostGIS enabled PostgreSQL databases. The user can then connect and add
* tables from the database to the map canvas.
*/
class QgsPgSourceSelect : public QDialog, private Ui::QgsPgSourceSelectBase
class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
{
Q_OBJECT

@@ -112,6 +112,7 @@
#include "qgscredentialdialog.h"
#include "qgscursors.h"
#include "qgscustomprojectiondialog.h"
#include "qgsdatasourceuri.h"
#include "qgsencodingfiledialog.h"
#include "qgsexception.h"
#include "qgsfeature.h"
@@ -235,8 +236,8 @@ extern "C"
{
#include <spatialite.h>
}
#include "qgsspatialitesourceselect.h"
#include "qgsnewspatialitelayerdialog.h"
#include "spatialite/qgsspatialitesourceselect.h"
#include "spatialite/qgsnewspatialitelayerdialog.h"
#endif

#include "qgspythonutils.h"
@@ -3025,17 +3026,16 @@ void QgisApp::addDatabaseLayer()

QApplication::setOverrideCursor( Qt::WaitCursor );

QString connectionInfo = dbs->connectionInfo();
// for each selected table, connect to the database, parse the Wkt geometry,
// and build a canvasitem for it
// readWKB(connectionInfo,tables);
QStringList::Iterator it = tables.begin();
while ( it != tables.end() )
{

// create the layer
//qWarning("creating layer");
QgsVectorLayer *layer = new QgsVectorLayer( connectionInfo + " " + *it, *it, "postgres" );
QgsDataSourceURI uri( *it );
QgsVectorLayer *layer = new QgsVectorLayer( uri.uri(), uri.table(), "postgres" );
if ( layer->isValid() )
{
// register this layer with the central layers registry
@@ -3101,20 +3101,13 @@ void QgisApp::addSpatiaLiteLayer()

QApplication::setOverrideCursor( Qt::WaitCursor );

QString connectionInfo = dbs->connectionInfo();
// for each selected table, connect to the database and build a canvasitem for it
QStringList::Iterator it = tables.begin();
while ( it != tables.end() )
{
// normalizing the layer name
QString layername = *it;
layername = layername.mid( 1 );
int idx = layername.indexOf( "\" (" );
if ( idx > 0 )
layername.truncate( idx );

// create the layer
QgsVectorLayer *layer = new QgsVectorLayer( "dbname='" + connectionInfo + "' table=" + *it + ") sql=", layername, "spatialite" );
QgsDataSourceURI uri( *it );
QgsVectorLayer *layer = new QgsVectorLayer( uri.uri(), uri.table(), "spatialite" );
if ( layer->isValid() )
{
// register this layer with the central layers registry

This file was deleted.

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 05c7708

Please sign in to comment.