Skip to content
Permalink
Browse files

QgsVectorLayerSaveAsDialog: use QgsVectorFileWriter::MetaData::compul…

…soryEncoding to initialize the encoding combobox
  • Loading branch information
rouault committed May 19, 2016
1 parent 3ee7d59 commit 1ab29771b79e54f4f8ee5b6220aed51c967e80ee
Showing with 23 additions and 3 deletions.
  1. +23 −3 src/app/ogr/qgsvectorlayersaveasdialog.cpp
@@ -228,8 +228,6 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx

if ( format() == "KML" )
{
mEncodingComboBox->setCurrentIndex( mEncodingComboBox->findText( "UTF-8" ) );
mEncodingComboBox->setDisabled( true );
mAttributesSelection->setEnabled( true );
selectAllFields = false;
}
@@ -240,7 +238,6 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
}
else
{
mEncodingComboBox->setEnabled( true );
mAttributesSelection->setEnabled( true );
fieldsAsDisplayedValues = ( format() == "CSV" || format() == "XLS" || format() == "XLSX" || format() == "ODS" );
}
@@ -372,6 +369,29 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
{
mLayerOptionsGroupBox->setVisible( false );
}

if ( driverMetaData.compulsoryEncoding.isEmpty() )
{
mEncodingComboBox->setEnabled( true );
}
else
{
int idx = mEncodingComboBox->findText( driverMetaData.compulsoryEncoding );
if ( idx >= 0 )
{
mEncodingComboBox->setCurrentIndex( idx );
mEncodingComboBox->setDisabled( true );
}
else
{
mEncodingComboBox->setEnabled( true );
}
}

}
else
{
mEncodingComboBox->setEnabled( true );
}
}

0 comments on commit 1ab2977

Please sign in to comment.
You can’t perform that action at this time.