Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jef committed Mar 16, 2011
1 parent 5003810 commit d5ae165
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -130,12 +130,23 @@ QgsVectorFileWriter::QgsVectorFileWriter(
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];
}
}

Expand Down Expand Up @@ -760,8 +771,8 @@ QMap<QString, QString> QgsVectorFileWriter::ogrDriverList()
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 );
}
Expand Down Expand Up @@ -792,8 +803,8 @@ QString QgsVectorFileWriter::filterForDriver( const QString& driverName )
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() + ")";
Expand Down Expand Up @@ -897,7 +908,7 @@ bool QgsVectorFileWriter::driverMetadata( QString driverName, QString &longName,
longName = "Mapinfo File";
trLongName = QObject::tr( "Mapinfo File" );
glob = "*.mif *.tab";
ext = "mif" ;
ext = "mif tab";
}
else if ( driverName.startsWith( "DGN" ) )
{
Expand Down

0 comments on commit d5ae165

Please sign in to comment.