Skip to content

Commit

Permalink
fix #1644
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@10605 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 20, 2009
1 parent 20edfed commit d72d5ab
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2188,11 +2188,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )

// adjust the display name for postgres layers
QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\" \\(([^)]+)\\)" );
reg.indexIn( name() );
QStringList stuff = reg.capturedTexts();
QString lName = stuff[1];
if ( stuff.size() == 3 )
if ( reg.indexIn( name() ) >= 0 )
{
QStringList stuff = reg.capturedTexts();
QString lName = stuff[1];

const QMap<QString, QgsMapLayer*> &layers = QgsMapLayerRegistry::instance()->mapLayers();

QMap<QString, QgsMapLayer*>::const_iterator it;
Expand All @@ -2201,10 +2201,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )

if ( it != layers.constEnd() )
lName += "." + stuff[2];

if ( !lName.isEmpty() )
setLayerName( lName );
}
else if ( lName.length() == 0 ) // fallback
lName = name();
setLayerName( lName );

QgsDebugMsg( "Beautifying layer name " + name() );

// deal with unnecessary schema qualification to make v.in.ogr happy
Expand Down

0 comments on commit d72d5ab

Please sign in to comment.