@@ -801,7 +801,7 @@ void QgisApp::createActions()
801
801
mActionLayerSelectionSaveAs ->setStatusTip ( tr ( " Save the selection as a shapefile" ) );
802
802
connect ( mActionLayerSelectionSaveAs , SIGNAL ( triggered () ), this , SLOT ( saveSelectionAsShapefile () ) );
803
803
mActionLayerSelectionSaveAs ->setEnabled ( false );
804
-
804
+
805
805
mActionRemoveLayer = new QAction ( getThemeIcon ( " mActionRemoveLayer.png" ), tr ( " Remove Layer" ), this );
806
806
mActionRemoveLayer ->setShortcut ( tr ( " Ctrl+D" , " Remove a Layer" ) );
807
807
mActionRemoveLayer ->setStatusTip ( tr ( " Remove a Layer" ) );
@@ -2173,15 +2173,16 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
2173
2173
2174
2174
// If the newly created layer has more than 1 layer of data available, we show the
2175
2175
// sublayers selection dialog so the user can select the sublayers to actually load.
2176
- if ( sublayers.count () > 1 )
2177
- {
2178
- askUserForSublayers (layer);
2176
+ if ( sublayers.count () > 1 )
2177
+ {
2178
+ askUserForSublayers ( layer );
2179
2179
2180
- // The first layer loaded is not usefull in that case. The user can select it in
2180
+ // The first layer loaded is not usefull in that case. The user can select it in
2181
2181
// the list if he wants to load it.
2182
2182
delete layer;
2183
2183
2184
- }else // there is 1 layer of data available
2184
+ }
2185
+ else // there is 1 layer of data available
2185
2186
{
2186
2187
// Register this layer with the layers registry
2187
2188
QgsMapLayerRegistry::instance ()->addMapLayer ( layer );
@@ -2219,57 +2220,57 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
2219
2220
} // QgisApp::addVectorLayer()
2220
2221
2221
2222
// This method is the method that does the real job. If the layer given in
2222
- // parameter is NULL, then the method tries to act on the activeLayer.
2223
- void QgisApp::askUserForSublayers (QgsVectorLayer *layer)
2223
+ // parameter is NULL, then the method tries to act on the activeLayer.
2224
+ void QgisApp::askUserForSublayers ( QgsVectorLayer *layer )
2224
2225
{
2225
- if (layer == NULL )
2226
+ if ( layer == NULL )
2226
2227
{
2227
- if (activeLayer () == NULL || activeLayer ()->type () != QgsMapLayer::VectorLayer)
2228
+ if ( activeLayer () == NULL || activeLayer ()->type () != QgsMapLayer::VectorLayer )
2228
2229
return ;
2229
-
2230
- layer = (QgsVectorLayer*) activeLayer ();
2231
- if (layer->dataProvider ()->name () != " ogr" )
2230
+
2231
+ layer = ( QgsVectorLayer* ) activeLayer ();
2232
+ if ( layer->dataProvider ()->name () != " ogr" )
2232
2233
return ;
2233
2234
}
2234
-
2235
+
2235
2236
QStringList sublayers = layer->dataProvider ()->subLayers ();
2236
2237
2237
2238
// We initialize a selection dialog and display it.
2238
2239
QgsOGRSublayersDialog chooseSublayersDialog ( this );
2239
2240
chooseSublayersDialog.populateLayerTable ( sublayers );
2240
-
2241
- if (chooseSublayersDialog.exec ())
2241
+
2242
+ if ( chooseSublayersDialog.exec () )
2242
2243
{
2243
2244
QString uri = layer->source ();
2244
- if ( uri.contains (' &' , Qt::CaseSensitive) )
2245
+ if ( uri.contains ( ' &' , Qt::CaseSensitive ) )
2245
2246
{
2246
2247
// If we get here, there are some options added to the filename.
2247
2248
// A valid uri is of the form: filename&option1=value1&option2=value2,...
2248
2249
// We want only the filename here, so we get the first part of the split.
2249
- QStringList theURIParts = uri.split (" &" );
2250
+ QStringList theURIParts = uri.split ( " &" );
2250
2251
uri = theURIParts.at ( 0 );
2251
2252
}
2252
-
2253
+
2253
2254
// the user has done his choice
2254
- loadOGRSublayers (uri, chooseSublayersDialog.getSelection ());
2255
+ loadOGRSublayers ( uri, chooseSublayersDialog.getSelection () );
2255
2256
}
2256
2257
}
2257
2258
2258
- // This method will load with OGR the layers in parameter.
2259
+ // This method will load with OGR the layers in parameter.
2259
2260
// This method has been conceived to use the new URI
2260
2261
// format of the ogrprovider so as to give precisions about which
2261
2262
// sublayer to load into QGIS. It is normally triggered by the
2262
2263
// sublayer selection dialog.
2263
- void QgisApp::loadOGRSublayers ( QString uri, QStringList list)
2264
+ void QgisApp::loadOGRSublayers ( QString uri, QStringList list )
2264
2265
{
2265
2266
// The uri must contain the actual uri of the vectorLayer from which we are
2266
2267
// going to load the sublayers.
2267
- QString fileName = QFileInfo (uri).baseName ();
2268
- for (int i = 0 ; i < list.size (); i++)
2269
- {
2270
- QString composedURI= uri+ " &layername=" + list.at (i );
2271
- QgsVectorLayer *layer= addVectorLayer (composedURI,fileName+ " :" + list.at (i), " ogr" );
2272
- }
2268
+ QString fileName = QFileInfo ( uri ).baseName ();
2269
+ for ( int i = 0 ; i < list.size (); i++ )
2270
+ {
2271
+ QString composedURI = uri + " &layername=" + list.at ( i );
2272
+ QgsVectorLayer *layer = addVectorLayer ( composedURI, fileName + " :" + list.at ( i ), " ogr" );
2273
+ }
2273
2274
}
2274
2275
2275
2276
/* * This helper checks to see whether the file name appears to be a valid vector file name */
0 commit comments