diff options
Diffstat (limited to 'krecipes/src/dialogs/usdadatadialog.cpp')
-rw-r--r-- | krecipes/src/dialogs/usdadatadialog.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/krecipes/src/dialogs/usdadatadialog.cpp b/krecipes/src/dialogs/usdadatadialog.cpp index 25f74d3..b5bce00 100644 --- a/krecipes/src/dialogs/usdadatadialog.cpp +++ b/krecipes/src/dialogs/usdadatadialog.cpp @@ -17,12 +17,12 @@ #include <klocale.h> #include <kmessagebox.h> -#include <qfile.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qtextstream.h> -#include <qvbox.h> +#include <ntqfile.h> +#include <ntqlabel.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> +#include <ntqtextstream.h> +#include <ntqvbox.h> #include "backends/recipedb.h" #include "backends/usda_property_data.h" @@ -30,19 +30,19 @@ #include "widgets/krelistview.h" #include "datablocks/weight.h" -USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *parent ) - : KDialogBase( parent, "usdaDataDialog", true, QString::null, +USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, TQWidget *parent ) + : KDialogBase( parent, "usdaDataDialog", true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), ingredient( ing ), database( db ) { - setCaption( QString( i18n( "Load ingredient properties for: \"%1\"" ) ).arg( ingredient.name ) ); + setCaption( TQString( i18n( "Load ingredient properties for: \"%1\"" ) ).arg( ingredient.name ) ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); setButtonText( KDialogBase::Ok, i18n( "&Load" ) ); - KreListView *krelistview = new KreListView( page, QString::null, true, 0 ); + KreListView *krelistview = new KreListView( page, TQString::null, true, 0 ); listView = krelistview->listView(); listView->addColumn( i18n( "USDA Ingredient" ) ); @@ -51,7 +51,7 @@ USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *paren loadDataFromFile(); - connect( listView, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), this, SLOT( slotOk() ) ); + connect( listView, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), this, SLOT( slotOk() ) ); } USDADataDialog::~USDADataDialog() @@ -59,32 +59,32 @@ USDADataDialog::~USDADataDialog() void USDADataDialog::loadDataFromFile() { - QString abbrev_file = locate( "appdata", "data/abbrev.txt" ); + TQString abbrev_file = locate( "appdata", "data/abbrev.txt" ); if ( abbrev_file.isEmpty() ) { kdDebug() << "Unable to find abbrev.txt data file." << endl; return ; } - QFile file( abbrev_file ); + TQFile file( abbrev_file ); if ( !file.open( IO_ReadOnly ) ) { kdDebug() << "Unable to open data file: " << abbrev_file << endl; return ; } int index = 0; - QTextStream stream( &file ); + TQTextStream stream( &file ); while ( !stream.atEnd() ) { - QString line = stream.readLine(); + TQString line = stream.readLine(); if ( line.isEmpty() ) { continue; } - QStringList fields = QStringList::split( "^", line, true ); + TQStringList fields = TQStringList::split( "^", line, true ); loaded_data << fields; - QString ing_id = fields[ 0 ].mid( 1, fields[ 1 ].length() - 2 ); - QString ing_name = fields[ 1 ].mid( 1, fields[ 1 ].length() - 2 ); - ( void ) new QListViewItem( listView, ing_name, QString::number( index ) ); //using an index instead of the actual id will help find the data later + TQString ing_id = fields[ 0 ].mid( 1, fields[ 1 ].length() - 2 ); + TQString ing_name = fields[ 1 ].mid( 1, fields[ 1 ].length() - 2 ); + ( void ) new TQListViewItem( listView, ing_name, TQString::number( index ) ); //using an index instead of the actual id will help find the data later index++; } @@ -92,10 +92,10 @@ void USDADataDialog::loadDataFromFile() void USDADataDialog::slotOk() { - QListViewItem * item = listView->selectedItem(); + TQListViewItem * item = listView->selectedItem(); if ( item ) { int index = item->text( 1 ).toInt(); - QStringList data = loaded_data[ index ]; + TQStringList data = loaded_data[ index ]; int grams_id = database->findExistingUnitByName( "g" ); //get this id because all data is given per gram if ( grams_id == -1 ) { @@ -119,7 +119,7 @@ void USDADataDialog::slotOk() database->loadProperties( &existing_ing_props, ingredient.id ); int i = 0; - for ( QStringList::const_iterator it = data.at( 2 ); !property_data_list[ i ].name.isEmpty(); ++it, ++i ) { + for ( TQStringList::const_iterator it = data.at( 2 ); !property_data_list[ i ].name.isEmpty(); ++it, ++i ) { int property_id = property_list.findByName( property_data_list[ i ].name ); if ( property_id == -1 ) { database->addProperty( property_data_list[ i ].name, property_data_list[ i ].unit ); @@ -144,12 +144,12 @@ void USDADataDialog::slotOk() i++; - QString amountAndWeight = data[i].mid( 1, data[i].length() - 2 ); + TQString amountAndWeight = data[i].mid( 1, data[i].length() - 2 ); if ( !amountAndWeight.isEmpty() ) { int spaceIndex = amountAndWeight.find(" "); w.perAmount = amountAndWeight.left(spaceIndex).toDouble(); - QString perAmountUnit = amountAndWeight.right(amountAndWeight.length()-spaceIndex-1); + TQString perAmountUnit = amountAndWeight.right(amountAndWeight.length()-spaceIndex-1); if ( !parseUSDAUnitAndPrep( perAmountUnit, w.perAmountUnit, w.prepMethod ) ) continue; |