[QGIS Commit] r14258 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Sep 19 16:20:06 EDT 2010
Author: jef
Date: 2010-09-19 20:20:06 +0000 (Sun, 19 Sep 2010)
New Revision: 14258
Modified:
trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
fix postgres layer beautification
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2010-09-19 19:02:18 UTC (rev 14257)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2010-09-19 20:20:06 UTC (rev 14258)
@@ -2550,7 +2550,7 @@
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 @@
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();
More information about the QGIS-commit
mailing list