Skip to content

Commit

Permalink
fix #2732
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13528 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 18, 2010
1 parent 37a82ab commit 5c10869
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/app/qgisapp.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2541,32 +2541,30 @@ void QgisApp::addVectorLayer()
bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QString& enc, const QString dataSourceType ) bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QString& enc, const QString dataSourceType )
{ {


for ( QStringList::ConstIterator it = theLayerQStringList.begin(); foreach( QString src, theLayerQStringList )
it != theLayerQStringList.end();
++it )
{ {
src = src.trimmed();
QString base; QString base;
if ( dataSourceType == "file" ) if ( dataSourceType == "file" )
{ {
QFileInfo fi( *it ); QFileInfo fi( src );
base = fi.completeBaseName(); base = fi.completeBaseName();
} }
else if ( dataSourceType == "database" ) else if ( dataSourceType == "database" )
{ {
base = *it; base = src;
} }
else //directory //protocol else //directory //protocol
{ {
QFileInfo fi( *it ); QFileInfo fi( src );
base = fi.completeBaseName(); base = fi.completeBaseName();
} }



QgsDebugMsg( "completeBaseName: " + base ); QgsDebugMsg( "completeBaseName: " + base );


// create the layer // create the layer


QgsVectorLayer *layer = new QgsVectorLayer( *it, base, "ogr" ); QgsVectorLayer *layer = new QgsVectorLayer( src, base, "ogr" );
Q_CHECK_PTR( layer ); Q_CHECK_PTR( layer );


if ( ! layer ) if ( ! layer )
Expand Down Expand Up @@ -2610,7 +2608,7 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
} }
else else
{ {
QString msg = tr( "%1 is not a valid or recognized data source" ).arg( *it ); QString msg = tr( "%1 is not a valid or recognized data source" ).arg( src );
QMessageBox::critical( this, tr( "Invalid Data Source" ), msg ); QMessageBox::critical( this, tr( "Invalid Data Source" ), msg );


// since the layer is bad, stomp on it // since the layer is bad, stomp on it
Expand Down

0 comments on commit 5c10869

Please sign in to comment.