@@ -611,7 +611,7 @@ void QgisApp::dropEvent( QDropEvent *event )
611
611
else
612
612
{
613
613
QgsDebugMsg ( " Adding " + fileName + " to the map canvas" );
614
- openLayer ( fileName );
614
+ openLayer ( fileName , true );
615
615
}
616
616
}
617
617
}
@@ -3403,17 +3403,28 @@ void QgisApp::openProject( const QString & fileName )
3403
3403
Used to process a commandline argument or OpenDocument AppleEvent.
3404
3404
@returns true if the file is successfully opened
3405
3405
*/
3406
- bool QgisApp::openLayer ( const QString & fileName )
3406
+ bool QgisApp::openLayer ( const QString & fileName, bool allowInteractive )
3407
3407
{
3408
3408
QFileInfo fileInfo ( fileName );
3409
3409
3410
3410
// try to load it as raster
3411
- QgsMapLayer* ok = NULL ;
3411
+ bool ok ( false ) ;
3412
3412
CPLPushErrorHandler ( CPLQuietErrorHandler );
3413
3413
if ( QgsRasterLayer::isValidRasterFileName ( fileName ) )
3414
- ok = addRasterLayer ( fileName, fileInfo.completeBaseName () );
3414
+ {
3415
+ ok = (addRasterLayer ( fileName, fileInfo.completeBaseName () ) != NULL );
3416
+ }
3415
3417
else // nope - try to load it as a shape/ogr
3416
- ok = addVectorLayer ( fileName, fileInfo.completeBaseName (), " ogr" );
3418
+ {
3419
+ if (allowInteractive)
3420
+ {
3421
+ ok = addVectorLayers (QStringList (fileName), " System" , " file" );
3422
+ }
3423
+ else
3424
+ {
3425
+ ok = (addVectorLayer ( fileName, fileInfo.completeBaseName (), " ogr" ) != NULL );
3426
+ }
3427
+ }
3417
3428
3418
3429
CPLPopErrorHandler ();
3419
3430
0 commit comments