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

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/dialogs
From:       Jason Kivlighn <confederacy2 () excite ! com>
Date:       2004-02-05 1:53:45
Message-ID: 20040205015345.C2F3B9913 () office ! kde ! org
[Download RAW message or body]

CVS commit by jkivlighn: 

Fixed a bug that caused ingredients not to be imported or to be imported incorrectly \
when there was a blank field in the database file

Separated USDA property data into separate file

Don't show message box when it can't find abbrev.txt (To make the translators lives a \
little easier, and since the file is shipped with the program) 


  M +4 -58     usdadatadialog.cpp   1.3


--- kdenonbeta/krecipes/src/dialogs/usdadatadialog.cpp  #1.2:1.3
@@ -26,59 +26,5 @@
 
 #include "DBBackend/recipedb.h"
-
-struct property_data
-{
-        int id;
-        const char *name;
-        const char *unit;
-};
-
-//NOTE: the following must be in this order
-static property_data property_data_list[] = {
-  {-1,I18N_NOOP("water"),"g"},
-  {-1,I18N_NOOP("energy"),"kcal"},
-  {-1,I18N_NOOP("protein"),"g"},
-  {-1,I18N_NOOP("fat"),"g"},
-  {-1,I18N_NOOP("ash"),"g"},
-  {-1,I18N_NOOP("carbohydrates"),"g"},
-  {-1,I18N_NOOP("dietary fiber"),"g"},
-  {-1,I18N_NOOP("sugar"),"g"},
-  {-1,I18N_NOOP("calcuim"),"mg"},
-  {-1,I18N_NOOP("iron"),"mg"},
-  {-1,I18N_NOOP("magnesium"),"mg"},
-  {-1,I18N_NOOP("phosphorus"),"mg"},
-  {-1,I18N_NOOP("potassium"),"mg"},
-  {-1,I18N_NOOP("sodium"),"mg"},
-  {-1,I18N_NOOP("zinc"),"mg"},
-  {-1,I18N_NOOP("copper"),"mg"},
-  {-1,I18N_NOOP("manganese"),"mg"},
-  {-1,I18N_NOOP("selenium"),"g"},
-  {-1,I18N_NOOP("vitamin C"),"mg"},
-  {-1,I18N_NOOP("thiamin"),"mg"},
-  {-1,I18N_NOOP("riboflavin"),"mg"},
-  {-1,I18N_NOOP("niacin"),"mg"},
-  {-1,I18N_NOOP("pantothenic acid"),"mg"},
-  {-1,I18N_NOOP("vitamin B"),"mg"},
-  {-1,I18N_NOOP("folate"),"g"},
-  {-1,I18N_NOOP("folic acid"),"g"},
-  {-1,I18N_NOOP("food folate"),"g"},
-  {-1,I18N_NOOP("folate (DFE)"),"g"},
-  {-1,I18N_NOOP("vitamin B12"),"g"},
-  {-1,I18N_NOOP("vitamin A (IU)"),"g"},
-  {-1,I18N_NOOP("vitamin A"),"mg"},
-  {-1,I18N_NOOP("retinol"),"g"},
-  {-1,I18N_NOOP("vitamin E"),"g"},
-  {-1,I18N_NOOP("vitamin K"),"g"},
-  {-1,I18N_NOOP("alpha-carotene"),"g"},
-  {-1,I18N_NOOP("beta-carotene"),"g"},
-  {-1,I18N_NOOP("beta-cryptoxanthin"),"g"},
-  {-1,I18N_NOOP("lycopene"),"g"},
-  {-1,I18N_NOOP("lutein+zeazanthin"),"g"},
-  {-1,I18N_NOOP("saturated fat"),"g"},
-  {-1,I18N_NOOP("monounsaturated fat"),"g"},
-  {-1,I18N_NOOP("polyunsaturated fat"),"g"},
-  {-1,I18N_NOOP("cholesterol"),"mg"},
-  { 0, 0, 0 }
-};
+#include "DBBackend/usda_property_data.h"
 
 USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *parent ) \
: KDialog(parent,0,true), @@ -127,8 +73,8 @@ USDADataDialog::~USDADataDialog()
 void USDADataDialog::loadDataFromFile()
 {
-        QString abbrev_file = locate("appdata","abbrev.txt");
+        QString abbrev_file = locate("appdata","data/abbrev.txt");
         if ( abbrev_file.isEmpty() )
         {
-                KMessageBox::error(this,i18n("Unable to find abbrev.txt data \
file.")); +                kdDebug()<<"Unable to find abbrev.txt data file."<<endl;
                 return;
         }
@@ -145,5 +91,5 @@ void USDADataDialog::loadDataFromFile()
         while ( !stream.atEnd() )
         {
-                QStringList fields = QStringList::split( "^", stream.readLine() );
+                QStringList fields = QStringList::split( "^", stream.readLine(), \
true );  loaded_data << fields;
 


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

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