Last active
December 17, 2015 22:49
-
-
Save jef-n/5684909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp | |
index d1e72f6..6989587 100644 | |
--- a/src/app/qgisapp.cpp | |
+++ b/src/app/qgisapp.cpp | |
@@ -2897,8 +2897,8 @@ void QgisApp::addDatabaseLayer() | |
QMessageBox::warning( this, tr( "PostgreSQL" ), tr( "Cannot get PostgreSQL select dialog from provider." ) ); | |
return; | |
} | |
- connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QString const & ) ), | |
- this, SLOT( addDatabaseLayers( QStringList const &, QString const & ) ) ); | |
+ connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ), | |
+ this, SLOT( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ) ); | |
connect( dbs, SIGNAL( progress( int, int ) ), | |
this, SLOT( showProgress( int, int ) ) ); | |
connect( dbs, SIGNAL( progressMessage( QString ) ), | |
@@ -2908,7 +2908,7 @@ void QgisApp::addDatabaseLayer() | |
#endif | |
} // QgisApp::addDatabaseLayer() | |
-void QgisApp::addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey ) | |
+void QgisApp::addDatabaseLayers( QStringList const & layerUris, QStringList const &layerNames, QString const & providerKey ) | |
{ | |
QList<QgsMapLayer *> myList; | |
if ( mMapCanvas && mMapCanvas->isDrawing() ) | |
@@ -2916,7 +2916,7 @@ void QgisApp::addDatabaseLayers( QStringList const & layerPathList, QString cons | |
return; | |
} | |
- if ( layerPathList.empty() ) | |
+ if ( layerUris.empty() ) | |
{ | |
// no layers to add so bail out, but | |
// allow mMapCanvas to handle events | |
@@ -2929,12 +2929,13 @@ void QgisApp::addDatabaseLayers( QStringList const & layerPathList, QString cons | |
QApplication::setOverrideCursor( Qt::WaitCursor ); | |
- foreach ( QString layerPath, layerPathList ) | |
+ int i = 0; | |
+ foreach ( QString layerUri, layerUris ) | |
{ | |
// create the layer | |
- QgsDataSourceURI uri( layerPath ); | |
+ QgsDataSourceURI uri( layerUri ); | |
- QgsVectorLayer *layer = new QgsVectorLayer( uri.uri(), uri.table(), providerKey ); | |
+ QgsVectorLayer *layer = new QgsVectorLayer( uri.uri(), layerNames.value( i++, uri.table() ), providerKey ); | |
Q_CHECK_PTR( layer ); | |
if ( ! layer ) | |
@@ -2954,8 +2955,8 @@ void QgisApp::addDatabaseLayers( QStringList const & layerPathList, QString cons | |
} | |
else | |
{ | |
- QgsMessageLog::logMessage( tr( "%1 is an invalid layer - not loaded" ).arg( layerPath ) ); | |
- QLabel *msgLabel = new QLabel( tr( "%1 is an invalid layer and cannot be loaded. Please check the <a href=\"#messageLog\">message log</a> for further info." ).arg( layerPath ), messageBar() ); | |
+ QgsMessageLog::logMessage( tr( "%1 is an invalid layer - not loaded" ).arg( layerUri ) ); | |
+ QLabel *msgLabel = new QLabel( tr( "%1 is an invalid layer and cannot be loaded. Please check the <a href=\"#messageLog\">message log</a> for further info." ).arg( layerUri ), messageBar() ); | |
msgLabel->setWordWrap( true ); | |
connect( msgLabel, SIGNAL( linkActivated( QString ) ), mLogDock, SLOT( show() ) ); | |
messageBar()->pushWidget( msgLabel, | |
@@ -2993,8 +2994,8 @@ void QgisApp::addSpatiaLiteLayer() | |
QMessageBox::warning( this, tr( "SpatiaLite" ), tr( "Cannot get SpatiaLite select dialog from provider." ) ); | |
return; | |
} | |
- connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QString const & ) ), | |
- this, SLOT( addDatabaseLayers( QStringList const &, QString const & ) ) ); | |
+ connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ), | |
+ this, SLOT( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ) ); | |
dbs->exec(); | |
delete dbs; | |
} // QgisApp::addSpatiaLiteLayer() | |
@@ -3039,8 +3040,8 @@ void QgisApp::addMssqlLayer() | |
QMessageBox::warning( this, tr( "MSSQL" ), tr( "Cannot get MSSQL select dialog from provider." ) ); | |
return; | |
} | |
- connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QString const & ) ), | |
- this, SLOT( addDatabaseLayers( QStringList const &, QString const & ) ) ); | |
+ connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ), | |
+ this, SLOT( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ) ); | |
dbs->exec(); | |
delete dbs; | |
#endif | |
@@ -3061,8 +3062,8 @@ void QgisApp::addOracleLayer() | |
QMessageBox::warning( this, tr( "Oracle" ), tr( "Cannot get Oracle select dialog from provider." ) ); | |
return; | |
} | |
- connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QString const & ) ), | |
- this, SLOT( addDatabaseLayers( QStringList const &, QString const & ) ) ); | |
+ connect( dbs, SIGNAL( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ), | |
+ this, SLOT( addDatabaseLayers( QStringList const &, QStringList const &, QString const & ) ) ); | |
connect( dbs, SIGNAL( progress( int, int ) ), | |
this, SLOT( showProgress( int, int ) ) ); | |
connect( dbs, SIGNAL( progressMessage( QString ) ), | |
diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h | |
index e04af84..f8da707 100644 | |
--- a/src/app/qgisapp.h | |
+++ b/src/app/qgisapp.h | |
@@ -624,7 +624,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow | |
void addDatabaseLayer(); | |
//#endif | |
//! Add a list of database layers to the map | |
- void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey ); | |
+ void addDatabaseLayers( QStringList const & layerUris, QStringList const &layerNames, QString const & providerKey ); | |
//! Add a SpatiaLite layer to the map | |
void addSpatiaLiteLayer(); | |
//! Add a Delimited Text layer to the map | |
diff --git a/src/providers/mssql/qgsmssqlsourceselect.cpp b/src/providers/mssql/qgsmssqlsourceselect.cpp | |
index 5cc81ea..8064c0d 100644 | |
--- a/src/providers/mssql/qgsmssqlsourceselect.cpp | |
+++ b/src/providers/mssql/qgsmssqlsourceselect.cpp | |
@@ -439,7 +439,7 @@ void QgsMssqlSourceSelect::addTables() | |
} | |
else | |
{ | |
- emit addDatabaseLayers( mSelectedTables, "mssql" ); | |
+ emit addDatabaseLayers( mSelectedTables, QStringList(), "mssql" ); | |
accept(); | |
} | |
} | |
diff --git a/src/providers/mssql/qgsmssqlsourceselect.h b/src/providers/mssql/qgsmssqlsourceselect.h | |
index 4e50ac3..6a55b37 100644 | |
--- a/src/providers/mssql/qgsmssqlsourceselect.h | |
+++ b/src/providers/mssql/qgsmssqlsourceselect.h | |
@@ -106,7 +106,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase | |
QString connectionInfo(); | |
signals: | |
- void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey ); | |
+ void addDatabaseLayers( QStringList const & layerUris, QStringList const &layerNames, QString const & providerKey ); | |
void connectionsChanged(); | |
void addGeometryColumn( QgsMssqlLayerProperty ); | |
diff --git a/src/providers/oracle/qgsoraclesourceselect.cpp b/src/providers/oracle/qgsoraclesourceselect.cpp | |
index 6d7613a..0397aa2 100644 | |
--- a/src/providers/oracle/qgsoraclesourceselect.cpp | |
+++ b/src/providers/oracle/qgsoraclesourceselect.cpp | |
@@ -433,7 +433,7 @@ void QgsOracleSourceSelect::addTables() | |
} | |
else | |
{ | |
- emit addDatabaseLayers( mSelectedTables, "oracle" ); | |
+ emit addDatabaseLayers( mSelectedTables, QStringList(), "oracle" ); | |
accept(); | |
} | |
} | |
diff --git a/src/providers/oracle/qgsoraclesourceselect.h b/src/providers/oracle/qgsoraclesourceselect.h | |
index 516d583..97673c4 100644 | |
--- a/src/providers/oracle/qgsoraclesourceselect.h | |
+++ b/src/providers/oracle/qgsoraclesourceselect.h | |
@@ -83,7 +83,7 @@ class QgsOracleSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase | |
QString connectionInfo(); | |
signals: | |
- void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey ); | |
+ void addDatabaseLayers( QStringList const & layerUris, QStringList const &layerNames, QString const & providerKey ); | |
void connectionsChanged(); | |
void progress( int, int ); | |
void progressMessage( QString ); | |
diff --git a/src/providers/postgres/qgspgsourceselect.cpp b/src/providers/postgres/qgspgsourceselect.cpp | |
index 3ad444a..fc01823 100644 | |
--- a/src/providers/postgres/qgspgsourceselect.cpp | |
+++ b/src/providers/postgres/qgspgsourceselect.cpp | |
@@ -415,7 +415,7 @@ void QgsPgSourceSelect::addTables() | |
} | |
else | |
{ | |
- emit addDatabaseLayers( mSelectedTables, "postgres" ); | |
+ emit addDatabaseLayers( mSelectedTables, QStringList(), "postgres" ); | |
accept(); | |
} | |
} | |
diff --git a/src/providers/postgres/qgspgsourceselect.h b/src/providers/postgres/qgspgsourceselect.h | |
index 2350fae..1906d8d 100644 | |
--- a/src/providers/postgres/qgspgsourceselect.h | |
+++ b/src/providers/postgres/qgspgsourceselect.h | |
@@ -72,7 +72,7 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase | |
QString connectionInfo(); | |
signals: | |
- void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey ); | |
+ void addDatabaseLayers( QStringList const & layerUris, QStringList const &layerNames, QString const & providerKey ); | |
void connectionsChanged(); | |
void addGeometryColumn( QgsPostgresLayerProperty ); | |
void progress( int, int ); | |
diff --git a/src/providers/spatialite/qgsspatialitesourceselect.cpp b/src/providers/spatialite/qgsspatialitesourceselect.cpp | |
index a1b1ffb..d4f4cd0 100644 | |
--- a/src/providers/spatialite/qgsspatialitesourceselect.cpp | |
+++ b/src/providers/spatialite/qgsspatialitesourceselect.cpp | |
@@ -392,7 +392,7 @@ void QgsSpatiaLiteSourceSelect::addTables() | |
} | |
else | |
{ | |
- emit addDatabaseLayers( m_selectedTables, "spatialite" ); | |
+ emit addDatabaseLayers( m_selectedTables, QStringList(), "spatialite" ); | |
accept(); | |
} | |
} | |
diff --git a/src/providers/spatialite/qgsspatialitesourceselect.h b/src/providers/spatialite/qgsspatialitesourceselect.h | |
index 7b244b7..781edb6 100644 | |
--- a/src/providers/spatialite/qgsspatialitesourceselect.h | |
+++ b/src/providers/spatialite/qgsspatialitesourceselect.h | |
@@ -96,7 +96,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa | |
signals: | |
void connectionsChanged(); | |
- void addDatabaseLayers( QStringList const & paths, QString const & providerKey ); | |
+ void addDatabaseLayers( QStringList const &uris, QStringList const &names, QString const & providerKey ); | |
private: | |
enum columns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment