[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/krecipes
From:       José Manuel Santamaría Lema <panfaust () gmail ! com>
Date:       2009-10-31 21:55:15
Message-ID: 1257026115.885124.24507.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1043153 by joselema:

When removing a category a recipe is moved to the "Uncategorized" folder (we're
talking only about the UI) only if the recipe is not included in other
categories.


 _M            . (directory)  
 M  +3 -0      ChangeLog  
 M  +13 -9     src/widgets/recipelistview.cpp  


--- trunk/extragear/utils/krecipes/ChangeLog #1043152:1043153
@@ -4,6 +4,9 @@
     + Uncategorized recipes are displayed when using MySQL 4, this fixes
       sourceforge #2878934. Thanks to Mike Ferguson for his help and feedback
       about this bug.
+    + When removing a category a recipe is moved to the "Uncategorized" folder
+      (we're talking only about the UI) only if the recipe is not included in
+      other categories.
 
 Changes from 2.0-alpha3 to 2.0-alpha4:
   * Fixed issues reported by Krazy in the user manual. Note that the user
--- trunk/extragear/utils/krecipes/src/widgets/recipelistview.cpp #1043152:1043153
@@ -426,20 +426,24 @@
 void RecipeListView::moveChildrenToRoot( Q3ListViewItem *item )
 {
 	Q3ListViewItem * next_sibling;
+	Recipe recipe;
 	for ( Q3ListViewItem * it = item->firstChild(); it; it = next_sibling ) {
 		next_sibling = it->nextSibling();
 		if ( it->rtti() == 1000 ) {
 			RecipeListItem *recipe_it = (RecipeListItem*) it;
-			Recipe r;
-			r.title = recipe_it->title(); r.recipeID = recipe_it->recipeID();
+			removeElement(it,false);
 
-			//the item is now uncategorized
-			removeElement(it,false);
-			it->parent() ->takeItem( it );
-			if ( !m_uncat_item && curr_offset == 0 )
-				m_uncat_item = new UncategorizedItem(this);
-			if ( m_uncat_item )
-				new RecipeListItem(m_uncat_item,r);
+			//the item is now uncategorized if it's not part of other categories
+			database->loadRecipe( &recipe,
+				RecipeDB::Title|RecipeDB::Categories, recipe_it->recipeID() );
+
+			if ( recipe.categoryList.isEmpty() ) {
+				it->parent() ->takeItem( it );
+				if ( !m_uncat_item && curr_offset == 0 )
+					m_uncat_item = new UncategorizedItem(this);
+				if ( m_uncat_item )
+					new RecipeListItem(m_uncat_item,recipe);
+			}
 		}
 		moveChildrenToRoot( it );
 		delete it;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic