Index: /trunk/qgis/src/app/qgsfieldcalculator.cpp =================================================================== --- qgis-1.4.0/src/app/qgsfieldcalculator.cpp (revision 12551) +++ /trunk/qgis/src/app/qgsfieldcalculator.cpp (revision 13046) @@ -25,4 +25,9 @@ setupUi( this ); + if ( !vl ) + { + return; + } + populateFields(); populateOutputFieldTypes(); @@ -32,5 +37,5 @@ mOutputFieldPrecisionSpinBox->setValue( 3 ); - mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked ); + //disable ok button until there is text for output field and expression @@ -40,7 +45,13 @@ if ( !( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes ) ) { + mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked ); mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked mNewFieldGroupBox->setEnabled( false ); mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) ); + } + + if ( vl->selectedFeaturesIds().size() > 0 ) + { + mOnlyUpdateSelectedCheckBox->setChecked( true ); }