Git commit 1831b13d3c8ecfb9b0f35f38fd823b741dddf398 by Jos=C3=A9 Manuel San= tamar=C3=ADa Lema. Committed on 12/07/2016 at 08:12. Pushed by joselema into branch 'master'. Emit the API v2 signals for ingredient headers. M +6 -0 src/backends/qsqlrecipedb.cpp M +11 -4 src/backends/recipedb.h http://commits.kde.org/krecipes/1831b13d3c8ecfb9b0f35f38fd823b741dddf398 diff --git a/src/backends/qsqlrecipedb.cpp b/src/backends/qsqlrecipedb.cpp index 87bfa37..c543b0b 100644 --- a/src/backends/qsqlrecipedb.cpp +++ b/src/backends/qsqlrecipedb.cpp @@ -1245,7 +1245,10 @@ RecipeDB::IdType QSqlRecipeDB::createNewIngGroup( co= nst QString &name ) QSqlQuery query( command, *database); = RecipeDB::IdType last_insert_id =3D lastInsertId( query ); + emit ingGroupCreated( Element( real_name, last_insert_id ) ); + emit ingHeaderCreated( KreIngHeader( QVariant(last_insert_id), real_name = ) ); + return last_insert_id; } = @@ -1299,6 +1302,7 @@ void QSqlRecipeDB::modIngredientGroup( int groupID, c= onst QString &newLabel ) QSqlQuery ingredientToCreate( command, *database); = emit ingGroupModified( Element( newLabel, groupID ) ); + emit ingHeaderModified( KreIngHeader( QVariant(groupID), newLabel ) ); } = void QSqlRecipeDB::modIngredient( int ingredientID, const QString &newLabe= l ) @@ -1430,6 +1434,7 @@ void QSqlRecipeDB::removeIngredientGroup( int groupID= ) toDelete.exec( command ); = emit ingGroupRemoved( groupID ); + emit ingHeaderRemoved( QVariant(groupID) ); } = void QSqlRecipeDB::removeIngredient( int ingredientID ) @@ -2858,6 +2863,7 @@ void QSqlRecipeDB::mergeIngredientGroups( int id1, in= t id2 ) command =3D QString( "DELETE FROM ingredient_groups WHERE id=3D%1" ).arg(= id2 ); update.exec( command ); emit ingGroupRemoved( id2 ); + emit ingHeaderRemoved( QVariant(id2) ); } = void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) diff --git a/src/backends/recipedb.h b/src/backends/recipedb.h index 2ff4599..c703804 100644 --- a/src/backends/recipedb.h +++ b/src/backends/recipedb.h @@ -14,6 +14,7 @@ #define RECIPEDB_H = #include "dtos/kreingredient.h" +#include "dtos/kreingheader.h" #include "datablocks/recipe.h" #include "datablocks/recipelist.h" #include "datablocks/elementlist.h" @@ -121,12 +122,18 @@ signals: void categoryModified( int id, int parent_id ); void categoriesMerged( int id1, int id2 ); = - void ingGroupCreated( const Element & ); - void ingGroupModified( const Element & ); - void ingGroupRemoved( int id ); + //Ingredient headers API v1 signals + /* kRECIPES_DEPRECATED */ void ingGroupCreated( const Element & ); + /* kRECIPES_DEPRECATED */ void ingGroupModified( const Element & ); + /* kRECIPES_DEPRECATED */ void ingGroupRemoved( int id ); + + //Ingredient headers API v2 signals + void ingHeaderCreated( const KreIngHeader & ingHeader ); + void ingHeaderModified( const KreIngHeader & newIngHeader ); + void ingHeaderRemoved( const QVariant & id ); = //Ingredients API v1 signals - /* KRECIPES_DEPRECATED */ void ingredientCreated( const Element & ); + /* kRECIPES_DEPRECATED */ void ingredientCreated( const Element & ); /* KRECIPES_DEPRECATED */ void ingredientModified( const Ingredient & new= Ingredient ); /* KRECIPES_DEPRECATED */ void ingredientRemoved( int id ); =