Skip to content

Commit

Permalink
QgsVectorLayerSaveAsDialog: use QgsVectorFileWriter::MetaData::compul…
Browse files Browse the repository at this point in the history
…soryEncoding to initialize the encoding combobox
  • Loading branch information
rouault committed May 19, 2016
1 parent 3ee7d59 commit 1ab2977
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/app/ogr/qgsvectorlayersaveasdialog.cpp
Expand Up @@ -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;
}
Expand All @@ -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" );
}
Expand Down Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit 1ab2977

Please sign in to comment.