Index: src/app/qgsattributedialog.cpp =================================================================== --- src/app/qgsattributedialog.cpp (revision 14799) +++ src/app/qgsattributedialog.cpp (working copy) @@ -43,6 +43,7 @@ #include int QgsAttributeDialog::smFormCounter = 0; +QCheckBox *cbxReuseValues; QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner ) : mDialog( 0 ) @@ -99,11 +100,29 @@ mFrame->setFrameShape( QFrame::StyledPanel ); mFrame->setFrameShadow( QFrame::Raised ); - gridLayout->addWidget( mFrame, 0, 0, 1, 1 ); + gridLayout->addWidget( mFrame, 0, 0, 1, 2 ); + cbxReuseValues = new QCheckBox( "Save values for next time", mDialog ); + cbxReuseValues->setEnabled( true ); + + QSettings settings; + // read the digitizing settings + bool reuseLastValues = settings.value( "/qgis/digitizing/reuseLastValues", false ).toBool(); + if ( reuseLastValues) + { + cbxReuseValues->setCheckState( Qt::Checked ); + } + else + { + cbxReuseValues->setCheckState( Qt::Unchecked ); + } + + mFrame->setObjectName( QString::fromUtf8( "cbxRememberLastValues" ) ); + gridLayout->addWidget( cbxReuseValues, 2 , 0 , 1 , 1 ); + buttonBox = new QDialogButtonBox( mDialog ); buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) ); - gridLayout->addWidget( buttonBox, 2, 0, 1, 1 ); + gridLayout->addWidget( buttonBox, 2, 1, 1, 1 ); // //Set up dynamic inside a scroll box @@ -279,6 +298,12 @@ if ( !mLayer->isEditable() || !mFeature ) return; + QSettings settings; + settings.setValue( "/qgis/digitizing/reuseLastValues", cbxReuseValues->isChecked() ); +#ifdef QGISDEBUG + QgsDebugMsg( QString( "reuseLastValues bool: %1" ).arg( cbxReuseValues->isChecked() ) ); +#endif + //write the new values back to the feature QgsAttributeMap myAttributes = mFeature->attributeMap(); int myIndex = 0; @@ -292,6 +317,8 @@ ++myIndex; } + + } int QgsAttributeDialog::exec() Index: src/app/qgsfeatureaction.cpp =================================================================== --- src/app/qgsfeatureaction.cpp (revision 14799) +++ src/app/qgsfeatureaction.cpp (working copy) @@ -136,7 +136,6 @@ QSettings settings; bool reuseLastValues = settings.value( "/qgis/digitizing/reuseLastValues", false ).toBool(); - QgsDebugMsg( QString( "reuseLastValues: %1" ).arg( reuseLastValues ) ); // add the fields to the QgsFeature const QgsFieldMap fields = mLayer->pendingFields(); @@ -165,25 +164,17 @@ } else { - QgsAttributeMap origValues; - if ( reuseLastValues ) - origValues = mFeature.attributeMap(); - QgsAttributeDialog *dialog = newDialog( false ); if ( dialog->exec() ) { + reuseLastValues = settings.value( "/qgis/digitizing/reuseLastValues", false ).toBool(); if ( reuseLastValues ) { for ( QgsFieldMap::const_iterator it = fields.constBegin(); it != fields.constEnd(); ++it ) { const QgsAttributeMap &newValues = mFeature.attributeMap(); - if ( newValues.contains( it.key() ) - && origValues.contains( it.key() ) - && origValues[ it.key()] != newValues[ it.key()] ) - { - QgsDebugMsg( QString( "saving %1 for %2" ).arg( mLastUsedValues[ mLayer ][ it.key()].toString() ).arg( it.key() ) ); - mLastUsedValues[ mLayer ][ it.key()] = newValues[ it.key()]; - } + QgsDebugMsg( QString( "saving %1 for %2" ).arg( mLastUsedValues[ mLayer ][ it.key()].toString() ).arg( it.key() ) ); + mLastUsedValues[ mLayer ][ it.key()] = newValues[ it.key()]; } }