[QGIS Commit] r15518 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Mar 16 09:21:34 EDT 2011
Author: jef
Date: 2011-03-16 06:21:34 -0700 (Wed, 16 Mar 2011)
New Revision: 15518
Modified:
trunk/qgis/src/core/qgsvectorfilewriter.cpp
Log:
allow multiple extensions in save as (eg. for mapinfo mif/tab)
Modified: trunk/qgis/src/core/qgsvectorfilewriter.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorfilewriter.cpp 2011-03-16 11:46:15 UTC (rev 15517)
+++ trunk/qgis/src/core/qgsvectorfilewriter.cpp 2011-03-16 13:21:34 UTC (rev 15518)
@@ -130,13 +130,24 @@
QString longName;
QString trLongName;
QString glob;
- QString ext;
- if ( QgsVectorFileWriter::driverMetadata( driverName, longName, trLongName, glob, ext ) )
+ QString exts;
+ if ( QgsVectorFileWriter::driverMetadata( driverName, longName, trLongName, glob, exts ) )
{
- if ( !vectorFileName.endsWith( "." + ext, Qt::CaseInsensitive ) )
+ QStringList allExts = exts.split( " ", QString::SkipEmptyParts );
+ bool found = false;
+ foreach( QString ext, allExts )
{
- vectorFileName += "." + ext;
+ if ( vectorFileName.endsWith( "." + ext, Qt::CaseInsensitive ) )
+ {
+ found = true;
+ break;
+ }
}
+
+ if ( !found )
+ {
+ vectorFileName += "." + exts[0];
+ }
}
QFile::remove( vectorFileName );
@@ -760,8 +771,8 @@
QString longName;
QString trLongName;
QString glob;
- QString ext;
- if ( QgsVectorFileWriter::driverMetadata( drvName, longName, trLongName, glob, ext ) && !trLongName.isEmpty() )
+ QString exts;
+ if ( QgsVectorFileWriter::driverMetadata( drvName, longName, trLongName, glob, exts ) && !trLongName.isEmpty() )
{
resultMap.insert( trLongName, drvName );
}
@@ -792,8 +803,8 @@
QString longName;
QString trLongName;
QString glob;
- QString ext;
- if ( !driverMetadata( driverName, longName, trLongName, glob, ext ) || trLongName.isEmpty() || glob.isEmpty() )
+ QString exts;
+ if ( !driverMetadata( driverName, longName, trLongName, glob, exts ) || trLongName.isEmpty() || glob.isEmpty() )
return "";
return trLongName + " [OGR] (" + glob.toLower() + " " + glob.toUpper() + ")";
@@ -897,7 +908,7 @@
longName = "Mapinfo File";
trLongName = QObject::tr( "Mapinfo File" );
glob = "*.mif *.tab";
- ext = "mif" ;
+ ext = "mif tab";
}
else if ( driverName.startsWith( "DGN" ) )
{
More information about the QGIS-commit
mailing list