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

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/dialogs
From:       Unai Garro <ugarro () telefonica ! net>
Date:       2004-03-25 22:01:10
Message-ID: 20040325220110.87EB1997E () office ! kde ! org
[Download RAW message or body]

CVS commit by uga: 

Classify the recipes by missing ingredient no, and fix some bug setting missing \
amount


  M +24 -5     ingredientmatcherdialog.cpp   1.9


--- kdenonbeta/krecipes/src/dialogs/ingredientmatcherdialog.cpp  #1.8:1.9
@@ -21,4 +21,5 @@
 #include <klocale.h>
 
+#include <iostream>
 IngredientMatcherDialog::IngredientMatcherDialog(QWidget *parent,RecipeDB \
*db):QVBox(parent)  {
@@ -120,7 +121,10 @@ void IngredientMatcherDialog::findRecipe
                         new RecipeListItem(recipeListView->listView(),*it);
                         }
-                else incompleteRecipes.append(*it);
+                else 
+                        {
+                        incompleteRecipes.append(*it);
                 missingNumbers.append(missing.count());
                 }
+                }
 
         //Check if the user wants to show missing ingredients
@@ -129,5 +133,5 @@ void IngredientMatcherDialog::findRecipe
         
         
-        new SectionItem(recipeListView->listView(),i18n("You are missing some \
ingredients for:")); +        
         
         // Classify recipes with missing ingredients in different lists by ammount
@@ -138,11 +142,26 @@ void IngredientMatcherDialog::findRecipe
         else missingNoAllowed=-1; // "Any"
         
+        std::cerr<<"missingNoAllowed: "<<missingNoAllowed<<"\n";
+        
+        for (int missingNo=1; missingNo<=missingNoAllowed; missingNo++)
+        {
+                std::cerr<<"missingNo: "<<missingNo<<"\n";
         nit=missingNumbers.begin();     
+                bool titleShownYet=false;
         
                 for \
(it=incompleteRecipes.begin();it!=incompleteRecipes.end();++it,++nit)  {
-                        if (missingNoAllowed<0||(*nit)<=missingNoAllowed)
+                std::cerr<<"*nit: "<<*nit<<"missingNo:"<<missingNo<<"\n";
+                        if ((*nit)==missingNo) 
+                                {       
+                                        if (!titleShownYet)
+                                        {
+                                                new \
SectionItem(recipeListView->listView(),i18n("You are missing %1 ingredients \
for:").arg(missingNo)); +                                                \
titleShownYet=true; +                                        }
                                 new RecipeListItem(recipeListView->listView(),*it);
                 }
+                }
+        }
         
 }


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

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