void QgsVectorLayerEditBuffer::handleAttributeAdded( int index )
{
  // go through the changed attributes map and adapt indices
  for ( int i = 0; i < mChangedAttributeValues.size(); ++i )
  {
    updateAttributeMapIndex( mChangedAttributeValues[i], index, + 1 );
  }

  // go through added features and adapt attributes
  QgsFeatureMap::iterator featureIt = mAddedFeatures.begin();
  for ( ; featureIt != mAddedFeatures.end(); ++featureIt )
  {
    QgsAttributes& attrs = featureIt->attributes();
    attrs.insert( index, QVariant() );
  }
}
void QgsVectorLayerEditBuffer::handleAttributeDeleted( int index )
{
  // go through the changed attributes map and adapt indices
  for ( int i = 0; i < mChangedAttributeValues.size(); ++i )
  {
    QgsAttributeMap& attrMap = mChangedAttributeValues[i];
    // remove the attribute
    if ( attrMap.contains( index ) )
      attrMap.remove( index );

    // update attribute indices
    updateAttributeMapIndex( attrMap, index, -1 );
  }

  // go through added features and adapt attributes
  QgsFeatureMap::iterator featureIt = mAddedFeatures.begin();
  for ( ; featureIt != mAddedFeatures.end(); ++featureIt )
  {
    QgsAttributes& attrs = featureIt->attributes();
    attrs.remove( index );
  }
}