Skip to content

Commit d5ae165

Browse files
author
jef
committed
allow multiple extensions in save as (eg. for mapinfo mif/tab)
git-svn-id: http://svn.osgeo.org/qgis/trunk@15518 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5003810 commit d5ae165

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/core/qgsvectorfilewriter.cpp

+20-9
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,23 @@ QgsVectorFileWriter::QgsVectorFileWriter(
130130
QString longName;
131131
QString trLongName;
132132
QString glob;
133-
QString ext;
134-
if ( QgsVectorFileWriter::driverMetadata( driverName, longName, trLongName, glob, ext ) )
133+
QString exts;
134+
if ( QgsVectorFileWriter::driverMetadata( driverName, longName, trLongName, glob, exts ) )
135135
{
136-
if ( !vectorFileName.endsWith( "." + ext, Qt::CaseInsensitive ) )
136+
QStringList allExts = exts.split( " ", QString::SkipEmptyParts );
137+
bool found = false;
138+
foreach( QString ext, allExts )
137139
{
138-
vectorFileName += "." + ext;
140+
if ( vectorFileName.endsWith( "." + ext, Qt::CaseInsensitive ) )
141+
{
142+
found = true;
143+
break;
144+
}
145+
}
146+
147+
if ( !found )
148+
{
149+
vectorFileName += "." + exts[0];
139150
}
140151
}
141152

@@ -760,8 +771,8 @@ QMap<QString, QString> QgsVectorFileWriter::ogrDriverList()
760771
QString longName;
761772
QString trLongName;
762773
QString glob;
763-
QString ext;
764-
if ( QgsVectorFileWriter::driverMetadata( drvName, longName, trLongName, glob, ext ) && !trLongName.isEmpty() )
774+
QString exts;
775+
if ( QgsVectorFileWriter::driverMetadata( drvName, longName, trLongName, glob, exts ) && !trLongName.isEmpty() )
765776
{
766777
resultMap.insert( trLongName, drvName );
767778
}
@@ -792,8 +803,8 @@ QString QgsVectorFileWriter::filterForDriver( const QString& driverName )
792803
QString longName;
793804
QString trLongName;
794805
QString glob;
795-
QString ext;
796-
if ( !driverMetadata( driverName, longName, trLongName, glob, ext ) || trLongName.isEmpty() || glob.isEmpty() )
806+
QString exts;
807+
if ( !driverMetadata( driverName, longName, trLongName, glob, exts ) || trLongName.isEmpty() || glob.isEmpty() )
797808
return "";
798809

799810
return trLongName + " [OGR] (" + glob.toLower() + " " + glob.toUpper() + ")";
@@ -897,7 +908,7 @@ bool QgsVectorFileWriter::driverMetadata( QString driverName, QString &longName,
897908
longName = "Mapinfo File";
898909
trLongName = QObject::tr( "Mapinfo File" );
899910
glob = "*.mif *.tab";
900-
ext = "mif" ;
911+
ext = "mif tab";
901912
}
902913
else if ( driverName.startsWith( "DGN" ) )
903914
{

0 commit comments

Comments
 (0)