Skip to content

Commit

Permalink
fix postgres layer beautification
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14258 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 19, 2010
1 parent 9b66c97 commit f2db6a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2550,7 +2550,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
QgsDebugMsg( "Beautifying layer name " + name() );

// adjust the display name for postgres layers
QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\" \\(([^)]+)\\)" );
QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\"( \\([^)]+\\))?" );
if ( reg.indexIn( name() ) >= 0 )
{
QStringList stuff = reg.capturedTexts();
Expand All @@ -2562,14 +2562,16 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; it++ )
;

if ( it != layers.constEnd() )
lName += "." + stuff[2];
if ( it != layers.constEnd() && stuff.size() > 2 )
{
lName += "." + stuff[2].mid( 2, stuff[2].length() - 3 );
}

if ( !lName.isEmpty() )
setLayerName( lName );
}

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

// deal with unnecessary schema qualification to make v.in.ogr happy
mDataSource = mDataProvider->dataSourceUri();
Expand Down

0 comments on commit f2db6a5

Please sign in to comment.