Skip to content
Permalink
Browse files
fix postgres layer beautification
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 f2db6a50d8434d4a40cf92a12a4d21d444ef8f63
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/core/qgsvectorlayer.cpp
@@ -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();
@@ -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();

0 comments on commit f2db6a5

Please sign in to comment.