From 5f9410ae910e73f8966318d1e1b9be03a5651118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 31 Jul 2013 17:02:11 +0200 Subject: Initial TQt conversion --- acinclude.m4 | 48 +- krecipes/src/backends/MySQL/mysqlrecipedb.cpp | 184 +-- krecipes/src/backends/MySQL/mysqlrecipedb.h | 16 +- krecipes/src/backends/PostgreSQL/psqlrecipedb.cpp | 160 +-- krecipes/src/backends/PostgreSQL/psqlrecipedb.h | 20 +- .../backends/SQLite/libqsqlite/krecqsqlitedb.cpp | 30 +- .../src/backends/SQLite/libqsqlite/krecqsqlitedb.h | 18 +- .../SQLite/libqsqlite/krecqsqliteresult.cpp | 74 +- .../backends/SQLite/libqsqlite/krecqsqliteresult.h | 62 +- krecipes/src/backends/SQLite/literecipedb.cpp | 210 ++-- krecipes/src/backends/SQLite/literecipedb.h | 20 +- krecipes/src/backends/SQLite/qsql_sqlite.cpp | 156 +-- krecipes/src/backends/SQLite/qsql_sqlite.h | 44 +- krecipes/src/backends/progressinterface.cpp | 12 +- krecipes/src/backends/progressinterface.h | 14 +- krecipes/src/backends/qsqlrecipedb.cpp | 1224 ++++++++++---------- krecipes/src/backends/qsqlrecipedb.h | 126 +- krecipes/src/backends/recipedb.cpp | 246 ++-- krecipes/src/backends/recipedb.h | 126 +- krecipes/src/backends/searchparameters.h | 30 +- krecipes/src/backends/usda_ingredient_data.h | 4 +- krecipes/src/backends/usda_property_data.h | 2 +- krecipes/src/backends/usda_unit_data.h | 4 +- krecipes/src/convert_sqlite3.cpp | 28 +- krecipes/src/convert_sqlite3.h | 8 +- krecipes/src/datablocks/constraintlist.h | 8 +- krecipes/src/datablocks/element.cpp | 2 +- krecipes/src/datablocks/element.h | 6 +- krecipes/src/datablocks/elementlist.cpp | 18 +- krecipes/src/datablocks/elementlist.h | 16 +- krecipes/src/datablocks/ingredient.cpp | 16 +- krecipes/src/datablocks/ingredient.h | 16 +- krecipes/src/datablocks/ingredientlist.cpp | 36 +- krecipes/src/datablocks/ingredientlist.h | 14 +- krecipes/src/datablocks/ingredientproperty.cpp | 2 +- krecipes/src/datablocks/ingredientproperty.h | 8 +- krecipes/src/datablocks/ingredientpropertylist.cpp | 4 +- krecipes/src/datablocks/ingredientpropertylist.h | 6 +- krecipes/src/datablocks/kreborder.cpp | 2 +- krecipes/src/datablocks/kreborder.h | 10 +- krecipes/src/datablocks/mixednumber.cpp | 30 +- krecipes/src/datablocks/mixednumber.h | 14 +- krecipes/src/datablocks/rating.cpp | 18 +- krecipes/src/datablocks/rating.h | 18 +- krecipes/src/datablocks/recipe.cpp | 18 +- krecipes/src/datablocks/recipe.h | 28 +- krecipes/src/datablocks/recipelist.cpp | 2 +- krecipes/src/datablocks/recipelist.h | 4 +- krecipes/src/datablocks/unit.cpp | 20 +- krecipes/src/datablocks/unit.h | 20 +- krecipes/src/datablocks/unitratiolist.h | 4 +- krecipes/src/datablocks/weight.h | 14 +- krecipes/src/dialogs/advancedsearchdialog.cpp | 440 +++---- krecipes/src/dialogs/advancedsearchdialog.h | 220 ++-- krecipes/src/dialogs/authorsdialog.cpp | 10 +- krecipes/src/dialogs/authorsdialog.h | 16 +- krecipes/src/dialogs/borderdialog.cpp | 56 +- krecipes/src/dialogs/borderdialog.h | 38 +- krecipes/src/dialogs/categorieseditordialog.cpp | 10 +- krecipes/src/dialogs/categorieseditordialog.h | 20 +- krecipes/src/dialogs/conversiondialog.cpp | 48 +- krecipes/src/dialogs/conversiondialog.h | 22 +- krecipes/src/dialogs/createcategorydialog.cpp | 28 +- krecipes/src/dialogs/createcategorydialog.h | 18 +- krecipes/src/dialogs/createelementdialog.cpp | 14 +- krecipes/src/dialogs/createelementdialog.h | 14 +- .../src/dialogs/createingredientweightdialog.cpp | 34 +- .../src/dialogs/createingredientweightdialog.h | 24 +- krecipes/src/dialogs/createpropertydialog.cpp | 20 +- krecipes/src/dialogs/createpropertydialog.h | 24 +- krecipes/src/dialogs/createunitdialog.cpp | 32 +- krecipes/src/dialogs/createunitdialog.h | 14 +- krecipes/src/dialogs/dbimportdialog.cpp | 90 +- krecipes/src/dialogs/dbimportdialog.h | 70 +- krecipes/src/dialogs/dependanciesdialog.cpp | 38 +- krecipes/src/dialogs/dependanciesdialog.h | 18 +- krecipes/src/dialogs/dietviewdialog.cpp | 54 +- krecipes/src/dialogs/dietviewdialog.h | 12 +- krecipes/src/dialogs/dietwizarddialog.cpp | 190 +-- krecipes/src/dialogs/dietwizarddialog.h | 102 +- krecipes/src/dialogs/editratingdialog.cpp | 88 +- krecipes/src/dialogs/editratingdialog.h | 48 +- krecipes/src/dialogs/ingredientgroupsdialog.cpp | 34 +- krecipes/src/dialogs/ingredientgroupsdialog.h | 6 +- krecipes/src/dialogs/ingredientmatcherdialog.cpp | 92 +- krecipes/src/dialogs/ingredientmatcherdialog.h | 60 +- krecipes/src/dialogs/ingredientparserdialog.cpp | 98 +- krecipes/src/dialogs/ingredientparserdialog.h | 30 +- krecipes/src/dialogs/ingredientsdialog.cpp | 228 ++-- krecipes/src/dialogs/ingredientsdialog.h | 38 +- krecipes/src/dialogs/pagesetupdialog.cpp | 74 +- krecipes/src/dialogs/pagesetupdialog.h | 24 +- krecipes/src/dialogs/prepmethodsdialog.cpp | 10 +- krecipes/src/dialogs/prepmethodsdialog.h | 20 +- krecipes/src/dialogs/propertiesdialog.cpp | 14 +- krecipes/src/dialogs/propertiesdialog.h | 16 +- krecipes/src/dialogs/recipeimportdialog.cpp | 64 +- krecipes/src/dialogs/recipeimportdialog.h | 22 +- krecipes/src/dialogs/recipeinputdialog.cpp | 474 ++++---- krecipes/src/dialogs/recipeinputdialog.h | 110 +- krecipes/src/dialogs/recipeprintpreview.cpp | 10 +- krecipes/src/dialogs/recipeprintpreview.h | 6 +- krecipes/src/dialogs/recipeviewdialog.cpp | 30 +- krecipes/src/dialogs/recipeviewdialog.h | 22 +- krecipes/src/dialogs/refineshoppinglistdialog.cpp | 62 +- krecipes/src/dialogs/refineshoppinglistdialog.h | 34 +- krecipes/src/dialogs/resizerecipedialog.cpp | 72 +- krecipes/src/dialogs/resizerecipedialog.h | 40 +- krecipes/src/dialogs/selectauthorsdialog.cpp | 34 +- krecipes/src/dialogs/selectauthorsdialog.h | 14 +- krecipes/src/dialogs/selectcategoriesdialog.cpp | 18 +- krecipes/src/dialogs/selectcategoriesdialog.h | 6 +- krecipes/src/dialogs/selectpropertydialog.cpp | 26 +- krecipes/src/dialogs/selectpropertydialog.h | 18 +- krecipes/src/dialogs/selectrecipedialog.cpp | 76 +- krecipes/src/dialogs/selectrecipedialog.h | 40 +- krecipes/src/dialogs/selectunitdialog.cpp | 20 +- krecipes/src/dialogs/selectunitdialog.h | 14 +- krecipes/src/dialogs/setupdisplay.cpp | 170 +-- krecipes/src/dialogs/setupdisplay.h | 68 +- krecipes/src/dialogs/shoppinglistdialog.cpp | 66 +- krecipes/src/dialogs/shoppinglistdialog.h | 24 +- krecipes/src/dialogs/shoppinglistviewdialog.cpp | 24 +- krecipes/src/dialogs/shoppinglistviewdialog.h | 8 +- krecipes/src/dialogs/similarcategoriesdialog.cpp | 136 +-- krecipes/src/dialogs/similarcategoriesdialog.h | 74 +- krecipes/src/dialogs/unitsdialog.cpp | 24 +- krecipes/src/dialogs/unitsdialog.h | 18 +- krecipes/src/dialogs/usdadatadialog.cpp | 50 +- krecipes/src/dialogs/usdadatadialog.h | 8 +- krecipes/src/exporters/baseexporter.cpp | 42 +- krecipes/src/exporters/baseexporter.h | 26 +- krecipes/src/exporters/cookmlexporter.cpp | 52 +- krecipes/src/exporters/cookmlexporter.h | 8 +- krecipes/src/exporters/htmlbookexporter.cpp | 60 +- krecipes/src/exporters/htmlbookexporter.h | 22 +- krecipes/src/exporters/htmlexporter.cpp | 244 ++-- krecipes/src/exporters/htmlexporter.h | 60 +- krecipes/src/exporters/kreexporter.cpp | 84 +- krecipes/src/exporters/kreexporter.h | 16 +- krecipes/src/exporters/mmfexporter.cpp | 58 +- krecipes/src/exporters/mmfexporter.h | 14 +- krecipes/src/exporters/plaintextexporter.cpp | 30 +- krecipes/src/exporters/plaintextexporter.h | 6 +- krecipes/src/exporters/recipemlexporter.cpp | 96 +- krecipes/src/exporters/recipemlexporter.h | 12 +- krecipes/src/exporters/rezkonvexporter.cpp | 74 +- krecipes/src/exporters/rezkonvexporter.h | 14 +- krecipes/src/importers/baseimporter.cpp | 26 +- krecipes/src/importers/baseimporter.h | 30 +- krecipes/src/importers/kredbimporter.cpp | 4 +- krecipes/src/importers/kredbimporter.h | 14 +- krecipes/src/importers/kreimporter.cpp | 120 +- krecipes/src/importers/kreimporter.h | 20 +- krecipes/src/importers/mmfimporter.cpp | 56 +- krecipes/src/importers/mmfimporter.h | 16 +- krecipes/src/importers/mx2importer.cpp | 60 +- krecipes/src/importers/mx2importer.h | 6 +- krecipes/src/importers/mxpimporter.cpp | 92 +- krecipes/src/importers/mxpimporter.h | 20 +- krecipes/src/importers/nycgenericimporter.cpp | 40 +- krecipes/src/importers/nycgenericimporter.h | 12 +- krecipes/src/importers/recipemlimporter.cpp | 142 +-- krecipes/src/importers/recipemlimporter.h | 24 +- krecipes/src/importers/rezkonvimporter.cpp | 90 +- krecipes/src/importers/rezkonvimporter.h | 20 +- krecipes/src/klomanager.cpp | 104 +- krecipes/src/klomanager.h | 50 +- krecipes/src/krecipes.cpp | 110 +- krecipes/src/krecipes.h | 10 +- krecipes/src/krecipesdbiface.h | 2 +- krecipes/src/krecipesiface.h | 4 +- krecipes/src/krecipesview.cpp | 86 +- krecipes/src/krecipesview.h | 66 +- krecipes/src/krepagelayout.cpp | 38 +- krecipes/src/krepagelayout.h | 42 +- krecipes/src/kstartuplogo.cpp | 18 +- krecipes/src/kstartuplogo.h | 10 +- krecipes/src/main.cpp | 2 +- krecipes/src/pref.cpp | 330 +++--- krecipes/src/pref.h | 72 +- krecipes/src/profiling.h | 4 +- krecipes/src/propertycalculator.cpp | 8 +- krecipes/src/recipeactionshandler.cpp | 130 +-- krecipes/src/recipeactionshandler.h | 26 +- krecipes/src/recipefilter.cpp | 34 +- krecipes/src/recipefilter.h | 14 +- krecipes/src/setupwizard.cpp | 368 +++--- krecipes/src/setupwizard.h | 128 +- krecipes/src/tests/checks.h | 36 +- krecipes/src/tests/exportertest.h | 10 +- krecipes/src/tests/importertest.h | 2 +- krecipes/src/tests/kretest.cpp | 20 +- krecipes/src/tests/kretest.txt | 4 +- krecipes/src/tests/mmftest.cpp | 18 +- krecipes/src/tests/mmftest.txt | 4 +- krecipes/src/tests/mx2test.cpp | 6 +- krecipes/src/tests/mxptest.cpp | 6 +- krecipes/src/tests/nyctest.cpp | 6 +- krecipes/src/tests/recipemltest.cpp | 18 +- krecipes/src/tests/recipemltest.txt | 4 +- krecipes/src/tests/rezkonvtest.cpp | 16 +- krecipes/src/tests/rezkonvtest.txt | 4 +- krecipes/src/widgets/amountunitinput.cpp | 6 +- krecipes/src/widgets/amountunitinput.h | 16 +- krecipes/src/widgets/authorlistview.cpp | 54 +- krecipes/src/widgets/authorlistview.h | 24 +- krecipes/src/widgets/categorycombobox.cpp | 24 +- krecipes/src/widgets/categorycombobox.h | 8 +- krecipes/src/widgets/categorylistview.cpp | 120 +- krecipes/src/widgets/categorylistview.h | 80 +- krecipes/src/widgets/conversiontable.cpp | 98 +- krecipes/src/widgets/conversiontable.h | 44 +- krecipes/src/widgets/criteriacombobox.cpp | 4 +- krecipes/src/widgets/criteriacombobox.h | 6 +- krecipes/src/widgets/dblistviewbase.cpp | 64 +- krecipes/src/widgets/dblistviewbase.h | 22 +- krecipes/src/widgets/fractioninput.cpp | 14 +- krecipes/src/widgets/fractioninput.h | 6 +- krecipes/src/widgets/headercombobox.cpp | 8 +- krecipes/src/widgets/headercombobox.h | 2 +- krecipes/src/widgets/headerlistview.cpp | 36 +- krecipes/src/widgets/headerlistview.h | 12 +- krecipes/src/widgets/inglistviewitem.cpp | 38 +- krecipes/src/widgets/inglistviewitem.h | 38 +- krecipes/src/widgets/ingredientcombobox.cpp | 28 +- krecipes/src/widgets/ingredientcombobox.h | 16 +- krecipes/src/widgets/ingredientinputwidget.cpp | 118 +- krecipes/src/widgets/ingredientinputwidget.h | 54 +- krecipes/src/widgets/ingredientlistview.cpp | 56 +- krecipes/src/widgets/ingredientlistview.h | 26 +- krecipes/src/widgets/kdateedit.cpp | 114 +- krecipes/src/widgets/kdateedit.h | 38 +- krecipes/src/widgets/kdatepickerpopup.cpp | 30 +- krecipes/src/widgets/kdatepickerpopup.h | 20 +- krecipes/src/widgets/krelistview.cpp | 38 +- krecipes/src/widgets/krelistview.h | 22 +- krecipes/src/widgets/kremenu.cpp | 168 +-- krecipes/src/widgets/kremenu.h | 62 +- krecipes/src/widgets/kreruler.cpp | 236 ++-- krecipes/src/widgets/kreruler.h | 62 +- krecipes/src/widgets/kretextedit.cpp | 42 +- krecipes/src/widgets/kretextedit.h | 12 +- krecipes/src/widgets/kwidgetlistbox.cpp | 32 +- krecipes/src/widgets/kwidgetlistbox.h | 26 +- krecipes/src/widgets/paneldeco.cpp | 80 +- krecipes/src/widgets/paneldeco.h | 54 +- krecipes/src/widgets/prepmethodcombobox.cpp | 30 +- krecipes/src/widgets/prepmethodcombobox.h | 12 +- krecipes/src/widgets/prepmethodlistview.cpp | 36 +- krecipes/src/widgets/prepmethodlistview.h | 12 +- krecipes/src/widgets/propertylistview.cpp | 58 +- krecipes/src/widgets/propertylistview.h | 48 +- krecipes/src/widgets/ratingdisplaywidget.ui | 14 +- krecipes/src/widgets/ratingwidget.cpp | 48 +- krecipes/src/widgets/ratingwidget.h | 30 +- krecipes/src/widgets/recipelistview.cpp | 90 +- krecipes/src/widgets/recipelistview.h | 56 +- krecipes/src/widgets/unitcombobox.cpp | 24 +- krecipes/src/widgets/unitcombobox.h | 8 +- krecipes/src/widgets/unitlistview.cpp | 62 +- krecipes/src/widgets/unitlistview.h | 16 +- krecipes/src/widgets/weightinput.cpp | 2 +- krecipes/src/widgets/weightinput.h | 2 +- 264 files changed, 6892 insertions(+), 6892 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 868519c..19f8f05 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1060,7 +1060,7 @@ elif test "$kde_use_qt_emb" = "yes"; then x_includes="" x_libraries="" elif test "$kde_use_qt_mac" = "yes"; then - dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to + dnl We're using QT/Mac (I use QT_MAC so that ntqglobal.h doesn't *have* to dnl be included to get the information) --Sam CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" @@ -1092,19 +1092,19 @@ AC_DEFUN([KDE_PRINT_QT_PROGRAM], AC_REQUIRE([KDE_USE_QT]) cat > conftest.$ac_ext < -#include +#include +#include EOF if test "$kde_qtver" = "2"; then cat >> conftest.$ac_ext < -#include -#include +#include +#include +#include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext <> conftest.$ac_ext < -#include +#include +#include #include EOF fi @@ -1201,22 +1201,22 @@ fi if test -z "$3"; then if test $kde_qtver = 3; then if test $kde_qtsubver -gt 0; then - kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000" + kde_qt_verstring="TQT_VERSION >= 0x03@VER@00 && TQT_VERSION < 0x040000" qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'` kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"` else - kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000" + kde_qt_verstring="TQT_VERSION >= 300 && TQT_VERSION < 0x040000" fi fi if test $kde_qtver = 2; then if test $kde_qtsubver -gt 0; then - kde_qt_verstring="QT_VERSION >= 222" + kde_qt_verstring="TQT_VERSION >= 222" else - kde_qt_verstring="QT_VERSION >= 200" + kde_qt_verstring="TQT_VERSION >= 200" fi fi if test $kde_qtver = 1; then - kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" + kde_qt_verstring="TQT_VERSION >= 142 && TQT_VERSION < 200" fi else kde_qt_verstring="$3" @@ -1325,7 +1325,7 @@ AC_ARG_ENABLE( USING_QT_MT="" dnl ------------------------------------------------------------------------ -dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl If we not get --disable-tqt-mt then adjust some vars for the host. dnl ------------------------------------------------------------------------ KDE_MT_LDFLAGS= @@ -1383,7 +1383,7 @@ dnl ------------------------------------------------------------ fi dnl ------------------------------------------------------------------------ -dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl If we got --enable-tqt-mt then adjust the Qt library name for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then @@ -1449,9 +1449,9 @@ if test ! "$ac_qt_includes" = "NO"; then fi if test "$kde_qtver" != "1"; then - kde_qt_header=qstyle.h + kde_qt_header=ntqstyle.h else - kde_qt_header=qglobal.h + kde_qt_header=ntqglobal.h fi AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) @@ -2034,7 +2034,7 @@ AC_CACHE_VAL(kde_cv_have_kdeqtaddon, LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" AC_TRY_LINK([ - #include + #include ], [ QDomDocument doc; @@ -2595,7 +2595,7 @@ LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK( -[#include ], +[#include ], [ int argc; char** argv; @@ -3439,7 +3439,7 @@ AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY], AC_TRY_COMPILE( [ -#include +#include #if Q_EXPORT - 0 != 0 /* if this compiles, then Q_EXPORT is undefined */ /* if Q_EXPORT is nonempty, this will break compilation */ @@ -4687,7 +4687,7 @@ CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" AC_TRY_RUN(dnl [ #include -#include +#include int main() { QString t = "hallo"; t.fill('t'); @@ -5531,7 +5531,7 @@ if test "${with_qt_dir+set}" = set; then kde_qtdir="$with_qt_dir" fi -AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) +AC_FIND_FILE(ntqsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) AC_MSG_RESULT($QTDOCDIR) AC_SUBST(QTDOCDIR) @@ -5552,7 +5552,7 @@ AC_SUBST(DOXYGEN_PROJECT_NAME) AC_SUBST(DOXYGEN_PROJECT_NUMBER) KDE_HAS_DOXYGEN=no -if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/ntqsql.html; then KDE_HAS_DOXYGEN=yes fi AC_SUBST(KDE_HAS_DOXYGEN) diff --git a/krecipes/src/backends/MySQL/mysqlrecipedb.cpp b/krecipes/src/backends/MySQL/mysqlrecipedb.cpp index 151954e..9e5411e 100644 --- a/krecipes/src/backends/MySQL/mysqlrecipedb.cpp +++ b/krecipes/src/backends/MySQL/mysqlrecipedb.cpp @@ -21,7 +21,7 @@ #include #include -MySQLRecipeDB::MySQLRecipeDB( const QString &host, const QString &user, const QString &pass, const QString &DBname, int port ) : QSqlRecipeDB( host, user, pass, DBname, port ) +MySQLRecipeDB::MySQLRecipeDB( const TQString &host, const TQString &user, const TQString &pass, const TQString &DBname, int port ) : TQSqlRecipeDB( host, user, pass, DBname, port ) {} MySQLRecipeDB::~MySQLRecipeDB() @@ -29,7 +29,7 @@ MySQLRecipeDB::~MySQLRecipeDB() void MySQLRecipeDB::createDB() { - QString real_db_name = database->databaseName(); + TQString real_db_name = database->databaseName(); //we have to be connected to some database in order to create the Krecipes database //so long as the permissions given are allowed access to "mysql', this works @@ -37,7 +37,7 @@ void MySQLRecipeDB::createDB() if ( database->open() ) { // Create the Database (Note: needs permissions) //FIXME: I've noticed certain characters cause this to fail (such as '-'). Somehow let the user know. - QSqlQuery query( QString( "CREATE DATABASE %1" ).arg( real_db_name ), database ); + TQSqlQuery query( TQString( "CREATE DATABASE %1" ).arg( real_db_name ), database ); if ( !query.isActive() ) kdDebug() << "create query failed: " << database->lastError().databaseText() << endl; @@ -49,49 +49,49 @@ void MySQLRecipeDB::createDB() database->setDatabaseName( real_db_name ); } -QStringList MySQLRecipeDB::backupCommand() const +TQStringList MySQLRecipeDB::backupCommand() const { KConfig *config = KGlobal::config(); config->setGroup("Server"); - QStringList command; + TQStringList command; command<readEntry( "MySQLDumpPath", "mysqldump" )<<"-q"; - QString pass = config->readEntry("Password", QString::null); + TQString pass = config->readEntry("Password", TQString::null); if ( !pass.isEmpty() ) command<<"-p"+pass; - QString user = config->readEntry("Username", QString::null); + TQString user = config->readEntry("Username", TQString::null); command<<"-u"+user; command<<"-h"+config->readEntry("Host", "localhost"); int port = config->readNumEntry("Port", 0); if ( port > 0 ) - command<<"-P"+QString::number(port); + command<<"-P"+TQString::number(port); command<databaseName(); return command; } -QStringList MySQLRecipeDB::restoreCommand() const +TQStringList MySQLRecipeDB::restoreCommand() const { KConfig *config = KGlobal::config(); config->setGroup("Server"); - QStringList command; + TQStringList command; command<readEntry( "MySQLPath", "mysql" ); - QString pass = config->readEntry("Password", QString::null); + TQString pass = config->readEntry("Password", TQString::null); if ( !pass.isEmpty() ) command<<"-p"+pass; - QString user = config->readEntry("Username", QString::null); + TQString user = config->readEntry("Username", TQString::null); command<<"-u"+user; int port = config->readNumEntry("Port", 0); if ( port > 0 ) - command<<"-P"+QString::number(port); + command<<"-P"+TQString::number(port); command<<"-h"+config->readEntry("Host", "localhost"); @@ -99,16 +99,16 @@ QStringList MySQLRecipeDB::restoreCommand() const return command; } -void MySQLRecipeDB::createTable( const QString &tableName ) +void MySQLRecipeDB::createTable( const TQString &tableName ) { - QStringList commands; + TQStringList commands; if ( tableName == "recipes" ) - commands << QString( "CREATE TABLE recipes (id INTEGER NOT NULL AUTO_INCREMENT,title VARCHAR(%1), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id int(11) DEFAULT '-1', instructions TEXT, photo BLOB, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP, PRIMARY KEY (id));" ).arg( maxRecipeTitleLength() ); + commands << TQString( "CREATE TABLE recipes (id INTEGER NOT NULL AUTO_INCREMENT,title VARCHAR(%1), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id int(11) DEFAULT '-1', instructions TEXT, photo BLOB, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP, PRIMARY KEY (id));" ).arg( maxRecipeTitleLength() ); else if ( tableName == "ingredients" ) - commands << QString( "CREATE TABLE ingredients (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxIngredientNameLength() ); + commands << TQString( "CREATE TABLE ingredients (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxIngredientNameLength() ); else if ( tableName == "ingredient_list" ) commands << "CREATE TABLE ingredient_list (id INTEGER NOT NULL AUTO_INCREMENT, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, substitute_for INTEGER, PRIMARY KEY(id), INDEX ridil_index(recipe_id), INDEX iidil_index(ingredient_id), INDEX gidil_index(group_id))"; @@ -117,11 +117,11 @@ void MySQLRecipeDB::createTable( const QString &tableName ) commands << "CREATE TABLE unit_list (ingredient_id INTEGER, unit_id INTEGER);"; else if ( tableName == "units" ) - commands << QString( "CREATE TABLE units (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), name_abbrev VARCHAR(%2), plural VARCHAR(%3), plural_abbrev VARCHAR(%4), type INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (id));" ) + commands << TQString( "CREATE TABLE units (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), name_abbrev VARCHAR(%2), plural VARCHAR(%3), plural_abbrev VARCHAR(%4), type INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (id));" ) .arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() ); else if ( tableName == "prep_methods" ) - commands << QString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); + commands << TQString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); else if ( tableName == "prep_method_list" ) commands << "CREATE TABLE prep_method_list (ingredient_list_id int(11) NOT NULL,prep_method_id int(11) NOT NULL, order_index int(11), INDEX iid_index (ingredient_list_id), INDEX pid_index (prep_method_id));"; @@ -139,26 +139,26 @@ void MySQLRecipeDB::createTable( const QString &tableName ) commands << "CREATE TABLE units_conversion (unit1_id INTEGER, unit2_id INTEGER, ratio FLOAT);"; else if ( tableName == "categories" ) - commands << QString( "CREATE TABLE categories (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL, parent_id int(11) NOT NULL default -1, PRIMARY KEY (id), INDEX parent_id_index(parent_id));" ).arg( maxCategoryNameLength() ); + commands << TQString( "CREATE TABLE categories (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL, parent_id int(11) NOT NULL default -1, PRIMARY KEY (id), INDEX parent_id_index(parent_id));" ).arg( maxCategoryNameLength() ); else if ( tableName == "category_list" ) commands << "CREATE TABLE category_list (recipe_id int(11) NOT NULL,category_id int(11) NOT NULL, INDEX rid_index (recipe_id), INDEX cid_index (category_id));"; else if ( tableName == "authors" ) - commands << QString( "CREATE TABLE authors (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL,PRIMARY KEY (id));" ).arg( maxAuthorNameLength() ); + commands << TQString( "CREATE TABLE authors (id int(11) NOT NULL auto_increment, name varchar(%1) default NULL,PRIMARY KEY (id));" ).arg( maxAuthorNameLength() ); else if ( tableName == "author_list" ) commands << "CREATE TABLE author_list (recipe_id int(11) NOT NULL,author_id int(11) NOT NULL);"; else if ( tableName == "db_info" ) { commands << "CREATE TABLE db_info (ver FLOAT NOT NULL,generated_by varchar(200) default NULL);"; - commands << QString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() ); + commands << TQString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() ); } else if ( tableName == "ingredient_groups" ) { - commands << QString( "CREATE TABLE `ingredient_groups` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( maxIngGroupNameLength() ); + commands << TQString( "CREATE TABLE `ingredient_groups` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( maxIngGroupNameLength() ); } else if ( tableName == "yield_types" ) { - commands << QString( "CREATE TABLE `yield_types` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( 20 ); + commands << TQString( "CREATE TABLE `yield_types` (`id` int(11) NOT NULL auto_increment, `name` varchar(%1), PRIMARY KEY (`id`));" ).arg( 20 ); } else if ( tableName == "ratings" ) @@ -173,29 +173,29 @@ void MySQLRecipeDB::createTable( const QString &tableName ) else return ; - QSqlQuery databaseToCreate( QString::null, database ); + TQSqlQuery databaseToCreate( TQString::null, database ); // execute the queries - for ( QStringList::const_iterator it = commands.begin(); it != commands.end(); ++it ) + for ( TQStringList::const_iterator it = commands.begin(); it != commands.end(); ++it ) databaseToCreate.exec( ( *it ) ); } void MySQLRecipeDB::portOldDatabases( float version ) { kdDebug() << "Current database version is..." << version << "\n"; - QString command; + TQString command; // Note that version no. means the version in which this DB structure // was introduced. To work with SVN users, the database will be incrementally // upgraded for each change made between releases (e.g. 0.81, 0.82,... are // what will become 0.9) - if ( qRound(version*10) < 3 ) // The database was generated with a version older than v 0.3. First update to 0.3 version + if ( tqRound(version*10) < 3 ) // The database was generated with a version older than v 0.3. First update to 0.3 version { // Add new columns to existing tables (creating new tables is not necessary. Integrity check does that before) command = "ALTER TABLE recipes ADD COLUMN persons int(11) AFTER title;"; - QSqlQuery tableToAlter( command, database ); + TQSqlQuery tableToAlter( command, database ); // Set the version to the new one (0.3) @@ -205,12 +205,12 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*10) < 4 ) // Upgrade to the current DB version 0.4 + if ( tqRound(version*10) < 4 ) // Upgrade to the current DB version 0.4 { // Add new columns to existing tables (creating any new tables is not necessary. Integrity check does that before) command = "ALTER TABLE ingredient_list ADD COLUMN order_index int(11) AFTER unit_id;"; - QSqlQuery tableToAlter( command, database ); + TQSqlQuery tableToAlter( command, database ); // Missing indexes in the previous versions command = "CREATE index rid_index ON category_list(recipe_id)"; @@ -229,13 +229,13 @@ void MySQLRecipeDB::portOldDatabases( float version ) //*1:: Recipes have always category -1 to speed up searches (no JOINs needed) command = "SELECT r.id FROM recipes r;"; // Find all recipes - QSqlQuery categoryToAdd( QString::null, database ); + TQSqlQuery categoryToAdd( TQString::null, database ); tableToAlter.exec( command ); if ( tableToAlter.isActive() ) { while ( tableToAlter.next() ) { int recipeId = tableToAlter.value( 0 ).toInt(); - QString cCommand = QString( "INSERT INTO category_list VALUES (%1,-1);" ).arg( recipeId ); + TQString cCommand = TQString( "INSERT INTO category_list VALUES (%1,-1);" ).arg( recipeId ); categoryToAdd.exec( cCommand ); emit progress(); @@ -250,9 +250,9 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*10) < 5 ) { - command = QString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*10) < 5 ) { + command = TQString( "CREATE TABLE prep_methods (id INTEGER NOT NULL AUTO_INCREMENT, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); + TQSqlQuery tableToAlter( command, database ); command = "ALTER TABLE ingredient_list ADD COLUMN prep_method_id int(11) AFTER unit_id;"; tableToAlter.exec( command ); @@ -271,9 +271,9 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*10) < 6 ) { + if ( tqRound(version*10) < 6 ) { command = "ALTER TABLE categories ADD COLUMN parent_id int(11) NOT NULL default '-1' AFTER name;"; - QSqlQuery tableToAlter( command, database ); + TQSqlQuery tableToAlter( command, database ); command = "DELETE FROM db_info;"; // Remove previous version records if they exist tableToAlter.exec( command ); @@ -281,9 +281,9 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*100) < 61 ) { - QString command = "ALTER TABLE `recipes` ADD COLUMN `prep_time` TIME DEFAULT NULL"; - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*100) < 61 ) { + TQString command = "ALTER TABLE `recipes` ADD COLUMN `prep_time` TIME DEFAULT NULL"; + TQSqlQuery tableToAlter( command, database ); command = "DELETE FROM db_info;"; // Remove previous version records if they exist tableToAlter.exec( command ); @@ -291,9 +291,9 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*100) < 62 ) { - QString command = "ALTER TABLE `ingredient_list` ADD COLUMN `group_id` int(11) default '-1' AFTER order_index;"; - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*100) < 62 ) { + TQString command = "ALTER TABLE `ingredient_list` ADD COLUMN `group_id` int(11) default '-1' AFTER order_index;"; + TQSqlQuery tableToAlter( command, database ); command = "DELETE FROM db_info;"; // Remove previous version records if they exist tableToAlter.exec( command ); @@ -301,15 +301,15 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*100) < 63 ) { - QString command = "ALTER TABLE `units` ADD COLUMN `plural` varchar(20) DEFAULT NULL AFTER name;"; - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*100) < 63 ) { + TQString command = "ALTER TABLE `units` ADD COLUMN `plural` varchar(20) DEFAULT NULL AFTER name;"; + TQSqlQuery tableToAlter( command, database ); - QSqlQuery result( "SELECT id,name FROM units WHERE plural IS NULL", database ); + TQSqlQuery result( "SELECT id,name FROM units WHERE plural IS NULL", database ); if ( result.isActive() ) { while ( result.next() ) { - command = "UPDATE units SET plural='" + result.value( 1 ).toString() + "' WHERE id=" + QString::number( result.value( 0 ).toInt() ); - QSqlQuery query( command, database ); + command = "UPDATE units SET plural='" + result.value( 1 ).toString() + "' WHERE id=" + TQString::number( result.value( 0 ).toInt() ); + TQSqlQuery query( command, database ); emit progress(); } @@ -321,22 +321,22 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*10) < 7 ) { //simply call 0.63 -> 0.7 - QString command = "UPDATE db_info SET ver='0.7';"; - QSqlQuery query( command, database ); + if ( tqRound(version*10) < 7 ) { //simply call 0.63 -> 0.7 + TQString command = "UPDATE db_info SET ver='0.7';"; + TQSqlQuery query( command, database ); } - if ( qRound(version*100) < 81 ) { - QString command = "ALTER TABLE `ingredient_list` ADD COLUMN `amount_offset` FLOAT DEFAULT '0' AFTER amount;"; - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*100) < 81 ) { + TQString command = "ALTER TABLE `ingredient_list` ADD COLUMN `amount_offset` FLOAT DEFAULT '0' AFTER amount;"; + TQSqlQuery tableToAlter( command, database ); command = "UPDATE db_info SET ver='0.81',generated_by='Krecipes SVN (20050816)';"; tableToAlter.exec( command ); } - if ( qRound(version*100) < 82 ) { - QString command = "ALTER TABLE `recipes` ADD COLUMN `yield_amount` FLOAT DEFAULT '0' AFTER persons;"; - QSqlQuery tableToAlter( command, database ); + if ( tqRound(version*100) < 82 ) { + TQString command = "ALTER TABLE `recipes` ADD COLUMN `yield_amount` FLOAT DEFAULT '0' AFTER persons;"; + TQSqlQuery tableToAlter( command, database ); command = "ALTER TABLE `recipes` ADD COLUMN `yield_amount_offset` FLOAT DEFAULT '0' AFTER yield_amount;"; tableToAlter.exec(command); @@ -344,11 +344,11 @@ void MySQLRecipeDB::portOldDatabases( float version ) command = "ALTER TABLE `recipes` ADD COLUMN `yield_type_id` INTEGER DEFAULT '-1' AFTER yield_amount_offset;"; tableToAlter.exec(command); - QSqlQuery result( "SELECT id,persons FROM recipes", database ); + TQSqlQuery result( "SELECT id,persons FROM recipes", database ); if ( result.isActive() ) { while ( result.next() ) { - command = "UPDATE recipes SET yield_amount='" + QString::number( result.value( 1 ).toInt() ) + "' WHERE id=" + QString::number( result.value( 0 ).toInt() ); - QSqlQuery query( command, database ); + command = "UPDATE recipes SET yield_amount='" + TQString::number( result.value( 1 ).toInt() ) + "' WHERE id=" + TQString::number( result.value( 0 ).toInt() ); + TQSqlQuery query( command, database ); emit progress(); } @@ -361,17 +361,17 @@ void MySQLRecipeDB::portOldDatabases( float version ) tableToAlter.exec( command ); } - if ( qRound(version*100) < 83 ) { + if ( tqRound(version*100) < 83 ) { database->transaction(); //====add a id columns to 'ingredient_list' to identify it for the prep method list database->exec( "RENAME TABLE ingredient_list TO ingredient_list_copy;" ); database->exec( "CREATE TABLE ingredient_list (id INTEGER NOT NULL AUTO_INCREMENT, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, PRIMARY KEY(id), INDEX ridil_index(recipe_id), INDEX iidil_index(ingredient_id));" ); - QSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" ); + TQSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.prepare( "INSERT INTO ingredient_list VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)" ); query.addBindValue( copyQuery.value( 0 ) ); query.addBindValue( copyQuery.value( 1 ) ); @@ -402,7 +402,7 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.83 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE recipes ADD COLUMN ctime TIMESTAMP;" ); @@ -417,10 +417,10 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.84 failed. Maybe you should try again."<transaction(); - QSqlQuery query( "SELECT id,photo FROM recipes", database ); + TQSqlQuery query( "SELECT id,photo FROM recipes", database ); if ( query.isActive() ) { while ( query.next() ) { @@ -436,24 +436,24 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.85 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE ingredient_list ADD INDEX (group_id)" ); - QSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); + TQSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); - QString last; + TQString last; int lastID; if ( query.isActive() ) { while ( query.next() ) { - QString name = query.value(1).toString(); + TQString name = query.value(1).toString(); int id = query.value(0).toInt(); if ( last == name ) { - QString command = QString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); + TQString command = TQString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); database->exec(command); - command = QString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); + command = TQString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); database->exec(command); } last = name; @@ -468,27 +468,27 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.86 failed. Maybe you should try again."<exec( QString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); database->exec( "UPDATE db_info SET ver='0.87',generated_by='Krecipes SVN (20051014)'" ); } - if ( qRound(version*100) < 90 ) { + if ( tqRound(version*100) < 90 ) { database->exec("UPDATE db_info SET ver='0.9',generated_by='Krecipes 0.9'"); } - if ( qRound(version*100) < 91 ) { + if ( tqRound(version*100) < 91 ) { database->exec("CREATE index parent_id_index ON categories(parent_id)"); database->exec("UPDATE db_info SET ver='0.91',generated_by='Krecipes SVN (20060526)'"); } - if ( qRound(version*100) < 92 ) { + if ( tqRound(version*100) < 92 ) { database->transaction(); database->exec( "ALTER TABLE units ADD COLUMN name_abbrev VARCHAR(20) AFTER name"); @@ -499,7 +499,7 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.92 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE ingredient_list ADD COLUMN substitute_for INTEGER AFTER group_id"); @@ -509,7 +509,7 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.93 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE units ADD COLUMN type INTEGER NOT NULL DEFAULT 0 AFTER plural_abbrev"); @@ -519,7 +519,7 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.94 failed. Maybe you should try again."<exec( "DROP TABLE ingredient_weights" ); createTable( "ingredient_weights" ); database->exec( "UPDATE db_info SET ver='0.95',generated_by='Krecipes SVN (20060726)'" ); @@ -528,7 +528,7 @@ void MySQLRecipeDB::portOldDatabases( float version ) int MySQLRecipeDB::lastInsertID() { - QSqlQuery lastInsertID( "SELECT LAST_INSERT_ID();", database ); + TQSqlQuery lastInsertID( "SELECT LAST_INSERT_ID();", database ); int id = -1; if ( lastInsertID.isActive() && lastInsertID.next() ) @@ -537,18 +537,18 @@ int MySQLRecipeDB::lastInsertID() return id; } -void MySQLRecipeDB::givePermissions( const QString &dbName, const QString &username, const QString &password, const QString &clientHost ) +void MySQLRecipeDB::givePermissions( const TQString &dbName, const TQString &username, const TQString &password, const TQString &clientHost ) { - QString command; + TQString command; if ( !password.isEmpty() ) - command = QString( "GRANT ALL ON %1.* TO '%2'@'%3' IDENTIFIED BY '%4';" ).arg( dbName ).arg( username ).arg( clientHost ).arg( password ); + command = TQString( "GRANT ALL ON %1.* TO '%2'@'%3' IDENTIFIED BY '%4';" ).arg( dbName ).arg( username ).arg( clientHost ).arg( password ); else - command = QString( "GRANT ALL ON %1.* TO '%2'@'%3';" ).arg( dbName ).arg( username ).arg( clientHost ); + command = TQString( "GRANT ALL ON %1.* TO '%2'@'%3';" ).arg( dbName ).arg( username ).arg( clientHost ); kdDebug() << "I'm doing the query to setup permissions\n"; - QSqlQuery permissionsToSet( command, database ); + TQSqlQuery permissionsToSet( command, database ); } #include "mysqlrecipedb.moc" diff --git a/krecipes/src/backends/MySQL/mysqlrecipedb.h b/krecipes/src/backends/MySQL/mysqlrecipedb.h index 01ac5a4..eafa56d 100644 --- a/krecipes/src/backends/MySQL/mysqlrecipedb.h +++ b/krecipes/src/backends/MySQL/mysqlrecipedb.h @@ -14,14 +14,14 @@ #ifndef MYSQLRECIPEDB_H #define MYSQLRECIPEDB_H -#define MYSQL_DRIVER "QMYSQL3" +#define MYSQL_DRIVER "TQMYSQL3" #include "qsqlrecipedb.h" /** @author Unai Garro */ -class MySQLRecipeDB : public QSqlRecipeDB +class MySQLRecipeDB : public TQSqlRecipeDB { Q_OBJECT @@ -30,24 +30,24 @@ private: void createDB( void ); public: - MySQLRecipeDB( const QString &host, const QString &user = QString::null, const QString &pass = QString::null, const QString &DBName = DEFAULT_DB_NAME, int port = 0 ); + MySQLRecipeDB( const TQString &host, const TQString &user = TQString::null, const TQString &pass = TQString::null, const TQString &DBName = DEFAULT_DB_NAME, int port = 0 ); ~MySQLRecipeDB( void ); int lastInsertID(); - void createTable( const QString &tableName ); - void givePermissions( const QString &dbName, const QString &username, const QString &password = QString::null, const QString &clientHost = "localhost" ); + void createTable( const TQString &tableName ); + void givePermissions( const TQString &dbName, const TQString &username, const TQString &password = TQString::null, const TQString &clientHost = "localhost" ); protected: - QString qsqlDriverPlugin() const + TQString qsqlDriverPlugin() const { return MYSQL_DRIVER; } private: void portOldDatabases( float version ); - QStringList backupCommand() const; - QStringList restoreCommand() const; + TQStringList backupCommand() const; + TQStringList restoreCommand() const; }; diff --git a/krecipes/src/backends/PostgreSQL/psqlrecipedb.cpp b/krecipes/src/backends/PostgreSQL/psqlrecipedb.cpp index c3a94e4..02a1f0a 100644 --- a/krecipes/src/backends/PostgreSQL/psqlrecipedb.cpp +++ b/krecipes/src/backends/PostgreSQL/psqlrecipedb.cpp @@ -20,10 +20,10 @@ #include #include -#include +#include //Note: PostgreSQL's database names are always lowercase -PSqlRecipeDB::PSqlRecipeDB( const QString& host, const QString& user, const QString& pass, const QString& DBname, int port ) : QSqlRecipeDB( host, user, pass, DBname.lower(), port ) +PSqlRecipeDB::PSqlRecipeDB( const TQString& host, const TQString& user, const TQString& pass, const TQString& DBname, int port ) : TQSqlRecipeDB( host, user, pass, DBname.lower(), port ) {} PSqlRecipeDB::~PSqlRecipeDB() @@ -31,13 +31,13 @@ PSqlRecipeDB::~PSqlRecipeDB() void PSqlRecipeDB::createDB() { - QString real_db_name = database->databaseName(); + TQString real_db_name = database->databaseName(); //we have to be connected to some database in order to create the Krecipes database //so long as the permissions given are allowed access to "template1', this works database->setDatabaseName( "template1" ); if ( database->open() ) { - QSqlQuery query( QString( "CREATE DATABASE %1" ).arg( real_db_name ), database ); + TQSqlQuery query( TQString( "CREATE DATABASE %1" ).arg( real_db_name ), database ); if ( !query.isActive() ) kdDebug() << "create query failed: " << database->lastError().databaseText() << endl; @@ -49,42 +49,42 @@ void PSqlRecipeDB::createDB() database->setDatabaseName( real_db_name ); } -QStringList PSqlRecipeDB::backupCommand() const +TQStringList PSqlRecipeDB::backupCommand() const { KConfig *config = KGlobal::config(); config->setGroup("Server"); - QStringList command; + TQStringList command; command<readEntry( "PgDumpPath", "pg_dump" )<<"-d"<databaseName() <<"-U"<readEntry( "Username" ); int port = config->readNumEntry( "Port", 0 ); if ( port > 0 ) - command<<"-p"<setGroup("Server"); - QStringList command; + TQStringList command; command<readEntry( "PsqlPath", "psql" )<databaseName() <<"-U"<readEntry( "Username" ); int port = config->readNumEntry( "Port", 0 ); if ( port > 0 ) - command<<"-p"<transaction(); addColumn("CREATE TABLE %1 (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, %2 unit_id INTEGER, prep_method_id INTEGER, order_index INTEGER, group_id INTEGER);","amount_offset FLOAT","'0'","ingredient_list",3); - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.exec( "CREATE INDEX ridil_index ON ingredient_list USING BTREE (recipe_id);" ); query.exec( "CREATE INDEX iidil_index ON ingredient_list USING BTREE (ingredient_id);"); @@ -206,15 +206,15 @@ void PSqlRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.81 failed. Maybe you should try again."<transaction(); //==================add a columns to 'recipes' to allow yield range + yield type database->exec( "CREATE TABLE recipes_copy (id SERIAL NOT NULL PRIMARY KEY,title CHARACTER VARYING, persons INTEGER, instructions TEXT, photo TEXT, prep_time TIME);" ); - QSqlQuery copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes;" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.prepare( "INSERT INTO recipes_copy VALUES (?, ?, ?, ?, ?, ?)" ); query.addBindValue( copyQuery.value( 0 ) ); query.addBindValue( copyQuery.value( 1 ) ); @@ -232,7 +232,7 @@ void PSqlRecipeDB::portOldDatabases( float version ) copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.prepare( "INSERT INTO recipes VALUES (?, ?, ?, ?, ?, ?, ?, ?)" ); query.addBindValue( copyQuery.value( 0 ) ); //id query.addBindValue( copyQuery.value( 1 ) ); //title @@ -255,7 +255,7 @@ void PSqlRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.82 failed. Maybe you should try again."<transaction(); //====add a id columns to 'ingredient_list' to identify it for the prep method list @@ -263,12 +263,12 @@ void PSqlRecipeDB::portOldDatabases( float version ) database->exec( "CREATE TABLE ingredient_list (id SERIAL NOT NULL PRIMARY KEY, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER);" ); - QSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" ); + TQSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { int ing_list_id = getNextInsertID("ingredient_list","id"); - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.prepare( "INSERT INTO ingredient_list VALUES (?, ?, ?, ?, ?, ?, ?, ?)" ); query.addBindValue( ing_list_id ); query.addBindValue( copyQuery.value( 0 ) ); @@ -305,7 +305,7 @@ void PSqlRecipeDB::portOldDatabases( float version ) } } - if ( qRound(version*100) < 84 ) { + if ( tqRound(version*100) < 84 ) { database->transaction(); database->exec( "ALTER TABLE recipes ADD COLUMN ctime TIMESTAMP" ); @@ -322,7 +322,7 @@ void PSqlRecipeDB::portOldDatabases( float version ) } } - if ( qRound(version*100) < 85 ) { //this change altered the photo format, but this backend already used the newer format + if ( tqRound(version*100) < 85 ) { //this change altered the photo format, but this backend already used the newer format database->transaction(); database->exec( "UPDATE db_info SET ver='0.85',generated_by='Krecipes SVN (20050926)';" ); @@ -333,24 +333,24 @@ void PSqlRecipeDB::portOldDatabases( float version ) } } - if ( qRound(version*100) < 86 ) { + if ( tqRound(version*100) < 86 ) { database->transaction(); database->exec( "CREATE INDEX gidil_index ON ingredient_list USING BTREE (group_id);" ); - QSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); + TQSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); - QString last; + TQString last; int lastID; if ( query.isActive() ) { while ( query.next() ) { - QString name = query.value(1).toString(); + TQString name = query.value(1).toString(); int id = query.value(0).toInt(); if ( last == name ) { - QString command = QString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); + TQString command = TQString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); database->exec(command); - command = QString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); + command = TQString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); database->exec(command); } last = name; @@ -365,50 +365,50 @@ void PSqlRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.86 failed. Maybe you should try again."<exec( QString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); database->exec( "UPDATE db_info SET ver='0.87',generated_by='Krecipes SVN (20051014)'" ); } - if ( qRound(version*100) < 90 ) { + if ( tqRound(version*100) < 90 ) { database->exec("UPDATE db_info SET ver='0.9',generated_by='Krecipes 0.9'"); } - if ( qRound(version*100) < 91 ) { + if ( tqRound(version*100) < 91 ) { database->exec("CREATE index parent_id_index ON categories USING BTREE(parent_id)"); database->exec("UPDATE db_info SET ver='0.91',generated_by='Krecipes SVN (20060526)'"); } - if ( qRound(version*100) < 92 ) { + if ( tqRound(version*100) < 92 ) { database->transaction(); //==================add a columns to 'units' to allow unit abbreviations database->exec( "ALTER TABLE units RENAME TO units_copy" ); int nextval = -1; - QSqlQuery getID( "SELECT nextval('units_id_seq')", database ); + TQSqlQuery getID( "SELECT nextval('units_id_seq')", database ); if ( getID.isActive() && getID.first() ) nextval = getID.value( 0 ).toInt(); if ( nextval == -1 ) kdDebug() << "Database update failed! Unable to update units sequence." << endl; database->exec( "CREATE TABLE units (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING, name_abbrev CHARACTER VARYING, plural CHARACTER VARYING, plural_abbrev CHARACTER VARYING )" ); - QSqlQuery copyQuery = database->exec( "SELECT id,name,plural FROM units_copy" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,name,plural FROM units_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QSqlQuery query(QString::null,database); + TQSqlQuery query(TQString::null,database); query.prepare( "INSERT INTO units VALUES(?, ?, ?, ?, ?)" ); query.addBindValue( copyQuery.value( 0 ) ); query.addBindValue( copyQuery.value( 1 ) ); - query.addBindValue( QVariant() ); + query.addBindValue( TQVariant() ); query.addBindValue( copyQuery.value( 2 ) ); - query.addBindValue( QVariant() ); + query.addBindValue( TQVariant() ); query.exec(); emit progress(); @@ -417,14 +417,14 @@ void PSqlRecipeDB::portOldDatabases( float version ) database->exec( "DROP TABLE units_copy" ); database->exec( "ALTER TABLE units_id_seq1 RENAME TO units_id_seq" ); - database->exec( "ALTER SEQUENCE units_id_seq RESTART WITH "+QString::number(nextval) ); + database->exec( "ALTER SEQUENCE units_id_seq RESTART WITH "+TQString::number(nextval) ); database->exec("UPDATE db_info SET ver='0.92',generated_by='Krecipes SVN (20060609)'"); if ( !database->commit() ) kdDebug()<<"Update to 0.92 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE ingredient_list ADD COLUMN substitute_for INTEGER" ); @@ -434,7 +434,7 @@ void PSqlRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.93 failed. Maybe you should try again."<transaction(); database->exec( "ALTER TABLE units ADD COLUMN type INTEGER NOT NULL DEFAULT '0'" ); @@ -444,56 +444,56 @@ void PSqlRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.94 failed. Maybe you should try again."<exec( "DROP TABLE ingredient_weights" ); createTable( "ingredient_weights" ); database->exec( "UPDATE db_info SET ver='0.95',generated_by='Krecipes SVN (20060726)'" ); } } -void PSqlRecipeDB::addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index ) +void PSqlRecipeDB::addColumn( const TQString &new_table_sql, const TQString &new_col_info, const TQString &default_value, const TQString &table_name, int col_index ) { - QString command; + TQString command; - command = QString(new_table_sql).arg(table_name+"_copy").arg(QString::null); + command = TQString(new_table_sql).arg(table_name+"_copy").arg(TQString::null); kdDebug()<<"calling: "< +#include #include @@ -37,10 +37,10 @@ #endif #include -QSQLiteDB::QSQLiteDB( QObject *, const char * ) +TQSQLiteDB::TQSQLiteDB( TQObject *, const char * ) {} -bool QSQLiteDB::open( const QString &dbname ) +bool TQSQLiteDB::open( const TQString &dbname ) { char * errmsg = 0; @@ -75,7 +75,7 @@ bool QSQLiteDB::open( const QString &dbname ) return func_res == 0; } -void QSQLiteDB::close() +void TQSQLiteDB::close() { if ( m_db ) { #if HAVE_SQLITE @@ -89,9 +89,9 @@ void QSQLiteDB::close() } } -QSQLiteResult QSQLiteDB::executeQuery( const QString &query, int *lastID ) +TQSQLiteResult TQSQLiteDB::executeQuery( const TQString &query, int *lastID ) { - QSQLiteResult res; + TQSQLiteResult res; if ( !m_db ) { return res; } @@ -109,7 +109,7 @@ QSQLiteResult QSQLiteDB::executeQuery( const QString &query, int *lastID ) kdDebug() << "SQLite error: " << errmsg << endl << "\t (Query: " << query << ")" << endl; res.setError( errmsg ); - res.setStatus( QSQLiteResult::Failure ); + res.setStatus( TQSQLiteResult::Failure ); #if HAVE_SQLITE sqlite_freemem( errmsg ); #elif HAVE_SQLITE3 @@ -127,17 +127,17 @@ QSQLiteResult QSQLiteDB::executeQuery( const QString &query, int *lastID ) } - res.setStatus( QSQLiteResult::Success ); + res.setStatus( TQSQLiteResult::Success ); return res; } -int QSQLiteDB::call_back( void* result, int argc, char** argv, char** columns ) +int TQSQLiteDB::call_back( void* result, int argc, char** argv, char** columns ) { - QSQLiteResult * res = ( QSQLiteResult* ) result; + TQSQLiteResult * res = ( TQSQLiteResult* ) result; - QMap tableString; - QMap tableInt; + TQMap tableString; + TQMap tableInt; for ( int i = 0; i < argc; i++ ) { tableInt.insert( i, argv[ i ] ); @@ -145,14 +145,14 @@ int QSQLiteDB::call_back( void* result, int argc, char** argv, char** columns ) argv[ i ] ); } - QSQLiteResultRow row( tableString, tableInt ); + TQSQLiteResultRow row( tableString, tableInt ); res->addRow( row ); return 0; } #if HAVE_SQLITE -void QSQLiteDB::lastInsertID(sqlite_func *context,int argc,const char**) +void TQSQLiteDB::lastInsertID(sqlite_func *context,int argc,const char**) { Q_ASSERT( argc==0 ); @@ -160,7 +160,7 @@ void QSQLiteDB::lastInsertID(sqlite_func *context,int argc,const char**) sqlite_set_result_int(context, sqlite_last_insert_rowid( (sqlite*)db ) ); } #elif HAVE_SQLITE3 -void QSQLiteDB::lastInsertID( sqlite3_context *context, int argc, sqlite3_value ** ) +void TQSQLiteDB::lastInsertID( sqlite3_context *context, int argc, sqlite3_value ** ) { Q_ASSERT( argc==0 ); diff --git a/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.h b/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.h index c0df13b..bff1967 100644 --- a/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.h +++ b/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.h @@ -18,12 +18,12 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef QSQLITEDB_H -#define QSQLITEDB_H +#ifndef TQSQLITEDB_H +#define TQSQLITEDB_H -#include -#include -#include +#include +#include +#include #include "config.h" #if HAVE_SQLITE @@ -35,13 +35,13 @@ #include "krecqsqliteresult.h" -class QSQLiteDB +class TQSQLiteDB { public: - QSQLiteDB( QObject *parent = 0, const char *name = 0 ); - bool open( const QString &dbname ); + TQSQLiteDB( TQObject *parent = 0, const char *name = 0 ); + bool open( const TQString &dbname ); void close(); - QSQLiteResult executeQuery( const QString &query, int *lastID = 0 ); + TQSQLiteResult executeQuery( const TQString &query, int *lastID = 0 ); int size(); //Returns the number of rows returned private: diff --git a/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.cpp b/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.cpp index 4bebfed..9a4f682 100644 --- a/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.cpp +++ b/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.cpp @@ -20,36 +20,36 @@ #include "krecqsqliteresult.h" -QSQLiteResultRow::QSQLiteResultRow( const TableString& string, const TableInt& Int ) +TQSQLiteResultRow::TQSQLiteResultRow( const TableString& string, const TableInt& Int ) : m_string( string ), m_int( Int ) {} -QSQLiteResultRow::~QSQLiteResultRow() +TQSQLiteResultRow::~TQSQLiteResultRow() {} -QSQLiteResultRow::QSQLiteResultRow( const QSQLiteResultRow& item ) +TQSQLiteResultRow::TQSQLiteResultRow( const TQSQLiteResultRow& item ) { *this = item; } -QSQLiteResultRow &QSQLiteResultRow::operator=( const QSQLiteResultRow& other ) +TQSQLiteResultRow &TQSQLiteResultRow::operator=( const TQSQLiteResultRow& other ) { m_string = other.m_string; m_int = other.m_int; return *this; } -QSQLiteResultRow::TableString QSQLiteResultRow::tableString() const +TQSQLiteResultRow::TableString TQSQLiteResultRow::tableString() const { return m_string; } -QSQLiteResultRow::TableInt QSQLiteResultRow::tableInt() const +TQSQLiteResultRow::TableInt TQSQLiteResultRow::tableInt() const { return m_int; } -QCString QSQLiteResultRow::data( const QString& columnName, bool *ok ) +TQCString TQSQLiteResultRow::data( const TQString& columnName, bool *ok ) { TableString::Iterator it = m_string.find( columnName ); @@ -62,12 +62,12 @@ QCString QSQLiteResultRow::data( const QString& columnName, bool *ok ) else { if ( ok ) * ok = false; - return QCString(0); + return TQCString(0); } } -QCString QSQLiteResultRow::data( int column, bool *ok ) +TQCString TQSQLiteResultRow::data( int column, bool *ok ) { TableInt::Iterator it = m_int.find( column ); @@ -80,102 +80,102 @@ QCString QSQLiteResultRow::data( int column, bool *ok ) else { if ( ok ) * ok = false; - return QCString(0); + return TQCString(0); } } /* * DateFormat is 'YYYY-MM-DD' */ -QDate QSQLiteResultRow::dataToDate( const QString& column, bool *ok ) +TQDate TQSQLiteResultRow::dataToDate( const TQString& column, bool *ok ) { - QDate date = QDate::currentDate(); - QString str = data( column, ok ); + TQDate date = TQDate::currentDate(); + TQString str = data( column, ok ); if ( !str.isEmpty() ) { ; // convert } return date; } -QDate QSQLiteResultRow::dataToDate( int column, bool *ok ) +TQDate TQSQLiteResultRow::dataToDate( int column, bool *ok ) { - QDate date = QDate::currentDate(); - QString str = data( column, ok ); + TQDate date = TQDate::currentDate(); + TQString str = data( column, ok ); if ( !str.isEmpty() ) { ; // convert } return date; } -QDateTime QSQLiteResultRow::dataToDateTime( const QString& column ) +TQDateTime TQSQLiteResultRow::dataToDateTime( const TQString& column ) { - QDateTime time = QDateTime::currentDateTime(); + TQDateTime time = TQDateTime::currentDateTime(); return time; } -QDateTime QSQLiteResultRow::dataToDateTime( int column ) +TQDateTime TQSQLiteResultRow::dataToDateTime( int column ) { - QDateTime time = QDateTime::currentDateTime(); + TQDateTime time = TQDateTime::currentDateTime(); return time; } -QSQLiteResult::QSQLiteResult( enum Status status, - const QSQLiteResult::Columns& list, - const QString &error ) +TQSQLiteResult::TQSQLiteResult( enum Status status, + const TQSQLiteResult::Columns& list, + const TQString &error ) : m_status( status ), m_list( list ), m_error( error ) {} -QSQLiteResult::~QSQLiteResult() +TQSQLiteResult::~TQSQLiteResult() {} -QSQLiteResult::Status QSQLiteResult::getStatus() const +TQSQLiteResult::Status TQSQLiteResult::getStatus() const { return m_status; } -void QSQLiteResult::setStatus( QSQLiteResult::Status status ) +void TQSQLiteResult::setStatus( TQSQLiteResult::Status status ) { m_status = status; } -QSQLiteResult::Columns QSQLiteResult::getResults() const +TQSQLiteResult::Columns TQSQLiteResult::getResults() const { return m_list; } -void QSQLiteResult::setResults( const QSQLiteResult::Columns& result ) +void TQSQLiteResult::setResults( const TQSQLiteResult::Columns& result ) { m_list = result; } -void QSQLiteResult::addRow( QSQLiteResultRow row ) +void TQSQLiteResult::addRow( TQSQLiteResultRow row ) { m_list.append( row ); } -QString QSQLiteResult::getError() const +TQString TQSQLiteResult::getError() const { return m_error; } -void QSQLiteResult::setError( const QString &error ) +void TQSQLiteResult::setError( const TQString &error ) { m_error = error; } -QSQLiteResultRow QSQLiteResult::first() +TQSQLiteResultRow TQSQLiteResult::first() { it = m_list.begin(); return ( *it ); } -QSQLiteResultRow QSQLiteResult::next() +TQSQLiteResultRow TQSQLiteResult::next() { ++it; return ( *it ); } -bool QSQLiteResult::atEnd() +bool TQSQLiteResult::atEnd() { if ( it == m_list.end() ) { return true; @@ -184,14 +184,14 @@ bool QSQLiteResult::atEnd() return false; } -QSQLiteResult::Columns::ConstIterator QSQLiteResult::iterator() const +TQSQLiteResult::Columns::ConstIterator TQSQLiteResult::iterator() const { - QSQLiteResult::Columns::ConstIterator it; + TQSQLiteResult::Columns::ConstIterator it; it = m_list.begin(); return it; } -int QSQLiteResult::size() const +int TQSQLiteResult::size() const { return ( m_list.size() ); } diff --git a/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.h b/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.h index d833eda..8311925 100644 --- a/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.h +++ b/krecipes/src/backends/SQLite/libqsqlite/krecqsqliteresult.h @@ -18,39 +18,39 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef QSQLITERESULT_H -#define QSQLITERESULT_H +#ifndef TQSQLITERESULT_H +#define TQSQLITERESULT_H -#include -#include -#include +#include +#include +#include /** * ResultRow represents one row of the resulting answer */ -class QSQLiteResultRow +class TQSQLiteResultRow { public: /** * TableString is used to establish the relations * between the column name and the real item */ - typedef QMap TableString; + typedef TQMap TableString; /** * TableInt is used to establish a relation between a * position of a column and the row value */ - typedef QMap TableInt; + typedef TQMap TableInt; /** * Default c'tor. It has a TableString and a TableInt */ - QSQLiteResultRow( const TableString& = TableString(), + TQSQLiteResultRow( const TableString& = TableString(), const TableInt& = TableInt() ); - QSQLiteResultRow( const QSQLiteResultRow& ); - ~QSQLiteResultRow(); - QSQLiteResultRow &operator=( const QSQLiteResultRow& ); + TQSQLiteResultRow( const TQSQLiteResultRow& ); + ~TQSQLiteResultRow(); + TQSQLiteResultRow &operator=( const TQSQLiteResultRow& ); /** * returns the TableString @@ -66,25 +66,25 @@ public: * retrieves the Data from columnName * */ - QCString data( const QString& columnName, bool *ok = 0 ); + TQCString data( const TQString& columnName, bool *ok = 0 ); /** - * QString for column number + * TQString for column number */ - QCString data( int columnNumber, bool *ok = 0 ); + TQCString data( int columnNumber, bool *ok = 0 ); /** * Date conversion from columnName */ - QDate dataToDate( const QString& columnName, bool *ok = 0 ); + TQDate dataToDate( const TQString& columnName, bool *ok = 0 ); /** * Date conversion from column-number */ - QDate dataToDate( int columnNumber, bool *ok = 0 ); + TQDate dataToDate( int columnNumber, bool *ok = 0 ); - QDateTime dataToDateTime( const QString& columName ); - QDateTime dataToDateTime( int columnNumber ); + TQDateTime dataToDateTime( const TQString& columName ); + TQDateTime dataToDateTime( int columnNumber ); private: TableString m_string; @@ -92,14 +92,14 @@ private: }; /** - * the QSQLiteResult + * the TQSQLiteResult * either a SQL statusment failed or succeeded */ -class QSQLiteResult +class TQSQLiteResult { public: - typedef QValueList Columns; + typedef TQValueList Columns; /** The Status of a Result */ enum Status{ Success = 0, Failure, Undefined }; @@ -110,23 +110,23 @@ public: * @param r ResultItems * @param error Error Message */ - QSQLiteResult( enum Status status = Undefined, + TQSQLiteResult( enum Status status = Undefined, const Columns &r = Columns(), - const QString &error = 0L ); - ~QSQLiteResult(); + const TQString &error = 0L ); + ~TQSQLiteResult(); Status getStatus() const; Columns getResults() const; - QString getError() const; + TQString getError() const; void setStatus( enum Status status ); void setResults( const Columns &result ); - void setError( const QString &error ); + void setError( const TQString &error ); - void addRow( QSQLiteResultRow row ); + void addRow( TQSQLiteResultRow row ); - QSQLiteResultRow first(); - QSQLiteResultRow next(); + TQSQLiteResultRow first(); + TQSQLiteResultRow next(); bool atEnd(); Columns::ConstIterator iterator() const; @@ -135,7 +135,7 @@ public: private: enum Status m_status; Columns m_list; - QString m_error; + TQString m_error; Columns::Iterator it; }; diff --git a/krecipes/src/backends/SQLite/literecipedb.cpp b/krecipes/src/backends/SQLite/literecipedb.cpp index ccd88ce..f0d46c7 100644 --- a/krecipes/src/backends/SQLite/literecipedb.cpp +++ b/krecipes/src/backends/SQLite/literecipedb.cpp @@ -14,7 +14,7 @@ #include "literecipedb.h" -#include +#include #include #include @@ -33,9 +33,9 @@ //keep these two around for porting old databases int sqlite_decode_binary( const unsigned char *in, unsigned char *out ); -QString escape( const QString &s ); +TQString escape( const TQString &s ); -LiteRecipeDB::LiteRecipeDB( const QString &_dbFile ) : QSqlRecipeDB( QString::null, QString::null, QString::null, _dbFile ) +LiteRecipeDB::LiteRecipeDB( const TQString &_dbFile ) : TQSqlRecipeDB( TQString::null, TQString::null, TQString::null, _dbFile ) { /* KConfig * config = KGlobal::config(); config->setGroup( "Server" ); @@ -52,7 +52,7 @@ LiteRecipeDB::~LiteRecipeDB() int LiteRecipeDB::lastInsertID() { int lastID = -1; - QSqlQuery query("SELECT lastInsertID()",database); + TQSqlQuery query("SELECT lastInsertID()",database); if ( query.isActive() && query.first() ) lastID = query.value(0).toInt(); @@ -61,36 +61,36 @@ int LiteRecipeDB::lastInsertID() return lastID; } -QStringList LiteRecipeDB::backupCommand() const +TQStringList LiteRecipeDB::backupCommand() const { #if HAVE_SQLITE - QString binary = "sqlite"; + TQString binary = "sqlite"; #elif HAVE_SQLITE3 - QString binary = "sqlite3"; + TQString binary = "sqlite3"; #endif KConfig * config = KGlobal::config(); config->setGroup( "Server" ); binary = config->readEntry( "SQLitePath", binary ); - QStringList command; + TQStringList command; command<databaseName()<<".dump"; return command; } -QStringList LiteRecipeDB::restoreCommand() const +TQStringList LiteRecipeDB::restoreCommand() const { #if HAVE_SQLITE - QString binary = "sqlite"; + TQString binary = "sqlite"; #elif HAVE_SQLITE3 - QString binary = "sqlite3"; + TQString binary = "sqlite3"; #endif KConfig * config = KGlobal::config(); config->setGroup( "Server" ); binary = config->readEntry( "SQLitePath", binary ); - QStringList command; + TQStringList command; command<databaseName(); return command; } @@ -100,16 +100,16 @@ void LiteRecipeDB::createDB() //The file is created by SQLite automatically } -void LiteRecipeDB::createTable( const QString &tableName ) +void LiteRecipeDB::createTable( const TQString &tableName ) { - QStringList commands; + TQStringList commands; if ( tableName == "recipes" ) - commands << QString( "CREATE TABLE recipes (id INTEGER NOT NULL,title VARCHAR(%1), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER DEFAULT '-1', instructions TEXT, photo BLOB, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP, PRIMARY KEY (id));" ).arg( maxRecipeTitleLength() ); + commands << TQString( "CREATE TABLE recipes (id INTEGER NOT NULL,title VARCHAR(%1), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER DEFAULT '-1', instructions TEXT, photo BLOB, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP, PRIMARY KEY (id));" ).arg( maxRecipeTitleLength() ); else if ( tableName == "ingredients" ) - commands << QString( "CREATE TABLE ingredients (id INTEGER NOT NULL, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxIngredientNameLength() ); + commands << TQString( "CREATE TABLE ingredients (id INTEGER NOT NULL, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxIngredientNameLength() ); else if ( tableName == "ingredient_list" ) { commands << "CREATE TABLE ingredient_list (id INTEGER NOT NULL, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, substitute_for INTEGER, PRIMARY KEY(id) );" @@ -122,11 +122,11 @@ void LiteRecipeDB::createTable( const QString &tableName ) commands << "CREATE TABLE unit_list (ingredient_id INTEGER, unit_id INTEGER);"; else if ( tableName == "units" ) - commands << QString( "CREATE TABLE units (id INTEGER NOT NULL, name VARCHAR(%1), name_abbrev VARCHAR(%2), plural VARCHAR(%3), plural_abbrev VARCHAR(%4), type INTEGER NOT NULL DEFAULT '0',PRIMARY KEY (id));" ) + commands << TQString( "CREATE TABLE units (id INTEGER NOT NULL, name VARCHAR(%1), name_abbrev VARCHAR(%2), plural VARCHAR(%3), plural_abbrev VARCHAR(%4), type INTEGER NOT NULL DEFAULT '0',PRIMARY KEY (id));" ) .arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() ).arg( maxUnitNameLength() ); else if ( tableName == "prep_methods" ) - commands << QString( "CREATE TABLE prep_methods (id INTEGER NOT NULL, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); + commands << TQString( "CREATE TABLE prep_methods (id INTEGER NOT NULL, name VARCHAR(%1), PRIMARY KEY (id));" ).arg( maxPrepMethodNameLength() ); else if ( tableName == "prep_method_list" ) { commands << "CREATE TABLE prep_method_list (ingredient_list_id INTEGER NOT NULL,prep_method_id INTEGER NOT NULL, order_index INTEGER );" @@ -153,7 +153,7 @@ void LiteRecipeDB::createTable( const QString &tableName ) commands << "CREATE TABLE units_conversion (unit1_id INTEGER, unit2_id INTEGER, ratio FLOAT);"; else if ( tableName == "categories" ) { - commands << QString( "CREATE TABLE categories (id INTEGER NOT NULL, name varchar(%1) default NULL, parent_id INGEGER NOT NULL default -1, PRIMARY KEY (id));" ).arg( maxCategoryNameLength() ); + commands << TQString( "CREATE TABLE categories (id INTEGER NOT NULL, name varchar(%1) default NULL, parent_id INGEGER NOT NULL default -1, PRIMARY KEY (id));" ).arg( maxCategoryNameLength() ); commands << "CREATE index parent_id_index ON categories(parent_id);"; } else if ( tableName == "category_list" ) { @@ -163,20 +163,20 @@ void LiteRecipeDB::createTable( const QString &tableName ) } else if ( tableName == "authors" ) - commands << QString( "CREATE TABLE authors (id INTEGER NOT NULL, name varchar(%1) default NULL,PRIMARY KEY (id));" ).arg( maxAuthorNameLength() ); + commands << TQString( "CREATE TABLE authors (id INTEGER NOT NULL, name varchar(%1) default NULL,PRIMARY KEY (id));" ).arg( maxAuthorNameLength() ); else if ( tableName == "author_list" ) commands << "CREATE TABLE author_list (recipe_id INTEGER NOT NULL,author_id INTEGER NOT NULL);"; else if ( tableName == "db_info" ) { commands << "CREATE TABLE db_info (ver FLOAT NOT NULL,generated_by varchar(200) default NULL);"; - commands << QString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() ); + commands << TQString( "INSERT INTO db_info VALUES(%1,'Krecipes %2');" ).arg( latestDBVersion() ).arg( krecipes_version() ); } else if ( tableName == "ingredient_groups" ) { - commands << QString( "CREATE TABLE ingredient_groups (id INTEGER NOT NULL, name varchar(%1), PRIMARY KEY (id));" ).arg( maxIngGroupNameLength() ); + commands << TQString( "CREATE TABLE ingredient_groups (id INTEGER NOT NULL, name varchar(%1), PRIMARY KEY (id));" ).arg( maxIngGroupNameLength() ); } else if ( tableName == "yield_types" ) { - commands << QString( "CREATE TABLE yield_types (id INTEGER NOT NULL, name varchar(%1), PRIMARY KEY (id));" ).arg( maxYieldTypeLength() ); + commands << TQString( "CREATE TABLE yield_types (id INTEGER NOT NULL, name varchar(%1), PRIMARY KEY (id));" ).arg( maxYieldTypeLength() ); } else if ( tableName == "ratings" ) @@ -192,22 +192,22 @@ void LiteRecipeDB::createTable( const QString &tableName ) return ; // execute the queries - for ( QStringList::const_iterator it = commands.begin(); it != commands.end(); ++it ) + for ( TQStringList::const_iterator it = commands.begin(); it != commands.end(); ++it ) database->exec( *it ); } void LiteRecipeDB::portOldDatabases( float version ) { - QString command; - if ( qRound(version*10) < 5 ) { + TQString command; + if ( tqRound(version*10) < 5 ) { //===========add prep_method_id to ingredient_list table //There's no ALTER command in SQLite, so we have to copy all data to a new table and then recreate the table with the prep_method_id database->exec( "CREATE TABLE ingredient_list_copy (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, unit_id INTEGER, order_index INTEGER);" ); - QSqlQuery copyQuery( "SELECT recipe_id,ingredient_id,amount,unit_id,order_index FROM ingredient_list;", database ); + TQSqlQuery copyQuery( "SELECT recipe_id,ingredient_id,amount,unit_id,order_index FROM ingredient_list;", database ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO ingredient_list_copy VALUES(%1,%2,%3,%4,%5);" ) + command = TQString( "INSERT INTO ingredient_list_copy VALUES(%1,%2,%3,%4,%5);" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( copyQuery.value( 1 ).toInt() ) .arg( copyQuery.value( 2 ).toDouble() ) @@ -223,7 +223,7 @@ void LiteRecipeDB::portOldDatabases( float version ) copyQuery = database->exec( "SELECT * FROM ingredient_list_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO ingredient_list VALUES(%1,%2,%3,%4,%5,%6);" ) + command = TQString( "INSERT INTO ingredient_list VALUES(%1,%2,%3,%4,%5,%6);" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( copyQuery.value( 1 ).toInt() ) .arg( copyQuery.value( 2 ).toDouble() ) @@ -247,7 +247,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO authors_copy VALUES(%1,'%2');" ) + command = TQString( "INSERT INTO authors_copy VALUES(%1,'%2');" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -261,7 +261,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO authors VALUES(%1,'%2');" ) + command = TQString( "INSERT INTO authors VALUES(%1,'%2');" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -278,7 +278,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO categories_copy VALUES(%1,'%2');" ) + command = TQString( "INSERT INTO categories_copy VALUES(%1,'%2');" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -292,7 +292,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO categories VALUES(%1,'%2');" ) + command = TQString( "INSERT INTO categories VALUES(%1,'%2');" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -309,14 +309,14 @@ void LiteRecipeDB::portOldDatabases( float version ) database->exec( command ); } - if ( qRound(version*10) < 6 ) { + if ( tqRound(version*10) < 6 ) { //==================add a column to 'categories' to allow subcategories database->exec( "CREATE TABLE categories_copy (id INTEGER, name varchar(40));" ); - QSqlQuery copyQuery = database->exec( "SELECT * FROM categories;" ); + TQSqlQuery copyQuery = database->exec( "SELECT * FROM categories;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO categories_copy VALUES(%1,'%2');" ) + command = TQString( "INSERT INTO categories_copy VALUES(%1,'%2');" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -330,7 +330,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO categories VALUES(%1,'%2',-1);" ) + command = TQString( "INSERT INTO categories VALUES(%1,'%2',-1);" ) .arg( copyQuery.value( 0 ).toInt() ) .arg( escape( copyQuery.value( 1 ).toString() ) ); database->exec( command ); @@ -347,14 +347,14 @@ void LiteRecipeDB::portOldDatabases( float version ) database->exec( command ); } - if ( qRound(version*100) < 61 ) { + if ( tqRound(version*100) < 61 ) { //==================add a column to 'recipes' to allow prep time database->exec( "CREATE TABLE recipes_copy (id INTEGER NOT NULL,title VARCHAR(200),persons INTEGER,instructions TEXT, photo BLOB, PRIMARY KEY (id));" ); - QSqlQuery copyQuery = database->exec( "SELECT * FROM recipes;" ); + TQSqlQuery copyQuery = database->exec( "SELECT * FROM recipes;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO recipes_copy VALUES(%1,'%2','%3','%4','%5');" ) + command = TQString( "INSERT INTO recipes_copy VALUES(%1,'%2','%3','%4','%5');" ) .arg( escape( copyQuery.value( 0 ).toString() ) ) .arg( escape( copyQuery.value( 1 ).toString() ) ) .arg( escape( copyQuery.value( 2 ).toString() ) ) @@ -371,7 +371,7 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - command = QString( "INSERT INTO recipes VALUES(%1,'%2','%3','%4','%5',NULL);" ) + command = TQString( "INSERT INTO recipes VALUES(%1,'%2','%3','%4','%5',NULL);" ) .arg( escape( copyQuery.value( 0 ).toString() ) ) .arg( escape( copyQuery.value( 1 ).toString() ) ) .arg( escape( copyQuery.value( 2 ).toString() ) ) @@ -392,12 +392,12 @@ void LiteRecipeDB::portOldDatabases( float version ) database->exec( command ); } - if ( qRound(version*100) < 62 ) { + if ( tqRound(version*100) < 62 ) { database->transaction(); //==================add a column to 'ingredient_list' to allow grouping ingredients database->exec( "CREATE TABLE ingredient_list_copy (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, unit_id INTEGER, prep_method_id INTEGER, order_index INTEGER);" ); - QSqlQuery copyQuery = database->exec( "SELECT * FROM ingredient_list;" ); + TQSqlQuery copyQuery = database->exec( "SELECT * FROM ingredient_list;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -441,12 +441,12 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 63 ) { + if ( tqRound(version*100) < 63 ) { database->transaction(); //==================add a column to 'units' to allow handling plurals database->exec( "CREATE TABLE units_copy (id INTEGER NOT NULL, name VARCHAR(20), PRIMARY KEY (id));" ); - QSqlQuery copyQuery = database->exec( "SELECT id,name FROM units;" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,name FROM units;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -473,10 +473,10 @@ void LiteRecipeDB::portOldDatabases( float version ) } database->exec( "DROP TABLE units_copy" ); - QSqlQuery result = database->exec( "SELECT id,name FROM units WHERE plural ISNULL;" ); + TQSqlQuery result = database->exec( "SELECT id,name FROM units WHERE plural ISNULL;" ); if ( result.isActive() ) { while ( result.next() ) { - command = "UPDATE units SET plural='" + escape( result.value( 1 ).toString() ) + "' WHERE id=" + QString::number( result.value( 0 ).toInt() ); + command = "UPDATE units SET plural='" + escape( result.value( 1 ).toString() ) + "' WHERE id=" + TQString::number( result.value( 0 ).toInt() ); database->exec( command ); emit progress(); @@ -491,11 +491,11 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*10) < 7 ) { //simply call 0.63 -> 0.7 + if ( tqRound(version*10) < 7 ) { //simply call 0.63 -> 0.7 database->exec( "UPDATE db_info SET ver='0.7';" ); } - if ( qRound(version*100) < 81 ) { + if ( tqRound(version*100) < 81 ) { database->transaction(); addColumn("CREATE TABLE %1 (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, %2 unit_id INTEGER, prep_method_id INTEGER, order_index INTEGER, group_id INTEGER)","amount_offset FLOAT","'0'","ingredient_list",3); @@ -507,12 +507,12 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 82 ) { + if ( tqRound(version*100) < 82 ) { database->transaction(); //==================add a columns to 'recipes' to allow yield range + yield type database->exec( "CREATE TABLE recipes_copy (id INTEGER NOT NULL,title VARCHAR(200),persons INTEGER,instructions TEXT, photo BLOB, prep_time TIME, PRIMARY KEY (id));" ); - QSqlQuery copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes;" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,title,persons,instructions,photo,prep_time FROM recipes;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -556,12 +556,12 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 83 ) { + if ( tqRound(version*100) < 83 ) { database->transaction(); //====add a id columns to 'ingredient_list' to identify it for the prep method list database->exec( "CREATE TABLE ingredient_list_copy (recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, prep_method_id INTEGER, order_index INTEGER, group_id INTEGER);" ); - QSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list" ); + TQSqlQuery copyQuery = database->exec( "SELECT recipe_id,ingredient_id,amount,amount_offset,unit_id,prep_method_id,order_index,group_id FROM ingredient_list" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -588,7 +588,7 @@ void LiteRecipeDB::portOldDatabases( float version ) while ( copyQuery.next() ) { command = "INSERT INTO ingredient_list VALUES(" - + QString("NULL") + + TQString("NULL") + ",'" + escape( copyQuery.value( 0 ).toString() ) + "','" + escape( copyQuery.value( 1 ).toString() ) + "','" + escape( copyQuery.value( 2 ).toString() ) @@ -602,8 +602,8 @@ void LiteRecipeDB::portOldDatabases( float version ) int prep_method_id = copyQuery.value( 5 ).toInt(); if ( prep_method_id != -1 ) { command = "INSERT INTO prep_method_list VALUES('" - + QString::number(lastInsertID()) - + "','" + QString::number(prep_method_id) + + TQString::number(lastInsertID()) + + "','" + TQString::number(prep_method_id) + "','1" //order_index + "')"; database->exec( command ); @@ -622,12 +622,12 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 84 ) { + if ( tqRound(version*100) < 84 ) { database->transaction(); //==================add a columns to 'recipes' to allow storing atime, mtime, ctime database->exec( "CREATE TABLE recipes_copy (id INTEGER NOT NULL,title VARCHAR(200), yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER, instructions TEXT, photo BLOB, prep_time TIME, PRIMARY KEY (id));" ); - QSqlQuery copyQuery = database->exec( "SELECT id,title,yield_amount,yield_amount_offset,yield_type_id,instructions,photo,prep_time FROM recipes;" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,title,yield_amount,yield_amount_offset,yield_type_id,instructions,photo,prep_time FROM recipes;" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -651,7 +651,7 @@ void LiteRecipeDB::portOldDatabases( float version ) copyQuery = database->exec( "SELECT id,title,yield_amount,yield_amount_offset,yield_type_id,instructions,photo,prep_time FROM recipes_copy" ); if ( copyQuery.isActive() ) { - QString current_timestamp = QDateTime::currentDateTime().toString(Qt::ISODate); + TQString current_timestamp = TQDateTime::currentDateTime().toString(TQt::ISODate); while ( copyQuery.next() ) { command = "INSERT INTO recipes VALUES('" + escape( copyQuery.value( 0 ).toString() ) @@ -677,15 +677,15 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 85 ) { + if ( tqRound(version*100) < 85 ) { database->transaction(); - QSqlQuery query( "SELECT id,photo FROM recipes", database ); + TQSqlQuery query( "SELECT id,photo FROM recipes", database ); if ( query.isActive() ) { while ( query.next() ) { - QImage photo; - QString photoString = query.value(1).toString(); + TQImage photo; + TQString photoString = query.value(1).toString(); // Decode the photo uchar *photoArray = new uchar [ photoString.length() + 1 ]; @@ -697,13 +697,13 @@ void LiteRecipeDB::portOldDatabases( float version ) // picture will now have a ready-to-use image delete[] photoArray; - QByteArray ba; - QBuffer buffer( ba ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); - QImageIO iio( &buffer, "JPEG" ); + TQImageIO iio( &buffer, "JPEG" ); iio.setImage( photo ); iio.write(); - //recipe->photo.save( &buffer, "JPEG" ); don't need QImageIO in QT 3.2 + //recipe->photo.save( &buffer, "JPEG" ); don't need TQImageIO in QT 3.2 storePhoto( query.value(0).toInt(), ba ); emit progress(); @@ -715,24 +715,24 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 86 ) { + if ( tqRound(version*100) < 86 ) { database->transaction(); database->exec( "CREATE index gidil_index ON ingredient_list(group_id)" ); - QSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); + TQSqlQuery query( "SELECT id,name FROM ingredient_groups ORDER BY name", database ); - QString last; + TQString last; int lastID; if ( query.isActive() ) { while ( query.next() ) { - QString name = query.value(1).toString(); + TQString name = query.value(1).toString(); int id = query.value(0).toInt(); if ( last == name ) { - QString command = QString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); + TQString command = TQString("UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2").arg(lastID).arg(id); database->exec(command); - command = QString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); + command = TQString("DELETE FROM ingredient_groups WHERE id=%1").arg(id); database->exec(command); } last = name; @@ -747,32 +747,32 @@ void LiteRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.86 failed. Maybe you should try again."<exec( QString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); - database->exec( QString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (1,'%1')").arg(i18n("Overall")) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (2,'%1')").arg(i18n("Taste") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (3,'%1')").arg(i18n("Appearance") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (4,'%1')").arg(i18n("Originality") ) ); + database->exec( TQString("INSERT INTO rating_criteria VALUES (5,'%1')").arg(i18n("Ease of Preparation") ) ); database->exec( "UPDATE db_info SET ver='0.87',generated_by='Krecipes SVN (20051014)'" ); } - if ( qRound(version*100) < 90 ) { + if ( tqRound(version*100) < 90 ) { database->exec("UPDATE db_info SET ver='0.9',generated_by='Krecipes 0.9'"); } - if ( qRound(version*100) < 91 ) { + if ( tqRound(version*100) < 91 ) { database->exec("CREATE index parent_id_index ON categories(parent_id)"); database->exec("UPDATE db_info SET ver='0.91',generated_by='Krecipes SVN (20060526)'"); } - if ( qRound(version*100) < 92 ) { + if ( tqRound(version*100) < 92 ) { database->transaction(); //==================add a columns to 'units' to allow unit abbreviations database->exec( "CREATE TABLE units_copy (id INTEGER NOT NULL, name VARCHAR(20), plural VARCHAR(20))" ); - QSqlQuery copyQuery = database->exec( "SELECT id,name,plural FROM units" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,name,plural FROM units" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { @@ -810,7 +810,7 @@ void LiteRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.92 failed. Maybe you should try again."<transaction(); addColumn("CREATE TABLE %1 (id INTEGER NOT NULL, recipe_id INTEGER, ingredient_id INTEGER, amount FLOAT, amount_offset FLOAT, unit_id INTEGER, order_index INTEGER, group_id INTEGER, %2 PRIMARY KEY(id) )","substitute_for INTEGER","NULL","ingredient_list",8); @@ -823,23 +823,23 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 94 ) { + if ( tqRound(version*100) < 94 ) { database->transaction(); //==================add a column to 'units' to allow specifying a type database->exec( "CREATE TABLE units_copy (id INTEGER NOT NULL, name VARCHAR(20), name_abbrev VARCHAR(20), plural VARCHAR(20), plural_abbrev VARCHAR(20))" ); - QSqlQuery copyQuery = database->exec( "SELECT id,name,name_abbrev,plural,plural_abbrev FROM units" ); + TQSqlQuery copyQuery = database->exec( "SELECT id,name,name_abbrev,plural,plural_abbrev FROM units" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QString name_abbrev = escape( copyQuery.value( 2 ).toString() ); + TQString name_abbrev = escape( copyQuery.value( 2 ).toString() ); if ( name_abbrev.isEmpty() ) name_abbrev = "NULL"; else { name_abbrev.prepend("'"); name_abbrev.append("'"); } - QString plural_abbrev = escape( copyQuery.value( 4 ).toString() ); + TQString plural_abbrev = escape( copyQuery.value( 4 ).toString() ); if ( plural_abbrev.isEmpty() ) plural_abbrev = "NULL"; else { @@ -865,14 +865,14 @@ void LiteRecipeDB::portOldDatabases( float version ) if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QString name_abbrev = escape( copyQuery.value( 2 ).toString() ); + TQString name_abbrev = escape( copyQuery.value( 2 ).toString() ); if ( name_abbrev.isEmpty() ) name_abbrev = "NULL"; else { name_abbrev.prepend("'"); name_abbrev.append("'"); } - QString plural_abbrev = escape( copyQuery.value( 4 ).toString() ); + TQString plural_abbrev = escape( copyQuery.value( 4 ).toString() ); if ( plural_abbrev.isEmpty() ) plural_abbrev = "NULL"; else { @@ -899,32 +899,32 @@ void LiteRecipeDB::portOldDatabases( float version ) database->commit(); } - if ( qRound(version*100) < 95 ) { + if ( tqRound(version*100) < 95 ) { database->exec( "DROP TABLE ingredient_weights" ); createTable( "ingredient_weights" ); database->exec( "UPDATE db_info SET ver='0.95',generated_by='Krecipes SVN (20060726)'" ); } } -void LiteRecipeDB::addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index ) +void LiteRecipeDB::addColumn( const TQString &new_table_sql, const TQString &new_col_info, const TQString &default_value, const TQString &table_name, int col_index ) { - QString command; + TQString command; - command = QString(new_table_sql).arg(table_name+"_copy").arg(QString::null); + command = TQString(new_table_sql).arg(table_name+"_copy").arg(TQString::null); kdDebug()<<"calling: "<exec( command ); command = "SELECT * FROM "+table_name; kdDebug()<<"calling: "<exec( command ); + TQSqlQuery copyQuery = database->exec( command ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QStringList dataList; + TQStringList dataList; for ( int i = 0 ;; ++i ) { if ( copyQuery.value(i).isNull() ) break; - QString data = copyQuery.value(i).toString(); + TQString data = copyQuery.value(i).toString(); dataList << "'"+escape(data)+"'"; } @@ -936,11 +936,11 @@ void LiteRecipeDB::addColumn( const QString &new_table_sql, const QString &new_c } } database->exec( "DROP TABLE "+table_name ); - database->exec( QString(new_table_sql).arg(table_name).arg(new_col_info+",") ); + database->exec( TQString(new_table_sql).arg(table_name).arg(new_col_info+",") ); copyQuery = database->exec( "SELECT * FROM "+table_name+"_copy" ); if ( copyQuery.isActive() ) { while ( copyQuery.next() ) { - QStringList dataList; + TQStringList dataList; for ( int i = 0 ;; ++i ) { if ( i == col_index ) dataList << default_value; @@ -948,7 +948,7 @@ void LiteRecipeDB::addColumn( const QString &new_table_sql, const QString &new_c if ( copyQuery.value(i).isNull() ) break; - QString data = copyQuery.value(i).toString(); + TQString data = copyQuery.value(i).toString(); dataList << "'"+escape(data)+"'"; } @@ -962,12 +962,12 @@ void LiteRecipeDB::addColumn( const QString &new_table_sql, const QString &new_c database->exec( "DROP TABLE "+table_name+"_copy" ); } -QString LiteRecipeDB::escapeAndEncode( const QString &s ) const +TQString LiteRecipeDB::escapeAndEncode( const TQString &s ) const { - QString s_escaped; + TQString s_escaped; // Escape - s_escaped = escape( QString::fromLatin1(s.utf8()) ); + s_escaped = escape( TQString::fromLatin1(s.utf8()) ); // Return encoded return s_escaped.latin1(); // Note that the text has already been converted before escaping. @@ -1009,9 +1009,9 @@ int sqlite_decode_binary( const unsigned char *in, unsigned char *out ) return i; } -QString escape( const QString &s ) +TQString escape( const TQString &s ) { - QString s_escaped = s; + TQString s_escaped = s; if ( !s_escaped.isEmpty() ) { //###: sqlite_mprintf() seems to fill an empty string with garbage // Escape using SQLite's function diff --git a/krecipes/src/backends/SQLite/literecipedb.h b/krecipes/src/backends/SQLite/literecipedb.h index c83672f..e0d8e76 100644 --- a/krecipes/src/backends/SQLite/literecipedb.h +++ b/krecipes/src/backends/SQLite/literecipedb.h @@ -15,13 +15,13 @@ #include "backends/qsqlrecipedb.h" -#include +#include #include "qsql_sqlite.h" #define SQLITE_DRIVER "KRESQLITE" -class LiteRecipeDB : public QSqlRecipeDB +class LiteRecipeDB : public TQSqlRecipeDB { Q_OBJECT @@ -30,28 +30,28 @@ private: void createDB( void ); public: - LiteRecipeDB( const QString &DBName = DEFAULT_DB_NAME ); + LiteRecipeDB( const TQString &DBName = DEFAULT_DB_NAME ); ~LiteRecipeDB( void ); virtual int lastInsertID(); - virtual void createTable( const QString &tableName ); - virtual void givePermissions(const QString&, const QString&, const QString&, const QString&){} //no permissions in this backend + virtual void createTable( const TQString &tableName ); + virtual void givePermissions(const TQString&, const TQString&, const TQString&, const TQString&){} //no permissions in this backend protected: - virtual QSqlDriver *qsqlDriver() const + virtual TQSqlDriver *qsqlDriver() const { return new KreSQLiteDriver(); } - virtual QString escapeAndEncode( const QString &s ) const; + virtual TQString escapeAndEncode( const TQString &s ) const; private: virtual void portOldDatabases( float version ); - virtual QStringList backupCommand() const; - virtual QStringList restoreCommand() const; + virtual TQStringList backupCommand() const; + virtual TQStringList restoreCommand() const; - void addColumn( const QString &new_table_sql, const QString &new_col_info, const QString &default_value, const QString &table_name, int col_index ); + void addColumn( const TQString &new_table_sql, const TQString &new_col_info, const TQString &default_value, const TQString &table_name, int col_index ); }; diff --git a/krecipes/src/backends/SQLite/qsql_sqlite.cpp b/krecipes/src/backends/SQLite/qsql_sqlite.cpp index b39a10b..8c228ef 100644 --- a/krecipes/src/backends/SQLite/qsql_sqlite.cpp +++ b/krecipes/src/backends/SQLite/qsql_sqlite.cpp @@ -10,11 +10,11 @@ #include "qsql_sqlite.h" -#include -#include -#include +#include +#include +#include -#include +#include #include #include @@ -22,7 +22,7 @@ #include "libqsqlite/krecqsqlitedb.h" #include "libqsqlite/krecqsqliteresult.h" -#define QSQLITE_DRIVER_NAME "KRE_QSQLITE" +#define TQSQLITE_DRIVER_NAME "KRE_QSQLITE" #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,43 +35,43 @@ #include #endif -class KreSQLiteResult : public QSqlResult +class KreSQLiteResult : public TQSqlResult { public: - KreSQLiteResult( const KreSQLiteDriver *d ): QSqlResult( d ) + KreSQLiteResult( const KreSQLiteDriver *d ): TQSqlResult( d ) { db = d->db; } ~KreSQLiteResult() {} protected: - QVariant data( int ); - bool reset ( const QString& ); + TQVariant data( int ); + bool reset ( const TQString& ); bool fetch( int ); bool fetchFirst(); bool fetchNext(); bool fetchLast(); bool isNull( int ); - QSqlRecord record(); + TQSqlRecord record(); int size(); int numRowsAffected(); private: - QSQLiteResult result; - QSQLiteResultRow row; + TQSQLiteResult result; + TQSQLiteResultRow row; - QSQLiteDB *db; + TQSQLiteDB *db; }; -QVariant KreSQLiteResult::data( int field ) +TQVariant KreSQLiteResult::data( int field ) { if ( !isSelect() ) { - //qWarning( "KreSQLiteResult::data: column %d out of range", field ); - qWarning( "KreSQLiteResult::data: not a select statement" ); - return QVariant(); + //tqWarning( "KreSQLiteResult::data: column %d out of range", field ); + tqWarning( "KreSQLiteResult::data: not a select statement" ); + return TQVariant(); } - return QVariant(row.data(field)); + return TQVariant(row.data(field)); } bool KreSQLiteResult::fetch( int i ) @@ -141,9 +141,9 @@ bool KreSQLiteResult::isNull( int i ) return false; } -QSqlRecord KreSQLiteResult::record() +TQSqlRecord KreSQLiteResult::record() {kdDebug()<<"record"<open(QFile::encodeName(file)) ) { - setLastError(QSqlError("Error to open database", 0, QSqlError::Connection)); + db = new TQSQLiteDB; + if ( !db->open(TQFile::encodeName(file)) ) { + setLastError(TQSqlError("Error to open database", 0, TQSqlError::Connection)); setOpenError(true); setOpen(false); return false; @@ -252,9 +252,9 @@ void KreSQLiteDriver::close() } } -QSqlQuery KreSQLiteDriver::createQuery() const +TQSqlQuery KreSQLiteDriver::createQuery() const { - return QSqlQuery(new KreSQLiteResult(this)); + return TQSqlQuery(new KreSQLiteResult(this)); } bool KreSQLiteDriver::beginTransaction() @@ -262,12 +262,12 @@ bool KreSQLiteDriver::beginTransaction() if (!isOpen() || isOpenError()) return false; - QSQLiteResult result = db->executeQuery( "BEGIN" ); + TQSQLiteResult result = db->executeQuery( "BEGIN" ); int status = result.getStatus(); - if (status == QSQLiteResult::Success) + if (status == TQSQLiteResult::Success) return true; - setLastError(QSqlError("Unable to begin transaction", result.getError(), QSqlError::Transaction, status)); + setLastError(TQSqlError("Unable to begin transaction", result.getError(), TQSqlError::Transaction, status)); return false; } @@ -276,12 +276,12 @@ bool KreSQLiteDriver::commitTransaction() if (!isOpen() || isOpenError()) return false; - QSQLiteResult result = db->executeQuery( "COMMIT" ); + TQSQLiteResult result = db->executeQuery( "COMMIT" ); int status = result.getStatus(); - if (status == QSQLiteResult::Success) + if (status == TQSQLiteResult::Success) return true; - setLastError(QSqlError("Unable to commit transaction", result.getError(), QSqlError::Transaction, status)); + setLastError(TQSqlError("Unable to commit transaction", result.getError(), TQSqlError::Transaction, status)); return false; } @@ -290,31 +290,31 @@ bool KreSQLiteDriver::rollbackTransaction() if (!isOpen() || isOpenError()) return false; - QSQLiteResult result = db->executeQuery( "ROLLBACK" ); + TQSQLiteResult result = db->executeQuery( "ROLLBACK" ); int status = result.getStatus(); if (status == SQLITE_OK) return true; - setLastError(QSqlError("Unable to rollback transaction", result.getError(), QSqlError::Transaction, status)); + setLastError(TQSqlError("Unable to rollback transaction", result.getError(), TQSqlError::Transaction, status)); return false; } -QStringList KreSQLiteDriver::tables(const QString &typeName) const +TQStringList KreSQLiteDriver::tables(const TQString &typeName) const { - QStringList res; + TQStringList res; if (!isOpen()) return res; int type = typeName.toInt(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(true); - #if (QT_VERSION-0 >= 0x030000) - if ((type & (int)QSql::Tables) && (type & (int)QSql::Views)) + #if (TQT_VERSION-0 >= 0x030000) + if ((type & (int)TQSql::Tables) && (type & (int)TQSql::Views)) q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'"); - else if (typeName.isEmpty() || (type & (int)QSql::Tables)) + else if (typeName.isEmpty() || (type & (int)TQSql::Tables)) q.exec("SELECT name FROM sqlite_master WHERE type='table'"); - else if (type & (int)QSql::Views) + else if (type & (int)TQSql::Views) q.exec("SELECT name FROM sqlite_master WHERE type='view'"); #else q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'"); @@ -326,8 +326,8 @@ QStringList KreSQLiteDriver::tables(const QString &typeName) const } } - #if (QT_VERSION-0 >= 0x030000) - if (type & (int)QSql::SystemTables) { + #if (TQT_VERSION-0 >= 0x030000) + if (type & (int)TQSql::SystemTables) { // there are no internal tables beside this one: res.append("sqlite_master"); } @@ -336,18 +336,18 @@ QStringList KreSQLiteDriver::tables(const QString &typeName) const return res; } -QSqlIndex KreSQLiteDriver::primaryIndex(const QString &tblname) const +TQSqlIndex KreSQLiteDriver::primaryIndex(const TQString &tblname) const { - QSqlRecordInfo rec(recordInfo(tblname)); // expensive :( + TQSqlRecordInfo rec(recordInfo(tblname)); // expensive :( if (!isOpen()) - return QSqlIndex(); + return TQSqlIndex(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(true); // finrst find a UNIQUE INDEX q.exec("PRAGMA index_list('" + tblname + "');"); - QString indexname; + TQString indexname; while(q.next()) { if (q.value(2).toInt()==1) { indexname = q.value(1).toString(); @@ -355,64 +355,64 @@ QSqlIndex KreSQLiteDriver::primaryIndex(const QString &tblname) const } } if (indexname.isEmpty()) - return QSqlIndex(); + return TQSqlIndex(); q.exec("PRAGMA index_info('" + indexname + "');"); - QSqlIndex index(tblname, indexname); + TQSqlIndex index(tblname, indexname); while(q.next()) { - QString name = q.value(2).toString(); - QSqlVariant::Type type = QSqlVariant::Invalid; + TQString name = q.value(2).toString(); + TQSqlVariant::Type type = TQSqlVariant::Invalid; if (rec.contains(name)) type = rec.find(name).type(); - index.append(QSqlField(name, type)); + index.append(TQSqlField(name, type)); } return index; } #if 0 -QSqlRecordInfo KreSQLiteDriver::recordInfo(const QString &tbl) const +TQSqlRecordInfo KreSQLiteDriver::recordInfo(const TQString &tbl) const { if (!isOpen()) - return QSqlRecordInfo(); + return TQSqlRecordInfo(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(true); q.exec("SELECT * FROM " + tbl + " LIMIT 1"); -return QSqlRecordInfo(); +return TQSqlRecordInfo(); // return recordInfo(q); } -QSqlRecord KreSQLiteDriver::record(const QString &tblname) const +TQSqlRecord KreSQLiteDriver::record(const TQString &tblname) const { if (!isOpen()) - return QSqlRecord(); + return TQSqlRecord(); return recordInfo(tblname).toRecord(); } -QSqlRecord KreSQLiteDriver::record(const QSqlQuery& query) const +TQSqlRecord KreSQLiteDriver::record(const TQSqlQuery& query) const { if (query.isActive() && query.driver() == this) { KreSQLiteResult* result = (KreSQLiteResult*)query.result(); return result->rInf.toRecord(); } - return QSqlRecord(); + return TQSqlRecord(); } -QSqlRecordInfo KreSQLiteDriver::recordInfo(const QSqlQuery& query) const +TQSqlRecordInfo KreSQLiteDriver::recordInfo(const TQSqlQuery& query) const { if (query.isActive() && query.driver() == this) { KreSQLiteResult* result = (KreSQLiteResult*)query.result(); return result->rInf; } - return QSqlRecordInfo(); + return TQSqlRecordInfo(); } //this would be used below in formatValue() -static QString escape( const QString &s ) +static TQString escape( const TQString &s ) { - QString s_escaped = s; + TQString s_escaped = s; if ( !s_escaped.isEmpty() ) { //###: sqlite_mprintf() seems to fill an empty string with garbage // Escape using SQLite's function @@ -433,24 +433,24 @@ static QString escape( const QString &s ) } -// Everything is considered a string given the implementation of this driver (we don't have field info). This would ruin a QByteArray (for the photo). -QString KreSQLiteDriver::formatValue( const QSqlField* field, bool trimStrings ) const +// Everything is considered a string given the implementation of this driver (we don't have field info). This would ruin a TQByteArray (for the photo). +TQString KreSQLiteDriver::formatValue( const TQSqlField* field, bool trimStrings ) const { - QString r; + TQString r; if ( field->isNull() ) { r = nullText(); } else { switch( field->type() ) { - case QVariant::String: - case QVariant::CString: { + case TQVariant::String: + case TQVariant::CString: { // Escape '\' characters - r = QSqlDriver::formatValue( field ); + r = TQSqlDriver::formatValue( field ); //r = escape(r); //kdDebug()<<"escaping sqlite string: "< -#include -#include -#include +#include +#include +#include +#include -typedef QVariant QSqlVariant; +typedef TQVariant TQSqlVariant; -class QSQLiteDB; +class TQSQLiteDB; -class KreSQLiteDriver : public QSqlDriver +class KreSQLiteDriver : public TQSqlDriver { public: - KreSQLiteDriver(QObject * parent = 0, const char * name = 0); - KreSQLiteDriver(QSQLiteDB *connection, QObject *parent = 0, const char *name = 0); + KreSQLiteDriver(TQObject * parent = 0, const char * name = 0); + KreSQLiteDriver(TQSQLiteDB *connection, TQObject *parent = 0, const char *name = 0); ~KreSQLiteDriver(); bool hasFeature( DriverFeature ) const; - bool open( const QString&, - const QString&, - const QString&, - const QString&, + bool open( const TQString&, + const TQString&, + const TQString&, + const TQString&, int ); void close(); - QSqlQuery createQuery() const; + TQSqlQuery createQuery() const; bool beginTransaction(); bool commitTransaction(); bool rollbackTransaction(); - QStringList tables(const QString &typeName) const; - QSqlIndex primaryIndex(const QString &tblname) const; - //QSqlRecordInfo recordInfo(const QString &tbl) const; - //QSqlRecord record(const QString &tblname) const; - //QString formatValue( const QSqlField* field, bool trimStrings ) const; + TQStringList tables(const TQString &typeName) const; + TQSqlIndex primaryIndex(const TQString &tblname) const; + //TQSqlRecordInfo recordInfo(const TQString &tbl) const; + //TQSqlRecord record(const TQString &tblname) const; + //TQString formatValue( const TQSqlField* field, bool trimStrings ) const; private: friend class KreSQLiteResult; - QSQLiteDB *db; + TQSQLiteDB *db; }; #endif diff --git a/krecipes/src/backends/progressinterface.cpp b/krecipes/src/backends/progressinterface.cpp index 7d2a7bd..aab2bc5 100644 --- a/krecipes/src/backends/progressinterface.cpp +++ b/krecipes/src/backends/progressinterface.cpp @@ -10,13 +10,13 @@ #include "progressinterface.h" -#include +#include #include #include "recipedb.h" -ProgressInterface::ProgressInterface( QWidget *parent ) : progress_dlg(0), database(0), m_rate(1), m_rate_at(0) +ProgressInterface::ProgressInterface( TQWidget *parent ) : progress_dlg(0), database(0), m_rate(1), m_rate_at(0) { slot_obj = new ProgressSlotObject(parent,this); } @@ -27,11 +27,11 @@ ProgressInterface::~ProgressInterface() delete slot_obj; } -void ProgressInterface::progressBegin( int steps, const QString &caption, const QString &text, int rate ) +void ProgressInterface::progressBegin( int steps, const TQString &caption, const TQString &text, int rate ) { m_rate = rate; - progress_dlg = new KProgressDialog((QWidget*)slot_obj->parent(),0,caption,text,true); + progress_dlg = new KProgressDialog((TQWidget*)slot_obj->parent(),0,caption,text,true); if ( steps == 0 ) progress_dlg->progressBar()->setPercentageVisible(false); @@ -58,7 +58,7 @@ void ProgressInterface::progress() progress_dlg->progressBar()->advance(1); m_rate_at = 0; } - qApp->processEvents(); + tqApp->processEvents(); } } @@ -68,7 +68,7 @@ void ProgressInterface::listenOn( RecipeDB *db ) database->disconnect(slot_obj); if ( db ) { - slot_obj->connect( db, SIGNAL(progressBegin(int,const QString&,const QString&,int)), slot_obj, SLOT(progressBegin(int,const QString&,const QString&,int)) ); + slot_obj->connect( db, SIGNAL(progressBegin(int,const TQString&,const TQString&,int)), slot_obj, SLOT(progressBegin(int,const TQString&,const TQString&,int)) ); slot_obj->connect( db, SIGNAL(progressDone()), slot_obj, SLOT(progressDone()) ); slot_obj->connect( db, SIGNAL(progress()), slot_obj, SLOT(progress()) ); } diff --git a/krecipes/src/backends/progressinterface.h b/krecipes/src/backends/progressinterface.h index 53c90fe..360d51b 100644 --- a/krecipes/src/backends/progressinterface.h +++ b/krecipes/src/backends/progressinterface.h @@ -11,8 +11,8 @@ #ifndef PROGRESSINTERFACE_H #define PROGRESSINTERFACE_H -#include -#include +#include +#include class KProgressDialog; @@ -30,7 +30,7 @@ class ProgressSlotObject; class ProgressInterface { public: - ProgressInterface( QWidget *parent ); + ProgressInterface( TQWidget *parent ); ~ProgressInterface(); void listenOn( RecipeDB* ); @@ -38,7 +38,7 @@ public: protected: friend class ProgressSlotObject; - virtual void progressBegin(int,const QString &caption,const QString &text,int rate); + virtual void progressBegin(int,const TQString &caption,const TQString &text,int rate); virtual void progressDone(); virtual void progress(); @@ -51,15 +51,15 @@ private: int m_rate_at; }; -class ProgressSlotObject : public QObject +class ProgressSlotObject : public TQObject { Q_OBJECT public: - ProgressSlotObject( QWidget*parent, ProgressInterface *p ) : QObject(parent), pInterface(p){} + ProgressSlotObject( TQWidget*parent, ProgressInterface *p ) : TQObject(parent), pInterface(p){} public slots: - void progressBegin(int i,const QString &caption=QString::null,const QString &text=QString::null,int rate=1){ pInterface->progressBegin(i,caption,text,rate); } + void progressBegin(int i,const TQString &caption=TQString::null,const TQString &text=TQString::null,int rate=1){ pInterface->progressBegin(i,caption,text,rate); } void progressDone(){ pInterface->progressDone(); } void progress(){ pInterface->progress(); } diff --git a/krecipes/src/backends/qsqlrecipedb.cpp b/krecipes/src/backends/qsqlrecipedb.cpp index 1192f43..3291f44 100644 --- a/krecipes/src/backends/qsqlrecipedb.cpp +++ b/krecipes/src/backends/qsqlrecipedb.cpp @@ -21,9 +21,9 @@ #include "propertycalculator.h" -#include -#include -#include +#include +#include +#include #include #include @@ -33,10 +33,10 @@ #include #include -int QSqlRecipeDB::m_refCount = 0; +int TQSqlRecipeDB::m_refCount = 0; -QSqlRecipeDB::QSqlRecipeDB( const QString &host, const QString &user, const QString &pass, const QString &name, int port ) : RecipeDB(), - connectionName("connection" + QString::number( m_refCount+1 )) +TQSqlRecipeDB::TQSqlRecipeDB( const TQString &host, const TQString &user, const TQString &pass, const TQString &name, int port ) : RecipeDB(), + connectionName("connection" + TQString::number( m_refCount+1 )) { DBuser = user; DBpass = pass; @@ -47,22 +47,22 @@ QSqlRecipeDB::QSqlRecipeDB( const QString &host, const QString &user, const QStr dbOK = false; //it isn't ok until we've connect()'ed ++m_refCount; - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Latin1")); //this is the default, but let's explicitly set this to be sure + TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("Latin1")); //this is the default, but let's explicitly set this to be sure } -QSqlRecipeDB::~QSqlRecipeDB() +TQSqlRecipeDB::~TQSqlRecipeDB() { if ( dbOK ) { database->close(); } - QSqlDatabase::removeDatabase( connectionName ); + TQSqlDatabase::removeDatabase( connectionName ); --m_refCount; } -void QSqlRecipeDB::connect( bool create_db, bool create_tables ) +void TQSqlRecipeDB::connect( bool create_db, bool create_tables ) { - kdDebug() << i18n( "QSqlRecipeDB: Opening Database..." ) << endl; + kdDebug() << i18n( "TQSqlRecipeDB: Opening Database..." ) << endl; kdDebug() << "Parameters: \n\thost: " << DBhost << "\n\tuser: " << DBuser << "\n\ttable: " << DBname << endl; bool driver_found = false; @@ -70,8 +70,8 @@ void QSqlRecipeDB::connect( bool create_db, bool create_tables ) if ( qsqlDriver() ) //we're using a built-in driver driver_found = true; else { - QStringList drivers = QSqlDatabase::drivers(); - for ( QStringList::const_iterator it = drivers.begin(); it != drivers.end(); ++it ) { + TQStringList drivers = TQSqlDatabase::drivers(); + for ( TQStringList::const_iterator it = drivers.begin(); it != drivers.end(); ++it ) { if ( ( *it ) == qsqlDriverPlugin() ) { driver_found = true; break; @@ -80,15 +80,15 @@ void QSqlRecipeDB::connect( bool create_db, bool create_tables ) } if ( !driver_found ) { - dbErr = QString( i18n( "The Qt database plug-in (%1) is not installed. This plug-in is required for using this database backend." ) ).arg( qsqlDriverPlugin() ); + dbErr = TQString( i18n( "The TQt database plug-in (%1) is not installed. This plug-in is required for using this database backend." ) ).arg( qsqlDriverPlugin() ); return ; } - //we need to have a unique connection name for each QSqlRecipeDB class as multiple db's may be open at once (db to db transfer) + //we need to have a unique connection name for each TQSqlRecipeDB class as multiple db's may be open at once (db to db transfer) if ( qsqlDriver() ) - database = QSqlDatabase::addDatabase( qsqlDriver(), connectionName ); + database = TQSqlDatabase::addDatabase( qsqlDriver(), connectionName ); else if ( !qsqlDriverPlugin().isEmpty() ) - database = QSqlDatabase::addDatabase( qsqlDriverPlugin(), connectionName ); + database = TQSqlDatabase::addDatabase( qsqlDriverPlugin(), connectionName ); else kdDebug()<<"Fatal internal error! Backend incorrectly written!"<open() ) { - QString error = i18n( "Database message: %1" ).arg( database->lastError().databaseText() ); + TQString error = i18n( "Database message: %1" ).arg( database->lastError().databaseText() ); kdDebug() << i18n( "Failing to open database. Exiting\n" ).latin1(); // Handle the error (passively) - dbErr = QString( i18n( "Krecipes could not open the database using the driver '%2' (with username: \"%1\"). You may not have the necessary permissions, or the server may be down." ) ).arg( DBuser ).arg( qsqlDriverPlugin() ); + dbErr = TQString( i18n( "Krecipes could not open the database using the driver '%2' (with username: \"%1\"). You may not have the necessary permissions, or the server may be down." ) ).arg( DBuser ).arg( qsqlDriverPlugin() ); return ; } } - if ( int( qRound( databaseVersion() * 1e5 ) ) > int( qRound( latestDBVersion() * 1e5 ) ) ) { //correct for float's imprecision + if ( int( tqRound( databaseVersion() * 1e5 ) ) > int( tqRound( latestDBVersion() * 1e5 ) ) ) { //correct for float's imprecision dbErr = i18n( "This database was created with a newer version of Krecipes and cannot be opened." ); return ; } @@ -140,30 +140,30 @@ void QSqlRecipeDB::connect( bool create_db, bool create_tables ) } // Database was opened correctly - m_query = QSqlQuery( QString::null, database ); + m_query = TQSqlQuery( TQString::null, database ); m_query.setForwardOnly(true); dbOK = true; } -void QSqlRecipeDB::execSQL( const QString &command ) +void TQSqlRecipeDB::execSQL( const TQString &command ) { database->exec( command ); } -void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList ids ) +void TQSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, TQValueList ids ) { // Empty the recipe first rlist->empty(); - QMap recipeIterators; // Stores the iterator of each recipe in the list; + TQMap recipeIterators; // Stores the iterator of each recipe in the list; - QString command; + TQString command; - QString current_timestamp = QDateTime::currentDateTime().toString(Qt::ISODate); + TQString current_timestamp = TQDateTime::currentDateTime().toString(TQt::ISODate); - QStringList ids_str; - for ( QValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { - QString number_str = QString::number(*it); + TQStringList ids_str; + for ( TQValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { + TQString number_str = TQString::number(*it); ids_str << number_str; if ( !(items & RecipeDB::Noatime) ) @@ -178,7 +178,7 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id if ( items & RecipeDB::Yield ) command += ",yield_amount,yield_amount_offset,yield_type_id"; command += " FROM recipes"+(ids_str.count()!=0?" WHERE id IN ("+ids_str.join(",")+")":""); - QSqlQuery recipeQuery(command,database); + TQSqlQuery recipeQuery(command,database); if ( recipeQuery.isActive() ) { while ( recipeQuery.next() ) { int row_at = 0; @@ -203,8 +203,8 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id recipe.yield.amount_offset = recipeQuery.value( row_at ).toDouble(); ++row_at; recipe.yield.type_id = recipeQuery.value( row_at ).toInt(); ++row_at; if ( recipe.yield.type_id != -1 ) { - QString y_command = QString("SELECT name FROM yield_types WHERE id=%1;").arg(recipe.yield.type_id); - QSqlQuery yield_query(y_command,database); + TQString y_command = TQString("SELECT name FROM yield_types WHERE id=%1;").arg(recipe.yield.type_id); + TQSqlQuery yield_query(y_command,database); if ( yield_query.isActive() && yield_query.first() ) recipe.yield.type = unescapeAndDecode(yield_query.value( 0 ).toCString()); else @@ -224,14 +224,14 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id for ( RecipeList::iterator recipe_it = rlist->begin(); recipe_it != rlist->end(); ++recipe_it ) { if ( items & RecipeDB::NamesOnly ) { if ( items & IngredientAmounts ) - command = QString( "SELECT il.ingredient_id,i.name,il.substitute_for,il.amount,il.amount_offset,u.id,u.type FROM ingredients i, ingredient_list il, units u WHERE il.recipe_id=%1 AND i.id=il.ingredient_id AND u.id=il.unit_id ORDER BY il.order_index" ).arg( (*recipe_it).recipeID ); + command = TQString( "SELECT il.ingredient_id,i.name,il.substitute_for,il.amount,il.amount_offset,u.id,u.type FROM ingredients i, ingredient_list il, units u WHERE il.recipe_id=%1 AND i.id=il.ingredient_id AND u.id=il.unit_id ORDER BY il.order_index" ).arg( (*recipe_it).recipeID ); else - command = QString( "SELECT il.ingredient_id,i.name,il.substitute_for FROM ingredients i, ingredient_list il WHERE il.recipe_id=%1 AND i.id=il.ingredient_id" ).arg( (*recipe_it).recipeID ); + command = TQString( "SELECT il.ingredient_id,i.name,il.substitute_for FROM ingredients i, ingredient_list il WHERE il.recipe_id=%1 AND i.id=il.ingredient_id" ).arg( (*recipe_it).recipeID ); } else - command = QString( "SELECT il.ingredient_id,i.name,il.substitute_for,il.amount,il.amount_offset,u.id,u.name,u.plural,u.name_abbrev,u.plural_abbrev,u.type,il.group_id,il.id FROM ingredients i, ingredient_list il, units u WHERE il.recipe_id=%1 AND i.id=il.ingredient_id AND u.id=il.unit_id ORDER BY il.order_index" ).arg( (*recipe_it).recipeID ); + command = TQString( "SELECT il.ingredient_id,i.name,il.substitute_for,il.amount,il.amount_offset,u.id,u.name,u.plural,u.name_abbrev,u.plural_abbrev,u.type,il.group_id,il.id FROM ingredients i, ingredient_list il, units u WHERE il.recipe_id=%1 AND i.id=il.ingredient_id AND u.id=il.unit_id ORDER BY il.order_index" ).arg( (*recipe_it).recipeID ); - QSqlQuery ingredientQuery( command, database ); + TQSqlQuery ingredientQuery( command, database ); if ( ingredientQuery.isActive() ) { RecipeList::Iterator it = recipeIterators[ (*recipe_it).recipeID ]; while ( ingredientQuery.next() ) { @@ -265,13 +265,13 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id ing.groupID = ingredientQuery.value( 11 ).toInt(); if ( ing.groupID != -1 ) { - QSqlQuery toLoad( QString( "SELECT name FROM ingredient_groups WHERE id=%1" ).arg( ing.groupID ), database ); + TQSqlQuery toLoad( TQString( "SELECT name FROM ingredient_groups WHERE id=%1" ).arg( ing.groupID ), database ); if ( toLoad.isActive() && toLoad.first() ) ing.group = unescapeAndDecode( toLoad.value( 0 ).toCString() ); } - command = QString("SELECT pl.prep_method_id,p.name FROM prep_methods p, prep_method_list pl WHERE pl.ingredient_list_id=%1 AND p.id=pl.prep_method_id ORDER BY pl.order_index;").arg(ingredientQuery.value( 12 ).toInt()); - QSqlQuery ingPrepMethodsQuery( command, database ); + command = TQString("SELECT pl.prep_method_id,p.name FROM prep_methods p, prep_method_list pl WHERE pl.ingredient_list_id=%1 AND p.id=pl.prep_method_id ORDER BY pl.order_index;").arg(ingredientQuery.value( 12 ).toInt()); + TQSqlQuery ingPrepMethodsQuery( command, database ); if ( ingPrepMethodsQuery.isActive() ) { while ( ingPrepMethodsQuery.next() ) { ing.prepMethodList.append( Element( unescapeAndDecode(ingPrepMethodsQuery.value(1).toCString()),ingPrepMethodsQuery.value(0).toInt()) ); @@ -305,7 +305,7 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id for ( RecipeList::iterator recipe_it = rlist->begin(); recipe_it != rlist->end(); ++recipe_it ) { RecipeList::iterator it = recipeIterators[ (*recipe_it).recipeID ]; - command = QString( "SELECT cl.category_id,c.name FROM category_list cl, categories c WHERE recipe_id=%1 AND cl.category_id=c.id;" ).arg( (*it).recipeID ); + command = TQString( "SELECT cl.category_id,c.name FROM category_list cl, categories c WHERE recipe_id=%1 AND cl.category_id=c.id;" ).arg( (*it).recipeID ); m_query.exec( command ); if ( m_query.isActive() ) { @@ -324,7 +324,7 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id for ( RecipeList::iterator recipe_it = rlist->begin(); recipe_it != rlist->end(); ++recipe_it ) { RecipeList::iterator it = recipeIterators[ (*recipe_it).recipeID ]; - command = QString( "SELECT al.author_id,a.name FROM author_list al, authors a WHERE recipe_id=%1 AND al.author_id=a.id;" ).arg( (*it).recipeID ); + command = TQString( "SELECT al.author_id,a.name FROM author_list al, authors a WHERE recipe_id=%1 AND al.author_id=a.id;" ).arg( (*it).recipeID ); m_query.exec( command ); if ( m_query.isActive() ) { @@ -343,8 +343,8 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id for ( RecipeList::iterator recipe_it = rlist->begin(); recipe_it != rlist->end(); ++recipe_it ) { RecipeList::iterator it = recipeIterators[ (*recipe_it).recipeID ]; - command = QString( "SELECT id,comment,rater FROM ratings WHERE recipe_id=%1 ORDER BY created DESC" ).arg( (*it).recipeID ); - QSqlQuery query( command, database ); + command = TQString( "SELECT id,comment,rater FROM ratings WHERE recipe_id=%1 ORDER BY created DESC" ).arg( (*it).recipeID ); + TQSqlQuery query( command, database ); if ( query.isActive() ) { while ( query.next() ) { Rating r; @@ -352,8 +352,8 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id r.comment = unescapeAndDecode( query.value( 1 ).toCString() ); r.rater = unescapeAndDecode( query.value( 2 ).toCString() ); - command = QString( "SELECT rc.id,rc.name,rl.stars FROM rating_criteria rc, rating_criterion_list rl WHERE rating_id=%1 AND rl.rating_criterion_id=rc.id" ).arg(r.id); - QSqlQuery criterionQuery( command, database ); + command = TQString( "SELECT rc.id,rc.name,rl.stars FROM rating_criteria rc, rating_criterion_list rl WHERE rating_id=%1 AND rl.rating_criterion_id=rc.id" ).arg(r.id); + TQSqlQuery criterionQuery( command, database ); if ( criterionQuery.isActive() ) { while ( criterionQuery.next() ) { RatingCriteria rc; @@ -378,11 +378,11 @@ void QSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, QValueList id } } -void QSqlRecipeDB::loadIngredientGroups( ElementList *list ) +void TQSqlRecipeDB::loadIngredientGroups( ElementList *list ) { list->clear(); - QString command = "SELECT id,name FROM ingredient_groups ORDER BY name;"; + TQString command = "SELECT id,name FROM ingredient_groups ORDER BY name;"; m_query.exec( command ); if ( m_query.isActive() ) { @@ -395,12 +395,12 @@ void QSqlRecipeDB::loadIngredientGroups( ElementList *list ) } } -void QSqlRecipeDB::loadIngredients( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadIngredients( ElementList *list, int limit, int offset ) { list->clear(); - QString command = "SELECT id,name FROM ingredients ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); + TQString command = "SELECT id,name FROM ingredients ORDER BY name" + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); m_query.exec( command ); if ( m_query.isActive() ) { @@ -413,12 +413,12 @@ void QSqlRecipeDB::loadIngredients( ElementList *list, int limit, int offset ) } } -void QSqlRecipeDB::loadPrepMethods( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadPrepMethods( ElementList *list, int limit, int offset ) { list->clear(); - QString command = "SELECT id,name FROM prep_methods ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); + TQString command = "SELECT id,name FROM prep_methods ORDER BY name" + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); m_query.exec( command ); if ( m_query.isActive() ) { @@ -431,12 +431,12 @@ void QSqlRecipeDB::loadPrepMethods( ElementList *list, int limit, int offset ) } } -void QSqlRecipeDB::loadYieldTypes( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadYieldTypes( ElementList *list, int limit, int offset ) { list->clear(); - QString command = "SELECT id,name FROM yield_types ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); + TQString command = "SELECT id,name FROM yield_types ORDER BY name" + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); m_query.exec( command ); if ( m_query.isActive() ) { @@ -449,48 +449,48 @@ void QSqlRecipeDB::loadYieldTypes( ElementList *list, int limit, int offset ) } } -void QSqlRecipeDB::createNewPrepMethod( const QString &prepMethodName ) +void TQSqlRecipeDB::createNewPrepMethod( const TQString &prepMethodName ) { - QString command; - QString real_name = prepMethodName.left( maxPrepMethodNameLength() ); + TQString command; + TQString real_name = prepMethodName.left( maxPrepMethodNameLength() ); - command = QString( "INSERT INTO prep_methods VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "prep_methods", "id" ) ); - QSqlQuery prepMethodToCreate( command, database ); + command = TQString( "INSERT INTO prep_methods VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "prep_methods", "id" ) ); + TQSqlQuery prepMethodToCreate( command, database ); emit prepMethodCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::modPrepMethod( int prepMethodID, const QString &newLabel ) +void TQSqlRecipeDB::modPrepMethod( int prepMethodID, const TQString &newLabel ) { - QString command; + TQString command; - command = QString( "UPDATE prep_methods SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( prepMethodID ); - QSqlQuery prepMethodToCreate( command, database ); + command = TQString( "UPDATE prep_methods SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( prepMethodID ); + TQSqlQuery prepMethodToCreate( command, database ); emit prepMethodRemoved( prepMethodID ); emit prepMethodCreated( Element( newLabel, prepMethodID ) ); } -void QSqlRecipeDB::modProperty( int propertyID, const QString &newLabel ) +void TQSqlRecipeDB::modProperty( int propertyID, const TQString &newLabel ) { - QString command; + TQString command; - command = QString( "UPDATE ingredient_properties SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( propertyID ); - QSqlQuery createQuery( command, database ); + command = TQString( "UPDATE ingredient_properties SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( propertyID ); + TQSqlQuery createQuery( command, database ); emit propertyRemoved( propertyID ); emit propertyCreated( propertyName( propertyID ) ); } -void QSqlRecipeDB::loadPossibleUnits( int ingredientID, UnitList *list ) +void TQSqlRecipeDB::loadPossibleUnits( int ingredientID, UnitList *list ) { list->clear(); - QString command; + TQString command; - command = QString( "SELECT u.id,u.name,u.plural,u.name_abbrev,u.plural_abbrev,u.type FROM unit_list ul, units u WHERE ul.ingredient_id=%1 AND ul.unit_id=u.id;" ).arg( ingredientID ); + command = TQString( "SELECT u.id,u.name,u.plural,u.name_abbrev,u.plural_abbrev,u.type FROM unit_list ul, units u WHERE ul.ingredient_id=%1 AND ul.unit_id=u.id;" ).arg( ingredientID ); - QSqlQuery unitToLoad( command, database ); + TQSqlQuery unitToLoad( command, database ); if ( unitToLoad.isActive() ) { while ( unitToLoad.next() ) { @@ -509,28 +509,28 @@ void QSqlRecipeDB::loadPossibleUnits( int ingredientID, UnitList *list ) } -void QSqlRecipeDB::storePhoto( int recipeID, const QByteArray &data ) +void TQSqlRecipeDB::storePhoto( int recipeID, const TQByteArray &data ) { - QSqlQuery query( QString::null, database ); + TQSqlQuery query( TQString::null, database ); - query.prepare( "UPDATE recipes SET photo=?,ctime=ctime,atime=atime,mtime=mtime WHERE id=" + QString::number( recipeID ) ); + query.prepare( "UPDATE recipes SET photo=?,ctime=ctime,atime=atime,mtime=mtime WHERE id=" + TQString::number( recipeID ) ); query.addBindValue( KCodecs::base64Encode( data ) ); query.exec(); } -void QSqlRecipeDB::loadPhoto( int recipeID, QPixmap &photo ) +void TQSqlRecipeDB::loadPhoto( int recipeID, TQPixmap &photo ) { - QString command = QString( "SELECT photo FROM recipes WHERE id=%1;" ).arg( recipeID ); - QSqlQuery query( command, database ); + TQString command = TQString( "SELECT photo FROM recipes WHERE id=%1;" ).arg( recipeID ); + TQSqlQuery query( command, database ); if ( query.isActive() && query.first() ) { - QCString decodedPic; - QPixmap pix; + TQCString decodedPic; + TQPixmap pix; KCodecs::base64Decode( query.value( 0 ).toCString(), decodedPic ); int len = decodedPic.size(); if ( len > 0 ) { - QByteArray picData( len ); + TQByteArray picData( len ); memcpy( picData.data(), decodedPic.data(), len ); bool ok = pix.loadFromData( picData, "JPEG" ); @@ -540,11 +540,11 @@ void QSqlRecipeDB::loadPhoto( int recipeID, QPixmap &photo ) } } -void QSqlRecipeDB::loadRecipeMetadata( Recipe *recipe ) +void TQSqlRecipeDB::loadRecipeMetadata( Recipe *recipe ) { - QString command = "SELECT ctime,mtime,atime FROM recipes WHERE id="+QString::number(recipe->recipeID); + TQString command = "SELECT ctime,mtime,atime FROM recipes WHERE id="+TQString::number(recipe->recipeID); - QSqlQuery query( command, database ); + TQSqlQuery query( command, database ); if ( query.isActive() && query.first() ) { recipe->ctime = query.value(0).toDateTime(); recipe->mtime = query.value(1).toDateTime(); @@ -552,7 +552,7 @@ void QSqlRecipeDB::loadRecipeMetadata( Recipe *recipe ) } } -void QSqlRecipeDB::saveRecipe( Recipe *recipe ) +void TQSqlRecipeDB::saveRecipe( Recipe *recipe ) { // Check if it's a new recipe or it exists (supossedly) already. @@ -561,14 +561,14 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) // First check if the recipe ID is set, if so, update (not create) // Be carefull, first check if the recipe hasn't been deleted while changing. - QSqlQuery recipeToSave( QString::null, database ); + TQSqlQuery recipeToSave( TQString::null, database ); - QString command; + TQString command; - QDateTime current_datetime = QDateTime::currentDateTime(); - QString current_timestamp = current_datetime.toString(Qt::ISODate); + TQDateTime current_datetime = TQDateTime::currentDateTime(); + TQString current_timestamp = current_datetime.toString(TQt::ISODate); if ( newRecipe ) { - command = QString( "INSERT INTO recipes VALUES ("+getNextInsertIDStr("recipes","id")+",'%1',%2,'%3','%4','%5',NULL,'%6','%7','%8','%9');" ) // Id is autoincremented + command = TQString( "INSERT INTO recipes VALUES ("+getNextInsertIDStr("recipes","id")+",'%1',%2,'%3','%4','%5',NULL,'%6','%7','%8','%9');" ) // Id is autoincremented .arg( escapeAndEncode( recipe->title ) ) .arg( recipe->yield.amount ) .arg( recipe->yield.amount_offset ) @@ -581,7 +581,7 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) recipe->mtime = recipe->ctime = recipe->atime = current_datetime; } else { - command = QString( "UPDATE recipes SET title='%1',yield_amount='%2',yield_amount_offset='%3',yield_type_id='%4',instructions='%5',prep_time='%6',mtime='%8',ctime=ctime,atime=atime WHERE id=%7;" ) + command = TQString( "UPDATE recipes SET title='%1',yield_amount='%2',yield_amount_offset='%3',yield_type_id='%4',instructions='%5',prep_time='%6',mtime='%8',ctime=ctime,atime=atime WHERE id=%7;" ) .arg( escapeAndEncode( recipe->title ) ) .arg( recipe->yield.amount ) .arg( recipe->yield.amount_offset ) @@ -596,16 +596,16 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) if ( !newRecipe ) { // Clean up yield_types which have no recipe that they belong to - QStringList ids; - command = QString( "SELECT DISTINCT(yield_type_id) FROM recipes" ); + TQStringList ids; + command = TQString( "SELECT DISTINCT(yield_type_id) FROM recipes" ); recipeToSave.exec( command ); if ( recipeToSave.isActive() ) { while ( recipeToSave.next() ) { if ( recipeToSave.value( 0 ).toInt() != -1 ) - ids << QString::number( recipeToSave.value( 0 ).toInt() ); + ids << TQString::number( recipeToSave.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM yield_types WHERE id NOT IN ( %1 )" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM yield_types WHERE id NOT IN ( %1 )" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); recipeToSave.exec( command ); } @@ -620,39 +620,39 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) // Let's begin storing the Image! if ( !recipe->photo.isNull() ) { - QByteArray ba; - QBuffer buffer( ba ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); - QImageIO iio( &buffer, "JPEG" ); + TQImageIO iio( &buffer, "JPEG" ); iio.setImage( recipe->photo.convertToImage() ); iio.write(); - //recipe->photo.save( &buffer, "JPEG" ); don't need QImageIO in QT 3.2 + //recipe->photo.save( &buffer, "JPEG" ); don't need TQImageIO in QT 3.2 storePhoto( recipeID, ba ); } else { - recipeToSave.exec( "UPDATE recipes SET photo=NULL, mtime=mtime, ctime=ctime, atime=atime WHERE id=" + QString::number( recipeID ) ); + recipeToSave.exec( "UPDATE recipes SET photo=NULL, mtime=mtime, ctime=ctime, atime=atime WHERE id=" + TQString::number( recipeID ) ); } // Save the ingredient list (first delete if we are updating) - command = QString( "SELECT id FROM ingredient_list WHERE recipe_id=%1" ).arg(recipeID); + command = TQString( "SELECT id FROM ingredient_list WHERE recipe_id=%1" ).arg(recipeID); recipeToSave.exec( command ); if ( recipeToSave.isActive() ) { while ( recipeToSave.next() ) { - command = QString("DELETE FROM prep_method_list WHERE ingredient_list_id=%1") + command = TQString("DELETE FROM prep_method_list WHERE ingredient_list_id=%1") .arg(recipeToSave.value(0).toInt()); database->exec(command); } } - command = QString( "DELETE FROM ingredient_list WHERE recipe_id=%1;" ) + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id=%1;" ) .arg( recipeID ); recipeToSave.exec( command ); int order_index = 0; for ( IngredientList::const_iterator ing_it = recipe->ingList.begin(); ing_it != recipe->ingList.end(); ++ing_it ) { order_index++; - QString ing_list_id_str = getNextInsertIDStr("ingredient_list","id"); - command = QString( "INSERT INTO ingredient_list VALUES (%1,%2,%3,%4,%5,%6,%7,%8,NULL);" ) + TQString ing_list_id_str = getNextInsertIDStr("ingredient_list","id"); + command = TQString( "INSERT INTO ingredient_list VALUES (%1,%2,%3,%4,%5,%6,%7,%8,NULL);" ) .arg( ing_list_id_str ) .arg( recipeID ) .arg( ( *ing_it ).ingredientID ) @@ -667,17 +667,17 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) int prep_order_index = 0; for ( ElementList::const_iterator prep_it = (*ing_it).prepMethodList.begin(); prep_it != (*ing_it).prepMethodList.end(); ++prep_it ) { prep_order_index++; - command = QString( "INSERT INTO prep_method_list VALUES (%1,%2,%3);" ) + command = TQString( "INSERT INTO prep_method_list VALUES (%1,%2,%3);" ) .arg( ing_list_id ) .arg( ( *prep_it ).id ) .arg( prep_order_index ); recipeToSave.exec( command ); } - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { order_index++; - QString ing_list_id_str = getNextInsertIDStr("ingredient_list","id"); - command = QString( "INSERT INTO ingredient_list VALUES (%1,%2,%3,%4,%5,%6,%7,%8,%9);" ) + TQString ing_list_id_str = getNextInsertIDStr("ingredient_list","id"); + command = TQString( "INSERT INTO ingredient_list VALUES (%1,%2,%3,%4,%5,%6,%7,%8,%9);" ) .arg( ing_list_id_str ) .arg( recipeID ) .arg( ( *sub_it ).ingredientID ) @@ -693,7 +693,7 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) int prep_order_index = 0; for ( ElementList::const_iterator prep_it = (*sub_it).prepMethodList.begin(); prep_it != (*sub_it).prepMethodList.end(); ++prep_it ) { prep_order_index++; - command = QString( "INSERT INTO prep_method_list VALUES (%1,%2,%3);" ) + command = TQString( "INSERT INTO prep_method_list VALUES (%1,%2,%3);" ) .arg( ing_list_id ) .arg( ( *prep_it ).id ) .arg( prep_order_index ); @@ -703,14 +703,14 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) } // Save the category list for the recipe (first delete, in case we are updating) - command = QString( "DELETE FROM category_list WHERE recipe_id=%1;" ) + command = TQString( "DELETE FROM category_list WHERE recipe_id=%1;" ) .arg( recipeID ); recipeToSave.exec( command ); ElementList::const_iterator cat_it = recipe->categoryList.end(); // Start from last, mysql seems to work in lifo format... so it's read first the latest inserted one (newest) --cat_it; for ( unsigned int i = 0; i < recipe->categoryList.count(); i++ ) { - command = QString( "INSERT INTO category_list VALUES (%1,%2);" ) + command = TQString( "INSERT INTO category_list VALUES (%1,%2);" ) .arg( recipeID ) .arg( ( *cat_it ).id ); recipeToSave.exec( command ); @@ -720,20 +720,20 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) //Add the default category -1 to ease and speed up searches - command = QString( "INSERT INTO category_list VALUES (%1,-1);" ) + command = TQString( "INSERT INTO category_list VALUES (%1,-1);" ) .arg( recipeID ); recipeToSave.exec( command ); // Save the author list for the recipe (first delete, in case we are updating) - command = QString( "DELETE FROM author_list WHERE recipe_id=%1;" ) + command = TQString( "DELETE FROM author_list WHERE recipe_id=%1;" ) .arg( recipeID ); recipeToSave.exec( command ); ElementList::const_iterator author_it = recipe->authorList.end(); // Start from last, mysql seems to work in lifo format... so it's read first the latest inserted one (newest) --author_it; for ( unsigned int i = 0; i < recipe->authorList.count(); i++ ) { - command = QString( "INSERT INTO author_list VALUES (%1,%2);" ) + command = TQString( "INSERT INTO author_list VALUES (%1,%2);" ) .arg( recipeID ) .arg( ( *author_it ).id ); recipeToSave.exec( command ); @@ -742,45 +742,45 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) } // Save the ratings (first delete criterion list if we are updating) - command = QString( "SELECT id FROM ratings WHERE recipe_id=%1" ).arg(recipeID); + command = TQString( "SELECT id FROM ratings WHERE recipe_id=%1" ).arg(recipeID); recipeToSave.exec( command ); if ( recipeToSave.isActive() ) { while ( recipeToSave.next() ) { - command = QString("DELETE FROM rating_criterion_list WHERE rating_id=%1") + command = TQString("DELETE FROM rating_criterion_list WHERE rating_id=%1") .arg(recipeToSave.value(0).toInt()); database->exec(command); } } - QStringList ids; + TQStringList ids; for ( RatingList::iterator rating_it = recipe->ratingList.begin(); rating_it != recipe->ratingList.end(); ++rating_it ) { //double average = (*rating_it).average(); if ( (*rating_it).id == -1 ) //new rating - command ="INSERT INTO ratings VALUES("+QString(getNextInsertIDStr("ratings","id"))+","+QString::number(recipeID)+",'"+QString(escapeAndEncode((*rating_it).comment))+"','"+QString(escapeAndEncode((*rating_it).rater))+/*"','"+QString::number(average)+*/"','"+current_timestamp+"')"; + command ="INSERT INTO ratings VALUES("+TQString(getNextInsertIDStr("ratings","id"))+","+TQString::number(recipeID)+",'"+TQString(escapeAndEncode((*rating_it).comment))+"','"+TQString(escapeAndEncode((*rating_it).rater))+/*"','"+TQString::number(average)+*/"','"+current_timestamp+"')"; else //existing rating command = "UPDATE ratings SET " - "comment='"+QString(escapeAndEncode((*rating_it).comment))+"'," - "rater='"+QString(escapeAndEncode((*rating_it).rater))+"'," + "comment='"+TQString(escapeAndEncode((*rating_it).comment))+"'," + "rater='"+TQString(escapeAndEncode((*rating_it).rater))+"'," "created=created " - "WHERE id="+QString::number((*rating_it).id); + "WHERE id="+TQString::number((*rating_it).id); recipeToSave.exec( command ); if ( (*rating_it).id == -1 ) (*rating_it).id = lastInsertID(); - for ( QValueList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { - command = QString( "INSERT INTO rating_criterion_list VALUES("+QString::number((*rating_it).id)+","+QString::number((*rc_it).id)+","+QString::number((*rc_it).stars)+")" ); + for ( TQValueList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { + command = TQString( "INSERT INTO rating_criterion_list VALUES("+TQString::number((*rating_it).id)+","+TQString::number((*rc_it).id)+","+TQString::number((*rc_it).stars)+")" ); recipeToSave.exec( command ); } - ids << QString::number((*rating_it).id); + ids << TQString::number((*rating_it).id); } // only delete those ratings that don't exist anymore - command = QString( "DELETE FROM ratings WHERE recipe_id=%1 AND id NOT IN( %2 )" ) + command = TQString( "DELETE FROM ratings WHERE recipe_id=%1 AND id NOT IN( %2 )" ) .arg( recipeID ).arg( ids.join(",") ); recipeToSave.exec( command ); @@ -790,17 +790,17 @@ void QSqlRecipeDB::saveRecipe( Recipe *recipe ) emit recipeModified( Element( recipe->title.left( maxRecipeTitleLength() ), recipeID ), recipe->categoryList ); } -void QSqlRecipeDB::loadRecipeList( ElementList *list, int categoryID, bool recursive ) +void TQSqlRecipeDB::loadRecipeList( ElementList *list, int categoryID, bool recursive ) { - QString command; + TQString command; if ( categoryID == -1 ) // load just the list command = "SELECT id,title FROM recipes;"; else // load the list of those in the specified category - command = QString( "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id AND cl.category_id=%1 ORDER BY r.title" ).arg( categoryID ); + command = TQString( "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id AND cl.category_id=%1 ORDER BY r.title" ).arg( categoryID ); if ( recursive ) { - QSqlQuery subcategories( QString("SELECT id FROM categories WHERE parent_id='%1'").arg(categoryID), database ); + TQSqlQuery subcategories( TQString("SELECT id FROM categories WHERE parent_id='%1'").arg(categoryID), database ); if ( subcategories.isActive() ) { while ( subcategories.next() ) { loadRecipeList(list,subcategories.value( 0 ).toInt(),true); @@ -808,7 +808,7 @@ void QSqlRecipeDB::loadRecipeList( ElementList *list, int categoryID, bool recur } } - QSqlQuery recipeToLoad( command, database ); + TQSqlQuery recipeToLoad( command, database ); if ( recipeToLoad.isActive() ) { while ( recipeToLoad.next() ) { @@ -821,11 +821,11 @@ void QSqlRecipeDB::loadRecipeList( ElementList *list, int categoryID, bool recur } -void QSqlRecipeDB::loadUncategorizedRecipes( ElementList *list ) +void TQSqlRecipeDB::loadUncategorizedRecipes( ElementList *list ) { list->clear(); - QString command = "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id GROUP BY id HAVING COUNT(*)=1 ORDER BY r.title DESC"; + TQString command = "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id GROUP BY id HAVING COUNT(*)=1 ORDER BY r.title DESC"; m_query.exec( command ); if ( m_query.isActive() ) { while ( m_query.next() ) { @@ -839,157 +839,157 @@ void QSqlRecipeDB::loadUncategorizedRecipes( ElementList *list ) -void QSqlRecipeDB::removeRecipe( int id ) +void TQSqlRecipeDB::removeRecipe( int id ) { emit recipeRemoved( id ); - QString command; + TQString command; - command = QString( "DELETE FROM recipes WHERE id=%1;" ).arg( id ); - QSqlQuery recipeToRemove( command, database ); - command = QString( "DELETE FROM ingredient_list WHERE recipe_id=%1;" ).arg( id ); + command = TQString( "DELETE FROM recipes WHERE id=%1;" ).arg( id ); + TQSqlQuery recipeToRemove( command, database ); + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id=%1;" ).arg( id ); recipeToRemove.exec( command ); - command = QString( "DELETE FROM category_list WHERE recipe_id=%1;" ).arg( id ); + command = TQString( "DELETE FROM category_list WHERE recipe_id=%1;" ).arg( id ); recipeToRemove.exec( command ); // Clean up ingredient_groups which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_groups WHERE id NOT IN ( SELECT DISTINCT(group_id) FROM ingredient_list );) - QStringList ids; - command = QString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); + TQStringList ids; + command = TQString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); recipeToRemove.exec( command ); if ( recipeToRemove.isActive() ) { while ( recipeToRemove.next() ) { if ( recipeToRemove.value( 0 ).toInt() != -1 ) - ids << QString::number( recipeToRemove.value( 0 ).toInt() ); + ids << TQString::number( recipeToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); recipeToRemove.exec( command ); // Clean up yield_types which have no recipe that they belong to ids.clear(); - command = QString( "SELECT DISTINCT(yield_type_id) FROM recipes" ); + command = TQString( "SELECT DISTINCT(yield_type_id) FROM recipes" ); recipeToRemove.exec( command ); if ( recipeToRemove.isActive() ) { while ( recipeToRemove.next() ) { if ( recipeToRemove.value( 0 ).toInt() != -1 ) - ids << QString::number( recipeToRemove.value( 0 ).toInt() ); + ids << TQString::number( recipeToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM yield_types WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM yield_types WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); recipeToRemove.exec( command ); } -void QSqlRecipeDB::removeRecipeFromCategory( int recipeID, int categoryID ) +void TQSqlRecipeDB::removeRecipeFromCategory( int recipeID, int categoryID ) { - QString command; - command = QString( "DELETE FROM category_list WHERE recipe_id=%1 AND category_id=%2;" ).arg( recipeID ).arg( categoryID ); - QSqlQuery recipeToRemove( command, database ); + TQString command; + command = TQString( "DELETE FROM category_list WHERE recipe_id=%1 AND category_id=%2;" ).arg( recipeID ).arg( categoryID ); + TQSqlQuery recipeToRemove( command, database ); emit recipeRemoved( recipeID, categoryID ); } -void QSqlRecipeDB::categorizeRecipe( int recipeID, const ElementList &categoryList ) +void TQSqlRecipeDB::categorizeRecipe( int recipeID, const ElementList &categoryList ) { - QString command; + TQString command; //emit recipeRemoved( recipeID, -1 ); for ( ElementList::const_iterator it = categoryList.begin(); it != categoryList.end(); ++it ) { - command = QString( "INSERT INTO category_list VALUES(%1,%2)" ).arg( recipeID ).arg( (*it).id ); + command = TQString( "INSERT INTO category_list VALUES(%1,%2)" ).arg( recipeID ).arg( (*it).id ); database->exec( command ); } emit recipeModified( Element(recipeTitle(recipeID),recipeID), categoryList ); } -void QSqlRecipeDB::createNewIngGroup( const QString &name ) +void TQSqlRecipeDB::createNewIngGroup( const TQString &name ) { - QString command; - QString real_name = name.left( maxIngGroupNameLength() ); + TQString command; + TQString real_name = name.left( maxIngGroupNameLength() ); - command = QString( "INSERT INTO ingredient_groups VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "ingredient_groups", "id" ) ); - QSqlQuery query( command, database ); + command = TQString( "INSERT INTO ingredient_groups VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "ingredient_groups", "id" ) ); + TQSqlQuery query( command, database ); emit ingGroupCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::createNewIngredient( const QString &ingredientName ) +void TQSqlRecipeDB::createNewIngredient( const TQString &ingredientName ) { - QString command; - QString real_name = ingredientName.left( maxIngredientNameLength() ); + TQString command; + TQString real_name = ingredientName.left( maxIngredientNameLength() ); - command = QString( "INSERT INTO ingredients VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "ingredients", "id" ) ); - QSqlQuery ingredientToCreate( command, database ); + command = TQString( "INSERT INTO ingredients VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "ingredients", "id" ) ); + TQSqlQuery ingredientToCreate( command, database ); emit ingredientCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::createNewRating( const QString &rating ) +void TQSqlRecipeDB::createNewRating( const TQString &rating ) { - QString command; - QString real_name = rating/*.left( maxIngredientNameLength() )*/; + TQString command; + TQString real_name = rating/*.left( maxIngredientNameLength() )*/; - command = QString( "INSERT INTO rating_criteria VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "rating_criteria", "id" ) ); - QSqlQuery toCreate( command, database ); + command = TQString( "INSERT INTO rating_criteria VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "rating_criteria", "id" ) ); + TQSqlQuery toCreate( command, database ); emit ratingCriteriaCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::createNewYieldType( const QString &name ) +void TQSqlRecipeDB::createNewYieldType( const TQString &name ) { - QString command; - QString real_name = name.left( maxYieldTypeLength() ); + TQString command; + TQString real_name = name.left( maxYieldTypeLength() ); - command = QString( "INSERT INTO yield_types VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "yield_types", "id" ) ); + command = TQString( "INSERT INTO yield_types VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "yield_types", "id" ) ); database->exec(command); //emit yieldTypeCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::modIngredientGroup( int groupID, const QString &newLabel ) +void TQSqlRecipeDB::modIngredientGroup( int groupID, const TQString &newLabel ) { - QString command; + TQString command; - command = QString( "UPDATE ingredient_groups SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( groupID ); - QSqlQuery ingredientToCreate( command, database ); + command = TQString( "UPDATE ingredient_groups SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( groupID ); + TQSqlQuery ingredientToCreate( command, database ); emit ingGroupRemoved( groupID ); emit ingGroupCreated( Element( newLabel, groupID ) ); } -void QSqlRecipeDB::modIngredient( int ingredientID, const QString &newLabel ) +void TQSqlRecipeDB::modIngredient( int ingredientID, const TQString &newLabel ) { - QString command; + TQString command; - command = QString( "UPDATE ingredients SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( ingredientID ); - QSqlQuery ingredientToCreate( command, database ); + command = TQString( "UPDATE ingredients SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( ingredientID ); + TQSqlQuery ingredientToCreate( command, database ); emit ingredientRemoved( ingredientID ); emit ingredientCreated( Element( newLabel, ingredientID ) ); } -void QSqlRecipeDB::addUnitToIngredient( int ingredientID, int unitID ) +void TQSqlRecipeDB::addUnitToIngredient( int ingredientID, int unitID ) { - QString command; + TQString command; - command = QString( "INSERT INTO unit_list VALUES(%1,%2);" ).arg( ingredientID ).arg( unitID ); - QSqlQuery ingredientToCreate( command, database ); + command = TQString( "INSERT INTO unit_list VALUES(%1,%2);" ).arg( ingredientID ).arg( unitID ); + TQSqlQuery ingredientToCreate( command, database ); } -void QSqlRecipeDB::loadUnits( UnitList *list, Unit::Type type, int limit, int offset ) +void TQSqlRecipeDB::loadUnits( UnitList *list, Unit::Type type, int limit, int offset ) { list->clear(); - QString command; + TQString command; command = "SELECT id,name,name_abbrev,plural,plural_abbrev,type FROM units " - +((type==Unit::All)?"":"WHERE type="+QString::number(type)) + +((type==Unit::All)?"":"WHERE type="+TQString::number(type)) +" ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); - QSqlQuery unitToLoad( command, database ); + TQSqlQuery unitToLoad( command, database ); if ( unitToLoad.isActive() ) { while ( unitToLoad.next() ) { @@ -1005,167 +1005,167 @@ void QSqlRecipeDB::loadUnits( UnitList *list, Unit::Type type, int limit, int of } } -void QSqlRecipeDB::removeUnitFromIngredient( int ingredientID, int unitID ) +void TQSqlRecipeDB::removeUnitFromIngredient( int ingredientID, int unitID ) { - QString command; + TQString command; - command = QString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); - QSqlQuery unitToRemove( command, database ); + command = TQString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); + TQSqlQuery unitToRemove( command, database ); // Remove any recipe using that combination of ingredients also (user must have been warned before calling this function!) - command = QString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1 AND il.unit_id=%2;" ).arg( ingredientID ).arg( unitID ); + command = TQString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1 AND il.unit_id=%2;" ).arg( ingredientID ).arg( unitID ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { emit recipeRemoved( unitToRemove.value( 0 ).toInt() ); - database->exec( QString( "DELETE FROM recipes WHERE id=%1;" ).arg( unitToRemove.value( 0 ).toInt() ) ); + database->exec( TQString( "DELETE FROM recipes WHERE id=%1;" ).arg( unitToRemove.value( 0 ).toInt() ) ); } } // Remove any ingredient in ingredient_list which has references to this unit and ingredient - command = QString( "DELETE FROM ingredient_list WHERE ingredient_id=%1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); + command = TQString( "DELETE FROM ingredient_list WHERE ingredient_id=%1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); unitToRemove.exec( command ); // Remove any ingredient properties from ingredient_info where the this ingredient+unit is being used (user must have been warned before calling this function!) - command = QString( "DELETE FROM ingredient_info ii WHERE ii.ingredient_id=%1 AND ii.per_units=%2;" ).arg( ingredientID ).arg( unitID ); + command = TQString( "DELETE FROM ingredient_info ii WHERE ii.ingredient_id=%1 AND ii.per_units=%2;" ).arg( ingredientID ).arg( unitID ); unitToRemove.exec( command ); // Clean up ingredient_list which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_list WHERE recipe_id NOT IN ( SELECT id FROM recipes );) - QStringList ids; - command = QString( "SELECT id FROM recipes;" ); + TQStringList ids; + command = TQString( "SELECT id FROM recipes;" ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { - ids << QString::number( unitToRemove.value( 0 ).toInt() ); + ids << TQString::number( unitToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); // Clean up category_list which have no recipe that they belong to - command = QString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); // Clean up ingredient_groups which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_groups WHERE id NOT IN ( SELECT DISTINCT(group_id) FROM ingredient_list );) ids.clear(); - command = QString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); + command = TQString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { if ( unitToRemove.value( 0 ).toInt() != -1 ) - ids << QString::number( unitToRemove.value( 0 ).toInt() ); + ids << TQString::number( unitToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); } -void QSqlRecipeDB::removeIngredientGroup( int groupID ) +void TQSqlRecipeDB::removeIngredientGroup( int groupID ) { - QString command; + TQString command; // First remove the ingredient - command = QString( "DELETE FROM ingredient_groups WHERE id=%1" ).arg( groupID ); - QSqlQuery toDelete( command, database ); + command = TQString( "DELETE FROM ingredient_groups WHERE id=%1" ).arg( groupID ); + TQSqlQuery toDelete( command, database ); // Remove all the unit entries for this ingredient - command = QString( "UPDATE ingredient_list SET group_id='-1' WHERE group_id=%1" ).arg( groupID ); + command = TQString( "UPDATE ingredient_list SET group_id='-1' WHERE group_id=%1" ).arg( groupID ); toDelete.exec( command ); emit ingGroupRemoved( groupID ); } -void QSqlRecipeDB::removeIngredient( int ingredientID ) +void TQSqlRecipeDB::removeIngredient( int ingredientID ) { - QString command; + TQString command; // First remove the ingredient - command = QString( "DELETE FROM ingredients WHERE id=%1;" ).arg( ingredientID ); - QSqlQuery ingredientToDelete( command, database ); + command = TQString( "DELETE FROM ingredients WHERE id=%1;" ).arg( ingredientID ); + TQSqlQuery ingredientToDelete( command, database ); // Remove all the unit entries for this ingredient - command = QString( "DELETE FROM unit_list WHERE ingredient_id=%1;" ).arg( ingredientID ); + command = TQString( "DELETE FROM unit_list WHERE ingredient_id=%1;" ).arg( ingredientID ); ingredientToDelete.exec( command ); // Remove any recipe using that ingredient - command = QString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1;" ).arg( ingredientID ); + command = TQString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1;" ).arg( ingredientID ); ingredientToDelete.exec( command ); if ( ingredientToDelete.isActive() ) { while ( ingredientToDelete.next() ) { emit recipeRemoved( ingredientToDelete.value( 0 ).toInt() ); - database->exec( QString( "DELETE FROM recipes WHERE id=%1;" ).arg( ingredientToDelete.value( 0 ).toInt() ) ); + database->exec( TQString( "DELETE FROM recipes WHERE id=%1;" ).arg( ingredientToDelete.value( 0 ).toInt() ) ); } } // Remove any ingredient in ingredient_list which has references to this ingredient - command = QString( "DELETE FROM ingredient_list WHERE ingredient_id=%1;" ).arg( ingredientID ); + command = TQString( "DELETE FROM ingredient_list WHERE ingredient_id=%1;" ).arg( ingredientID ); ingredientToDelete.exec( command ); // Clean up ingredient_list which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_list WHERE recipe_id NOT IN ( SELECT id FROM recipes );) - QStringList ids; - command = QString( "SELECT id FROM recipes;" ); + TQStringList ids; + command = TQString( "SELECT id FROM recipes;" ); ingredientToDelete.exec( command ); if ( ingredientToDelete.isActive() ) { while ( ingredientToDelete.next() ) { - ids << QString::number( ingredientToDelete.value( 0 ).toInt() ); + ids << TQString::number( ingredientToDelete.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); ingredientToDelete.exec( command ); // Clean up category_list which have no recipe that they belong to. Same method as above - command = QString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); ingredientToDelete.exec( command ); // Clean up ingredient_groups which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_groups WHERE id NOT IN ( SELECT DISTINCT(group_id) FROM ingredient_list );) ids.clear(); - command = QString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); + command = TQString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); ingredientToDelete.exec( command ); if ( ingredientToDelete.isActive() ) { while ( ingredientToDelete.next() ) { if ( ingredientToDelete.value( 0 ).toInt() != -1 ) - ids << QString::number( ingredientToDelete.value( 0 ).toInt() ); + ids << TQString::number( ingredientToDelete.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); ingredientToDelete.exec( command ); // Remove property list of this ingredient - command = QString( "DELETE FROM ingredient_info WHERE ingredient_id=%1;" ).arg( ingredientID ); + command = TQString( "DELETE FROM ingredient_info WHERE ingredient_id=%1;" ).arg( ingredientID ); ingredientToDelete.exec( command ); emit ingredientRemoved( ingredientID ); } -void QSqlRecipeDB::removeIngredientWeight( int id ) +void TQSqlRecipeDB::removeIngredientWeight( int id ) { - QString command; + TQString command; // First remove the ingredient - command = QString( "DELETE FROM ingredient_weights WHERE id=%1" ).arg( id ); - QSqlQuery toDelete( command, database ); + command = TQString( "DELETE FROM ingredient_weights WHERE id=%1" ).arg( id ); + TQSqlQuery toDelete( command, database ); } -void QSqlRecipeDB::addIngredientWeight( const Weight &w ) +void TQSqlRecipeDB::addIngredientWeight( const Weight &w ) { - QString command; + TQString command; if ( w.id != -1 ) { - command = QString( "UPDATE ingredient_weights SET ingredient_id=%1,amount=%2,unit_id=%3,weight=%4,weight_unit_id=%5,prep_method_id=%7 WHERE id=%6" ) + command = TQString( "UPDATE ingredient_weights SET ingredient_id=%1,amount=%2,unit_id=%3,weight=%4,weight_unit_id=%5,prep_method_id=%7 WHERE id=%6" ) .arg(w.ingredientID) .arg(w.perAmount) .arg(w.perAmountUnitID) @@ -1175,7 +1175,7 @@ void QSqlRecipeDB::addIngredientWeight( const Weight &w ) .arg(w.prepMethodID); } else { - command = QString( "INSERT INTO ingredient_weights VALUES(%6,%1,%2,%3,%4,%5,%7)" ) + command = TQString( "INSERT INTO ingredient_weights VALUES(%6,%1,%2,%3,%4,%5,%7)" ) .arg(w.ingredientID) .arg(w.perAmount) .arg(w.perAmountUnitID) @@ -1184,45 +1184,45 @@ void QSqlRecipeDB::addIngredientWeight( const Weight &w ) .arg(getNextInsertIDStr( "ingredient_weights", "id" )) .arg(w.prepMethodID); } - QSqlQuery query( command, database ); + TQSqlQuery query( command, database ); } -void QSqlRecipeDB::addProperty( const QString &name, const QString &units ) +void TQSqlRecipeDB::addProperty( const TQString &name, const TQString &units ) { - QString command; - QString real_name = name.left( maxPropertyNameLength() ); + TQString command; + TQString real_name = name.left( maxPropertyNameLength() ); - command = QString( "INSERT INTO ingredient_properties VALUES(%3,'%1','%2');" ) + command = TQString( "INSERT INTO ingredient_properties VALUES(%3,'%1','%2');" ) .arg( escapeAndEncode( real_name ) ) .arg( escapeAndEncode( units ) ) .arg( getNextInsertIDStr( "ingredient_properties", "id" ) ); - QSqlQuery propertyToAdd( command, database ); + TQSqlQuery propertyToAdd( command, database ); emit propertyCreated( IngredientProperty( real_name, units, lastInsertID() ) ); } -void QSqlRecipeDB::loadProperties( IngredientPropertyList *list, int ingredientID ) +void TQSqlRecipeDB::loadProperties( IngredientPropertyList *list, int ingredientID ) { list->clear(); - QString command; + TQString command; bool usePerUnit; if ( ingredientID >= 0 ) // Load properties of this ingredient { usePerUnit = true; - command = QString( "SELECT ip.id,ip.name,ip.units,ii.per_units,u.name,u.type,ii.amount,ii.ingredient_id FROM ingredient_properties ip, ingredient_info ii, units u WHERE ii.ingredient_id=%1 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( ingredientID ); + command = TQString( "SELECT ip.id,ip.name,ip.units,ii.per_units,u.name,u.type,ii.amount,ii.ingredient_id FROM ingredient_properties ip, ingredient_info ii, units u WHERE ii.ingredient_id=%1 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( ingredientID ); } else if ( ingredientID == -1 ) // Load the properties of all the ingredients { usePerUnit = true; - command = QString( "SELECT ip.id,ip.name,ip.units,ii.per_units,u.name,u.type,ii.amount,ii.ingredient_id FROM ingredient_properties ip, ingredient_info ii, units u WHERE ii.property_id=ip.id AND ii.per_units=u.id;" ); + command = TQString( "SELECT ip.id,ip.name,ip.units,ii.per_units,u.name,u.type,ii.amount,ii.ingredient_id FROM ingredient_properties ip, ingredient_info ii, units u WHERE ii.property_id=ip.id AND ii.per_units=u.id;" ); } else // Load the whole property list (just the list of possible properties, not the ingredient properties) { usePerUnit = false; - command = QString( "SELECT id,name,units FROM ingredient_properties;" ); + command = TQString( "SELECT id,name,units FROM ingredient_properties;" ); } - QSqlQuery propertiesToLoad ( command, database ); + TQSqlQuery propertiesToLoad ( command, database ); // Load the results into the list if ( propertiesToLoad.isActive() ) { while ( propertiesToLoad.next() ) { @@ -1249,183 +1249,183 @@ void QSqlRecipeDB::loadProperties( IngredientPropertyList *list, int ingredientI } } -void QSqlRecipeDB::changePropertyAmountToIngredient( int ingredientID, int propertyID, double amount, int per_units ) +void TQSqlRecipeDB::changePropertyAmountToIngredient( int ingredientID, int propertyID, double amount, int per_units ) { - QString command; - command = QString( "UPDATE ingredient_info SET amount=%1 WHERE ingredient_id=%2 AND property_id=%3 AND per_units=%4;" ).arg( amount ).arg( ingredientID ).arg( propertyID ).arg( per_units ); - QSqlQuery infoToChange( command, database ); + TQString command; + command = TQString( "UPDATE ingredient_info SET amount=%1 WHERE ingredient_id=%2 AND property_id=%3 AND per_units=%4;" ).arg( amount ).arg( ingredientID ).arg( propertyID ).arg( per_units ); + TQSqlQuery infoToChange( command, database ); } -void QSqlRecipeDB::addPropertyToIngredient( int ingredientID, int propertyID, double amount, int perUnitsID ) +void TQSqlRecipeDB::addPropertyToIngredient( int ingredientID, int propertyID, double amount, int perUnitsID ) { - QString command; + TQString command; - command = QString( "INSERT INTO ingredient_info VALUES(%1,%2,%3,%4);" ).arg( ingredientID ).arg( propertyID ).arg( amount ).arg( perUnitsID ); - QSqlQuery propertyToAdd( command, database ); + command = TQString( "INSERT INTO ingredient_info VALUES(%1,%2,%3,%4);" ).arg( ingredientID ).arg( propertyID ).arg( amount ).arg( perUnitsID ); + TQSqlQuery propertyToAdd( command, database ); } -void QSqlRecipeDB::removePropertyFromIngredient( int ingredientID, int propertyID, int perUnitID ) +void TQSqlRecipeDB::removePropertyFromIngredient( int ingredientID, int propertyID, int perUnitID ) { - QString command; + TQString command; // remove property from ingredient info. Note that there could be duplicates with different units (per_units). Remove just the one especified. - command = QString( "DELETE FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2 AND per_units=%3;" ).arg( ingredientID ).arg( propertyID ).arg( perUnitID ); - QSqlQuery propertyToRemove( command, database ); + command = TQString( "DELETE FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2 AND per_units=%3;" ).arg( ingredientID ).arg( propertyID ).arg( perUnitID ); + TQSqlQuery propertyToRemove( command, database ); } -void QSqlRecipeDB::removeProperty( int propertyID ) +void TQSqlRecipeDB::removeProperty( int propertyID ) { - QString command; + TQString command; // Remove property from the ingredient_properties - command = QString( "DELETE FROM ingredient_properties WHERE id=%1;" ).arg( propertyID ); - QSqlQuery propertyToRemove( command, database ); + command = TQString( "DELETE FROM ingredient_properties WHERE id=%1;" ).arg( propertyID ); + TQSqlQuery propertyToRemove( command, database ); // Remove any ingredient info that uses this property - command = QString( "DELETE FROM ingredient_info WHERE property_id=%1;" ).arg( propertyID ); + command = TQString( "DELETE FROM ingredient_info WHERE property_id=%1;" ).arg( propertyID ); propertyToRemove.exec( command ); emit propertyRemoved( propertyID ); } -void QSqlRecipeDB::removeUnit( int unitID ) +void TQSqlRecipeDB::removeUnit( int unitID ) { - QString command; + TQString command; // Remove the unit first - command = QString( "DELETE FROM units WHERE id=%1;" ).arg( unitID ); - QSqlQuery unitToRemove( command, database ); + command = TQString( "DELETE FROM units WHERE id=%1;" ).arg( unitID ); + TQSqlQuery unitToRemove( command, database ); //Remove the unit from ingredients using it - command = QString( "DELETE FROM unit_list WHERE unit_id=%1;" ).arg( unitID ); + command = TQString( "DELETE FROM unit_list WHERE unit_id=%1;" ).arg( unitID ); unitToRemove.exec( command ); // Remove any recipe using that unit in the ingredient list (user must have been warned before calling this function!) - command = QString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.unit_id=%1;" ).arg( unitID ); + command = TQString( "SELECT r.id FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.unit_id=%1;" ).arg( unitID ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { emit recipeRemoved( unitToRemove.value( 0 ).toInt() ); - database->exec( QString( "DELETE FROM recipes WHERE id=%1;" ).arg( unitToRemove.value( 0 ).toInt() ) ); + database->exec( TQString( "DELETE FROM recipes WHERE id=%1;" ).arg( unitToRemove.value( 0 ).toInt() ) ); } } // Remove any ingredient in ingredient_list which has references to this unit - command = QString( "DELETE FROM ingredient_list WHERE unit_id=%1;" ).arg( unitID ); + command = TQString( "DELETE FROM ingredient_list WHERE unit_id=%1;" ).arg( unitID ); unitToRemove.exec( command ); // Clean up ingredient_list which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_list WHERE recipe_id NOT IN ( SELECT id FROM recipes );) - QStringList ids; - command = QString( "SELECT id FROM recipes;" ); + TQStringList ids; + command = TQString( "SELECT id FROM recipes;" ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { - ids << QString::number( unitToRemove.value( 0 ).toInt() ); + ids << TQString::number( unitToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); // Clean up category_list which have no recipe that they belong to. Same method as above - command = QString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); // Clean up ingredient_groups which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_groups WHERE id NOT IN ( SELECT DISTINCT(group_id) FROM ingredient_list );) ids.clear(); - command = QString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); + command = TQString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); unitToRemove.exec( command ); if ( unitToRemove.isActive() ) { while ( unitToRemove.next() ) { if ( unitToRemove.value( 0 ).toInt() != -1 ) - ids << QString::number( unitToRemove.value( 0 ).toInt() ); + ids << TQString::number( unitToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); unitToRemove.exec( command ); // Remove the ingredient properties using this unit (user must be warned before calling this function) - command = QString( "DELETE FROM ingredient_info WHERE per_units=%1;" ).arg( unitID ); + command = TQString( "DELETE FROM ingredient_info WHERE per_units=%1;" ).arg( unitID ); unitToRemove.exec( command ); // Remove the unit conversion ratios with this unit - command = QString( "DELETE FROM units_conversion WHERE unit1_id=%1 OR unit2_id=%2;" ).arg( unitID ).arg( unitID ); + command = TQString( "DELETE FROM units_conversion WHERE unit1_id=%1 OR unit2_id=%2;" ).arg( unitID ).arg( unitID ); unitToRemove.exec( command ); // Remove associated ingredient weights - command = QString( "DELETE FROM ingredient_weights WHERE unit_id=%1" ).arg( unitID ); + command = TQString( "DELETE FROM ingredient_weights WHERE unit_id=%1" ).arg( unitID ); unitToRemove.exec( command ); emit unitRemoved( unitID ); } -void QSqlRecipeDB::removePrepMethod( int prepMethodID ) +void TQSqlRecipeDB::removePrepMethod( int prepMethodID ) { - QString command; + TQString command; // Remove the prep method first - command = QString( "DELETE FROM prep_methods WHERE id=%1;" ).arg( prepMethodID ); - QSqlQuery prepMethodToRemove( command, database ); + command = TQString( "DELETE FROM prep_methods WHERE id=%1;" ).arg( prepMethodID ); + TQSqlQuery prepMethodToRemove( command, database ); // Remove any recipe using that prep method in the ingredient list (user must have been warned before calling this function!) - command = QString( "SELECT DISTINCT r.id FROM recipes r,ingredient_list il, prep_method_list pl WHERE r.id=il.recipe_id AND pl.ingredient_list_id=il.id AND pl.prep_method_id=%1;" ).arg( prepMethodID ); + command = TQString( "SELECT DISTINCT r.id FROM recipes r,ingredient_list il, prep_method_list pl WHERE r.id=il.recipe_id AND pl.ingredient_list_id=il.id AND pl.prep_method_id=%1;" ).arg( prepMethodID ); prepMethodToRemove.exec( command ); if ( prepMethodToRemove.isActive() ) { while ( prepMethodToRemove.next() ) { emit recipeRemoved( prepMethodToRemove.value( 0 ).toInt() ); - database->exec( QString( "DELETE FROM recipes WHERE id=%1;" ).arg( prepMethodToRemove.value( 0 ).toInt() ) ); + database->exec( TQString( "DELETE FROM recipes WHERE id=%1;" ).arg( prepMethodToRemove.value( 0 ).toInt() ) ); } } // Clean up ingredient_list which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_list WHERE recipe_id NOT IN ( SELECT id FROM recipes );) - QStringList ids; - command = QString( "SELECT id FROM recipes;" ); + TQStringList ids; + command = TQString( "SELECT id FROM recipes;" ); prepMethodToRemove.exec( command ); if ( prepMethodToRemove.isActive() ) { while ( prepMethodToRemove.next() ) { - ids << QString::number( prepMethodToRemove.value( 0 ).toInt() ); + ids << TQString::number( prepMethodToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); prepMethodToRemove.exec( command ); // Clean up category_list which have no recipe that they belong to. Same method as above - command = QString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM category_list WHERE recipe_id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); prepMethodToRemove.exec( command ); // Clean up ingredient_groups which have no recipe that they belong to // MySQL doesn't support subqueries until 4.1, so we'll do this the long way // (Easy way: DELETE FROM ingredient_groups WHERE id NOT IN ( SELECT DISTINCT(group_id) FROM ingredient_list );) ids.clear(); - command = QString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); + command = TQString( "SELECT DISTINCT(group_id) FROM ingredient_list;" ); prepMethodToRemove.exec( command ); if ( prepMethodToRemove.isActive() ) { while ( prepMethodToRemove.next() ) { if ( prepMethodToRemove.value( 0 ).toInt() != -1 ) - ids << QString::number( prepMethodToRemove.value( 0 ).toInt() ); + ids << TQString::number( prepMethodToRemove.value( 0 ).toInt() ); } } - command = QString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); + command = TQString( "DELETE FROM ingredient_groups WHERE id NOT IN ( %1 );" ).arg( ( ids.count() == 0 ) ? "-1" : ids.join( "," ) ); prepMethodToRemove.exec( command ); emit prepMethodRemoved( prepMethodID ); } -void QSqlRecipeDB::createNewUnit( const Unit &unit ) +void TQSqlRecipeDB::createNewUnit( const Unit &unit ) { - QString real_name = unit.name.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_plural = unit.plural.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_name_abbrev = unit.name_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_plural_abbrev = unit.plural_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_name = unit.name.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_plural = unit.plural.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_name_abbrev = unit.name_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_plural_abbrev = unit.plural_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); Unit new_unit( real_name, real_plural ); new_unit.name_abbrev = real_name_abbrev; @@ -1447,29 +1447,29 @@ void QSqlRecipeDB::createNewUnit( const Unit &unit ) real_plural_abbrev = "'"+escapeAndEncode(real_plural_abbrev)+"'"; - QString command = "INSERT INTO units VALUES(" + getNextInsertIDStr( "units", "id" ) + TQString command = "INSERT INTO units VALUES(" + getNextInsertIDStr( "units", "id" ) + ",'" + escapeAndEncode( real_name ) + "'," + real_name_abbrev + ",'" + escapeAndEncode( real_plural ) + "'," + real_plural_abbrev - + "," + QString::number(unit.type) + + "," + TQString::number(unit.type) + ");"; - QSqlQuery unitToCreate( command, database ); + TQSqlQuery unitToCreate( command, database ); new_unit.id = lastInsertID(); emit unitCreated( new_unit ); } -void QSqlRecipeDB::modUnit( const Unit &unit ) +void TQSqlRecipeDB::modUnit( const Unit &unit ) { - QSqlQuery unitQuery( QString::null, database ); + TQSqlQuery unitQuery( TQString::null, database ); - QString real_name = unit.name.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_plural = unit.plural.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_name_abbrev = unit.name_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); - QString real_plural_abbrev = unit.plural_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_name = unit.name.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_plural = unit.plural.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_name_abbrev = unit.name_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); + TQString real_plural_abbrev = unit.plural_abbrev.left( maxUnitNameLength() ).stripWhiteSpace(); Unit newUnit( real_name, real_plural, unit.id ); newUnit.type = unit.type; @@ -1485,7 +1485,7 @@ void QSqlRecipeDB::modUnit( const Unit &unit ) else real_plural_abbrev = "'"+escapeAndEncode(real_plural_abbrev)+"'"; - QString command = QString("UPDATE units SET name='%1',name_abbrev=%2,plural='%3',plural_abbrev=%4,type=%6 WHERE id='%5'") + TQString command = TQString("UPDATE units SET name='%1',name_abbrev=%2,plural='%3',plural_abbrev=%4,type=%6 WHERE id='%5'") .arg(escapeAndEncode(real_name)) .arg(real_name_abbrev) .arg(escapeAndEncode(real_plural)) @@ -1498,10 +1498,10 @@ void QSqlRecipeDB::modUnit( const Unit &unit ) emit unitCreated( newUnit ); } -void QSqlRecipeDB::findUseOfIngGroupInRecipes( ElementList *results, int groupID ) +void TQSqlRecipeDB::findUseOfIngGroupInRecipes( ElementList *results, int groupID ) { - QString command = QString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.group_id=%1" ).arg( groupID ); - QSqlQuery query( command, database ); + TQString command = TQString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.group_id=%1" ).arg( groupID ); + TQSqlQuery query( command, database ); // Populate data if ( query.isActive() ) { @@ -1514,10 +1514,10 @@ void QSqlRecipeDB::findUseOfIngGroupInRecipes( ElementList *results, int groupID } } -void QSqlRecipeDB::findUseOfCategoryInRecipes( ElementList *results, int catID ) +void TQSqlRecipeDB::findUseOfCategoryInRecipes( ElementList *results, int catID ) { - QString command = QString( "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id AND cl.category_id=%1" ).arg( catID ); - QSqlQuery query( command, database ); + TQString command = TQString( "SELECT r.id,r.title FROM recipes r,category_list cl WHERE r.id=cl.recipe_id AND cl.category_id=%1" ).arg( catID ); + TQSqlQuery query( command, database ); // Populate data if ( query.isActive() ) { @@ -1530,8 +1530,8 @@ void QSqlRecipeDB::findUseOfCategoryInRecipes( ElementList *results, int catID ) } //recursively find dependenacies in subcategories - command = QString( "SELECT id FROM categories WHERE parent_id=%1" ).arg( catID ); - QSqlQuery findDeps = database->exec( command ); + command = TQString( "SELECT id FROM categories WHERE parent_id=%1" ).arg( catID ); + TQSqlQuery findDeps = database->exec( command ); if ( findDeps.isActive() ) { while ( findDeps.next() ) { findUseOfCategoryInRecipes(results,findDeps.value( 0 ).toInt() ); @@ -1539,10 +1539,10 @@ void QSqlRecipeDB::findUseOfCategoryInRecipes( ElementList *results, int catID ) } } -void QSqlRecipeDB::findUseOfAuthorInRecipes( ElementList *results, int authorID ) +void TQSqlRecipeDB::findUseOfAuthorInRecipes( ElementList *results, int authorID ) { - QString command = QString( "SELECT r.id,r.title FROM recipes r,author_list al WHERE r.id=al.recipe_id AND al.author_id=%1" ).arg( authorID ); - QSqlQuery query( command, database ); + TQString command = TQString( "SELECT r.id,r.title FROM recipes r,author_list al WHERE r.id=al.recipe_id AND al.author_id=%1" ).arg( authorID ); + TQSqlQuery query( command, database ); // Populate data if ( query.isActive() ) { @@ -1555,16 +1555,16 @@ void QSqlRecipeDB::findUseOfAuthorInRecipes( ElementList *results, int authorID } } -void QSqlRecipeDB::loadUnitRatios( UnitRatioList *ratioList, Unit::Type type ) +void TQSqlRecipeDB::loadUnitRatios( UnitRatioList *ratioList, Unit::Type type ) { ratioList->clear(); - QString command; + TQString command; if ( type == Unit::All ) command = "SELECT unit1_id,unit2_id,ratio FROM units_conversion"; else - command = "SELECT unit1_id,unit2_id,ratio FROM units_conversion,units unit1,units unit2 WHERE unit1_id=unit1.id AND unit1.type="+QString::number(type)+" AND unit2_id=unit2.id AND unit2.type="+QString::number(type); - QSqlQuery ratiosToLoad( command, database ); + command = "SELECT unit1_id,unit2_id,ratio FROM units_conversion,units unit1,units unit2 WHERE unit1_id=unit1.id AND unit1.type="+TQString::number(type)+" AND unit2_id=unit2.id AND unit2.type="+TQString::number(type); + TQSqlQuery ratiosToLoad( command, database ); if ( ratiosToLoad.isActive() ) { while ( ratiosToLoad.next() ) { @@ -1577,38 +1577,38 @@ void QSqlRecipeDB::loadUnitRatios( UnitRatioList *ratioList, Unit::Type type ) } } -void QSqlRecipeDB::saveUnitRatio( const UnitRatio *ratio ) +void TQSqlRecipeDB::saveUnitRatio( const UnitRatio *ratio ) { - QString command; + TQString command; // Check if it's a new ratio or it exists already. - command = QString( "SELECT * FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2" ).arg( ratio->uID1 ).arg( ratio->uID2 ); // Find ratio between units + command = TQString( "SELECT * FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2" ).arg( ratio->uID1 ).arg( ratio->uID2 ); // Find ratio between units - QSqlQuery ratioFound( command, database ); // Find the entries + TQSqlQuery ratioFound( command, database ); // Find the entries bool newRatio = ( ratioFound.size() == 0 ); if ( newRatio ) - command = QString( "INSERT INTO units_conversion VALUES(%1,%2,%3);" ).arg( ratio->uID1 ).arg( ratio->uID2 ).arg( ratio->ratio ); + command = TQString( "INSERT INTO units_conversion VALUES(%1,%2,%3);" ).arg( ratio->uID1 ).arg( ratio->uID2 ).arg( ratio->ratio ); else - command = QString( "UPDATE units_conversion SET ratio=%3 WHERE unit1_id=%1 AND unit2_id=%2" ).arg( ratio->uID1 ).arg( ratio->uID2 ).arg( ratio->ratio ); + command = TQString( "UPDATE units_conversion SET ratio=%3 WHERE unit1_id=%1 AND unit2_id=%2" ).arg( ratio->uID1 ).arg( ratio->uID2 ).arg( ratio->ratio ); ratioFound.exec( command ); // Enter the new ratio } -void QSqlRecipeDB::removeUnitRatio( int unitID1, int unitID2 ) +void TQSqlRecipeDB::removeUnitRatio( int unitID1, int unitID2 ) { - database->exec(QString( "DELETE FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2" ).arg( unitID1 ).arg( unitID2 )); + database->exec(TQString( "DELETE FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2" ).arg( unitID1 ).arg( unitID2 )); } -double QSqlRecipeDB::unitRatio( int unitID1, int unitID2 ) +double TQSqlRecipeDB::unitRatio( int unitID1, int unitID2 ) { if ( unitID1 == unitID2 ) return ( 1.0 ); - QString command; + TQString command; - command = QString( "SELECT ratio FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2;" ).arg( unitID1 ).arg( unitID2 ); - QSqlQuery ratioToLoad( command, database ); + command = TQString( "SELECT ratio FROM units_conversion WHERE unit1_id=%1 AND unit2_id=%2;" ).arg( unitID1 ).arg( unitID2 ); + TQSqlQuery ratioToLoad( command, database ); if ( ratioToLoad.isActive() && ratioToLoad.next() ) return ( ratioToLoad.value( 0 ).toDouble() ); @@ -1616,13 +1616,13 @@ double QSqlRecipeDB::unitRatio( int unitID1, int unitID2 ) return ( -1 ); } -double QSqlRecipeDB::ingredientWeight( const Ingredient &ing, bool *wasApproximated ) +double TQSqlRecipeDB::ingredientWeight( const Ingredient &ing, bool *wasApproximated ) { - QString command = QString( "SELECT amount,weight,prep_method_id,unit_id FROM ingredient_weights WHERE ingredient_id=%1 AND (unit_id=%2 OR weight_unit_id=%3)" ) + TQString command = TQString( "SELECT amount,weight,prep_method_id,unit_id FROM ingredient_weights WHERE ingredient_id=%1 AND (unit_id=%2 OR weight_unit_id=%3)" ) .arg( ing.ingredientID ) .arg( ing.units.id ).arg( ing.units.id ); - QSqlQuery query( command, database ); + TQSqlQuery query( command, database ); if ( query.isActive() ) { //store the amount for the entry with no prep method. If no other suitable entry is found, we'll guesstimate @@ -1664,12 +1664,12 @@ double QSqlRecipeDB::ingredientWeight( const Ingredient &ing, bool *wasApproxima return -1; } -WeightList QSqlRecipeDB::ingredientWeightUnits( int ingID ) +WeightList TQSqlRecipeDB::ingredientWeightUnits( int ingID ) { WeightList list; - QString command = QString( "SELECT id,amount,unit_id,weight,weight_unit_id,prep_method_id FROM ingredient_weights WHERE ingredient_id=%1" ).arg( ingID ); - QSqlQuery query( command, database ); + TQString command = TQString( "SELECT id,amount,unit_id,weight,weight_unit_id,prep_method_id FROM ingredient_weights WHERE ingredient_id=%1" ).arg( ingID ); + TQSqlQuery query( command, database ); if ( query.isActive() ) { while ( query.next() ) { Weight w; @@ -1688,48 +1688,48 @@ WeightList QSqlRecipeDB::ingredientWeightUnits( int ingID ) } //Finds data dependant on this Ingredient/Unit combination -void QSqlRecipeDB::findIngredientUnitDependancies( int ingredientID, int unitID, ElementList *recipes, ElementList *ingredientInfo ) +void TQSqlRecipeDB::findIngredientUnitDependancies( int ingredientID, int unitID, ElementList *recipes, ElementList *ingredientInfo ) { // Recipes using that combination - QString command = QString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1 AND il.unit_id=%2;" ).arg( ingredientID ).arg( unitID ); - QSqlQuery unitToRemove( command, database ); + TQString command = TQString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1 AND il.unit_id=%2;" ).arg( ingredientID ).arg( unitID ); + TQSqlQuery unitToRemove( command, database ); loadElementList( recipes, &unitToRemove ); // Ingredient info using that combination - command = QString( "SELECT i.name,ip.name,ip.units,u.name FROM ingredients i, ingredient_info ii, ingredient_properties ip, units u WHERE i.id=ii.ingredient_id AND ii.ingredient_id=%1 AND ii.per_units=%2 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( ingredientID ).arg( unitID ); + command = TQString( "SELECT i.name,ip.name,ip.units,u.name FROM ingredients i, ingredient_info ii, ingredient_properties ip, units u WHERE i.id=ii.ingredient_id AND ii.ingredient_id=%1 AND ii.per_units=%2 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( ingredientID ).arg( unitID ); unitToRemove.exec( command ); loadPropertyElementList( ingredientInfo, &unitToRemove ); } -void QSqlRecipeDB::findIngredientDependancies( int ingredientID, ElementList *recipes ) +void TQSqlRecipeDB::findIngredientDependancies( int ingredientID, ElementList *recipes ) { - QString command = QString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1" ).arg( ingredientID ); + TQString command = TQString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.ingredient_id=%1" ).arg( ingredientID ); - QSqlQuery ingredientToRemove( command, database ); + TQSqlQuery ingredientToRemove( command, database ); loadElementList( recipes, &ingredientToRemove ); } //Finds data dependant on the removal of this Unit -void QSqlRecipeDB::findUnitDependancies( int unitID, ElementList *properties, ElementList *recipes, ElementList *weights ) +void TQSqlRecipeDB::findUnitDependancies( int unitID, ElementList *properties, ElementList *recipes, ElementList *weights ) { // Ingredient-Info (ingredient->property) using this Unit - QString command = QString( "SELECT i.name,ip.name,ip.units,u.name FROM ingredients i, ingredient_info ii, ingredient_properties ip, units u WHERE i.id=ii.ingredient_id AND ii.per_units=%1 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( unitID ); - QSqlQuery unitToRemove( command, database ); + TQString command = TQString( "SELECT i.name,ip.name,ip.units,u.name FROM ingredients i, ingredient_info ii, ingredient_properties ip, units u WHERE i.id=ii.ingredient_id AND ii.per_units=%1 AND ii.property_id=ip.id AND ii.per_units=u.id;" ).arg( unitID ); + TQSqlQuery unitToRemove( command, database ); loadPropertyElementList( properties, &unitToRemove ); // Recipes using this Unit - command = QString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.unit_id=%1;" ).arg( unitID ); // Without "DISTINCT" we get duplicates since ingredient_list has no unique recipe_id's + command = TQString( "SELECT DISTINCT r.id,r.title FROM recipes r,ingredient_list il WHERE r.id=il.recipe_id AND il.unit_id=%1;" ).arg( unitID ); // Without "DISTINCT" we get duplicates since ingredient_list has no unique recipe_id's unitToRemove.exec( command ); loadElementList( recipes, &unitToRemove ); // Weights using this unit - command = QString( "SELECT i.name,weight_u.name,per_u.name,w.prep_method_id FROM ingredients i,ingredient_weights w,units weight_u,units per_u WHERE i.id=w.ingredient_id AND w.unit_id=per_u.id AND w.weight_unit_id=weight_u.id AND (weight_u.id=%1 OR per_u.id=%2)" ) + command = TQString( "SELECT i.name,weight_u.name,per_u.name,w.prep_method_id FROM ingredients i,ingredient_weights w,units weight_u,units per_u WHERE i.id=w.ingredient_id AND w.unit_id=per_u.id AND w.weight_unit_id=weight_u.id AND (weight_u.id=%1 OR per_u.id=%2)" ) .arg( unitID ) .arg( unitID ); unitToRemove.exec( command ); @@ -1737,48 +1737,48 @@ void QSqlRecipeDB::findUnitDependancies( int unitID, ElementList *properties, El while ( unitToRemove.next() ) { Element el; - QString ingName = unescapeAndDecode( unitToRemove.value( 0 ).toCString() ); - QString weightUnit = unescapeAndDecode( unitToRemove.value( 1 ).toCString() ); - QString perUnit = unescapeAndDecode( unitToRemove.value( 2 ).toCString() ); + TQString ingName = unescapeAndDecode( unitToRemove.value( 0 ).toCString() ); + TQString weightUnit = unescapeAndDecode( unitToRemove.value( 1 ).toCString() ); + TQString perUnit = unescapeAndDecode( unitToRemove.value( 2 ).toCString() ); int prepID = unitToRemove.value( 3 ).toInt(); - QString prep; + TQString prep; if ( prepID != -1 ) { - command = QString( "SELECT p.name FROM prep_methods p, ingredient_weights w WHERE p.id = w.prep_method_id AND w.prep_method_id=%1" ) + command = TQString( "SELECT p.name FROM prep_methods p, ingredient_weights w WHERE p.id = w.prep_method_id AND w.prep_method_id=%1" ) .arg( prepID ); - QSqlQuery query( command, database ); + TQSqlQuery query( command, database ); if ( query.isActive() && query.first() ) prep = unescapeAndDecode( query.value( 0 ).toCString() ); } - el.name = QString( i18n("In ingredient '%1': weight [%2/%3%4]") ).arg( ingName ).arg( weightUnit ).arg( perUnit ).arg( (prepID == -1)?QString::null:"; "+prep ); + el.name = TQString( i18n("In ingredient '%1': weight [%2/%3%4]") ).arg( ingName ).arg( weightUnit ).arg( perUnit ).arg( (prepID == -1)?TQString::null:"; "+prep ); weights->append( el ); } } } -void QSqlRecipeDB::findPrepMethodDependancies( int prepMethodID, ElementList *recipes ) +void TQSqlRecipeDB::findPrepMethodDependancies( int prepMethodID, ElementList *recipes ) { //get just the ids first so that we can use DISTINCT - QString command = QString( "SELECT DISTINCT r.id FROM recipes r,ingredient_list il, prep_method_list pl WHERE r.id=il.recipe_id AND pl.ingredient_list_id=il.id AND pl.prep_method_id=%1;" ).arg( prepMethodID ); + TQString command = TQString( "SELECT DISTINCT r.id FROM recipes r,ingredient_list il, prep_method_list pl WHERE r.id=il.recipe_id AND pl.ingredient_list_id=il.id AND pl.prep_method_id=%1;" ).arg( prepMethodID ); - QStringList ids; - QSqlQuery query( command, database ); + TQStringList ids; + TQSqlQuery query( command, database ); if ( query.isActive() ) { while ( query.next() ) { - ids << QString::number(query.value( 0 ).toInt()); + ids << TQString::number(query.value( 0 ).toInt()); } } //now get the titles of the ids - command = QString( "SELECT r.id, r.title FROM recipes r WHERE r.id IN ("+ids.join(",")+")" ); - QSqlQuery prepMethodToRemove( command, database ); + command = TQString( "SELECT r.id, r.title FROM recipes r WHERE r.id IN ("+ids.join(",")+")" ); + TQSqlQuery prepMethodToRemove( command, database ); loadElementList( recipes, &prepMethodToRemove ); } -void QSqlRecipeDB::loadElementList( ElementList *elList, QSqlQuery *query ) +void TQSqlRecipeDB::loadElementList( ElementList *elList, TQSqlQuery *query ) { if ( query->isActive() ) { while ( query->next() ) { @@ -1790,18 +1790,18 @@ void QSqlRecipeDB::loadElementList( ElementList *elList, QSqlQuery *query ) } } // See function "findUnitDependancies" for use -void QSqlRecipeDB::loadPropertyElementList( ElementList *elList, QSqlQuery *query ) +void TQSqlRecipeDB::loadPropertyElementList( ElementList *elList, TQSqlQuery *query ) { if ( query->isActive() ) { while ( query->next() ) { Element el; el.id = -1; // There's no ID for the ingredient-property combination - QString ingName = unescapeAndDecode( query->value( 0 ).toCString() ); - QString propName = unescapeAndDecode( query->value( 1 ).toCString() ); - QString propUnits = unescapeAndDecode( query->value( 2 ).toCString() ); - QString propPerUnits = unescapeAndDecode( query->value( 3 ).toCString() ); + TQString ingName = unescapeAndDecode( query->value( 0 ).toCString() ); + TQString propName = unescapeAndDecode( query->value( 1 ).toCString() ); + TQString propUnits = unescapeAndDecode( query->value( 2 ).toCString() ); + TQString propPerUnits = unescapeAndDecode( query->value( 3 ).toCString() ); - el.name = QString( i18n("In ingredient '%1': property \"%2\" [%3/%4]") ).arg( ingName ).arg( propName ).arg( propUnits ).arg( propPerUnits ); + el.name = TQString( i18n("In ingredient '%1': property \"%2\" [%3/%4]") ).arg( ingName ).arg( propName ).arg( propUnits ).arg( propPerUnits ); elList->append( el ); } } @@ -1809,87 +1809,87 @@ void QSqlRecipeDB::loadPropertyElementList( ElementList *elList, QSqlQuery *quer //The string going into the database is utf8 text interpreted as latin1 -QString QSqlRecipeDB::escapeAndEncode( const QString &s ) const +TQString TQSqlRecipeDB::escapeAndEncode( const TQString &s ) const { - QString s_escaped = s; + TQString s_escaped = s; s_escaped.replace ( "'", "\\'" ); s_escaped.replace ( ";", "\";@" ); // Small trick for only for parsing later on - return QString::fromLatin1( s_escaped.utf8() ); + return TQString::fromLatin1( s_escaped.utf8() ); } //The string coming out of the database is utf8 text, interpreted as though latin1. Calling fromUtf8() on this gives us back the original utf8. -QString QSqlRecipeDB::unescapeAndDecode( const QCString &s ) const +TQString TQSqlRecipeDB::unescapeAndDecode( const TQCString &s ) const { - return QString::fromUtf8( s ).replace( "\";@", ";" ); // Use unicode encoding + return TQString::fromUtf8( s ).replace( "\";@", ";" ); // Use unicode encoding } -bool QSqlRecipeDB::ingredientContainsUnit( int ingredientID, int unitID ) +bool TQSqlRecipeDB::ingredientContainsUnit( int ingredientID, int unitID ) { - QString command = QString( "SELECT * FROM unit_list WHERE ingredient_id= %1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); - QSqlQuery recipeToLoad( command, database ); + TQString command = TQString( "SELECT * FROM unit_list WHERE ingredient_id= %1 AND unit_id=%2;" ).arg( ingredientID ).arg( unitID ); + TQSqlQuery recipeToLoad( command, database ); if ( recipeToLoad.isActive() ) { return ( recipeToLoad.size() > 0 ); } return false; } -bool QSqlRecipeDB::ingredientContainsProperty( int ingredientID, int propertyID, int perUnitsID ) +bool TQSqlRecipeDB::ingredientContainsProperty( int ingredientID, int propertyID, int perUnitsID ) { - QString command = QString( "SELECT * FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2 AND per_units=%3;" ).arg( ingredientID ).arg( propertyID ).arg( perUnitsID ); - QSqlQuery recipeToLoad( command, database ); + TQString command = TQString( "SELECT * FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2 AND per_units=%3;" ).arg( ingredientID ).arg( propertyID ).arg( perUnitsID ); + TQSqlQuery recipeToLoad( command, database ); if ( recipeToLoad.isActive() ) { return ( recipeToLoad.size() > 0 ); } return false; } -QString QSqlRecipeDB::categoryName( int ID ) +TQString TQSqlRecipeDB::categoryName( int ID ) { - QString command = QString( "SELECT name FROM categories WHERE id=%1;" ).arg( ID ); - QSqlQuery toLoad( command, database ); + TQString command = TQString( "SELECT name FROM categories WHERE id=%1;" ).arg( ID ); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() && toLoad.next() ) // Go to the first record (there should be only one anyway. return ( unescapeAndDecode( toLoad.value( 0 ).toCString() ) ); - return ( QString::null ); + return ( TQString::null ); } -QString QSqlRecipeDB::ingredientName( int ID ) +TQString TQSqlRecipeDB::ingredientName( int ID ) { - QString command = QString( "SELECT name FROM ingredients WHERE id=%1" ).arg( ID ); - QSqlQuery toLoad( command, database ); + TQString command = TQString( "SELECT name FROM ingredients WHERE id=%1" ).arg( ID ); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() && toLoad.next() ) // Go to the first record (there should be only one anyway. return ( unescapeAndDecode( toLoad.value( 0 ).toCString() ) ); - return ( QString::null ); + return ( TQString::null ); } -QString QSqlRecipeDB::prepMethodName( int ID ) +TQString TQSqlRecipeDB::prepMethodName( int ID ) { - QString command = QString( "SELECT name FROM prep_methods WHERE id=%1" ).arg( ID ); - QSqlQuery toLoad( command, database ); + TQString command = TQString( "SELECT name FROM prep_methods WHERE id=%1" ).arg( ID ); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() && toLoad.next() ) // Go to the first record (there should be only one anyway. return ( unescapeAndDecode( toLoad.value( 0 ).toCString() ) ); - return ( QString::null ); + return ( TQString::null ); } -IngredientProperty QSqlRecipeDB::propertyName( int ID ) +IngredientProperty TQSqlRecipeDB::propertyName( int ID ) { - QString command = QString( "SELECT name,units FROM ingredient_properties WHERE id=%1;" ).arg( ID ); - QSqlQuery toLoad( command, database ); + TQString command = TQString( "SELECT name,units FROM ingredient_properties WHERE id=%1;" ).arg( ID ); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() && toLoad.next() ) { // Go to the first record (there should be only one anyway. return ( IngredientProperty( unescapeAndDecode( toLoad.value( 0 ).toCString() ), unescapeAndDecode( toLoad.value( 1 ).toCString() ), ID ) ); } - return ( IngredientProperty( QString::null, QString::null ) ); + return ( IngredientProperty( TQString::null, TQString::null ) ); } -Unit QSqlRecipeDB::unitName( int ID ) +Unit TQSqlRecipeDB::unitName( int ID ) { - QString command = QString( "SELECT name,plural,name_abbrev,plural_abbrev,type FROM units WHERE id=%1" ).arg( ID ); - QSqlQuery toLoad( command, database ); + TQString command = TQString( "SELECT name,plural,name_abbrev,plural_abbrev,type FROM units WHERE id=%1" ).arg( ID ); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() && toLoad.next() ) { // Go to the first record (there should be only one anyway. Unit unit( unescapeAndDecode( toLoad.value( 0 ).toCString() ), unescapeAndDecode( toLoad.value( 1 ).toCString() ) ); @@ -1910,10 +1910,10 @@ Unit QSqlRecipeDB::unitName( int ID ) return Unit(); } -int QSqlRecipeDB::getCount( const QString &table_name ) +int TQSqlRecipeDB::getCount( const TQString &table_name ) { m_command = "SELECT COUNT(1) FROM "+table_name; - QSqlQuery count( m_command, database ); + TQSqlQuery count( m_command, database ); if ( count.isActive() && count.next() ) { // Go to the first record (there should be only one anyway. return count.value( 0 ).toInt(); } @@ -1921,10 +1921,10 @@ int QSqlRecipeDB::getCount( const QString &table_name ) return -1; } -int QSqlRecipeDB::categoryTopLevelCount() +int TQSqlRecipeDB::categoryTopLevelCount() { m_command = "SELECT COUNT(1) FROM categories WHERE parent_id='-1'"; - QSqlQuery count( m_command, database ); + TQSqlQuery count( m_command, database ); if ( count.isActive() && count.next() ) { // Go to the first record (there should be only one anyway. return count.value( 0 ).toInt(); } @@ -1932,19 +1932,19 @@ int QSqlRecipeDB::categoryTopLevelCount() return -1; } -bool QSqlRecipeDB::checkIntegrity( void ) +bool TQSqlRecipeDB::checkIntegrity( void ) { // Check existence of the necessary tables (the database may be created, but empty) - QStringList tables; + TQStringList tables; tables << "ingredient_info" << "ingredient_list" << "ingredient_properties" << "ingredient_weights" << "ingredients" << "recipes" << "unit_list" << "units" << "units_conversion" << "categories" << "category_list" << "authors" << "author_list" << "db_info" << "prep_methods" << "ingredient_groups" << "yield_types" << "prep_method_list" << "ratings" << "rating_criteria" << "rating_criterion_list"; - QStringList existingTableList = database->tables(); - for ( QStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) { + TQStringList existingTableList = database->tables(); + for ( TQStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) { bool found = false; - for ( QStringList::Iterator ex_it = existingTableList.begin(); ( ( ex_it != existingTableList.end() ) && ( !found ) ); ++ex_it ) { + for ( TQStringList::Iterator ex_it = existingTableList.begin(); ( ( ex_it != existingTableList.end() ) && ( !found ) ); ++ex_it ) { found = ( *ex_it == *it ); } @@ -1954,7 +1954,7 @@ bool QSqlRecipeDB::checkIntegrity( void ) } } - QStringList newTableList = database->tables(); + TQStringList newTableList = database->tables(); if ( newTableList.isEmpty() ) return false; @@ -1965,10 +1965,10 @@ bool QSqlRecipeDB::checkIntegrity( void ) float version = databaseVersion(); kdDebug() << "version found... " << version << " \n"; kdDebug() << "latest version... " << latestDBVersion() << endl; - if ( int( qRound( databaseVersion() * 1e5 ) ) < int( qRound( latestDBVersion() * 1e5 ) ) ) { //correct for float's imprecision + if ( int( tqRound( databaseVersion() * 1e5 ) ) < int( tqRound( latestDBVersion() * 1e5 ) ) ) { //correct for float's imprecision switch ( KMessageBox::questionYesNo( 0, i18n( "The database was created with a previous version of Krecipes. Would you like Krecipes to update this database to work with this version of Krecipes? Depending on the number of recipes and amount of data, this could take some time.

Warning: After updating, this database will no longer be compatible with previous versions of Krecipes.

Cancelling this operation may result in corrupting the database.
" ) ) ) { case KMessageBox::Yes: - emit progressBegin(0,QString::null,i18n("Porting database structure..."),50); + emit progressBegin(0,TQString::null,i18n("Porting database structure..."),50); portOldDatabases( version ); emit progressDone(); break; @@ -1980,19 +1980,19 @@ bool QSqlRecipeDB::checkIntegrity( void ) return true; } -void QSqlRecipeDB::splitCommands( QString& s, QStringList& sl ) +void TQSqlRecipeDB::splitCommands( TQString& s, TQStringList& sl ) { - sl = QStringList::split( QRegExp( ";{1}(?!@)" ), s ); + sl = TQStringList::split( TQRegExp( ";{1}(?!@)" ), s ); } -void QSqlRecipeDB::portOldDatabases( float /* version */ ) +void TQSqlRecipeDB::portOldDatabases( float /* version */ ) {} -float QSqlRecipeDB::databaseVersion( void ) +float TQSqlRecipeDB::databaseVersion( void ) { - QString command = "SELECT ver FROM db_info"; - QSqlQuery dbVersion( command, database ); + TQString command = "SELECT ver FROM db_info"; + TQSqlQuery dbVersion( command, database ); if ( dbVersion.isActive() && dbVersion.next() ) return ( dbVersion.value( 0 ).toDouble() ); // There should be only one (or none for old DB) element, so go to first @@ -2000,13 +2000,13 @@ float QSqlRecipeDB::databaseVersion( void ) return ( 0.2 ); // if table is empty, assume oldest (0.2), and port } -void QSqlRecipeDB::loadRatingCriterion( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadRatingCriterion( ElementList *list, int limit, int offset ) { list->clear(); - QString command = "SELECT id,name FROM rating_criteria ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); - QSqlQuery toLoad( command, database ); + TQString command = "SELECT id,name FROM rating_criteria ORDER BY name" + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); + TQSqlQuery toLoad( command, database ); if ( toLoad.isActive() ) { while ( toLoad.next() ) { Element el; @@ -2017,13 +2017,13 @@ void QSqlRecipeDB::loadRatingCriterion( ElementList *list, int limit, int offset } } -void QSqlRecipeDB::loadCategories( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadCategories( ElementList *list, int limit, int offset ) { list->clear(); m_command = "SELECT id,name FROM categories ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); - QSqlQuery categoryToLoad( m_command, database ); + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); + TQSqlQuery categoryToLoad( m_command, database ); if ( categoryToLoad.isActive() ) { while ( categoryToLoad.next() ) { Element el; @@ -2034,20 +2034,20 @@ void QSqlRecipeDB::loadCategories( ElementList *list, int limit, int offset ) } } -void QSqlRecipeDB::loadCategories( CategoryTree *list, int limit, int offset, int parent_id, bool recurse ) +void TQSqlRecipeDB::loadCategories( CategoryTree *list, int limit, int offset, int parent_id, bool recurse ) { - QString limit_str; + TQString limit_str; if ( parent_id == -1 ) { - emit progressBegin(0,QString::null,i18n("Loading category list")); + emit progressBegin(0,TQString::null,i18n("Loading category list")); list->clear(); //only limit the number of top-level categories - limit_str = (limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset); + limit_str = (limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset); } - m_command = "SELECT id,name,parent_id FROM categories WHERE parent_id='"+QString::number(parent_id)+"' ORDER BY name "+limit_str; + m_command = "SELECT id,name,parent_id FROM categories WHERE parent_id='"+TQString::number(parent_id)+"' ORDER BY name "+limit_str; - QSqlQuery categoryToLoad( QString::null, database ); + TQSqlQuery categoryToLoad( TQString::null, database ); //categoryToLoad.setForwardOnly(true); //FIXME? Subcategories aren't loaded if this is enabled, even though we only go forward categoryToLoad.exec(m_command); @@ -2063,7 +2063,7 @@ void QSqlRecipeDB::loadCategories( CategoryTree *list, int limit, int offset, in CategoryTree *list_child = list->add( el ); if ( recurse ) { - //QTime dbg_timer; dbg_timer.start(); kdDebug()<<" calling QSqlRecipeDB::loadCategories"<clear(); - QString command = "SELECT id,name FROM authors ORDER BY name" - +((limit==-1)?"":" LIMIT "+QString::number(limit)+" OFFSET "+QString::number(offset)); - QSqlQuery authorToLoad( command, database ); + TQString command = "SELECT id,name FROM authors ORDER BY name" + +((limit==-1)?"":" LIMIT "+TQString::number(limit)+" OFFSET "+TQString::number(offset)); + TQSqlQuery authorToLoad( command, database ); if ( authorToLoad.isActive() ) { while ( authorToLoad.next() ) { Element el; @@ -2143,44 +2143,44 @@ void QSqlRecipeDB::loadAuthors( ElementList *list, int limit, int offset ) } } -void QSqlRecipeDB::createNewAuthor( const QString &authorName ) +void TQSqlRecipeDB::createNewAuthor( const TQString &authorName ) { - QString command; - QString real_name = authorName.left( maxAuthorNameLength() ); + TQString command; + TQString real_name = authorName.left( maxAuthorNameLength() ); - command = QString( "INSERT INTO authors VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "authors", "id" ) ); - QSqlQuery authorToCreate( command, database ); + command = TQString( "INSERT INTO authors VALUES(%2,'%1');" ).arg( escapeAndEncode( real_name ) ).arg( getNextInsertIDStr( "authors", "id" ) ); + TQSqlQuery authorToCreate( command, database ); emit authorCreated( Element( real_name, lastInsertID() ) ); } -void QSqlRecipeDB::modAuthor( int authorID, const QString &newLabel ) +void TQSqlRecipeDB::modAuthor( int authorID, const TQString &newLabel ) { - QString command; + TQString command; - command = QString( "UPDATE authors SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( authorID ); - QSqlQuery authorToCreate( command, database ); + command = TQString( "UPDATE authors SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( authorID ); + TQSqlQuery authorToCreate( command, database ); emit authorRemoved( authorID ); emit authorCreated( Element( newLabel, authorID ) ); } -void QSqlRecipeDB::removeAuthor( int authorID ) +void TQSqlRecipeDB::removeAuthor( int authorID ) { - QString command; + TQString command; - command = QString( "DELETE FROM authors WHERE id=%1;" ).arg( authorID ); - QSqlQuery authorToRemove( command, database ); + command = TQString( "DELETE FROM authors WHERE id=%1;" ).arg( authorID ); + TQSqlQuery authorToRemove( command, database ); emit authorRemoved( authorID ); } -int QSqlRecipeDB::findExistingAuthorByName( const QString& name ) +int TQSqlRecipeDB::findExistingAuthorByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxAuthorNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxAuthorNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM authors WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM authors WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2189,12 +2189,12 @@ int QSqlRecipeDB::findExistingAuthorByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingCategoryByName( const QString& name ) +int TQSqlRecipeDB::findExistingCategoryByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxCategoryNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxCategoryNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM categories WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM categories WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2203,12 +2203,12 @@ int QSqlRecipeDB::findExistingCategoryByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingIngredientGroupByName( const QString& name ) +int TQSqlRecipeDB::findExistingIngredientGroupByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxIngGroupNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxIngGroupNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM ingredient_groups WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM ingredient_groups WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2217,12 +2217,12 @@ int QSqlRecipeDB::findExistingIngredientGroupByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingIngredientByName( const QString& name ) +int TQSqlRecipeDB::findExistingIngredientByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxIngredientNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxIngredientNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM ingredients WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM ingredients WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2231,12 +2231,12 @@ int QSqlRecipeDB::findExistingIngredientByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingPrepByName( const QString& name ) +int TQSqlRecipeDB::findExistingPrepByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxPrepMethodNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxPrepMethodNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM prep_methods WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM prep_methods WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2245,12 +2245,12 @@ int QSqlRecipeDB::findExistingPrepByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingPropertyByName( const QString& name ) +int TQSqlRecipeDB::findExistingPropertyByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxPropertyNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxPropertyNameLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM ingredient_properties WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM ingredient_properties WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2259,17 +2259,17 @@ int QSqlRecipeDB::findExistingPropertyByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingUnitByName( const QString& name ) +int TQSqlRecipeDB::findExistingUnitByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxUnitNameLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxUnitNameLength() ) ); //truncate to the maximum size db holds - QString command = "SELECT id FROM units WHERE name LIKE '" + search_str + TQString command = "SELECT id FROM units WHERE name LIKE '" + search_str + "' OR plural LIKE '" + search_str + "' OR name_abbrev LIKE '" + search_str + "' OR plural_abbrev LIKE '" + search_str + "'"; - QSqlQuery elementToLoad( command, database ); // Run the query + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2278,12 +2278,12 @@ int QSqlRecipeDB::findExistingUnitByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingRatingByName( const QString& name ) +int TQSqlRecipeDB::findExistingRatingByName( const TQString& name ) { - QString search_str = escapeAndEncode( name ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM rating_criteria WHERE name LIKE '%1'" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM rating_criteria WHERE name LIKE '%1'" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2292,12 +2292,12 @@ int QSqlRecipeDB::findExistingRatingByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingRecipeByName( const QString& name ) +int TQSqlRecipeDB::findExistingRecipeByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxRecipeTitleLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxRecipeTitleLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM recipes WHERE title LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM recipes WHERE title LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2306,12 +2306,12 @@ int QSqlRecipeDB::findExistingRecipeByName( const QString& name ) return id; } -int QSqlRecipeDB::findExistingYieldTypeByName( const QString& name ) +int TQSqlRecipeDB::findExistingYieldTypeByName( const TQString& name ) { - QString search_str = escapeAndEncode( name.left( maxYieldTypeLength() ) ); //truncate to the maximum size db holds + TQString search_str = escapeAndEncode( name.left( maxYieldTypeLength() ) ); //truncate to the maximum size db holds - QString command = QString( "SELECT id FROM yield_types WHERE name LIKE '%1';" ).arg( search_str ); - QSqlQuery elementToLoad( command, database ); // Run the query + TQString command = TQString( "SELECT id FROM yield_types WHERE name LIKE '%1';" ).arg( search_str ); + TQSqlQuery elementToLoad( command, database ); // Run the query int id = -1; if ( elementToLoad.isActive() && elementToLoad.first() ) @@ -2320,18 +2320,18 @@ int QSqlRecipeDB::findExistingYieldTypeByName( const QString& name ) return id; } -void QSqlRecipeDB::mergeAuthors( int id1, int id2 ) +void TQSqlRecipeDB::mergeAuthors( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' - QString command = QString( "UPDATE author_list SET author_id=%1 WHERE author_id=%2" ) + TQString command = TQString( "UPDATE author_list SET author_id=%1 WHERE author_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure no duplicates were created in this process - command = QString( "SELECT recipe_id FROM author_list WHERE author_id=%1 ORDER BY recipe_id" ) + command = TQString( "SELECT recipe_id FROM author_list WHERE author_id=%1 ORDER BY recipe_id" ) .arg( id1 ); update.exec( command ); int last_id = -1; @@ -2340,19 +2340,19 @@ void QSqlRecipeDB::mergeAuthors( int id1, int id2 ) int current_id = update.value( 0 ).toInt(); if ( last_id == current_id ) { int count = -1; - command = QString( "SELECT COUNT(1) FROM author_list WHERE author_id=%1 AND recipe_id=%2" ) + command = TQString( "SELECT COUNT(1) FROM author_list WHERE author_id=%1 AND recipe_id=%2" ) .arg( id1 ) .arg( last_id ); - QSqlQuery remove( command, database); + TQSqlQuery remove( command, database); if ( remove.isActive() && remove.first() ) count = remove.value(0).toInt(); if ( count > 1 ) { - command = QString( "DELETE FROM author_list WHERE author_id=%1 AND recipe_id=%2" ) + command = TQString( "DELETE FROM author_list WHERE author_id=%1 AND recipe_id=%2" ) .arg( id1 ) .arg( last_id ); database->exec( command ); - command = QString( "INSERT INTO author_list VALUES(%1,%2)" ) + command = TQString( "INSERT INTO author_list VALUES(%1,%2)" ) .arg( id1 ) .arg( last_id ); database->exec( command ); @@ -2363,23 +2363,23 @@ void QSqlRecipeDB::mergeAuthors( int id1, int id2 ) } //remove author with id 'id2' - command = QString( "DELETE FROM authors WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM authors WHERE id=%1" ).arg( id2 ); update.exec( command ); emit authorRemoved( id2 ); } -void QSqlRecipeDB::mergeCategories( int id1, int id2 ) +void TQSqlRecipeDB::mergeCategories( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' - QString command = QString( "UPDATE category_list SET category_id=%1 WHERE category_id=%2" ) + TQString command = TQString( "UPDATE category_list SET category_id=%1 WHERE category_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure no duplicates were created in this process - command = QString( "SELECT recipe_id FROM category_list WHERE category_id=%1 ORDER BY recipe_id" ) + command = TQString( "SELECT recipe_id FROM category_list WHERE category_id=%1 ORDER BY recipe_id" ) .arg( id1 ); update.exec( command ); int last_id = -1; @@ -2388,19 +2388,19 @@ void QSqlRecipeDB::mergeCategories( int id1, int id2 ) int current_id = update.value( 0 ).toInt(); if ( last_id == current_id ) { int count = -1; - command = QString( "SELECT COUNT(1) FROM category_list WHERE category_id=%1 AND recipe_id=%2" ) + command = TQString( "SELECT COUNT(1) FROM category_list WHERE category_id=%1 AND recipe_id=%2" ) .arg( id1 ) .arg( last_id ); - QSqlQuery remove( command, database); + TQSqlQuery remove( command, database); if ( remove.isActive() && remove.first() ) count = remove.value(0).toInt(); if ( count > 1 ) { - command = QString( "DELETE FROM category_list WHERE category_id=%1 AND recipe_id=%2" ) + command = TQString( "DELETE FROM category_list WHERE category_id=%1 AND recipe_id=%2" ) .arg( id1 ) .arg( last_id ); database->exec( command ); - command = QString( "INSERT INTO category_list VALUES(%1,%2)" ) + command = TQString( "INSERT INTO category_list VALUES(%1,%2)" ) .arg( id1 ) .arg( last_id ); database->exec( command ); @@ -2410,61 +2410,61 @@ void QSqlRecipeDB::mergeCategories( int id1, int id2 ) } } - command = QString( "UPDATE categories SET parent_id=%1 WHERE parent_id=%2" ) + command = TQString( "UPDATE categories SET parent_id=%1 WHERE parent_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //we don't want to have a category be its own parent... - command = QString( "UPDATE categories SET parent_id=-1 WHERE parent_id=id" ); + command = TQString( "UPDATE categories SET parent_id=-1 WHERE parent_id=id" ); update.exec( command ); //remove category with id 'id2' - command = QString( "DELETE FROM categories WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM categories WHERE id=%1" ).arg( id2 ); update.exec( command ); emit categoriesMerged( id1, id2 ); } -void QSqlRecipeDB::mergeIngredientGroups( int id1, int id2 ) +void TQSqlRecipeDB::mergeIngredientGroups( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' - QString command = QString( "UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2" ) + TQString command = TQString( "UPDATE ingredient_list SET group_id=%1 WHERE group_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //remove ingredient with id 'id2' - command = QString( "DELETE FROM ingredient_groups WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM ingredient_groups WHERE id=%1" ).arg( id2 ); update.exec( command ); emit ingGroupRemoved( id2 ); } -void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) +void TQSqlRecipeDB::mergeIngredients( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' - QString command = QString( "UPDATE ingredient_list SET ingredient_id=%1 WHERE ingredient_id=%2" ) + TQString command = TQString( "UPDATE ingredient_list SET ingredient_id=%1 WHERE ingredient_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //delete nutrient info associated with ingredient with id 'id2' - command = QString( "DELETE FROM ingredient_info WHERE ingredient_id=%1" ) + command = TQString( "DELETE FROM ingredient_info WHERE ingredient_id=%1" ) .arg( id2 ); update.exec( command ); //update the unit_list - command = QString( "UPDATE unit_list SET ingredient_id=%1 WHERE ingredient_id=%2" ) + command = TQString( "UPDATE unit_list SET ingredient_id=%1 WHERE ingredient_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure no duplicates were created in this process - command = QString( "SELECT unit_id FROM unit_list WHERE ingredient_id=%1 ORDER BY unit_id" ) + command = TQString( "SELECT unit_id FROM unit_list WHERE ingredient_id=%1 ORDER BY unit_id" ) .arg( id1 ); update.exec( command ); int last_id = -1; @@ -2473,19 +2473,19 @@ void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) int current_id = update.value( 0 ).toInt(); if ( last_id == current_id ) { int count = -1; - command = QString( "SELECT COUNT(1) FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) + command = TQString( "SELECT COUNT(1) FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) .arg( id1 ) .arg( last_id ); - QSqlQuery remove( command, database); + TQSqlQuery remove( command, database); if ( remove.isActive() && remove.first() ) count = remove.value(0).toInt(); if ( count > 1 ) { - command = QString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) + command = TQString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) .arg( id1 ) .arg( last_id ); database->exec( command ); - command = QString( "INSERT INTO unit_list VALUES(%1,%2)" ) + command = TQString( "INSERT INTO unit_list VALUES(%1,%2)" ) .arg( id1 ) .arg( last_id ); database->exec( command ); @@ -2496,14 +2496,14 @@ void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) } //update ingredient info - command = QString( "UPDATE ingredient_info SET ingredient_id=%1 WHERE ingredient_id=%2" ) + command = TQString( "UPDATE ingredient_info SET ingredient_id=%1 WHERE ingredient_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure no duplicates were created in this process //info associated with one ingredient will be lost... they should be the same ingredient and thus info anyways - command = QString( "SELECT property_id FROM ingredient_info WHERE ingredient_id=%1 ORDER BY property_id" ) + command = TQString( "SELECT property_id FROM ingredient_info WHERE ingredient_id=%1 ORDER BY property_id" ) .arg( id1 ); update.exec( command ); last_id = -1; @@ -2512,19 +2512,19 @@ void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) int current_id = update.value( 0 ).toInt(); if ( last_id == current_id ) { int count = -1; - command = QString( "SELECT COUNT(1) FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2" ) + command = TQString( "SELECT COUNT(1) FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2" ) .arg( id1 ) .arg( last_id ); - QSqlQuery remove( command, database); + TQSqlQuery remove( command, database); if ( remove.isActive() && remove.first() ) count = remove.value(0).toInt(); if ( count > 1 ) { - command = QString( "DELETE FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2" ) + command = TQString( "DELETE FROM ingredient_info WHERE ingredient_id=%1 AND property_id=%2" ) .arg( id1 ) .arg( last_id ); database->exec( command ); - command = QString( "INSERT INTO ingredient_info VALUES(%1,%2)" ) + command = TQString( "INSERT INTO ingredient_info VALUES(%1,%2)" ) .arg( id1 ) .arg( last_id ); database->exec( command ); @@ -2536,72 +2536,72 @@ void QSqlRecipeDB::mergeIngredients( int id1, int id2 ) } //remove ingredient with id 'id2' - command = QString( "DELETE FROM ingredients WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM ingredients WHERE id=%1" ).arg( id2 ); update.exec( command ); emit ingredientRemoved( id2 ); } -void QSqlRecipeDB::mergePrepMethods( int id1, int id2 ) +void TQSqlRecipeDB::mergePrepMethods( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' in ingredient list - QString command = QString( "UPDATE prep_method_list SET prep_method_id=%1 WHERE prep_method_id=%2" ) + TQString command = TQString( "UPDATE prep_method_list SET prep_method_id=%1 WHERE prep_method_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //change all instances of 'id2' to 'id1' in ingredient weights - command = QString( "UPDATE ingredient_weights SET prep_method_id=%1 WHERE prep_method_id=%2" ) + command = TQString( "UPDATE ingredient_weights SET prep_method_id=%1 WHERE prep_method_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //remove prep method with id 'id2' - command = QString( "DELETE FROM prep_methods WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM prep_methods WHERE id=%1" ).arg( id2 ); update.exec( command ); emit prepMethodRemoved( id2 ); } -void QSqlRecipeDB::mergeProperties( int id1, int id2 ) +void TQSqlRecipeDB::mergeProperties( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' - QString command = QString( "UPDATE ingredient_properties SET id=%1 WHERE id=%2" ) + TQString command = TQString( "UPDATE ingredient_properties SET id=%1 WHERE id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); - command = QString( "UPDATE ingredient_info SET property_id=%1 WHERE property_id=%2" ) + command = TQString( "UPDATE ingredient_info SET property_id=%1 WHERE property_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //remove prep method with id 'id2' - command = QString( "DELETE FROM ingredient_properties WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM ingredient_properties WHERE id=%1" ).arg( id2 ); update.exec( command ); emit propertyRemoved( id2 ); } -void QSqlRecipeDB::mergeUnits( int id1, int id2 ) +void TQSqlRecipeDB::mergeUnits( int id1, int id2 ) { - QSqlQuery update( QString::null, database ); + TQSqlQuery update( TQString::null, database ); //change all instances of 'id2' to 'id1' in unit list - QString command = QString( "UPDATE unit_list SET unit_id=%1 WHERE unit_id=%2" ) + TQString command = TQString( "UPDATE unit_list SET unit_id=%1 WHERE unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //change all instances of 'id2' to 'id1' in ingredient list - command = QString( "UPDATE ingredient_list SET unit_id=%1 WHERE unit_id=%2" ) + command = TQString( "UPDATE ingredient_list SET unit_id=%1 WHERE unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure no duplicates were created in this process - command = QString( "SELECT ingredient_id FROM unit_list WHERE unit_id=%1 ORDER BY ingredient_id" ) + command = TQString( "SELECT ingredient_id FROM unit_list WHERE unit_id=%1 ORDER BY ingredient_id" ) .arg( id1 ); update.exec( command ); int last_id = -1; @@ -2610,19 +2610,19 @@ void QSqlRecipeDB::mergeUnits( int id1, int id2 ) int current_id = update.value( 0 ).toInt(); if ( last_id == current_id ) { int count = -1; - command = QString( "SELECT COUNT(1) FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) + command = TQString( "SELECT COUNT(1) FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) .arg( id1 ) .arg( last_id ); - QSqlQuery remove( command, database); + TQSqlQuery remove( command, database); if ( remove.isActive() && remove.first() ) count = remove.value(0).toInt(); if ( count > 1 ) { - command = QString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) + command = TQString( "DELETE FROM unit_list WHERE ingredient_id=%1 AND unit_id=%2" ) .arg( id1 ) .arg( last_id ); database->exec( command ); - command = QString( "INSERT INTO unit_list VALUES(%1,%2)" ) + command = TQString( "INSERT INTO unit_list VALUES(%1,%2)" ) .arg( id1 ) .arg( last_id ); database->exec( command ); @@ -2633,107 +2633,107 @@ void QSqlRecipeDB::mergeUnits( int id1, int id2 ) } //update ingredient info - command = QString( "UPDATE ingredient_info SET per_units=%1 WHERE per_units=%2" ) + command = TQString( "UPDATE ingredient_info SET per_units=%1 WHERE per_units=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //change all instances of 'id2' to 'id1' in unit_conversion - command = QString( "UPDATE units_conversion SET unit1_id=%1 WHERE unit1_id=%2" ) + command = TQString( "UPDATE units_conversion SET unit1_id=%1 WHERE unit1_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); - command = QString( "UPDATE units_conversion SET unit2_id=%1 WHERE unit2_id=%2" ) + command = TQString( "UPDATE units_conversion SET unit2_id=%1 WHERE unit2_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //and ensure that the one to one ratio wasn't created - command = QString( "DELETE FROM units_conversion WHERE unit1_id=unit2_id" ); + command = TQString( "DELETE FROM units_conversion WHERE unit1_id=unit2_id" ); update.exec( command ); //update ingredient weights - command = QString( "UPDATE ingredient_weights SET unit_id=%1 WHERE unit_id=%2" ) + command = TQString( "UPDATE ingredient_weights SET unit_id=%1 WHERE unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); - command = QString( "UPDATE ingredient_weights SET weight_unit_id=%1 WHERE weight_unit_id=%2" ) + command = TQString( "UPDATE ingredient_weights SET weight_unit_id=%1 WHERE weight_unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //change all instances of 'id2' to 'id1' in ingredient weights - command = QString( "UPDATE ingredient_weights SET unit_id=%1 WHERE unit_id=%2" ) + command = TQString( "UPDATE ingredient_weights SET unit_id=%1 WHERE unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); - command = QString( "UPDATE ingredient_weights SET weight_unit_id=%1 WHERE weight_unit_id=%2" ) + command = TQString( "UPDATE ingredient_weights SET weight_unit_id=%1 WHERE weight_unit_id=%2" ) .arg( id1 ) .arg( id2 ); update.exec( command ); //remove units with id 'id2' - command = QString( "DELETE FROM units WHERE id=%1" ).arg( id2 ); + command = TQString( "DELETE FROM units WHERE id=%1" ).arg( id2 ); update.exec( command ); emit unitRemoved( id2 ); } -QString QSqlRecipeDB::getUniqueRecipeTitle( const QString &recipe_title ) +TQString TQSqlRecipeDB::getUniqueRecipeTitle( const TQString &recipe_title ) { //already is unique if ( findExistingRecipeByName( recipe_title ) == -1 ) return recipe_title; - QString return_title = recipe_title; //If any error is produced, just go for default value (always return something) + TQString return_title = recipe_title; //If any error is produced, just go for default value (always return something) - QString command = QString( "SELECT COUNT(1) FROM recipes WHERE title LIKE '%1 (%)';" ).arg( escapeAndEncode( recipe_title ) ); + TQString command = TQString( "SELECT COUNT(1) FROM recipes WHERE title LIKE '%1 (%)';" ).arg( escapeAndEncode( recipe_title ) ); - QSqlQuery alikeRecipes( command, database ); + TQSqlQuery alikeRecipes( command, database ); if ( alikeRecipes.isActive() && alikeRecipes.first() ) { int count = alikeRecipes.value( 0 ).toInt(); - return_title = QString( "%1 (%2)" ).arg( recipe_title ).arg( count + 2 ); + return_title = TQString( "%1 (%2)" ).arg( recipe_title ).arg( count + 2 ); //make sure this newly created title is unique (just in case) while ( findExistingRecipeByName( return_title ) != -1 ) { count--; //go down to find the skipped recipe(s) - return_title = QString( "%1 (%2)" ).arg( recipe_title ).arg( count + 2 ); + return_title = TQString( "%1 (%2)" ).arg( recipe_title ).arg( count + 2 ); } } return return_title; } -QString QSqlRecipeDB::recipeTitle( int recipeID ) +TQString TQSqlRecipeDB::recipeTitle( int recipeID ) { - QString command = QString( "SELECT title FROM recipes WHERE id=%1;" ).arg( recipeID ); - QSqlQuery recipeToLoad( command, database ); + TQString command = TQString( "SELECT title FROM recipes WHERE id=%1;" ).arg( recipeID ); + TQSqlQuery recipeToLoad( command, database ); if ( recipeToLoad.isActive() && recipeToLoad.next() ) // Go to the first record (there should be only one anyway. return ( unescapeAndDecode(recipeToLoad.value( 0 ).toCString()) ); - return ( QString::null ); + return ( TQString::null ); } -void QSqlRecipeDB::emptyData( void ) +void TQSqlRecipeDB::emptyData( void ) { - QStringList tables; + TQStringList tables; tables << "ingredient_info" << "ingredient_list" << "ingredient_properties" << "ingredients" << "recipes" << "unit_list" << "units" << "units_conversion" << "categories" << "category_list" << "authors" << "author_list" << "prep_methods" << "ingredient_groups" << "yield_types" << "ratings" << "rating_criteria" << "rating_criterion_list"; - QSqlQuery tablesToEmpty( QString::null, database ); - for ( QStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) { - QString command = QString( "DELETE FROM %1;" ).arg( *it ); + TQSqlQuery tablesToEmpty( TQString::null, database ); + for ( TQStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) { + TQString command = TQString( "DELETE FROM %1;" ).arg( *it ); tablesToEmpty.exec( command ); } } -void QSqlRecipeDB::empty( void ) +void TQSqlRecipeDB::empty( void ) { - QSqlQuery tablesToEmpty( QString::null, database ); + TQSqlQuery tablesToEmpty( TQString::null, database ); - QStringList list = database->tables(); - QStringList::const_iterator it = list.begin(); + TQStringList list = database->tables(); + TQStringList::const_iterator it = list.begin(); while( it != list.end() ) { - QString command = QString( "DROP TABLE %1;" ).arg( *it ); + TQString command = TQString( "DROP TABLE %1;" ).arg( *it ); tablesToEmpty.exec( command ); if ( !tablesToEmpty.isActive() ) @@ -2743,25 +2743,25 @@ void QSqlRecipeDB::empty( void ) } } -QString QSqlRecipeDB::getNextInsertIDStr( const QString &table, const QString &column ) +TQString TQSqlRecipeDB::getNextInsertIDStr( const TQString &table, const TQString &column ) { int next_id = getNextInsertID( table, column ); - QString id_str; + TQString id_str; if ( next_id == -1 ) id_str = "NULL"; else - id_str = QString::number( next_id ); + id_str = TQString::number( next_id ); return id_str; } -void QSqlRecipeDB::search( RecipeList *list, int items, const RecipeSearchParameters ¶meters ) +void TQSqlRecipeDB::search( RecipeList *list, int items, const RecipeSearchParameters ¶meters ) { - QString query = buildSearchQuery(parameters); + TQString query = buildSearchQuery(parameters); - QValueList ids; - QSqlQuery recipeToLoad( query, database ); + TQValueList ids; + TQSqlQuery recipeToLoad( query, database ); if ( recipeToLoad.isActive() ) { while ( recipeToLoad.next() ) { ids << recipeToLoad.value( 0 ).toInt(); diff --git a/krecipes/src/backends/qsqlrecipedb.h b/krecipes/src/backends/qsqlrecipedb.h index 68ba6cc..ca707dd 100644 --- a/krecipes/src/backends/qsqlrecipedb.h +++ b/krecipes/src/backends/qsqlrecipedb.h @@ -13,18 +13,18 @@ ***************************************************************************/ -#ifndef QSQLRECIPEDB_H -#define QSQLRECIPEDB_H +#ifndef TQSQLRECIPEDB_H +#define TQSQLRECIPEDB_H #include "backends/recipedb.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include "datablocks/recipe.h" #include "datablocks/elementlist.h" @@ -34,19 +34,19 @@ /** @author Unai Garro, Jason Kivlighn */ -class QSqlRecipeDB : public RecipeDB +class TQSqlRecipeDB : public RecipeDB { Q_OBJECT protected: - virtual QString qsqlDriverPlugin() const { return QString::null; } - virtual QSqlDriver *qsqlDriver() const { return 0; } + virtual TQString qsqlDriverPlugin() const { return TQString::null; } + virtual TQSqlDriver *qsqlDriver() const { return 0; } virtual void createDB( void ) = 0; virtual void portOldDatabases( float version ); - virtual void storePhoto( int recipeID, const QByteArray &data ); - virtual void loadPhoto( int recipeID, QPixmap &photo ); + virtual void storePhoto( int recipeID, const TQByteArray &data ); + virtual void loadPhoto( int recipeID, TQPixmap &photo ); void loadRecipeMetadata( Recipe *recipe ); void search( RecipeList *list, int items, const RecipeSearchParameters & ); @@ -58,54 +58,54 @@ protected: * Note: Only call when an insert is actually going to take place. * This function will increment the sequence counter. */ - virtual int getNextInsertID( const QString & /*table*/, const QString & /*column*/ ) + virtual int getNextInsertID( const TQString & /*table*/, const TQString & /*column*/ ) { return -1; } - QSqlDatabase *database; - QSqlQuery m_query; - QString DBuser; - QString DBpass; - QString DBhost; + TQSqlDatabase *database; + TQSqlQuery m_query; + TQString DBuser; + TQString DBpass; + TQString DBhost; int DBport; public: - QSqlRecipeDB( const QString &host, const QString &user = QString::null, const QString &pass = QString::null, const QString &DBName = DEFAULT_DB_NAME, int port = 0 ); - ~QSqlRecipeDB( void ); + TQSqlRecipeDB( const TQString &host, const TQString &user = TQString::null, const TQString &pass = TQString::null, const TQString &DBName = DEFAULT_DB_NAME, int port = 0 ); + ~TQSqlRecipeDB( void ); void connect( bool create_db, bool create_tables ); void addIngredientWeight( const Weight & ); - void addProperty( const QString &name, const QString &units ); + void addProperty( const TQString &name, const TQString &units ); void addPropertyToIngredient( int ingredientID, int propertyID, double amount, int perUnitsID ); void addUnitToIngredient( int ingredientID, int unitID ); void categorizeRecipe( int recipeID, const ElementList &categoryList ); void changePropertyAmountToIngredient( int ingredientID, int propertyID, double amount, int per_units ); - void createNewAuthor( const QString &authorName ); - void createNewCategory( const QString &categoryName, int parent_id = -1 ); - void createNewIngGroup( const QString &name ); - void createNewIngredient( const QString &ingredientName ); - void createNewPrepMethod( const QString &prepMethodName ); - void createNewRating( const QString &name ); + void createNewAuthor( const TQString &authorName ); + void createNewCategory( const TQString &categoryName, int parent_id = -1 ); + void createNewIngGroup( const TQString &name ); + void createNewIngredient( const TQString &ingredientName ); + void createNewPrepMethod( const TQString &prepMethodName ); + void createNewRating( const TQString &name ); void createNewUnit( const Unit &unit ); - void createNewYieldType( const QString &type ); + void createNewYieldType( const TQString &type ); void emptyData( void ); void empty( void ); - int findExistingAuthorByName( const QString& name ); - int findExistingCategoryByName( const QString& name ); - int findExistingIngredientGroupByName( const QString& name ); - int findExistingIngredientByName( const QString& name ); - int findExistingPrepByName( const QString& name ); - int findExistingRecipeByName( const QString& name ); - int findExistingRatingByName( const QString& name ); - int findExistingUnitByName( const QString& name ); - int findExistingPropertyByName( const QString& name ); - int findExistingYieldTypeByName( const QString& name ); + int findExistingAuthorByName( const TQString& name ); + int findExistingCategoryByName( const TQString& name ); + int findExistingIngredientGroupByName( const TQString& name ); + int findExistingIngredientByName( const TQString& name ); + int findExistingPrepByName( const TQString& name ); + int findExistingRecipeByName( const TQString& name ); + int findExistingRatingByName( const TQString& name ); + int findExistingUnitByName( const TQString& name ); + int findExistingPropertyByName( const TQString& name ); + int findExistingYieldTypeByName( const TQString& name ); void findIngredientUnitDependancies( int ingredientID, int unitID, ElementList *recipes, ElementList *ingredientInfo ); void findIngredientDependancies( int ingredientID, ElementList *recipes ); void findPrepMethodDependancies( int prepMethodID, ElementList *recipes ); @@ -114,7 +114,7 @@ public: void findUseOfCategoryInRecipes( ElementList *results, int catID ); void findUseOfAuthorInRecipes( ElementList *results, int authorID ); - QString getUniqueRecipeTitle( const QString &recipe_title ); + TQString getUniqueRecipeTitle( const TQString &recipe_title ); bool ingredientContainsProperty( int ingredientID, int propertyID, int perUnitsID ); bool ingredientContainsUnit( int ingredientID, int unitID ); @@ -128,7 +128,7 @@ public: void loadPrepMethods( ElementList *list, int limit = -1, int offset = 0 ); void loadProperties( IngredientPropertyList *list, int ingredientID = -2 ); // Loads the list of possible properties by default, all the ingredient properties with -1, and the ingredients of given property if id>=0 void loadRatingCriterion( ElementList *list, int limit = -1, int offset = 0 ); - void loadRecipes( RecipeList *, int items = All, QValueList ids = QValueList() ); + void loadRecipes( RecipeList *, int items = All, TQValueList ids = TQValueList() ); void loadRecipeList( ElementList *list, int categoryID = -1, bool recursive = false ); void loadUncategorizedRecipes( ElementList *list ); void loadUnits( UnitList *list, Unit::Type = Unit::All, int limit = -1, int offset = 0 ); @@ -143,11 +143,11 @@ public: void mergePrepMethods( int id1, int id2 ); void mergeProperties( int id1, int id2 ); - void modIngredientGroup( int ingredientID, const QString &newLabel ); + void modIngredientGroup( int ingredientID, const TQString &newLabel ); /** * set newLabel for ingredientID */ - void modIngredient( int ingredientID, const QString &newLabel ); + void modIngredient( int ingredientID, const TQString &newLabel ); /** * set newLabel for unitID */ @@ -155,18 +155,18 @@ public: /** * set newLabel for categoryID */ - void modCategory( int categoryID, const QString &newLabel ); + void modCategory( int categoryID, const TQString &newLabel ); void modCategory( int categoryID, int new_parent_id ); /** * set newLabel for authorID */ - void modAuthor( int authorID, const QString &newLabel ); + void modAuthor( int authorID, const TQString &newLabel ); - void modPrepMethod( int prepMethodID, const QString &newLabel ); + void modPrepMethod( int prepMethodID, const TQString &newLabel ); - void modProperty( int propertyID, const QString &newLabel ); + void modProperty( int propertyID, const TQString &newLabel ); - QString recipeTitle( int recipeID ); + TQString recipeTitle( int recipeID ); void removeAuthor( int categoryID ); void removeCategory( int categoryID ); @@ -189,35 +189,35 @@ public: double ingredientWeight( const Ingredient &ing, bool *wasApproximated = 0 ); WeightList ingredientWeightUnits( int ingID ); - QString escapeAndEncode( const QString &s ) const; - QString unescapeAndDecode( const QCString &s ) const; + TQString escapeAndEncode( const TQString &s ) const; + TQString unescapeAndDecode( const TQCString &s ) const; - QString categoryName( int ID ); - QString prepMethodName( int ID ); - QString ingredientName( int ID ); + TQString categoryName( int ID ); + TQString prepMethodName( int ID ); + TQString ingredientName( int ID ); IngredientProperty propertyName( int ID ); Unit unitName( int ID ); - int getCount( const QString &table_name ); + int getCount( const TQString &table_name ); int categoryTopLevelCount(); bool checkIntegrity( void ); - void splitCommands( QString& s, QStringList& sl ); + void splitCommands( TQString& s, TQStringList& sl ); float databaseVersion( void ); protected: - void execSQL( const QString &command ); + void execSQL( const TQString &command ); private: - void loadElementList( ElementList *elList, QSqlQuery *query ); - void loadPropertyElementList( ElementList *elList, QSqlQuery *query ); - QString getNextInsertIDStr( const QString &table, const QString &column ); + void loadElementList( ElementList *elList, TQSqlQuery *query ); + void loadPropertyElementList( ElementList *elList, TQSqlQuery *query ); + TQString getNextInsertIDStr( const TQString &table, const TQString &column ); - QString DBname; - const QString connectionName; - QString m_command; + TQString DBname; + const TQString connectionName; + TQString m_command; static int m_refCount; }; diff --git a/krecipes/src/backends/recipedb.cpp b/krecipes/src/backends/recipedb.cpp index 9df42df..1f6be92 100644 --- a/krecipes/src/backends/recipedb.cpp +++ b/krecipes/src/backends/recipedb.cpp @@ -30,9 +30,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include @@ -65,14 +65,14 @@ struct ingredient_nutrient_data { int usda_id; - QString name; - QValueList data; + TQString name; + TQValueList data; WeightList weights; }; RecipeDB::RecipeDB() : DCOPObject(), - QObject(), m_categoryCache(0), haltOperation(false) + TQObject(), m_categoryCache(0), haltOperation(false) { dbOK = false; dbErr = ""; @@ -87,33 +87,33 @@ double RecipeDB::latestDBVersion() const return 0.95; } -QString RecipeDB::krecipes_version() const +TQString RecipeDB::krecipes_version() const { KInstance * this_instance = KGlobal::instance(); if ( this_instance && this_instance->aboutData() ) return this_instance->aboutData() ->version(); - return QString::null; //Oh, well. We couldn't get the version (shouldn't happen). + return TQString::null; //Oh, well. We couldn't get the version (shouldn't happen). } -RecipeDB* RecipeDB::createDatabase( const QString &dbType, const QString &file ) +RecipeDB* RecipeDB::createDatabase( const TQString &dbType, const TQString &file ) { KConfig * config = kapp->config(); config->setGroup( "Server" ); - QString host = config->readEntry( "Host", "localhost" ); - QString user = config->readEntry( "Username", QString::null ); - QString pass = config->readEntry( "Password", QString::null ); - QString dbname = config->readEntry( "DBName", DEFAULT_DB_NAME ); + TQString host = config->readEntry( "Host", "localhost" ); + TQString user = config->readEntry( "Username", TQString::null ); + TQString pass = config->readEntry( "Password", TQString::null ); + TQString dbname = config->readEntry( "DBName", DEFAULT_DB_NAME ); int port = config->readNumEntry( "Port", 0 ); - QString f = file; + TQString f = file; if ( f.isEmpty() ) f = config->readEntry( "DBFile", locateLocal ( "appdata", DB_FILENAME ) ); return createDatabase( dbType, host, user, pass, dbname, port, f ); } -RecipeDB* RecipeDB::createDatabase( const QString &dbType, const QString &host, const QString &user, const QString &pass, const QString &dbname, int port, const QString &file ) +RecipeDB* RecipeDB::createDatabase( const TQString &dbType, const TQString &host, const TQString &user, const TQString &pass, const TQString &dbname, int port, const TQString &file ) { RecipeDB * database = 0; @@ -244,14 +244,14 @@ RecipeDB::ConversionStatus RecipeDB::convertIngredientUnits( const Ingredient &f return Success; } else { - QString to_str; + TQString to_str; switch ( to.type ) { case Unit::Other: to_str = "Other"; break; case Unit::Mass: to_str = "Mass"; break; case Unit::Volume: to_str = "Volume"; break; case Unit::All: kdDebug()<<"Code error: trying to convert to unit of type 'All'"<setUseShell(true); - QIODevice *dumpFile = KFilterDev::deviceForFile(backup_file,"application/x-gzip"); + TQIODevice *dumpFile = KFilterDev::deviceForFile(backup_file,"application/x-gzip"); if ( !dumpFile->open( IO_WriteOnly ) ) { kdDebug()<<"Couldn't open "<" << backup_file*/; - QApplication::connect( p, SIGNAL(receivedStdout(KProcess*,char*,int)), this, SLOT(processDumpOutput(KProcess*,char*,int)) ); - QApplication::connect( p, SIGNAL(receivedStderr(KProcess*,char*,int)), this, SLOT(processDumpOutput(KProcess*,char*,int)) ); + TQApplication::connect( p, SIGNAL(receivedStdout(KProcess*,char*,int)), this, SLOT(processDumpOutput(KProcess*,char*,int)) ); + TQApplication::connect( p, SIGNAL(receivedStderr(KProcess*,char*,int)), this, SLOT(processDumpOutput(KProcess*,char*,int)) ); - emit progressBegin(0,QString::null, - QString("
%1
%2") + emit progressBegin(0,TQString::null, + TQString("
%1
%2") .arg(i18n("Creating complete backup")) .arg(i18n("Depending on the number of recipes and amount of data, this could take some time.")),50); bool success = p->start( KProcess::Block, KProcess::AllOutput ); if ( !success ) { - if ( errMsg ) *errMsg = QString(i18n("Unable to find or run the program '%1'. Either it is not installed on your system or it is not in $PATH.")).arg(command.first()); + if ( errMsg ) *errMsg = TQString(i18n("Unable to find or run the program '%1'. Either it is not installed on your system or it is not in $PATH.")).arg(command.first()); delete p; delete dumpStream; delete dumpFile; - QFile::remove(backup_file); + TQFile::remove(backup_file); emit progressDone(); return false; } @@ -320,15 +320,15 @@ bool RecipeDB::backup( const QString &backup_file, QString *errMsg ) //but delete the file we created if ( !p->normalExit() ) { kdDebug()<<"Process killed, deleting partial backup."<exitStatus() != 0 ) { //Since the process failed, dumpStream should have output from the app as to why it did - QString appOutput; + TQString appOutput; dumpFile->close(); if ( dumpFile->open( IO_ReadOnly ) ) { - QTextStream appErrStream( dumpFile ); + TQTextStream appErrStream( dumpFile ); //ignore our own versioning output appErrStream.readLine(); @@ -340,8 +340,8 @@ bool RecipeDB::backup( const QString &backup_file, QString *errMsg ) else kdDebug()<<"Unable to open file to get error output."<findResource( "appdata", "data/data.sql" ) ); + TQFile datafile( KGlobal::dirs() ->findResource( "appdata", "data/data.sql" ) ); if ( datafile.open( IO_ReadOnly ) ) { - QTextStream stream( &datafile ); + TQTextStream stream( &datafile ); execSQL(stream); datafile.close(); } } -bool RecipeDB::restore( const QString &file, QString *errMsg ) +bool RecipeDB::restore( const TQString &file, TQString *errMsg ) { - QIODevice *dumpFile = KFilterDev::deviceForFile(file,"application/x-gzip"); + TQIODevice *dumpFile = KFilterDev::deviceForFile(file,"application/x-gzip"); if ( dumpFile->open( IO_ReadOnly ) ) { - QTextStream stream( dumpFile ); - QString firstLine = stream.readLine().stripWhiteSpace(); - QString dbVersion = stream.readLine().stripWhiteSpace(); + TQTextStream stream( dumpFile ); + TQString firstLine = stream.readLine().stripWhiteSpace(); + TQString dbVersion = stream.readLine().stripWhiteSpace(); dbVersion = dbVersion.right( dbVersion.length() - dbVersion.find(":") - 2 ); - if ( qRound(dbVersion.toDouble()*1e5) > qRound(latestDBVersion()*1e5) ) { //correct for float's imprecision + if ( tqRound(dbVersion.toDouble()*1e5) > tqRound(latestDBVersion()*1e5) ) { //correct for float's imprecision if ( errMsg ) *errMsg = i18n( "This backup was created with a newer version of Krecipes and cannot be restored." ); delete dumpFile; return false; @@ -394,15 +394,15 @@ bool RecipeDB::restore( const QString &file, QString *errMsg ) KConfig * config = kapp->config(); config->setGroup( "DBType" ); - QString dbType = stream.readLine().stripWhiteSpace(); + TQString dbType = stream.readLine().stripWhiteSpace(); dbType = dbType.right( dbType.length() - dbType.find(":") - 2 ); if ( dbType.isEmpty() || !firstLine.startsWith("-- Generated for Krecipes") ) { if ( errMsg ) *errMsg = i18n("This file is not a Krecipes backup file or has become corrupt."); delete dumpFile; return false; } - else if ( dbType != config->readEntry("Type",QString::null) ) { - if ( errMsg ) *errMsg = QString(i18n("This backup was created using the \"%1\" backend. It can only be restored into a database using this backend." )).arg(dbType); + else if ( dbType != config->readEntry("Type",TQString::null) ) { + if ( errMsg ) *errMsg = TQString(i18n("This backup was created using the \"%1\" backend. It can only be restored into a database using this backend." )).arg(dbType); delete dumpFile; return false; } @@ -416,19 +416,19 @@ bool RecipeDB::restore( const QString &file, QString *errMsg ) KProcIO *process = new KProcIO; - QStringList command = restoreCommand(); + TQStringList command = restoreCommand(); kdDebug()<<"Restoring backup using: "<setComm( KProcess::Stdin ); if ( process->start( KProcess::NotifyOnExit ) ) { - emit progressBegin(0,QString::null, - QString("
%1
%2") + emit progressBegin(0,TQString::null, + TQString("
%1
%2") .arg(i18n("Restoring backup")) .arg(i18n("Depending on the number of recipes and amount of data, this could take some time."))); do { - QByteArray array(4096); + TQByteArray array(4096); int len = dumpFile->readBlock(array.data(),array.size()); array.resize(len); @@ -486,17 +486,17 @@ bool RecipeDB::restore( const QString &file, QString *errMsg ) return true; } -void RecipeDB::execSQL( QTextStream &stream ) +void RecipeDB::execSQL( TQTextStream &stream ) { - QString line, command; - while ( (line = stream.readLine()) != QString::null ) { + TQString line, command; + while ( (line = stream.readLine()) != TQString::null ) { command += " "+line; if ( command.startsWith(" --") ) { - command = QString::null; + command = TQString::null; } else if ( command.endsWith(";") ) { execSQL( command ); - command = QString::null; + command = TQString::null; } } } @@ -504,7 +504,7 @@ void RecipeDB::execSQL( QTextStream &stream ) void RecipeDB::loadRecipe( Recipe *recipe, int items, int id ) { RecipeList rlist; - QValueList ids; ids << id; + TQValueList ids; ids << id; loadRecipes( &rlist, items, ids ); *recipe = *rlist.begin(); @@ -537,7 +537,7 @@ int RecipeDB::unitCount() void RecipeDB::importSamples() { - QString sample_recipes = locate( "appdata", "data/samples-" + KGlobal::locale() ->language() + ".kreml" ); + TQString sample_recipes = locate( "appdata", "data/samples-" + KGlobal::locale() ->language() + ".kreml" ); if ( sample_recipes.isEmpty() ) { //TODO: Make this a KMessageBox?? kdDebug() << "NOTICE: Samples recipes for the language \"" << KGlobal::locale() ->language() << "\" are not available. However, if you would like samples recipes for this language included in future releases of Krecipes, we invite you to submit your own. Just save your favorite recipes in the kreml format and e-mail them to jkivlighn@gmail.com." << endl; @@ -547,7 +547,7 @@ void RecipeDB::importSamples() if ( !sample_recipes.isEmpty() ) { KreImporter importer; - QStringList file; + TQStringList file; file << sample_recipes; importer.parseFiles( file ); @@ -557,24 +557,24 @@ void RecipeDB::importSamples() kdDebug() << "Unable to find samples recipe file (samples-en_US.kreml)" << endl; } -void RecipeDB::getIDList( const CategoryTree *categoryTree, QStringList &ids ) +void RecipeDB::getIDList( const CategoryTree *categoryTree, TQStringList &ids ) { for ( CategoryTree * child_it = categoryTree->firstChild(); child_it; child_it = child_it->nextSibling() ) { - ids << QString::number(child_it->category.id); + ids << TQString::number(child_it->category.id); getIDList(child_it,ids ); } } -QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const +TQString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const { - QStringList queryList, conditionList, tableList; + TQStringList queryList, conditionList, tableList; if ( p.ingsOr.count() != 0 ) { tableList << "ingredient_list il" << "ingredients i"; conditionList << "il.ingredient_id=i.id" << "il.recipe_id=r.id"; - QString condition = "("; - for ( QStringList::const_iterator it = p.ingsOr.begin(); it != p.ingsOr.end();) { + TQString condition = "("; + for ( TQStringList::const_iterator it = p.ingsOr.begin(); it != p.ingsOr.end();) { condition += "i.name LIKE '%"+escapeAndEncode(*it)+"%' "; if ( ++it != p.ingsOr.end() ) { condition += "OR "; @@ -589,8 +589,8 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const tableList << "category_list cl" << "categories c"; conditionList << "cl.category_id=c.id" << "cl.recipe_id=r.id"; - QString condition = "("; - for ( QStringList::const_iterator it = p.catsOr.begin(); it != p.catsOr.end();) { + TQString condition = "("; + for ( TQStringList::const_iterator it = p.catsOr.begin(); it != p.catsOr.end();) { condition += "c.name LIKE '%"+escapeAndEncode(*it)+"%' "; if ( ++it != p.catsOr.end() ) { condition += "OR "; @@ -605,8 +605,8 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const tableList << "author_list al" << "authors a"; conditionList << "al.author_id=a.id" << "al.recipe_id=r.id"; - QString condition = "("; - for ( QStringList::const_iterator it = p.authorsOr.begin(); it != p.authorsOr.end();) { + TQString condition = "("; + for ( TQStringList::const_iterator it = p.authorsOr.begin(); it != p.authorsOr.end();) { condition += "a.name LIKE '%"+escapeAndEncode(*it)+"%'"; if ( ++it != p.authorsOr.end() ) { condition += "OR "; @@ -618,10 +618,10 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const } if ( p.titleKeywords.count() != 0 ) { - QString op = (p.requireAllTitleWords) ? "AND " : "OR "; + TQString op = (p.requireAllTitleWords) ? "AND " : "OR "; - QString condition = "("; - for ( QStringList::const_iterator it = p.titleKeywords.begin(); it != p.titleKeywords.end();) { + TQString condition = "("; + for ( TQStringList::const_iterator it = p.titleKeywords.begin(); it != p.titleKeywords.end();) { condition += "r.title LIKE '%"+escapeAndEncode(*it)+"%' "; if ( ++it != p.titleKeywords.end() ) { condition += op; @@ -632,10 +632,10 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const } if ( p.instructionsKeywords.count() != 0 ) { - QString op = (p.requireAllInstructionsWords) ? "AND " : "OR "; + TQString op = (p.requireAllInstructionsWords) ? "AND " : "OR "; - QString condition = "("; - for ( QStringList::const_iterator it = p.instructionsKeywords.begin(); it != p.instructionsKeywords.end();) { + TQString condition = "("; + for ( TQStringList::const_iterator it = p.instructionsKeywords.begin(); it != p.instructionsKeywords.end();) { condition += "r.instructions LIKE '%"+escapeAndEncode(*it)+"%' "; if ( ++it != p.instructionsKeywords.end() ) { condition += op; @@ -646,12 +646,12 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const } if ( !p.prep_time.isNull() ) { - QString op; + TQString op; switch ( p.prep_param ) { case 0: op = "<= "+p.prep_time.toString( "'hh:mm:ss'" ); break; case 1: //TODO: have a configurable 'about'. It tests within 15 minutes for now. - QTime lower = p.prep_time; lower.addSecs( 60*15 ); - QTime upper = p.prep_time; upper.addSecs( 60*-15 ); + TQTime lower = p.prep_time; lower.addSecs( 60*15 ); + TQTime upper = p.prep_time; upper.addSecs( 60*-15 ); op = "BETWEEN "+lower.toString( "'hh:mm:ss'" )+" AND "+upper.toString( "'hh:mm:ss'" ); break; } @@ -659,87 +659,87 @@ QString RecipeDB::buildSearchQuery( const RecipeSearchParameters &p ) const } if ( p.servings > 0 ) { - QString op; + TQString op; switch ( p.servings_param ) { - case 0: op = "> "+QString::number(p.servings); break; - case 1: op = "< "+QString::number(p.servings); break; - case 2: op = "BETWEEN "+QString::number(p.servings-5)+" AND "+QString::number(p.servings+5); break; + case 0: op = "> "+TQString::number(p.servings); break; + case 1: op = "< "+TQString::number(p.servings); break; + case 2: op = "BETWEEN "+TQString::number(p.servings-5)+" AND "+TQString::number(p.servings+5); break; } conditionList << "r.yield_amount "+op; } if ( p.createdDateBegin.isValid() ) { if ( p.createdDateEnd.isValid() ) { - conditionList << "r.ctime >= '"+p.createdDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.ctime <= '"+p.createdDateEnd.toString(Qt::ISODate)+"'"; + conditionList << "r.ctime >= '"+p.createdDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.ctime <= '"+p.createdDateEnd.toString(TQt::ISODate)+"'"; } else { if ( p.createdDateBegin.time().isNull() ) { //we just want something on a particular date, not time - QDateTime end = p.createdDateBegin.addDays(1); - conditionList << "r.ctime >= '"+p.createdDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.ctime <= '"+end.toString(Qt::ISODate)+"'"; + TQDateTime end = p.createdDateBegin.addDays(1); + conditionList << "r.ctime >= '"+p.createdDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.ctime <= '"+end.toString(TQt::ISODate)+"'"; } else //use the exact time - conditionList << "r.ctime = '"+p.createdDateBegin.toString(Qt::ISODate)+"'"; + conditionList << "r.ctime = '"+p.createdDateBegin.toString(TQt::ISODate)+"'"; } } if ( p.modifiedDateBegin.isValid() ) { if ( p.modifiedDateEnd.isValid() ) { - conditionList << "r.mtime >= '"+p.modifiedDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.mtime <= '"+p.modifiedDateEnd.toString(Qt::ISODate)+"'"; + conditionList << "r.mtime >= '"+p.modifiedDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.mtime <= '"+p.modifiedDateEnd.toString(TQt::ISODate)+"'"; } else { if ( p.modifiedDateBegin.time().isNull() ) { //we just want something on a particular date, not time - QDateTime end = p.modifiedDateBegin.addDays(1); - conditionList << "r.mtime >= '"+p.modifiedDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.mtime <= '"+end.toString(Qt::ISODate)+"'"; + TQDateTime end = p.modifiedDateBegin.addDays(1); + conditionList << "r.mtime >= '"+p.modifiedDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.mtime <= '"+end.toString(TQt::ISODate)+"'"; } else //use the exact time - conditionList << "r.mtime = '"+p.modifiedDateBegin.toString(Qt::ISODate)+"'"; + conditionList << "r.mtime = '"+p.modifiedDateBegin.toString(TQt::ISODate)+"'"; } } if ( p.accessedDateBegin.isValid() ) { if ( p.accessedDateEnd.isValid() ) { - conditionList << "r.atime >= '"+p.accessedDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.atime <= '"+p.accessedDateEnd.toString(Qt::ISODate)+"'"; + conditionList << "r.atime >= '"+p.accessedDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.atime <= '"+p.accessedDateEnd.toString(TQt::ISODate)+"'"; } else { if ( p.accessedDateBegin.time().isNull() ) { //we just want something on a particular date, not time - QDateTime end = p.accessedDateBegin.addDays(1); - conditionList << "r.atime >= '"+p.accessedDateBegin.toString(Qt::ISODate)+"'"; - conditionList << "r.atime <= '"+end.toString(Qt::ISODate)+"'"; + TQDateTime end = p.accessedDateBegin.addDays(1); + conditionList << "r.atime >= '"+p.accessedDateBegin.toString(TQt::ISODate)+"'"; + conditionList << "r.atime <= '"+end.toString(TQt::ISODate)+"'"; } else //use the exact time - conditionList << "r.atime = '"+p.accessedDateBegin.toString(Qt::ISODate)+"'"; + conditionList << "r.atime = '"+p.accessedDateBegin.toString(TQt::ISODate)+"'"; } } - QString wholeQuery = "SELECT r.id FROM recipes r" - +QString(tableList.count()!=0?","+tableList.join(","):"") - +QString(conditionList.count()!=0?" WHERE "+conditionList.join(" AND "):""); + TQString wholeQuery = "SELECT r.id FROM recipes r" + +TQString(tableList.count()!=0?","+tableList.join(","):"") + +TQString(conditionList.count()!=0?" WHERE "+conditionList.join(" AND "):""); kdDebug()<<"calling: "< * ); -int createUnit( const QString &name, Unit::Type, RecipeDB* ); -int createIngredient( const QString &name, int unit_g_id, int unit_mg_id, RecipeDB*, bool do_checks ); +void getIngredientNameAndID( std::multimap * ); +int createUnit( const TQString &name, Unit::Type, RecipeDB* ); +int createIngredient( const TQString &name, int unit_g_id, int unit_mg_id, RecipeDB*, bool do_checks ); void create_properties( RecipeDB* ); void RecipeDB::importUSDADatabase() { //check if the data file even exists before we do anything - 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 ; @@ -747,19 +747,19 @@ void RecipeDB::importUSDADatabase() create_properties( this ); - std::multimap *ings_and_ids = new std::multimap; + std::multimap *ings_and_ids = new std::multimap; getIngredientNameAndID( ings_and_ids ); - QTextStream stream( &file ); - QValueList *data = new QValueList; + TQTextStream stream( &file ); + TQValueList *data = new TQValueList; kdDebug() << "Parsing abbrev.txt" << endl; while ( !stream.atEnd() ) { - QStringList fields = QStringList::split( "^", stream.readLine(), true ); + TQStringList fields = TQStringList::split( "^", stream.readLine(), true ); int id = fields[ 0 ].mid( 1, fields[ 0 ].length() - 2 ).toInt(); - std::multimap::iterator current_pair; + std::multimap::iterator current_pair; while ( ( current_pair = ings_and_ids->find( id ) ) != ings_and_ids->end() ) //there may be more than one ingredients with the same id { ingredient_nutrient_data current_ing; @@ -771,12 +771,12 @@ void RecipeDB::importUSDADatabase() Weight w; w.weight = fields[ TOTAL_USDA_PROPERTIES + 2 ].toDouble(); - QString amountAndWeight = fields[ TOTAL_USDA_PROPERTIES + 3 ].mid( 1, fields[ TOTAL_USDA_PROPERTIES + 3 ].length() - 2 ); + TQString amountAndWeight = fields[ TOTAL_USDA_PROPERTIES + 3 ].mid( 1, fields[ TOTAL_USDA_PROPERTIES + 3 ].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 ) ) current_ing.weights << w; @@ -788,7 +788,7 @@ void RecipeDB::importUSDADatabase() 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 ) ) current_ing.weights << w; @@ -823,8 +823,8 @@ void RecipeDB::importUSDADatabase() int unit_g_id = createUnit( "g", Unit::Mass, this ); int unit_mg_id = createUnit( "mg", Unit::Mass, this ); - QValueList::const_iterator it; - QValueList::const_iterator data_end = data->end(); + TQValueList::const_iterator it; + TQValueList::const_iterator data_end = data->end(); const int total = data->count(); int counter = 0; @@ -843,8 +843,8 @@ void RecipeDB::importUSDADatabase() if ( do_checks ) loadProperties( &ing_properties, assigned_id ); if ( ing_properties.count() == 0 ) //ingredient doesn't already have any properties { - QValueList::const_iterator property_it; - QValueList::const_iterator property_end = ( *it ).data.end(); + TQValueList::const_iterator property_it; + TQValueList::const_iterator property_end = ( *it ).data.end(); int i = 0; for ( property_it = ( *it ).data.begin(); property_it != property_end; ++property_it, ++i ) addPropertyToIngredient( assigned_id, property_data_list[ i ].id, ( *property_it ) / 100.0, unit_g_id ); @@ -889,13 +889,13 @@ void RecipeDB::importUSDADatabase() emit progressDone(); } -void getIngredientNameAndID( std::multimap *data ) +void getIngredientNameAndID( std::multimap *data ) { for ( int i = 0; !ingredient_data_list[ i ].name.isEmpty(); i++ ) data->insert( std::make_pair( ingredient_data_list[ i ].usda_id, ingredient_data_list[ i ].name ) ); } -int createIngredient( const QString &name, int unit_g_id, int unit_mg_id, RecipeDB *database, bool do_checks ) +int createIngredient( const TQString &name, int unit_g_id, int unit_mg_id, RecipeDB *database, bool do_checks ) { bool ingredientExisted = true; int assigned_id = -1; @@ -917,7 +917,7 @@ int createIngredient( const QString &name, int unit_g_id, int unit_mg_id, Recipe return assigned_id; } -int createUnit( const QString &name, Unit::Type type, RecipeDB *database ) +int createUnit( const TQString &name, Unit::Type type, RecipeDB *database ) { int assigned_id = database->findExistingUnitByName( name ); @@ -955,11 +955,11 @@ void create_properties( RecipeDB *database ) } } -bool parseUSDAUnitAndPrep( const QString &string, QString &unit, QString &prep ) +bool parseUSDAUnitAndPrep( const TQString &string, TQString &unit, TQString &prep ) { int commaIndex = string.find(","); - QString unitPart = string.left(commaIndex); - QString prepPart = string.right(string.length()-commaIndex-2).stripWhiteSpace(); + TQString unitPart = string.left(commaIndex); + TQString prepPart = string.right(string.length()-commaIndex-2).stripWhiteSpace(); bool acceptable = false; for ( int i = 0; unit_data_list[ i ].name; ++i ) { @@ -979,7 +979,7 @@ bool parseUSDAUnitAndPrep( const QString &string, QString &unit, QString &prep ) } } if ( !acceptable ) - prepPart = QString::null; + prepPart = TQString::null; unit = unitPart; prep = prepPart; diff --git a/krecipes/src/backends/recipedb.h b/krecipes/src/backends/recipedb.h index 3901b56..c098424 100644 --- a/krecipes/src/backends/recipedb.h +++ b/krecipes/src/backends/recipedb.h @@ -14,9 +14,9 @@ #ifndef RECIPEDB_H #define RECIPEDB_H -#include -#include -#include +#include +#include +#include #include @@ -36,7 +36,7 @@ */ class KProcess; -class QTextStream; +class TQTextStream; class CategoryTree; class RecipeSearchParameters; @@ -45,12 +45,12 @@ class WeightList; typedef struct { - QValueList recipeIdList; + TQValueList recipeIdList; IngredientList ilist; } RecipeIngredientList; -class RecipeDB: public QObject, virtual public KrecipesDBIface +class RecipeDB: public TQObject, virtual public KrecipesDBIface { Q_OBJECT @@ -62,13 +62,13 @@ public: void importSamples(); - bool backup( const QString &file ){ return backup(file,0); } - bool backup( const QString &file, QString *errMsg = 0 ); - bool restore( const QString &file, QString *errMsg = 0 ); + bool backup( const TQString &file ){ return backup(file,0); } + bool backup( const TQString &file, TQString *errMsg = 0 ); + bool restore( const TQString &file, TQString *errMsg = 0 ); // Error handling (passive) bool dbOK; - QString dbErr; + TQString dbErr; enum RecipeItems { None = 0, @@ -103,7 +103,7 @@ public slots: void cancelOperation(){ haltOperation = true; } signals: - void progressBegin(int,const QString &c=QString::null,const QString &t=QString::null,int rate=1); + void progressBegin(int,const TQString &c=TQString::null,const TQString &t=TQString::null,int rate=1); void progressDone(); void progress(); @@ -144,47 +144,47 @@ public: * This function should be called to create a new database, rather * than directly calling the constructor of a specific backend. */ - static RecipeDB* createDatabase( const QString &dbType, - const QString &host, - const QString &user, - const QString &pass, - const QString &DBname, + static RecipeDB* createDatabase( const TQString &dbType, + const TQString &host, + const TQString &user, + const TQString &pass, + const TQString &DBname, int port, - const QString &file = QString::null ); + const TQString &file = TQString::null ); /** Convenience method. Calls the above with arguments from KConfig. */ - static RecipeDB* createDatabase( const QString &dbType, const QString &file = QString::null ); + static RecipeDB* createDatabase( const TQString &dbType, const TQString &file = TQString::null ); virtual void addIngredientWeight( const Weight & ) = 0; - virtual void addProperty( const QString &name, const QString &units ) = 0; + virtual void addProperty( const TQString &name, const TQString &units ) = 0; virtual void addPropertyToIngredient( int ingredientID, int propertyID, double amount, int perUnitsID ) = 0; virtual void addUnitToIngredient( int ingredientID, int unitID ) = 0; virtual void categorizeRecipe( int recipeID, const ElementList &categoryList ) = 0; virtual void changePropertyAmountToIngredient( int ingredientID, int propertyID, double amount, int per_units ) = 0; - virtual void createNewAuthor( const QString &authorName ) = 0; - virtual void createNewCategory( const QString &categoryName, int parent_id = -1 ) = 0; - virtual void createNewIngGroup( const QString &name ) = 0; - virtual void createNewIngredient( const QString &ingredientName ) = 0; - virtual void createNewPrepMethod( const QString &prepMethodName ) = 0; - virtual void createNewRating( const QString &name ) = 0; + virtual void createNewAuthor( const TQString &authorName ) = 0; + virtual void createNewCategory( const TQString &categoryName, int parent_id = -1 ) = 0; + virtual void createNewIngGroup( const TQString &name ) = 0; + virtual void createNewIngredient( const TQString &ingredientName ) = 0; + virtual void createNewPrepMethod( const TQString &prepMethodName ) = 0; + virtual void createNewRating( const TQString &name ) = 0; virtual void createNewUnit( const Unit &unit ) = 0; - virtual void createNewYieldType( const QString &type ) = 0; + virtual void createNewYieldType( const TQString &type ) = 0; virtual void emptyData( void ) = 0; virtual void empty( void ) = 0; - virtual int findExistingAuthorByName( const QString& name ) = 0; - virtual int findExistingCategoryByName( const QString& name ) = 0; - virtual int findExistingIngredientGroupByName( const QString& name ) = 0; - virtual int findExistingIngredientByName( const QString& name ) = 0; - virtual int findExistingPrepByName( const QString& name ) = 0; - virtual int findExistingPropertyByName( const QString& name ) = 0; - virtual int findExistingRatingByName( const QString& name ) = 0; - virtual int findExistingRecipeByName( const QString& name ) = 0; - virtual int findExistingUnitByName( const QString& name ) = 0; - virtual int findExistingYieldTypeByName( const QString& name ) = 0; + virtual int findExistingAuthorByName( const TQString& name ) = 0; + virtual int findExistingCategoryByName( const TQString& name ) = 0; + virtual int findExistingIngredientGroupByName( const TQString& name ) = 0; + virtual int findExistingIngredientByName( const TQString& name ) = 0; + virtual int findExistingPrepByName( const TQString& name ) = 0; + virtual int findExistingPropertyByName( const TQString& name ) = 0; + virtual int findExistingRatingByName( const TQString& name ) = 0; + virtual int findExistingRecipeByName( const TQString& name ) = 0; + virtual int findExistingUnitByName( const TQString& name ) = 0; + virtual int findExistingYieldTypeByName( const TQString& name ) = 0; virtual void findIngredientUnitDependancies( int ingredientID, int unitID, ElementList *recipes, ElementList *ingredientInfo ) = 0; virtual void findIngredientDependancies( int ingredientID, ElementList *recipes ) = 0; virtual void findPrepMethodDependancies( int prepMethodID, ElementList *recipes ) = 0; @@ -193,9 +193,9 @@ public: virtual void findUseOfCategoryInRecipes( ElementList *results, int catID ) = 0; virtual void findUseOfAuthorInRecipes( ElementList *results, int authorID ) = 0; - void getIDList( const CategoryTree *categoryTree, QStringList &ids ); - virtual QString getUniqueRecipeTitle( const QString &recipe_title ) = 0; - virtual void givePermissions( const QString &dbName, const QString &username, const QString &password = QString::null, const QString &clientHost = "localhost" ) = 0; + void getIDList( const CategoryTree *categoryTree, TQStringList &ids ); + virtual TQString getUniqueRecipeTitle( const TQString &recipe_title ) = 0; + virtual void givePermissions( const TQString &dbName, const TQString &username, const TQString &password = TQString::null, const TQString &clientHost = "localhost" ) = 0; void importUSDADatabase(); @@ -219,7 +219,7 @@ public: virtual void loadRatingCriterion( ElementList *list, int limit = -1, int offset = 0 ) = 0; /** Load all recipes with the ids in @param ids into the @ref RecipeList @param recipes */ - virtual void loadRecipes( RecipeList *, int items = All, QValueList ids = QValueList()/*, KProgressDialog *progress_dlg = 0*/ ) = 0; + virtual void loadRecipes( RecipeList *, int items = All, TQValueList ids = TQValueList()/*, KProgressDialog *progress_dlg = 0*/ ) = 0; virtual void loadRecipeList( ElementList *list, int categoryID = -1, bool recursive = false ) = 0; virtual void loadUncategorizedRecipes( ElementList *list ) = 0; virtual void loadUnits( UnitList *list, Unit::Type = Unit::All, int limit = -1, int offset = 0 ) = 0; @@ -246,11 +246,11 @@ public: virtual void mergeProperties( int id1, int id2 ) = 0; - virtual void modIngredientGroup( int ingredientID, const QString &newLabel ) = 0; + virtual void modIngredientGroup( int ingredientID, const TQString &newLabel ) = 0; /** * set newLabel for ingredientID */ - virtual void modIngredient( int ingredientID, const QString &newLabel ) = 0; + virtual void modIngredient( int ingredientID, const TQString &newLabel ) = 0; /** * set newLabel for unitID */ @@ -258,18 +258,18 @@ public: /** * set newLabel for categoryID */ - virtual void modCategory( int categoryID, const QString &newLabel ) = 0; + virtual void modCategory( int categoryID, const TQString &newLabel ) = 0; virtual void modCategory( int categoryID, int new_parent_id ) = 0; /** * set newLabel for authorID */ - virtual void modAuthor( int authorID, const QString &newLabel ) = 0; + virtual void modAuthor( int authorID, const TQString &newLabel ) = 0; - virtual void modPrepMethod( int prepMethodID, const QString &newLabel ) = 0; + virtual void modPrepMethod( int prepMethodID, const TQString &newLabel ) = 0; - virtual void modProperty( int propertyID, const QString &newLabel ) = 0; + virtual void modProperty( int propertyID, const TQString &newLabel ) = 0; - virtual QString recipeTitle( int recipeID ) = 0; + virtual TQString recipeTitle( int recipeID ) = 0; virtual void removeAuthor( int categoryID ) = 0; virtual void removeCategory( int categoryID ) = 0; @@ -297,17 +297,17 @@ public: virtual double ingredientWeight( const Ingredient &ing, bool *wasApproximated = 0 ) = 0; virtual WeightList ingredientWeightUnits( int ingID ) = 0; - virtual QString escapeAndEncode( const QString &s ) const = 0; - virtual QString unescapeAndDecode( const QCString &s ) const = 0; + virtual TQString escapeAndEncode( const TQString &s ) const = 0; + virtual TQString unescapeAndDecode( const TQCString &s ) const = 0; - virtual QString categoryName( int ID ) = 0; - virtual QString ingredientName( int ID ) = 0; - virtual QString prepMethodName( int ID ) = 0; + virtual TQString categoryName( int ID ) = 0; + virtual TQString ingredientName( int ID ) = 0; + virtual TQString prepMethodName( int ID ) = 0; virtual IngredientProperty propertyName( int ID ) = 0; virtual Unit unitName( int ID ) = 0; virtual int categoryTopLevelCount() = 0; - virtual int getCount( const QString &table_name ) = 0; + virtual int getCount( const TQString &table_name ) = 0; int authorCount(); int ingredientCount(); int prepMethodCount(); @@ -316,8 +316,8 @@ public: virtual bool checkIntegrity( void ) = 0; - virtual void createTable( const QString &tableName ) = 0; - virtual void splitCommands( QString& s, QStringList& sl ) = 0; + virtual void createTable( const TQString &tableName ) = 0; + virtual void splitCommands( TQString& s, TQStringList& sl ) = 0; virtual float databaseVersion( void ) = 0; @@ -362,7 +362,7 @@ public: { return ( dbOK ); } - virtual QString err() + virtual TQString err() { return ( dbErr ); } @@ -372,22 +372,22 @@ public: protected: virtual void portOldDatabases( float version ) = 0; - virtual QStringList backupCommand() const = 0; - virtual QStringList restoreCommand() const = 0; + virtual TQStringList backupCommand() const = 0; + virtual TQStringList restoreCommand() const = 0; //Use these with caution: SQL for one backend might not work on another! - void execSQL( QTextStream &stream ); - virtual void execSQL( const QString & ) = 0; + void execSQL( TQTextStream &stream ); + virtual void execSQL( const TQString & ) = 0; - QString buildSearchQuery( const RecipeSearchParameters ¶meters ) const; + TQString buildSearchQuery( const RecipeSearchParameters ¶meters ) const; double latestDBVersion() const; - QString krecipes_version() const; + TQString krecipes_version() const; CategoryTree *m_categoryCache; private: - QTextStream *dumpStream; + TQTextStream *dumpStream; bool haltOperation; private slots: diff --git a/krecipes/src/backends/searchparameters.h b/krecipes/src/backends/searchparameters.h index c3e354a..06fd972 100644 --- a/krecipes/src/backends/searchparameters.h +++ b/krecipes/src/backends/searchparameters.h @@ -11,9 +11,9 @@ #ifndef SEARCHPARAMETERS_H #define SEARCHPARAMETERS_H -#include -#include -#include +#include +#include +#include class RecipeSearchParameters { @@ -21,17 +21,17 @@ public: RecipeSearchParameters() : servings(-1)/*, averageRating(-1), averageRatingOffset(0)*/ {} - QStringList titleKeywords; + TQStringList titleKeywords; bool requireAllTitleWords; - QStringList instructionsKeywords; + TQStringList instructionsKeywords; bool requireAllInstructionsWords; - QStringList ingsOr; - QStringList catsOr; - QStringList authorsOr; + TQStringList ingsOr; + TQStringList catsOr; + TQStringList authorsOr; - QTime prep_time; + TQTime prep_time; /** 0 -> greater than given time * 1 -> less than given time @@ -47,12 +47,12 @@ public: */ int servings_param; - QDateTime createdDateBegin; - QDateTime createdDateEnd; - QDateTime modifiedDateBegin; - QDateTime modifiedDateEnd; - QDateTime accessedDateBegin; - QDateTime accessedDateEnd; + TQDateTime createdDateBegin; + TQDateTime createdDateEnd; + TQDateTime modifiedDateBegin; + TQDateTime modifiedDateEnd; + TQDateTime accessedDateBegin; + TQDateTime accessedDateEnd; //RatingCriteriaList criteriaList; //double averageRating; diff --git a/krecipes/src/backends/usda_ingredient_data.h b/krecipes/src/backends/usda_ingredient_data.h index f7ad2df..e7db7c9 100644 --- a/krecipes/src/backends/usda_ingredient_data.h +++ b/krecipes/src/backends/usda_ingredient_data.h @@ -18,7 +18,7 @@ struct ingredient_data { - QString name; + TQString name; int usda_id; }; @@ -76,7 +76,7 @@ static ingredient_data ingredient_data_list[] = { {I18N_NOOP( "canned beef" ), 13934}, {I18N_NOOP( "canned black beans" ), 16018}, {I18N_NOOP( "canned carrot slices" ), 11128}, - {I18N_NOOP( "canned cooked squid" ), 15175}, + {I18N_NOOP( "canned cooked stquid" ), 15175}, {I18N_NOOP( "canned corn" ), 11174}, {I18N_NOOP( "canned crushed tomatoes" ), 11693}, {I18N_NOOP( "canned green beans" ), 11056}, diff --git a/krecipes/src/backends/usda_property_data.h b/krecipes/src/backends/usda_property_data.h index a0ae784..63a58a7 100644 --- a/krecipes/src/backends/usda_property_data.h +++ b/krecipes/src/backends/usda_property_data.h @@ -19,7 +19,7 @@ struct property_data { int id; - QString name; + TQString name; const char *unit; }; diff --git a/krecipes/src/backends/usda_unit_data.h b/krecipes/src/backends/usda_unit_data.h index 2c3a5ef..0fc9074 100644 --- a/krecipes/src/backends/usda_unit_data.h +++ b/krecipes/src/backends/usda_unit_data.h @@ -14,7 +14,7 @@ #include -#include +#include struct unit_data { const char *name; @@ -99,6 +99,6 @@ static const char * prep_data_list[] = { 0 }; -bool parseUSDAUnitAndPrep( const QString &string, QString &unit, QString &prep ); +bool parseUSDAUnitAndPrep( const TQString &string, TQString &unit, TQString &prep ); #endif //USDA_UNIT_DATA_H diff --git a/krecipes/src/convert_sqlite3.cpp b/krecipes/src/convert_sqlite3.cpp index 19de813..1322091 100644 --- a/krecipes/src/convert_sqlite3.cpp +++ b/krecipes/src/convert_sqlite3.cpp @@ -10,8 +10,8 @@ #include "convert_sqlite3.h" -#include -#include +#include +#include #include #include @@ -21,9 +21,9 @@ //FIXME: Some messages should be given to the user about success/failure, but that can't be done in the 0.8.x branch due to i18n. -ConvertSQLite3::ConvertSQLite3( const QString &db_file ) : QObject(), error(false) +ConvertSQLite3::ConvertSQLite3( const TQString &db_file ) : TQObject(), error(false) { - QString file = db_file; + TQString file = db_file; if ( file.isEmpty() ) { KConfig *config = KGlobal::config(); config->setGroup("Server"); @@ -37,7 +37,7 @@ ConvertSQLite3::ConvertSQLite3( const QString &db_file ) : QObject(), error(fals *p << "sqlite" << file << ".dump" << "|" << "sqlite3" << file+".new"; - QApplication::connect( p, SIGNAL(readReady(KProcIO*)), this, SLOT(processOutput(KProcIO*)) ); + TQApplication::connect( p, SIGNAL(readReady(KProcIO*)), this, SLOT(processOutput(KProcIO*)) ); bool success = p->start( KProcess::Block, true ); if ( !success ) { @@ -49,10 +49,10 @@ ConvertSQLite3::ConvertSQLite3( const QString &db_file ) : QObject(), error(fals return; - QString backup_file = file+".sqlite2"; + TQString backup_file = file+".sqlite2"; int i = 1; - while ( QFile::exists(backup_file) ) { - backup_file = backup_file.left(file.length()+8)+"."+QString::number(i); + while ( TQFile::exists(backup_file) ) { + backup_file = backup_file.left(file.length()+8)+"."+TQString::number(i); ++i; } @@ -68,7 +68,7 @@ ConvertSQLite3::ConvertSQLite3( const QString &db_file ) : QObject(), error(fals } else { kdDebug()<<"Conversion successful!"<readln(buffer) != -1 ) { error_str += buffer; } @@ -91,11 +91,11 @@ void ConvertSQLite3::processOutput( KProcIO* p ) p->ackRead(); } -bool ConvertSQLite3::copyFile( const QString &oldFilePath, const QString &newFilePath ) +bool ConvertSQLite3::copyFile( const TQString &oldFilePath, const TQString &newFilePath ) { //load both files - QFile oldFile(oldFilePath); - QFile newFile(newFilePath); + TQFile oldFile(oldFilePath); + TQFile newFile(newFilePath); bool openOld = oldFile.open( IO_ReadOnly ); bool openNew = newFile.open( IO_WriteOnly ); @@ -107,7 +107,7 @@ bool ConvertSQLite3::copyFile( const QString &oldFilePath, const QString &newFil char* buffer = new char[BUFFER_SIZE]; while(!oldFile.atEnd()) { - Q_ULONG len = oldFile.readBlock( buffer, BUFFER_SIZE ); + TQ_ULONG len = oldFile.readBlock( buffer, BUFFER_SIZE ); newFile.writeBlock( buffer, len ); } diff --git a/krecipes/src/convert_sqlite3.h b/krecipes/src/convert_sqlite3.h index 8387464..acbb50b 100644 --- a/krecipes/src/convert_sqlite3.h +++ b/krecipes/src/convert_sqlite3.h @@ -11,23 +11,23 @@ #ifndef CONVERT_SQLITE3_H #define CONVERT_SQLITE3_H -#include +#include class KProcIO; -class ConvertSQLite3 : public QObject +class ConvertSQLite3 : public TQObject { Q_OBJECT public: - ConvertSQLite3( const QString &db_file = QString::null ); + ConvertSQLite3( const TQString &db_file = TQString::null ); ~ConvertSQLite3(); public slots: void processOutput( KProcIO* p ); private: - bool copyFile( const QString &oldFilePath, const QString &newFilePath ); + bool copyFile( const TQString &oldFilePath, const TQString &newFilePath ); bool error; }; diff --git a/krecipes/src/datablocks/constraintlist.h b/krecipes/src/datablocks/constraintlist.h index 4269725..46c7056 100644 --- a/krecipes/src/datablocks/constraintlist.h +++ b/krecipes/src/datablocks/constraintlist.h @@ -10,7 +10,7 @@ #ifndef CONSTRAINTLIST_H #define CONSTRAINTLIST_H -#include +#include #include "unit.h" @@ -34,14 +34,14 @@ public: ~Constraint(){} int id; - QString name; - QString units; + TQString name; + TQString units; Unit perUnit; // stores the unit ID, name, and type double max; double min; bool enabled; }; -typedef QValueList< Constraint > ConstraintList; +typedef TQValueList< Constraint > ConstraintList; #endif diff --git a/krecipes/src/datablocks/element.cpp b/krecipes/src/datablocks/element.cpp index 786fb0b..18c2b7f 100644 --- a/krecipes/src/datablocks/element.cpp +++ b/krecipes/src/datablocks/element.cpp @@ -16,7 +16,7 @@ Element::Element() : id( -1 ) {} -Element::Element( const QString &_name, int _id ) : +Element::Element( const TQString &_name, int _id ) : name( _name ), id( _id ) {} diff --git a/krecipes/src/datablocks/element.h b/krecipes/src/datablocks/element.h index 4906fcf..a940953 100644 --- a/krecipes/src/datablocks/element.h +++ b/krecipes/src/datablocks/element.h @@ -12,7 +12,7 @@ #ifndef ELEMENT_H #define ELEMENT_H -#include +#include /** @author Unai Garro */ @@ -20,11 +20,11 @@ class Element { public: Element(); - Element( const QString &name, int id = -1 ); + Element( const TQString &name, int id = -1 ); Element( const Element &el ); ~Element(); - QString name; + TQString name; int id; Element& operator=( const Element &el ); diff --git a/krecipes/src/datablocks/elementlist.cpp b/krecipes/src/datablocks/elementlist.cpp index 321e1ea..06b28bf 100644 --- a/krecipes/src/datablocks/elementlist.cpp +++ b/krecipes/src/datablocks/elementlist.cpp @@ -10,7 +10,7 @@ ***************************************************************************/ #include "datablocks/elementlist.h" -ElementList::ElementList() : QValueList () +ElementList::ElementList() : TQValueList () {} ElementList::~ElementList() @@ -21,7 +21,7 @@ Element ElementList::getElement( int index ) const return * ( at( index ) ); } -Element ElementList::findByName( const QString &name ) const +Element ElementList::findByName( const TQString &name ) const { ElementList::const_iterator it_end = end(); for ( ElementList::const_iterator it = begin(); it != it_end; ++it ) { @@ -34,7 +34,7 @@ Element ElementList::findByName( const QString &name ) const return el; } -Element ElementList::findByName( const QRegExp &rx ) const +Element ElementList::findByName( const TQRegExp &rx ) const { ElementList::const_iterator it_end = end(); for ( ElementList::const_iterator it = begin(); it != it_end; ++it ) { @@ -70,9 +70,9 @@ bool ElementList::containsSubSet( ElementList &el ) return true; } -QString ElementList::join( const QString &sep ) const +TQString ElementList::join( const TQString &sep ) const { - QString ret; + TQString ret; ElementList::const_iterator it_end = end(); ElementList::const_iterator it; @@ -86,13 +86,13 @@ QString ElementList::join( const QString &sep ) const return ret; } -ElementList ElementList::split( const QString &sep, const QString &str ) +ElementList ElementList::split( const TQString &sep, const TQString &str ) { ElementList ret; - QStringList list = QStringList::split(sep,str); + TQStringList list = TQStringList::split(sep,str); - QStringList::const_iterator it_end = list.end(); - QStringList::const_iterator it; + TQStringList::const_iterator it_end = list.end(); + TQStringList::const_iterator it; for ( it = list.begin(); it != it_end; ++it ) { ret.append( Element((*it).stripWhiteSpace()) ); diff --git a/krecipes/src/datablocks/elementlist.h b/krecipes/src/datablocks/elementlist.h index 1a4f369..85a7dd1 100644 --- a/krecipes/src/datablocks/elementlist.h +++ b/krecipes/src/datablocks/elementlist.h @@ -11,15 +11,15 @@ #ifndef ELEMENTLIST_H #define ELEMENTLIST_H -#include -#include +#include +#include #include "element.h" /** @author Unai Garro */ -class ElementList: public QValueList +class ElementList: public TQValueList { public: ElementList(); @@ -28,16 +28,16 @@ public: bool containsId( int id ) const; bool containsSubSet( ElementList &el ); - Element findByName( const QString & ) const; - Element findByName( const QRegExp & ) const; + Element findByName( const TQString & ) const; + Element findByName( const TQRegExp & ) const; Element getElement( int index ) const; - QString join( const QString &sep ) const; + TQString join( const TQString &sep ) const; - static ElementList split( const QString &sep, const QString &str ); + static ElementList split( const TQString &sep, const TQString &str ); }; -typedef QValueList IDList; +typedef TQValueList IDList; #endif diff --git a/krecipes/src/datablocks/ingredient.cpp b/krecipes/src/datablocks/ingredient.cpp index a078f84..19d66e6 100644 --- a/krecipes/src/datablocks/ingredient.cpp +++ b/krecipes/src/datablocks/ingredient.cpp @@ -12,14 +12,14 @@ #include "datablocks/ingredient.h" -#include +#include #include "mixednumber.h" IngredientData::IngredientData() : amount( 0 ), amount_offset( 0 ), groupID( -1 ) {} -IngredientData::IngredientData( const QString &_name, double _amount, const Unit &_units, int _unitID, int _ingredientID ) : +IngredientData::IngredientData( const TQString &_name, double _amount, const Unit &_units, int _unitID, int _ingredientID ) : ingredientID( _ingredientID ), name( _name ), amount( _amount ), @@ -39,29 +39,29 @@ bool IngredientData::operator==( const IngredientData &ing ) const Ingredient::Ingredient() : IngredientData() {} -Ingredient::Ingredient( const QString &_name, double _amount, const Unit &_units, int _unitID, int _ingredientID ) : +Ingredient::Ingredient( const TQString &_name, double _amount, const Unit &_units, int _unitID, int _ingredientID ) : IngredientData(_name,_amount,_units,_unitID,_ingredientID) {} Ingredient::Ingredient( const IngredientData &d ) : IngredientData(d) {} -void Ingredient::setAmount( const QString &range, bool *ok ) +void Ingredient::setAmount( const TQString &range, bool *ok ) { if ( range.isEmpty() ) { if ( ok ) *ok = true; return; } - QStringList ranges = QStringList::split('-',range); + TQStringList ranges = TQStringList::split('-',range); - QString amount_min = ranges[0]; + TQString amount_min = ranges[0]; if ( amount_min.isEmpty() ) { if ( ok ) *ok = false; return; } - QString amount_max; + TQString amount_max; switch ( ranges.count() ) { case 0: case 1: break; @@ -91,5 +91,5 @@ bool Ingredient::operator==( const Ingredient &ing ) const bool Ingredient::operator<( const Ingredient &ing ) const { - return ( QString::localeAwareCompare( name, ing.name ) < 0 ); + return ( TQString::localeAwareCompare( name, ing.name ) < 0 ); } diff --git a/krecipes/src/datablocks/ingredient.h b/krecipes/src/datablocks/ingredient.h index 8bcf28f..98ca9d4 100644 --- a/krecipes/src/datablocks/ingredient.h +++ b/krecipes/src/datablocks/ingredient.h @@ -12,8 +12,8 @@ #ifndef INGREDIENT_H #define INGREDIENT_H -#include -#include +#include +#include #include "datablocks/unit.h" #include "datablocks/elementlist.h" @@ -24,15 +24,15 @@ class IngredientData { public: IngredientData(); - IngredientData( const QString &name, double amount, const Unit &units, int unitID = -1, int ingredientID = -1 ); + IngredientData( const TQString &name, double amount, const Unit &units, int unitID = -1, int ingredientID = -1 ); int ingredientID; - QString name; + TQString name; double amount; double amount_offset; Unit units; int groupID; - QString group; + TQString group; ElementList prepMethodList; /** Compare two elements by their id */ @@ -46,12 +46,12 @@ class Ingredient : public IngredientData { public: Ingredient(); - Ingredient( const QString &name, double amount, const Unit &units, int unitID = -1, int ingredientID = -1 ); + Ingredient( const TQString &name, double amount, const Unit &units, int unitID = -1, int ingredientID = -1 ); Ingredient( const IngredientData& ); - QValueList substitutes; + TQValueList substitutes; - void setAmount( const QString &range, bool *ok = 0 ); + void setAmount( const TQString &range, bool *ok = 0 ); /** Compare two elements by their id and groupID */ bool operator==( const Ingredient & ) const; diff --git a/krecipes/src/datablocks/ingredientlist.cpp b/krecipes/src/datablocks/ingredientlist.cpp index c522a46..7156a48 100644 --- a/krecipes/src/datablocks/ingredientlist.cpp +++ b/krecipes/src/datablocks/ingredientlist.cpp @@ -14,7 +14,7 @@ #include "backends/recipedb.h" -IngredientList::IngredientList() : QValueList() +IngredientList::IngredientList() : TQValueList() {} IngredientList::~IngredientList() @@ -39,7 +39,7 @@ bool IngredientList::contains( const Ingredient &ing, bool compareAmount, Recipe } } if ( !ret ) { - for ( QValueList::const_iterator it = ing.substitutes.begin(); it != ing.substitutes.end(); ++it ) { + for ( TQValueList::const_iterator it = ing.substitutes.begin(); it != ing.substitutes.end(); ++it ) { ret = contains(*it, compareAmount, database); if ( ret ) break; } @@ -100,14 +100,14 @@ int IngredientList::find( int id ) const // Search by id (which uses search by i return findIndex( i ); } -Ingredient IngredientList::findByName( const QString &ing ) const +Ingredient IngredientList::findByName( const TQString &ing ) const { IngredientList::const_iterator it_end = end(); for ( IngredientList::const_iterator it = begin(); it != it_end; ++it ) { if ( ( *it ).name == ing ) return *it; - for ( QValueList::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { + for ( TQValueList::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { if ( ( *sub_it ).name == ing ) return *sub_it; } @@ -118,14 +118,14 @@ Ingredient IngredientList::findByName( const QString &ing ) const return el; } -Ingredient IngredientList::findByName( const QRegExp &rx ) const +Ingredient IngredientList::findByName( const TQRegExp &rx ) const { IngredientList::const_iterator it_end = end(); for ( IngredientList::const_iterator it = begin(); it != it_end; ++it ) { if ( ( *it ).name.find(rx) != -1 ) return *it; - for ( QValueList::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { + for ( TQValueList::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { if ( ( *sub_it ).name.find(rx) != -1 ) return *sub_it; } @@ -140,22 +140,22 @@ IngredientList::const_iterator IngredientList::find( IngredientList::const_itera { Ingredient i; i.ingredientID = id; - return QValueList::find( it, i ); + return TQValueList::find( it, i ); } IngredientList::iterator IngredientList::find( IngredientList::iterator it, int id ) // Search by id (which uses search by item, with comparison defined on header) { Ingredient i; i.ingredientID = id; - return QValueList::find( it, i ); + return TQValueList::find( it, i ); } IngredientData& IngredientList::findSubstitute( const Ingredient &i ) // Search by id (which uses search by item, with comparison defined on header) { - QValueList::iterator result = QValueList::find(i); + TQValueList::iterator result = TQValueList::find(i); if ( result == end() ) { for ( IngredientList::iterator it = begin(); it != end(); ++it ) { - QValueList::iterator result = (*it).substitutes.find(i); + TQValueList::iterator result = (*it).substitutes.find(i); if ( result != (*it).substitutes.end() ) return *result; } @@ -165,10 +165,10 @@ IngredientData& IngredientList::findSubstitute( const Ingredient &i ) // Search void IngredientList::removeSubstitute( const Ingredient &i ) { - QValueList::iterator result = QValueList::find(i); + TQValueList::iterator result = TQValueList::find(i); if ( result == end() ) { for ( IngredientList::iterator it = begin(); it != end(); ++it ) { - QValueList::iterator result = (*it).substitutes.find(i); + TQValueList::iterator result = (*it).substitutes.find(i); if ( result != (*it).substitutes.end() ) { (*it).substitutes.remove(result); return; @@ -225,11 +225,11 @@ IngredientList IngredientList::groupMembers( int id, IngredientList::const_itera return matches; } -QValueList IngredientList::_groupMembers( int id, IngredientList::const_iterator begin ) const +TQValueList IngredientList::_groupMembers( int id, IngredientList::const_iterator begin ) const { bool first_found = false; - QValueList matches; + TQValueList matches; for ( IngredientList::const_iterator it = begin; it != end(); ++it ) { if ( ( *it ).groupID == id ) { matches << it; @@ -246,9 +246,9 @@ IngredientList IngredientList::firstGroup() { usedGroups.clear(); - QValueList members = _groupMembers( ( *begin() ).groupID, begin() ); + TQValueList members = _groupMembers( ( *begin() ).groupID, begin() ); - for ( QValueList::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { + for ( TQValueList::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { usedGroups << *members_it; } @@ -259,9 +259,9 @@ IngredientList IngredientList::nextGroup() { for ( IngredientList::const_iterator it = begin(); it != end(); ++it ) { if ( usedGroups.find( it ) == usedGroups.end() ) { - QValueList members = _groupMembers( ( *it ).groupID, it ); + TQValueList members = _groupMembers( ( *it ).groupID, it ); - for ( QValueList::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { + for ( TQValueList::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { usedGroups << *members_it; } diff --git a/krecipes/src/datablocks/ingredientlist.h b/krecipes/src/datablocks/ingredientlist.h index 9f01831..08fd153 100644 --- a/krecipes/src/datablocks/ingredientlist.h +++ b/krecipes/src/datablocks/ingredientlist.h @@ -13,8 +13,8 @@ #ifndef INGREDIENTLIST_H #define INGREDIENTLIST_H -#include -#include +#include +#include #include "datablocks/ingredient.h" @@ -23,7 +23,7 @@ class RecipeDB; /** @author Unai Garro */ -class IngredientList: public QValueList +class IngredientList: public TQValueList { public: IngredientList(); @@ -39,8 +39,8 @@ public: void move( int index1, int count, int index2 ); void empty( void ); int find( int id ) const; - Ingredient findByName( const QString & ) const; - Ingredient findByName( const QRegExp & ) const; + Ingredient findByName( const TQString & ) const; + Ingredient findByName( const TQRegExp & ) const; IngredientList::const_iterator find( IngredientList::const_iterator, int id ) const; IngredientList::iterator find( IngredientList::iterator, int id ); @@ -54,8 +54,8 @@ public: IngredientList nextGroup(); private: - QValueList _groupMembers( int id, IngredientList::const_iterator begin ) const; - QValueList usedGroups; + TQValueList _groupMembers( int id, IngredientList::const_iterator begin ) const; + TQValueList usedGroups; }; #endif diff --git a/krecipes/src/datablocks/ingredientproperty.cpp b/krecipes/src/datablocks/ingredientproperty.cpp index 331ee93..d8c621e 100644 --- a/krecipes/src/datablocks/ingredientproperty.cpp +++ b/krecipes/src/datablocks/ingredientproperty.cpp @@ -16,7 +16,7 @@ IngredientProperty::IngredientProperty() amount = 0.0; } -IngredientProperty::IngredientProperty( const QString &_name, const QString &_units, int _id ) : +IngredientProperty::IngredientProperty( const TQString &_name, const TQString &_units, int _id ) : id( _id ), name( _name ), units( _units ) diff --git a/krecipes/src/datablocks/ingredientproperty.h b/krecipes/src/datablocks/ingredientproperty.h index 0acceaf..ecc28cf 100644 --- a/krecipes/src/datablocks/ingredientproperty.h +++ b/krecipes/src/datablocks/ingredientproperty.h @@ -10,7 +10,7 @@ #ifndef INGREDIENTPROPERTY_H #define INGREDIENTPROPERTY_H -#include +#include #include "unit.h" @@ -21,12 +21,12 @@ class IngredientProperty { public: IngredientProperty(); - IngredientProperty( const QString &name, const QString &units, int id = -1 ); + IngredientProperty( const TQString &name, const TQString &units, int id = -1 ); ~IngredientProperty(); int id; // The property's id int ingredientID; // (Optional) reference to the ingredient to which is attached - QString name; // Name of the property - QString units; // The units that the property uses + TQString name; // Name of the property + TQString units; // The units that the property uses Unit perUnit; // stores the unit ID, name, and type of the per units. double amount; // Stores the amount, in the case of being attached to an ingredient. If not attached to any, you can set it to -1 preferably. That's the case in which the property is treated as a characteristic any without value (amount). diff --git a/krecipes/src/datablocks/ingredientpropertylist.cpp b/krecipes/src/datablocks/ingredientpropertylist.cpp index 59dc646..40d63be 100644 --- a/krecipes/src/datablocks/ingredientpropertylist.cpp +++ b/krecipes/src/datablocks/ingredientpropertylist.cpp @@ -21,10 +21,10 @@ IngredientPropertyList::const_iterator IngredientPropertyList::find( int id ) { IngredientProperty ip; ip.id = id; - return QValueList::find( ip ); + return TQValueList::find( ip ); } -int IngredientPropertyList::findByName( const QString &name ) +int IngredientPropertyList::findByName( const TQString &name ) { IngredientPropertyList::const_iterator prop_it; for ( prop_it = begin(); prop_it != end(); ++prop_it ) { diff --git a/krecipes/src/datablocks/ingredientpropertylist.h b/krecipes/src/datablocks/ingredientpropertylist.h index 88cd1c2..041c920 100644 --- a/krecipes/src/datablocks/ingredientpropertylist.h +++ b/krecipes/src/datablocks/ingredientpropertylist.h @@ -10,11 +10,11 @@ #ifndef INGREDIENTPROPERTYLIST_H #define INGREDIENTPROPERTYLIST_H -#include +#include #include "datablocks/ingredientproperty.h" -class IngredientPropertyList : public QValueList +class IngredientPropertyList : public TQValueList { public: IngredientPropertyList(); @@ -23,7 +23,7 @@ public: void divide( double units_of_yield_type ); IngredientPropertyList::const_iterator find( int id ); - int findByName( const QString & ); + int findByName( const TQString & ); void filter( int ingredientID, IngredientPropertyList *filteredList ); }; diff --git a/krecipes/src/datablocks/kreborder.cpp b/krecipes/src/datablocks/kreborder.cpp index 11ff382..4109f1e 100644 --- a/krecipes/src/datablocks/kreborder.cpp +++ b/krecipes/src/datablocks/kreborder.cpp @@ -12,6 +12,6 @@ //typedef enum KreBorderStyle { None = 0, Dotted, Dashed, Solid, Double, Groove, Ridge, Inset, Outset }; -KreBorder::KreBorder( int w, const QString & s, const QColor &c ) : width( w ), style( s ), color( c ) +KreBorder::KreBorder( int w, const TQString & s, const TQColor &c ) : width( w ), style( s ), color( c ) { } diff --git a/krecipes/src/datablocks/kreborder.h b/krecipes/src/datablocks/kreborder.h index caf38dd..48d0390 100644 --- a/krecipes/src/datablocks/kreborder.h +++ b/krecipes/src/datablocks/kreborder.h @@ -11,19 +11,19 @@ #ifndef KREBORDER_H #define KREBORDER_H -#include -#include +#include +#include //typedef enum KreBorderStyle { None = 0, Dotted, Dashed, Solid, Double, Groove, Ridge, Inset, Outset }; class KreBorder { public: - KreBorder( int w = 1, const QString & s = "none", const QColor &c = Qt::black ); + KreBorder( int w = 1, const TQString & s = "none", const TQColor &c = TQt::black ); int width; - QString style; - QColor color; + TQString style; + TQColor color; }; #endif //KREBORDER_H diff --git a/krecipes/src/datablocks/mixednumber.cpp b/krecipes/src/datablocks/mixednumber.cpp index bc999f2..9318567 100644 --- a/krecipes/src/datablocks/mixednumber.cpp +++ b/krecipes/src/datablocks/mixednumber.cpp @@ -9,16 +9,16 @@ ***************************************************************************/ #include "mixednumber.h" -#include +#include #include #include #include -QString beautify( const QString &num ) +TQString beautify( const TQString &num ) { - QString copy( num ); - copy.remove( QRegExp( QString( "(%1){0,1}0+$" ).arg( QRegExp::escape( KGlobal::locale() ->decimalSymbol() ) ) ) ); + TQString copy( num ); + copy.remove( TQRegExp( TQString( "(%1){0,1}0+$" ).arg( TQRegExp::escape( KGlobal::locale() ->decimalSymbol() ) ) ) ); return copy; } @@ -95,19 +95,19 @@ MixedNumber::MixedNumber( double decimal, double precision ) : MixedNumber::~MixedNumber() {} -int MixedNumber::getNumerator( const QString &input, int space_index, int slash_index, bool *ok ) +int MixedNumber::getNumerator( const TQString &input, int space_index, int slash_index, bool *ok ) { return input.mid( space_index + 1, slash_index - space_index - 1 ).toInt( ok ); } -int MixedNumber::getDenominator( const QString &input, int slash_index, bool *ok ) +int MixedNumber::getDenominator( const TQString &input, int slash_index, bool *ok ) { return input.mid( slash_index + 1, input.length() ).toInt( ok ); } -MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_aware ) +MixedNumber MixedNumber::fromString( const TQString &str, bool *ok, bool locale_aware ) { - QString input = str.stripWhiteSpace(); + TQString input = str.stripWhiteSpace(); if ( input.isEmpty() ) { if ( ok ) { *ok = true; @@ -129,7 +129,7 @@ MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_a if ( space_index == -1 ) { if ( slash_index == -1 ) //input contains no fractional part { - QString decimal_symbol = ( locale_aware ) ? locale->decimalSymbol() : "."; + TQString decimal_symbol = ( locale_aware ) ? locale->decimalSymbol() : "."; if ( input.endsWith( decimal_symbol ) ) { if ( ok ) { @@ -215,29 +215,29 @@ MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_a return MixedNumber( whole, numerator, denominator ); } -QString MixedNumber::toString( Format format, bool locale_aware ) const +TQString MixedNumber::toString( Format format, bool locale_aware ) const { if ( format == DecimalFormat ) { if ( locale_aware ) return beautify( locale->formatNumber( toDouble(), 5 ) ); else - return QString::number( toDouble() ); + return TQString::number( toDouble() ); } if ( m_numerator == 0 && m_whole == 0 ) - return QString( "0" ); + return TQString( "0" ); - QString result; + TQString result; if ( m_whole != 0 ) { - result += QString::number( m_whole ); + result += TQString::number( m_whole ); if ( m_numerator != 0 ) result += " "; } if ( m_numerator != 0 ) - result += QString::number( m_numerator ) + "/" + QString::number( m_denominator ); + result += TQString::number( m_numerator ) + "/" + TQString::number( m_denominator ); return result; } diff --git a/krecipes/src/datablocks/mixednumber.h b/krecipes/src/datablocks/mixednumber.h index 2c39c50..15a299c 100644 --- a/krecipes/src/datablocks/mixednumber.h +++ b/krecipes/src/datablocks/mixednumber.h @@ -11,10 +11,10 @@ #ifndef MIXEDNUMBER_H #define MIXEDNUMBER_H -#include +#include /** remove any extra zeros on the end of the string and the decimal if a whole number */ -QString beautify( const QString &num ); +TQString beautify( const TQString &num ); class KLocale; @@ -52,7 +52,7 @@ public: double toDouble() const; /** Returns the fraction as a string */ - QString toString( Format = MixedNumberFormat, bool locale_aware = true ) const; + TQString toString( Format = MixedNumberFormat, bool locale_aware = true ) const; /** The whole part of the input */ int whole() const @@ -84,14 +84,14 @@ public: /** Ensure that the fraction is simplified to its lowest terms. */ void simplify(); - /** Parses the given QString as a mixed number. The input can be + /** Parses the given TQString as a mixed number. The input can be * expressed as a mixed number in the form "a b/c", or as a decimal. */ - static MixedNumber fromString( const QString &input, bool *ok = 0, bool locale_aware = true ); + static MixedNumber fromString( const TQString &input, bool *ok = 0, bool locale_aware = true ); private: - static int getNumerator( const QString &input, int space_index, int slash_index, bool *ok ); - static int getDenominator( const QString &input, int slash_index, bool *ok ); + static int getNumerator( const TQString &input, int space_index, int slash_index, bool *ok ); + static int getDenominator( const TQString &input, int slash_index, bool *ok ); int gcd( int, int ); diff --git a/krecipes/src/datablocks/rating.cpp b/krecipes/src/datablocks/rating.cpp index e2c0a3f..af78344 100644 --- a/krecipes/src/datablocks/rating.cpp +++ b/krecipes/src/datablocks/rating.cpp @@ -10,19 +10,19 @@ #include "rating.h" -#include -#include +#include +#include #include -QPixmap Rating::starsPixmap( double stars_d, bool include_empty ) +TQPixmap Rating::starsPixmap( double stars_d, bool include_empty ) { - int stars = qRound(stars_d * 2); //multiply by two to make it easier to work with half-stars + int stars = tqRound(stars_d * 2); //multiply by two to make it easier to work with half-stars - QPixmap star = UserIcon(QString::fromLatin1("star_on")); - QPixmap star_off; + TQPixmap star = UserIcon(TQString::fromLatin1("star_on")); + TQPixmap star_off; if ( include_empty ) - star_off = UserIcon(QString::fromLatin1("star_off")); + star_off = UserIcon(TQString::fromLatin1("star_off")); int pixmapWidth; if ( include_empty ) @@ -30,11 +30,11 @@ QPixmap Rating::starsPixmap( double stars_d, bool include_empty ) else pixmapWidth = 18*(stars/2)+((stars%2==1)?9:0); - QPixmap generatedPixmap(pixmapWidth,18); + TQPixmap generatedPixmap(pixmapWidth,18); if ( !generatedPixmap.isNull() ) { //there aren't zero stars generatedPixmap.fill(); - QPainter painter( &generatedPixmap ); + TQPainter painter( &generatedPixmap ); int pixmapWidth = 18*(stars/2)+((stars%2==1)?9:0); if ( include_empty ) diff --git a/krecipes/src/datablocks/rating.h b/krecipes/src/datablocks/rating.h index 3f65340..54379a5 100644 --- a/krecipes/src/datablocks/rating.h +++ b/krecipes/src/datablocks/rating.h @@ -11,10 +11,10 @@ #ifndef RATING_H #define RATING_H -#include -#include +#include +#include -#include +#include class RatingCriteria { @@ -22,31 +22,31 @@ public: RatingCriteria() : id(-1), stars(0.0){} int id; - QString name; + TQString name; double stars; }; -typedef QValueList< RatingCriteria > RatingCriteriaList; +typedef TQValueList< RatingCriteria > RatingCriteriaList; class Rating { public: Rating() : id(-1){} - static QPixmap starsPixmap( double stars_d, bool include_empty = false ); + static TQPixmap starsPixmap( double stars_d, bool include_empty = false ); void append( const RatingCriteria & ); double average() const; int id; - QString comment; - QString rater; + TQString comment; + TQString rater; RatingCriteriaList ratingCriteriaList; }; -class RatingList : public QValueList< Rating > +class RatingList : public TQValueList< Rating > { public: double average(); diff --git a/krecipes/src/datablocks/recipe.cpp b/krecipes/src/datablocks/recipe.cpp index c1ef971..dd00f07 100644 --- a/krecipes/src/datablocks/recipe.cpp +++ b/krecipes/src/datablocks/recipe.cpp @@ -24,29 +24,29 @@ void Recipe::empty( void ) yield.amount = 1; yield.amount_offset = 0; - yield.type = QString::null; + yield.type = TQString::null; - title = QString::null; - instructions = QString::null; - photo = QPixmap(); + title = TQString::null; + instructions = TQString::null; + photo = TQPixmap(); ingList.empty(); categoryList.clear(); authorList.clear(); ratingList.clear(); - prepTime = QTime( 0, 0 ); + prepTime = TQTime( 0, 0 ); } -QString Yield::amountToString() const +TQString Yield::amountToString() const { - QString ret = QString::number(amount); + TQString ret = TQString::number(amount); if ( amount_offset > 0 ) - ret += "-"+QString::number(amount+amount_offset); + ret += "-"+TQString::number(amount+amount_offset); return ret; } -QString Yield::toString() const +TQString Yield::toString() const { return amountToString() + " " + type; } diff --git a/krecipes/src/datablocks/recipe.h b/krecipes/src/datablocks/recipe.h index 536864c..1ff7f8b 100644 --- a/krecipes/src/datablocks/recipe.h +++ b/krecipes/src/datablocks/recipe.h @@ -11,9 +11,9 @@ #ifndef RECIPE_H #define RECIPE_H -#include -#include -#include +#include +#include +#include #include "ingredientlist.h" #include "datablocks/rating.h" @@ -23,14 +23,14 @@ class Yield { public: - Yield() : amount(1), amount_offset(0), type(QString::null), type_id(-1){} + Yield() : amount(1), amount_offset(0), type(TQString::null), type_id(-1){} - QString amountToString() const; - QString toString() const; + TQString amountToString() const; + TQString toString() const; double amount; double amount_offset; - QString type; + TQString type; int type_id; }; @@ -46,17 +46,17 @@ public: int recipeID; Yield yield; - QString title; - QString instructions; - QPixmap photo; + TQString title; + TQString instructions; + TQPixmap photo; IngredientList ingList; ElementList categoryList; // id+name ElementList authorList; //authors' id+name - QTime prepTime; + TQTime prepTime; - QDateTime ctime; - QDateTime mtime; - QDateTime atime; + TQDateTime ctime; + TQDateTime mtime; + TQDateTime atime; RatingList ratingList; IngredientPropertyList properties; diff --git a/krecipes/src/datablocks/recipelist.cpp b/krecipes/src/datablocks/recipelist.cpp index 524df68..5a7d583 100644 --- a/krecipes/src/datablocks/recipelist.cpp +++ b/krecipes/src/datablocks/recipelist.cpp @@ -10,7 +10,7 @@ #include "recipelist.h" -RecipeList::RecipeList() : QValueList () +RecipeList::RecipeList() : TQValueList () {} RecipeList::~RecipeList() diff --git a/krecipes/src/datablocks/recipelist.h b/krecipes/src/datablocks/recipelist.h index e3c90aa..2aaf180 100644 --- a/krecipes/src/datablocks/recipelist.h +++ b/krecipes/src/datablocks/recipelist.h @@ -13,12 +13,12 @@ #include "datablocks/recipe.h" -#include +#include /** @author Unai Garro */ -class RecipeList: public QValueList +class RecipeList: public TQValueList { public: RecipeList(); diff --git a/krecipes/src/datablocks/unit.cpp b/krecipes/src/datablocks/unit.cpp index fbd94de..ab670f3 100644 --- a/krecipes/src/datablocks/unit.cpp +++ b/krecipes/src/datablocks/unit.cpp @@ -13,14 +13,14 @@ Unit::Unit() : type(Unit::Other), id( -1 ) {} -Unit::Unit( const QString &_name, const QString &_plural, int _id ) : +Unit::Unit( const TQString &_name, const TQString &_plural, int _id ) : type(Unit::Other), id( _id ), name( _name ), plural( _plural ) {} -Unit::Unit( const QString &_name, double amount ) : type(Unit::Other) +Unit::Unit( const TQString &_name, double amount ) : type(Unit::Other) { if ( amount > 1 ) plural = _name; @@ -28,10 +28,10 @@ Unit::Unit( const QString &_name, double amount ) : type(Unit::Other) name = _name; } -QString Unit::determineName( double amount, bool useAbbrev ) const +TQString Unit::determineName( double amount, bool useAbbrev ) const { if ( useAbbrev ) { - QString unit = ( amount > 1 ) ? plural_abbrev : name_abbrev; + TQString unit = ( amount > 1 ) ? plural_abbrev : name_abbrev; if ( unit.isEmpty() ) unit = ( amount > 1 ) ? plural : name; return unit; @@ -42,20 +42,20 @@ QString Unit::determineName( double amount, bool useAbbrev ) const bool Unit::operator==( const Unit &u ) const { - //treat QString::null and "" as the same - QString plural_test1 = u.plural.lower(); + //treat TQString::null and "" as the same + TQString plural_test1 = u.plural.lower(); if ( plural_test1.isNull() ) plural_test1 = ""; - QString plural_test2 = plural.lower(); + TQString plural_test2 = plural.lower(); if ( plural_test2.isNull() ) plural_test2 = ""; - QString single_test1 = u.name.lower(); + TQString single_test1 = u.name.lower(); if ( single_test1.isNull() ) single_test1 = ""; - QString single_test2 = name.lower(); + TQString single_test2 = name.lower(); if ( single_test2.isNull() ) single_test2 = ""; @@ -71,5 +71,5 @@ bool Unit::operator==( const Unit &u ) const bool Unit::operator<( const Unit &u ) const { - return ( QString::localeAwareCompare( name.lower(), u.name.lower() ) < 0 ); + return ( TQString::localeAwareCompare( name.lower(), u.name.lower() ) < 0 ); } diff --git a/krecipes/src/datablocks/unit.h b/krecipes/src/datablocks/unit.h index 73ae794..ff565d1 100644 --- a/krecipes/src/datablocks/unit.h +++ b/krecipes/src/datablocks/unit.h @@ -11,35 +11,35 @@ #ifndef UNIT_H #define UNIT_H -#include -#include +#include +#include class Unit { public: Unit(); - Unit( const QString &name, const QString &plural, int id = -1 ); + Unit( const TQString &name, const TQString &plural, int id = -1 ); typedef enum { All = -1, Other = 0, Mass, Volume } Type; /** Use @param amount to determine whether to use @param name as the plural or singlular form */ - Unit( const QString &name, double amount ); + Unit( const TQString &name, double amount ); bool operator==( const Unit &u ) const; bool operator<( const Unit &u ) const; - QString determineName( double amount, bool useAbbrev ) const; + TQString determineName( double amount, bool useAbbrev ) const; Type type; int id; - QString name; - QString plural; + TQString name; + TQString plural; - QString name_abbrev; - QString plural_abbrev; + TQString name_abbrev; + TQString plural_abbrev; }; -typedef QValueList< Unit > UnitList; +typedef TQValueList< Unit > UnitList; #endif //UNIT_H diff --git a/krecipes/src/datablocks/unitratiolist.h b/krecipes/src/datablocks/unitratiolist.h index 22a49a8..86193ad 100644 --- a/krecipes/src/datablocks/unitratiolist.h +++ b/krecipes/src/datablocks/unitratiolist.h @@ -9,14 +9,14 @@ ***************************************************************************/ #ifndef UNITRATIOLIST_H #define UNITRATIOLIST_H -#include +#include #include "unitratio.h" /** @author Unai Garro */ -class UnitRatioList : public QValueList +class UnitRatioList : public TQValueList { public: UnitRatioList(); diff --git a/krecipes/src/datablocks/weight.h b/krecipes/src/datablocks/weight.h index eefe896..881d359 100644 --- a/krecipes/src/datablocks/weight.h +++ b/krecipes/src/datablocks/weight.h @@ -10,8 +10,8 @@ #ifndef WEIGHT_H #define WEIGHT_H -#include -#include +#include +#include #include "datablocks/elementlist.h" @@ -23,19 +23,19 @@ public: int id; int ingredientID; int perAmountUnitID; - QString perAmountUnit; + TQString perAmountUnit; double perAmount; int weightUnitID; double weight; - QString weightUnit; + TQString weightUnit; int prepMethodID; - QString prepMethod; + TQString prepMethod; }; -class WeightList : public QValueList +class WeightList : public TQValueList { public: - WeightList() : QValueList(){} + WeightList() : TQValueList(){} }; #endif diff --git a/krecipes/src/dialogs/advancedsearchdialog.cpp b/krecipes/src/dialogs/advancedsearchdialog.cpp index 30d50a5..7fc78e6 100644 --- a/krecipes/src/dialogs/advancedsearchdialog.cpp +++ b/krecipes/src/dialogs/advancedsearchdialog.cpp @@ -10,28 +10,28 @@ #include "advancedsearchdialog.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -54,340 +54,340 @@ #include "profiling.h" -AdvancedSearchDialog::AdvancedSearchDialog( QWidget *parent, RecipeDB *db ) : QWidget( parent ), +AdvancedSearchDialog::AdvancedSearchDialog( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ), database( db ) { /// ///BEGIN OF AUTOMATICALLY GENERATED GUI CODE/// /// - AdvancedSearchDialogLayout = new QHBoxLayout( this, 5, 3, "AdvancedSearchDialogLayout"); + AdvancedSearchDialogLayout = new TQHBoxLayout( this, 5, 3, "AdvancedSearchDialogLayout"); - layout7 = new QVBoxLayout( 0, 0, 3, "layout7"); + layout7 = new TQVBoxLayout( 0, 0, 3, "layout7"); - textLabel1_4 = new QLabel( this, "textLabel1_4" ); + textLabel1_4 = new TQLabel( this, "textLabel1_4" ); layout7->addWidget( textLabel1_4 ); - scrollView1 = new QScrollView( this, "scrollView1" ); + scrollView1 = new TQScrollView( this, "scrollView1" ); scrollView1->enableClipper(true); - parametersFrame = new QFrame( scrollView1, "parametersFrame" ); - parametersFrame->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, parametersFrame->sizePolicy().hasHeightForWidth() ) ); - parametersFrame->setFrameShape( QFrame::NoFrame ); - parametersFrame->setFrameShadow( QFrame::Plain ); + parametersFrame = new TQFrame( scrollView1, "parametersFrame" ); + parametersFrame->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)3, 0, 0, parametersFrame->sizePolicy().hasHeightForWidth() ) ); + parametersFrame->setFrameShape( TQFrame::NoFrame ); + parametersFrame->setFrameShadow( TQFrame::Plain ); parametersFrame->setLineWidth( 0 ); - parametersFrameLayout = new QVBoxLayout( parametersFrame, 0, 0, "parametersFrameLayout"); + parametersFrameLayout = new TQVBoxLayout( parametersFrame, 0, 0, "parametersFrameLayout"); - titleButton = new QPushButton( parametersFrame, "titleButton" ); + titleButton = new TQPushButton( parametersFrame, "titleButton" ); titleButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( titleButton ); - titleFrame = new QFrame( parametersFrame, "titleFrame" ); - titleFrame->setFrameShape( QFrame::StyledPanel ); - titleFrame->setFrameShadow( QFrame::Raised ); - titleFrameLayout = new QVBoxLayout( titleFrame, 5, 3, "titleFrameLayout"); + titleFrame = new TQFrame( parametersFrame, "titleFrame" ); + titleFrame->setFrameShape( TQFrame::StyledPanel ); + titleFrame->setFrameShadow( TQFrame::Raised ); + titleFrameLayout = new TQVBoxLayout( titleFrame, 5, 3, "titleFrameLayout"); - requireAllTitle = new QCheckBox( i18n("Require All Words"), titleFrame ); + requireAllTitle = new TQCheckBox( i18n("Require All Words"), titleFrame ); titleFrameLayout->addWidget( requireAllTitle ); - QHBox *titleHBox = new QHBox( titleFrame ); - /*QLabel *titleInfoLabel = */new QLabel(i18n("Keywords:"),titleHBox); - titleEdit = new QLineEdit( titleHBox, "titleEdit" ); + TQHBox *titleHBox = new TQHBox( titleFrame ); + /*TQLabel *titleInfoLabel = */new TQLabel(i18n("Keywords:"),titleHBox); + titleEdit = new TQLineEdit( titleHBox, "titleEdit" ); titleFrameLayout->addWidget( titleHBox ); parametersFrameLayout->addWidget( titleFrame ); - titleFrameSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + titleFrameSpacer = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( titleFrameSpacer ); - ingredientButton = new QPushButton( parametersFrame, "ingredientButton" ); + ingredientButton = new TQPushButton( parametersFrame, "ingredientButton" ); ingredientButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( ingredientButton ); - ingredientFrame = new QFrame( parametersFrame, "ingredientFrame" ); - ingredientFrame->setFrameShape( QFrame::StyledPanel ); - ingredientFrame->setFrameShadow( QFrame::Raised ); - ingredientFrameLayout = new QGridLayout( ingredientFrame, 1, 1, 3, 3, "ingredientFrameLayout"); + ingredientFrame = new TQFrame( parametersFrame, "ingredientFrame" ); + ingredientFrame->setFrameShape( TQFrame::StyledPanel ); + ingredientFrame->setFrameShadow( TQFrame::Raised ); + ingredientFrameLayout = new TQGridLayout( ingredientFrame, 1, 1, 3, 3, "ingredientFrameLayout"); - QLabel *ingredientInfoLabel = new QLabel(i18n("Enter ingredients: (e.g. chicken pasta \"white wine\")"),ingredientFrame); - ingredientInfoLabel->setTextFormat( Qt::RichText ); + TQLabel *ingredientInfoLabel = new TQLabel(i18n("Enter ingredients: (e.g. chicken pasta \"white wine\")"),ingredientFrame); + ingredientInfoLabel->setTextFormat( TQt::RichText ); ingredientFrameLayout->addMultiCellWidget( ingredientInfoLabel, 0, 0, 0, 1 ); - ingredientsAllEdit = new QLineEdit( ingredientFrame, "ingredientsAllEdit" ); + ingredientsAllEdit = new TQLineEdit( ingredientFrame, "ingredientsAllEdit" ); ingredientFrameLayout->addWidget( ingredientsAllEdit, 1, 1 ); - ingredientsAnyEdit = new QLineEdit( ingredientFrame, "ingredientsAnyEdit" ); + ingredientsAnyEdit = new TQLineEdit( ingredientFrame, "ingredientsAnyEdit" ); ingredientFrameLayout->addWidget( ingredientsAnyEdit, 2, 1 ); - textLabel1_2 = new QLabel( ingredientFrame, "textLabel1_2" ); + textLabel1_2 = new TQLabel( ingredientFrame, "textLabel1_2" ); ingredientFrameLayout->addWidget( textLabel1_2, 2, 0 ); - textLabel1 = new QLabel( ingredientFrame, "textLabel1" ); + textLabel1 = new TQLabel( ingredientFrame, "textLabel1" ); ingredientFrameLayout->addWidget( textLabel1, 1, 0 ); - ingredientsWithoutEdit = new QLineEdit( ingredientFrame, "ingredientsWithoutEdit" ); + ingredientsWithoutEdit = new TQLineEdit( ingredientFrame, "ingredientsWithoutEdit" ); ingredientFrameLayout->addWidget( ingredientsWithoutEdit, 3, 1 ); - textLabel1_3 = new QLabel( ingredientFrame, "textLabel1_3" ); + textLabel1_3 = new TQLabel( ingredientFrame, "textLabel1_3" ); ingredientFrameLayout->addWidget( textLabel1_3, 3, 0 ); parametersFrameLayout->addWidget( ingredientFrame ); - spacer3_2_3_2_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + spacer3_2_3_2_2 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( spacer3_2_3_2_2 ); - categoriesButton = new QPushButton( parametersFrame, "categoriesButton" ); + categoriesButton = new TQPushButton( parametersFrame, "categoriesButton" ); categoriesButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( categoriesButton ); - categoryFrame = new QFrame( parametersFrame, "categoryFrame" ); - categoryFrame->setFrameShape( QFrame::StyledPanel ); - categoryFrame->setFrameShadow( QFrame::Raised ); - categoryFrameLayout = new QGridLayout( categoryFrame, 1, 1, 3, 3, "categoryFrameLayout"); + categoryFrame = new TQFrame( parametersFrame, "categoryFrame" ); + categoryFrame->setFrameShape( TQFrame::StyledPanel ); + categoryFrame->setFrameShadow( TQFrame::Raised ); + categoryFrameLayout = new TQGridLayout( categoryFrame, 1, 1, 3, 3, "categoryFrameLayout"); - QLabel *categoryInfoLabel = new QLabel(i18n("Enter categories: (e.g. Desserts Pastas \"Main Dishes\")"),categoryFrame); - categoryInfoLabel->setTextFormat( Qt::RichText ); + TQLabel *categoryInfoLabel = new TQLabel(i18n("Enter categories: (e.g. Desserts Pastas \"Main Dishes\")"),categoryFrame); + categoryInfoLabel->setTextFormat( TQt::RichText ); categoryFrameLayout->addMultiCellWidget( categoryInfoLabel, 0, 0, 0, 1 ); - categoriesAllEdit = new QLineEdit( categoryFrame, "categoriesAllEdit" ); + categoriesAllEdit = new TQLineEdit( categoryFrame, "categoriesAllEdit" ); categoryFrameLayout->addWidget( categoriesAllEdit, 1, 1 ); - textLabel1_5 = new QLabel( categoryFrame, "textLabel1_5" ); + textLabel1_5 = new TQLabel( categoryFrame, "textLabel1_5" ); categoryFrameLayout->addWidget( textLabel1_5, 1, 0 ); - textLabel1_3_3 = new QLabel( categoryFrame, "textLabel1_3_3" ); + textLabel1_3_3 = new TQLabel( categoryFrame, "textLabel1_3_3" ); categoryFrameLayout->addWidget( textLabel1_3_3, 3, 0 ); - categoriesAnyEdit = new QLineEdit( categoryFrame, "categoriesAnyEdit" ); + categoriesAnyEdit = new TQLineEdit( categoryFrame, "categoriesAnyEdit" ); categoryFrameLayout->addWidget( categoriesAnyEdit, 2, 1 ); - textLabel1_2_3 = new QLabel( categoryFrame, "textLabel1_2_3" ); + textLabel1_2_3 = new TQLabel( categoryFrame, "textLabel1_2_3" ); categoryFrameLayout->addWidget( textLabel1_2_3, 2, 0 ); - categoriesNotEdit = new QLineEdit( categoryFrame, "categoriesNotEdit" ); + categoriesNotEdit = new TQLineEdit( categoryFrame, "categoriesNotEdit" ); categoryFrameLayout->addWidget( categoriesNotEdit, 3, 1 ); parametersFrameLayout->addWidget( categoryFrame ); - spacer3_2_3_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + spacer3_2_3_2 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( spacer3_2_3_2 ); - authorsButton = new QPushButton( parametersFrame, "authorsButton" ); + authorsButton = new TQPushButton( parametersFrame, "authorsButton" ); authorsButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( authorsButton ); - authorsFrame = new QFrame( parametersFrame, "authorsFrame" ); - authorsFrame->setFrameShape( QFrame::StyledPanel ); - authorsFrame->setFrameShadow( QFrame::Raised ); - authorsFrameLayout = new QGridLayout( authorsFrame, 1, 1, 3, 3, "authorsFrameLayout"); + authorsFrame = new TQFrame( parametersFrame, "authorsFrame" ); + authorsFrame->setFrameShape( TQFrame::StyledPanel ); + authorsFrame->setFrameShadow( TQFrame::Raised ); + authorsFrameLayout = new TQGridLayout( authorsFrame, 1, 1, 3, 3, "authorsFrameLayout"); - QLabel *authorsInfoLabel = new QLabel(i18n("Enter author name (e.g. Smith or \"Jane Doe\")"),authorsFrame); - authorsInfoLabel->setTextFormat( Qt::RichText ); + TQLabel *authorsInfoLabel = new TQLabel(i18n("Enter author name (e.g. Smith or \"Jane Doe\")"),authorsFrame); + authorsInfoLabel->setTextFormat( TQt::RichText ); authorsFrameLayout->addMultiCellWidget( authorsInfoLabel, 0, 0, 0, 1 ); - textLabel1_2_4 = new QLabel( authorsFrame, "textLabel1_2_4" ); + textLabel1_2_4 = new TQLabel( authorsFrame, "textLabel1_2_4" ); authorsFrameLayout->addWidget( textLabel1_2_4, 1, 0 ); - textLabel1_6 = new QLabel( authorsFrame, "textLabel1_6" ); + textLabel1_6 = new TQLabel( authorsFrame, "textLabel1_6" ); authorsFrameLayout->addWidget( textLabel1_6, 2, 0 ); - textLabel1_3_4 = new QLabel( authorsFrame, "textLabel1_3_4" ); + textLabel1_3_4 = new TQLabel( authorsFrame, "textLabel1_3_4" ); authorsFrameLayout->addWidget( textLabel1_3_4, 3, 0 ); - authorsAnyEdit = new QLineEdit( authorsFrame, "authorsAnyEdit" ); + authorsAnyEdit = new TQLineEdit( authorsFrame, "authorsAnyEdit" ); authorsFrameLayout->addWidget( authorsAnyEdit, 1, 1 ); - authorsAllEdit = new QLineEdit( authorsFrame, "authorsAllEdit" ); + authorsAllEdit = new TQLineEdit( authorsFrame, "authorsAllEdit" ); authorsFrameLayout->addWidget( authorsAllEdit, 2, 1 ); - authorsWithoutEdit = new QLineEdit( authorsFrame, "authorsWithoutEdit" ); + authorsWithoutEdit = new TQLineEdit( authorsFrame, "authorsWithoutEdit" ); authorsFrameLayout->addWidget( authorsWithoutEdit, 3, 1 ); parametersFrameLayout->addWidget( authorsFrame ); - spacer3_2_3 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + spacer3_2_3 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( spacer3_2_3 ); - servingsButton = new QPushButton( parametersFrame, "servingsButton" ); + servingsButton = new TQPushButton( parametersFrame, "servingsButton" ); servingsButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( servingsButton ); - servingsFrame = new QFrame( parametersFrame, "servingsFrame" ); - servingsFrame->setFrameShape( QFrame::StyledPanel ); - servingsFrame->setFrameShadow( QFrame::Raised ); - servingsFrameLayout = new QVBoxLayout( servingsFrame, 3, 3, "servingsFrameLayout"); + servingsFrame = new TQFrame( parametersFrame, "servingsFrame" ); + servingsFrame->setFrameShape( TQFrame::StyledPanel ); + servingsFrame->setFrameShadow( TQFrame::Raised ); + servingsFrameLayout = new TQVBoxLayout( servingsFrame, 3, 3, "servingsFrameLayout"); - enableServingsCheckBox = new QCheckBox( servingsFrame, "enableServingsCheckBox" ); + enableServingsCheckBox = new TQCheckBox( servingsFrame, "enableServingsCheckBox" ); servingsFrameLayout->addWidget( enableServingsCheckBox ); - layout5 = new QHBoxLayout( 0, 0, 3, "layout5"); + layout5 = new TQHBoxLayout( 0, 0, 3, "layout5"); - servingsComboBox = new QComboBox( FALSE, servingsFrame, "servingsComboBox" ); + servingsComboBox = new TQComboBox( FALSE, servingsFrame, "servingsComboBox" ); servingsComboBox->setEnabled( FALSE ); - servingsComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, servingsComboBox->sizePolicy().hasHeightForWidth() ) ); + servingsComboBox->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, servingsComboBox->sizePolicy().hasHeightForWidth() ) ); layout5->addWidget( servingsComboBox ); - servingsSpinBox = new QSpinBox( servingsFrame, "servingsSpinBox" ); + servingsSpinBox = new TQSpinBox( servingsFrame, "servingsSpinBox" ); servingsSpinBox->setEnabled( FALSE ); servingsSpinBox->setMinValue( 1 ); servingsSpinBox->setMaxValue( 9999 ); layout5->addWidget( servingsSpinBox ); servingsFrameLayout->addLayout( layout5 ); parametersFrameLayout->addWidget( servingsFrame ); - spacer3_2_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + spacer3_2_2 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( spacer3_2_2 ); - prepTimeButton = new QPushButton( parametersFrame, "prepTimeButton" ); + prepTimeButton = new TQPushButton( parametersFrame, "prepTimeButton" ); prepTimeButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( prepTimeButton ); - prepTimeFrame = new QFrame( parametersFrame, "prepTimeFrame" ); - prepTimeFrame->setFrameShape( QFrame::StyledPanel ); - prepTimeFrame->setFrameShadow( QFrame::Raised ); - prepTimeFrameLayout = new QVBoxLayout( prepTimeFrame, 3, 3, "prepTimeFrameLayout"); + prepTimeFrame = new TQFrame( parametersFrame, "prepTimeFrame" ); + prepTimeFrame->setFrameShape( TQFrame::StyledPanel ); + prepTimeFrame->setFrameShadow( TQFrame::Raised ); + prepTimeFrameLayout = new TQVBoxLayout( prepTimeFrame, 3, 3, "prepTimeFrameLayout"); - enablePrepTimeCheckBox = new QCheckBox( prepTimeFrame, "enablePrepTimeCheckBox" ); + enablePrepTimeCheckBox = new TQCheckBox( prepTimeFrame, "enablePrepTimeCheckBox" ); prepTimeFrameLayout->addWidget( enablePrepTimeCheckBox ); - layout6 = new QHBoxLayout( 0, 0, 3, "layout6"); + layout6 = new TQHBoxLayout( 0, 0, 3, "layout6"); - prepTimeComboBox = new QComboBox( FALSE, prepTimeFrame, "prepTimeComboBox" ); + prepTimeComboBox = new TQComboBox( FALSE, prepTimeFrame, "prepTimeComboBox" ); prepTimeComboBox->setEnabled( FALSE ); - prepTimeComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, prepTimeComboBox->sizePolicy().hasHeightForWidth() ) ); + prepTimeComboBox->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, prepTimeComboBox->sizePolicy().hasHeightForWidth() ) ); layout6->addWidget( prepTimeComboBox ); - prepTimeEdit = new QTimeEdit( prepTimeFrame, "prepTimeEdit" ); + prepTimeEdit = new TQTimeEdit( prepTimeFrame, "prepTimeEdit" ); prepTimeEdit->setEnabled( FALSE ); - prepTimeEdit->setDisplay( int( QTimeEdit::Minutes | QTimeEdit::Hours ) ); + prepTimeEdit->setDisplay( int( TQTimeEdit::Minutes | TQTimeEdit::Hours ) ); layout6->addWidget( prepTimeEdit ); prepTimeFrameLayout->addLayout( layout6 ); parametersFrameLayout->addWidget( prepTimeFrame ); - spacer15 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + spacer15 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( spacer15 ); - instructionsButton = new QPushButton( parametersFrame, "instructionsButton" ); + instructionsButton = new TQPushButton( parametersFrame, "instructionsButton" ); instructionsButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( instructionsButton ); - instructionsFrame = new QFrame( parametersFrame, "instructionsFrame" ); - instructionsFrame->setFrameShape( QFrame::StyledPanel ); - instructionsFrame->setFrameShadow( QFrame::Raised ); - instructionsFrameLayout = new QVBoxLayout( instructionsFrame, 5, 3, "instructionsFrameLayout"); + instructionsFrame = new TQFrame( parametersFrame, "instructionsFrame" ); + instructionsFrame->setFrameShape( TQFrame::StyledPanel ); + instructionsFrame->setFrameShadow( TQFrame::Raised ); + instructionsFrameLayout = new TQVBoxLayout( instructionsFrame, 5, 3, "instructionsFrameLayout"); - requireAllInstructions = new QCheckBox( i18n("Require All Words"), instructionsFrame ); + requireAllInstructions = new TQCheckBox( i18n("Require All Words"), instructionsFrame ); instructionsFrameLayout->addWidget( requireAllInstructions ); - QHBox *instructionsHBox = new QHBox(instructionsFrame); - /*QLabel *instructionsInfoLabel = */new QLabel(i18n("Keywords:"),instructionsHBox); + TQHBox *instructionsHBox = new TQHBox(instructionsFrame); + /*TQLabel *instructionsInfoLabel = */new TQLabel(i18n("Keywords:"),instructionsHBox); - instructionsEdit = new QLineEdit( instructionsHBox, "instructionsEdit" ); + instructionsEdit = new TQLineEdit( instructionsHBox, "instructionsEdit" ); instructionsFrameLayout->addWidget( instructionsHBox ); parametersFrameLayout->addWidget( instructionsFrame ); - instructionsFrameSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + instructionsFrameSpacer = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( instructionsFrameSpacer ); - metaDataButton = new QPushButton( parametersFrame, "metaDataButton" ); + metaDataButton = new TQPushButton( parametersFrame, "metaDataButton" ); metaDataButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( metaDataButton ); - metaDataFrame = new QFrame( parametersFrame, "metaDataFrame" ); - metaDataFrame->setFrameShape( QFrame::StyledPanel ); - metaDataFrame->setFrameShadow( QFrame::Raised ); - metaDataFrameLayout = new QVBoxLayout( metaDataFrame, 5, 3, "metaDataFrameLayout"); + metaDataFrame = new TQFrame( parametersFrame, "metaDataFrame" ); + metaDataFrame->setFrameShape( TQFrame::StyledPanel ); + metaDataFrame->setFrameShadow( TQFrame::Raised ); + metaDataFrameLayout = new TQVBoxLayout( metaDataFrame, 5, 3, "metaDataFrameLayout"); - QLabel *createdLabel = new QLabel( i18n("Created:"), metaDataFrame ); + TQLabel *createdLabel = new TQLabel( i18n("Created:"), metaDataFrame ); metaDataFrameLayout->addWidget( createdLabel ); - QHBox *createdHBox = new QHBox(metaDataFrame); + TQHBox *createdHBox = new TQHBox(metaDataFrame); createdStartDateEdit = new KDateEdit(createdHBox,"createdStartEdit"); - createdStartDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); - (void)new QLabel(" - ",createdHBox); + createdStartDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); + (void)new TQLabel(" - ",createdHBox); createdEndDateEdit = new KDateEdit(createdHBox,"createdEndEdit"); - createdEndDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); + createdEndDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); metaDataFrameLayout->addWidget( createdHBox ); - QLabel *modifiedLabel = new QLabel( i18n("Modified:"), metaDataFrame ); + TQLabel *modifiedLabel = new TQLabel( i18n("Modified:"), metaDataFrame ); metaDataFrameLayout->addWidget( modifiedLabel ); - QHBox *modifiedHBox = new QHBox(metaDataFrame); + TQHBox *modifiedHBox = new TQHBox(metaDataFrame); modifiedStartDateEdit = new KDateEdit(modifiedHBox,"modifiedStartEdit"); - modifiedStartDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); - (void)new QLabel(" - ",modifiedHBox); + modifiedStartDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); + (void)new TQLabel(" - ",modifiedHBox); modifiedEndDateEdit = new KDateEdit(modifiedHBox,"modifiedEndEdit"); - modifiedEndDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); + modifiedEndDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); metaDataFrameLayout->addWidget( modifiedHBox ); - QLabel *accessedLabel = new QLabel( i18n("Last Accessed:"), metaDataFrame ); + TQLabel *accessedLabel = new TQLabel( i18n("Last Accessed:"), metaDataFrame ); metaDataFrameLayout->addWidget( accessedLabel ); - QHBox *accessedHBox = new QHBox(metaDataFrame); + TQHBox *accessedHBox = new TQHBox(metaDataFrame); accessedStartDateEdit = new KDateEdit(accessedHBox,"accessedStartEdit"); - accessedStartDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); - (void)new QLabel(" - ",accessedHBox); + accessedStartDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); + (void)new TQLabel(" - ",accessedHBox); accessedEndDateEdit = new KDateEdit(accessedHBox,"accessedEndEdit"); - accessedEndDateEdit->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); + accessedEndDateEdit->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); metaDataFrameLayout->addWidget( accessedHBox ); parametersFrameLayout->addWidget( metaDataFrame ); - metaDataFrameSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred ); + metaDataFrameSpacer = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Preferred ); parametersFrameLayout->addItem( metaDataFrameSpacer ); //=============RATINGS FRAME===========// - ratingsButton = new QPushButton( parametersFrame, "ratingsButton" ); + ratingsButton = new TQPushButton( parametersFrame, "ratingsButton" ); ratingsButton->setToggleButton( TRUE ); parametersFrameLayout->addWidget( ratingsButton ); - ratingButtonGroup = new QButtonGroup( parametersFrame, "ratingButtonGroup" ); + ratingButtonGroup = new TQButtonGroup( parametersFrame, "ratingButtonGroup" ); ratingButtonGroup->setLineWidth( 0 ); - ratingButtonGroup->setColumnLayout(0, Qt::Vertical ); + ratingButtonGroup->setColumnLayout(0, TQt::Vertical ); ratingButtonGroup->layout()->setSpacing( 5 ); ratingButtonGroup->layout()->setMargin( 3 ); - ratingButtonGroupLayout = new QVBoxLayout( ratingButtonGroup->layout() ); - ratingButtonGroupLayout->setAlignment( Qt::AlignTop ); + ratingButtonGroupLayout = new TQVBoxLayout( ratingButtonGroup->layout() ); + ratingButtonGroupLayout->setAlignment( TQt::AlignTop ); - ratingAvgRadioButton = new QRadioButton( ratingButtonGroup, "ratingAvgRadioButton" ); + ratingAvgRadioButton = new TQRadioButton( ratingButtonGroup, "ratingAvgRadioButton" ); ratingAvgRadioButton->setChecked( TRUE ); ratingButtonGroupLayout->addWidget( ratingAvgRadioButton ); - ratingAvgFrame = new QFrame( ratingButtonGroup, "ratingAvgFrame" ); + ratingAvgFrame = new TQFrame( ratingButtonGroup, "ratingAvgFrame" ); ratingAvgFrame->setLineWidth( 0 ); - ratingAvgFrameLayout = new QHBoxLayout( ratingAvgFrame, 2, 2, "ratingAvgFrameLayout"); + ratingAvgFrameLayout = new TQHBoxLayout( ratingAvgFrame, 2, 2, "ratingAvgFrameLayout"); avgStarsEdit = new FractionInput( ratingAvgFrame ); avgStarsEdit->setAllowRange(true); ratingAvgFrameLayout->addWidget( avgStarsEdit ); - avgStarsLabel = new QLabel( ratingAvgFrame, "avgStarsLabel" ); + avgStarsLabel = new TQLabel( ratingAvgFrame, "avgStarsLabel" ); ratingAvgFrameLayout->addWidget( avgStarsLabel ); ratingButtonGroupLayout->addWidget( ratingAvgFrame ); - criterionRadioButton = new QRadioButton( ratingButtonGroup, "criterionRadioButton" ); + criterionRadioButton = new TQRadioButton( ratingButtonGroup, "criterionRadioButton" ); ratingButtonGroupLayout->addWidget( criterionRadioButton ); - criterionFrame = new QFrame( ratingButtonGroup, "criterionFrame" ); + criterionFrame = new TQFrame( ratingButtonGroup, "criterionFrame" ); criterionFrame->setEnabled( FALSE ); criterionFrame->setLineWidth( 0 ); - criterionFrameLayout = new QVBoxLayout( criterionFrame, 2, 2, "criterionFrameLayout"); + criterionFrameLayout = new TQVBoxLayout( criterionFrame, 2, 2, "criterionFrameLayout"); - layout12 = new QHBoxLayout( 0, 0, 6, "layout12"); + layout12 = new TQHBoxLayout( 0, 0, 6, "layout12"); criteriaComboBox = new CriteriaComboBox( FALSE, criterionFrame, database ); criteriaComboBox->setEditable( false ); @@ -396,54 +396,54 @@ AdvancedSearchDialog::AdvancedSearchDialog( QWidget *parent, RecipeDB *db ) : QW starsWidget = new FractionInput( criterionFrame ); starsWidget->setAllowRange(true); - starsWidget->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); + starsWidget->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Preferred ); layout12->addWidget( starsWidget ); - addCriteriaButton = new QPushButton( criterionFrame, "addCriteriaButton" ); - addCriteriaButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, addCriteriaButton->sizePolicy().hasHeightForWidth() ) ); - addCriteriaButton->setMaximumSize( QSize( 30, 30 ) ); + addCriteriaButton = new TQPushButton( criterionFrame, "addCriteriaButton" ); + addCriteriaButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, addCriteriaButton->sizePolicy().hasHeightForWidth() ) ); + addCriteriaButton->setMaximumSize( TQSize( 30, 30 ) ); layout12->addWidget( addCriteriaButton ); #if 0 - removeCriteriaButton = new QPushButton( criterionFrame, "removeCriteriaButton" ); - removeCriteriaButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, removeCriteriaButton->sizePolicy().hasHeightForWidth() ) ); - removeCriteriaButton->setMaximumSize( QSize( 30, 30 ) ); + removeCriteriaButton = new TQPushButton( criterionFrame, "removeCriteriaButton" ); + removeCriteriaButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, removeCriteriaButton->sizePolicy().hasHeightForWidth() ) ); + removeCriteriaButton->setMaximumSize( TQSize( 30, 30 ) ); layout12->addWidget( removeCriteriaButton ); #endif criterionFrameLayout->addLayout( layout12 ); criteriaListView = new KListView( criterionFrame, "criteriaListView" ); - criteriaListView->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ); + criteriaListView->setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Minimum ); criteriaListView->addColumn( i18n( "Criterion" ) ); criteriaListView->addColumn( i18n( "Stars" ) ); criterionFrameLayout->addWidget( criteriaListView ); ratingButtonGroupLayout->addWidget( criterionFrame ); parametersFrameLayout->addWidget( ratingButtonGroup ); - ratingsFrameSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + ratingsFrameSpacer = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); parametersFrameLayout->addItem( ratingsFrameSpacer ); scrollView1->addChild( parametersFrame ); layout7->addWidget( scrollView1 ); - layout9 = new QHBoxLayout( 0, 0, 3, "layout9"); + layout9 = new TQHBoxLayout( 0, 0, 3, "layout9"); clearButton = new KPushButton( this, "clearButton" ); - clearButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, clearButton->sizePolicy().hasHeightForWidth() ) ); + clearButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, clearButton->sizePolicy().hasHeightForWidth() ) ); layout9->addWidget( clearButton ); - spacer3 = new QSpacerItem( 110, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + spacer3 = new TQSpacerItem( 110, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); layout9->addItem( spacer3 ); findButton = new KPushButton( this, "findButton" ); - findButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, findButton->sizePolicy().hasHeightForWidth() ) ); + findButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, findButton->sizePolicy().hasHeightForWidth() ) ); layout9->addWidget( findButton ); layout7->addLayout( layout9 ); AdvancedSearchDialogLayout->addLayout( layout7 ); resultsListView = new KListView( this, "resultsListView" ); - resultsListView->setSelectionMode( QListView::Extended ); - resultsListView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 1, resultsListView->sizePolicy().hasHeightForWidth() ) ); + resultsListView->setSelectionMode( TQListView::Extended ); + resultsListView->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 1, resultsListView->sizePolicy().hasHeightForWidth() ) ); AdvancedSearchDialogLayout->addWidget( resultsListView ); languageChange(); clearWState( WState_Polished ); @@ -451,13 +451,13 @@ AdvancedSearchDialog::AdvancedSearchDialog( QWidget *parent, RecipeDB *db ) : QW ///END OF AUTOMATICALLY GENERATED GUI CODE/// /// - resultsListView->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); - scrollView1->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ); + resultsListView->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred ); + scrollView1->setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Ignored ); AdvancedSearchDialogLayout->setStretchFactor( resultsListView, 2 ); - scrollView1->setHScrollBarMode( QScrollView::AlwaysOff ); - scrollView1->setResizePolicy( QScrollView::AutoOneFit ); + scrollView1->setHScrollBarMode( TQScrollView::AlwaysOff ); + scrollView1->setResizePolicy( TQScrollView::AutoOneFit ); KConfig *config = KGlobal::config(); config->setGroup( "Advanced" ); @@ -523,7 +523,7 @@ AdvancedSearchDialog::AdvancedSearchDialog( QWidget *parent, RecipeDB *db ) : QW ratingButtonGroup->setShown(false); connect( actionHandler, SIGNAL( recipeSelected( int, int ) ), SIGNAL( recipeSelected( int, int ) ) ); - connect( actionHandler, SIGNAL( recipesSelected( const QValueList &, int ) ), SIGNAL( recipesSelected( const QValueList &, int ) ) ); + connect( actionHandler, SIGNAL( recipesSelected( const TQValueList &, int ) ), SIGNAL( recipesSelected( const TQValueList &, int ) ) ); connect( database, SIGNAL( recipeRemoved( int ) ), SLOT( removeRecipe( int ) ) ); @@ -538,9 +538,9 @@ AdvancedSearchDialog::~AdvancedSearchDialog() void AdvancedSearchDialog::languageChange() { - titleButton->setText( QString("%1 >>").arg(i18n("Title")) ); + titleButton->setText( TQString("%1 >>").arg(i18n("Title")) ); textLabel1_4->setText( i18n( "Search using the following criteria:" ) ); - ingredientButton->setText( QString("%1 >>").arg(i18n("Ingredients")) ); + ingredientButton->setText( TQString("%1 >>").arg(i18n("Ingredients")) ); textLabel1_2->setText( i18n( "Uses any of:" ) ); textLabel1->setText( i18n( "Uses all:" ) ); textLabel1_3->setText( i18n( "Without:" ) ); @@ -548,25 +548,25 @@ void AdvancedSearchDialog::languageChange() textLabel1_5->setText( i18n( "In all:" ) ); textLabel1_3_3->setText( i18n( "Not in:" ) ); textLabel1_2_3->setText( i18n( "In any of:" ) ); - authorsButton->setText( QString("%1 >>").arg(i18n("Authors")) ); + authorsButton->setText( TQString("%1 >>").arg(i18n("Authors")) ); textLabel1_2_4->setText( i18n( "By any of:" ) ); textLabel1_6->setText( i18n( "By all:" ) ); textLabel1_3_4->setText( i18n( "Not by:" ) ); - servingsButton->setText( QString("%1 >>").arg(i18n("Yield")) ); + servingsButton->setText( TQString("%1 >>").arg(i18n("Yield")) ); enableServingsCheckBox->setText( i18n( "Enabled" ) ); servingsComboBox->clear(); servingsComboBox->insertItem( i18n( "Yields at least:" ) ); servingsComboBox->insertItem( i18n( "Yields at most:" ) ); servingsComboBox->insertItem( i18n( "Yields about:" ) ); - prepTimeButton->setText( QString("%1 >>").arg(i18n("Preparation Time")) ); + prepTimeButton->setText( TQString("%1 >>").arg(i18n("Preparation Time")) ); enablePrepTimeCheckBox->setText( i18n( "Enabled" ) ); prepTimeComboBox->clear(); prepTimeComboBox->insertItem( i18n( "Ready in at most:" ) ); prepTimeComboBox->insertItem( i18n( "Ready in about:" ) ); - instructionsButton->setText( QString("%1 >>").arg(i18n("Instructions")) ); - metaDataButton->setText( QString("%1 >>").arg(i18n("Meta Data")) ); + instructionsButton->setText( TQString("%1 >>").arg(i18n("Instructions")) ); + metaDataButton->setText( TQString("%1 >>").arg(i18n("Meta Data")) ); clearButton->setText( i18n( "C&lear" ) ); - clearButton->setAccel( QKeySequence( i18n( "Alt+L" ) ) ); + clearButton->setAccel( TQKeySequence( i18n( "Alt+L" ) ) ); findButton->setText( i18n( "&Search" ) ); ratingAvgRadioButton->setText( i18n( "By average:" ) ); avgStarsLabel->setText( i18n( "stars" ) ); @@ -575,12 +575,12 @@ void AdvancedSearchDialog::languageChange() //removeCriteriaButton->setText( i18n( "-" ) ); criteriaListView->header()->setLabel( 0, i18n( "Criteria" ) ); criteriaListView->header()->setLabel( 1, i18n( "Stars" ) ); - ratingsButton->setText( QString("%1 >>").arg(i18n("Ratings")) ); + ratingsButton->setText( TQString("%1 >>").arg(i18n("Ratings")) ); } void AdvancedSearchDialog::removeRecipe( int id ) { - QListViewItemIterator iterator( resultsListView ); + TQListViewItemIterator iterator( resultsListView ); while ( iterator.current() ) { if ( iterator.current()->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current(); @@ -606,15 +606,15 @@ void AdvancedSearchDialog::clear() titleEdit->clear(); instructionsEdit->clear(); - createdStartDateEdit->setDate( QDate() ); - createdEndDateEdit->setDate( QDate() ); - modifiedStartDateEdit->setDate( QDate() ); - modifiedEndDateEdit->setDate( QDate() ); - accessedStartDateEdit->setDate( QDate() ); - accessedEndDateEdit->setDate( QDate() ); + createdStartDateEdit->setDate( TQDate() ); + createdEndDateEdit->setDate( TQDate() ); + modifiedStartDateEdit->setDate( TQDate() ); + modifiedEndDateEdit->setDate( TQDate() ); + accessedStartDateEdit->setDate( TQDate() ); + accessedEndDateEdit->setDate( TQDate() ); servingsSpinBox->setValue( 1 ); - prepTimeEdit->setTime( QTime(0,0) ); + prepTimeEdit->setTime( TQTime(0,0) ); enablePrepTimeCheckBox->setChecked(false); enableServingsCheckBox->setChecked(false); @@ -647,12 +647,12 @@ void AdvancedSearchDialog::activateRatingOption( int button_id ) void AdvancedSearchDialog::buttonSwitched() { - const QObject *sent = sender(); + const TQObject *sent = sender(); - if ( sent->inherits("QPushButton") ) { - QPushButton *pushed = (QPushButton*) sent; + if ( sent->inherits("TQPushButton") ) { + TQPushButton *pushed = (TQPushButton*) sent; - QString suffix = ( pushed->state() == QButton::On ) ? " <<" : " >>"; + TQString suffix = ( pushed->state() == TQButton::On ) ? " <<" : " >>"; pushed->setText( pushed->text().left( pushed->text().length() - 3 ) + suffix ); } } @@ -717,19 +717,19 @@ void AdvancedSearchDialog::search() */ START_TIMER("Further narrowing the search (no SQL)"); - QStringList items = split(authorsAllEdit->text()); - for ( QStringList::const_iterator author_it = items.begin(); author_it != items.end(); ++author_it ) { + TQStringList items = split(authorsAllEdit->text()); + for ( TQStringList::const_iterator author_it = items.begin(); author_it != items.end(); ++author_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).authorList.findByName( QRegExp(*author_it,false, true) ).id == -1 ) { + if ( ( *it ).authorList.findByName( TQRegExp(*author_it,false, true) ).id == -1 ) { it = allRecipes.remove( it ); it--; } } } items = split(authorsWithoutEdit->text()); - for ( QStringList::const_iterator author_it = items.begin(); author_it != items.end(); ++author_it ) { + for ( TQStringList::const_iterator author_it = items.begin(); author_it != items.end(); ++author_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).authorList.findByName( QRegExp(*author_it,false,true) ).id != -1 ) { + if ( ( *it ).authorList.findByName( TQRegExp(*author_it,false,true) ).id != -1 ) { it = allRecipes.remove( it ); it--; } @@ -738,18 +738,18 @@ void AdvancedSearchDialog::search() //narrow down by categories items = split(categoriesAllEdit->text()); - for ( QStringList::const_iterator cat_it = items.begin(); cat_it != items.end(); ++cat_it ) { + for ( TQStringList::const_iterator cat_it = items.begin(); cat_it != items.end(); ++cat_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).categoryList.findByName( QRegExp(*cat_it,false,true) ).id == -1 ) { + if ( ( *it ).categoryList.findByName( TQRegExp(*cat_it,false,true) ).id == -1 ) { it = allRecipes.remove( it ); it--; } } } items = split(categoriesNotEdit->text()); - for ( QStringList::const_iterator cat_it = items.begin(); cat_it != items.end(); ++cat_it ) { + for ( TQStringList::const_iterator cat_it = items.begin(); cat_it != items.end(); ++cat_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).categoryList.findByName( QRegExp(*cat_it,false,true) ).id != -1 ) { + if ( ( *it ).categoryList.findByName( TQRegExp(*cat_it,false,true) ).id != -1 ) { it = allRecipes.remove( it ); it--; } @@ -758,18 +758,18 @@ void AdvancedSearchDialog::search() //narrow down by ingredients items = split(ingredientsAllEdit->text()); - for ( QStringList::const_iterator ing_it = items.begin(); ing_it != items.end(); ++ing_it ) { + for ( TQStringList::const_iterator ing_it = items.begin(); ing_it != items.end(); ++ing_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).ingList.findByName( QRegExp(*ing_it,false,true) ).ingredientID == -1 ) { + if ( ( *it ).ingList.findByName( TQRegExp(*ing_it,false,true) ).ingredientID == -1 ) { it = allRecipes.remove( it ); it--; } } } items = split(ingredientsWithoutEdit->text()); - for ( QStringList::const_iterator ing_it = items.begin(); ing_it != items.end(); ++ing_it ) { + for ( TQStringList::const_iterator ing_it = items.begin(); ing_it != items.end(); ++ing_it ) { for ( RecipeList::iterator it = allRecipes.begin(); it != allRecipes.end(); ++it ) { - if ( ( *it ).ingList.findByName( QRegExp(*ing_it,false,true) ).ingredientID != -1 ) { + if ( ( *it ).ingList.findByName( TQRegExp(*ing_it,false,true) ).ingredientID != -1 ) { it = allRecipes.remove( it ); it--; } @@ -815,24 +815,24 @@ void AdvancedSearchDialog::search() //TODO: Clean this up and/or do it more efficiently if ( criterionRadioButton->isChecked() && criteriaListView->firstChild() ) { for ( RecipeList::iterator recipe_it = allRecipes.begin(); recipe_it != allRecipes.end(); ++recipe_it ) { - QMap< int, double > idSumMap; - QMap< int, int > idCountMap; + TQMap< int, double > idSumMap; + TQMap< int, int > idCountMap; for ( RatingList::const_iterator rating_it = (*recipe_it).ratingList.begin(); rating_it != (*recipe_it).ratingList.end(); ++rating_it ) { for ( RatingCriteriaList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { - QMap< int, double >::iterator sum_it = idSumMap.find((*rc_it).id); + TQMap< int, double >::iterator sum_it = idSumMap.find((*rc_it).id); if ( sum_it == idSumMap.end() ) sum_it = idSumMap.insert((*rc_it).id,0); (*sum_it) += (*rc_it).stars; - QMap< int, int >::iterator count_it = idCountMap.find((*rc_it).id); + TQMap< int, int >::iterator count_it = idCountMap.find((*rc_it).id); if ( count_it == idCountMap.end() ) count_it = idCountMap.insert((*rc_it).id,0); (*count_it)++; } } - for ( QListViewItem *item = criteriaListView->firstChild(); item; item = item->nextSibling() ) { + for ( TQListViewItem *item = criteriaListView->firstChild(); item; item = item->nextSibling() ) { Ingredient i; i.setAmount( item->text(1) ); double stars = i.amount; double stars_offset = i.amount_offset; @@ -845,9 +845,9 @@ void AdvancedSearchDialog::search() int id = item->text(2).toInt(); - QMap< int, double >::iterator sum_it = idSumMap.find(id); + TQMap< int, double >::iterator sum_it = idSumMap.find(id); if ( sum_it != idSumMap.end() ) { - QMap< int, int >::iterator count_it = idCountMap.find(id); + TQMap< int, int >::iterator count_it = idCountMap.find(id); double average = (*sum_it)/(*count_it); if ( average < stars || average > stars + stars_offset ) { @@ -874,29 +874,29 @@ void AdvancedSearchDialog::search() } if ( !resultsListView->firstChild() ) { - ( void ) new QListViewItem( resultsListView, "--- "+i18n("No matching recipes found")+" ---"); + ( void ) new TQListViewItem( resultsListView, "--- "+i18n("No matching recipes found")+" ---"); } KApplication::restoreOverrideCursor(); } -QStringList AdvancedSearchDialog::split( const QString &text, bool sql_wildcards ) const +TQStringList AdvancedSearchDialog::split( const TQString &text, bool sql_wildcards ) const { - QStringList result; + TQStringList result; // To keep quoted words together, first split on quotes, // and then split again on the even numbered items - QStringList temp = QStringList::split('"',text,true); + TQStringList temp = TQStringList::split('"',text,true); for ( uint i = 0; i < temp.count(); ++i ) { if ( i & 1 ) //odd result += temp[i].stripWhiteSpace(); else //even - result += QStringList::split(' ',temp[i]); + result += TQStringList::split(' ',temp[i]); } if ( sql_wildcards ) { - for ( QStringList::iterator it = result.begin(); it != result.end(); ++it ) { + for ( TQStringList::iterator it = result.begin(); it != result.end(); ++it ) { (*it).replace("%","\\%"); (*it).replace("_","\\_"); @@ -910,19 +910,19 @@ QStringList AdvancedSearchDialog::split( const QString &text, bool sql_wildcards void AdvancedSearchDialog::slotAddRatingCriteria() { - QListViewItem * it = new QListViewItem(criteriaListView,criteriaComboBox->currentText()); + TQListViewItem * it = new TQListViewItem(criteriaListView,criteriaComboBox->currentText()); MixedNumber stars; double stars_offset; starsWidget->value(stars,stars_offset); - QString stars_str = stars.toString(); + TQString stars_str = stars.toString(); if ( stars_offset > 0 ) stars_str += "-"+MixedNumber( stars + stars_offset ).toString(); else if ( stars.toDouble() <= 1e-10 ) stars_str = ""; it->setText(1,stars_str); - it->setText(2,QString::number(criteriaComboBox->criteriaID(criteriaComboBox->currentItem()))); + it->setText(2,TQString::number(criteriaComboBox->criteriaID(criteriaComboBox->currentItem()))); } void AdvancedSearchDialog::slotRemoveRatingCriteria() diff --git a/krecipes/src/dialogs/advancedsearchdialog.h b/krecipes/src/dialogs/advancedsearchdialog.h index e6e88df..afb9244 100644 --- a/krecipes/src/dialogs/advancedsearchdialog.h +++ b/krecipes/src/dialogs/advancedsearchdialog.h @@ -11,26 +11,26 @@ #ifndef ADVANCEDSEARCHDIALOG_H #define ADVANCEDSEARCHDIALOG_H -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QScrollView; -class QPushButton; -class QFrame; -class QLineEdit; -class QLabel; -class QCheckBox; -class QComboBox; -class QSpinBox; -class QTimeEdit; +#include + +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQScrollView; +class TQPushButton; +class TQFrame; +class TQLineEdit; +class TQLabel; +class TQCheckBox; +class TQComboBox; +class TQSpinBox; +class TQTimeEdit; class KPushButton; class KListView; -class QListViewItem; -class QRadioButton; -class QButtonGroup; +class TQListViewItem; +class TQRadioButton; +class TQButtonGroup; class KDateEdit; class RecipeDB; @@ -39,12 +39,12 @@ class FractionInput; class CriteriaComboBox; -class AdvancedSearchDialog : public QWidget +class AdvancedSearchDialog : public TQWidget { Q_OBJECT public: - AdvancedSearchDialog( QWidget *parent, RecipeDB * ); + AdvancedSearchDialog( TQWidget *parent, RecipeDB * ); ~AdvancedSearchDialog(); virtual void languageChange(); @@ -52,113 +52,113 @@ public: RecipeActionsHandler *actionHandler; protected: - QLabel* textLabel1_4; - QScrollView* scrollView1; - QFrame* parametersFrame; - QLineEdit* titleEdit; - QPushButton* titleButton; - QFrame* titleFrame; - QPushButton* ingredientButton; - QFrame* ingredientFrame; - QLineEdit* ingredientsAllEdit; - QLineEdit* ingredientsAnyEdit; - QLabel* textLabel1_2; - QLabel* textLabel1; - QLineEdit* ingredientsWithoutEdit; - QLabel* textLabel1_3; - QPushButton* categoriesButton; - QFrame* categoryFrame; - QLineEdit* categoriesAllEdit; - QLabel* textLabel1_5; - QLabel* textLabel1_3_3; - QLineEdit* categoriesAnyEdit; - QLabel* textLabel1_2_3; - QLineEdit* categoriesNotEdit; - QPushButton* authorsButton; - QFrame* authorsFrame; - QLabel* textLabel1_2_4; - QLabel* textLabel1_6; - QLabel* textLabel1_3_4; - QLineEdit* authorsAnyEdit; - QLineEdit* authorsAllEdit; - QLineEdit* authorsWithoutEdit; - QPushButton* servingsButton; - QFrame* servingsFrame; - QCheckBox* enableServingsCheckBox; - QComboBox* servingsComboBox; - QSpinBox* servingsSpinBox; - QPushButton* prepTimeButton; - QFrame* prepTimeFrame; - QCheckBox* enablePrepTimeCheckBox; - QComboBox* prepTimeComboBox; - QTimeEdit* prepTimeEdit; - QLineEdit* instructionsEdit; - QPushButton* instructionsButton; - QFrame* instructionsFrame; + TQLabel* textLabel1_4; + TQScrollView* scrollView1; + TQFrame* parametersFrame; + TQLineEdit* titleEdit; + TQPushButton* titleButton; + TQFrame* titleFrame; + TQPushButton* ingredientButton; + TQFrame* ingredientFrame; + TQLineEdit* ingredientsAllEdit; + TQLineEdit* ingredientsAnyEdit; + TQLabel* textLabel1_2; + TQLabel* textLabel1; + TQLineEdit* ingredientsWithoutEdit; + TQLabel* textLabel1_3; + TQPushButton* categoriesButton; + TQFrame* categoryFrame; + TQLineEdit* categoriesAllEdit; + TQLabel* textLabel1_5; + TQLabel* textLabel1_3_3; + TQLineEdit* categoriesAnyEdit; + TQLabel* textLabel1_2_3; + TQLineEdit* categoriesNotEdit; + TQPushButton* authorsButton; + TQFrame* authorsFrame; + TQLabel* textLabel1_2_4; + TQLabel* textLabel1_6; + TQLabel* textLabel1_3_4; + TQLineEdit* authorsAnyEdit; + TQLineEdit* authorsAllEdit; + TQLineEdit* authorsWithoutEdit; + TQPushButton* servingsButton; + TQFrame* servingsFrame; + TQCheckBox* enableServingsCheckBox; + TQComboBox* servingsComboBox; + TQSpinBox* servingsSpinBox; + TQPushButton* prepTimeButton; + TQFrame* prepTimeFrame; + TQCheckBox* enablePrepTimeCheckBox; + TQComboBox* prepTimeComboBox; + TQTimeEdit* prepTimeEdit; + TQLineEdit* instructionsEdit; + TQPushButton* instructionsButton; + TQFrame* instructionsFrame; KPushButton* clearButton; KPushButton* findButton; KListView* resultsListView; - QCheckBox *requireAllTitle; - QCheckBox *requireAllInstructions; + TQCheckBox *requireAllTitle; + TQCheckBox *requireAllInstructions; KDateEdit *createdStartDateEdit; KDateEdit *createdEndDateEdit; KDateEdit *modifiedStartDateEdit; KDateEdit *modifiedEndDateEdit; KDateEdit *accessedStartDateEdit; KDateEdit *accessedEndDateEdit; - QPushButton* metaDataButton; - QFrame* metaDataFrame; - QRadioButton* ratingAvgRadioButton; + TQPushButton* metaDataButton; + TQFrame* metaDataFrame; + TQRadioButton* ratingAvgRadioButton; FractionInput* avgStarsEdit; - QLabel* avgStarsLabel; - QRadioButton* criterionRadioButton; + TQLabel* avgStarsLabel; + TQRadioButton* criterionRadioButton; CriteriaComboBox* criteriaComboBox; FractionInput* starsWidget; - QPushButton* addCriteriaButton; - QPushButton* removeCriteriaButton; + TQPushButton* addCriteriaButton; + TQPushButton* removeCriteriaButton; KListView* criteriaListView; - QPushButton* ratingsButton; - QButtonGroup *ratingButtonGroup; - QFrame *ratingAvgFrame; - QFrame *criterionFrame; - QVBoxLayout *criterionFrameLayout; - QHBoxLayout *ratingAvgFrameLayout; - QVBoxLayout *ratingButtonGroupLayout; - - QHBoxLayout* AdvancedSearchDialogLayout; - QVBoxLayout* layout7; - QHBoxLayout* scrollView1Layout; - QVBoxLayout* parametersFrameLayout; - QSpacerItem* spacer3_2_3_2_2; - QSpacerItem* spacer3_2_3_2; - QSpacerItem* spacer3_2_3; - QSpacerItem* spacer3_2_2; - QSpacerItem* titleFrameSpacer; - QSpacerItem* instructionsFrameSpacer; - QSpacerItem* metaDataFrameSpacer; - QSpacerItem* spacer15; - QVBoxLayout* titleFrameLayout; - QGridLayout* ingredientFrameLayout; - QGridLayout* categoryFrameLayout; - QGridLayout* authorsFrameLayout; - QVBoxLayout* servingsFrameLayout; - QHBoxLayout* layout5; - QVBoxLayout* prepTimeFrameLayout; - QVBoxLayout* instructionsFrameLayout; - QVBoxLayout* metaDataFrameLayout; - QHBoxLayout* layout6; - QHBoxLayout* layout9; - QSpacerItem* spacer3; - QVBoxLayout* ratingsFrameLayout; - QHBoxLayout* layout11; - QHBoxLayout* layout12; - QSpacerItem* ratingsFrameSpacer; + TQPushButton* ratingsButton; + TQButtonGroup *ratingButtonGroup; + TQFrame *ratingAvgFrame; + TQFrame *criterionFrame; + TQVBoxLayout *criterionFrameLayout; + TQHBoxLayout *ratingAvgFrameLayout; + TQVBoxLayout *ratingButtonGroupLayout; + + TQHBoxLayout* AdvancedSearchDialogLayout; + TQVBoxLayout* layout7; + TQHBoxLayout* scrollView1Layout; + TQVBoxLayout* parametersFrameLayout; + TQSpacerItem* spacer3_2_3_2_2; + TQSpacerItem* spacer3_2_3_2; + TQSpacerItem* spacer3_2_3; + TQSpacerItem* spacer3_2_2; + TQSpacerItem* titleFrameSpacer; + TQSpacerItem* instructionsFrameSpacer; + TQSpacerItem* metaDataFrameSpacer; + TQSpacerItem* spacer15; + TQVBoxLayout* titleFrameLayout; + TQGridLayout* ingredientFrameLayout; + TQGridLayout* categoryFrameLayout; + TQGridLayout* authorsFrameLayout; + TQVBoxLayout* servingsFrameLayout; + TQHBoxLayout* layout5; + TQVBoxLayout* prepTimeFrameLayout; + TQVBoxLayout* instructionsFrameLayout; + TQVBoxLayout* metaDataFrameLayout; + TQHBoxLayout* layout6; + TQHBoxLayout* layout9; + TQSpacerItem* spacer3; + TQVBoxLayout* ratingsFrameLayout; + TQHBoxLayout* layout11; + TQHBoxLayout* layout12; + TQSpacerItem* ratingsFrameSpacer; RecipeDB *database; signals: void recipeSelected( int, int ); - void recipesSelected( const QValueList &, int ); + void recipesSelected( const TQValueList &, int ); private slots: void search(); @@ -172,7 +172,7 @@ private slots: void removeRecipe( int id ); private: - QStringList split( const QString &text, bool sql_wildcards = false ) const; + TQStringList split( const TQString &text, bool sql_wildcards = false ) const; }; #endif //ADVANCEDSEARCHDIALOG_H diff --git a/krecipes/src/dialogs/authorsdialog.cpp b/krecipes/src/dialogs/authorsdialog.cpp index 8015f3f..1622dfa 100644 --- a/krecipes/src/dialogs/authorsdialog.cpp +++ b/krecipes/src/dialogs/authorsdialog.cpp @@ -19,27 +19,27 @@ #include #include -AuthorsDialog::AuthorsDialog( QWidget* parent, RecipeDB *db ) : QWidget( parent ) +AuthorsDialog::AuthorsDialog( TQWidget* parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database database = db; - QHBoxLayout* layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); //Author List authorListView = new StdAuthorListView( this, database, true ); layout->addWidget( authorListView ); //Buttons - QVBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); + TQVBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); - newAuthorButton = new QPushButton( this ); + newAuthorButton = new TQPushButton( this ); newAuthorButton->setText( i18n( "Create ..." ) ); newAuthorButton->setFlat( true ); vboxl->addWidget( newAuthorButton ); - removeAuthorButton = new QPushButton( this ); + removeAuthorButton = new TQPushButton( this ); removeAuthorButton->setText( i18n( "Delete" ) ); removeAuthorButton->setFlat( true ); vboxl->addWidget( removeAuthorButton ); diff --git a/krecipes/src/dialogs/authorsdialog.h b/krecipes/src/dialogs/authorsdialog.h index c7026cc..9e4cae9 100644 --- a/krecipes/src/dialogs/authorsdialog.h +++ b/krecipes/src/dialogs/authorsdialog.h @@ -13,10 +13,10 @@ #ifndef AUTHORSDIALOG_H #define AUTHORSDIALOG_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -29,14 +29,14 @@ class StdAuthorListView; @author Unai Garro */ -class AuthorsDialog: public QWidget +class AuthorsDialog: public TQWidget { Q_OBJECT public: - AuthorsDialog( QWidget* parent, RecipeDB *db ); + AuthorsDialog( TQWidget* parent, RecipeDB *db ); ~AuthorsDialog(); void reload( ReloadFlags flag = Load ); private: @@ -44,8 +44,8 @@ private: RecipeDB *database; //Widgets StdAuthorListView *authorListView; - QPushButton *newAuthorButton; - QPushButton *removeAuthorButton; + TQPushButton *newAuthorButton; + TQPushButton *removeAuthorButton; KIconLoader *il; }; #endif diff --git a/krecipes/src/dialogs/borderdialog.cpp b/krecipes/src/dialogs/borderdialog.cpp index c3d8971..ee86575 100644 --- a/krecipes/src/dialogs/borderdialog.cpp +++ b/krecipes/src/dialogs/borderdialog.cpp @@ -10,14 +10,14 @@ #include "borderdialog.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -27,37 +27,37 @@ #include "datablocks/kreborder.h" -BorderDialog::BorderDialog( const KreBorder &border, QWidget* parent, const char* name ) - : KDialogBase( parent, name, true, QString::null, +BorderDialog::BorderDialog( const KreBorder &border, TQWidget* parent, const char* name ) + : KDialogBase( parent, name, true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - borderGroupBox = new QGroupBox( page, "borderGroupBox" ); - borderGroupBox->setColumnLayout( 0, Qt::Vertical ); + borderGroupBox = new TQGroupBox( page, "borderGroupBox" ); + borderGroupBox->setColumnLayout( 0, TQt::Vertical ); borderGroupBox->layout() ->setSpacing( 6 ); borderGroupBox->layout() ->setMargin( 11 ); - borderGroupBoxLayout = new QVBoxLayout( borderGroupBox->layout() ); - borderGroupBoxLayout->setAlignment( Qt::AlignTop ); + borderGroupBoxLayout = new TQVBoxLayout( borderGroupBox->layout() ); + borderGroupBoxLayout->setAlignment( TQt::AlignTop ); - layout4 = new QHBoxLayout( 0, 0, 6, "layout4" ); + layout4 = new TQHBoxLayout( 0, 0, 6, "layout4" ); - layout3 = new QVBoxLayout( 0, 0, 6, "layout3" ); + layout3 = new TQVBoxLayout( 0, 0, 6, "layout3" ); - styleLabel = new QLabel( borderGroupBox, "styleLabel" ); + styleLabel = new TQLabel( borderGroupBox, "styleLabel" ); layout3->addWidget( styleLabel ); styleListBox = new KListBox( borderGroupBox, "styleListBox" ); layout3->addWidget( styleListBox ); layout4->addLayout( layout3 ); - layout2 = new QVBoxLayout( 0, 0, 6, "layout2" ); + layout2 = new TQVBoxLayout( 0, 0, 6, "layout2" ); - colorLabel = new QLabel( borderGroupBox, "colorLabel" ); + colorLabel = new TQLabel( borderGroupBox, "colorLabel" ); layout2->addWidget( colorLabel ); - QHBox *color_hbox = new QHBox( borderGroupBox ); - color_hbox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); + TQHBox *color_hbox = new TQHBox( borderGroupBox ); + color_hbox->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ); hsSelector = new KHSSelector( color_hbox ); hsSelector->setMinimumSize( 140, 70 ); connect( hsSelector, SIGNAL( valueChanged( int, int ) ), SLOT( slotHSChanged( int, int ) ) ); @@ -69,12 +69,12 @@ BorderDialog::BorderDialog( const KreBorder &border, QWidget* parent, const char layout2->addWidget( color_hbox ); layout4->addLayout( layout2 ); - layout1 = new QVBoxLayout( 0, 0, 6, "layout1" ); + layout1 = new TQVBoxLayout( 0, 0, 6, "layout1" ); - widthLabel = new QLabel( borderGroupBox, "widthLabel" ); + widthLabel = new TQLabel( borderGroupBox, "widthLabel" ); layout1->addWidget( widthLabel ); - widthSpinBox = new QSpinBox( borderGroupBox, "widthSpinBox" ); + widthSpinBox = new TQSpinBox( borderGroupBox, "widthSpinBox" ); widthSpinBox->setMinValue( 1 ); layout1->addWidget( widthSpinBox ); @@ -84,7 +84,7 @@ BorderDialog::BorderDialog( const KreBorder &border, QWidget* parent, const char borderGroupBoxLayout->addLayout( layout4 ); borderPreview = new KHTMLPart( borderGroupBox ); - borderPreview->view() ->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + borderPreview->view() ->setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Fixed ); borderGroupBoxLayout->addWidget( borderPreview->view() ); languageChange(); @@ -114,7 +114,7 @@ KreBorder BorderDialog::border() const { int width = widthSpinBox->value(); - QString style; + TQString style; switch ( styleListBox->currentItem() ) { case 0: style = "none"; @@ -202,7 +202,7 @@ void BorderDialog::updatePreview() { KreBorder b( border() ); - QString html_str = QString( "

%4

" ).arg( b.width ).arg( b.style ).arg( b.color.name() ).arg( i18n( "Border Preview" ) ); + TQString html_str = TQString( "

%4

" ).arg( b.width ).arg( b.style ).arg( b.color.name() ).arg( i18n( "Border Preview" ) ); borderPreview->begin(); borderPreview->write( html_str ); diff --git a/krecipes/src/dialogs/borderdialog.h b/krecipes/src/dialogs/borderdialog.h index 2b35f01..7ea169f 100644 --- a/krecipes/src/dialogs/borderdialog.h +++ b/krecipes/src/dialogs/borderdialog.h @@ -14,15 +14,15 @@ #include #include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QGroupBox; -class QLabel; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQGroupBox; +class TQLabel; class KListBox; -class QListBoxItem; -class QSpinBox; +class TQListBoxItem; +class TQSpinBox; class KHTMLPart; class KreBorder; @@ -32,28 +32,28 @@ class BorderDialog : public KDialogBase Q_OBJECT public: - BorderDialog( const KreBorder &border, QWidget* parent = 0, const char* name = 0 ); + BorderDialog( const KreBorder &border, TQWidget* parent = 0, const char* name = 0 ); ~BorderDialog(); KreBorder border() const; - QGroupBox* borderGroupBox; - QLabel* styleLabel; + TQGroupBox* borderGroupBox; + TQLabel* styleLabel; KListBox* styleListBox; - QLabel* colorLabel; + TQLabel* colorLabel; KHSSelector* hsSelector; KValueSelector* valuePal; - QLabel* widthLabel; - QSpinBox* widthSpinBox; + TQLabel* widthLabel; + TQSpinBox* widthSpinBox; KListBox* widthListBox; KHTMLPart* borderPreview; protected: - QVBoxLayout* borderGroupBoxLayout; - QHBoxLayout* layout4; - QVBoxLayout* layout3; - QVBoxLayout* layout2; - QVBoxLayout* layout1; + TQVBoxLayout* borderGroupBoxLayout; + TQHBoxLayout* layout4; + TQVBoxLayout* layout3; + TQVBoxLayout* layout2; + TQVBoxLayout* layout1; protected slots: virtual void languageChange(); diff --git a/krecipes/src/dialogs/categorieseditordialog.cpp b/krecipes/src/dialogs/categorieseditordialog.cpp index 4c767a6..d4d7195 100644 --- a/krecipes/src/dialogs/categorieseditordialog.cpp +++ b/krecipes/src/dialogs/categorieseditordialog.cpp @@ -21,27 +21,27 @@ #include "createcategorydialog.h" #include "backends/recipedb.h" -CategoriesEditorDialog::CategoriesEditorDialog( QWidget* parent, RecipeDB *db ) : QWidget( parent ) +CategoriesEditorDialog::CategoriesEditorDialog( TQWidget* parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database database = db; - QHBoxLayout* layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); //Category List categoryListView = new StdCategoryListView( this, database, true ); layout->addWidget( categoryListView ); //Buttons - QVBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); + TQVBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); - newCategoryButton = new QPushButton( this ); + newCategoryButton = new TQPushButton( this ); newCategoryButton->setText( i18n( "Create ..." ) ); newCategoryButton->setFlat( true ); vboxl->addWidget( newCategoryButton ); - removeCategoryButton = new QPushButton( this ); + removeCategoryButton = new TQPushButton( this ); removeCategoryButton->setText( i18n( "Delete" ) ); removeCategoryButton->setFlat( true ); vboxl->addWidget( removeCategoryButton ); diff --git a/krecipes/src/dialogs/categorieseditordialog.h b/krecipes/src/dialogs/categorieseditordialog.h index 6b8ced9..58bcc7f 100644 --- a/krecipes/src/dialogs/categorieseditordialog.h +++ b/krecipes/src/dialogs/categorieseditordialog.h @@ -13,10 +13,10 @@ #ifndef CATEGORIESEDITORDIALOG_H #define CATEGORIESEDITORDIALOG_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -29,14 +29,14 @@ class StdCategoryListView; /** @author Unai Garro */ -class CategoriesEditorDialog: public QWidget +class CategoriesEditorDialog: public TQWidget { Q_OBJECT public: - CategoriesEditorDialog( QWidget* parent, RecipeDB *db ); + CategoriesEditorDialog( TQWidget* parent, RecipeDB *db ); ~CategoriesEditorDialog(); void reload( ReloadFlags flag = Load ); @@ -45,11 +45,11 @@ private: // Internal data RecipeDB *database; //Widgets - QGridLayout *layout; + TQGridLayout *layout; StdCategoryListView *categoryListView; - QHBox *buttonBar; - QPushButton *newCategoryButton; - QPushButton *removeCategoryButton; + TQHBox *buttonBar; + TQPushButton *newCategoryButton; + TQPushButton *removeCategoryButton; KIconLoader *il; }; diff --git a/krecipes/src/dialogs/conversiondialog.cpp b/krecipes/src/dialogs/conversiondialog.cpp index 7746a43..78edc09 100644 --- a/krecipes/src/dialogs/conversiondialog.cpp +++ b/krecipes/src/dialogs/conversiondialog.cpp @@ -10,15 +10,15 @@ #include "conversiondialog.h" -#include -#include +#include +#include #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -30,7 +30,7 @@ #include "widgets/prepmethodcombobox.h" #include "widgets/fractioninput.h" -ConversionDialog::ConversionDialog( QWidget* parent, RecipeDB *db, const char* name ) +ConversionDialog::ConversionDialog( TQWidget* parent, RecipeDB *db, const char* name ) : KDialogBase( parent, name, false, i18n( "Measurement Converter" ), KDialogBase::Close | KDialogBase::User1 | KDialogBase::Help, KDialogBase::Close ), m_database(db) @@ -40,12 +40,12 @@ ConversionDialog::ConversionDialog( QWidget* parent, RecipeDB *db, const char* n setSizeGripEnabled( TRUE ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - QHBox *vbox = new QVBox(page); + TQHBox *vbox = new TQVBox(page); - QHBox *fromTopBox = new QHBox(vbox); - convertLabel = new QLabel( fromTopBox, "convertLabel" ); + TQHBox *fromTopBox = new TQHBox(vbox); + convertLabel = new TQLabel( fromTopBox, "convertLabel" ); amountEdit = new FractionInput( fromTopBox ); @@ -54,7 +54,7 @@ ConversionDialog::ConversionDialog( QWidget* parent, RecipeDB *db, const char* n fromTopBox->setStretchFactor( fromUnitBox, 2 ); fromTopBox->setSpacing(3); - QHBox *fromBottomBox = new QHBox(vbox); + TQHBox *fromBottomBox = new TQHBox(vbox); ingredientBox = new IngredientComboBox( FALSE, fromBottomBox, db, i18n( "--Ingredient (optional)--" ) ); ingredientBox->reload(); @@ -63,23 +63,23 @@ ConversionDialog::ConversionDialog( QWidget* parent, RecipeDB *db, const char* n prepMethodBox->reload(); fromBottomBox->setSpacing(3); - QHBox *toBox = new QHBox(vbox); + TQHBox *toBox = new TQHBox(vbox); - toLabel = new QLabel( toBox, "toLabel" ); + toLabel = new TQLabel( toBox, "toLabel" ); toUnitBox = new UnitComboBox( toBox, db ); toUnitBox->reload(); toBox->setStretchFactor( toUnitBox, 2 ); toBox->setSpacing(8); - QHBox *resultBox = new QHBox(vbox); - resultLabel = new QLabel( resultBox, "resultLabel" ); - resultText = new QLabel( resultBox, "resultText" ); + TQHBox *resultBox = new TQHBox(vbox); + resultLabel = new TQLabel( resultBox, "resultLabel" ); + resultText = new TQLabel( resultBox, "resultText" ); resultBox->setStretchFactor( resultText, 2 ); languageChange(); - setInitialSize( QSize(300, 200).expandedTo(minimumSizeHint()) ); + setInitialSize( TQSize(300, 200).expandedTo(minimumSizeHint()) ); // signals and slots connections connect ( this, SIGNAL( closeClicked() ), this, SLOT( accept() ) ); @@ -94,7 +94,7 @@ void ConversionDialog::languageChange() convertLabel->setText( i18n( "Convert" ) ); toLabel->setText( i18n( "To" ) ); resultLabel->setText( i18n( "Result:" ) ); - resultText->setText( QString::null ); + resultText->setText( TQString::null ); } void ConversionDialog::show() @@ -105,7 +105,7 @@ void ConversionDialog::show() void ConversionDialog::reset() { - resultText->setText( QString::null ); + resultText->setText( TQString::null ); ingredientBox->setCurrentItem( 0 ); prepMethodBox->setCurrentItem( 0 ); toUnitBox->setCurrentItem( 0 ); @@ -129,16 +129,16 @@ void ConversionDialog::convert() int prepID = prepMethodBox->id(prepMethodBox->currentItem()); if ( prepID != -1 ) - ing.prepMethodList.append(Element(QString::null,prepID)); + ing.prepMethodList.append(Element(TQString::null,prepID)); switch ( m_database->convertIngredientUnits( ing, unit, result ) ) { case RecipeDB::Success: resultLabel->setText( i18n( "Result:" ) ); - resultText->setText(QString::number(result.amount)+" "+((result.amount>1)?result.units.plural:result.units.name)); + resultText->setText(TQString::number(result.amount)+" "+((result.amount>1)?result.units.plural:result.units.name)); break; case RecipeDB::MismatchedPrepMethodUsingApprox: resultLabel->setText( i18n( "Approximated result:" ) ); - resultText->setText(QString::number(result.amount)+" "+((result.amount>1)?result.units.plural:result.units.name)); + resultText->setText(TQString::number(result.amount)+" "+((result.amount>1)?result.units.plural:result.units.name)); break; case RecipeDB::MissingUnitConversion: resultLabel->setText( i18n( "Error:" ) ); diff --git a/krecipes/src/dialogs/conversiondialog.h b/krecipes/src/dialogs/conversiondialog.h index e48769b..5cde864 100644 --- a/krecipes/src/dialogs/conversiondialog.h +++ b/krecipes/src/dialogs/conversiondialog.h @@ -13,14 +13,14 @@ #include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; class KComboBox; -class QLabel; +class TQLabel; class KLineEdit; -class QPushButton; +class TQPushButton; class RecipeDB; class UnitComboBox; @@ -33,7 +33,7 @@ class ConversionDialog : public KDialogBase Q_OBJECT public: - ConversionDialog( QWidget* parent, RecipeDB *, const char* name = 0 ); + ConversionDialog( TQWidget* parent, RecipeDB *, const char* name = 0 ); ~ConversionDialog(); virtual void show(); @@ -42,13 +42,13 @@ public: protected: IngredientComboBox* ingredientBox; PrepMethodComboBox* prepMethodBox; - QLabel* convertLabel; + TQLabel* convertLabel; UnitComboBox* toUnitBox; UnitComboBox* fromUnitBox; FractionInput* amountEdit; - QLabel* toLabel; - QLabel* resultLabel; - QLabel* resultText; + TQLabel* toLabel; + TQLabel* resultLabel; + TQLabel* resultText; protected slots: virtual void languageChange(); diff --git a/krecipes/src/dialogs/createcategorydialog.cpp b/krecipes/src/dialogs/createcategorydialog.cpp index fe1cb91..d871fd9 100644 --- a/krecipes/src/dialogs/createcategorydialog.cpp +++ b/krecipes/src/dialogs/createcategorydialog.cpp @@ -12,35 +12,35 @@ #include "createcategorydialog.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include -CreateCategoryDialog::CreateCategoryDialog( QWidget *parent, const ElementList& categories ) +CreateCategoryDialog::CreateCategoryDialog( TQWidget *parent, const ElementList& categories ) : KDialogBase( parent, "createCategoryDialog", true, i18n( "New Category" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); - box->setColumnLayout( 0, Qt::Vertical ); + box = new TQGroupBox( page ); + box->setColumnLayout( 0, TQt::Vertical ); box->layout() ->setSpacing( 6 ); box->layout() ->setMargin( 11 ); - QVBoxLayout *boxLayout = new QVBoxLayout( box->layout() ); - boxLayout->setAlignment( Qt::AlignTop ); + TQVBoxLayout *boxLayout = new TQVBoxLayout( box->layout() ); + boxLayout->setAlignment( TQt::AlignTop ); box->setTitle( i18n( "New Category" ) ); elementEdit = new KLineEdit( box ); boxLayout->addWidget( elementEdit ); - QHBox *subcatHBox = new QHBox( box ); - ( void ) new QLabel( i18n( "Subcategory of:" ), subcatHBox ); + TQHBox *subcatHBox = new TQHBox( box ); + ( void ) new TQLabel( i18n( "Subcategory of:" ), subcatHBox ); categoryComboBox = new KComboBox( subcatHBox ); boxLayout->addWidget( subcatHBox ); loadCategories( categories ); @@ -64,7 +64,7 @@ void CreateCategoryDialog::loadCategories( const ElementList& categories ) } } -QString CreateCategoryDialog::newCategoryName( void ) +TQString CreateCategoryDialog::newCategoryName( void ) { return ( elementEdit->text() ); } diff --git a/krecipes/src/dialogs/createcategorydialog.h b/krecipes/src/dialogs/createcategorydialog.h index 2bde7b7..a820996 100644 --- a/krecipes/src/dialogs/createcategorydialog.h +++ b/krecipes/src/dialogs/createcategorydialog.h @@ -13,17 +13,17 @@ #ifndef CREATECATEGORYDIALOG_H #define CREATECATEGORYDIALOG_H -#include +#include #include #include "datablocks/elementlist.h" class KLineEdit; -class QPushButton; -class QVBoxLayout; -class QGroupBox; -class QVBox; +class TQPushButton; +class TQVBoxLayout; +class TQGroupBox; +class TQVBox; class KComboBox; /** @@ -32,19 +32,19 @@ class KComboBox; class CreateCategoryDialog : public KDialogBase { public: - CreateCategoryDialog( QWidget *parent, const ElementList &categories ); + CreateCategoryDialog( TQWidget *parent, const ElementList &categories ); ~CreateCategoryDialog(); - QString newCategoryName( void ); + TQString newCategoryName( void ); int subcategory( void ); private: void loadCategories( const ElementList &categories ); //Widgets - QGroupBox *box; + TQGroupBox *box; KLineEdit *elementEdit; KComboBox* categoryComboBox; - QMap idMap; + TQMap idMap; }; diff --git a/krecipes/src/dialogs/createelementdialog.cpp b/krecipes/src/dialogs/createelementdialog.cpp index 11bc973..a129f78 100644 --- a/krecipes/src/dialogs/createelementdialog.cpp +++ b/krecipes/src/dialogs/createelementdialog.cpp @@ -14,18 +14,18 @@ #include -CreateElementDialog::CreateElementDialog( QWidget *parent, const QString &text ) +CreateElementDialog::CreateElementDialog( TQWidget *parent, const TQString &text ) : KDialogBase( parent, "createElementDialog", true, text, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); - box->setColumnLayout( 0, Qt::Vertical ); + box = new TQGroupBox( page ); + box->setColumnLayout( 0, TQt::Vertical ); box->layout() ->setSpacing( 6 ); box->layout() ->setMargin( 11 ); - QVBoxLayout *boxLayout = new QVBoxLayout( box->layout() ); - boxLayout->setAlignment( Qt::AlignTop ); + TQVBoxLayout *boxLayout = new TQVBoxLayout( box->layout() ); + boxLayout->setAlignment( TQt::AlignTop ); box->setTitle( text ); elementEdit = new KLineEdit( box ); @@ -41,7 +41,7 @@ CreateElementDialog::CreateElementDialog( QWidget *parent, const QString &text ) CreateElementDialog::~CreateElementDialog() {} -QString CreateElementDialog::newElementName( void ) +TQString CreateElementDialog::newElementName( void ) { return ( elementEdit->text() ); } diff --git a/krecipes/src/dialogs/createelementdialog.h b/krecipes/src/dialogs/createelementdialog.h index 93406f1..14b137e 100644 --- a/krecipes/src/dialogs/createelementdialog.h +++ b/krecipes/src/dialogs/createelementdialog.h @@ -13,10 +13,10 @@ #ifndef CREATEELEMENTDIALOG_H #define CREATEELEMENTDIALOG_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -27,13 +27,13 @@ class CreateElementDialog : public KDialogBase { public: - CreateElementDialog( QWidget *parent, const QString &text ); + CreateElementDialog( TQWidget *parent, const TQString &text ); ~CreateElementDialog(); - QString newElementName( void ); + TQString newElementName( void ); private: //Widgets - QGroupBox *box; + TQGroupBox *box; KLineEdit *elementEdit; }; diff --git a/krecipes/src/dialogs/createingredientweightdialog.cpp b/krecipes/src/dialogs/createingredientweightdialog.cpp index 1ad3cda..0f3262b 100644 --- a/krecipes/src/dialogs/createingredientweightdialog.cpp +++ b/krecipes/src/dialogs/createingredientweightdialog.cpp @@ -10,13 +10,13 @@ #include "createingredientweightdialog.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -27,18 +27,18 @@ #include "datablocks/weight.h" #include "backends/recipedb.h" -CreateIngredientWeightDialog::CreateIngredientWeightDialog( QWidget* parent, RecipeDB *db ) - : KDialogBase( parent, "createIngWeightDialog", true, QString::null, +CreateIngredientWeightDialog::CreateIngredientWeightDialog( TQWidget* parent, RecipeDB *db ) + : KDialogBase( parent, "createIngWeightDialog", true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - groupBox1 = new QGroupBox( page ); - groupBox1->setColumnLayout(0, Qt::Vertical ); + groupBox1 = new TQGroupBox( page ); + groupBox1->setColumnLayout(0, TQt::Vertical ); groupBox1->layout()->setSpacing( 6 ); groupBox1->layout()->setMargin( 11 ); - groupBox1Layout = new QGridLayout( groupBox1->layout() ); - groupBox1Layout->setAlignment( Qt::AlignTop ); + groupBox1Layout = new TQGridLayout( groupBox1->layout() ); + groupBox1Layout->setAlignment( TQt::AlignTop ); perAmountEdit = new FractionInput( groupBox1 ); @@ -53,11 +53,11 @@ CreateIngredientWeightDialog::CreateIngredientWeightDialog( QWidget* parent, Rec groupBox1Layout->addMultiCellWidget( weightUnitBox, 0, 0, 2, 3 ); - perAmountLabel = new QLabel( groupBox1, "perAmountLabel" ); + perAmountLabel = new TQLabel( groupBox1, "perAmountLabel" ); groupBox1Layout->addWidget( perAmountLabel, 1, 0 ); - weightLabel = new QLabel( groupBox1, "weightLabel" ); + weightLabel = new TQLabel( groupBox1, "weightLabel" ); groupBox1Layout->addWidget( weightLabel, 0, 0 ); @@ -78,7 +78,7 @@ CreateIngredientWeightDialog::CreateIngredientWeightDialog( QWidget* parent, Rec CreateIngredientWeightDialog::~CreateIngredientWeightDialog() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, TQt does it all for us } void CreateIngredientWeightDialog::languageChange() diff --git a/krecipes/src/dialogs/createingredientweightdialog.h b/krecipes/src/dialogs/createingredientweightdialog.h index bfcd800..30ba144 100644 --- a/krecipes/src/dialogs/createingredientweightdialog.h +++ b/krecipes/src/dialogs/createingredientweightdialog.h @@ -13,15 +13,15 @@ #include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QGroupBox; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQGroupBox; class KLineEdit; class KComboBox; -class QLabel; -class QPushButton; +class TQLabel; +class TQPushButton; class FractionInput; class UnitComboBox; @@ -34,25 +34,25 @@ class CreateIngredientWeightDialog : public KDialogBase Q_OBJECT public: - CreateIngredientWeightDialog( QWidget* parent, RecipeDB* ); + CreateIngredientWeightDialog( TQWidget* parent, RecipeDB* ); ~CreateIngredientWeightDialog(); Weight weight() const; protected: - QGridLayout* groupBox1Layout; + TQGridLayout* groupBox1Layout; protected slots: virtual void languageChange(); void slotOk(); private: - QGroupBox* groupBox1; + TQGroupBox* groupBox1; FractionInput* perAmountEdit; FractionInput* weightEdit; UnitComboBox* weightUnitBox; - QLabel* perAmountLabel; - QLabel* weightLabel; + TQLabel* perAmountLabel; + TQLabel* weightLabel; UnitComboBox* perAmountUnitBox; PrepMethodComboBox* prepMethodBox; }; diff --git a/krecipes/src/dialogs/createpropertydialog.cpp b/krecipes/src/dialogs/createpropertydialog.cpp index 26be442..44f7584 100644 --- a/krecipes/src/dialogs/createpropertydialog.cpp +++ b/krecipes/src/dialogs/createpropertydialog.cpp @@ -14,7 +14,7 @@ #include -CreatePropertyDialog::CreatePropertyDialog( QWidget *parent, UnitList* list ) +CreatePropertyDialog::CreatePropertyDialog( TQWidget *parent, UnitList* list ) : KDialogBase( parent, "createPropertyDialog", true, i18n( "New Property" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { @@ -23,23 +23,23 @@ CreatePropertyDialog::CreatePropertyDialog( QWidget *parent, UnitList* list ) unitList = list; // Store the pointer to the unitList; // Initialize widgets - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); - box->setColumnLayout( 0, Qt::Vertical ); + box = new TQGroupBox( page ); + box->setColumnLayout( 0, TQt::Vertical ); box->layout() ->setSpacing( 6 ); box->layout() ->setMargin( 11 ); - QGridLayout *gridLayout = new QGridLayout( box->layout() ); - gridLayout->setAlignment( Qt::AlignTop ); + TQGridLayout *gridLayout = new TQGridLayout( box->layout() ); + gridLayout->setAlignment( TQt::AlignTop ); box->setTitle( i18n( "New Property" ) ); - nameEditText = new QLabel( i18n( "Property name:" ), box ); + nameEditText = new TQLabel( i18n( "Property name:" ), box ); propertyNameEdit = new KLineEdit( box ); propertyNameEdit->setMinimumWidth( 150 ); gridLayout->addWidget( nameEditText, 0, 0 ); gridLayout->addWidget( propertyNameEdit, 0, 1 ); - unitsText = new QLabel( i18n( "Units:" ), box ); + unitsText = new TQLabel( i18n( "Units:" ), box ); propertyUnits = new KLineEdit( box ); propertyUnits->setMinimumWidth( 150 ); gridLayout->addWidget( unitsText, 1, 0 ); @@ -56,12 +56,12 @@ CreatePropertyDialog::~CreatePropertyDialog() {} -QString CreatePropertyDialog::newPropertyName( void ) +TQString CreatePropertyDialog::newPropertyName( void ) { return ( propertyNameEdit->text() ); } -QString CreatePropertyDialog::newUnitsName( void ) +TQString CreatePropertyDialog::newUnitsName( void ) { return ( propertyUnits->text() ); } diff --git a/krecipes/src/dialogs/createpropertydialog.h b/krecipes/src/dialogs/createpropertydialog.h index 4831562..ab99013 100644 --- a/krecipes/src/dialogs/createpropertydialog.h +++ b/krecipes/src/dialogs/createpropertydialog.h @@ -17,12 +17,12 @@ #ifndef CREATEPROPERTYDIALOG_H #define CREATEPROPERTYDIALOG_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -32,19 +32,19 @@ class CreatePropertyDialog : public KDialogBase { public: - CreatePropertyDialog( QWidget *parent, UnitList *list ); + CreatePropertyDialog( TQWidget *parent, UnitList *list ); ~CreatePropertyDialog(); - QString newPropertyName( void ); - QString newUnitsName( void ); + TQString newPropertyName( void ); + TQString newUnitsName( void ); private: //Widgets - QGroupBox *box; + TQGroupBox *box; KLineEdit *propertyNameEdit; KLineEdit *propertyUnits; - QLabel *nameEditText; - QLabel *unitsText; + TQLabel *nameEditText; + TQLabel *unitsText; //Internal variables UnitList *unitList; diff --git a/krecipes/src/dialogs/createunitdialog.cpp b/krecipes/src/dialogs/createunitdialog.cpp index 7f35862..224f65d 100644 --- a/krecipes/src/dialogs/createunitdialog.cpp +++ b/krecipes/src/dialogs/createunitdialog.cpp @@ -12,52 +12,52 @@ #include "createunitdialog.h" -#include +#include #include #include #include -CreateUnitDialog::CreateUnitDialog( QWidget *parent, const QString &name, const QString &plural, const QString &name_abbrev, const QString &plural_abbrev, bool newUnit ) +CreateUnitDialog::CreateUnitDialog( TQWidget *parent, const TQString &name, const TQString &plural, const TQString &name_abbrev, const TQString &plural_abbrev, bool newUnit ) : KDialogBase( parent, "createElementDialog", true, (newUnit)?i18n( "New Unit" ):i18n("Unit"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); - box->setColumnLayout( 0, Qt::Vertical ); + box = new TQGroupBox( page ); + box->setColumnLayout( 0, TQt::Vertical ); box->layout() ->setSpacing( 6 ); box->layout() ->setMargin( 11 ); - QGridLayout *gridLayout = new QGridLayout( box->layout() ); - gridLayout->setAlignment( Qt::AlignTop ); + TQGridLayout *gridLayout = new TQGridLayout( box->layout() ); + gridLayout->setAlignment( TQt::AlignTop ); box->setTitle( (newUnit)?i18n( "New Unit" ):i18n("Unit") ); - QLabel *nameLabel = new QLabel( i18n( "Singular:" ), box ); + TQLabel *nameLabel = new TQLabel( i18n( "Singular:" ), box ); nameEdit = new KLineEdit( name, box ); gridLayout->addWidget( nameLabel, 0, 0 ); gridLayout->addWidget( nameEdit, 0, 1 ); - QLabel *nameAbbrevLabel = new QLabel( i18n( "Abbreviation:" ), box ); + TQLabel *nameAbbrevLabel = new TQLabel( i18n( "Abbreviation:" ), box ); nameAbbrevEdit = new KLineEdit( name_abbrev, box ); gridLayout->addWidget( nameAbbrevLabel, 0, 2 ); gridLayout->addWidget( nameAbbrevEdit, 0, 3 ); - QLabel *pluralLabel = new QLabel( i18n( "Plural:" ), box ); + TQLabel *pluralLabel = new TQLabel( i18n( "Plural:" ), box ); pluralEdit = new KLineEdit( plural, box ); gridLayout->addWidget( pluralLabel, 1, 0 ); gridLayout->addWidget( pluralEdit, 1, 1 ); - QLabel *pluralAbbrevLabel = new QLabel( i18n( "Abbreviation:" ), box ); + TQLabel *pluralAbbrevLabel = new TQLabel( i18n( "Abbreviation:" ), box ); pluralAbbrevEdit = new KLineEdit( plural_abbrev, box ); gridLayout->addWidget( pluralAbbrevLabel, 1, 2 ); gridLayout->addWidget( pluralAbbrevEdit, 1, 3 ); - QLabel *typeLabel = new QLabel( i18n( "Type:" ), box ); + TQLabel *typeLabel = new TQLabel( i18n( "Type:" ), box ); typeComboBox = new KComboBox( false, box ); typeComboBox->insertItem(i18n("Other")); typeComboBox->insertItem(i18n("Mass")); @@ -69,7 +69,7 @@ CreateUnitDialog::CreateUnitDialog( QWidget *parent, const QString &name, const adjustSize(); setFixedSize( size() ); //we've got all the widgets put in, now let's keep it this size - connect( nameAbbrevEdit, SIGNAL(textChanged(const QString&)), SLOT(nameAbbrevTextChanged(const QString &)) ); + connect( nameAbbrevEdit, SIGNAL(textChanged(const TQString&)), SLOT(nameAbbrevTextChanged(const TQString &)) ); if ( name.isEmpty() ) nameEdit->setFocus(); @@ -83,8 +83,8 @@ CreateUnitDialog::~CreateUnitDialog() Unit CreateUnitDialog::newUnit( void ) { - QString name = nameEdit->text(); - QString plural = pluralEdit->text(); + TQString name = nameEdit->text(); + TQString plural = pluralEdit->text(); if ( name.isEmpty() ) name = plural; @@ -100,7 +100,7 @@ Unit CreateUnitDialog::newUnit( void ) return new_unit; } -void CreateUnitDialog::nameAbbrevTextChanged(const QString &newText) +void CreateUnitDialog::nameAbbrevTextChanged(const TQString &newText) { //appending if ( newText.left( newText.length()-1 ) == pluralAbbrevEdit->text() ) { diff --git a/krecipes/src/dialogs/createunitdialog.h b/krecipes/src/dialogs/createunitdialog.h index f74fa67..5c534bd 100644 --- a/krecipes/src/dialogs/createunitdialog.h +++ b/krecipes/src/dialogs/createunitdialog.h @@ -14,10 +14,10 @@ #define CREATEUNITDIALOG_H #include -#include -#include -#include -#include +#include +#include +#include +#include #include "datablocks/unit.h" @@ -32,16 +32,16 @@ class CreateUnitDialog : public KDialogBase Q_OBJECT public: - CreateUnitDialog( QWidget *parent, const QString &name = QString::null, const QString &plural = QString::null, const QString &name_abbrev = QString::null, const QString &plural_abbrev = QString::null, bool newUnit = true ); + CreateUnitDialog( TQWidget *parent, const TQString &name = TQString::null, const TQString &plural = TQString::null, const TQString &name_abbrev = TQString::null, const TQString &plural_abbrev = TQString::null, bool newUnit = true ); ~CreateUnitDialog(); Unit newUnit( void ); protected slots: - void nameAbbrevTextChanged(const QString &); + void nameAbbrevTextChanged(const TQString &); private: //Widgets - QGroupBox *box; + TQGroupBox *box; KLineEdit *nameEdit; KLineEdit *pluralEdit; KLineEdit *nameAbbrevEdit; diff --git a/krecipes/src/dialogs/dbimportdialog.cpp b/krecipes/src/dialogs/dbimportdialog.cpp index 6fb946d..187eee3 100644 --- a/krecipes/src/dialogs/dbimportdialog.cpp +++ b/krecipes/src/dialogs/dbimportdialog.cpp @@ -17,17 +17,17 @@ #include "config.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -35,80 +35,80 @@ #include #include -DBImportDialog::DBImportDialog( QWidget *parent, const char *name ) +DBImportDialog::DBImportDialog( TQWidget *parent, const char *name ) : KDialogBase( parent, name, true, i18n( "Database Import" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { setButtonBoxOrientation( Vertical ); - QHBox *page = makeHBoxMainWidget(); + TQHBox *page = makeHBoxMainWidget(); - dbButtonGroup = new QButtonGroup( page, "dbButtonGroup" ); - dbButtonGroup->setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 4, ( QSizePolicy::SizeType ) 5, 0, 0, dbButtonGroup->sizePolicy().hasHeightForWidth() ) ); - dbButtonGroup->setColumnLayout( 0, Qt::Vertical ); + dbButtonGroup = new TQButtonGroup( page, "dbButtonGroup" ); + dbButtonGroup->setSizePolicy( TQSizePolicy( ( TQSizePolicy::SizeType ) 4, ( TQSizePolicy::SizeType ) 5, 0, 0, dbButtonGroup->sizePolicy().hasHeightForWidth() ) ); + dbButtonGroup->setColumnLayout( 0, TQt::Vertical ); dbButtonGroup->layout() ->setSpacing( 6 ); dbButtonGroup->layout() ->setMargin( 11 ); - dbButtonGroupLayout = new QVBoxLayout( dbButtonGroup->layout() ); - dbButtonGroupLayout->setAlignment( Qt::AlignTop ); + dbButtonGroupLayout = new TQVBoxLayout( dbButtonGroup->layout() ); + dbButtonGroupLayout->setAlignment( TQt::AlignTop ); - liteRadioButton = new QRadioButton( dbButtonGroup, "liteRadioButton" ); + liteRadioButton = new TQRadioButton( dbButtonGroup, "liteRadioButton" ); liteRadioButton->setChecked( TRUE ); dbButtonGroupLayout->addWidget( liteRadioButton ); - mysqlRadioButton = new QRadioButton( dbButtonGroup, "mysqlRadioButton" ); + mysqlRadioButton = new TQRadioButton( dbButtonGroup, "mysqlRadioButton" ); dbButtonGroupLayout->addWidget( mysqlRadioButton ); - psqlRadioButton = new QRadioButton( dbButtonGroup, "psqlRadioButton" ); + psqlRadioButton = new TQRadioButton( dbButtonGroup, "psqlRadioButton" ); dbButtonGroupLayout->addWidget( psqlRadioButton ); - paramStack = new QWidgetStack( page, "paramStack" ); - paramStack->setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 7, ( QSizePolicy::SizeType ) 5, 0, 0, paramStack->sizePolicy().hasHeightForWidth() ) ); + paramStack = new TQWidgetStack( page, "paramStack" ); + paramStack->setSizePolicy( TQSizePolicy( ( TQSizePolicy::SizeType ) 7, ( TQSizePolicy::SizeType ) 5, 0, 0, paramStack->sizePolicy().hasHeightForWidth() ) ); - sqlitePage = new QWidget( paramStack, "sqlitePage" ); - serverPageLayout_2 = new QVBoxLayout( sqlitePage, 11, 6, "serverPageLayout_2" ); + sqlitePage = new TQWidget( paramStack, "sqlitePage" ); + serverPageLayout_2 = new TQVBoxLayout( sqlitePage, 11, 6, "serverPageLayout_2" ); - QLabel *sqliteLabel = new QLabel( i18n( "Database file:" ), sqlitePage ); + TQLabel *sqliteLabel = new TQLabel( i18n( "Database file:" ), sqlitePage ); serverPageLayout_2->addWidget( sqliteLabel ); sqliteDBRequester = new KURLRequester( sqlitePage, "sqliteDBRequester" ); sqliteDBRequester->setShowLocalProtocol( false ); serverPageLayout_2->addWidget( sqliteDBRequester ); - QSpacerItem *vSpacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + TQSpacerItem *vSpacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); serverPageLayout_2->addItem(vSpacer); paramStack->addWidget( sqlitePage, 1 ); - serverPage = new QWidget( paramStack, "serverPage" ); - serverPageLayout = new QVBoxLayout( serverPage, 11, 6, "serverPageLayout" ); + serverPage = new TQWidget( paramStack, "serverPage" ); + serverPageLayout = new TQVBoxLayout( serverPage, 11, 6, "serverPageLayout" ); - layout5 = new QGridLayout( 0, 1, 1, 0, 6, "layout5" ); + layout5 = new TQGridLayout( 0, 1, 1, 0, 6, "layout5" ); - hostEdit = new QLineEdit( serverPage, "hostEdit" ); + hostEdit = new TQLineEdit( serverPage, "hostEdit" ); layout5->addWidget( hostEdit, 0, 1 ); - hostLabel = new QLabel( serverPage, "hostLabel" ); + hostLabel = new TQLabel( serverPage, "hostLabel" ); layout5->addWidget( hostLabel, 0, 0 ); - userEdit = new QLineEdit( serverPage, "userEdit" ); + userEdit = new TQLineEdit( serverPage, "userEdit" ); layout5->addWidget( userEdit, 1, 1 ); - userLabel = new QLabel( serverPage, "userLabel" ); + userLabel = new TQLabel( serverPage, "userLabel" ); layout5->addWidget( userLabel, 1, 0 ); - passwordEdit = new QLineEdit( serverPage, "passwordEdit" ); - passwordEdit->setEchoMode( QLineEdit::Password ); + passwordEdit = new TQLineEdit( serverPage, "passwordEdit" ); + passwordEdit->setEchoMode( TQLineEdit::Password ); layout5->addWidget( passwordEdit, 2, 1 ); - passwordLabel = new QLabel( serverPage, "passwordLabel" ); + passwordLabel = new TQLabel( serverPage, "passwordLabel" ); layout5->addWidget( passwordLabel, 2, 0 ); portEdit = new KIntNumInput( serverPage, "portEdit" ); portEdit->setMinValue(0); portEdit->setValue(0); layout5->addWidget( portEdit, 3, 1 ); - portLabel = new QLabel( serverPage, "portLabel" ); + portLabel = new TQLabel( serverPage, "portLabel" ); layout5->addWidget( portLabel, 3, 0 ); - nameEdit = new QLineEdit( serverPage, "nameEdit" ); + nameEdit = new TQLineEdit( serverPage, "nameEdit" ); layout5->addWidget( nameEdit, 4, 1 ); - nameLabel = new QLabel( serverPage, "nameLabel" ); + nameLabel = new TQLabel( serverPage, "nameLabel" ); layout5->addWidget( nameLabel, 4, 0 ); serverPageLayout->addLayout( layout5 ); @@ -169,7 +169,7 @@ void DBImportDialog::languageChange() struct passwd *user; userID = getuid(); user = getpwuid ( userID ); - QString username(user->pw_name); + TQString username(user->pw_name); userEdit->setText( username ); } @@ -187,7 +187,7 @@ void DBImportDialog::switchDBPage( int id ) } } -QString DBImportDialog::dbType() const +TQString DBImportDialog::dbType() const { //int id=dbButtonGroup->selectedId(); //QT 3.2 int id = dbButtonGroup->id( dbButtonGroup->selected() ); //QT 3.1 @@ -199,11 +199,11 @@ QString DBImportDialog::dbType() const case 2: return "PostgreSQL"; default: - return QString::null; + return TQString::null; } } -void DBImportDialog::serverParams( QString &host, QString &user, QString &pass, int &port, QString &table ) const +void DBImportDialog::serverParams( TQString &host, TQString &user, TQString &pass, int &port, TQString &table ) const { host = hostEdit->text(); user = userEdit->text(); @@ -212,7 +212,7 @@ void DBImportDialog::serverParams( QString &host, QString &user, QString &pass, port = portEdit->value(); } -QString DBImportDialog::dbFile() const +TQString DBImportDialog::dbFile() const { return sqliteDBRequester->url(); } diff --git a/krecipes/src/dialogs/dbimportdialog.h b/krecipes/src/dialogs/dbimportdialog.h index 37e447a..0024daf 100644 --- a/krecipes/src/dialogs/dbimportdialog.h +++ b/krecipes/src/dialogs/dbimportdialog.h @@ -12,17 +12,17 @@ #include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QButtonGroup; -class QRadioButton; -class QWidgetStack; -class QWidget; -class QLineEdit; -class QLabel; -class QPushButton; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQButtonGroup; +class TQRadioButton; +class TQWidgetStack; +class TQWidget; +class TQLineEdit; +class TQLabel; +class TQPushButton; class KURLRequester; class KIntNumInput; @@ -35,37 +35,37 @@ class DBImportDialog: public KDialogBase { Q_OBJECT public: - DBImportDialog( QWidget *parent = 0, const char *name = 0 ); + DBImportDialog( TQWidget *parent = 0, const char *name = 0 ); - QString dbType() const; - void serverParams( QString &host, QString &user, QString &pass, int &port, QString &table ) const; - QString dbFile() const; + TQString dbType() const; + void serverParams( TQString &host, TQString &user, TQString &pass, int &port, TQString &table ) const; + TQString dbFile() const; private: // Widgets - QButtonGroup* dbButtonGroup; - QRadioButton* liteRadioButton; - QRadioButton* mysqlRadioButton; - QRadioButton* psqlRadioButton; - QWidgetStack* paramStack; - QWidget* serverPage; - QLineEdit* nameEdit; - QLabel* passwordLabel; - QLineEdit* hostEdit; - QLineEdit* passwordEdit; - QLineEdit* userEdit; - QLabel* userLabel; - QLabel* hostLabel; - QLabel* nameLabel; - QLabel* portLabel; + TQButtonGroup* dbButtonGroup; + TQRadioButton* liteRadioButton; + TQRadioButton* mysqlRadioButton; + TQRadioButton* psqlRadioButton; + TQWidgetStack* paramStack; + TQWidget* serverPage; + TQLineEdit* nameEdit; + TQLabel* passwordLabel; + TQLineEdit* hostEdit; + TQLineEdit* passwordEdit; + TQLineEdit* userEdit; + TQLabel* userLabel; + TQLabel* hostLabel; + TQLabel* nameLabel; + TQLabel* portLabel; KIntNumInput *portEdit; - QWidget* sqlitePage; + TQWidget* sqlitePage; KURLRequester* sqliteDBRequester; - QVBoxLayout* dbButtonGroupLayout; - QVBoxLayout* serverPageLayout; - QGridLayout* layout5; - QVBoxLayout* serverPageLayout_2; + TQVBoxLayout* dbButtonGroupLayout; + TQVBoxLayout* serverPageLayout; + TQGridLayout* layout5; + TQVBoxLayout* serverPageLayout_2; protected slots: void languageChange(); diff --git a/krecipes/src/dialogs/dependanciesdialog.cpp b/krecipes/src/dialogs/dependanciesdialog.cpp index a352e1e..b520d77 100644 --- a/krecipes/src/dialogs/dependanciesdialog.cpp +++ b/krecipes/src/dialogs/dependanciesdialog.cpp @@ -15,25 +15,25 @@ #include "dependanciesdialog.h" #include "datablocks/elementlist.h" -#include +#include #include #include #include #include -DependanciesDialog::DependanciesDialog( QWidget *parent, const QValueList &lists, bool deps_are_deleted ) : KDialogBase( parent, "DependanciesDialog", true, QString::null, +DependanciesDialog::DependanciesDialog( TQWidget *parent, const TQValueList &lists, bool deps_are_deleted ) : KDialogBase( parent, "DependanciesDialog", true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ), m_depsAreDeleted(deps_are_deleted) { init( lists ); } -DependanciesDialog::DependanciesDialog( QWidget *parent, const ListInfo &list, bool deps_are_deleted ) : KDialogBase( parent, "DependanciesDialog", true, QString::null, +DependanciesDialog::DependanciesDialog( TQWidget *parent, const ListInfo &list, bool deps_are_deleted ) : KDialogBase( parent, "DependanciesDialog", true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ), m_depsAreDeleted(deps_are_deleted) { - QValueList lists; + TQValueList lists; lists << list; init( lists ); } @@ -41,16 +41,16 @@ DependanciesDialog::DependanciesDialog( QWidget *parent, const ListInfo &list, b DependanciesDialog::~DependanciesDialog() {} -void DependanciesDialog::init( const QValueList &lists ) +void DependanciesDialog::init( const TQValueList &lists ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); // Design the dialog - instructionsLabel = new QLabel( page ); - instructionsLabel->setMinimumSize( QSize( 100, 30 ) ); - instructionsLabel->setMaximumSize( QSize( 10000, 10000 ) ); - instructionsLabel->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); + instructionsLabel = new TQLabel( page ); + instructionsLabel->setMinimumSize( TQSize( 100, 30 ) ); + instructionsLabel->setMaximumSize( TQSize( 10000, 10000 ) ); + instructionsLabel->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) ); if ( m_depsAreDeleted ) { instructionsLabel->setText( i18n( "WARNING: The following will have to be removed also, since currently they use the element you have chosen to be removed." ) ); @@ -59,9 +59,9 @@ void DependanciesDialog::init( const QValueList &lists ) instructionsLabel->setText( i18n( "WARNING: The following currently use the element you have chosen to be removed." ) ); } - for ( QValueList::const_iterator list_it = lists.begin(); list_it != lists.end(); ++list_it ) { + for ( TQValueList::const_iterator list_it = lists.begin(); list_it != lists.end(); ++list_it ) { if ( !((*list_it).list).isEmpty() ) { - QGroupBox *groupBox = new QGroupBox( 1, Qt::Vertical, (*list_it).name, page ); + TQGroupBox *groupBox = new TQGroupBox( 1, TQt::Vertical, (*list_it).name, page ); KListBox *listBox = new KListBox( groupBox ); loadList( listBox, (*list_it).list ); } @@ -77,9 +77,9 @@ void DependanciesDialog::loadList( KListBox* listBox, const ElementList &list ) bool show_id = config->readBoolEntry( "ShowID", false ); for ( ElementList::const_iterator el_it = list.begin(); el_it != list.end(); ++el_it ) { - QString name = ( *el_it ).name; + TQString name = ( *el_it ).name; if ( show_id ) - name += " (" + QString::number(( *el_it ).id) + ")"; + name += " (" + TQString::number(( *el_it ).id) + ")"; listBox->insertItem( name ); } } @@ -88,13 +88,13 @@ void DependanciesDialog::accept() { if ( !m_msg.isEmpty() ) { switch ( KMessageBox::warningYesNo(this, - QString("%1

%2").arg(m_msg).arg(i18n("Are you sure you wish to proceed?")), - QString::null,KStdGuiItem::yes(),KStdGuiItem::no(),"doubleCheckDelete") ) + TQString("%1

%2").arg(m_msg).arg(i18n("Are you sure you wish to proceed?")), + TQString::null,KStdGuiItem::yes(),KStdGuiItem::no(),"doubleCheckDelete") ) { - case KMessageBox::Yes: QDialog::accept(); break; - case KMessageBox::No: QDialog::reject(); break; + case KMessageBox::Yes: TQDialog::accept(); break; + case KMessageBox::No: TQDialog::reject(); break; } } else - QDialog::accept(); + TQDialog::accept(); } diff --git a/krecipes/src/dialogs/dependanciesdialog.h b/krecipes/src/dialogs/dependanciesdialog.h index 07e1696..e5c10f9 100644 --- a/krecipes/src/dialogs/dependanciesdialog.h +++ b/krecipes/src/dialogs/dependanciesdialog.h @@ -15,8 +15,8 @@ #ifndef DEPENDANCIESDIALOG_H #define DEPENDANCIESDIALOG_H -#include -#include +#include +#include #include #include @@ -25,7 +25,7 @@ typedef struct ListInfo { ElementList list; - QString name; + TQString name; }; /** @@ -35,25 +35,25 @@ class DependanciesDialog: public KDialogBase { public: //Methods - DependanciesDialog( QWidget *parent, const QValueList &lists, bool deps_are_deleted = true ); - DependanciesDialog( QWidget *parent, const ListInfo &list, bool deps_are_deleted = true ); + DependanciesDialog( TQWidget *parent, const TQValueList &lists, bool deps_are_deleted = true ); + DependanciesDialog( TQWidget *parent, const ListInfo &list, bool deps_are_deleted = true ); ~DependanciesDialog(); - void setCustomWarning( const QString &msg ){ m_msg = msg; } + void setCustomWarning( const TQString &msg ){ m_msg = msg; } public slots: void accept(); private: //Widgets - QLabel *instructionsLabel; + TQLabel *instructionsLabel; bool m_depsAreDeleted; - QString m_msg; + TQString m_msg; // Methods - void init( const QValueList &lists ); + void init( const TQValueList &lists ); void loadList( KListBox*, const ElementList &list ); }; diff --git a/krecipes/src/dialogs/dietviewdialog.cpp b/krecipes/src/dialogs/dietviewdialog.cpp index cdb5884..17bfc4a 100644 --- a/krecipes/src/dialogs/dietviewdialog.cpp +++ b/krecipes/src/dialogs/dietviewdialog.cpp @@ -15,20 +15,20 @@ #include #include -DietViewDialog::DietViewDialog( QWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const QValueList &dishNumbers ) - : KDialogBase( parent, "dietViewDialog", true, QString::null, +DietViewDialog::DietViewDialog( TQWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList &dishNumbers ) + : KDialogBase( parent, "dietViewDialog", true, TQString::null, KDialogBase::User2 | KDialogBase::Close | KDialogBase::User1, KDialogBase::User2, false, KStdGuiItem::print() ) { setButtonText( KDialogBase::User2, i18n( "Create &Shopping List" ) ); // Design the dialog - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); // The html part dietView = new KHTMLPart( page ); - setInitialSize( QSize(350, 450) ); + setInitialSize( TQSize(350, 450) ); setSizeGripEnabled( true ); @@ -43,12 +43,12 @@ DietViewDialog::DietViewDialog( QWidget *parent, const RecipeList &recipeList, i DietViewDialog::~DietViewDialog() {} -void DietViewDialog::showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const QValueList &dishNumbers ) +void DietViewDialog::showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList &dishNumbers ) { // Header - QString htmlCode = QString( "%1" ).arg( i18n( "Diet" ) ); + TQString htmlCode = TQString( "%1" ).arg( i18n( "Diet" ) ); // CSS htmlCode += ""; output += ""; output += ""; @@ -181,7 +181,7 @@ QString HTMLExporter::createHeader( const RecipeList & ) return output; } -void HTMLExporter::beginObject( const QString &object ) +void HTMLExporter::beginObject( const TQString &object ) { m_cachedCSS += "."+object+" { \n"; } @@ -191,83 +191,83 @@ void HTMLExporter::endObject() m_cachedCSS += " } \n"; } -void HTMLExporter::loadBackgroundColor( const QString &/*object*/, const QColor& color ) +void HTMLExporter::loadBackgroundColor( const TQString &/*object*/, const TQColor& color ) { m_cachedCSS += bgColorAsCSS(color); } -void HTMLExporter::loadFont( const QString &/*object*/, const QFont& font ) +void HTMLExporter::loadFont( const TQString &/*object*/, const TQFont& font ) { m_cachedCSS += fontAsCSS(font); } -void HTMLExporter::loadTextColor( const QString &/*object*/, const QColor& color ) +void HTMLExporter::loadTextColor( const TQString &/*object*/, const TQColor& color ) { m_cachedCSS += textColorAsCSS(color); } -void HTMLExporter::loadVisibility( const QString &object, bool visible ) +void HTMLExporter::loadVisibility( const TQString &object, bool visible ) { m_cachedCSS += visibilityAsCSS(visible); m_visibilityMap.insert(object,visible); } -void HTMLExporter::loadAlignment( const QString &/*object*/, int alignment ) +void HTMLExporter::loadAlignment( const TQString &/*object*/, int alignment ) { m_cachedCSS += alignmentAsCSS(alignment); } -void HTMLExporter::loadBorder( const QString &/*object*/, const KreBorder& border ) +void HTMLExporter::loadBorder( const TQString &/*object*/, const KreBorder& border ) { m_cachedCSS += borderAsCSS(border); } -void HTMLExporter::loadColumns( const QString & object, int cols ) +void HTMLExporter::loadColumns( const TQString & object, int cols ) { m_columnsMap.insert(object,cols); kdDebug()<"; } void HTMLExporter::storePhoto( const Recipe &recipe ) { - QImage image; - QString photo_name; + TQImage image; + TQString photo_name; if ( recipe.photo.isNull() ) { - image = QImage( defaultPhoto ); + image = TQImage( defaultPhoto ); photo_name = "default_photo"; } else { image = recipe.photo.convertToImage(); - photo_name = QString::number(recipe.recipeID); + photo_name = TQString::number(recipe.recipeID); } - QPixmap pm = image;//image.smoothScale( phwidth, 0, QImage::ScaleMax ); + TQPixmap pm = image;//image.smoothScale( phwidth, 0, TQImage::ScaleMax ); - QFileInfo fi(fileName()); - QString photo_path = fi.dirPath(true) + "/" + fi.baseName() + "_photos/" + photo_name + ".png"; - if ( !QFile::exists( photo_path ) ) { + TQFileInfo fi(fileName()); + TQString photo_path = fi.dirPath(true) + "/" + fi.baseName() + "_photos/" + photo_name + ".png"; + if ( !TQFile::exists( photo_path ) ) { pm.save( photo_path, "PNG" ); } } -QString HTMLExporter::HTMLIfVisible( const QString &name, const QString &html ) +TQString HTMLExporter::HTMLIfVisible( const TQString &name, const TQString &html ) { - QMap::const_iterator it = m_visibilityMap.find(name); + TQMap::const_iterator it = m_visibilityMap.find(name); if ( it == m_visibilityMap.end() || it.data() == true ) return html; else - return QString::null; + return TQString::null; } -void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) +void HTMLExporter::populateTemplate( const Recipe &recipe, TQString &content ) { KConfig * config = KGlobal::config(); @@ -275,72 +275,72 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) content = content.replace("**TITLE**",HTMLIfVisible("title",recipe.title)); //=======================INSTRUCTIONS======================// - QString instr_html = QStyleSheet::escape( recipe.instructions ); + TQString instr_html = TQStyleSheet::escape( recipe.instructions ); instr_html.replace( "\n", "
" ); content = content.replace( "**INSTRUCTIONS**", HTMLIfVisible("instructions",instr_html) ); //=======================SERVINGS======================// - QString yield_html = QString( "%1: %2" ).arg( i18n( "Yield" ) ).arg( recipe.yield.toString() ); + TQString yield_html = TQString( "%1: %2" ).arg( i18n( "Yield" ) ).arg( recipe.yield.toString() ); content = content.replace( "**YIELD**", HTMLIfVisible("yield",yield_html) ); //=======================PREP TIME======================// - QString preptime_html; + TQString preptime_html; if ( !recipe.prepTime.isNull() && recipe.prepTime.isValid() ) - preptime_html = QString( "%1: %2" ).arg( i18n( "Preparation Time" ) ).arg( recipe.prepTime.toString( "h:mm" ) ); + preptime_html = TQString( "%1: %2" ).arg( i18n( "Preparation Time" ) ).arg( recipe.prepTime.toString( "h:mm" ) ); content = content.replace( "**PREP_TIME**", HTMLIfVisible("prep_time",preptime_html) ); //========================PHOTO========================// - QString photo_name; + TQString photo_name; if ( recipe.photo.isNull() ) photo_name = "default_photo"; else - photo_name = QString::number(recipe.recipeID); + photo_name = TQString::number(recipe.recipeID); - QFileInfo fi(fileName()); - QString image_url = fi.baseName() + "_photos/" + escape( photo_name ) + ".png"; + TQFileInfo fi(fileName()); + TQString image_url = fi.baseName() + "_photos/" + escape( photo_name ) + ".png"; image_url = KURL::encode_string( image_url ); content = content.replace( "**PHOTO**", HTMLIfVisible("photo",image_url) ); //=======================AUTHORS======================// - QString authors_html; + TQString authors_html; int counter = 0; for ( ElementList::const_iterator author_it = recipe.authorList.begin(); author_it != recipe.authorList.end(); ++author_it ) { if ( counter ) authors_html += ", "; - authors_html += QStyleSheet::escape( ( *author_it ).name ); + authors_html += TQStyleSheet::escape( ( *author_it ).name ); counter++; } if ( !authors_html.isEmpty() ) - authors_html.prepend( QString( "%1: " ).arg( i18n( "Authors" ) ) ); + authors_html.prepend( TQString( "%1: " ).arg( i18n( "Authors" ) ) ); content = content.replace( "**AUTHORS**", HTMLIfVisible("authors",authors_html) ); //=======================CATEGORIES======================// - QString categories_html; + TQString categories_html; counter = 0; for ( ElementList::const_iterator cat_it = recipe.categoryList.begin(); cat_it != recipe.categoryList.end(); ++cat_it ) { if ( counter ) categories_html += ", "; - categories_html += QStyleSheet::escape( ( *cat_it ).name ); + categories_html += TQStyleSheet::escape( ( *cat_it ).name ); counter++; } if ( !categories_html.isEmpty() ) - categories_html.prepend( QString( "%1: " ).arg( i18n( "Categories" ) ) ); + categories_html.prepend( TQString( "%1: " ).arg( i18n( "Categories" ) ) ); content = content.replace( "**CATEGORIES**", HTMLIfVisible("categories",categories_html) ); //=======================INGREDIENTS======================// - QString ingredients_html; + TQString ingredients_html; config->setGroup( "Formatting" ); bool useAbbreviations = config->readBoolEntry("AbbreviateUnits"); MixedNumber::Format number_format = ( config->readBoolEntry( "Fraction" ) ) ? MixedNumber::MixedNumberFormat : MixedNumber::DecimalFormat; - QString ingredient_format = config->readEntry( "Ingredient", "%n%p: %a %u" ); + TQString ingredient_format = config->readEntry( "Ingredient", "%n%p: %a %u" ); - QMap::const_iterator cols_it = m_columnsMap.find("ingredients"); + TQMap::const_iterator cols_it = m_columnsMap.find("ingredients"); int cols = 1; if ( cols_it != m_columnsMap.end() ) cols = cols_it.data(); @@ -351,7 +351,7 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) int count = 0; IngredientList list_copy = recipe.ingList; //simple workaround until I fix iterating over the list dealing with groups for ( IngredientList group_list = list_copy.firstGroup(); group_list.count() != 0; group_list = list_copy.nextGroup() ) { - QString group = group_list[ 0 ].group; //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group; //just use the first's name... they're all the same bool loneHeader = false; if ( count != 0 && count % per_col == 0 ) { @@ -376,48 +376,48 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) ingredients_html += "
    "; } - QString amount_str = MixedNumber( ( *ing_it ).amount ).toString( number_format ); + TQString amount_str = MixedNumber( ( *ing_it ).amount ).toString( number_format ); if ( (*ing_it).amount_offset > 0 ) amount_str += "-"+MixedNumber( ( *ing_it ).amount + ( *ing_it ).amount_offset ).toString( number_format ); else if ( ( *ing_it ).amount <= 1e-10 ) amount_str = ""; - QString unit = ( *ing_it ).units.determineName( ( *ing_it ).amount + ( *ing_it ).amount_offset, useAbbreviations ); + TQString unit = ( *ing_it ).units.determineName( ( *ing_it ).amount + ( *ing_it ).amount_offset, useAbbreviations ); - QString tmp_format( ingredient_format ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%n" ) ), QStyleSheet::escape( ( *ing_it ).name ) ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%a" ) ), amount_str ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%u" ) ), QStyleSheet::escape(unit) ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%p" ) ), ( ( *ing_it ).prepMethodList.count() == 0 ) ? - QString::fromLatin1( "" ) : QString::fromLatin1( "; " ) + QStyleSheet::escape( ( *ing_it ).prepMethodList.join(",") ) ); + TQString tmp_format( ingredient_format ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%n" ) ), TQStyleSheet::escape( ( *ing_it ).name ) ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%a" ) ), amount_str ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%u" ) ), TQStyleSheet::escape(unit) ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%p" ) ), ( ( *ing_it ).prepMethodList.count() == 0 ) ? + TQString::fromLatin1( "" ) : TQString::fromLatin1( "; " ) + TQStyleSheet::escape( ( *ing_it ).prepMethodList.join(",") ) ); if ( (*ing_it).substitutes.count() > 0 ) tmp_format += ", "+i18n("or"); - ingredients_html += QString( "
  • %1
  • " ).arg( tmp_format ); + ingredients_html += TQString( "
  • %1
  • " ).arg( tmp_format ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QString amount_str = MixedNumber( ( *sub_it ).amount ).toString( number_format ); + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQString amount_str = MixedNumber( ( *sub_it ).amount ).toString( number_format ); if ( (*ing_it).amount_offset > 0 ) amount_str += "-"+MixedNumber( ( *sub_it ).amount + ( *sub_it ).amount_offset ).toString( number_format ); else if ( ( *sub_it ).amount <= 1e-10 ) amount_str = ""; - QString unit = ( *sub_it ).units.determineName( ( *sub_it ).amount + ( *sub_it ).amount_offset, config->readBoolEntry("AbbreviateUnits") ); + TQString unit = ( *sub_it ).units.determineName( ( *sub_it ).amount + ( *sub_it ).amount_offset, config->readBoolEntry("AbbreviateUnits") ); - QString tmp_format( ingredient_format ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%n" ) ), QStyleSheet::escape( ( *sub_it ).name ) ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%a" ) ), amount_str ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%u" ) ), QStyleSheet::escape(unit) ); - tmp_format.replace( QRegExp( QString::fromLatin1( "%p" ) ), ( ( *sub_it ).prepMethodList.count() == 0 ) ? - QString::fromLatin1( "" ) : QString::fromLatin1( "; " ) + QStyleSheet::escape( ( *sub_it ).prepMethodList.join(",") ) ); + TQString tmp_format( ingredient_format ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%n" ) ), TQStyleSheet::escape( ( *sub_it ).name ) ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%a" ) ), amount_str ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%u" ) ), TQStyleSheet::escape(unit) ); + tmp_format.replace( TQRegExp( TQString::fromLatin1( "%p" ) ), ( ( *sub_it ).prepMethodList.count() == 0 ) ? + TQString::fromLatin1( "" ) : TQString::fromLatin1( "; " ) + TQStyleSheet::escape( ( *sub_it ).prepMethodList.join(",") ) ); ++sub_it; if ( sub_it != (*ing_it).substitutes.end() ) tmp_format += ", "+i18n("or"); - ingredients_html += QString( "
  • %1
  • " ).arg( tmp_format ); + ingredients_html += TQString( "
  • %1
  • " ).arg( tmp_format ); } } @@ -431,9 +431,9 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) content = content.replace( "**INGREDIENTS**", HTMLIfVisible("ingredients",ingredients_html) ); //=======================PROPERTIES======================// - QString properties_html; + TQString properties_html; - QStringList hiddenList = config->readListEntry("HiddenProperties"); + TQStringList hiddenList = config->readListEntry("HiddenProperties"); IngredientPropertyList visibleProperties; for ( IngredientPropertyList::const_iterator prop_it = recipe.properties.begin(); prop_it != recipe.properties.end(); ++prop_it ) { if ( hiddenList.find((*prop_it).name) == hiddenList.end() ) @@ -455,20 +455,20 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) // if the amount given is <0, it means the property calculator found that the property was undefined for some ingredients, so the amount will be actually bigger - QString amount_str; + TQString amount_str; double prop_amount = (*prop_it).amount; if ( prop_amount > 0 ) { //TODO: make the precision configuratble - prop_amount = double( qRound( prop_amount * 10.0 ) ) / 10.0; //not a "chemistry experiment" ;) Let's only have one decimal place + prop_amount = double( tqRound( prop_amount * 10.0 ) ) / 10.0; //not a "chemistry experiment" ;) Let's only have one decimal place amount_str = beautify( KGlobal::locale() ->formatNumber( prop_amount, 5 ) ); } else amount_str = "0"; - properties_html += QString( "
  • %1: %2 %3
  • " ) - .arg( QStyleSheet::escape( (*prop_it).name ) ) + properties_html += TQString( "
  • %1: %2 %3
  • " ) + .arg( TQStyleSheet::escape( (*prop_it).name ) ) .arg( amount_str ) - .arg( QStyleSheet::escape( (*prop_it).units ) ); + .arg( TQStyleSheet::escape( (*prop_it).units ) ); ++count; } @@ -480,9 +480,9 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) content = content.replace( "**PROPERTIES**", HTMLIfVisible("properties",properties_html) ); //=======================RATINGS======================// - QString ratings_html; + TQString ratings_html; if ( recipe.ratingList.count() > 0 ) - ratings_html += QString("%1:").arg(i18n("Ratings")); + ratings_html += TQString("%1:").arg(i18n("Ratings")); int rating_total = 0; double rating_sum = 0; @@ -495,11 +495,11 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) if ( (*rating_it).ratingCriteriaList.count() > 0 ) ratings_html += ""; for ( RatingCriteriaList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { - QString image_url = fi.baseName() + "_photos/" + QString::number((*rc_it).stars) + "-stars.png"; + TQString image_url = fi.baseName() + "_photos/" + TQString::number((*rc_it).stars) + "-stars.png"; image_url = KURL::encode_string( image_url ); ratings_html += ""; - if ( !QFile::exists( fi.dirPath(true) + "/" + image_url ) ) { - QPixmap starPixmap = Rating::starsPixmap((*rc_it).stars,true); + if ( !TQFile::exists( fi.dirPath(true) + "/" + image_url ) ) { + TQPixmap starPixmap = Rating::starsPixmap((*rc_it).stars,true); starPixmap.save( fi.dirPath(true) + "/" + image_url, "PNG" ); } @@ -514,57 +514,57 @@ void HTMLExporter::populateTemplate( const Recipe &recipe, QString &content ) } content = content.replace( "**RATINGS**", HTMLIfVisible("ratings",ratings_html) ); - QString overall_html; + TQString overall_html; if ( rating_total > 0 ) { double average = int(2*rating_sum/rating_total)/2; - overall_html += QString("%1:").arg(i18n("Overall Rating")); - QString image_url = fi.baseName() + "_photos/" + QString::number(average) + "-stars.png"; + overall_html += TQString("%1:").arg(i18n("Overall Rating")); + TQString image_url = fi.baseName() + "_photos/" + TQString::number(average) + "-stars.png"; image_url = KURL::encode_string( image_url ); overall_html += ""; - if ( !QFile::exists( fi.dirPath(true) + "/" + image_url ) ) { - QPixmap starPixmap = Rating::starsPixmap(average,true); + if ( !TQFile::exists( fi.dirPath(true) + "/" + image_url ) ) { + TQPixmap starPixmap = Rating::starsPixmap(average,true); starPixmap.save( fi.dirPath(true) + "/" + image_url, "PNG" ); } } content = content.replace( "**OVERALL_RATING**", HTMLIfVisible("overall_rating",overall_html) ); } -void HTMLExporter::removeHTMLFiles( const QString &filename, int recipe_id ) +void HTMLExporter::removeHTMLFiles( const TQString &filename, int recipe_id ) { - QValueList id; + TQValueList id; id << recipe_id; removeHTMLFiles( filename, id ); } -void HTMLExporter::removeHTMLFiles( const QString &filename, const QValueList &recipe_ids ) +void HTMLExporter::removeHTMLFiles( const TQString &filename, const TQValueList &recipe_ids ) { //remove HTML file - QFile old_file( filename + ".html" ); + TQFile old_file( filename + ".html" ); if ( old_file.exists() ) old_file.remove(); //remove photos - for ( QValueList::const_iterator it = recipe_ids.begin(); it != recipe_ids.end(); ++it ) { - QFile photo( filename + "_photos/" + QString::number(*it) + ".png" ); + for ( TQValueList::const_iterator it = recipe_ids.begin(); it != recipe_ids.end(); ++it ) { + TQFile photo( filename + "_photos/" + TQString::number(*it) + ".png" ); if ( photo.exists() ) photo.remove(); //remove photos in directory before removing it } //take care of the default photo - QFile photo( filename + "_photos/default_photo.png" ); + TQFile photo( filename + "_photos/default_photo.png" ); if ( photo.exists() ) photo.remove(); //remove photo directory - QDir photo_dir; + TQDir photo_dir; photo_dir.rmdir( filename + "_photos" ); for ( double d = 0.5; d < 5.5; d += 0.5 ) { - if ( QFile::exists(filename+"_photos/"+QString::number(d)+"-stars.png") ) photo.remove(filename+"_photos/"+QString::number(d)+"-stars.png"); + if ( TQFile::exists(filename+"_photos/"+TQString::number(d)+"-stars.png") ) photo.remove(filename+"_photos/"+TQString::number(d)+"-stars.png"); } } -QString HTMLExporter::escape( const QString & str ) +TQString HTMLExporter::escape( const TQString & str ) { - QString tmp( str ); + TQString tmp( str ); return tmp.replace( '/', "_" ); } diff --git a/krecipes/src/exporters/htmlexporter.h b/krecipes/src/exporters/htmlexporter.h index 158869e..9382afb 100644 --- a/krecipes/src/exporters/htmlexporter.h +++ b/krecipes/src/exporters/htmlexporter.h @@ -11,8 +11,8 @@ #ifndef HTMLEXPORTER_H #define HTMLEXPORTER_H -#include -#include +#include +#include #include "baseexporter.h" #include "klomanager.h" @@ -27,51 +27,51 @@ class KProgress; class HTMLExporter : public BaseExporter, protected KLOManager { public: - HTMLExporter( const QString&, const QString& ); + HTMLExporter( const TQString&, const TQString& ); virtual ~HTMLExporter(); virtual int supportedItems() const; - static void removeHTMLFiles( const QString &filename, int recipe_id ); - static void removeHTMLFiles( const QString &filename, const QValueList &recipe_ids ); + static void removeHTMLFiles( const TQString &filename, int recipe_id ); + static void removeHTMLFiles( const TQString &filename, const TQValueList &recipe_ids ); - void setTemplate( const QString &filename ); - void setStyle( const QString &filename ); + void setTemplate( const TQString &filename ); + void setStyle( const TQString &filename ); protected: - QString createContent( const Recipe& recipe ); - virtual QString createContent( const RecipeList & ); - virtual QString createHeader( const RecipeList & ); - virtual QString createFooter(); + TQString createContent( const Recipe& recipe ); + virtual TQString createContent( const RecipeList & ); + virtual TQString createHeader( const RecipeList & ); + virtual TQString createFooter(); virtual int progressInterval() const { return 1; } - virtual void loadBackgroundColor( const QString &obj, const QColor& ); - virtual void loadFont( const QString &obj, const QFont& ); - virtual void loadTextColor( const QString &obj, const QColor& ); - virtual void loadVisibility( const QString &obj, bool ); - virtual void loadAlignment( const QString &obj, int ); - virtual void loadBorder( const QString &obj, const KreBorder& ); - virtual void loadColumns( const QString & obj, int cols ); + virtual void loadBackgroundColor( const TQString &obj, const TQColor& ); + virtual void loadFont( const TQString &obj, const TQFont& ); + virtual void loadTextColor( const TQString &obj, const TQColor& ); + virtual void loadVisibility( const TQString &obj, bool ); + virtual void loadAlignment( const TQString &obj, int ); + virtual void loadBorder( const TQString &obj, const KreBorder& ); + virtual void loadColumns( const TQString & obj, int cols ); - virtual void beginObject( const QString &obj ); + virtual void beginObject( const TQString &obj ); virtual void endObject(); - static QString escape( const QString & ); + static TQString escape( const TQString & ); - QString m_templateContent; + TQString m_templateContent; private: void storePhoto( const Recipe &recipe ); - void populateTemplate( const Recipe &recipe, QString &content ); - void replaceIfVisible( QString &content, const QString &name, const QString &html ); - QString HTMLIfVisible( const QString &name, const QString &html ); - - QString m_layoutFilename; - QString m_templateFilename; - QString m_cachedCSS; - QMap m_visibilityMap; - QMap m_columnsMap; + void populateTemplate( const Recipe &recipe, TQString &content ); + void replaceIfVisible( TQString &content, const TQString &name, const TQString &html ); + TQString HTMLIfVisible( const TQString &name, const TQString &html ); + + TQString m_layoutFilename; + TQString m_templateFilename; + TQString m_cachedCSS; + TQMap m_visibilityMap; + TQMap m_columnsMap; bool m_error; }; diff --git a/krecipes/src/exporters/kreexporter.cpp b/krecipes/src/exporters/kreexporter.cpp index 5ed1b65..70eef9b 100644 --- a/krecipes/src/exporters/kreexporter.cpp +++ b/krecipes/src/exporters/kreexporter.cpp @@ -13,10 +13,10 @@ #include "kreexporter.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -26,7 +26,7 @@ #include "backends/recipedb.h" -KreExporter::KreExporter( CategoryTree *_categories, const QString& filename, const QString &format ) : +KreExporter::KreExporter( CategoryTree *_categories, const TQString& filename, const TQString &format ) : BaseExporter( filename, format ), categories( _categories ) { if ( format == "*.kre" ) { @@ -50,9 +50,9 @@ int KreExporter::headerFlags() const return RecipeDB::Categories; } -QString KreExporter::createHeader( const RecipeList& recipes ) +TQString KreExporter::createHeader( const RecipeList& recipes ) { - QString xml; + TQString xml; xml += "\n"; xml += "language() + "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"krecipes.xsd\">\n"; @@ -62,58 +62,58 @@ QString KreExporter::createHeader( const RecipeList& recipes ) return xml; } -QString KreExporter::createFooter() +TQString KreExporter::createFooter() { return "\n"; } -QString KreExporter::generateIngredient( const IngredientData &ing ) +TQString KreExporter::generateIngredient( const IngredientData &ing ) { - QString xml; + TQString xml; - xml += "" + QStyleSheet::escape( ( ing ).name ) + "\n"; + xml += "" + TQStyleSheet::escape( ( ing ).name ) + "\n"; xml += ""; if ( ing.amount_offset < 1e-10 ) { - xml += QString::number( ing.amount ); + xml += TQString::number( ing.amount ); } else { - xml += ""+QString::number( ing.amount )+""; - xml += ""+QString::number( ing.amount + ing.amount_offset )+""; + xml += ""+TQString::number( ing.amount )+""; + xml += ""+TQString::number( ing.amount + ing.amount_offset )+""; } xml += "\n"; - QString unit_str = ( ing.amount+ing.amount_offset > 1 ) ? ing.units.plural : ing.units.name; - xml += "" + QStyleSheet::escape( unit_str ) + "\n"; + TQString unit_str = ( ing.amount+ing.amount_offset > 1 ) ? ing.units.plural : ing.units.name; + xml += "" + TQStyleSheet::escape( unit_str ) + "\n"; if ( ing.prepMethodList.count() > 0 ) - xml += "" + QStyleSheet::escape( ing.prepMethodList.join(",") ) + "\n"; + xml += "" + TQStyleSheet::escape( ing.prepMethodList.join(",") ) + "\n"; return xml; } -//TODO: use QDOM (see recipemlexporter.cpp)? -QString KreExporter::createContent( const RecipeList& recipes ) +//TODO: use TQDOM (see recipemlexporter.cpp)? +TQString KreExporter::createContent( const RecipeList& recipes ) { - QString xml; + TQString xml; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { xml += "\n"; xml += "\n"; - xml += "" + QStyleSheet::escape( ( *recipe_it ).title ) + "\n"; + xml += "" + TQStyleSheet::escape( ( *recipe_it ).title ) + "\n"; for ( ElementList::const_iterator author_it = ( *recipe_it ).authorList.begin(); author_it != ( *recipe_it ).authorList.end(); ++author_it ) - xml += "" + QStyleSheet::escape( ( *author_it ).name ) + "\n"; + xml += "" + TQStyleSheet::escape( ( *author_it ).name ) + "\n"; xml += "\n"; if ( !( *recipe_it ).photo.isNull() ) { xml += "\n"; for ( ElementList::const_iterator cat_it = ( *recipe_it ).categoryList.begin(); cat_it != ( *recipe_it ).categoryList.end(); ++cat_it ) - xml += "" + QStyleSheet::escape( ( *cat_it ).name ) + "\n"; + xml += "" + TQStyleSheet::escape( ( *cat_it ).name ) + "\n"; xml += "\n"; xml += ""; xml += ""; if ( ( *recipe_it ).yield.amount_offset < 1e-10 ) { - xml += QString::number( ( *recipe_it ).yield.amount ); + xml += TQString::number( ( *recipe_it ).yield.amount ); } else { - xml += ""+QString::number( ( *recipe_it ).yield.amount )+""; - xml += ""+QString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset )+""; + xml += ""+TQString::number( ( *recipe_it ).yield.amount )+""; + xml += ""+TQString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset )+""; } xml += ""; xml += ""+( *recipe_it ).yield.type+""; @@ -146,9 +146,9 @@ QString KreExporter::createContent( const RecipeList& recipes ) IngredientList list_copy = ( *recipe_it ).ingList; for ( IngredientList group_list = list_copy.firstGroup(); group_list.count() != 0; group_list = list_copy.nextGroup() ) { - QString group = group_list[ 0 ].group; //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group; //just use the first's name... they're all the same if ( !group.isEmpty() ) - xml += "\n"; + xml += "\n"; for ( IngredientList::const_iterator ing_it = group_list.begin(); ing_it != group_list.end(); ++ing_it ) { xml += "\n"; @@ -157,7 +157,7 @@ QString KreExporter::createContent( const RecipeList& recipes ) if ( (*ing_it).substitutes.count() > 0 ) { xml += "\n"; - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { xml += "\n"; xml += generateIngredient(*sub_it); xml += "\n"; @@ -176,21 +176,21 @@ QString KreExporter::createContent( const RecipeList& recipes ) xml += "\n"; xml += "\n"; - xml += QStyleSheet::escape( ( *recipe_it ).instructions ); + xml += TQStyleSheet::escape( ( *recipe_it ).instructions ); xml += "\n"; //ratings xml += ""; for ( RatingList::const_iterator rating_it = (*recipe_it).ratingList.begin(); rating_it != (*recipe_it).ratingList.end(); ++rating_it ) { xml += ""; - xml += ""+QStyleSheet::escape( ( *rating_it ).comment )+""; - xml += ""+QStyleSheet::escape( ( *rating_it ).rater )+""; + xml += ""+TQStyleSheet::escape( ( *rating_it ).comment )+""; + xml += ""+TQStyleSheet::escape( ( *rating_it ).rater )+""; xml += ""; for ( RatingCriteriaList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { xml += ""; xml += ""+(*rc_it).name+""; - xml += ""+QString::number((*rc_it).stars)+""; + xml += ""+TQString::number((*rc_it).stars)+""; xml += ""; } xml += ""; @@ -204,9 +204,9 @@ QString KreExporter::createContent( const RecipeList& recipes ) return xml; } -void KreExporter::createCategoryStructure( QString &xml, const RecipeList &recipes ) +void KreExporter::createCategoryStructure( TQString &xml, const RecipeList &recipes ) { - QValueList categoriesUsed; + TQValueList categoriesUsed; for ( RecipeList::const_iterator recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { for ( ElementList::const_iterator cat_it = ( *recipe_it ).categoryList.begin(); cat_it != ( *recipe_it ).categoryList.end(); ++cat_it ) { if ( categoriesUsed.find( ( *cat_it ).id ) == categoriesUsed.end() ) @@ -224,7 +224,7 @@ void KreExporter::createCategoryStructure( QString &xml, const RecipeList &recip } } -bool KreExporter::removeIfUnused( const QValueList &cat_ids, CategoryTree *parent, bool parent_should_show ) +bool KreExporter::removeIfUnused( const TQValueList &cat_ids, CategoryTree *parent, bool parent_should_show ) { for ( CategoryTree * it = parent->firstChild(); it; it = it->nextSibling() ) { if ( cat_ids.find( it->category.id ) != cat_ids.end() ) { @@ -248,11 +248,11 @@ bool KreExporter::removeIfUnused( const QValueList &cat_ids, CategoryTree * return parent_should_show; } -void KreExporter::writeCategoryStructure( QString &xml, const CategoryTree *categoryTree ) +void KreExporter::writeCategoryStructure( TQString &xml, const CategoryTree *categoryTree ) { if ( categoryTree->category.id != -2 ) { if ( categoryTree->category.id != -1 ) - xml += "category.name ).replace("\"",""") + "\">\n"; + xml += "category.name ).replace("\"",""") + "\">\n"; for ( CategoryTree * child_it = categoryTree->firstChild(); child_it; child_it = child_it->nextSibling() ) { writeCategoryStructure( xml, child_it ); diff --git a/krecipes/src/exporters/kreexporter.h b/krecipes/src/exporters/kreexporter.h index 9626933..d6b0b17 100644 --- a/krecipes/src/exporters/kreexporter.h +++ b/krecipes/src/exporters/kreexporter.h @@ -27,23 +27,23 @@ Export class for Krecipes native file format (.kre, .kreml) class KreExporter : public BaseExporter { public: - KreExporter( CategoryTree *, const QString&, const QString& ); + KreExporter( CategoryTree *, const TQString&, const TQString& ); virtual ~KreExporter(); virtual int supportedItems() const; protected: - virtual QString createContent( const RecipeList & ); - virtual QString createHeader( const RecipeList & ); - virtual QString createFooter(); + virtual TQString createContent( const RecipeList & ); + virtual TQString createHeader( const RecipeList & ); + virtual TQString createFooter(); virtual int headerFlags() const; private: - bool removeIfUnused( const QValueList &cat_ids, CategoryTree *parent, bool parent_should_show = false ); - void createCategoryStructure( QString &xml, const RecipeList &recipes ); - void writeCategoryStructure( QString &xml, const CategoryTree *categoryTree ); - QString generateIngredient( const IngredientData &ing ); + bool removeIfUnused( const TQValueList &cat_ids, CategoryTree *parent, bool parent_should_show = false ); + void createCategoryStructure( TQString &xml, const RecipeList &recipes ); + void writeCategoryStructure( TQString &xml, const CategoryTree *categoryTree ); + TQString generateIngredient( const IngredientData &ing ); CategoryTree *categories; }; diff --git a/krecipes/src/exporters/mmfexporter.cpp b/krecipes/src/exporters/mmfexporter.cpp index c8125df..596111f 100644 --- a/krecipes/src/exporters/mmfexporter.cpp +++ b/krecipes/src/exporters/mmfexporter.cpp @@ -10,7 +10,7 @@ #include "mmfexporter.h" -#include +#include #include #include @@ -21,7 +21,7 @@ #include "datablocks/mixednumber.h" #include "mmdata.h" -MMFExporter::MMFExporter( const QString& filename, const QString& format ) : +MMFExporter::MMFExporter( const TQString& filename, const TQString& format ) : BaseExporter( filename, format ) {} @@ -34,9 +34,9 @@ int MMFExporter::supportedItems() const return RecipeDB::All ^ RecipeDB::Photo ^ RecipeDB::Ratings ^ RecipeDB::Authors; } -QString MMFExporter::createContent( const RecipeList& recipes ) +TQString MMFExporter::createContent( const RecipeList& recipes ) { - QString content; + TQString content; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { @@ -59,16 +59,16 @@ QString MMFExporter::createContent( const RecipeList& recipes ) * Line 3 - "Categories:" followed by a blank space; Maximum of 5 * Line 4 - Numeric quantity representing the # of servings (1-9999) */ -void MMFExporter::writeMMFHeader( QString &content, const Recipe &recipe ) +void MMFExporter::writeMMFHeader( TQString &content, const Recipe &recipe ) { - content += QString( "----- Exported by Krecipes v%1 [Meal-Master Export Format] -----\n\n" ).arg( krecipes_version() ); + content += TQString( "----- Exported by Krecipes v%1 [Meal-Master Export Format] -----\n\n" ).arg( krecipes_version() ); - QString title = recipe.title; + TQString title = recipe.title; title.truncate( 60 ); content += " Title: " + title + "\n"; int i = 0; - QStringList categories; + TQStringList categories; for ( ElementList::const_iterator cat_it = recipe.categoryList.begin(); cat_it != recipe.categoryList.end(); ++cat_it ) { i++; @@ -76,11 +76,11 @@ void MMFExporter::writeMMFHeader( QString &content, const Recipe &recipe ) break; //maximum of 5 categories categories << ( *cat_it ).name; } - QString cat_str = " Categories: " + categories.join( ", " ); + TQString cat_str = " Categories: " + categories.join( ", " ); cat_str.truncate( 67 ); content += cat_str + "\n"; - content += " Servings: " + QString::number( QMIN( 9999, recipe.yield.amount ) ) + "\n"; //some yield info is lost here, but hey, that's the MM format + content += " Servings: " + TQString::number( TQMIN( 9999, recipe.yield.amount ) ) + "\n"; //some yield info is lost here, but hey, that's the MM format } /* Ingredient lines: @@ -90,15 +90,15 @@ void MMFExporter::writeMMFHeader( QString &content, const Recipe &recipe ) * in position 12 and text in positions 13-39 (the latter is a * "continuation" line for the previous ingredient name) */ -void MMFExporter::writeMMFIngredients( QString &content, const Recipe &recipe ) +void MMFExporter::writeMMFIngredients( TQString &content, const Recipe &recipe ) { //this format requires ingredients without a group to be written first for ( IngredientList::const_iterator ing_it = recipe.ingList.begin(); ing_it != recipe.ingList.end(); ++ing_it ) { if ( ( *ing_it ).groupID == -1 ) { writeSingleIngredient( content, *ing_it, (*ing_it).substitutes.count() > 0 ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList::const_iterator save_it = sub_it; + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList::const_iterator save_it = sub_it; ++sub_it; writeSingleIngredient( content, *save_it, sub_it != (*ing_it).substitutes.end() ); @@ -111,19 +111,19 @@ void MMFExporter::writeMMFIngredients( QString &content, const Recipe &recipe ) if ( group_list[ 0 ].groupID == -1 ) //we already handled this group continue; - QString group = group_list[ 0 ].group.left( 76 ); //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group.left( 76 ); //just use the first's name... they're all the same if ( !group.isEmpty() ) { int length = group.length(); - QString filler_lt = QString().fill( '-', ( 76 - length ) / 2 ); - QString filler_rt = ( length % 2 ) ? QString().fill( '-', ( 76 - length ) / 2 + 1 ) : filler_lt; + TQString filler_lt = TQString().fill( '-', ( 76 - length ) / 2 ); + TQString filler_rt = ( length % 2 ) ? TQString().fill( '-', ( 76 - length ) / 2 + 1 ) : filler_lt; content += filler_lt + group + filler_rt + "\n"; } for ( IngredientList::const_iterator ing_it = group_list.begin(); ing_it != group_list.end(); ++ing_it ) { writeSingleIngredient( content, *ing_it, (*ing_it).substitutes.count() > 0 ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList::const_iterator save_it = sub_it; + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList::const_iterator save_it = sub_it; ++sub_it; writeSingleIngredient( content, *save_it, sub_it != (*ing_it).substitutes.end() ); @@ -132,7 +132,7 @@ void MMFExporter::writeMMFIngredients( QString &content, const Recipe &recipe ) } } -void MMFExporter::writeSingleIngredient( QString &content, const Ingredient &ing, bool is_sub ) +void MMFExporter::writeSingleIngredient( TQString &content, const Ingredient &ing, bool is_sub ) { KConfig * config = kapp->config(); config->setGroup( "Formatting" ); @@ -151,7 +151,7 @@ void MMFExporter::writeSingleIngredient( QString &content, const Ingredient &ing unit_info[ i ].plural_expanded_form == ing.units.plural || unit_info[ i ].short_form == ing.units.name ) { found_short_form = true; - content += QString( unit_info[ i ].short_form ).leftJustify( 2 ) + " "; + content += TQString( unit_info[ i ].short_form ).leftJustify( 2 ) + " "; break; } } @@ -162,7 +162,7 @@ void MMFExporter::writeSingleIngredient( QString &content, const Ingredient &ing } //columns 12-39 - QString ing_name( ing.name ); + TQString ing_name( ing.name ); if ( ing.prepMethodList.count() > 0 ) ing_name += "; " + ing.prepMethodList.join(", "); @@ -188,25 +188,25 @@ void MMFExporter::writeSingleIngredient( QString &content, const Ingredient &ing content += " -" + ing_name.mid( 28 * ( i ) + split_index, 28 ) + "\n"; } -void MMFExporter::writeMMFDirections( QString &content, const Recipe &recipe ) +void MMFExporter::writeMMFDirections( TQString &content, const Recipe &recipe ) { - QStringList lines = QStringList::split("\n",recipe.instructions,true); - for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { + TQStringList lines = TQStringList::split("\n",recipe.instructions,true); + for ( TQStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { content += wrapText( *it, 80 ).join( "\n" ) + "\n"; } } -QStringList MMFExporter::wrapText( const QString& str, int at ) const +TQStringList MMFExporter::wrapText( const TQString& str, int at ) const { - QStringList ret; - QString copy( str ); + TQStringList ret; + TQString copy( str ); bool stop = false; while ( !stop ) { - QString line( copy.left( at ) ); + TQString line( copy.left( at ) ); if ( line.length() >= copy.length() ) stop = true; else { - QRegExp rxp( "(\\s\\S*)$", false ); // last word in the new line + TQRegExp rxp( "(\\s\\S*)$", false ); // last word in the new line rxp.setMinimal( true ); // one word, only one word, please line = line.replace( rxp, "" ); // remove last word } diff --git a/krecipes/src/exporters/mmfexporter.h b/krecipes/src/exporters/mmfexporter.h index 5b50f4d..6cb1d8a 100644 --- a/krecipes/src/exporters/mmfexporter.h +++ b/krecipes/src/exporters/mmfexporter.h @@ -31,21 +31,21 @@ class MMFExporter : public BaseExporter { public: - MMFExporter( const QString&, const QString& ); + MMFExporter( const TQString&, const TQString& ); virtual ~MMFExporter(); virtual int supportedItems() const; protected: - virtual QString createContent( const RecipeList & ); + virtual TQString createContent( const RecipeList & ); private: - void writeMMFHeader( QString &content, const Recipe &recipe ); - void writeMMFIngredients( QString &content, const Recipe &recipe ); - void writeSingleIngredient( QString &content, const Ingredient &ing, bool is_sub = false ); - void writeMMFDirections( QString &content, const Recipe &recipe ); + void writeMMFHeader( TQString &content, const Recipe &recipe ); + void writeMMFIngredients( TQString &content, const Recipe &recipe ); + void writeSingleIngredient( TQString &content, const Ingredient &ing, bool is_sub = false ); + void writeMMFDirections( TQString &content, const Recipe &recipe ); - QStringList wrapText( const QString& str, int at ) const; + TQStringList wrapText( const TQString& str, int at ) const; }; #endif //MMFEXPORTER_H diff --git a/krecipes/src/exporters/plaintextexporter.cpp b/krecipes/src/exporters/plaintextexporter.cpp index 3fa6a57..f9be518 100644 --- a/krecipes/src/exporters/plaintextexporter.cpp +++ b/krecipes/src/exporters/plaintextexporter.cpp @@ -16,7 +16,7 @@ #include "backends/recipedb.h" -PlainTextExporter::PlainTextExporter( const QString& filename, const QString& format ) : +PlainTextExporter::PlainTextExporter( const TQString& filename, const TQString& format ) : BaseExporter( filename, format ) {} @@ -29,13 +29,13 @@ int PlainTextExporter::supportedItems() const return RecipeDB::All ^ RecipeDB::Photo; } -QString PlainTextExporter::generateIngredient( const IngredientData &ing, MixedNumber::Format number_format ) +TQString PlainTextExporter::generateIngredient( const IngredientData &ing, MixedNumber::Format number_format ) { KConfig *config = KGlobal::config(); - QString content; + TQString content; - QString amount_str = MixedNumber( ing.amount ).toString( number_format ); + TQString amount_str = MixedNumber( ing.amount ).toString( number_format ); if ( ing.amount_offset > 0 ) amount_str += "-"+MixedNumber( ing.amount + ing.amount_offset ).toString( number_format ); @@ -46,7 +46,7 @@ QString PlainTextExporter::generateIngredient( const IngredientData &ing, MixedN if ( !amount_str.isEmpty() ) content += " "; - QString unit_str = ing.units.determineName( ing.amount + ing.amount_offset, config->readBoolEntry("AbbreviateUnits") ); + TQString unit_str = ing.units.determineName( ing.amount + ing.amount_offset, config->readBoolEntry("AbbreviateUnits") ); content += unit_str; if ( !unit_str.isEmpty() ) @@ -61,39 +61,39 @@ QString PlainTextExporter::generateIngredient( const IngredientData &ing, MixedN } -QString PlainTextExporter::createContent( const RecipeList& recipes ) +TQString PlainTextExporter::createContent( const RecipeList& recipes ) { KConfig *config = KGlobal::config(); config->setGroup( "Formatting" ); MixedNumber::Format number_format = ( config->readBoolEntry( "Fraction" ) ) ? MixedNumber::MixedNumberFormat : MixedNumber::DecimalFormat; - QString content; + TQString content; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { content += ( *recipe_it ).title + "\n\n"; if ( ( *recipe_it ).authorList.count() > 0 ) { - content += QString("%1: ").arg(i18n("Authors")); + content += TQString("%1: ").arg(i18n("Authors")); content += ( *recipe_it ).authorList.join(", "); content += "\n"; } if ( ( *recipe_it ).categoryList.count() > 0 ) { - content += QString("%1: ").arg(i18n("Categories")); + content += TQString("%1: ").arg(i18n("Categories")); content += ( *recipe_it ).categoryList.join(", "); content += "\n"; } if ( ( *recipe_it ).yield.amount > 0 ) { - content += QString("%1: ").arg(i18n("Yields")); + content += TQString("%1: ").arg(i18n("Yields")); content += ( *recipe_it ).yield.toString(); content += "\n"; } if ( !( *recipe_it ).prepTime.isNull() ) { - content += QString("%1: ").arg(i18n("Preparation Time")); + content += TQString("%1: ").arg(i18n("Preparation Time")); content += ( *recipe_it ).prepTime.toString( "hh:mm" ); content += "\n"; } @@ -102,7 +102,7 @@ QString PlainTextExporter::createContent( const RecipeList& recipes ) IngredientList list_copy = ( *recipe_it ).ingList; for ( IngredientList group_list = list_copy.firstGroup(); group_list.count() != 0; group_list = list_copy.nextGroup() ) { - QString group = group_list[ 0 ].group; //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group; //just use the first's name... they're all the same if ( !group.isEmpty() ) content += group + ":\n"; @@ -116,7 +116,7 @@ QString PlainTextExporter::createContent( const RecipeList& recipes ) content += ", "+i18n("or"); content += "\n"; - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { if ( !group.isEmpty() ) content += " "; @@ -150,8 +150,8 @@ QString PlainTextExporter::createContent( const RecipeList& recipes ) for ( RatingCriteriaList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { //FIXME: This is an ugly hack, but I don't know how else to be i18n friendly (if this is even that) // and still be able to display the amount as a fraction - QString starsTrans = i18n("1 star","%n stars",qRound((*rc_it).stars)); - starsTrans.replace(QString::number(qRound((*rc_it).stars)),MixedNumber((*rc_it).stars).toString()); + TQString starsTrans = i18n("1 star","%n stars",tqRound((*rc_it).stars)); + starsTrans.replace(TQString::number(tqRound((*rc_it).stars)),MixedNumber((*rc_it).stars).toString()); content += " "+(*rc_it).name+": "+starsTrans+"\n"; } diff --git a/krecipes/src/exporters/plaintextexporter.h b/krecipes/src/exporters/plaintextexporter.h index f38e2ca..1f4a727 100644 --- a/krecipes/src/exporters/plaintextexporter.h +++ b/krecipes/src/exporters/plaintextexporter.h @@ -27,16 +27,16 @@ class IngredientData; class PlainTextExporter : public BaseExporter { public: - PlainTextExporter( const QString&, const QString& ); + PlainTextExporter( const TQString&, const TQString& ); virtual ~PlainTextExporter(); virtual int supportedItems() const; protected: - virtual QString createContent( const RecipeList & ); + virtual TQString createContent( const RecipeList & ); private: - QString generateIngredient( const IngredientData &ing, MixedNumber::Format number_format ); + TQString generateIngredient( const IngredientData &ing, MixedNumber::Format number_format ); }; #endif //PLAINTEXTEXPORTER_H diff --git a/krecipes/src/exporters/recipemlexporter.cpp b/krecipes/src/exporters/recipemlexporter.cpp index 4a6bfc9..71fed09 100644 --- a/krecipes/src/exporters/recipemlexporter.cpp +++ b/krecipes/src/exporters/recipemlexporter.cpp @@ -15,7 +15,7 @@ #include "backends/recipedb.h" -RecipeMLExporter::RecipeMLExporter( const QString& filename, const QString& format ) : +RecipeMLExporter::RecipeMLExporter( const TQString& filename, const TQString& format ) : BaseExporter( filename, format ) {} @@ -28,106 +28,106 @@ int RecipeMLExporter::supportedItems() const return RecipeDB::All ^ RecipeDB::Photo ^ RecipeDB::Ratings; } -QString RecipeMLExporter::createHeader( const RecipeList& ) +TQString RecipeMLExporter::createHeader( const RecipeList& ) { - QString xml = "\n"; + TQString xml = "\n"; xml += ""; xml += "\n"; return xml; } -QString RecipeMLExporter::createFooter() +TQString RecipeMLExporter::createFooter() { return ""; } -void RecipeMLExporter::createIngredient( QDomElement &ing_tag, const IngredientData &ing, QDomDocument &doc ) +void RecipeMLExporter::createIngredient( TQDomElement &ing_tag, const IngredientData &ing, TQDomDocument &doc ) { - QDomElement amt_tag = doc.createElement( "amt" ); + TQDomElement amt_tag = doc.createElement( "amt" ); ing_tag.appendChild( amt_tag ); - QDomElement qty_tag = doc.createElement( "qty" ); + TQDomElement qty_tag = doc.createElement( "qty" ); amt_tag.appendChild( qty_tag ); if ( ing.amount_offset < 1e-10 ) - qty_tag.appendChild( doc.createTextNode( QString::number( ing.amount ) ) ); + qty_tag.appendChild( doc.createTextNode( TQString::number( ing.amount ) ) ); else { - QDomElement range_tag = doc.createElement( "range" ); + TQDomElement range_tag = doc.createElement( "range" ); qty_tag.appendChild(range_tag); - QDomElement q1_tag = doc.createElement( "q1" ); - q1_tag.appendChild( doc.createTextNode( QString::number( ing.amount ) ) ); - QDomElement q2_tag = doc.createElement( "q2" ); - q2_tag.appendChild( doc.createTextNode( QString::number( ing.amount + ing.amount_offset ) ) ); + TQDomElement q1_tag = doc.createElement( "q1" ); + q1_tag.appendChild( doc.createTextNode( TQString::number( ing.amount ) ) ); + TQDomElement q2_tag = doc.createElement( "q2" ); + q2_tag.appendChild( doc.createTextNode( TQString::number( ing.amount + ing.amount_offset ) ) ); range_tag.appendChild(q1_tag); range_tag.appendChild(q2_tag); } - QDomElement unit_tag = doc.createElement( "unit" ); + TQDomElement unit_tag = doc.createElement( "unit" ); amt_tag.appendChild( unit_tag ); unit_tag.appendChild( doc.createTextNode( ( ing.amount > 1 ) ? ing.units.plural : ing.units.name ) ); - QDomElement item_tag = doc.createElement( "item" ); + TQDomElement item_tag = doc.createElement( "item" ); item_tag.appendChild( doc.createTextNode( ing.name ) ); ing_tag.appendChild( item_tag ); - QDomElement prep_tag = doc.createElement( "prep" ); + TQDomElement prep_tag = doc.createElement( "prep" ); prep_tag.appendChild( doc.createTextNode( ing.prepMethodList.join(",") ) ); ing_tag.appendChild( prep_tag ); } -QString RecipeMLExporter::createContent( const RecipeList& recipes ) +TQString RecipeMLExporter::createContent( const RecipeList& recipes ) { - QDomDocument doc; + TQDomDocument doc; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { - QDomElement recipe_tag = doc.createElement( "recipe" ); + TQDomElement recipe_tag = doc.createElement( "recipe" ); doc.appendChild(recipe_tag); //recipe_root.appendChild( recipe_tag ); //will append to either if exists or else - QDomElement head_tag = doc.createElement( "head" ); + TQDomElement head_tag = doc.createElement( "head" ); recipe_tag.appendChild( head_tag ); - QDomElement title_tag = doc.createElement( "title" ); + TQDomElement title_tag = doc.createElement( "title" ); title_tag.appendChild( doc.createTextNode( ( *recipe_it ).title ) ); head_tag.appendChild( title_tag ); - QDomElement source_tag = doc.createElement( "source" ); + TQDomElement source_tag = doc.createElement( "source" ); for ( ElementList::const_iterator author_it = ( *recipe_it ).authorList.begin(); author_it != ( *recipe_it ).authorList.end(); ++author_it ) { - QDomElement srcitem_tag = doc.createElement( "srcitem" ); + TQDomElement srcitem_tag = doc.createElement( "srcitem" ); srcitem_tag.appendChild( doc.createTextNode( ( *author_it ).name ) ); source_tag.appendChild( srcitem_tag ); } head_tag.appendChild( source_tag ); - QDomElement categories_tag = doc.createElement( "categories" ); + TQDomElement categories_tag = doc.createElement( "categories" ); for ( ElementList::const_iterator cat_it = ( *recipe_it ).categoryList.begin(); cat_it != ( *recipe_it ).categoryList.end(); ++cat_it ) { - QDomElement cat_tag = doc.createElement( "cat" ); + TQDomElement cat_tag = doc.createElement( "cat" ); cat_tag.appendChild( doc.createTextNode( ( *cat_it ).name ) ); categories_tag.appendChild( cat_tag ); } head_tag.appendChild( categories_tag ); - QDomElement yield_tag = doc.createElement( "yield" ); + TQDomElement yield_tag = doc.createElement( "yield" ); if ( ( *recipe_it ).yield.amount_offset < 1e-10 ) - yield_tag.appendChild( doc.createTextNode( QString::number( ( *recipe_it ).yield.amount ) ) ); + yield_tag.appendChild( doc.createTextNode( TQString::number( ( *recipe_it ).yield.amount ) ) ); else { - QDomElement range_tag = doc.createElement( "range" ); + TQDomElement range_tag = doc.createElement( "range" ); yield_tag.appendChild(range_tag); - QDomElement q1_tag = doc.createElement( "q1" ); - q1_tag.appendChild( doc.createTextNode( QString::number(( *recipe_it ).yield.amount ) ) ); - QDomElement q2_tag = doc.createElement( "q2" ); - q2_tag.appendChild( doc.createTextNode( QString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset ) ) ); + TQDomElement q1_tag = doc.createElement( "q1" ); + q1_tag.appendChild( doc.createTextNode( TQString::number(( *recipe_it ).yield.amount ) ) ); + TQDomElement q2_tag = doc.createElement( "q2" ); + q2_tag.appendChild( doc.createTextNode( TQString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset ) ) ); range_tag.appendChild(q1_tag); range_tag.appendChild(q2_tag); } if ( !( *recipe_it ).yield.type.isEmpty() ) { - QDomElement yield_unit_tag = doc.createElement( "unit" ); + TQDomElement yield_unit_tag = doc.createElement( "unit" ); yield_unit_tag.appendChild( doc.createTextNode(( *recipe_it ).yield.type) ); yield_tag.appendChild( yield_unit_tag ); } @@ -135,31 +135,31 @@ QString RecipeMLExporter::createContent( const RecipeList& recipes ) head_tag.appendChild( yield_tag ); if ( !( *recipe_it ).prepTime.isNull() ) { - QDomElement preptime_tag = doc.createElement( "preptime" ); + TQDomElement preptime_tag = doc.createElement( "preptime" ); head_tag.appendChild( preptime_tag ); preptime_tag.setAttribute( "type", i18n( "Total" ) ); - QDomElement preptime_time_tag = doc.createElement( "time" ); + TQDomElement preptime_time_tag = doc.createElement( "time" ); preptime_tag.appendChild( preptime_time_tag ); - QDomElement preptime_min_qty_tag = doc.createElement( "qty" ); + TQDomElement preptime_min_qty_tag = doc.createElement( "qty" ); preptime_time_tag.appendChild( preptime_min_qty_tag ); - preptime_min_qty_tag.appendChild( doc.createTextNode( QString::number( ( *recipe_it ).prepTime.minute() + ( *recipe_it ).prepTime.hour() * 60 ) ) ); + preptime_min_qty_tag.appendChild( doc.createTextNode( TQString::number( ( *recipe_it ).prepTime.minute() + ( *recipe_it ).prepTime.hour() * 60 ) ) ); - QDomElement preptime_min_unit_tag = doc.createElement( "timeunit" ); + TQDomElement preptime_min_unit_tag = doc.createElement( "timeunit" ); preptime_time_tag.appendChild( preptime_min_unit_tag ); preptime_min_unit_tag.appendChild( doc.createTextNode( "minutes" ) ); } - QDomElement ingredients_tag = doc.createElement( "ingredients" ); + TQDomElement ingredients_tag = doc.createElement( "ingredients" ); IngredientList list_copy = ( *recipe_it ).ingList; for ( IngredientList group_list = list_copy.firstGroup(); group_list.count() != 0; group_list = list_copy.nextGroup() ) { - QDomElement ing_root; + TQDomElement ing_root; - QString group = group_list[ 0 ].group; //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group; //just use the first's name... they're all the same if ( !group.isEmpty() ) { - QDomElement ingdiv_tag = doc.createElement( "ing-div" ); - QDomElement title_tag = doc.createElement( "title" ); + TQDomElement ingdiv_tag = doc.createElement( "ing-div" ); + TQDomElement title_tag = doc.createElement( "title" ); title_tag.appendChild( doc.createTextNode( group ) ); ingdiv_tag.appendChild( title_tag ); ingredients_tag.appendChild( ingdiv_tag ); @@ -169,13 +169,13 @@ QString RecipeMLExporter::createContent( const RecipeList& recipes ) ing_root = ingredients_tag; for ( IngredientList::const_iterator ing_it = group_list.begin(); ing_it != group_list.end(); ++ing_it ) { - QDomElement ing_tag = doc.createElement( "ing" ); + TQDomElement ing_tag = doc.createElement( "ing" ); ing_root.appendChild( ing_tag ); createIngredient( ing_tag, *ing_it, doc ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { - QDomElement alt_ing_tag = doc.createElement( "alt-ing" ); + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + TQDomElement alt_ing_tag = doc.createElement( "alt-ing" ); ing_tag.appendChild( alt_ing_tag ); createIngredient( alt_ing_tag, *sub_it, doc ); } @@ -183,10 +183,10 @@ QString RecipeMLExporter::createContent( const RecipeList& recipes ) } recipe_tag.appendChild( ingredients_tag ); - QDomElement directions_tag = doc.createElement( "directions" ); + TQDomElement directions_tag = doc.createElement( "directions" ); recipe_tag.appendChild( directions_tag ); - QDomElement step_tag = doc.createElement( "step" ); //we've just got everything in one step + TQDomElement step_tag = doc.createElement( "step" ); //we've just got everything in one step directions_tag.appendChild( step_tag ); step_tag.appendChild( doc.createTextNode( ( *recipe_it ).instructions ) ); } diff --git a/krecipes/src/exporters/recipemlexporter.h b/krecipes/src/exporters/recipemlexporter.h index b975c67..2f8fcef 100644 --- a/krecipes/src/exporters/recipemlexporter.h +++ b/krecipes/src/exporters/recipemlexporter.h @@ -13,7 +13,7 @@ #include "baseexporter.h" -#include +#include class IngredientData; @@ -28,18 +28,18 @@ class IngredientData; class RecipeMLExporter : public BaseExporter { public: - RecipeMLExporter( const QString&, const QString& ); + RecipeMLExporter( const TQString&, const TQString& ); virtual ~RecipeMLExporter(); virtual int supportedItems() const; protected: - virtual QString createContent( const RecipeList& ); - virtual QString createHeader( const RecipeList& ); - virtual QString createFooter(); + virtual TQString createContent( const RecipeList& ); + virtual TQString createHeader( const RecipeList& ); + virtual TQString createFooter(); private: - void createIngredient( QDomElement &ing_tag, const IngredientData &, QDomDocument &doc ); + void createIngredient( TQDomElement &ing_tag, const IngredientData &, TQDomDocument &doc ); }; #endif //RECIPEMLEXPORTER_H diff --git a/krecipes/src/exporters/rezkonvexporter.cpp b/krecipes/src/exporters/rezkonvexporter.cpp index e714897..9e90adb 100644 --- a/krecipes/src/exporters/rezkonvexporter.cpp +++ b/krecipes/src/exporters/rezkonvexporter.cpp @@ -10,7 +10,7 @@ #include "rezkonvexporter.h" -#include +#include #include #include @@ -88,7 +88,7 @@ static translate_unit_info translate_units[] = { { 0, 0, 0, 0 } }; -RezkonvExporter::RezkonvExporter( const QString& filename, const QString& format ) : +RezkonvExporter::RezkonvExporter( const TQString& filename, const TQString& format ) : BaseExporter( filename, format ) {} @@ -101,9 +101,9 @@ int RezkonvExporter::supportedItems() const return RecipeDB::All ^ RecipeDB::Photo ^ RecipeDB::Ratings; } -QString RezkonvExporter::createContent( const RecipeList& recipes ) +TQString RezkonvExporter::createContent( const RecipeList& recipes ) { - QString content; + TQString content; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { @@ -126,16 +126,16 @@ QString RezkonvExporter::createContent( const RecipeList& recipes ) * Line 3 - "Categories:" followed by a blank space; Maximum of 5 * Line 4 - Numeric quantity representing the # of servings (1-9999) */ -void RezkonvExporter::writeHeader( QString &content, const Recipe &recipe ) +void RezkonvExporter::writeHeader( TQString &content, const Recipe &recipe ) { - content += QString( "===== Exported by Krecipes v%1 [REZKONV Export Format] =====\n\n" ).arg( krecipes_version() ); + content += TQString( "===== Exported by Krecipes v%1 [REZKONV Export Format] =====\n\n" ).arg( krecipes_version() ); - QString title = recipe.title; + TQString title = recipe.title; title.truncate( 60 ); - content += QString("Titel: ").rightJustify( 13, ' ', true) + title + "\n"; + content += TQString("Titel: ").rightJustify( 13, ' ', true) + title + "\n"; int i = 0; - QStringList categories; + TQStringList categories; for ( ElementList::const_iterator cat_it = recipe.categoryList.begin(); cat_it != recipe.categoryList.end(); ++cat_it ) { i++; @@ -143,11 +143,11 @@ void RezkonvExporter::writeHeader( QString &content, const Recipe &recipe ) break; //maximum of 5 categories categories << ( *cat_it ).name; } - QString cat_str = QString("Kategorien: ").rightJustify( 13, ' ', true) + categories.join( ", " ); + TQString cat_str = TQString("Kategorien: ").rightJustify( 13, ' ', true) + categories.join( ", " ); cat_str.truncate( 67 ); content += cat_str + "\n"; - content += QString("Menge: ").rightJustify( 13, ' ', true) + recipe.yield.toString() + "\n"; + content += TQString("Menge: ").rightJustify( 13, ' ', true) + recipe.yield.toString() + "\n"; } /* Ingredient lines: @@ -157,15 +157,15 @@ void RezkonvExporter::writeHeader( QString &content, const Recipe &recipe ) * in position 12 and text in positions 13-39 (the latter is a * "continuation" line for the previous ingredient name) */ -void RezkonvExporter::writeIngredients( QString &content, const Recipe &recipe ) +void RezkonvExporter::writeIngredients( TQString &content, const Recipe &recipe ) { //this format requires ingredients without a group to be written first for ( IngredientList::const_iterator ing_it = recipe.ingList.begin(); ing_it != recipe.ingList.end(); ++ing_it ) { if ( ( *ing_it ).groupID == -1 ) { writeSingleIngredient( content, *ing_it, (*ing_it).substitutes.count() > 0 ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList::const_iterator save_it = sub_it; + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList::const_iterator save_it = sub_it; ++sub_it; writeSingleIngredient( content, *save_it, sub_it != (*ing_it).substitutes.end() ); @@ -178,19 +178,19 @@ void RezkonvExporter::writeIngredients( QString &content, const Recipe &recipe ) if ( group_list[ 0 ].groupID == -1 ) //we already handled this group continue; - QString group = group_list[ 0 ].group.left( 76 ); //just use the first's name... they're all the same + TQString group = group_list[ 0 ].group.left( 76 ); //just use the first's name... they're all the same if ( !group.isEmpty() ) { int length = group.length(); - QString filler_lt = QString().fill( '=', ( 76 - length ) / 2 ); - QString filler_rt = ( length % 2 ) ? QString().fill( '=', ( 76 - length ) / 2 + 1 ) : filler_lt; + TQString filler_lt = TQString().fill( '=', ( 76 - length ) / 2 ); + TQString filler_rt = ( length % 2 ) ? TQString().fill( '=', ( 76 - length ) / 2 + 1 ) : filler_lt; content += filler_lt + group + filler_rt + "\n"; } for ( IngredientList::const_iterator ing_it = group_list.begin(); ing_it != group_list.end(); ++ing_it ) { writeSingleIngredient( content, *ing_it, (*ing_it).substitutes.count() > 0 ); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList::const_iterator save_it = sub_it; + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList::const_iterator save_it = sub_it; ++sub_it; writeSingleIngredient( content, *save_it, sub_it != (*ing_it).substitutes.end() ); @@ -198,9 +198,9 @@ void RezkonvExporter::writeIngredients( QString &content, const Recipe &recipe ) } } - QString authorLines; + TQString authorLines; if ( recipe.authorList.count() > 0 ) { - content += "============================== QUELLE ==============================\n"; + content += "============================== TQUELLE ==============================\n"; authorLines = " "+(*recipe.authorList.begin()).name+"\n"; } for ( ElementList::const_iterator author_it = ++recipe.authorList.begin(); author_it != recipe.authorList.end(); ++author_it ) { @@ -212,7 +212,7 @@ void RezkonvExporter::writeIngredients( QString &content, const Recipe &recipe ) content += authorLines; } -void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientData &ing, bool is_sub ) +void RezkonvExporter::writeSingleIngredient( TQString &content, const IngredientData &ing, bool is_sub ) { KConfig * config = kapp->config(); config->setGroup( "Formatting" ); @@ -220,7 +220,7 @@ void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientD //columns 1-7 if ( ing.amount > 1e-8 ) { - QString amount_str = MixedNumber( ing.amount ).toString( number_format, false ); + TQString amount_str = MixedNumber( ing.amount ).toString( number_format, false ); if ( ing.amount_offset > 0 ) amount_str += "-"+MixedNumber( ing.amount + ing.amount_offset ).toString( number_format, false ); @@ -228,7 +228,7 @@ void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientD if ( amount_str.length() > 7 ) { //too long, let's try the other formatting MixedNumber::Format other_format = (number_format == MixedNumber::DecimalFormat) ? MixedNumber::MixedNumberFormat : MixedNumber::DecimalFormat; - QString new_amount_str = MixedNumber( ing.amount ).toString( other_format, false ); + TQString new_amount_str = MixedNumber( ing.amount ).toString( other_format, false ); if ( ing.amount_offset > 0 ) new_amount_str += "-"+MixedNumber( ing.amount + ing.amount_offset ).toString( other_format, false ); @@ -241,14 +241,14 @@ void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientD content += amount_str.rightJustify( 7, ' ', true ) + " "; } else - content += QString().fill(' ',7+1); + content += TQString().fill(' ',7+1); //columns 9-19 bool found_translation = false; for ( int i = 0; translate_units[ i ].english; i++ ) { if ( translate_units[ i ].english == ing.units.name || translate_units[ i ].english_plural == ing.units.plural || translate_units[ i ].german == ing.units.name || translate_units[ i ].german_plural == ing.units.plural ) { found_translation = true; - QString unit; + TQString unit; if ( ing.amount > 1 ) unit += translate_units[i].german; else @@ -260,11 +260,11 @@ void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientD if ( !found_translation ) { kdDebug() << "Warning: unable to find German translation for: " << ing.units.name << endl; kdDebug() << " This ingredient (" << ing.name << ") will be exported without a unit" << endl; - content += QString().fill(' ',9+1); + content += TQString().fill(' ',9+1); } //columns 21-70 - QString ing_name( ing.name ); + TQString ing_name( ing.name ); if ( ing.prepMethodList.count() > 0 ) ing_name += "; " + ing.prepMethodList.join(", "); @@ -287,28 +287,28 @@ void RezkonvExporter::writeSingleIngredient( QString &content, const IngredientD content += ing_name.left(split_index) + "\n"; for ( unsigned int i = 0; i < ( ing_name.length() - 1 ) / 50; i++ ) //if longer than 50 chars, continue on next line(s) - content += QString().fill(' ',(7+1)+(9+1)) + "-" + ing_name.mid( 50 * ( i ) + split_index, 50 ) + "\n"; + content += TQString().fill(' ',(7+1)+(9+1)) + "-" + ing_name.mid( 50 * ( i ) + split_index, 50 ) + "\n"; } -void RezkonvExporter::writeDirections( QString &content, const Recipe &recipe ) +void RezkonvExporter::writeDirections( TQString &content, const Recipe &recipe ) { - QStringList lines = QStringList::split("\n",recipe.instructions,true); - for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { + TQStringList lines = TQStringList::split("\n",recipe.instructions,true); + for ( TQStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { content += wrapText( *it, 80 ).join( "\n" ) + "\n"; } } -QStringList RezkonvExporter::wrapText( const QString& str, int at ) const +TQStringList RezkonvExporter::wrapText( const TQString& str, int at ) const { - QStringList ret; - QString copy( str ); + TQStringList ret; + TQString copy( str ); bool stop = false; while ( !stop ) { - QString line( copy.left( at ) ); + TQString line( copy.left( at ) ); if ( line.length() >= copy.length() ) stop = true; else { - QRegExp rxp( "(\\s\\S*)$", false ); // last word in the new line + TQRegExp rxp( "(\\s\\S*)$", false ); // last word in the new line rxp.setMinimal( true ); // one word, only one word, please line = line.replace( rxp, "" ); // remove last word } diff --git a/krecipes/src/exporters/rezkonvexporter.h b/krecipes/src/exporters/rezkonvexporter.h index 230a1ba..32ffbd4 100644 --- a/krecipes/src/exporters/rezkonvexporter.h +++ b/krecipes/src/exporters/rezkonvexporter.h @@ -31,21 +31,21 @@ class RezkonvExporter : public BaseExporter { public: - RezkonvExporter( const QString&, const QString& ); + RezkonvExporter( const TQString&, const TQString& ); virtual ~RezkonvExporter(); virtual int supportedItems() const; protected: - virtual QString createContent( const RecipeList & ); + virtual TQString createContent( const RecipeList & ); private: - void writeHeader( QString &content, const Recipe &recipe ); - void writeIngredients( QString &content, const Recipe &recipe ); - void writeSingleIngredient( QString &content, const IngredientData &ing, bool is_sub = false ); - void writeDirections( QString &content, const Recipe &recipe ); + void writeHeader( TQString &content, const Recipe &recipe ); + void writeIngredients( TQString &content, const Recipe &recipe ); + void writeSingleIngredient( TQString &content, const IngredientData &ing, bool is_sub = false ); + void writeDirections( TQString &content, const Recipe &recipe ); - QStringList wrapText( const QString& str, int at ) const; + TQStringList wrapText( const TQString& str, int at ) const; }; #endif //REZKONVEXPORTER_H diff --git a/krecipes/src/importers/baseimporter.cpp b/krecipes/src/importers/baseimporter.cpp index 2cc21a5..9994415 100644 --- a/krecipes/src/importers/baseimporter.cpp +++ b/krecipes/src/importers/baseimporter.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include "datablocks/recipe.h" #include "backends/recipedb.h" @@ -77,12 +77,12 @@ void BaseImporter::add( const Recipe &recipe ) m_recipe_list->append( copy ); } -void BaseImporter::parseFiles( const QStringList &filenames ) +void BaseImporter::parseFiles( const TQStringList &filenames ) { if ( direct ) m_filenames = filenames; else { - for ( QStringList::const_iterator file_it = filenames.begin(); file_it != filenames.end(); ++file_it ) { + for ( TQStringList::const_iterator file_it = filenames.begin(); file_it != filenames.end(); ++file_it ) { file_recipe_count = 0; parseFile( *file_it ); processMessages( *file_it ); @@ -96,12 +96,12 @@ void BaseImporter::import( RecipeDB *db, bool automatic ) m_database = db; m_progress_dialog = new KProgressDialog( kapp->mainWidget(), 0, - i18n( "Importing selected recipes" ), QString::null, true ); + i18n( "Importing selected recipes" ), TQString::null, true ); KProgress *progress = m_progress_dialog->progressBar(); progress->setPercentageVisible(false); progress->setTotalSteps( 0 ); - for ( QStringList::const_iterator file_it = m_filenames.begin(); file_it != m_filenames.end(); ++file_it ) { + for ( TQStringList::const_iterator file_it = m_filenames.begin(); file_it != m_filenames.end(); ++file_it ) { file_recipe_count = 0; parseFile( *file_it ); processMessages( *file_it ); @@ -121,7 +121,7 @@ void BaseImporter::import( RecipeDB *db, bool automatic ) //db->blockSignals(true); m_progress_dialog = new KProgressDialog( kapp->mainWidget(), 0, - i18n( "Importing selected recipes" ), QString::null, true ); + i18n( "Importing selected recipes" ), TQString::null, true ); KProgress *progress = m_progress_dialog->progressBar(); progress->setTotalSteps( m_recipe_list->count() ); progress->setFormat( i18n( "%v/%m Recipes" ) ); @@ -151,7 +151,7 @@ void BaseImporter::importIngredient( IngredientData &ing, RecipeDB *db, KProgres } //create ingredient groups - QString real_group_name = ing.group.left( max_group_length ); + TQString real_group_name = ing.group.left( max_group_length ); int new_group_id = db->findExistingIngredientGroupByName(real_group_name); if ( new_group_id == -1 ) { db->createNewIngGroup( real_group_name ); @@ -227,7 +227,7 @@ void BaseImporter::importRecipes( RecipeList &selected_recipes, RecipeDB *db, KP if ( recipe_it_old != selected_recipes.end() ) selected_recipes.remove( recipe_it_old ); - progress_dialog->setLabel( QString( i18n( "Importing recipe: %1" ) ).arg( ( *recipe_it ).title ) ); + progress_dialog->setLabel( TQString( i18n( "Importing recipe: %1" ) ).arg( ( *recipe_it ).title ) ); progress_dialog->progressBar()->advance( 1 ); kapp->processEvents(); @@ -236,7 +236,7 @@ void BaseImporter::importRecipes( RecipeList &selected_recipes, RecipeDB *db, KP for ( IngredientList::iterator ing_it = ( *recipe_it ).ingList.begin(); ing_it != ing_list_end; ++ing_it ) { importIngredient( *ing_it, db, progress_dialog ); - for ( QValueList::iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList::iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { importIngredient( *sub_it, db, progress_dialog ); } } @@ -352,7 +352,7 @@ void BaseImporter::setUnitRatioInfo( UnitRatioList &ratioList, UnitList &unitLis void BaseImporter::importUnitRatios( RecipeDB *db ) { for ( UnitRatioList::const_iterator it = m_ratioList.begin(); it != m_ratioList.end(); ++it ) { - QString unitName1, unitName2; + TQString unitName1, unitName2; for ( UnitList::const_iterator unit_it = m_unitList.begin(); unit_it != m_unitList.end(); ++unit_it ) { if ( ( *it ).uID1 == ( *unit_it ).id ) { unitName1 = ( *unit_it ).name; @@ -381,17 +381,17 @@ void BaseImporter::importUnitRatios( RecipeDB *db ) } } -void BaseImporter::processMessages( const QString &file ) +void BaseImporter::processMessages( const TQString &file ) { if ( m_error_msgs.count() > 0 ) { // ensures it is detected as RichText - m_master_error += QString( i18n( "Import of recipes from the file \"%1\" failed due to the following error(s):" ) ).arg( file ); + m_master_error += TQString( i18n( "Import of recipes from the file \"%1\" failed due to the following error(s):" ) ).arg( file ); m_master_error += "
    • " + m_error_msgs.join( "
    • " ) + "
    "; m_error_msgs.clear(); } else if ( m_warning_msgs.count() > 0 ) { - m_master_warning += QString( i18n( "The file %1 generated the following warning(s):" ) ).arg( file ); + m_master_warning += TQString( i18n( "The file %1 generated the following warning(s):" ) ).arg( file ); m_master_warning += "
    • " + m_warning_msgs.join( "
    • " ) + "
    "; m_warning_msgs.clear(); diff --git a/krecipes/src/importers/baseimporter.h b/krecipes/src/importers/baseimporter.h index 2c68775..68df558 100644 --- a/krecipes/src/importers/baseimporter.h +++ b/krecipes/src/importers/baseimporter.h @@ -15,8 +15,8 @@ #include -#include -#include +#include +#include #include "datablocks/recipelist.h" #include "datablocks/elementlist.h" @@ -43,20 +43,20 @@ public: BaseImporter(); virtual ~BaseImporter(); - QString getMessages() const + TQString getMessages() const { return m_master_error + m_master_warning; } - QString getErrorMsg() const + TQString getErrorMsg() const { return m_master_error; } - QString getWarningMsg() const + TQString getWarningMsg() const { return m_master_warning; } - void parseFiles( const QStringList &filenames ); + void parseFiles( const TQStringList &filenames ); /** Import all the recipes into the given database. These recipes are the * recipes added to this class by a subclass using the @ref add() method. @@ -69,7 +69,7 @@ public: const CategoryTree *categoryStructure() const { return m_cat_structure; } protected: - virtual void parseFile( const QString &filename ) = 0; + virtual void parseFile( const TQString &filename ) = 0; void importRecipes( RecipeList &selected_recipes, RecipeDB *db, KProgressDialog *progess_dialog ); @@ -89,11 +89,11 @@ protected: return file_recipe_count; } - void setErrorMsg( const QString & s ) + void setErrorMsg( const TQString & s ) { m_error_msgs.append( s ); } - void addWarningMsg( const QString & s ) + void addWarningMsg( const TQString & s ) { m_warning_msgs.append( s ); } @@ -103,24 +103,24 @@ private: void importUnitRatios( RecipeDB * ); void importIngredient( IngredientData &ing, RecipeDB *db, KProgressDialog *progress_dialog ); - void processMessages( const QString &file ); + void processMessages( const TQString &file ); RecipeList *m_recipe_list; CategoryTree *m_cat_structure; UnitRatioList m_ratioList; UnitList m_unitList; - QStringList m_warning_msgs; - QStringList m_error_msgs; - QString m_master_warning; - QString m_master_error; + TQStringList m_warning_msgs; + TQStringList m_error_msgs; + TQString m_master_warning; + TQString m_master_error; int file_recipe_count; bool direct; RecipeDB *m_database; KProgressDialog *m_progress_dialog; - QStringList m_filenames; + TQStringList m_filenames; }; #endif //BASEIMPORTER_H diff --git a/krecipes/src/importers/kredbimporter.cpp b/krecipes/src/importers/kredbimporter.cpp index 2634462..9ee0864 100644 --- a/krecipes/src/importers/kredbimporter.cpp +++ b/krecipes/src/importers/kredbimporter.cpp @@ -18,7 +18,7 @@ #include "datablocks/categorytree.h" #include "backends/recipedb.h" -KreDBImporter::KreDBImporter( const QString &_dbType, const QString &_host, const QString &_user, const QString &_pass, int _port ) : BaseImporter(), +KreDBImporter::KreDBImporter( const TQString &_dbType, const TQString &_host, const TQString &_user, const TQString &_pass, int _port ) : BaseImporter(), dbType( _dbType ), host( _host ), user( _user ), @@ -29,7 +29,7 @@ KreDBImporter::KreDBImporter( const QString &_dbType, const QString &_host, cons KreDBImporter::~KreDBImporter() {} -void KreDBImporter::parseFile( const QString &file ) //this is either a database file or a database table +void KreDBImporter::parseFile( const TQString &file ) //this is either a database file or a database table { RecipeDB * database = RecipeDB::createDatabase( dbType, host, user, pass, file, port, file ); //uses 'file' as either table or file name, depending on the database diff --git a/krecipes/src/importers/kredbimporter.h b/krecipes/src/importers/kredbimporter.h index 39a3ae1..4fb3667 100644 --- a/krecipes/src/importers/kredbimporter.h +++ b/krecipes/src/importers/kredbimporter.h @@ -11,7 +11,7 @@ #ifndef KREDBIMPORTER_H #define KREDBIMPORTER_H -#include +#include #include "baseimporter.h" @@ -22,16 +22,16 @@ class KreDBImporter : public BaseImporter { public: - KreDBImporter( const QString &dbType, const QString &host = QString::null, const QString &user = QString::null, const QString &pass = QString::null, int port = 0 ); + KreDBImporter( const TQString &dbType, const TQString &host = TQString::null, const TQString &user = TQString::null, const TQString &pass = TQString::null, int port = 0 ); virtual ~KreDBImporter(); private: - virtual void parseFile( const QString &file_or_table ); + virtual void parseFile( const TQString &file_or_table ); - QString dbType; - QString host; - QString user; - QString pass; + TQString dbType; + TQString host; + TQString user; + TQString pass; int port; }; diff --git a/krecipes/src/importers/kreimporter.cpp b/krecipes/src/importers/kreimporter.cpp index 8676bf4..3a49535 100644 --- a/krecipes/src/importers/kreimporter.cpp +++ b/krecipes/src/importers/kreimporter.cpp @@ -16,8 +16,8 @@ #include #include -#include -#include +#include +#include #include #include "datablocks/recipe.h" @@ -26,21 +26,21 @@ KreImporter::KreImporter() : BaseImporter() {} -void KreImporter::parseFile( const QString &filename ) +void KreImporter::parseFile( const TQString &filename ) { - QFile * file = 0; + TQFile * file = 0; bool unlink = false; kdDebug() << "loading file: %s" << filename << endl; if ( filename.right( 4 ) == ".kre" ) { - file = new QFile( filename ); + file = new TQFile( filename ); kdDebug() << "file is an archive" << endl; KTar* kre = new KTar( filename, "application/x-gzip" ); kre->open( IO_ReadOnly ); const KArchiveDirectory* dir = kre->directory(); - QString name; - QStringList fileList = dir->entries(); - for ( QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it ) { + TQString name; + TQStringList fileList = dir->entries(); + for ( TQStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it ) { if ( ( *it ).right( 6 ) == ".kreml" ) { name = *it; } @@ -50,29 +50,29 @@ void KreImporter::parseFile( const QString &filename ) setErrorMsg( i18n( "Archive does not contain a valid Krecipes file" ) ); return ; } - QString tmp_dir = locateLocal( "tmp", "" ); + TQString tmp_dir = locateLocal( "tmp", "" ); dir->copyTo( tmp_dir ); - file = new QFile( tmp_dir + name ); + file = new TQFile( tmp_dir + name ); kre->close(); unlink = true; //remove file after import } else { - file = new QFile( filename ); + file = new TQFile( filename ); } if ( file->open( IO_ReadOnly ) ) { kdDebug() << "file opened" << endl; - QDomDocument doc; - QString error; + TQDomDocument doc; + TQString error; int line; int column; if ( !doc.setContent( file, &error, &line, &column ) ) { - kdDebug() << QString( "error: \"%1\" at line %2, column %3" ).arg( error ).arg( line ).arg( column ) << endl; - setErrorMsg( QString( i18n( "\"%1\" at line %2, column %3" ) ).arg( error ).arg( line ).arg( column ) ); + kdDebug() << TQString( "error: \"%1\" at line %2, column %3" ).arg( error ).arg( line ).arg( column ) << endl; + setErrorMsg( TQString( i18n( "\"%1\" at line %2, column %3" ) ).arg( error ).arg( line ).arg( column ) ); return ; } - QDomElement kreml = doc.documentElement(); + TQDomElement kreml = doc.documentElement(); if ( kreml.tagName() != "krecipes" ) { setErrorMsg( i18n( "This file does not appear to be a *.kreml file" ) ); @@ -80,19 +80,19 @@ void KreImporter::parseFile( const QString &filename ) } // TODO Check if there are changes between versions - QString kreVersion = kreml.attribute( "version" ); - kdDebug() << QString( i18n( "KreML version %1" ) ).arg( kreVersion ) << endl; + TQString kreVersion = kreml.attribute( "version" ); + kdDebug() << TQString( i18n( "KreML version %1" ) ).arg( kreVersion ) << endl; - QDomNodeList r = kreml.childNodes(); - QDomElement krecipe; + TQDomNodeList r = kreml.childNodes(); + TQDomElement krecipe; for ( unsigned z = 0; z < r.count(); z++ ) { krecipe = r.item( z ).toElement(); - QDomNodeList l = krecipe.childNodes(); + TQDomNodeList l = krecipe.childNodes(); if ( krecipe.tagName() == "krecipes-recipe" ) { Recipe recipe; for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == "krecipes-description" ) { readDescription( el.childNodes(), &recipe ); } @@ -126,22 +126,22 @@ KreImporter::~KreImporter() { } -void KreImporter::readCategoryStructure( const QDomNodeList& l, CategoryTree *tree ) +void KreImporter::readCategoryStructure( const TQDomNodeList& l, CategoryTree *tree ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); - QString category = el.attribute( "name" ); + TQString category = el.attribute( "name" ); CategoryTree *child_node = tree->add ( Element( category ) ); readCategoryStructure( el.childNodes(), child_node ); } } -void KreImporter::readDescription( const QDomNodeList& l, Recipe *recipe ) +void KreImporter::readDescription( const TQDomNodeList& l, Recipe *recipe ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == "title" ) { recipe->title = el.text(); kdDebug() << "Found title: " << recipe->title << endl; @@ -154,9 +154,9 @@ void KreImporter::readDescription( const QDomNodeList& l, Recipe *recipe ) recipe->yield.amount = el.text().toInt(); } else if ( el.tagName() == "yield" ) { - QDomNodeList yield_children = el.childNodes(); + TQDomNodeList yield_children = el.childNodes(); for ( unsigned j = 0; j < yield_children.count(); j++ ) { - QDomElement y = yield_children.item( j ).toElement(); + TQDomElement y = yield_children.item( j ).toElement(); if ( y.tagName() == "amount" ) readAmount(y,recipe->yield.amount,recipe->yield.amount_offset); else if ( y.tagName() == "type" ) @@ -164,30 +164,30 @@ void KreImporter::readDescription( const QDomNodeList& l, Recipe *recipe ) } } else if ( el.tagName() == "preparation-time" ) { - recipe->prepTime = QTime::fromString( el.text() ); + recipe->prepTime = TQTime::fromString( el.text() ); } else if ( el.tagName() == "category" ) { - QDomNodeList categories = el.childNodes(); + TQDomNodeList categories = el.childNodes(); for ( unsigned j = 0; j < categories.count(); j++ ) { - QDomElement c = categories.item( j ).toElement(); + TQDomElement c = categories.item( j ).toElement(); if ( c.tagName() == "cat" ) { - kdDebug() << "Found category: " << QString( c.text() ).stripWhiteSpace() << endl; - recipe->categoryList.append( Element( QString( c.text() ).stripWhiteSpace() ) ); + kdDebug() << "Found category: " << TQString( c.text() ).stripWhiteSpace() << endl; + recipe->categoryList.append( Element( TQString( c.text() ).stripWhiteSpace() ) ); } } } else if ( el.tagName() == "pictures" ) { if ( el.hasChildNodes() ) { - QDomNodeList pictures = el.childNodes(); + TQDomNodeList pictures = el.childNodes(); for ( unsigned j = 0; j < pictures.count(); j++ ) { - QDomElement pic = pictures.item( j ).toElement(); - QCString decodedPic; + TQDomElement pic = pictures.item( j ).toElement(); + TQCString decodedPic; if ( pic.tagName() == "pic" ) kdDebug() << "Found photo" << endl; - QPixmap pix; - KCodecs::base64Decode( QCString( pic.text().latin1() ), decodedPic ); + TQPixmap pix; + KCodecs::base64Decode( TQCString( pic.text().latin1() ), decodedPic ); int len = decodedPic.size(); - QByteArray picData( len ); + TQByteArray picData( len ); memcpy( picData.data(), decodedPic.data(), len ); bool ok = pix.loadFromData( picData, "JPEG" ); if ( ok ) { @@ -199,17 +199,17 @@ void KreImporter::readDescription( const QDomNodeList& l, Recipe *recipe ) } } -void KreImporter::readIngredients( const QDomNodeList& l, Recipe *recipe, const QString &header, Ingredient *ing ) +void KreImporter::readIngredients( const TQDomNodeList& l, Recipe *recipe, const TQString &header, Ingredient *ing ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == "ingredient" ) { - QDomNodeList ingredient = el.childNodes(); + TQDomNodeList ingredient = el.childNodes(); Ingredient new_ing; for ( unsigned j = 0; j < ingredient.count(); j++ ) { - QDomElement ing = ingredient.item( j ).toElement(); + TQDomElement ing = ingredient.item( j ).toElement(); if ( ing.tagName() == "name" ) { - new_ing.name = QString( ing.text() ).stripWhiteSpace(); + new_ing.name = TQString( ing.text() ).stripWhiteSpace(); kdDebug() << "Found ingredient: " << new_ing.name << endl; } else if ( ing.tagName() == "amount" ) { @@ -219,7 +219,7 @@ void KreImporter::readIngredients( const QDomNodeList& l, Recipe *recipe, const new_ing.units = Unit( ing.text().stripWhiteSpace(), new_ing.amount+new_ing.amount_offset ); } else if ( ing.tagName() == "prep" ) { - new_ing.prepMethodList = ElementList::split(",",QString( ing.text() ).stripWhiteSpace()); + new_ing.prepMethodList = ElementList::split(",",TQString( ing.text() ).stripWhiteSpace()); } else if ( ing.tagName() == "substitutes" ) { readIngredients(ing.childNodes(), recipe, header, &new_ing); @@ -238,20 +238,20 @@ void KreImporter::readIngredients( const QDomNodeList& l, Recipe *recipe, const } } -void KreImporter::readAmount( const QDomElement& amountEl, double &amount, double &amount_offset ) +void KreImporter::readAmount( const TQDomElement& amountEl, double &amount, double &amount_offset ) { - QDomNodeList children = amountEl.childNodes(); + TQDomNodeList children = amountEl.childNodes(); double min = 0,max = 0; for ( unsigned i = 0; i < children.count(); i++ ) { - QDomElement child = children.item( i ).toElement(); + TQDomElement child = children.item( i ).toElement(); if ( child.tagName() == "min" ) { - min = ( QString( child.text() ).stripWhiteSpace() ).toDouble(); + min = ( TQString( child.text() ).stripWhiteSpace() ).toDouble(); } else if ( child.tagName() == "max" ) - max = ( QString( child.text() ).stripWhiteSpace() ).toDouble(); + max = ( TQString( child.text() ).stripWhiteSpace() ).toDouble(); else if ( child.tagName().isEmpty() ) - min = ( QString( amountEl.text() ).stripWhiteSpace() ).toDouble(); + min = ( TQString( amountEl.text() ).stripWhiteSpace() ).toDouble(); } amount = min; @@ -259,16 +259,16 @@ void KreImporter::readAmount( const QDomElement& amountEl, double &amount, doubl amount_offset = max-min; } -void KreImporter::readRatings( const QDomNodeList& l, Recipe *recipe ) +void KreImporter::readRatings( const TQDomNodeList& l, Recipe *recipe ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement child = l.item( i ).toElement(); + TQDomElement child = l.item( i ).toElement(); if ( child.tagName() == "rating" ) { Rating r; - QDomNodeList ratingChildren = child.childNodes(); + TQDomNodeList ratingChildren = child.childNodes(); for ( unsigned j = 0; j < ratingChildren.count(); j++ ) { - QDomElement ratingChild = ratingChildren.item( j ).toElement(); + TQDomElement ratingChild = ratingChildren.item( j ).toElement(); if ( ratingChild.tagName() == "comment" ) { r.comment = ratingChild.text(); } @@ -284,17 +284,17 @@ void KreImporter::readRatings( const QDomNodeList& l, Recipe *recipe ) } } -void KreImporter::readCriterion( const QDomNodeList& l, RatingCriteriaList &rc_list ) +void KreImporter::readCriterion( const TQDomNodeList& l, RatingCriteriaList &rc_list ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement child = l.item( i ).toElement(); + TQDomElement child = l.item( i ).toElement(); if ( child.tagName() == "criteria" ) { RatingCriteria rc; - QDomNodeList criteriaChildren = child.childNodes(); + TQDomNodeList criteriaChildren = child.childNodes(); for ( unsigned j = 0; j < criteriaChildren.count(); j++ ) { - QDomElement criteriaChild = criteriaChildren.item( j ).toElement(); + TQDomElement criteriaChild = criteriaChildren.item( j ).toElement(); if ( criteriaChild.tagName() == "name" ) { rc.name = criteriaChild.text(); diff --git a/krecipes/src/importers/kreimporter.h b/krecipes/src/importers/kreimporter.h index 73d6d13..2cbd2d5 100644 --- a/krecipes/src/importers/kreimporter.h +++ b/krecipes/src/importers/kreimporter.h @@ -17,9 +17,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "baseimporter.h" @@ -40,15 +40,15 @@ public: virtual ~KreImporter(); private: - void parseFile( const QString& filename ); + void parseFile( const TQString& filename ); private: - void readCategoryStructure( const QDomNodeList& l, CategoryTree *tree ); - void readDescription( const QDomNodeList& l, Recipe* ); - void readIngredients( const QDomNodeList& l, Recipe*, const QString &header = QString::null, Ingredient *ing = 0 ); - void readAmount( const QDomElement& amount1, double &amount2, double &amount_offset ); - void readRatings( const QDomNodeList&, Recipe * ); - void readCriterion( const QDomNodeList&, RatingCriteriaList &r ); + void readCategoryStructure( const TQDomNodeList& l, CategoryTree *tree ); + void readDescription( const TQDomNodeList& l, Recipe* ); + void readIngredients( const TQDomNodeList& l, Recipe*, const TQString &header = TQString::null, Ingredient *ing = 0 ); + void readAmount( const TQDomElement& amount1, double &amount2, double &amount_offset ); + void readRatings( const TQDomNodeList&, Recipe * ); + void readCriterion( const TQDomNodeList&, RatingCriteriaList &r ); }; #endif diff --git a/krecipes/src/importers/mmfimporter.cpp b/krecipes/src/importers/mmfimporter.cpp index ab6b7eb..0613d2a 100644 --- a/krecipes/src/importers/mmfimporter.cpp +++ b/krecipes/src/importers/mmfimporter.cpp @@ -14,10 +14,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "datablocks/mixednumber.h" #include "datablocks/recipe.h" @@ -31,17 +31,17 @@ MMFImporter::MMFImporter() : BaseImporter() MMFImporter::~MMFImporter() {} -void MMFImporter::parseFile( const QString &file ) +void MMFImporter::parseFile( const TQString &file ) { resetVars(); - QFile input( file ); + TQFile input( file ); if ( input.open( IO_ReadOnly ) ) { - QTextStream stream( &input ); + TQTextStream stream( &input ); stream.skipWhiteSpace(); - QString line; + TQString line; while ( !stream.atEnd() ) { line = stream.readLine(); @@ -73,11 +73,11 @@ void MMFImporter::parseFile( const QString &file ) setErrorMsg( i18n( "Unable to open file." ) ); } -void MMFImporter::importMMF( QTextStream &stream ) +void MMFImporter::importMMF( TQTextStream &stream ) { kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes - QString current; + TQString current; //===============FIXED FORMAT================// //line 1: title @@ -94,10 +94,10 @@ void MMFImporter::importMMF( QTextStream &stream ) stream.skipWhiteSpace(); current = stream.readLine().stripWhiteSpace(); const char separator = ( version == FromDatabase ) ? ' ' : ','; - QStringList categories = QStringList::split( separator, current.mid( current.find( ":" ) + 1, current.length() ) ); - for ( QStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { + TQStringList categories = TQStringList::split( separator, current.mid( current.find( ":" ) + 1, current.length() ) ); + for ( TQStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { Element new_cat; - new_cat.name = QString( *it ).stripWhiteSpace(); + new_cat.name = TQString( *it ).stripWhiteSpace(); kdDebug() << "Found category: " << new_cat.name << endl; m_categories.append( new_cat ); } @@ -134,7 +134,7 @@ void MMFImporter::importMMF( QTextStream &stream ) loadIngredientLine( current.mid( 41, current.length() ), m_right_col_ing, is_sub ); if ( instruction_found && col_one_used ) { - addWarningMsg( QString( i18n( "While loading recipe %1 " + addWarningMsg( TQString( i18n( "While loading recipe %1 " "an ingredient line was found after the directions. " "While this is valid, it most commonly indicates an incorrectly " "formatted recipe." ) ).arg( m_title ) ); @@ -156,7 +156,7 @@ void MMFImporter::importMMF( QTextStream &stream ) putDataInRecipe(); } -bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &list, bool &is_sub ) +bool MMFImporter::loadIngredientLine( const TQString &string, IngredientList &list, bool &is_sub ) { //just ignore an empty line if ( string.stripWhiteSpace().isEmpty() ) @@ -169,7 +169,7 @@ bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &lis { //kdDebug()<<"Appending to last ingredient in column: "<= 40 && ( ( string.at( string.length() / 2 ) != "-" ) || ( string.at( string.length() / 2 + 1 ) != "-" ) || ( string.at( string.length() / 2 - 1 ) != "-" ) ) ) { - QString header( string.stripWhiteSpace() ); + TQString header( string.stripWhiteSpace() ); //get only the header name - header.remove( QRegExp( "^MMMMM" ) ); - header.remove( QRegExp( "^-*" ) ).remove( QRegExp( "-*$" ) ); + header.remove( TQRegExp( "^MMMMM" ) ); + header.remove( TQRegExp( "^-*" ) ).remove( TQRegExp( "-*$" ) ); kdDebug() << "found ingredient header: " << header << endl; @@ -291,8 +291,8 @@ void MMFImporter::putDataInRecipe() m_all_ing.append( *ing_it ); for ( IngredientList::iterator ing_it = m_all_ing.begin(); ing_it != m_all_ing.end(); ++ing_it ) { - QString name_and_prep = ( *ing_it ).name; - int separator_index = name_and_prep.find( QRegExp( "(;|,)" ) ); + TQString name_and_prep = ( *ing_it ).name; + int separator_index = name_and_prep.find( TQRegExp( "(;|,)" ) ); if ( separator_index != -1 ) { ( *ing_it ).name = name_and_prep.mid( 0, separator_index ).stripWhiteSpace(); ( *ing_it ).prepMethodList = ElementList::split(",",name_and_prep.mid( separator_index + 1, name_and_prep.length() ).stripWhiteSpace() ); @@ -328,9 +328,9 @@ void MMFImporter::resetVars() m_servings = 0; - m_title = QString::null; - m_instructions = QString::null; + m_title = TQString::null; + m_instructions = TQString::null; - current_header = QString::null; + current_header = TQString::null; } diff --git a/krecipes/src/importers/mmfimporter.h b/krecipes/src/importers/mmfimporter.h index bf89d44..89dd16e 100644 --- a/krecipes/src/importers/mmfimporter.h +++ b/krecipes/src/importers/mmfimporter.h @@ -11,7 +11,7 @@ #ifndef MMFIMPORTER_H #define MMFIMPORTER_H -#include +#include #include "baseimporter.h" #include "datablocks/ingredientlist.h" @@ -29,27 +29,27 @@ public: private: enum FormatVersion { FromDatabase, VersionMMMMM, VersionBB, VersionNormal }; - virtual void parseFile( const QString &filename ); + virtual void parseFile( const TQString &filename ); - void importMMF( QTextStream &stream ); + void importMMF( TQTextStream &stream ); /** Parses the line and save it if the line is a valid ingredient and return true. * Returns false if not an ingredient. */ - bool loadIngredientLine( const QString &, IngredientList &, bool &is_sub ); + bool loadIngredientLine( const TQString &, IngredientList &, bool &is_sub ); /** Parses the line and save it if the line is a valid ingredient header and return true. * Returns false if not an ingredient header. */ - bool loadIngredientHeader( const QString & ); + bool loadIngredientHeader( const TQString & ); void resetVars(); void putDataInRecipe(); int m_servings; - QString m_instructions; - QString m_title; + TQString m_instructions; + TQString m_title; ElementList m_authors; ElementList m_categories; @@ -59,7 +59,7 @@ private: FormatVersion version; - QString current_header; + TQString current_header; }; #endif //MMFIMPORTER_H diff --git a/krecipes/src/importers/mx2importer.cpp b/krecipes/src/importers/mx2importer.cpp index 3c949b9..d926dfa 100644 --- a/krecipes/src/importers/mx2importer.cpp +++ b/krecipes/src/importers/mx2importer.cpp @@ -22,10 +22,10 @@ Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307 USA #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "datablocks/recipe.h" @@ -33,30 +33,30 @@ Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307 USA MX2Importer::MX2Importer() {} -void MX2Importer::parseFile( const QString& filename ) +void MX2Importer::parseFile( const TQString& filename ) { - QFile file( filename ); + TQFile file( filename ); kdDebug() << "loading file: " << filename << endl; if ( file.open( IO_ReadOnly ) ) { kdDebug() << "file opened" << endl; - QDomDocument doc; + TQDomDocument doc; //hopefully a temporary hack, since MasterCook creates invalid xml declarations - QTextStream stream( &file ); - QString all_data = stream.read(); + TQTextStream stream( &file ); + TQString all_data = stream.read(); if ( all_data.startsWith( "" ) + 2 ); - QString error; + TQString error; int line; int column; if ( !doc.setContent( all_data, &error, &line, &column ) ) { - kdDebug() << QString( "error: \"%1\" at line %2, column %3" ).arg( error ).arg( line ).arg( column ) << endl; - setErrorMsg( QString( i18n( "\"%1\" at line %2, column %3. This may not be a *.mx2 file." ) ).arg( error ).arg( line ).arg( column ) ); + kdDebug() << TQString( "error: \"%1\" at line %2, column %3" ).arg( error ).arg( line ).arg( column ) << endl; + setErrorMsg( TQString( i18n( "\"%1\" at line %2, column %3. This may not be a *.mx2 file." ) ).arg( error ).arg( line ).arg( column ) ); return ; } - QDomElement mx2 = doc.documentElement(); + TQDomElement mx2 = doc.documentElement(); // TODO Check if there are changes between versions if ( mx2.tagName() != "mx2" /*|| mx2.attribute("source") != "MasterCook 5.0"*/ ) { @@ -64,10 +64,10 @@ void MX2Importer::parseFile( const QString& filename ) return ; } - QDomNodeList l = mx2.childNodes(); + TQDomNodeList l = mx2.childNodes(); for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == "RcpE" ) { Recipe recipe; @@ -90,22 +90,22 @@ MX2Importer::~MX2Importer() { } -void MX2Importer::readRecipe( const QDomNodeList& l, Recipe *recipe ) +void MX2Importer::readRecipe( const TQDomNodeList& l, Recipe *recipe ) { for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQString tagName = el.tagName(); if ( tagName == "Serv" ) { recipe->yield.amount = el.attribute( "qty" ).toInt(); recipe->yield.type = i18n("servings"); } else if ( tagName == "PrpT" ) - recipe->prepTime = QTime::fromString( el.attribute( "elapsed" ) ); + recipe->prepTime = TQTime::fromString( el.attribute( "elapsed" ) ); else if ( tagName == "CatS" ) { - QDomNodeList categories = el.childNodes(); + TQDomNodeList categories = el.childNodes(); for ( unsigned j = 0; j < categories.count(); j++ ) { - QDomElement c = categories.item( j ).toElement(); + TQDomElement c = categories.item( j ).toElement(); if ( c.tagName() == "CatT" ) { if ( c.text().length() > 0 ) { Element cat( c.text().stripWhiteSpace() ); @@ -119,9 +119,9 @@ void MX2Importer::readRecipe( const QDomNodeList& l, Recipe *recipe ) el.attribute( "qty" ).toDouble(), Unit( el.attribute( "unit" ), el.attribute( "qty" ).toDouble() ) ); if ( el.hasChildNodes() ) { - QDomNodeList iChilds = el.childNodes(); + TQDomNodeList iChilds = el.childNodes(); for ( unsigned j = 0; j < iChilds.count(); j++ ) { - QDomElement iChild = iChilds.item( j ).toElement(); + TQDomElement iChild = iChilds.item( j ).toElement(); if ( iChild.tagName() == "IPrp" ) new_ing.prepMethodList.append( Element(iChild.text().stripWhiteSpace()) ); else if ( iChild.tagName() == "INtI" ) @@ -131,16 +131,16 @@ void MX2Importer::readRecipe( const QDomNodeList& l, Recipe *recipe ) recipe->ingList.append( new_ing ); } else if ( tagName == "DirS" ) { - QStringList directions; - QDomNodeList dirs = el.childNodes(); + TQStringList directions; + TQDomNodeList dirs = el.childNodes(); for ( unsigned j = 0; j < dirs.count(); j++ ) { - QDomElement dir = dirs.item( j ).toElement(); + TQDomElement dir = dirs.item( j ).toElement(); if ( dir.tagName() == "DirT" ) directions.append( dir.text().stripWhiteSpace() ); } - QString directionsText; + TQString directionsText; - // TODO This is copied from RecipeML, maybe a QStringList + // TODO This is copied from RecipeML, maybe a TQStringList // for directions in Recipe instead? if ( directions.count() > 1 ) { for ( unsigned i = 1; i <= directions.count(); i++ ) { @@ -148,8 +148,8 @@ void MX2Importer::readRecipe( const QDomNodeList& l, Recipe *recipe ) directionsText += "\n\n"; } - QString sWith = QString( "%1. " ).arg( i ); - QString text = directions[ i - 1 ]; + TQString sWith = TQString( "%1. " ).arg( i ); + TQString text = directions[ i - 1 ]; if ( !text.stripWhiteSpace().startsWith( sWith ) ) directionsText += sWith; directionsText += text; diff --git a/krecipes/src/importers/mx2importer.h b/krecipes/src/importers/mx2importer.h index 22867d0..0488565 100644 --- a/krecipes/src/importers/mx2importer.h +++ b/krecipes/src/importers/mx2importer.h @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307 USA #include "baseimporter.h" -#include +#include class Recipe; @@ -37,10 +37,10 @@ public: virtual ~MX2Importer(); protected: - void parseFile( const QString& filename ); + void parseFile( const TQString& filename ); private: - void readRecipe( const QDomNodeList& l, Recipe* ); + void readRecipe( const TQDomNodeList& l, Recipe* ); } ; #endif //MX2IMPORTER_H diff --git a/krecipes/src/importers/mxpimporter.cpp b/krecipes/src/importers/mxpimporter.cpp index 201098d..6a353cd 100644 --- a/krecipes/src/importers/mxpimporter.cpp +++ b/krecipes/src/importers/mxpimporter.cpp @@ -10,10 +10,10 @@ #include "mxpimporter.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -25,15 +25,15 @@ MXPImporter::MXPImporter() : BaseImporter() {} -void MXPImporter::parseFile( const QString &file ) +void MXPImporter::parseFile( const TQString &file ) { - QFile input( file ); + TQFile input( file ); if ( input.open( IO_ReadOnly ) ) { - QTextStream stream( &input ); + TQTextStream stream( &input ); stream.skipWhiteSpace(); - QString line; + TQString line; while ( !stream.atEnd() ) { line = stream.readLine().stripWhiteSpace(); @@ -60,14 +60,14 @@ void MXPImporter::parseFile( const QString &file ) MXPImporter::~MXPImporter() {} -void MXPImporter::importMXP( QTextStream &stream ) +void MXPImporter::importMXP( TQTextStream &stream ) { Recipe recipe; kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes //kdDebug()<<"Found recipe MXP format: * Exported from MasterCook *"< +#include #include "baseimporter.h" @@ -26,20 +26,20 @@ public: virtual ~MXPImporter(); protected: - void parseFile( const QString& filename ); + void parseFile( const TQString& filename ); private: - void importMXP( QTextStream &stream ); + void importMXP( TQTextStream &stream ); - void loadCategories( QTextStream &stream, Recipe &recipe ); - void loadIngredients( QTextStream &stream, Recipe &recipe ); - void loadInstructions( QTextStream &stream, Recipe &recipe ); - void loadOptionalFields( QTextStream &stream, Recipe &recipe ); + void loadCategories( TQTextStream &stream, Recipe &recipe ); + void loadIngredients( TQTextStream &stream, Recipe &recipe ); + void loadInstructions( TQTextStream &stream, Recipe &recipe ); + void loadOptionalFields( TQTextStream &stream, Recipe &recipe ); - void importMac( QTextStream &stream ); - void importGeneric( QTextStream &stream ); + void importMac( TQTextStream &stream ); + void importGeneric( TQTextStream &stream ); - QString getNextQuotedString( QTextStream &stream ); + TQString getNextQuotedString( TQTextStream &stream ); }; #endif //MXPIMPORTER_H diff --git a/krecipes/src/importers/nycgenericimporter.cpp b/krecipes/src/importers/nycgenericimporter.cpp index 4105eea..8502a04 100644 --- a/krecipes/src/importers/nycgenericimporter.cpp +++ b/krecipes/src/importers/nycgenericimporter.cpp @@ -14,10 +14,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "datablocks/mixednumber.h" #include "datablocks/recipe.h" @@ -25,15 +25,15 @@ NYCGenericImporter::NYCGenericImporter() : BaseImporter() {} -void NYCGenericImporter::parseFile( const QString &file ) +void NYCGenericImporter::parseFile( const TQString &file ) { first = true; m_recipe.empty(); - QFile input( file ); + TQFile input( file ); if ( input.open( IO_ReadOnly ) ) { - QTextStream stream( &input ); + TQTextStream stream( &input ); stream.skipWhiteSpace(); if ( !stream.atEnd() && stream.readLine().startsWith( "@@@@@" ) ) @@ -50,11 +50,11 @@ void NYCGenericImporter::parseFile( const QString &file ) NYCGenericImporter::~NYCGenericImporter() {} -void NYCGenericImporter::importNYCGeneric( QTextStream &stream ) +void NYCGenericImporter::importNYCGeneric( TQTextStream &stream ) { kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes - QString current; + TQString current; stream.skipWhiteSpace(); @@ -69,13 +69,13 @@ void NYCGenericImporter::importNYCGeneric( QTextStream &stream ) break; } //oops, this is really an ingredient line (there was no category line) - QStringList categories = QStringList::split( ',', current ); + TQStringList categories = TQStringList::split( ',', current ); if ( categories.count() > 0 && categories[ 0 ].upper() == "none" ) //there are no categories break; - for ( QStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { - Element new_cat( QString( *it ).stripWhiteSpace() ); + for ( TQStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { + Element new_cat( TQString( *it ).stripWhiteSpace() ); kdDebug() << "Found category: " << new_cat.name << endl; m_recipe.categoryList.append( new_cat ); } @@ -94,7 +94,7 @@ void NYCGenericImporter::importNYCGeneric( QTextStream &stream ) m_recipe.authorList.append( new_author ); } else if ( current.startsWith( "Preparation Time:" ) ) { - m_recipe.prepTime = QTime::fromString( current.mid( current.find( ':' ), current.length() ) ); + m_recipe.prepTime = TQTime::fromString( current.mid( current.find( ':' ), current.length() ) ); } else if ( current.startsWith( "Yield:" ) ) { int colon_index = current.find( ':' ); @@ -130,9 +130,9 @@ void NYCGenericImporter::putDataInRecipe() m_recipe.empty(); } -void NYCGenericImporter::loadIngredientLine( const QString &line ) +void NYCGenericImporter::loadIngredientLine( const TQString &line ) { - QString current = line; + TQString current = line; if ( current.contains( "-----" ) ) { current_header = current.stripWhiteSpace(); @@ -141,11 +141,11 @@ void NYCGenericImporter::loadIngredientLine( const QString &line ) } MixedNumber amount( 0, 0, 1 ); - QString unit; - QString name; - QString prep; + TQString unit; + TQString name; + TQString prep; - QStringList ingredient_line = QStringList::split( ' ', current ); + TQStringList ingredient_line = TQStringList::split( ' ', current ); bool found_amount = false; @@ -180,7 +180,7 @@ void NYCGenericImporter::loadIngredientLine( const QString &line ) //now join each separate part of ingredient (name, unit, amount) name = ingredient_line.join( " " ); - int prep_sep_index = name.find( QRegExp( "(--|,;;)" ) ); + int prep_sep_index = name.find( TQRegExp( "(--|,;;)" ) ); if ( prep_sep_index == -1 ) prep_sep_index = name.length(); diff --git a/krecipes/src/importers/nycgenericimporter.h b/krecipes/src/importers/nycgenericimporter.h index f0ac1c3..7a215cd 100644 --- a/krecipes/src/importers/nycgenericimporter.h +++ b/krecipes/src/importers/nycgenericimporter.h @@ -11,8 +11,8 @@ #ifndef NYCGENERICIMPORTER_H #define NYCGENERICIMPORTER_H -#include -#include +#include +#include #include "baseimporter.h" #include "datablocks/ingredientlist.h" @@ -28,15 +28,15 @@ public: ~NYCGenericImporter(); protected: - void parseFile( const QString& filename ); + void parseFile( const TQString& filename ); private: - void importNYCGeneric( QTextStream &stream ); + void importNYCGeneric( TQTextStream &stream ); void putDataInRecipe(); - void loadIngredientLine( const QString & ); + void loadIngredientLine( const TQString & ); Recipe m_recipe; - QString current_header; + TQString current_header; bool first; }; diff --git a/krecipes/src/importers/recipemlimporter.cpp b/krecipes/src/importers/recipemlimporter.cpp index d32e352..8b1f14b 100644 --- a/krecipes/src/importers/recipemlimporter.cpp +++ b/krecipes/src/importers/recipemlimporter.cpp @@ -13,8 +13,8 @@ #include "recipemlimporter.h" -#include -#include +#include +#include #include #include @@ -25,31 +25,31 @@ RecipeMLImporter::RecipeMLImporter() : BaseImporter() {} -void RecipeMLImporter::parseFile( const QString& file ) +void RecipeMLImporter::parseFile( const TQString& file ) { - QFile input( file ); + TQFile input( file ); if ( input.open( IO_ReadOnly ) ) { - QDomDocument doc; - QString error; + TQDomDocument doc; + TQString error; int line; int column; if ( !doc.setContent( &input, &error, &line, &column ) ) { - setErrorMsg( QString( i18n( "\"%1\" at line %2, column %3. This may not be a RecipeML file." ) ).arg( error ).arg( line ).arg( column ) ); + setErrorMsg( TQString( i18n( "\"%1\" at line %2, column %3. This may not be a RecipeML file." ) ).arg( error ).arg( line ).arg( column ) ); return ; } - QDomElement recipeml = doc.documentElement(); + TQDomElement recipeml = doc.documentElement(); if ( recipeml.tagName() != "recipeml" ) { setErrorMsg( i18n( "This file does not appear to be a valid RecipeML archive." ) ); return ; } - QDomNodeList l = recipeml.childNodes(); + TQDomNodeList l = recipeml.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "meta" ) continue; @@ -68,15 +68,15 @@ void RecipeMLImporter::parseFile( const QString& file ) RecipeMLImporter::~RecipeMLImporter() {} -void RecipeMLImporter::readRecipemlRecipe( const QDomElement& recipe_element ) +void RecipeMLImporter::readRecipemlRecipe( const TQDomElement& recipe_element ) { recipe.empty(); - QDomNodeList l = recipe_element.childNodes(); + TQDomNodeList l = recipe_element.childNodes(); for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "head" ) readRecipemlHead( el ); @@ -96,12 +96,12 @@ void RecipeMLImporter::readRecipemlRecipe( const QDomElement& recipe_element ) ( recipe ); } -void RecipeMLImporter::readRecipemlHead( const QDomElement& head ) +void RecipeMLImporter::readRecipemlHead( const TQDomElement& head ) { - QDomNodeList l = head.childNodes(); + TQDomNodeList l = head.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "title" ) recipe.title = el.text().stripWhiteSpace(); @@ -111,9 +111,9 @@ void RecipeMLImporter::readRecipemlHead( const QDomElement& head ) else if ( tagName == "source" ) readRecipemlSrcItems( el ); else if ( tagName == "categories" ) { - QDomNodeList categories = el.childNodes(); + TQDomNodeList categories = el.childNodes(); for ( unsigned j = 0; j < categories.count(); j++ ) { - QDomElement c = categories.item( j ).toElement(); + TQDomElement c = categories.item( j ).toElement(); if ( c.tagName() == "cat" ) { recipe.categoryList.append( Element( c.text() ) ); } @@ -124,10 +124,10 @@ void RecipeMLImporter::readRecipemlHead( const QDomElement& head ) else if ( tagName == "preptime" ) readRecipemlPreptime( el ); else if ( tagName == "yield" ) { - QDomNodeList yieldChildren = el.childNodes(); + TQDomNodeList yieldChildren = el.childNodes(); for ( unsigned j = 0; j < yieldChildren.count(); j++ ) { - QDomElement y = yieldChildren.item( j ).toElement(); - QString tagName = y.tagName(); + TQDomElement y = yieldChildren.item( j ).toElement(); + TQString tagName = y.tagName(); if ( tagName == "range" ) readRecipemlRange( y, recipe.yield.amount, recipe.yield.amount_offset ); else if ( tagName == "unit" ) @@ -141,22 +141,22 @@ void RecipeMLImporter::readRecipemlHead( const QDomElement& head ) } } -void RecipeMLImporter::readRecipemlIngs( const QDomElement& ings ) +void RecipeMLImporter::readRecipemlIngs( const TQDomElement& ings ) { - QDomNodeList l = ings.childNodes(); + TQDomNodeList l = ings.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "ing" ) readRecipemlIng( el ); else if ( tagName == "ing-div" ) //NOTE: this can have the "type" attribute { - QString header; - QDomNodeList ingDiv = el.childNodes(); + TQString header; + TQDomNodeList ingDiv = el.childNodes(); for ( unsigned j = 0; j < ingDiv.count(); j++ ) { - QDomElement cEl = ingDiv.item( j ).toElement(); + TQDomElement cEl = ingDiv.item( j ).toElement(); if ( cEl.tagName() == "title" ) header = cEl.text().stripWhiteSpace(); else if ( cEl.tagName() == "description" ) {} //TODO: what do we do with this? @@ -173,28 +173,28 @@ void RecipeMLImporter::readRecipemlIngs( const QDomElement& ings ) } } -void RecipeMLImporter::readRecipemlIng( const QDomElement& ing, Ingredient *ing_parent, const QString &header ) +void RecipeMLImporter::readRecipemlIng( const TQDomElement& ing, Ingredient *ing_parent, const TQString &header ) { Ingredient new_ing; - QDomNodeList ingChilds = ing.childNodes(); + TQDomNodeList ingChilds = ing.childNodes(); - QString name, unit, size, prep_method; + TQString name, unit, size, prep_method; Ingredient quantity; quantity.amount = 1;// default quantity assumed by RecipeML DTD for ( unsigned j = 0; j < ingChilds.count(); j++ ) { - QDomElement ingChild = ingChilds.item( j ).toElement(); - QString tagName = ingChild.tagName(); + TQDomElement ingChild = ingChilds.item( j ).toElement(); + TQString tagName = ingChild.tagName(); if ( tagName == "amt" ) { - QDomNodeList amtChilds = ingChild.childNodes(); + TQDomNodeList amtChilds = ingChild.childNodes(); for ( unsigned k = 0; k < amtChilds.count(); k++ ) { - QDomElement amtChild = amtChilds.item( k ).toElement(); + TQDomElement amtChild = amtChilds.item( k ).toElement(); if ( amtChild.tagName() == "qty" ) - readRecipemlQty( amtChild, quantity ); + readRecipemlTQty( amtChild, quantity ); else if ( amtChild.tagName() == "size" ) size = amtChild.text().stripWhiteSpace(); else if ( amtChild.tagName() == "unit" ) @@ -233,14 +233,14 @@ void RecipeMLImporter::readRecipemlIng( const QDomElement& ing, Ingredient *ing_ ing_parent->substitutes.append( new_ing ); } -void RecipeMLImporter::readRecipemlDirections( const QDomElement& dirs ) +void RecipeMLImporter::readRecipemlDirections( const TQDomElement& dirs ) { - QDomNodeList l = dirs.childNodes(); + TQDomNodeList l = dirs.childNodes(); - QStringList directions; + TQStringList directions; for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == "step" ) directions.append( el.text().stripWhiteSpace() ); @@ -248,7 +248,7 @@ void RecipeMLImporter::readRecipemlDirections( const QDomElement& dirs ) kdDebug() << "Unknown tag within : " << el.tagName() << endl; } - QString directionsText; + TQString directionsText; if ( directions.count() > 1 ) { for ( unsigned i = 1; i <= directions.count(); i++ ) { @@ -256,8 +256,8 @@ void RecipeMLImporter::readRecipemlDirections( const QDomElement& dirs ) directionsText += "\n\n"; } - QString sWith = QString( "%1. " ).arg( i ); - QString text = directions[ i - 1 ]; + TQString sWith = TQString( "%1. " ).arg( i ); + TQString text = directions[ i - 1 ]; if ( !text.stripWhiteSpace().startsWith( sWith ) ) directionsText += sWith; directionsText += text; @@ -269,12 +269,12 @@ void RecipeMLImporter::readRecipemlDirections( const QDomElement& dirs ) recipe.instructions = directionsText; } -void RecipeMLImporter::readRecipemlMenu( const QDomElement& menu_el ) +void RecipeMLImporter::readRecipemlMenu( const TQDomElement& menu_el ) { - QDomNodeList l = menu_el.childNodes(); + TQDomNodeList l = menu_el.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "head" ) readRecipemlHead( el ); @@ -286,12 +286,12 @@ void RecipeMLImporter::readRecipemlMenu( const QDomElement& menu_el ) } } -void RecipeMLImporter::readRecipemlSrcItems( const QDomElement& sources ) +void RecipeMLImporter::readRecipemlSrcItems( const TQDomElement& sources ) { - QDomNodeList l = sources.childNodes(); + TQDomNodeList l = sources.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement srcitem = l.item( i ).toElement(); - QString tagName = srcitem.tagName(); + TQDomElement srcitem = l.item( i ).toElement(); + TQString tagName = srcitem.tagName(); if ( tagName == "srcitem" ) recipe.authorList.append( Element( srcitem.text().stripWhiteSpace() ) ); @@ -300,21 +300,21 @@ void RecipeMLImporter::readRecipemlSrcItems( const QDomElement& sources ) } } -void RecipeMLImporter::readRecipemlPreptime( const QDomElement &preptime ) +void RecipeMLImporter::readRecipemlPreptime( const TQDomElement &preptime ) { - QDomNodeList l = preptime.childNodes(); + TQDomNodeList l = preptime.childNodes(); for ( unsigned i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); if ( tagName == "time" ) { int qty = 0; - QString timeunit; + TQString timeunit; - QDomNodeList time_l = el.childNodes(); + TQDomNodeList time_l = el.childNodes(); for ( unsigned i = 0 ; i < time_l.count(); i++ ) { - QDomElement time_el = time_l.item( i ).toElement(); - QString time_tagName = time_el.tagName(); + TQDomElement time_el = time_l.item( i ).toElement(); + TQString time_tagName = time_el.tagName(); if ( time_tagName == "qty" ) qty = time_el.text().toInt(); @@ -333,20 +333,20 @@ void RecipeMLImporter::readRecipemlPreptime( const QDomElement &preptime ) else kdDebug() << "Unknown timeunit: " << timeunit << endl; - recipe.prepTime = QTime( hours + minutes / 60, minutes % 60 ); + recipe.prepTime = TQTime( hours + minutes / 60, minutes % 60 ); } else kdDebug() << "Unknown tag within : " << tagName << endl; } } -void RecipeMLImporter::readRecipemlQty( const QDomElement &qty, Ingredient &ing ) +void RecipeMLImporter::readRecipemlTQty( const TQDomElement &qty, Ingredient &ing ) { - QDomNodeList qtyChilds = qty.childNodes(); + TQDomNodeList qtyChilds = qty.childNodes(); for ( unsigned i = 0; i < qtyChilds.count(); i++ ) { - QDomElement qtyChild = qtyChilds.item( i ).toElement(); - QString tagName = qtyChild.tagName(); + TQDomElement qtyChild = qtyChilds.item( i ).toElement(); + TQString tagName = qtyChild.tagName(); if ( tagName == "range" ) readRecipemlRange( qtyChild, ing.amount, ing.amount_offset ); else if ( tagName.isEmpty() ) @@ -356,13 +356,13 @@ void RecipeMLImporter::readRecipemlQty( const QDomElement &qty, Ingredient &ing } } -void RecipeMLImporter::readRecipemlRange( const QDomElement& range, double &amount, double &amount_offset ) +void RecipeMLImporter::readRecipemlRange( const TQDomElement& range, double &amount, double &amount_offset ) { - QDomNodeList rangeChilds = range.childNodes(); + TQDomNodeList rangeChilds = range.childNodes(); double q1 = 1, q2 = 0; // default quantity assumed by RecipeML DTD for ( unsigned j = 0; j < rangeChilds.count(); j++ ) { - QDomElement rangeChild = rangeChilds.item( j ).toElement(); - QString subTagName = rangeChild.tagName(); + TQDomElement rangeChild = rangeChilds.item( j ).toElement(); + TQString subTagName = rangeChild.tagName(); if ( subTagName == "q1" ) q1 = MixedNumber::fromString( rangeChild.text() ).toDouble(); else if ( subTagName == "q2" ) diff --git a/krecipes/src/importers/recipemlimporter.h b/krecipes/src/importers/recipemlimporter.h index b330a05..bd1a7c7 100644 --- a/krecipes/src/importers/recipemlimporter.h +++ b/krecipes/src/importers/recipemlimporter.h @@ -19,7 +19,7 @@ #include "datablocks/ingredient.h" #include "datablocks/recipe.h" -#include +#include /** Class to import the RecipeML, XML-based file format. * More info at http://www.formatdata.com/recipeml @@ -33,19 +33,19 @@ public: virtual ~RecipeMLImporter(); protected: - void parseFile( const QString& filename ); + void parseFile( const TQString& filename ); private: - void readRecipemlDirections( const QDomElement& dirs ); - void readRecipemlHead( const QDomElement& head ); - void readRecipemlIng( const QDomElement& ing1, Ingredient *ing2 = 0, const QString &header = QString::null ); - void readRecipemlIngs( const QDomElement& ings ); - void readRecipemlMenu( const QDomElement& menu ); - void readRecipemlSrcItems( const QDomElement& sources ); - void readRecipemlRecipe( const QDomElement& recipe ); - void readRecipemlPreptime( const QDomElement &preptime ); - void readRecipemlQty( const QDomElement &qty, Ingredient &ing ); - void readRecipemlRange( const QDomElement& range1, double &range2, double &range_offset ); + void readRecipemlDirections( const TQDomElement& dirs ); + void readRecipemlHead( const TQDomElement& head ); + void readRecipemlIng( const TQDomElement& ing1, Ingredient *ing2 = 0, const TQString &header = TQString::null ); + void readRecipemlIngs( const TQDomElement& ings ); + void readRecipemlMenu( const TQDomElement& menu ); + void readRecipemlSrcItems( const TQDomElement& sources ); + void readRecipemlRecipe( const TQDomElement& recipe ); + void readRecipemlPreptime( const TQDomElement &preptime ); + void readRecipemlTQty( const TQDomElement &qty, Ingredient &ing ); + void readRecipemlRange( const TQDomElement& range1, double &range2, double &range_offset ); Recipe recipe; }; diff --git a/krecipes/src/importers/rezkonvimporter.cpp b/krecipes/src/importers/rezkonvimporter.cpp index 2f7f428..5d326c8 100644 --- a/krecipes/src/importers/rezkonvimporter.cpp +++ b/krecipes/src/importers/rezkonvimporter.cpp @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "datablocks/mixednumber.h" @@ -26,22 +26,22 @@ RezkonvImporter::RezkonvImporter() : BaseImporter() RezkonvImporter::~RezkonvImporter() {} -void RezkonvImporter::parseFile( const QString &filename ) +void RezkonvImporter::parseFile( const TQString &filename ) { - QFile input( filename ); + TQFile input( filename ); if ( input.open( IO_ReadOnly ) ) { - QTextStream stream( &input ); + TQTextStream stream( &input ); stream.skipWhiteSpace(); - QString line; + TQString line; while ( !stream.atEnd() ) { line = stream.readLine(); - if ( line.contains( QRegExp( "^=====.*REZKONV.*" ) ) ) { - QStringList raw_recipe; - while ( !( line = stream.readLine() ).contains( QRegExp( "^=====\\s*$" ) ) && !stream.atEnd() ) + if ( line.contains( TQRegExp( "^=====.*REZKONV.*" ) ) ) { + TQStringList raw_recipe; + while ( !( line = stream.readLine() ).contains( TQRegExp( "^=====\\s*$" ) ) && !stream.atEnd() ) raw_recipe << line; readRecipe( raw_recipe ); @@ -55,13 +55,13 @@ void RezkonvImporter::parseFile( const QString &filename ) setErrorMsg( i18n( "Unable to open file." ) ); } -void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) +void RezkonvImporter::readRecipe( const TQStringList &raw_recipe ) { kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes Recipe recipe; - QStringList::const_iterator text_it = raw_recipe.begin(); + TQStringList::const_iterator text_it = raw_recipe.begin(); m_end_it = raw_recipe.end(); //title (Titel) @@ -71,10 +71,10 @@ void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) //categories (Kategorien): text_it++; - QStringList categories = QStringList::split( ',', ( *text_it ).mid( ( *text_it ).find( ":" ) + 1, ( *text_it ).length() ) ); - for ( QStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { + TQStringList categories = TQStringList::split( ',', ( *text_it ).mid( ( *text_it ).find( ":" ) + 1, ( *text_it ).length() ) ); + for ( TQStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { Element new_cat; - new_cat.name = QString( *it ).stripWhiteSpace(); + new_cat.name = TQString( *it ).stripWhiteSpace(); kdDebug() << "Found category: " << new_cat.name << endl; recipe.categoryList.append( new_cat ); } @@ -82,8 +82,8 @@ void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) //yield (Menge) text_it++; //get the number between the ":" and the next space after it - QString yield_str = ( *text_it ).stripWhiteSpace(); - yield_str.remove( QRegExp( "^Menge:\\s*" ) ); + TQString yield_str = ( *text_it ).stripWhiteSpace(); + yield_str.remove( TQRegExp( "^Menge:\\s*" ) ); int sep_index = yield_str.find( ' ' ); if ( sep_index != -1 ) recipe.yield.type = yield_str.mid( sep_index+1 ); @@ -100,7 +100,7 @@ void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) continue; } - if ( ( *text_it ).contains( QRegExp( "^=====.*=$" ) ) ) //is a header + if ( ( *text_it ).contains( TQRegExp( "^=====.*=$" ) ) ) //is a header { if ( ( *text_it ).contains( "quelle", false ) ) { @@ -113,7 +113,7 @@ void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) //if it has no more than two spaces followed by a non-digit //then we'll assume it is a direction line - else if ( last_line_empty && ( *text_it ).contains( QRegExp( "^\\s{0,2}[^\\d\\s=]" ) ) ) + else if ( last_line_empty && ( *text_it ).contains( TQRegExp( "^\\s{0,2}[^\\d\\s=]" ) ) ) break; else loadIngredient( *text_it, recipe, is_sub ); @@ -127,17 +127,17 @@ void RezkonvImporter::readRecipe( const QStringList &raw_recipe ) add ( recipe ); - current_header = QString::null; + current_header = TQString::null; } -void RezkonvImporter::loadIngredient( const QString &string, Recipe &recipe, bool &is_sub ) +void RezkonvImporter::loadIngredient( const TQString &string, Recipe &recipe, bool &is_sub ) { Ingredient new_ingredient; new_ingredient.amount = 0; //amount not required, so give default of 0 - QRegExp cont_test( "^-{1,2}" ); + TQRegExp cont_test( "^-{1,2}" ); if ( string.stripWhiteSpace().contains( cont_test ) ) { - QString name = string.stripWhiteSpace(); + TQString name = string.stripWhiteSpace(); name.remove( cont_test ); kdDebug() << "Appending to last ingredient: " << name << endl; if ( !recipe.ingList.isEmpty() ) //so it doesn't crash when the first ingredient appears to be a continuation of another @@ -151,14 +151,14 @@ void RezkonvImporter::loadIngredient( const QString &string, Recipe &recipe, boo readRange( string.mid( 0, 7 ), new_ingredient.amount, new_ingredient.amount_offset ); //unit - QString unit_str = string.mid( 8, 9 ).stripWhiteSpace(); + TQString unit_str = string.mid( 8, 9 ).stripWhiteSpace(); new_ingredient.units = Unit( unit_str, new_ingredient.amount ); //name and preparation method new_ingredient.name = string.mid( 18, string.length() - 18 ).stripWhiteSpace(); //separate out the preparation method - QString name_and_prep = new_ingredient.name; + TQString name_and_prep = new_ingredient.name; int separator_index = name_and_prep.find( "," ); if ( separator_index != -1 ) { new_ingredient.name = name_and_prep.mid( 0, separator_index ).stripWhiteSpace(); @@ -182,10 +182,10 @@ void RezkonvImporter::loadIngredient( const QString &string, Recipe &recipe, boo recipe.ingList.append( new_ingredient ); } -void RezkonvImporter::loadIngredientHeader( const QString &string, Recipe &/*recipe*/ ) +void RezkonvImporter::loadIngredientHeader( const TQString &string, Recipe &/*recipe*/ ) { - QString header = string; - header.remove( QRegExp( "^=*" ) ).remove( QRegExp( "=*$" ) ); + TQString header = string; + header.remove( TQRegExp( "^=*" ) ).remove( TQRegExp( "=*$" ) ); header = header.stripWhiteSpace(); kdDebug() << "found ingredient header: " << header << endl; @@ -193,11 +193,11 @@ void RezkonvImporter::loadIngredientHeader( const QString &string, Recipe &/*rec current_header = header; } -void RezkonvImporter::loadInstructions( QStringList::const_iterator &text_it, Recipe &recipe ) +void RezkonvImporter::loadInstructions( TQStringList::const_iterator &text_it, Recipe &recipe ) { - QString instr; - QRegExp rx_title( "^:{0,1}\\s*O-Titel\\s*:" ); - QString line; + TQString instr; + TQRegExp rx_title( "^:{0,1}\\s*O-Titel\\s*:" ); + TQString line; while ( text_it != m_end_it ) { line = *text_it; @@ -206,7 +206,7 @@ void RezkonvImporter::loadInstructions( QStringList::const_iterator &text_it, Re line.remove( rx_title ); recipe.title = line.stripWhiteSpace(); - QRegExp rx_line_cont( ":\\s*>{0,1}\\s*:" ); + TQRegExp rx_line_cont( ":\\s*>{0,1}\\s*:" ); while ( ( line = *text_it ).contains( rx_line_cont ) ) { line.remove( rx_line_cont ); recipe.title += line; @@ -228,22 +228,22 @@ void RezkonvImporter::loadInstructions( QStringList::const_iterator &text_it, Re recipe.instructions = instr; } -void RezkonvImporter::loadReferences( QStringList::const_iterator &text_it, Recipe &recipe ) +void RezkonvImporter::loadReferences( TQStringList::const_iterator &text_it, Recipe &recipe ) { kdDebug() << "Found source header" << endl; while ( text_it != m_end_it ) { text_it++; - QRegExp rx_line_begin( "^\\s*-{0,2}\\s*" ); + TQRegExp rx_line_begin( "^\\s*-{0,2}\\s*" ); - QRegExp rx_creation_date = QRegExp( "^\\s*-{0,2}\\s*Erfasst \\*RK\\*", false ); + TQRegExp rx_creation_date = TQRegExp( "^\\s*-{0,2}\\s*Erfasst \\*RK\\*", false ); if ( ( *text_it ).contains( rx_creation_date ) ) // date followed by typist { - QString date = *text_it; - date.remove( rx_creation_date ).remove( QRegExp( " von\\s*$" ) ); + TQString date = *text_it; + date.remove( rx_creation_date ).remove( TQRegExp( " von\\s*$" ) ); // Date is given as DD.MM.YY - QString s = date.section( ".", 0, 0 ); + TQString s = date.section( ".", 0, 0 ); int day = s.toInt(); s = date.section( ".", 1, 1 ); @@ -255,12 +255,12 @@ void RezkonvImporter::loadReferences( QStringList::const_iterator &text_it, Reci if ( year < 1970 ) year += 100; //we'll assume nothing has been created before 1970 (y2k issues :p) - recipe.ctime = QDate(year,month,day); + recipe.ctime = TQDate(year,month,day); #if 0 //typist text_it++; - QString typist = = *text_it; + TQString typist = = *text_it; typist.remove( rx_line_begin ); #endif @@ -268,7 +268,7 @@ void RezkonvImporter::loadReferences( QStringList::const_iterator &text_it, Reci else //everything else is an author { if ( ( *text_it ).contains( rx_line_begin ) ) { - QString author = *text_it; + TQString author = *text_it; author.remove( rx_line_begin ); recipe.authorList.append( Element( author ) ); @@ -279,10 +279,10 @@ void RezkonvImporter::loadReferences( QStringList::const_iterator &text_it, Reci } } -void RezkonvImporter::readRange( const QString &range_str, double &amount, double &amount_offset ) +void RezkonvImporter::readRange( const TQString &range_str, double &amount, double &amount_offset ) { - QString from = range_str.section( '-', 0, 0 ); - QString to = range_str.section( '-', 1, 1 ); + TQString from = range_str.section( '-', 0, 0 ); + TQString to = range_str.section( '-', 1, 1 ); amount = MixedNumber::fromString( from ).toDouble(); diff --git a/krecipes/src/importers/rezkonvimporter.h b/krecipes/src/importers/rezkonvimporter.h index 2b0b707..90d873b 100644 --- a/krecipes/src/importers/rezkonvimporter.h +++ b/krecipes/src/importers/rezkonvimporter.h @@ -11,7 +11,7 @@ #ifndef REZKONVIMPORTER_H #define REZKONVIMPORTER_H -#include +#include #include "baseimporter.h" #include "datablocks/recipe.h" @@ -23,20 +23,20 @@ public: ~RezkonvImporter(); protected: - void parseFile( const QString &filename ); + void parseFile( const TQString &filename ); private: - void loadIngredient( const QString &line, Recipe & recipe, bool &is_sub ); - void loadIngredientHeader( const QString &line, Recipe & recipe ); - void loadInstructions( QStringList::const_iterator &raw_text, Recipe & recipe ); - void loadReferences( QStringList::const_iterator &raw_text, Recipe & recipe ); + void loadIngredient( const TQString &line, Recipe & recipe, bool &is_sub ); + void loadIngredientHeader( const TQString &line, Recipe & recipe ); + void loadInstructions( TQStringList::const_iterator &raw_text, Recipe & recipe ); + void loadReferences( TQStringList::const_iterator &raw_text, Recipe & recipe ); - void readRange( const QString &, double &amount, double &amount_offset ); - void readRecipe( const QStringList &raw_text ); + void readRange( const TQString &, double &amount, double &amount_offset ); + void readRecipe( const TQStringList &raw_text ); - QStringList::const_iterator m_end_it; + TQStringList::const_iterator m_end_it; - QString current_header; + TQString current_header; }; #endif //REZKONVIMPORTER_H diff --git a/krecipes/src/klomanager.cpp b/krecipes/src/klomanager.cpp index b760dc7..8026c7b 100644 --- a/krecipes/src/klomanager.cpp +++ b/krecipes/src/klomanager.cpp @@ -12,9 +12,9 @@ #include -#include -#include -#include +#include +#include +#include KLOManager::KLOManager() { @@ -25,32 +25,32 @@ KLOManager::~KLOManager() } -QStringList KLOManager::classes() +TQStringList KLOManager::classes() { - QStringList classesList; + TQStringList classesList; classesList << "title" << "instructions" << "yield" << "prep_time" << "photo" << "authors" << "categories" << "header" << "ingredients" << "properties" << "ratings"; return classesList; } -void KLOManager::processDocument( const QDomDocument &doc ) +void KLOManager::processDocument( const TQDomDocument &doc ) { - QDomElement layout = doc.documentElement(); + TQDomElement layout = doc.documentElement(); if ( layout.tagName() != "krecipes-layout" ) { kdDebug() << "This file does not appear to be a valid Krecipes layout file." << endl; return ; } - QDomNodeList l = layout.childNodes(); + TQDomNodeList l = layout.childNodes(); for ( unsigned int i = 0 ; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); - QString tagName = el.tagName(); - QDomNodeList subList = el.childNodes(); + TQDomElement el = l.item( i ).toElement(); + TQString tagName = el.tagName(); + TQDomNodeList subList = el.childNodes(); /*if ( !*/beginObject( tagName )/* ) {*/; //###: just a thought.... for ( unsigned int j = 0 ; j < subList.count(); j++ ) { - QDomElement subEl = subList.item( j ).toElement(); - QString subTagName = subEl.tagName(); + TQDomElement subEl = subList.item( j ).toElement(); + TQString subTagName = subEl.tagName(); if ( subTagName == "background-color" ) loadBackgroundColor( tagName, getColorAttribute(el,subTagName) ); @@ -73,23 +73,23 @@ void KLOManager::processDocument( const QDomDocument &doc ) } } -QDomElement KLOManager::getLayoutAttribute( const QDomElement &object, const QString &attribute ) const +TQDomElement KLOManager::getLayoutAttribute( const TQDomElement &object, const TQString &attribute ) const { - QDomNodeList l = object.childNodes(); + TQDomNodeList l = object.childNodes(); for ( unsigned i = 0; i < l.count(); i++ ) { - QDomElement el = l.item( i ).toElement(); + TQDomElement el = l.item( i ).toElement(); if ( el.tagName() == attribute ) return el; } kdDebug() << "Warning: Requested attribute \"" << attribute << "\" not found." << endl; - return QDomElement(); + return TQDomElement(); } -bool KLOManager::getBoolAttribute( const QDomElement &object, const QString &attribute, bool defaultValue ) const +bool KLOManager::getBoolAttribute( const TQDomElement &object, const TQString &attribute, bool defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } @@ -98,20 +98,20 @@ bool KLOManager::getBoolAttribute( const QDomElement &object, const QString &att } } -QColor KLOManager::getColorAttribute( const QDomElement &object, const QString &attribute, const QColor &defaultValue ) const +TQColor KLOManager::getColorAttribute( const TQDomElement &object, const TQString &attribute, const TQColor &defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } else { - return QColor(result.text()); + return TQColor(result.text()); } } -QString KLOManager::getTextAttribute( const QDomElement &object, const QString &attribute, const QString &defaultValue ) const +TQString KLOManager::getTextAttribute( const TQDomElement &object, const TQString &attribute, const TQString &defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } @@ -120,9 +120,9 @@ QString KLOManager::getTextAttribute( const QDomElement &object, const QString & } } -int KLOManager::getIntAttribute( const QDomElement &object, const QString &attribute, int defaultValue ) const +int KLOManager::getIntAttribute( const TQDomElement &object, const TQString &attribute, int defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } @@ -131,67 +131,67 @@ int KLOManager::getIntAttribute( const QDomElement &object, const QString &attri } } -KreBorder KLOManager::getBorderAttribute( const QDomElement &object, const QString &attribute, const KreBorder &defaultValue ) const +KreBorder KLOManager::getBorderAttribute( const TQDomElement &object, const TQString &attribute, const KreBorder &defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } else { - return KreBorder( result.attribute( "width" ).toInt(), result.attribute( "style" ), QColor(result.attribute( "color" )) ); + return KreBorder( result.attribute( "width" ).toInt(), result.attribute( "style" ), TQColor(result.attribute( "color" )) ); } } -QFont KLOManager::getFontAttribute( const QDomElement &object, const QString &attribute, const QFont &defaultValue ) const +TQFont KLOManager::getFontAttribute( const TQDomElement &object, const TQString &attribute, const TQFont &defaultValue ) const { - QDomElement result = getLayoutAttribute( object, attribute ); + TQDomElement result = getLayoutAttribute( object, attribute ); if ( result.isNull() ) { return defaultValue; } else { - QFont font; + TQFont font; font.fromString(result.text()); return font; } } -QString KLOManager::alignmentAsCSS( int alignment ) +TQString KLOManager::alignmentAsCSS( int alignment ) { - QString text; + TQString text; - if ( alignment & Qt::AlignLeft ) + if ( alignment & TQt::AlignLeft ) text += "text-align: left;\n"; - if ( alignment & Qt::AlignRight ) + if ( alignment & TQt::AlignRight ) text += "text-align: right;\n"; - if ( alignment & Qt::AlignHCenter ) + if ( alignment & TQt::AlignHCenter ) text += "text-align: center;\n"; - if ( alignment & Qt::AlignTop ) + if ( alignment & TQt::AlignTop ) text += "vertical-align: top;\n"; - if ( alignment & Qt::AlignBottom ) + if ( alignment & TQt::AlignBottom ) text += "vertical-align: bottom;\n"; - if ( alignment & Qt::AlignVCenter ) + if ( alignment & TQt::AlignVCenter ) text += "vertical-align: middle;\n"; return text; } -QString KLOManager::borderAsCSS( const KreBorder &border ) +TQString KLOManager::borderAsCSS( const KreBorder &border ) { - return QString( "border: %1px %2 %3;\n" ).arg(border.width).arg(border.style).arg(border.color.name()); + return TQString( "border: %1px %2 %3;\n" ).arg(border.width).arg(border.style).arg(border.color.name()); } -QString KLOManager::bgColorAsCSS( const QColor &color ) +TQString KLOManager::bgColorAsCSS( const TQColor &color ) { - return QString( "background-color: %1;\n" ).arg( color.name() ); + return TQString( "background-color: %1;\n" ).arg( color.name() ); } -QString KLOManager::fontAsCSS( const QFont &font ) +TQString KLOManager::fontAsCSS( const TQFont &font ) { - QString text; + TQString text; - text += QString( "font-family: %1;\n" ).arg( font.family() ); - text += QString( "font-weight: %1;\n" ).arg( font.weight() ); - text += QString( "font-size: %1pt;\n" ).arg( font.pointSize() ); + text += TQString( "font-family: %1;\n" ).arg( font.family() ); + text += TQString( "font-weight: %1;\n" ).arg( font.weight() ); + text += TQString( "font-size: %1pt;\n" ).arg( font.pointSize() ); if ( font.underline() ) text += "text-decoration: underline;\n"; if ( font.strikeOut() ) @@ -204,12 +204,12 @@ QString KLOManager::fontAsCSS( const QFont &font ) return text; } -QString KLOManager::textColorAsCSS( const QColor &color ) +TQString KLOManager::textColorAsCSS( const TQColor &color ) { - return QString( "color: %1;\n" ).arg( color.name() ); + return TQString( "color: %1;\n" ).arg( color.name() ); } -QString KLOManager::visibilityAsCSS( bool visible ) +TQString KLOManager::visibilityAsCSS( bool visible ) { if ( visible ) return "visibility: visible;\n"; diff --git a/krecipes/src/klomanager.h b/krecipes/src/klomanager.h index ed90771..88db2d6 100644 --- a/krecipes/src/klomanager.h +++ b/krecipes/src/klomanager.h @@ -11,8 +11,8 @@ #ifndef KLOMANAGER_H #define KLOMANAGER_H -#include -#include +#include +#include #include "datablocks/kreborder.h" @@ -22,38 +22,38 @@ public: KLOManager(); virtual ~KLOManager(); - static QStringList classes(); + static TQStringList classes(); protected: - void processDocument( const QDomDocument & ); + void processDocument( const TQDomDocument & ); - virtual void loadBackgroundColor( const QString &/*obj*/, const QColor& ){}; - virtual void loadFont( const QString &/*obj*/, const QFont& ){}; - virtual void loadTextColor( const QString &/*obj*/, const QColor& ){}; - virtual void loadVisibility( const QString &/*obj*/, bool ){}; - virtual void loadAlignment( const QString &/*obj*/, int ){}; - virtual void loadBorder( const QString &/*obj*/, const KreBorder& ){}; - virtual void loadColumns( const QString &/*obj*/, int ){}; + virtual void loadBackgroundColor( const TQString &/*obj*/, const TQColor& ){}; + virtual void loadFont( const TQString &/*obj*/, const TQFont& ){}; + virtual void loadTextColor( const TQString &/*obj*/, const TQColor& ){}; + virtual void loadVisibility( const TQString &/*obj*/, bool ){}; + virtual void loadAlignment( const TQString &/*obj*/, int ){}; + virtual void loadBorder( const TQString &/*obj*/, const KreBorder& ){}; + virtual void loadColumns( const TQString &/*obj*/, int ){}; - virtual void beginObject( const QString &/*obj*/ ){}; + virtual void beginObject( const TQString &/*obj*/ ){}; virtual void endObject(){}; - bool getBoolAttribute( const QDomElement &obj, const QString &attr, bool defaultValue = true ) const; - QColor getColorAttribute( const QDomElement &obj, const QString &attr, const QColor &defaultValue = Qt::white ) const; - QString getTextAttribute( const QDomElement &obj, const QString &attr, const QString &defaultValue = QString::null ) const; - int getIntAttribute( const QDomElement &obj, const QString &attr, int defaultValue = 0 ) const; - KreBorder getBorderAttribute( const QDomElement &obj, const QString &attr, const KreBorder &defaultValue = KreBorder() ) const; - QFont getFontAttribute( const QDomElement &obj, const QString &attr, const QFont &defaultValue = QFont() ) const; + bool getBoolAttribute( const TQDomElement &obj, const TQString &attr, bool defaultValue = true ) const; + TQColor getColorAttribute( const TQDomElement &obj, const TQString &attr, const TQColor &defaultValue = TQt::white ) const; + TQString getTextAttribute( const TQDomElement &obj, const TQString &attr, const TQString &defaultValue = TQString::null ) const; + int getIntAttribute( const TQDomElement &obj, const TQString &attr, int defaultValue = 0 ) const; + KreBorder getBorderAttribute( const TQDomElement &obj, const TQString &attr, const KreBorder &defaultValue = KreBorder() ) const; + TQFont getFontAttribute( const TQDomElement &obj, const TQString &attr, const TQFont &defaultValue = TQFont() ) const; - QString alignmentAsCSS( int ); - QString borderAsCSS( const KreBorder & ); - QString bgColorAsCSS( const QColor & ); - QString fontAsCSS( const QFont & ); - QString textColorAsCSS( const QColor & ); - QString visibilityAsCSS( bool ); + TQString alignmentAsCSS( int ); + TQString borderAsCSS( const KreBorder & ); + TQString bgColorAsCSS( const TQColor & ); + TQString fontAsCSS( const TQFont & ); + TQString textColorAsCSS( const TQColor & ); + TQString visibilityAsCSS( bool ); private: - QDomElement getLayoutAttribute( const QDomElement &obj, const QString &attr ) const; + TQDomElement getLayoutAttribute( const TQDomElement &obj, const TQString &attr ) const; }; #endif //KLOMANAGER_H diff --git a/krecipes/src/krecipes.cpp b/krecipes/src/krecipes.cpp index 845c29b..9449351 100644 --- a/krecipes/src/krecipes.cpp +++ b/krecipes/src/krecipes.cpp @@ -44,11 +44,11 @@ #include "backends/recipedb.h" #include "backends/progressinterface.h" -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include @@ -95,10 +95,10 @@ Krecipes::Krecipes() // allow the view to change the statusbar and caption - connect( m_view, SIGNAL( signalChangeStatusbar( const QString& ) ), - this, SLOT( changeStatusbar( const QString& ) ) ); - connect( m_view, SIGNAL( signalChangeCaption( const QString& ) ), - this, SLOT( changeCaption( const QString& ) ) ); + connect( m_view, SIGNAL( signalChangeStatusbar( const TQString& ) ), + this, SLOT( changeStatusbar( const TQString& ) ) ); + connect( m_view, SIGNAL( signalChangeCaption( const TQString& ) ), + this, SLOT( changeCaption( const TQString& ) ) ); connect( m_view, SIGNAL( panelShown( KrePanel, bool ) ), SLOT( updateActions( KrePanel, bool ) ) ); connect( m_view, SIGNAL( panelShown( KrePanel, bool ) ), SLOT( updateActions( KrePanel, bool ) ) ); @@ -113,10 +113,10 @@ Krecipes::Krecipes() enableSaveOption( false ); // Disables saving initially recipeSelected( false ); //nothing is selected initially - parsing_file_dlg = new KDialog( this, "parsing_file_dlg", true, Qt::WX11BypassWM ); - QLabel *parsing_file_dlg_label = new QLabel( i18n( "Gathering recipe data from file.\nPlease wait..." ), parsing_file_dlg ); - parsing_file_dlg_label->setFrameStyle( QFrame::Box | QFrame::Raised ); - ( new QVBoxLayout( parsing_file_dlg ) ) ->addWidget( parsing_file_dlg_label ); + parsing_file_dlg = new KDialog( this, "parsing_file_dlg", true, TQt::WX11BypassWM ); + TQLabel *parsing_file_dlg_label = new TQLabel( i18n( "Gathering recipe data from file.\nPlease wait..." ), parsing_file_dlg ); + parsing_file_dlg_label->setFrameStyle( TQFrame::Box | TQFrame::Raised ); + ( new TQVBoxLayout( parsing_file_dlg ) ) ->addWidget( parsing_file_dlg_label ); parsing_file_dlg->adjustSize(); //parsing_file_dlg->setFixedSize(parsing_file_dlg->size()); @@ -256,16 +256,16 @@ void Krecipes::readProperties( KConfig * ) // the app is being restored. read in here whatever you wrote // in 'saveProperties' - //QString url = config->readEntry("lastURL"); + //TQString url = config->readEntry("lastURL"); //if (!url.isNull()) // m_view->openURL(KURL(url)); } -void Krecipes::dragEnterEvent( QDragEnterEvent *event ) +void Krecipes::dragEnterEvent( TQDragEnterEvent *event ) { // accept uri drops only - event->accept( QUriDrag::canDecode( event ) ); + event->accept( TQUriDrag::canDecode( event ) ); } @@ -283,10 +283,10 @@ void Krecipes::fileOpen() // button is clicked /* // this brings up the generic open dialog - KURL url = KURLRequesterDlg::getURL(QString::null, this, i18n("Open Location") ); + KURL url = KURLRequesterDlg::getURL(TQString::null, this, i18n("Open Location") ); */ // standard filedialog - /*KURL url = KFileDialog::getOpenURL(QString::null, QString::null, this, i18n("Open Location")); + /*KURL url = KFileDialog::getOpenURL(TQString::null, TQString::null, this, i18n("Open Location")); if (!url.isEmpty()) m_view->openURL(url);*/ } @@ -317,7 +317,7 @@ void Krecipes::filePrint() void Krecipes::import() { - KFileDialog file_dialog( QString::null, + KFileDialog file_dialog( TQString::null, "*.kre *.kreml|Krecipes (*.kre, *.kreml)\n" "*.mx2|MasterCook (*.mx2)\n" "*.mxp *.txt|MasterCook Export (*.mxp, *.txt)\n" @@ -332,9 +332,9 @@ void Krecipes::import() file_dialog.setMode( KFile::Files ); if ( file_dialog.exec() == KFileDialog::Accepted ) { - QStringList warnings_list; + TQStringList warnings_list; - QString selected_filter = file_dialog.currentFilter(); + TQString selected_filter = file_dialog.currentFilter(); BaseImporter *importer; if ( selected_filter == "*.mxp *.txt" ) @@ -353,7 +353,7 @@ void Krecipes::import() importer = new RezkonvImporter(); else { KMessageBox::sorry( this, - QString( i18n( "Filter \"%1\" not recognized.\n" + TQString( i18n( "Filter \"%1\" not recognized.\n" "Please select one of the provided filters." ) ).arg( selected_filter ), i18n( "Unrecognized Filter" ) ); @@ -373,7 +373,7 @@ void Krecipes::import() if ( !direct ) { RecipeImportDialog import_dialog( importer->recipeList() ); - if ( import_dialog.exec() != QDialog::Accepted ) { + if ( import_dialog.exec() != TQDialog::Accepted ) { delete importer; return; } @@ -386,13 +386,13 @@ void Krecipes::import() if ( !importer->getMessages().isEmpty() ) { KTextEdit * warningEdit = new KTextEdit( this ); - warningEdit->setTextFormat( Qt::RichText ); - warningEdit->setText( QString( i18n( "NOTE: We recommend that all recipes generating warnings be checked to ensure that they were properly imported, and no loss of recipe data has occurred.

    " ) ) + importer->getMessages() ); + warningEdit->setTextFormat( TQt::RichText ); + warningEdit->setText( TQString( i18n( "NOTE: We recommend that all recipes generating warnings be checked to ensure that they were properly imported, and no loss of recipe data has occurred.

    " ) ) + importer->getMessages() ); warningEdit->setReadOnly( true ); KDialogBase showWarningsDlg( KDialogBase::Swallow, i18n( "Import Warnings" ), KDialogBase::Ok, KDialogBase::Default, this ); showWarningsDlg.setMainWidget( warningEdit ); //KDialogBase will delete warningEdit for us - showWarningsDlg.resize( QSize( 550, 250 ) ); + showWarningsDlg.resize( TQSize( 550, 250 ) ); showWarningsDlg.exec(); } @@ -403,9 +403,9 @@ void Krecipes::import() void Krecipes::kreDBImport() { DBImportDialog importOptions; - if ( importOptions.exec() == QDialog::Accepted ) { + if ( importOptions.exec() == TQDialog::Accepted ) { //Get all params, even if we don't use them - QString host, user, pass, table; + TQString host, user, pass, table; int port; importOptions.serverParams( host, user, pass, port, table ); @@ -413,7 +413,7 @@ void Krecipes::kreDBImport() parsing_file_dlg->show(); KApplication::setOverrideCursor( KCursor::waitCursor() ); - QStringList tables; + TQStringList tables; if ( importOptions.dbType() == "SQLite" ) tables << importOptions.dbFile(); else //MySQL or PostgreSQL @@ -428,14 +428,14 @@ void Krecipes::kreDBImport() if ( !direct ) { RecipeImportDialog import_dialog( importer.recipeList() ); - if ( import_dialog.exec() != QDialog::Accepted ) { + if ( import_dialog.exec() != TQDialog::Accepted ) { return; } else importer.setRecipeList( import_dialog.getSelectedRecipes() ); } - QString error = importer.getErrorMsg(); + TQString error = importer.getErrorMsg(); if ( !error.isEmpty() ) { KMessageBox::sorry( this, error ); } @@ -451,12 +451,12 @@ void Krecipes::pageSetupSlot() KConfig *config = KGlobal::config(); config->setGroup("Page Setup"); - QString layout = config->readEntry( "Layout", locate( "appdata", "layouts/Default.klo" ) ); - QString printLayout = config->readEntry( "PrintLayout", locate( "appdata", "layouts/Default.klo" ) ); + TQString layout = config->readEntry( "Layout", locate( "appdata", "layouts/Default.klo" ) ); + TQString printLayout = config->readEntry( "PrintLayout", locate( "appdata", "layouts/Default.klo" ) ); if ( layout == printLayout ) { KMessageBox::information( this, i18n("The recipe print and view layouts use the same file for their style, meaning changing one view's look changes them both. If this is not the behavior you desire, load one style and save it under a different name."), - QString::null, "sharedLayoutWarning" ); + TQString::null, "sharedLayoutWarning" ); } PageSetupDialog page_setup( this, recipe ); @@ -470,12 +470,12 @@ void Krecipes::printSetupSlot() KConfig *config = KGlobal::config(); config->setGroup("Page Setup"); - QString layout = config->readEntry( "Layout", locate( "appdata", "layouts/Default.klo" ) ); - QString printLayout = config->readEntry( "PrintLayout", locate( "appdata", "layouts/Default.klo" ) ); + TQString layout = config->readEntry( "Layout", locate( "appdata", "layouts/Default.klo" ) ); + TQString printLayout = config->readEntry( "PrintLayout", locate( "appdata", "layouts/Default.klo" ) ); if ( layout == printLayout ) { KMessageBox::information( this, i18n("The recipe print and view layouts use the same file for their style, meaning changing one view's look changes them both. If this is not the behavior you desire, load one style and save it under a different name."), - QString::null, "sharedLayoutWarning" ); + TQString::null, "sharedLayoutWarning" ); } PageSetupDialog pageSetup( this, recipe, "Print" ); @@ -489,20 +489,20 @@ void Krecipes::conversionToolSlot() void Krecipes::backupSlot() { - QString fileName = KFileDialog::getSaveFileName(QString::null, - QString("*.krecbk|%1 (*.krecbk)").arg("Krecipes Backup File"), + TQString fileName = KFileDialog::getSaveFileName(TQString::null, + TQString("*.krecbk|%1 (*.krecbk)").arg("Krecipes Backup File"), this,i18n("Save Backup As...")); int overwrite = KMessageBox::Yes; - if ( QFile::exists(fileName) ) { - overwrite = KMessageBox::warningYesNo( this, QString( i18n( "File \"%1\" exists. Are you sure you want to overwrite it?" ) ).arg( fileName ) ); + if ( TQFile::exists(fileName) ) { + overwrite = KMessageBox::warningYesNo( this, TQString( i18n( "File \"%1\" exists. Are you sure you want to overwrite it?" ) ).arg( fileName ) ); } if ( !fileName.isNull() && overwrite == KMessageBox::Yes ) { ProgressInterface pi(this); pi.listenOn(m_view->database); - QString errMsg; + TQString errMsg; if ( !m_view->database->backup( fileName, &errMsg ) ) KMessageBox::error( this, errMsg, i18n("Backup Failed") ); } @@ -510,17 +510,17 @@ void Krecipes::backupSlot() void Krecipes::restoreSlot() { - QString filename = KFileDialog::getOpenFileName(QString::null, - QString("*.krecbk|%1 (*.krecbk)").arg(i18n("Krecipes Backup File")), + TQString filename = KFileDialog::getOpenFileName(TQString::null, + TQString("*.krecbk|%1 (*.krecbk)").arg(i18n("Krecipes Backup File")), this,i18n("Restore Backup")); if ( !filename.isNull() ) { - switch ( KMessageBox::warningContinueCancel(this,i18n("Restoring this file will erase ALL data currently in the database!

    If you want to keep the recipes in your database, click \"Cancel\" and first export your recipes. These can then be imported once the restore is complete.

    Are you sure you want to proceed?"),QString::null,KStdGuiItem::cont(),"RestoreWarning") ) { + switch ( KMessageBox::warningContinueCancel(this,i18n("Restoring this file will erase ALL data currently in the database!

    If you want to keep the recipes in your database, click \"Cancel\" and first export your recipes. These can then be imported once the restore is complete.

    Are you sure you want to proceed?"),TQString::null,KStdGuiItem::cont(),"RestoreWarning") ) { case KMessageBox::Continue: { ProgressInterface pi(this); pi.listenOn(m_view->database); - QString errMsg; + TQString errMsg; if ( m_view->database->restore( filename, &errMsg ) ) KMessageBox::information(this,i18n("Restore successful.")); else @@ -540,9 +540,9 @@ void Krecipes::mergeSimilarCategories() ElementList categories; m_view->database->loadCategories(&categories); SimilarCategoriesDialog dlg(categories,this); - if ( dlg.exec() == QDialog::Accepted ) { - QValueList ids = dlg.matches(); - QString name = dlg.element(); + if ( dlg.exec() == TQDialog::Accepted ) { + TQValueList ids = dlg.matches(); + TQString name = dlg.element(); int id = m_view->database->findExistingCategoryByName(name); if ( id == -1 ) { @@ -550,7 +550,7 @@ void Krecipes::mergeSimilarCategories() id = m_view->database->lastInsertID(); } - for ( QValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { + for ( TQValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { if ( id != *it ) m_view->database->mergeCategories(id, *it); } @@ -562,9 +562,9 @@ void Krecipes::mergeSimilarIngredients() ElementList ingredients; m_view->database->loadIngredients(&ingredients); SimilarCategoriesDialog dlg(ingredients,this); - if ( dlg.exec() == QDialog::Accepted ) { - QValueList ids = dlg.matches(); - QString name = dlg.element(); + if ( dlg.exec() == TQDialog::Accepted ) { + TQValueList ids = dlg.matches(); + TQString name = dlg.element(); if ( ids.isEmpty() || name.isEmpty() ) return; @@ -574,7 +574,7 @@ void Krecipes::mergeSimilarIngredients() id = m_view->database->lastInsertID(); } - for ( QValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { + for ( TQValueList::const_iterator it = ids.begin(); it != ids.end(); ++it ) { if ( id != *it ) m_view->database->mergeIngredients(id, *it); } @@ -684,13 +684,13 @@ void Krecipes::optionsPreferences() } -void Krecipes::changeStatusbar( const QString& text ) +void Krecipes::changeStatusbar( const TQString& text ) { // display the text on the statusbar statusBar() ->message( text ); } -void Krecipes::changeCaption( const QString& text ) +void Krecipes::changeCaption( const TQString& text ) { // display the text on the caption setCaption( text ); diff --git a/krecipes/src/krecipes.h b/krecipes/src/krecipes.h index db7918e..67ac881 100644 --- a/krecipes/src/krecipes.h +++ b/krecipes/src/krecipes.h @@ -54,9 +54,9 @@ public: protected: /** - * Overridden virtuals for Qt drag 'n drop (XDND) + * Overridden virtuals for TQt drag 'n drop (XDND) */ - virtual void dragEnterEvent( QDragEnterEvent *event ); + virtual void dragEnterEvent( TQDragEnterEvent *event ); protected: /** @@ -103,8 +103,8 @@ private slots: */ void updateActions( KrePanel panel, bool show ); - void changeStatusbar( const QString& text ); - void changeCaption( const QString& text ); + void changeStatusbar( const TQString& text ); + void changeCaption( const TQString& text ); private: // Private methods @@ -130,7 +130,7 @@ private: KDialog *parsing_file_dlg; ConversionDialog *convertDialog; - QValueList recipe_actions; + TQValueList recipe_actions; private slots: void enableSaveOption( bool en = true ); diff --git a/krecipes/src/krecipesdbiface.h b/krecipes/src/krecipesdbiface.h index a0fae49..f5447dc 100644 --- a/krecipes/src/krecipesdbiface.h +++ b/krecipes/src/krecipesdbiface.h @@ -20,7 +20,7 @@ public: k_dcop: virtual void emptyData() = 0; - virtual bool backup( const QString &filename ) = 0; + virtual bool backup( const TQString &filename ) = 0; }; #endif // _KRECIPESIFACE_H_ diff --git a/krecipes/src/krecipesiface.h b/krecipes/src/krecipesiface.h index ebb12b1..718dadb 100644 --- a/krecipes/src/krecipesiface.h +++ b/krecipes/src/krecipesiface.h @@ -14,7 +14,7 @@ #include #include -#include +#include class KrecipesIface : virtual public DCOPObject { @@ -25,7 +25,7 @@ k_dcop: virtual DCOPRef currentDatabase() const = 0; virtual void reload() = 0; - virtual void exportRecipes( const QValueList &ids ) = 0; + virtual void exportRecipes( const TQValueList &ids ) = 0; }; #endif // _KRECIPESIFACE_H_ diff --git a/krecipes/src/krecipesview.cpp b/krecipes/src/krecipesview.cpp index 9c71b27..4fbdc42 100644 --- a/krecipes/src/krecipesview.cpp +++ b/krecipes/src/krecipesview.cpp @@ -15,10 +15,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -57,11 +57,11 @@ #include "profiling.h" -KrecipesView::KrecipesView( QWidget *parent ) - : DCOPObject( "KrecipesInterface" ), QVBox( parent ) +KrecipesView::KrecipesView( TQWidget *parent ) + : DCOPObject( "KrecipesInterface" ), TQVBox( parent ) { #ifndef NDEBUG - QTime dbg_total_timer; dbg_total_timer.start(); + TQTime dbg_total_timer; dbg_total_timer.start(); #endif kapp->dcopClient()->setDefaultObject( objId() ); @@ -96,7 +96,7 @@ KrecipesView::KrecipesView( QWidget *parent ) // Design the GUI - splitter = new QHBox( this ); + splitter = new TQHBox( this ); // Create Left and Right Panels (splitter) @@ -109,7 +109,7 @@ KrecipesView::KrecipesView( QWidget *parent ) START_TIMER("Setting up buttons") // Buttons - buttonsList = new QPtrList(); + buttonsList = new TQPtrList(); buttonsList->setAutoDelete( TRUE ); button0 = new KreMenuButton( leftPanel, SelectP ); @@ -156,7 +156,7 @@ KrecipesView::KrecipesView( QWidget *parent ) button6->setIconSet( il.loadIconSet( "personal", KIcon::Panel, 32 ) ); buttonsList->append( button6 ); - contextButton = new QPushButton( leftPanel, "contextButton" ); + contextButton = new TQPushButton( leftPanel, "contextButton" ); contextButton->setIconSet( il.loadIconSet( "krectip", KIcon::Panel, 32 ) ); contextButton->setGeometry( leftPanel->width() - 42, leftPanel->height() - 42, 32, 32 ); contextButton->setPaletteBackgroundColor( contextButton->paletteBackgroundColor().light( 140 ) ); @@ -254,12 +254,12 @@ KrecipesView::KrecipesView( QWidget *parent ) connect ( inputPanel, SIGNAL( enableSaveOption( bool ) ), this, SIGNAL( enableSaveOption( bool ) ) ); // Create a new button when a recipe is unsaved - connect ( inputPanel, SIGNAL( createButton( QWidget*, const QString & ) ), this, SLOT( addRecipeButton( QWidget*, const QString & ) ) ); + connect ( inputPanel, SIGNAL( createButton( TQWidget*, const TQString & ) ), this, SLOT( addRecipeButton( TQWidget*, const TQString & ) ) ); // Connect Signals from selectPanel (SelectRecipeDialog) connect ( selectPanel, SIGNAL( recipeSelected( int, int ) ), this, SLOT( actionRecipe( int, int ) ) ); - connect ( selectPanel, SIGNAL( recipesSelected( const QValueList&, int ) ), this, SLOT( actionRecipes( const QValueList&, int ) ) ); + connect ( selectPanel, SIGNAL( recipesSelected( const TQValueList&, int ) ), this, SLOT( actionRecipes( const TQValueList&, int ) ) ); // Connect Signals from ingredientMatcherPanel (IngredientMatcherDialog) @@ -277,7 +277,7 @@ KrecipesView::KrecipesView( QWidget *parent ) // Place the Tip Button in correct position when the left pane is resized connect( leftPanel, SIGNAL( resized( int, int ) ), this, SLOT( moveTipButton( int, int ) ) ); - connect( rightPanel, SIGNAL( panelRaised( QWidget*, QWidget* ) ), SLOT( panelRaised( QWidget*, QWidget* ) ) ); + connect( rightPanel, SIGNAL( panelRaised( TQWidget*, TQWidget* ) ), SLOT( panelRaised( TQWidget*, TQWidget* ) ) ); connect( selectPanel, SIGNAL( recipeSelected(bool) ), SIGNAL( recipeSelected(bool) ) ); @@ -297,9 +297,9 @@ KrecipesView::~KrecipesView() delete database; } -bool KrecipesView::questionRerunWizard( const QString &message, const QString &error ) +bool KrecipesView::questionRerunWizard( const TQString &message, const TQString &error ) { - QString yesNoMessage = message + " " + i18n( "\nWould you like to run the setup wizard again? Otherwise, the application will be closed." ); + TQString yesNoMessage = message + " " + i18n( "\nWould you like to run the setup wizard again? Otherwise, the application will be closed." ); int answer = KMessageBox::questionYesNo( this, yesNoMessage ); if ( answer == KMessageBox::Yes ) @@ -333,7 +333,7 @@ void KrecipesView::print() } -void KrecipesView::slotSetTitle( const QString& title ) +void KrecipesView::slotSetTitle( const TQString& title ) { emit signalChangeCaption( title ); } @@ -415,7 +415,7 @@ bool KrecipesView::save( void ) */ void KrecipesView::exportRecipe() { - QWidget * vis_panel = rightPanel->visiblePanel(); + TQWidget * vis_panel = rightPanel->visiblePanel(); if ( vis_panel == viewPanel && viewPanel->recipesLoaded() > 0 ) { exportRecipes( viewPanel->currentRecipes() ); } @@ -426,9 +426,9 @@ void KrecipesView::exportRecipe() void KrecipesView::exportToClipboard() { - QWidget * vis_panel = rightPanel->visiblePanel(); + TQWidget * vis_panel = rightPanel->visiblePanel(); if ( vis_panel == viewPanel && viewPanel->recipesLoaded() > 0 ) { - QValueList ids = viewPanel->currentRecipes(); + TQValueList ids = viewPanel->currentRecipes(); RecipeActionsHandler::recipesToClipboard( ids, database ); } else if ( vis_panel == selectPanel ) { @@ -436,7 +436,7 @@ void KrecipesView::exportToClipboard() } } -void KrecipesView::exportRecipes( const QValueList &ids ) +void KrecipesView::exportRecipes( const TQValueList &ids ) { if ( ids.count() == 1 ) RecipeActionsHandler::exportRecipes( ids, i18n( "Export Recipe" ), database->recipeTitle( ids[ 0 ] ), database ); @@ -457,7 +457,7 @@ void KrecipesView::actionRecipe( int recipeID, int action ) if ( !inputPanel->everythingSaved() ) { switch ( KMessageBox::questionYesNoCancel( this, - QString( i18n( "A recipe contains unsaved changes.\n" + TQString( i18n( "A recipe contains unsaved changes.\n" "Do you want to save changes made to this recipe before editing another recipe?" ) ), i18n( "Unsaved changes" ) ) ) { case KMessageBox::Yes: @@ -477,7 +477,7 @@ void KrecipesView::actionRecipe( int recipeID, int action ) case 2: //Remove { switch ( KMessageBox::questionYesNo( this, - QString( i18n( "Are you sure you want to permanently remove the recipe, %1?" ) ).arg(database->recipeTitle(recipeID)), + TQString( i18n( "Are you sure you want to permanently remove the recipe, %1?" ) ).arg(database->recipeTitle(recipeID)), i18n( "Confirm remove" ) ) ) { case KMessageBox::Yes: @@ -496,7 +496,7 @@ void KrecipesView::actionRecipe( int recipeID, int action ) } } -void KrecipesView::actionRecipes( const QValueList &ids, int action ) +void KrecipesView::actionRecipes( const TQValueList &ids, int action ) { if ( action == 0 ) //show { @@ -509,7 +509,7 @@ void KrecipesView::createNewRecipe( void ) { if ( !inputPanel->everythingSaved() ) { switch ( KMessageBox::questionYesNoCancel( this, - QString( i18n( "A recipe contains unsaved changes.\n" + TQString( i18n( "A recipe contains unsaved changes.\n" "Do you want to save changes made to this recipe before creating a new recipe?" ) ), i18n( "Unsaved changes" ) ) ) { case KMessageBox::Yes: @@ -544,18 +544,18 @@ void KrecipesView::wizard( bool force ) config->setGroup( "Wizard" ); bool setupDone = config->readBoolEntry( "SystemSetup", false ); - QString setupVersion = config->readEntry( "Version", "0.3" ); // By default assume it's 0.3. This parameter didn't exist in that version yet. + TQString setupVersion = config->readEntry( "Version", "0.3" ); // By default assume it's 0.3. This parameter didn't exist in that version yet. if ( !setupDone || ( setupVersion.toDouble() < 0.5 ) || force ) // The config structure changed in version 0.4 to have DBType and Config Structure version { bool setupUser, initData, doUSDAImport, adminEnabled; - QString adminUser, adminPass, user, pass, host, client, dbName; + TQString adminUser, adminPass, user, pass, host, client, dbName; int port; bool isRemote; SetupWizard *setupWizard = new SetupWizard( this ); - if ( setupWizard->exec() == QDialog::Accepted ) + if ( setupWizard->exec() == TQDialog::Accepted ) { KConfig * config; config = kapp->config(); @@ -580,7 +580,7 @@ void KrecipesView::wizard( bool force ) adminUser = "root"; else if ( dbType == "PostgreSQL" ) adminUser = "postgres"; - adminPass = QString::null; + adminPass = TQString::null; } if ( !isRemote ) // Use localhost { @@ -639,12 +639,12 @@ void KrecipesView::wizard( bool force ) } -void KrecipesView::setupUserPermissions( const QString &host, const QString &client, const QString &dbName, const QString &newUser, const QString &newPass, const QString &adminUser, const QString &adminPass, int port ) +void KrecipesView::setupUserPermissions( const TQString &host, const TQString &client, const TQString &dbName, const TQString &newUser, const TQString &newPass, const TQString &adminUser, const TQString &adminPass, int port ) { - QString user = adminUser; - QString pass = adminPass; + TQString user = adminUser; + TQString pass = adminPass; if ( user.isNull() ) { - pass = QString::null; + pass = TQString::null; if ( dbType == "PostgreSQL" ) user = "postgres"; @@ -669,7 +669,7 @@ void KrecipesView::setupUserPermissions( const QString &host, const QString &cli } -void KrecipesView::initializeData( const QString &host, const QString &dbName, const QString &user, const QString &pass, int port ) +void KrecipesView::initializeData( const TQString &host, const TQString &dbName, const TQString &user, const TQString &pass, int port ) { RecipeDB * db = RecipeDB::createDatabase( dbType, host, user, pass, dbName, port, dbName ); if ( !db ) { @@ -687,7 +687,7 @@ void KrecipesView::initializeData( const QString &host, const QString &dbName, c delete db; } -void KrecipesView::addRecipeButton( QWidget *w, const QString &title ) +void KrecipesView::addRecipeButton( TQWidget *w, const TQString &title ) { recipeWidget = w; KIconLoader il; @@ -696,7 +696,7 @@ void KrecipesView::addRecipeButton( QWidget *w, const QString &title ) recipeButton->setIconSet( il.loadIconSet( "filesave", KIcon::Small ) ); - QString short_title = title.left( 20 ); + TQString short_title = title.left( 20 ); if ( title.length() > 20 ) short_title.append( "..." ); @@ -706,7 +706,7 @@ void KrecipesView::addRecipeButton( QWidget *w, const QString &title ) leftPanel->highlightButton( recipeButton ); connect( recipeButton, SIGNAL( clicked() ), this, SLOT( switchToRecipe() ) ); - connect( ( RecipeInputDialog * ) w, SIGNAL( titleChanged( const QString& ) ), recipeButton, SLOT( setTitle( const QString& ) ) ); + connect( ( RecipeInputDialog * ) w, SIGNAL( titleChanged( const TQString& ) ), recipeButton, SLOT( setTitle( const TQString& ) ) ); } } @@ -728,17 +728,17 @@ void KrecipesView::closeRecipe( void ) void KrecipesView::show ( void ) { slotSetPanel( SelectP ); - QWidget::show(); + TQWidget::show(); } void KrecipesView::showRecipe( int recipeID ) { - QValueList ids; + TQValueList ids; ids << recipeID; showRecipes( ids ); } -void KrecipesView::showRecipes( const QValueList &recipeIDs ) +void KrecipesView::showRecipes( const TQValueList &recipeIDs ) { if ( viewPanel->loadRecipes( recipeIDs ) ) slotSetPanel( RecipeView ); @@ -797,7 +797,7 @@ void KrecipesView::activateContextHelp() } } -void KrecipesView::panelRaised( QWidget *w, QWidget *old_w ) +void KrecipesView::panelRaised( TQWidget *w, TQWidget *old_w ) { emit panelShown( panelMap[ old_w ], false ); emit panelShown( panelMap[ w ], true ); @@ -817,8 +817,8 @@ void KrecipesView::moveTipButton( int, int ) void KrecipesView::resizeRightPane( int lpw, int ) { - QSize rpsize = rightPanel->size(); - QPoint rpplace = rightPanel->pos(); + TQSize rpsize = rightPanel->size(); + TQPoint rpplace = rightPanel->pos(); rpsize.setWidth( width() - lpw ); rpplace.setX( lpw ); rightPanel->move( rpplace ); @@ -877,7 +877,7 @@ void KrecipesView::initDatabase( KConfig *config ) kdDebug() << i18n( "DB started correctly\n" ).latin1(); } -QString KrecipesView::checkCorrectDBType( KConfig *config ) +TQString KrecipesView::checkCorrectDBType( KConfig *config ) { dbType = config->readEntry( "Type", "SQLite" ); diff --git a/krecipes/src/krecipesview.h b/krecipes/src/krecipesview.h index 9b933e1..3d29fca 100644 --- a/krecipes/src/krecipesview.h +++ b/krecipes/src/krecipesview.h @@ -13,17 +13,17 @@ #ifndef KRECIPESVIEW_H #define KRECIPESVIEW_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -48,13 +48,13 @@ class KreMenuButton; class IngredientMatcherDialog; class PanelDeco; class PropertiesDialog; -class QPainter; +class TQPainter; class RecipeInputDialog; class RecipeViewDialog; class SelectRecipeDialog; class ShoppingListDialog; class UnitsDialog; -typedef QValueList ::Iterator MenuId; +typedef TQValueList ::Iterator MenuId; /** @@ -79,14 +79,14 @@ typedef enum KrePanel {SelectP = 0, ShoppingP, DietP, MatcherP, IngredientsP, Pr // Class KrecipesView -class KrecipesView : public QVBox, virtual public KrecipesIface +class KrecipesView : public TQVBox, virtual public KrecipesIface { Q_OBJECT public: /** * Default constructor */ - KrecipesView( QWidget *parent ); + KrecipesView( TQWidget *parent ); /** * Destructor @@ -107,12 +107,12 @@ signals: /** * Use this signal to change the content of the statusbar */ - void signalChangeStatusbar( const QString& text ); + void signalChangeStatusbar( const TQString& text ); /** * Use this signal to change the content of the caption */ - void signalChangeCaption( const QString& text ); + void signalChangeCaption( const TQString& text ); void panelShown( KrePanel, bool ); @@ -137,26 +137,26 @@ public: void createNewRecipe( void ); void createNewElement( void ); - void exportRecipes( const QValueList &ids ); + void exportRecipes( const TQValueList &ids ); private: // Internal methods - QString checkCorrectDBType( KConfig *config ); - void initializeData( const QString &host, const QString &dbName, const QString &user, const QString &pass, int port ); + TQString checkCorrectDBType( KConfig *config ); + void initializeData( const TQString &host, const TQString &dbName, const TQString &user, const TQString &pass, int port ); void initDatabase( KConfig *config ); - bool questionRerunWizard( const QString &message, const QString &error = "" ); - void setupUserPermissions( const QString &host, const QString &client, const QString &dbName, const QString &newUser, const QString &newPass, const QString &adminUser = QString::null, const QString &adminPass = QString::null, int port = 0 ); + bool questionRerunWizard( const TQString &message, const TQString &error = "" ); + void setupUserPermissions( const TQString &host, const TQString &client, const TQString &dbName, const TQString &newUser, const TQString &newPass, const TQString &adminUser = TQString::null, const TQString &adminPass = TQString::null, int port = 0 ); void wizard( bool force = false ); // Widgets - QHBox *splitter; + TQHBox *splitter; KreMenu *leftPanel; MenuId dataMenu; PanelDeco *rightPanel; - QPtrList *buttonsList; + TQPtrList *buttonsList; KreMenuButton *button0; KreMenuButton *button1; KreMenuButton *button2; @@ -167,16 +167,16 @@ private: KreMenuButton *button7; KreMenuButton *button8; KreMenuButton *button9; - QPushButton* contextButton; + TQPushButton* contextButton; KreMenuButton *recipeButton; - QWidget *recipeWidget; + TQWidget *recipeWidget; // Internal variables - QString dbType; + TQString dbType; KrePanel m_activePanel; - QMap panelMap; + TQMap panelMap; // i18n void translate(); @@ -196,18 +196,18 @@ public slots: private slots: void actionRecipe( int recipeID, int action ); - void actionRecipes( const QValueList &ids, int action ); - void addRecipeButton( QWidget *w, const QString &title ); + void actionRecipes( const TQValueList &ids, int action ); + void addRecipeButton( TQWidget *w, const TQString &title ); void closeRecipe( void ); void showRecipe( int recipeID ); - void showRecipes( const QValueList &recipeIDs ); - void slotSetTitle( const QString& title ); + void showRecipes( const TQValueList &recipeIDs ); + void slotSetTitle( const TQString& title ); void slotSetPanel( KrePanel ); void switchToRecipe( void ); void createShoppingListFromDiet( void ); void moveTipButton( int, int ); void resizeRightPane( int lpw, int lph ); - void panelRaised( QWidget *w, QWidget *old_w ); + void panelRaised( TQWidget *w, TQWidget *old_w ); void editRecipe(); }; diff --git a/krecipes/src/krepagelayout.cpp b/krecipes/src/krepagelayout.cpp index ea87652..97e4272 100644 --- a/krecipes/src/krepagelayout.cpp +++ b/krecipes/src/krepagelayout.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include "kreunit.h" @@ -46,9 +46,9 @@ #define PG_US_EXECUTIVE_WIDTH 191.0 #define PG_US_EXECUTIVE_HEIGHT 254.0 -QDomElement KoPageLayout::saveKreFormat( QDomDocument &doc ) const +TQDomElement KoPageLayout::saveKreFormat( TQDomDocument &doc ) const { - QDomElement style = doc.createElement( "page-layout-properties" ); + TQDomElement style = doc.createElement( "page-layout-properties" ); style.setAttribute("page-width", ptWidth); style.setAttribute("page-height", ptHeight); style.setAttribute("margin-left", ptLeft); @@ -59,20 +59,20 @@ QDomElement KoPageLayout::saveKreFormat( QDomDocument &doc ) const return style; } -void KoPageLayout::loadKreFormat(const QDomElement &style) +void KoPageLayout::loadKreFormat(const TQDomElement &style) { if ( !style.isNull() ) { - ptWidth = KoUnit::parseValue(style.attribute("page-width", QString::null ) ); - ptHeight = KoUnit::parseValue(style.attribute( "page-height", QString::null ) ); - if (style.attribute( "print-orientation", QString::null)=="portrait") + ptWidth = KoUnit::parseValue(style.attribute("page-width", TQString::null ) ); + ptHeight = KoUnit::parseValue(style.attribute( "page-height", TQString::null ) ); + if (style.attribute( "print-orientation", TQString::null)=="portrait") orientation=PG_PORTRAIT; else orientation=PG_LANDSCAPE; - ptRight = KoUnit::parseValue( style.attribute( "margin-right", QString::null ) ); - ptBottom = KoUnit::parseValue( style.attribute( "margin-bottom", QString::null ) ); - ptLeft = KoUnit::parseValue( style.attribute( "margin-left", QString::null ) ); - ptTop = KoUnit::parseValue( style.attribute( "margin-top", QString::null ) ); + ptRight = KoUnit::parseValue( style.attribute( "margin-right", TQString::null ) ); + ptBottom = KoUnit::parseValue( style.attribute( "margin-bottom", TQString::null ) ); + ptLeft = KoUnit::parseValue( style.attribute( "margin-left", TQString::null ) ); + ptTop = KoUnit::parseValue( style.attribute( "margin-top", TQString::null ) ); // guessFormat takes millimeters if ( orientation == PG_LANDSCAPE ) format = KoPageFormat::guessFormat( POINT_TO_MM(ptHeight), POINT_TO_MM(ptWidth) ); @@ -195,18 +195,18 @@ KoFormat KoPageFormat::guessFormat( double width, double height ) return PG_CUSTOM; } -QString KoPageFormat::formatString( KoFormat format ) +TQString KoPageFormat::formatString( KoFormat format ) { if ( format <= PG_LAST_FORMAT ) - return QString::fromLatin1( pageFormatInfo[ format ].shortName ); - return QString::fromLatin1( "A4" ); + return TQString::fromLatin1( pageFormatInfo[ format ].shortName ); + return TQString::fromLatin1( "A4" ); } -KoFormat KoPageFormat::formatFromString( const QString & string ) +KoFormat KoPageFormat::formatFromString( const TQString & string ) { for ( int i = 0 ; i <= PG_LAST_FORMAT ; ++i ) { - if (string == QString::fromLatin1( pageFormatInfo[ i ].shortName )) + if (string == TQString::fromLatin1( pageFormatInfo[ i ].shortName )) return pageFormatInfo[ i ].format; } // We do not know the format name, so we have a custom format @@ -224,16 +224,16 @@ KoFormat KoPageFormat::defaultFormat() return PG_DIN_A4; } -QString KoPageFormat::name( KoFormat format ) +TQString KoPageFormat::name( KoFormat format ) { if ( format <= PG_LAST_FORMAT ) return i18n( pageFormatInfo[ format ].descriptiveName ); return i18n( pageFormatInfo[ PG_DIN_A4 ].descriptiveName ); } -QStringList KoPageFormat::allFormats() +TQStringList KoPageFormat::allFormats() { - QStringList lst; + TQStringList lst; for ( int i = 0 ; i <= PG_LAST_FORMAT ; ++i ) { lst << i18n( pageFormatInfo[ i ].descriptiveName ); diff --git a/krecipes/src/krepagelayout.h b/krecipes/src/krepagelayout.h index 74ed31a..c392a26 100644 --- a/krecipes/src/krepagelayout.h +++ b/krecipes/src/krepagelayout.h @@ -23,16 +23,16 @@ #ifndef KREPAGELAYOUT_H #define KREPAGELAYOUT_H -#include +#include -class QDomElement; -class QDomDocument; +class TQDomElement; +class TQDomDocument; /** * @brief Represents the paper format a document shall be printed on. * * For compatibility reasons, and because of screen and custom, - * this enum doesn't map to QPrinter::PageSize but KoPageFormat::printerPageSize + * this enum doesn't map to TQPrinter::PageSize but KoPageFormat::printerPageSize * does the conversion. * * @todo convert DIN to ISO in the names @@ -109,13 +109,13 @@ namespace KoPageFormat * Returns the internal name of the given page format. * Use for saving. */ - QString formatString( KoFormat format ); + TQString formatString( KoFormat format ); /** * Convert a format string (internal name) to a page format value. * Use for loading. */ - KoFormat formatFromString( const QString & string ); + KoFormat formatFromString( const TQString & string ); /** * Returns the default format (based on the KControl settings) @@ -126,12 +126,12 @@ namespace KoPageFormat * Returns the translated name of the given page format. * Use for showing the user. */ - QString name( KoFormat format ); + TQString name( KoFormat format ); /** * Lists the translated names of all the available formats */ - QStringList allFormats(); + TQStringList allFormats(); /** * Try to find the paper format for the given width and height (in mm). @@ -193,12 +193,12 @@ struct KoPageLayout /** * Save this page layout to the Krecipes layout format */ - QDomElement saveKreFormat( QDomDocument &doc ) const; + TQDomElement saveKreFormat( TQDomDocument &doc ) const; /** * Load this page layout from the Krecipes layout format */ - void loadKreFormat(const QDomElement &style); + void loadKreFormat(const TQDomElement &style); /** * @return a page layout with the default page size depending on the locale settings, @@ -211,12 +211,12 @@ struct KoPageLayout /** structure for header-footer */ struct KoHeadFoot { - QString headLeft; - QString headMid; - QString headRight; - QString footLeft; - QString footMid; - QString footRight; + TQString headLeft; + TQString headMid; + TQString headRight; + TQString footLeft; + TQString footMid; + TQString footRight; }; /** structure for columns */ @@ -226,11 +226,11 @@ struct KoColumns double ptColumnSpacing; bool operator==( const KoColumns& rhs ) const { return columns == rhs.columns && - QABS(ptColumnSpacing - rhs.ptColumnSpacing) <= 1E-10; + TQABS(ptColumnSpacing - rhs.ptColumnSpacing) <= 1E-10; } bool operator!=( const KoColumns& rhs ) const { return columns != rhs.columns || - QABS(ptColumnSpacing - rhs.ptColumnSpacing) > 1E-10; + TQABS(ptColumnSpacing - rhs.ptColumnSpacing) > 1E-10; } }; @@ -244,9 +244,9 @@ struct KoKWHeaderFooter double ptFootNoteBodySpacing; bool operator==( const KoKWHeaderFooter& rhs ) const { return header == rhs.header && footer == rhs.footer && - QABS(ptHeaderBodySpacing - rhs.ptHeaderBodySpacing) <= 1E-10 && - QABS(ptFooterBodySpacing - rhs.ptFooterBodySpacing) <= 1E-10 && - QABS(ptFootNoteBodySpacing - rhs.ptFootNoteBodySpacing) <= 1E-10; + TQABS(ptHeaderBodySpacing - rhs.ptHeaderBodySpacing) <= 1E-10 && + TQABS(ptFooterBodySpacing - rhs.ptFooterBodySpacing) <= 1E-10 && + TQABS(ptFootNoteBodySpacing - rhs.ptFootNoteBodySpacing) <= 1E-10; } bool operator!=( const KoKWHeaderFooter& rhs ) const { return !( *this == rhs ); diff --git a/krecipes/src/kstartuplogo.cpp b/krecipes/src/kstartuplogo.cpp index 3ea13fc..6db749b 100755 --- a/krecipes/src/kstartuplogo.cpp +++ b/krecipes/src/kstartuplogo.cpp @@ -18,16 +18,16 @@ #include #include -#include +#include -KStartupLogo::KStartupLogo( QWidget * parent, const char *name ) : QWidget( parent, name, WStyle_NoBorder | WStyle_Customize | WDestructiveClose ), m_bReadyToHide( false ) +KStartupLogo::KStartupLogo( TQWidget * parent, const char *name ) : TQWidget( parent, name, WStyle_NoBorder | WStyle_Customize | WDestructiveClose ), m_bReadyToHide( false ) { - QString dataDir = locate( "data", "krecipes/pics/startlogo.png" ); - QPixmap pm( dataDir ); + TQString dataDir = locate( "data", "krecipes/pics/startlogo.png" ); + TQPixmap pm( dataDir ); setBackgroundPixmap( pm ); resize(pm.size()); - QRect desk = splashScreenDesktopGeometry(); + TQRect desk = splashScreenDesktopGeometry(); setGeometry( ( desk.width() / 2 ) - ( width() / 2 ) + desk.left(), ( desk.height() / 2 ) - ( height() / 2 ) + desk.top(), width(), height() ); @@ -36,7 +36,7 @@ KStartupLogo::KStartupLogo( QWidget * parent, const char *name ) : QWidget( pare KStartupLogo::~KStartupLogo() {} -void KStartupLogo::mousePressEvent( QMouseEvent* ) +void KStartupLogo::mousePressEvent( TQMouseEvent* ) { if ( m_bReadyToHide ) { hide(); @@ -46,16 +46,16 @@ void KStartupLogo::mousePressEvent( QMouseEvent* ) /** This function is based on KDE's KGlobalSettings::splashScreenDesktopGeometry(), * which is not available in KDE 3.1. */ -QRect KStartupLogo::splashScreenDesktopGeometry() const +TQRect KStartupLogo::splashScreenDesktopGeometry() const { - QDesktopWidget *dw = QApplication::desktop(); + TQDesktopWidget *dw = TQApplication::desktop(); if (dw->isVirtualDesktop()) { KConfigGroup group(KGlobal::config(), "Windows"); int scr = group.readNumEntry("Unmanaged", -3); if (group.readBoolEntry("XineramaEnabled", true) && scr != -2) { if (scr == -3) - scr = dw->screenNumber(QCursor::pos()); + scr = dw->screenNumber(TQCursor::pos()); return dw->screenGeometry(scr); } else { diff --git a/krecipes/src/kstartuplogo.h b/krecipes/src/kstartuplogo.h index fe00118..46692c3 100755 --- a/krecipes/src/kstartuplogo.h +++ b/krecipes/src/kstartuplogo.h @@ -17,7 +17,7 @@ #ifndef KSTARTUPLOGO_H #define KSTARTUPLOGO_H -#include +#include #include #include @@ -25,19 +25,19 @@ /** * Displays a startup splash screen */ -class KStartupLogo : public QWidget +class KStartupLogo : public TQWidget { Q_OBJECT public: - KStartupLogo( QWidget *parent = 0, const char *name = 0 ); + KStartupLogo( TQWidget *parent = 0, const char *name = 0 ); ~KStartupLogo(); void setHideEnabled( bool bEnabled ) { m_bReadyToHide = bEnabled; }; protected: - virtual void mousePressEvent( QMouseEvent* ); - QRect splashScreenDesktopGeometry() const; + virtual void mousePressEvent( TQMouseEvent* ); + TQRect splashScreenDesktopGeometry() const; bool m_bReadyToHide; }; diff --git a/krecipes/src/main.cpp b/krecipes/src/main.cpp index be3505e..664a2ce 100644 --- a/krecipes/src/main.cpp +++ b/krecipes/src/main.cpp @@ -62,7 +62,7 @@ int main( int argc, char **argv ) // no session.. just start up normally KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QApplication::flushX(); + TQApplication::flushX(); if ( args->isSet("convert-sqlite3") ) { ConvertSQLite3(); diff --git a/krecipes/src/pref.cpp b/krecipes/src/pref.cpp index 329e0e9..218868c 100644 --- a/krecipes/src/pref.cpp +++ b/krecipes/src/pref.cpp @@ -18,17 +18,17 @@ #include "config.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -41,41 +41,41 @@ #include #include -KrecipesPreferences::KrecipesPreferences( QWidget *parent ) +KrecipesPreferences::KrecipesPreferences( TQWidget *parent ) : KDialogBase( IconList, i18n( "Krecipes Preferences" ), Help | Ok | Cancel, Ok, parent ) { // this is the base class for your preferences dialog. it is now // a TreeList dialog.. but there are a number of other // possibilities (including Tab, Swallow, and just Plain) - QFrame * frame; + TQFrame * frame; KConfig *config = KGlobal::config(); config->setGroup( "DBType" ); KIconLoader il; frame = addPage( i18n( "Server Settings" ), - QString( i18n( "Database Server Options (%1)" ) ).arg( config->readEntry( "Type" ) ), + TQString( i18n( "Database Server Options (%1)" ) ).arg( config->readEntry( "Type" ) ), il.loadIcon( "network_local", KIcon::NoGroup, 32 ) ); - QHBoxLayout* layout = new QHBoxLayout( frame ); + TQHBoxLayout* layout = new TQHBoxLayout( frame ); m_pageServer = new ServerPrefs( frame ); layout->addWidget( m_pageServer ); m_helpMap.insert(0,"configure-server-settings"); frame = addPage( i18n( "Formatting" ), i18n( "Customize Formatting" ), il.loadIcon( "math_frac", KIcon::NoGroup, 32 ) ); - QHBoxLayout* formatting_layout = new QHBoxLayout( frame ); + TQHBoxLayout* formatting_layout = new TQHBoxLayout( frame ); m_pageNumbers = new NumbersPrefs( frame ); formatting_layout->addWidget( m_pageNumbers ); m_helpMap.insert(1,"custom-formatting"); frame = addPage( i18n( "Import/Export" ), i18n( "Recipe Import and Export Options" ), il.loadIcon( "down", KIcon::NoGroup, 32 ) ); - QHBoxLayout* import_layout = new QHBoxLayout( frame ); + TQHBoxLayout* import_layout = new TQHBoxLayout( frame ); m_pageImport = new ImportPrefs( frame ); import_layout->addWidget( m_pageImport ); m_helpMap.insert(2,"import-export-preference"); frame = addPage( i18n( "Performance" ), i18n( "Performance Options" ), il.loadIcon( "launch", KIcon::NoGroup, 32 ) ); - QHBoxLayout* performance_layout = new QHBoxLayout( frame ); + TQHBoxLayout* performance_layout = new TQHBoxLayout( frame ); m_pagePerformance = new PerformancePrefs( frame ); performance_layout->addWidget( m_pagePerformance ); m_helpMap.insert(3,"configure-performance"); @@ -91,105 +91,105 @@ void KrecipesPreferences::slotHelp() } -MySQLServerPrefs::MySQLServerPrefs( QWidget *parent ) : QWidget( parent ) +MySQLServerPrefs::MySQLServerPrefs( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); layout->setSpacing( KDialog::spacingHint() ); layout->setMargin( 0 ); - QSpacerItem* spacerTop = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerTop = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerTop, 0, 1 ); - QSpacerItem* spacerLeft = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacerLeft = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacerLeft, 1, 0 ); - QLabel* serverText = new QLabel( i18n( "Server:" ), this ); - serverText->setFixedSize( QSize( 100, 20 ) ); - serverText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* serverText = new TQLabel( i18n( "Server:" ), this ); + serverText->setFixedSize( TQSize( 100, 20 ) ); + serverText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( serverText, 1, 1 ); serverEdit = new KLineEdit( this ); - serverEdit->setFixedSize( QSize( 120, 20 ) ); - serverEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + serverEdit->setFixedSize( TQSize( 120, 20 ) ); + serverEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( serverEdit, 1, 2 ); - QSpacerItem* spacerRow1 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow1 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow1, 2, 1 ); - QLabel* usernameText = new QLabel( i18n( "Username:" ), this ); - usernameText->setFixedSize( QSize( 100, 20 ) ); - usernameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* usernameText = new TQLabel( i18n( "Username:" ), this ); + usernameText->setFixedSize( TQSize( 100, 20 ) ); + usernameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( usernameText, 3, 1 ); usernameEdit = new KLineEdit( this ); - usernameEdit->setFixedSize( QSize( 120, 20 ) ); - usernameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + usernameEdit->setFixedSize( TQSize( 120, 20 ) ); + usernameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( usernameEdit, 3, 2 ); - QSpacerItem* spacerRow2 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow2 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow2, 4, 1 ); - QLabel* passwordText = new QLabel( i18n( "Password:" ), this ); - passwordText->setFixedSize( QSize( 100, 20 ) ); - passwordText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* passwordText = new TQLabel( i18n( "Password:" ), this ); + passwordText->setFixedSize( TQSize( 100, 20 ) ); + passwordText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( passwordText, 5, 1 ); passwordEdit = new KLineEdit( this ); - passwordEdit->setFixedSize( QSize( 120, 20 ) ); - passwordEdit->setEchoMode( QLineEdit::Password ); - passwordEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + passwordEdit->setFixedSize( TQSize( 120, 20 ) ); + passwordEdit->setEchoMode( TQLineEdit::Password ); + passwordEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( passwordEdit, 5, 2 ); - QSpacerItem* spacerRow3 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow3 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow3, 6, 1 ); - QLabel* portText = new QLabel( i18n( "Port:" ), this ); - portText->setFixedSize( QSize( 100, 20 ) ); - portText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* portText = new TQLabel( i18n( "Port:" ), this ); + portText->setFixedSize( TQSize( 100, 20 ) ); + portText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( portText, 7, 1 ); portEdit = new KIntNumInput( this ); portEdit->setMinValue(0); portEdit->setSpecialValueText( i18n("Default") ); - portEdit->setFixedSize( QSize( 120, 20 ) ); - portEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + portEdit->setFixedSize( TQSize( 120, 20 ) ); + portEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( portEdit, 7, 2 ); - QSpacerItem* spacerRow4 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow4 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow4, 8, 1 ); - QLabel* dbNameText = new QLabel( i18n( "Database name:" ), this ); - dbNameText->setFixedSize( QSize( 100, 20 ) ); - dbNameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* dbNameText = new TQLabel( i18n( "Database name:" ), this ); + dbNameText->setFixedSize( TQSize( 100, 20 ) ); + dbNameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( dbNameText, 9, 1 ); dbNameEdit = new KLineEdit( this ); - dbNameEdit->setFixedSize( QSize( 120, 20 ) ); - dbNameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + dbNameEdit->setFixedSize( TQSize( 120, 20 ) ); + dbNameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( dbNameEdit, 9, 2 ); - QSpacerItem* spacerRow5 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacerRow5 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( spacerRow5, 10, 1 ); // Backup options - QGroupBox *backupGBox = new QGroupBox( this, "backupGBox" ); + TQGroupBox *backupGBox = new TQGroupBox( this, "backupGBox" ); backupGBox->setTitle( i18n( "Backup" ) ); backupGBox->setColumns( 2 ); layout->addMultiCellWidget( backupGBox, 10, 10, 1, 4 ); - QLabel *dumpPathLabel = new QLabel( backupGBox ); - dumpPathLabel->setText( QString(i18n( "Path to '%1':" )).arg("mysqldump") ); + TQLabel *dumpPathLabel = new TQLabel( backupGBox ); + dumpPathLabel->setText( TQString(i18n( "Path to '%1':" )).arg("mysqldump") ); dumpPathRequester = new KURLRequester( backupGBox ); dumpPathRequester->setFilter( "mysqldump" ); - QLabel *mysqlPathLabel = new QLabel( backupGBox ); - mysqlPathLabel->setText( QString(i18n( "Path to '%1':" )).arg("mysql") ); + TQLabel *mysqlPathLabel = new TQLabel( backupGBox ); + mysqlPathLabel->setText( TQString(i18n( "Path to '%1':" )).arg("mysql") ); mysqlPathRequester = new KURLRequester( backupGBox ); mysqlPathRequester->setFilter( "mysql" ); - QSpacerItem* spacerRow6 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacerRow6 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( spacerRow6, 11, 1 ); - QSpacerItem* spacerRight = new QSpacerItem( 10, 10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); + TQSpacerItem* spacerRight = new TQSpacerItem( 10, 10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ); layout->addItem( spacerRight, 1, 4 ); // Load & Save Current Settings @@ -218,105 +218,105 @@ void MySQLServerPrefs::saveOptions( void ) } -PostgreSQLServerPrefs::PostgreSQLServerPrefs( QWidget *parent ) : QWidget( parent ) +PostgreSQLServerPrefs::PostgreSQLServerPrefs( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); layout->setSpacing( KDialog::spacingHint() ); layout->setMargin( 0 ); - QSpacerItem* spacerTop = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerTop = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerTop, 0, 1 ); - QSpacerItem* spacerLeft = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacerLeft = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacerLeft, 1, 0 ); - QLabel* serverText = new QLabel( i18n( "Server:" ), this ); - serverText->setFixedSize( QSize( 100, 20 ) ); - serverText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* serverText = new TQLabel( i18n( "Server:" ), this ); + serverText->setFixedSize( TQSize( 100, 20 ) ); + serverText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( serverText, 1, 1 ); serverEdit = new KLineEdit( this ); - serverEdit->setFixedSize( QSize( 120, 20 ) ); - serverEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + serverEdit->setFixedSize( TQSize( 120, 20 ) ); + serverEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( serverEdit, 1, 2 ); - QSpacerItem* spacerRow1 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow1 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow1, 2, 1 ); - QLabel* usernameText = new QLabel( i18n( "Username:" ), this ); - usernameText->setFixedSize( QSize( 100, 20 ) ); - usernameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* usernameText = new TQLabel( i18n( "Username:" ), this ); + usernameText->setFixedSize( TQSize( 100, 20 ) ); + usernameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( usernameText, 3, 1 ); usernameEdit = new KLineEdit( this ); - usernameEdit->setFixedSize( QSize( 120, 20 ) ); - usernameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + usernameEdit->setFixedSize( TQSize( 120, 20 ) ); + usernameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( usernameEdit, 3, 2 ); - QSpacerItem* spacerRow2 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow2 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow2, 4, 1 ); - QLabel* passwordText = new QLabel( i18n( "Password:" ), this ); - passwordText->setFixedSize( QSize( 100, 20 ) ); - passwordText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* passwordText = new TQLabel( i18n( "Password:" ), this ); + passwordText->setFixedSize( TQSize( 100, 20 ) ); + passwordText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( passwordText, 5, 1 ); passwordEdit = new KLineEdit( this ); - passwordEdit->setFixedSize( QSize( 120, 20 ) ); - passwordEdit->setEchoMode( QLineEdit::Password ); - passwordEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + passwordEdit->setFixedSize( TQSize( 120, 20 ) ); + passwordEdit->setEchoMode( TQLineEdit::Password ); + passwordEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( passwordEdit, 5, 2 ); - QSpacerItem* spacerRow3 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow3 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow3, 6, 1 ); - QLabel* portText = new QLabel( i18n( "Port:" ), this ); - portText->setFixedSize( QSize( 100, 20 ) ); - portText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* portText = new TQLabel( i18n( "Port:" ), this ); + portText->setFixedSize( TQSize( 100, 20 ) ); + portText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( portText, 7, 1 ); portEdit = new KIntNumInput( this ); portEdit->setMinValue(0); portEdit->setSpecialValueText( i18n("Default") ); - portEdit->setFixedSize( QSize( 120, 20 ) ); - portEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + portEdit->setFixedSize( TQSize( 120, 20 ) ); + portEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( portEdit, 7, 2 ); - QSpacerItem* spacerRow4 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerRow4 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerRow4, 8, 1 ); - QLabel* dbNameText = new QLabel( i18n( "Database name:" ), this ); - dbNameText->setFixedSize( QSize( 100, 20 ) ); - dbNameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* dbNameText = new TQLabel( i18n( "Database name:" ), this ); + dbNameText->setFixedSize( TQSize( 100, 20 ) ); + dbNameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( dbNameText, 9, 1 ); dbNameEdit = new KLineEdit( this ); - dbNameEdit->setFixedSize( QSize( 120, 20 ) ); - dbNameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + dbNameEdit->setFixedSize( TQSize( 120, 20 ) ); + dbNameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); layout->addWidget( dbNameEdit, 9, 2 ); - QSpacerItem* spacerRow5 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacerRow5 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( spacerRow5, 10, 1 ); // Backup options - QGroupBox *backupGBox = new QGroupBox( this, "backupGBox" ); + TQGroupBox *backupGBox = new TQGroupBox( this, "backupGBox" ); backupGBox->setTitle( i18n( "Backup" ) ); backupGBox->setColumns( 2 ); layout->addMultiCellWidget( backupGBox, 10, 10, 1, 4 ); - QLabel *dumpPathLabel = new QLabel( backupGBox ); - dumpPathLabel->setText( QString(i18n( "Path to '%1':" )).arg("pg_dump") ); + TQLabel *dumpPathLabel = new TQLabel( backupGBox ); + dumpPathLabel->setText( TQString(i18n( "Path to '%1':" )).arg("pg_dump") ); dumpPathRequester = new KURLRequester( backupGBox ); dumpPathRequester->setFilter( "pg_dump" ); - QLabel *psqlPathLabel = new QLabel( backupGBox ); - psqlPathLabel->setText( QString(i18n( "Path to '%1':" )).arg("psql") ); + TQLabel *psqlPathLabel = new TQLabel( backupGBox ); + psqlPathLabel->setText( TQString(i18n( "Path to '%1':" )).arg("psql") ); psqlPathRequester = new KURLRequester( backupGBox ); psqlPathRequester->setFilter( "psql" ); - QSpacerItem* spacerRow6 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacerRow6 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( spacerRow6, 11, 1 ); - QSpacerItem* spacerRight = new QSpacerItem( 10, 10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); + TQSpacerItem* spacerRight = new TQSpacerItem( 10, 10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ); layout->addItem( spacerRight, 1, 4 ); // Load & Save Current Settings @@ -346,22 +346,22 @@ void PostgreSQLServerPrefs::saveOptions( void ) -SQLiteServerPrefs::SQLiteServerPrefs( QWidget *parent ) : QWidget( parent ) +SQLiteServerPrefs::SQLiteServerPrefs( TQWidget *parent ) : TQWidget( parent ) { - QVBoxLayout * Form1Layout = new QVBoxLayout( this ); + TQVBoxLayout * Form1Layout = new TQVBoxLayout( this ); - QHBox *hbox = new QHBox( this ); - ( void ) new QLabel( i18n( "Database file:" ), hbox ); + TQHBox *hbox = new TQHBox( this ); + ( void ) new TQLabel( i18n( "Database file:" ), hbox ); fileRequester = new KURLRequester( hbox ); hbox->setStretchFactor( fileRequester, 2 ); Form1Layout->addWidget( hbox ); - QSpacerItem* spacerRow5 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacerRow5 = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); Form1Layout->addItem( spacerRow5 ); - QString sqliteBinary; + TQString sqliteBinary; #if HAVE_SQLITE3 sqliteBinary = "sqlite3"; #elif HAVE_SQLITE @@ -369,13 +369,13 @@ SQLiteServerPrefs::SQLiteServerPrefs( QWidget *parent ) : QWidget( parent ) #endif // Backup options - QGroupBox *backupGBox = new QGroupBox( this, "backupGBox" ); + TQGroupBox *backupGBox = new TQGroupBox( this, "backupGBox" ); backupGBox->setTitle( i18n( "Backup" ) ); backupGBox->setColumns( 2 ); Form1Layout->addWidget( backupGBox ); - QLabel *dumpPathLabel = new QLabel( backupGBox ); - dumpPathLabel->setText( QString(i18n( "Path to '%1':" )).arg(sqliteBinary) ); + TQLabel *dumpPathLabel = new TQLabel( backupGBox ); + dumpPathLabel->setText( TQString(i18n( "Path to '%1':" )).arg(sqliteBinary) ); dumpPathRequester = new KURLRequester( backupGBox ); dumpPathRequester->setFilter( sqliteBinary ); @@ -396,14 +396,14 @@ void SQLiteServerPrefs::saveOptions( void ) // Server Setttings Dialog -ServerPrefs::ServerPrefs( QWidget *parent ) - : QWidget( parent ) +ServerPrefs::ServerPrefs( TQWidget *parent ) + : TQWidget( parent ) { - QVBoxLayout * Form1Layout = new QVBoxLayout( this, 11, 6 ); + TQVBoxLayout * Form1Layout = new TQVBoxLayout( this, 11, 6 ); KConfig *config = kapp->config(); config->setGroup( "DBType" ); - QString DBtype = config->readEntry( "Type" ); + TQString DBtype = config->readEntry( "Type" ); if ( DBtype == "MySQL" ) serverWidget = new MySQLServerPrefs( this ); else if ( DBtype == "PostgreSQL" ) @@ -411,16 +411,16 @@ ServerPrefs::ServerPrefs( QWidget *parent ) else serverWidget = new SQLiteServerPrefs( this ); - serverWidget->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); + serverWidget->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); Form1Layout->addWidget( serverWidget ); - Form1Layout->addItem( new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + Form1Layout->addItem( new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); - wizard_button = new QCheckBox( i18n( "Re-run wizard on next startup" ), this ); - wizard_button->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); + wizard_button = new TQCheckBox( i18n( "Re-run wizard on next startup" ), this ); + wizard_button->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); Form1Layout->addWidget( wizard_button ); - QLabel *note = new QLabel( i18n( "Note: Krecipes must be restarted for most server preferences to take effect." ), this ); + TQLabel *note = new TQLabel( i18n( "Note: Krecipes must be restarted for most server preferences to take effect." ), this ); Form1Layout->addWidget( note ); adjustSize(); @@ -440,7 +440,7 @@ void ServerPrefs::saveOptions( void ) { KConfig * config = kapp->config(); config->setGroup( "DBType" ); - QString DBtype = config->readEntry( "Type" ); + TQString DBtype = config->readEntry( "Type" ); if ( DBtype == "MySQL" ) ( ( MySQLServerPrefs* ) serverWidget ) ->saveOptions(); else if ( DBtype == "PostgreSQL" ) @@ -455,23 +455,23 @@ void ServerPrefs::saveOptions( void ) } //=============Numbers Preferences Dialog================// -NumbersPrefs::NumbersPrefs( QWidget *parent ) - : QWidget( parent ) +NumbersPrefs::NumbersPrefs( TQWidget *parent ) + : TQWidget( parent ) { - Form1Layout = new QVBoxLayout( this, 11, 6 ); + Form1Layout = new TQVBoxLayout( this, 11, 6 ); - numberButtonGroup = new QButtonGroup( this ); - numberButtonGroup->setColumnLayout( 0, Qt::Vertical ); + numberButtonGroup = new TQButtonGroup( this ); + numberButtonGroup->setColumnLayout( 0, TQt::Vertical ); numberButtonGroup->layout() ->setSpacing( 6 ); numberButtonGroup->layout() ->setMargin( 11 ); - numberButtonGroup->resize( QSize() ); - numberButtonGroupLayout = new QVBoxLayout( numberButtonGroup->layout() ); - numberButtonGroupLayout->setAlignment( Qt::AlignTop ); + numberButtonGroup->resize( TQSize() ); + numberButtonGroupLayout = new TQVBoxLayout( numberButtonGroup->layout() ); + numberButtonGroupLayout->setAlignment( TQt::AlignTop ); - fractionRadioButton = new QRadioButton( numberButtonGroup ); + fractionRadioButton = new TQRadioButton( numberButtonGroup ); numberButtonGroupLayout->addWidget( fractionRadioButton ); - decimalRadioButton = new QRadioButton( numberButtonGroup ); + decimalRadioButton = new TQRadioButton( numberButtonGroup ); numberButtonGroupLayout->addWidget( decimalRadioButton ); Form1Layout->addWidget( numberButtonGroup ); @@ -479,12 +479,12 @@ NumbersPrefs::NumbersPrefs( QWidget *parent ) numberButtonGroup->insert( fractionRadioButton, 1 ); //ingredient display format - QGroupBox *ingredientGrpBox = new QGroupBox( 2, Qt::Vertical, i18n( "Ingredients" ), this ); + TQGroupBox *ingredientGrpBox = new TQGroupBox( 2, TQt::Vertical, i18n( "Ingredients" ), this ); - QHBox *ingredientBox = new QHBox( ingredientGrpBox ); - ( void ) new QLabel( i18n( "Ingredient Format:" ), ingredientBox ); + TQHBox *ingredientBox = new TQHBox( ingredientGrpBox ); + ( void ) new TQLabel( i18n( "Ingredient Format:" ), ingredientBox ); ingredientEdit = new KLineEdit( ingredientBox ); - ( void ) new QLabel( i18n( "%n: Name
    " + ( void ) new TQLabel( i18n( "%n: Name
    " "%p: Preparation method
    " "%a: Amount
    " "%u: Unit" @@ -493,13 +493,13 @@ NumbersPrefs::NumbersPrefs( QWidget *parent ) Form1Layout->addWidget( ingredientGrpBox ); //unit display format - QGroupBox *abbrevGrpBox = new QGroupBox( 1, Qt::Vertical, i18n( "Units" ), this ); - QHBox *abbrevBox = new QHBox( abbrevGrpBox ); - abbrevButton = new QCheckBox( i18n( "Use abbreviations" ), abbrevBox ); + TQGroupBox *abbrevGrpBox = new TQGroupBox( 1, TQt::Vertical, i18n( "Units" ), this ); + TQHBox *abbrevBox = new TQHBox( abbrevGrpBox ); + abbrevButton = new TQCheckBox( i18n( "Use abbreviations" ), abbrevBox ); Form1Layout->addWidget( abbrevGrpBox ); - Form1Layout->addItem( new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + Form1Layout->addItem( new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); adjustSize(); @@ -538,8 +538,8 @@ void NumbersPrefs::languageChange() } //=============Import/Export Preferences Dialog================// -ImportPrefs::ImportPrefs( QWidget *parent ) - : QWidget( parent ) +ImportPrefs::ImportPrefs( TQWidget *parent ) + : TQWidget( parent ) { // Load Current Settings KConfig * config = kapp->config(); @@ -548,27 +548,27 @@ ImportPrefs::ImportPrefs( QWidget *parent ) bool overwrite = config->readBoolEntry( "OverwriteExisting", false ); bool direct = config->readBoolEntry( "DirectImport", false ); - Form1Layout = new QVBoxLayout( this, 11, 6 ); + Form1Layout = new TQVBoxLayout( this, 11, 6 ); - QGroupBox *importGroup = new QGroupBox(2,Qt::Vertical,i18n("Import"), this); + TQGroupBox *importGroup = new TQGroupBox(2,TQt::Vertical,i18n("Import"), this); - overwriteCheckbox = new QCheckBox( i18n( "Overwrite recipes with same title" ), importGroup ); + overwriteCheckbox = new TQCheckBox( i18n( "Overwrite recipes with same title" ), importGroup ); overwriteCheckbox->setChecked( overwrite ); - overwriteCheckbox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); + overwriteCheckbox->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); - directImportCheckbox = new QCheckBox( i18n( "Ask which recipes to import" ), importGroup ); + directImportCheckbox = new TQCheckBox( i18n( "Ask which recipes to import" ), importGroup ); directImportCheckbox->setChecked( !direct ); - directImportCheckbox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); + directImportCheckbox->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); Form1Layout->addWidget(importGroup); - QGroupBox *exportGroup = new QGroupBox(1,Qt::Vertical,i18n("Export"), this); + TQGroupBox *exportGroup = new TQGroupBox(1,TQt::Vertical,i18n("Export"), this); - QHBox *clipboardHBox = new QHBox(exportGroup); + TQHBox *clipboardHBox = new TQHBox(exportGroup); clipboardHBox->setSpacing(6); - QLabel *clipboardLabel = new QLabel(i18n("'Copy to Clipboard' format:"),clipboardHBox); - clipBoardFormatComboBox = new QComboBox( clipboardHBox ); - clipBoardFormatComboBox->insertItem(QString("%3 (*.txt)").arg(i18n("Plain Text"))); + TQLabel *clipboardLabel = new TQLabel(i18n("'Copy to Clipboard' format:"),clipboardHBox); + clipBoardFormatComboBox = new TQComboBox( clipboardHBox ); + clipBoardFormatComboBox->insertItem(TQString("%3 (*.txt)").arg(i18n("Plain Text"))); clipBoardFormatComboBox->insertItem("Krecipes (*.kreml)"); clipBoardFormatComboBox->insertItem("Meal-Master (*.mmf)"); clipBoardFormatComboBox->insertItem("Rezkonv (*.rk)"); @@ -577,7 +577,7 @@ ImportPrefs::ImportPrefs( QWidget *parent ) clipboardHBox->setStretchFactor(clipBoardFormatComboBox,1); config->setGroup( "Export" ); - QString clipboardFormat = config->readEntry("ClipboardFormat"); + TQString clipboardFormat = config->readEntry("ClipboardFormat"); if ( clipboardFormat == "*.kreml" ) clipBoardFormatComboBox->setCurrentItem(1); else if ( clipboardFormat == "*.mmf" ) @@ -589,9 +589,9 @@ ImportPrefs::ImportPrefs( QWidget *parent ) Form1Layout->addWidget(exportGroup); - Form1Layout->addItem( new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + Form1Layout->addItem( new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); - QWhatsThis::add( directImportCheckbox, + TQWhatsThis::add( directImportCheckbox, i18n("When this is enabled, the importer will show every recipe in the file(s) and allow you to select which recipes you want imported.\n \ \ Disable this to always import every recipe, which allows for faster and less memory-intensive imports.") @@ -609,14 +609,14 @@ void ImportPrefs::saveOptions() config->writeEntry( "DirectImport", !directImportCheckbox->isChecked() ); config->setGroup( "Export" ); - QString ext = clipBoardFormatComboBox->currentText().mid(clipBoardFormatComboBox->currentText().find("(")+1,clipBoardFormatComboBox->currentText().length()-clipBoardFormatComboBox->currentText().find("(")-2); + TQString ext = clipBoardFormatComboBox->currentText().mid(clipBoardFormatComboBox->currentText().find("(")+1,clipBoardFormatComboBox->currentText().length()-clipBoardFormatComboBox->currentText().find("(")-2); config->writeEntry( "ClipboardFormat", ext ); } //=============Performance Options Dialog================// -PerformancePrefs::PerformancePrefs( QWidget *parent ) - : QWidget( parent ) +PerformancePrefs::PerformancePrefs( TQWidget *parent ) + : TQWidget( parent ) { // Load Current Settings KConfig * config = kapp->config(); @@ -625,15 +625,15 @@ PerformancePrefs::PerformancePrefs( QWidget *parent ) int cat_limit = config->readNumEntry( "CategoryLimit", -1 ); int limit = config->readNumEntry( "Limit", -1 ); - Form1Layout = new QVBoxLayout( this, 11, 6 ); + Form1Layout = new TQVBoxLayout( this, 11, 6 ); - searchAsYouTypeBox = new QCheckBox( i18n( "Search as you type" ), this ); + searchAsYouTypeBox = new TQCheckBox( i18n( "Search as you type" ), this ); searchAsYouTypeBox->setChecked( config->readBoolEntry( "SearchAsYouType", true ) ); - QLabel *explainationLabel = new QLabel( i18n("In most instances these options do not need to be changed. However, limiting the amount of items displayed at once will allow Krecipes to better perform when the database is loaded with many thousands of recipes."), this ); - explainationLabel->setTextFormat( Qt::RichText ); + TQLabel *explainationLabel = new TQLabel( i18n("In most instances these options do not need to be changed. However, limiting the amount of items displayed at once will allow Krecipes to better perform when the database is loaded with many thousands of recipes."), this ); + explainationLabel->setTextFormat( TQt::RichText ); - QHBox *catLimitHBox = new QHBox( this ); + TQHBox *catLimitHBox = new TQHBox( this ); catLimitInput = new KIntNumInput(catLimitHBox); catLimitInput->setLabel( i18n( "Number of categories to display at once:" ) ); catLimitInput->setRange(0,5000,20,true); @@ -642,7 +642,7 @@ PerformancePrefs::PerformancePrefs( QWidget *parent ) if ( cat_limit > 0 ) catLimitInput->setValue( cat_limit ); - QHBox *limitHBox = new QHBox( this ); + TQHBox *limitHBox = new TQHBox( this ); limitInput = new KIntNumInput(limitHBox); limitInput->setLabel( i18n( "Number of elements to display at once:" ) ); limitInput->setRange(0,100000,1000,true); @@ -656,7 +656,7 @@ PerformancePrefs::PerformancePrefs( QWidget *parent ) Form1Layout->addWidget( catLimitHBox ); Form1Layout->addWidget( limitHBox ); - Form1Layout->addItem( new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + Form1Layout->addItem( new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); adjustSize(); } diff --git a/krecipes/src/pref.h b/krecipes/src/pref.h index 7d464f6..46b4a7e 100644 --- a/krecipes/src/pref.h +++ b/krecipes/src/pref.h @@ -17,7 +17,7 @@ #include -#include +#include class ServerPrefs; class NumbersPrefs; @@ -28,17 +28,17 @@ class KIntNumInput; class KLineEdit; class KURLRequester; -class QButtonGroup; -class QCheckBox; -class QRadioButton; -class QVBoxLayout; -class QComboBox; +class TQButtonGroup; +class TQCheckBox; +class TQRadioButton; +class TQVBoxLayout; +class TQComboBox; class KrecipesPreferences : public KDialogBase { Q_OBJECT public: - KrecipesPreferences( QWidget *parent ); + KrecipesPreferences( TQWidget *parent ); protected slots: void slotHelp(); @@ -49,17 +49,17 @@ private: ImportPrefs *m_pageImport; PerformancePrefs *m_pagePerformance; - QMap m_helpMap; + TQMap m_helpMap; private slots: void saveSettings( void ); }; -class MySQLServerPrefs : public QWidget +class MySQLServerPrefs : public TQWidget { public: - MySQLServerPrefs( QWidget *parent ); + MySQLServerPrefs( TQWidget *parent ); void saveOptions( void ); private: @@ -74,10 +74,10 @@ private: KIntNumInput *portEdit; }; -class PostgreSQLServerPrefs : public QWidget +class PostgreSQLServerPrefs : public TQWidget { public: - PostgreSQLServerPrefs( QWidget *parent ); + PostgreSQLServerPrefs( TQWidget *parent ); void saveOptions( void ); private: @@ -92,12 +92,12 @@ private: KIntNumInput *portEdit; }; -class SQLiteServerPrefs : public QWidget +class SQLiteServerPrefs : public TQWidget { Q_OBJECT public: - SQLiteServerPrefs( QWidget *parent ); + SQLiteServerPrefs( TQWidget *parent ); void saveOptions( void ); @@ -108,73 +108,73 @@ private: }; -class ServerPrefs : public QWidget +class ServerPrefs : public TQWidget { Q_OBJECT public: - ServerPrefs( QWidget *parent = 0 ); + ServerPrefs( TQWidget *parent = 0 ); // Public Methods void saveOptions( void ); private: - QWidget *serverWidget; - QCheckBox *wizard_button; + TQWidget *serverWidget; + TQCheckBox *wizard_button; }; -class NumbersPrefs : public QWidget +class NumbersPrefs : public TQWidget { Q_OBJECT public: - NumbersPrefs( QWidget *parent = 0 ); + NumbersPrefs( TQWidget *parent = 0 ); void saveOptions(); protected: - QButtonGroup* numberButtonGroup; - QRadioButton* fractionRadioButton; - QRadioButton* decimalRadioButton; + TQButtonGroup* numberButtonGroup; + TQRadioButton* fractionRadioButton; + TQRadioButton* decimalRadioButton; - QVBoxLayout* Form1Layout; - QVBoxLayout* numberButtonGroupLayout; + TQVBoxLayout* Form1Layout; + TQVBoxLayout* numberButtonGroupLayout; KLineEdit *ingredientEdit; - QCheckBox *abbrevButton; + TQCheckBox *abbrevButton; protected slots: virtual void languageChange(); }; -class ImportPrefs : public QWidget +class ImportPrefs : public TQWidget { Q_OBJECT public: - ImportPrefs( QWidget *parent = 0 ); + ImportPrefs( TQWidget *parent = 0 ); void saveOptions(); protected: - QVBoxLayout* Form1Layout; - QCheckBox* overwriteCheckbox; - QCheckBox* directImportCheckbox; + TQVBoxLayout* Form1Layout; + TQCheckBox* overwriteCheckbox; + TQCheckBox* directImportCheckbox; - QComboBox *clipBoardFormatComboBox; + TQComboBox *clipBoardFormatComboBox; }; -class PerformancePrefs : public QWidget +class PerformancePrefs : public TQWidget { Q_OBJECT public: - PerformancePrefs( QWidget *parent = 0 ); + PerformancePrefs( TQWidget *parent = 0 ); void saveOptions(); protected: - QVBoxLayout* Form1Layout; - QCheckBox* searchAsYouTypeBox; + TQVBoxLayout* Form1Layout; + TQCheckBox* searchAsYouTypeBox; KIntNumInput* catLimitInput; KIntNumInput* limitInput; }; diff --git a/krecipes/src/profiling.h b/krecipes/src/profiling.h index d12ca4d..42f7769 100644 --- a/krecipes/src/profiling.h +++ b/krecipes/src/profiling.h @@ -18,9 +18,9 @@ #define KRECIPES_PROFILING #ifdef KRECIPES_PROFILING - #include + #include #include - static QTime dbg_timer; + static TQTime dbg_timer; #define START_TIMER(MSG) \ dbg_timer.start(); kdDebug()< ratioCache; //unit->ratio + TQMap ratioCache; //unit->ratio IngredientPropertyList::const_iterator prop_it; for ( prop_it = ingPropertyList.begin(); prop_it != ingPropertyList.end(); ++prop_it ) { @@ -76,7 +76,7 @@ void addPropertyToList( RecipeDB *database, IngredientPropertyList *recipeProper Ingredient result; bool converted; - QMap::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); + TQMap::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); if ( cache_it == ratioCache.end() ) { RecipeDB::ConversionStatus status = database->convertIngredientUnits( ing, (*prop_it).perUnit, result ); converted = status == RecipeDB::Success || status == RecipeDB::MismatchedPrepMethodUsingApprox; @@ -101,12 +101,12 @@ void addPropertyToList( RecipeDB *database, IngredientPropertyList *recipeProper property.id = (*prop_it).id; property.name = (*prop_it).name; property.perUnit.id = -1; // It's not per unit, it's total sum of the recipe - property.perUnit.name = QString::null; // " + property.perUnit.name = TQString::null; // " property.units = (*prop_it).units; Ingredient result; bool converted; - QMap::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); + TQMap::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); if ( cache_it == ratioCache.end() ) { RecipeDB::ConversionStatus status = database->convertIngredientUnits( ing, (*prop_it).perUnit, result ); converted = status == RecipeDB::Success || status == RecipeDB::MismatchedPrepMethodUsingApprox; diff --git a/krecipes/src/recipeactionshandler.cpp b/krecipes/src/recipeactionshandler.cpp index 112b423..a1840d1 100644 --- a/krecipes/src/recipeactionshandler.cpp +++ b/krecipes/src/recipeactionshandler.cpp @@ -12,8 +12,8 @@ #include "recipeactionshandler.h" -#include -#include +#include +#include #include #include @@ -40,7 +40,7 @@ #include "backends/recipedb.h" -RecipeActionsHandler::RecipeActionsHandler( KListView *_parentListView, RecipeDB *db, int actions ) : QObject( _parentListView ), +RecipeActionsHandler::RecipeActionsHandler( KListView *_parentListView, RecipeDB *db, int actions ) : TQObject( _parentListView ), parentListView( _parentListView ), database( db ) { @@ -80,11 +80,11 @@ RecipeActionsHandler::RecipeActionsHandler( KListView *_parentListView, RecipeDB delete il; - connect( parentListView, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( parentListView, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), SLOT( open() ) ); + connect( parentListView, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( parentListView, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), SLOT( open() ) ); } -void RecipeActionsHandler::exec( ItemType type, const QPoint &p ) +void RecipeActionsHandler::exec( ItemType type, const TQPoint &p ) { if ( type == Recipe ) { if ( kpop->idAt( 0 ) != -1 ) @@ -96,9 +96,9 @@ void RecipeActionsHandler::exec( ItemType type, const QPoint &p ) } } -void RecipeActionsHandler::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void RecipeActionsHandler::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { - if ( i ) { // Check if the QListViewItem actually exists + if ( i ) { // Check if the TQListViewItem actually exists if ( i->rtti() == 1000 ) { kpop->setItemVisible( categorize_item, i->parent() && i->parent()->rtti() == 1006 ); kpop->setItemVisible( remove_from_cat_item, i->parent() && i->parent()->rtti() == 1001 ); @@ -109,12 +109,12 @@ void RecipeActionsHandler::showPopup( KListView * /*l*/, QListViewItem *i, const } } -QValueList RecipeActionsHandler::recipeIDs( const QPtrList &items ) const +TQValueList RecipeActionsHandler::recipeIDs( const TQPtrList &items ) const { - QValueList ids; + TQValueList ids; - QPtrListIterator it(items); - QListViewItem *item; + TQPtrListIterator it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->rtti() == 1000 ) { //RecipeListItem RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -139,9 +139,9 @@ QValueList RecipeActionsHandler::recipeIDs( const QPtrList & void RecipeActionsHandler::open() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList ids = recipeIDs(items); + TQValueList ids = recipeIDs(items); if ( ids.count() == 1 ) emit recipeSelected(ids.first(),0); else if ( ids.count() > 0 ) @@ -149,11 +149,11 @@ void RecipeActionsHandler::open() #if 0 else if ( it->rtti() == 1001 && it->firstChild() ) //CategoryListItem and not empty { - QValueList ids; + TQValueList ids; //do this to only iterate over children of 'it' - QListViewItem *pEndItem = NULL; - QListViewItem *pStartItem = it; + TQListViewItem *pEndItem = NULL; + TQListViewItem *pStartItem = it; do { if ( pStartItem->nextSibling() ) @@ -163,7 +163,7 @@ void RecipeActionsHandler::open() } while ( pStartItem && !pEndItem ); - QListViewItemIterator iterator( it ); + TQListViewItemIterator iterator( it ); while ( iterator.current() != pEndItem ) { if ( iterator.current() ->rtti() == 1000 ) { @@ -182,16 +182,16 @@ void RecipeActionsHandler::open() void RecipeActionsHandler::categorize() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { ElementList categoryList; SelectCategoriesDialog *editCategoriesDialog = new SelectCategoriesDialog( parentListView, categoryList, database ); - if ( editCategoriesDialog->exec() == QDialog::Accepted ) { // user presses Ok + if ( editCategoriesDialog->exec() == TQDialog::Accepted ) { // user presses Ok editCategoriesDialog->getSelectedCategories( &categoryList ); // get the category list chosen - QPtrListIterator it(items); - QListViewItem *item; + TQPtrListIterator it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->parent() != 0 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -209,7 +209,7 @@ void RecipeActionsHandler::categorize() void RecipeActionsHandler::edit() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 1 ) KMessageBox::sorry( kapp->mainWidget(), i18n("Please select only one recipe."), i18n("Edit Recipe") ); else if ( items.count() == 1 && items.at(0)->rtti() == 1000 ) { @@ -222,11 +222,11 @@ void RecipeActionsHandler::edit() void RecipeActionsHandler::recipeExport() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList ids = recipeIDs( items ); + TQValueList ids = recipeIDs( items ); - QString title; + TQString title; if ( items.count() == 1 && items.at(0)->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) items.at(0); title = recipe_it->title(); @@ -238,7 +238,7 @@ void RecipeActionsHandler::recipeExport() } else //if nothing selected, export all visible recipes { - QValueList ids = getAllVisibleItems(); + TQValueList ids = getAllVisibleItems(); if ( ids.count() > 0 ) { switch ( KMessageBox::questionYesNo( kapp->mainWidget(), i18n("No recipes are currently selected.\nWould you like to export all recipes in the current view?")) ) { @@ -255,10 +255,10 @@ void RecipeActionsHandler::recipeExport() void RecipeActionsHandler::removeFromCategory() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator it(items); - QListViewItem *item; + TQPtrListIterator it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->parent() != 0 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -274,10 +274,10 @@ void RecipeActionsHandler::removeFromCategory() void RecipeActionsHandler::remove() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator it(items); - QListViewItem *item; + TQPtrListIterator it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->rtti() == RECIPELISTITEM_RTTI ) { RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -290,10 +290,10 @@ void RecipeActionsHandler::remove() void RecipeActionsHandler::addToShoppingList() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator it(items); - QListViewItem *item; + TQPtrListIterator it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->parent() != 0 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -306,9 +306,9 @@ void RecipeActionsHandler::addToShoppingList() void RecipeActionsHandler::expandAll() { - QListViewItemIterator it( parentListView ); + TQListViewItemIterator it( parentListView ); while ( it.current() ) { - QListViewItem * item = it.current(); + TQListViewItem * item = it.current(); item->setOpen( true ); ++it; } @@ -316,26 +316,26 @@ void RecipeActionsHandler::expandAll() void RecipeActionsHandler::collapseAll() { - QListViewItemIterator it( parentListView ); + TQListViewItemIterator it( parentListView ); while ( it.current() ) { - QListViewItem * item = it.current(); + TQListViewItem * item = it.current(); item->setOpen( false ); ++it; } } -void RecipeActionsHandler::exportRecipe( int id, const QString & caption, const QString &selection, RecipeDB *db ) +void RecipeActionsHandler::exportRecipe( int id, const TQString & caption, const TQString &selection, RecipeDB *db ) { - QValueList ids; + TQValueList ids; ids.append( id ); exportRecipes( ids, caption, selection, db ); } -void RecipeActionsHandler::exportRecipes( const QValueList &ids, const QString & caption, const QString &selection, RecipeDB *database ) +void RecipeActionsHandler::exportRecipes( const TQValueList &ids, const TQString & caption, const TQString &selection, RecipeDB *database ) { - KFileDialog * fd = new KFileDialog( QString::null, - QString( "*.kre|%1 (*.kre)\n" + KFileDialog * fd = new KFileDialog( TQString::null, + TQString( "*.kre|%1 (*.kre)\n" "*.kreml|Krecipes (*.kreml)\n" "*.txt|%3 (*.txt)\n" //"*.cml|CookML (*.cml)\n" @@ -351,7 +351,7 @@ void RecipeActionsHandler::exportRecipes( const QValueList &ids, const QStr fd->setSelection( selection ); fd->setMode( KFile::File | KFile::Directory ); if ( fd->exec() == KFileDialog::Accepted ) { - QString fileName = fd->selectedFile(); + TQString fileName = fd->selectedFile(); if ( !fileName.isNull() ) { BaseExporter * exporter; if ( fd->currentFilter() == "*.xml" ) @@ -379,12 +379,12 @@ void RecipeActionsHandler::exportRecipes( const QValueList &ids, const QStr } int overwrite = -1; - if ( QFile::exists( exporter->fileName() ) ) { - overwrite = KMessageBox::warningYesNo( 0, QString( i18n( "File \"%1\" exists. Are you sure you want to overwrite it?" ) ).arg( exporter->fileName() ), i18n( "Saving recipe" ) ); + if ( TQFile::exists( exporter->fileName() ) ) { + overwrite = KMessageBox::warningYesNo( 0, TQString( i18n( "File \"%1\" exists. Are you sure you want to overwrite it?" ) ).arg( exporter->fileName() ), i18n( "Saving recipe" ) ); } if ( overwrite == KMessageBox::Yes || overwrite == -1 ) { - KProgressDialog progress_dialog( 0, "export_progress_dialog", QString::null, i18n( "Saving recipes..." ) ); + KProgressDialog progress_dialog( 0, "export_progress_dialog", TQString::null, i18n( "Saving recipes..." ) ); exporter->exporter( ids, database, &progress_dialog ); } delete exporter; @@ -393,56 +393,56 @@ void RecipeActionsHandler::exportRecipes( const QValueList &ids, const QStr delete fd; } -void RecipeActionsHandler::recipesToClipboard( const QValueList &ids, RecipeDB *db ) +void RecipeActionsHandler::recipesToClipboard( const TQValueList &ids, RecipeDB *db ) { KConfig *config = KGlobal::config(); config->setGroup("Export"); - QString formatFilter = config->readEntry("ClipboardFormat"); + TQString formatFilter = config->readEntry("ClipboardFormat"); BaseExporter * exporter; if ( formatFilter == "*.xml" ) - exporter = new RecipeMLExporter( QString::null, formatFilter ); + exporter = new RecipeMLExporter( TQString::null, formatFilter ); else if ( formatFilter == "*.mmf" ) - exporter = new MMFExporter( QString::null, formatFilter ); + exporter = new MMFExporter( TQString::null, formatFilter ); else if ( formatFilter == "*.cml" ) - exporter = new CookMLExporter( QString::null, formatFilter ); + exporter = new CookMLExporter( TQString::null, formatFilter ); else if ( formatFilter == "*.rk" ) - exporter = new RezkonvExporter( QString::null, formatFilter ); + exporter = new RezkonvExporter( TQString::null, formatFilter ); else if ( formatFilter == "*.kre" || formatFilter == "*.kreml" ) { CategoryTree *cat_structure = new CategoryTree; db->loadCategories( cat_structure ); - exporter = new KreExporter( cat_structure, QString::null, formatFilter ); + exporter = new KreExporter( cat_structure, TQString::null, formatFilter ); } else //default to plain text - exporter = new PlainTextExporter( QString::null, "*.txt" ); + exporter = new PlainTextExporter( TQString::null, "*.txt" ); RecipeList recipeList; db->loadRecipes( &recipeList, exporter->supportedItems(), ids ); - QString buffer; - QTextStream stream(buffer,IO_WriteOnly); + TQString buffer; + TQTextStream stream(buffer,IO_WriteOnly); exporter->writeStream(stream,recipeList); delete exporter; - QApplication::clipboard()->setText(buffer); + TQApplication::clipboard()->setText(buffer); } void RecipeActionsHandler::recipesToClipboard() { - QPtrList items = parentListView->selectedItems(); + TQPtrList items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList ids = recipeIDs( items ); + TQValueList ids = recipeIDs( items ); recipesToClipboard(ids,database); } } -QValueList RecipeActionsHandler::getAllVisibleItems() +TQValueList RecipeActionsHandler::getAllVisibleItems() { - QValueList ids; + TQValueList ids; - QListViewItemIterator iterator( parentListView ); + TQListViewItemIterator iterator( parentListView ); while ( iterator.current() ) { if ( iterator.current() ->isVisible() ) { if ( iterator.current() ->rtti() == RECIPELISTITEM_RTTI ) { diff --git a/krecipes/src/recipeactionshandler.h b/krecipes/src/recipeactionshandler.h index eefa9bb..6e5737f 100644 --- a/krecipes/src/recipeactionshandler.h +++ b/krecipes/src/recipeactionshandler.h @@ -13,11 +13,11 @@ #ifndef RECIPEACTIONSHANDLER_H #define RECIPEACTIONSHANDLER_H -#include -#include -#include +#include +#include +#include -class QListViewItem; +class TQListViewItem; class KListView; class KPopupMenu; class RecipeDB; @@ -30,7 +30,7 @@ class RecipeDB; * * @author Jason Kivlighn */ -class RecipeActionsHandler : public QObject +class RecipeActionsHandler : public TQObject { Q_OBJECT @@ -54,17 +54,17 @@ public: ~RecipeActionsHandler() {} - static void exportRecipes( const QValueList &ids, const QString & caption, const QString &selection, RecipeDB *db ); - static void exportRecipe( int id, const QString & caption, const QString &selection, RecipeDB *db ); - static void recipesToClipboard( const QValueList &ids, RecipeDB *db ); + static void exportRecipes( const TQValueList &ids, const TQString & caption, const TQString &selection, RecipeDB *db ); + static void exportRecipe( int id, const TQString & caption, const TQString &selection, RecipeDB *db ); + static void recipesToClipboard( const TQValueList &ids, RecipeDB *db ); signals: void recipeSelected( int id, int action ); - void recipesSelected( const QValueList &ids, int action ); + void recipesSelected( const TQValueList &ids, int action ); public slots: - void exec( ItemType type, const QPoint &p ); - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void exec( ItemType type, const TQPoint &p ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void categorize(); @@ -111,8 +111,8 @@ private: int remove_from_cat_item; int categorize_item; - QValueList getAllVisibleItems(); - QValueList recipeIDs( const QPtrList &items ) const; + TQValueList getAllVisibleItems(); + TQValueList recipeIDs( const TQPtrList &items ) const; }; #endif //RECIPEACTIONSHANDLER_H diff --git a/krecipes/src/recipefilter.cpp b/krecipes/src/recipefilter.cpp index f350edd..9958e67 100644 --- a/krecipes/src/recipefilter.cpp +++ b/krecipes/src/recipefilter.cpp @@ -15,17 +15,17 @@ #include "widgets/recipelistview.h" -RecipeFilter::RecipeFilter( KListView *klv ) : QObject( klv ), +RecipeFilter::RecipeFilter( KListView *klv ) : TQObject( klv ), listview( klv ), currentCategory( 0 ) {} -void RecipeFilter::filter( const QString &s ) +void RecipeFilter::filter( const TQString &s ) { //do this to only iterate over children of 'currentCategory' - QListViewItem * pEndItem = NULL; + TQListViewItem * pEndItem = NULL; if ( currentCategory ) { - QListViewItem * pStartItem = currentCategory; + TQListViewItem * pStartItem = currentCategory; do { if ( pStartItem->nextSibling() ) pEndItem = pStartItem->nextSibling(); @@ -36,11 +36,11 @@ void RecipeFilter::filter( const QString &s ) } //Re-show everything - QListViewItemIterator list_it; + TQListViewItemIterator list_it; if ( currentCategory ) - list_it = QListViewItemIterator( currentCategory ); + list_it = TQListViewItemIterator( currentCategory ); else - list_it = QListViewItemIterator( listview ); + list_it = TQListViewItemIterator( listview ); while ( list_it.current() != pEndItem ) { list_it.current() ->setVisible( true ); list_it++; @@ -48,8 +48,8 @@ void RecipeFilter::filter( const QString &s ) // Only filter if the filter text isn't empty if ( !s.isEmpty() ) { - QListViewItemIterator list_it( listview ); - while ( QListViewItem * it = list_it.current() ) { + TQListViewItemIterator list_it( listview ); + while ( TQListViewItem * it = list_it.current() ) { if ( it->rtti() == 1000 ) // Its a recipe { RecipeListItem * recipe_it = ( RecipeListItem* ) it; @@ -82,8 +82,8 @@ void RecipeFilter::filterCategory( int categoryID ) if ( categoryID == -1 ) currentCategory = 0; else { - QListViewItemIterator list_it( listview ); - while ( QListViewItem * it = list_it.current() ) { + TQListViewItemIterator list_it( listview ); + while ( TQListViewItem * it = list_it.current() ) { if ( it->rtti() == 1001 ) { CategoryListItem * cat_it = ( CategoryListItem* ) it; if ( cat_it->categoryId() == categoryID ) { @@ -96,8 +96,8 @@ void RecipeFilter::filterCategory( int categoryID ) } } - QListViewItemIterator list_it( listview ); - while ( QListViewItem * it = list_it.current() ) { + TQListViewItemIterator list_it( listview ); + while ( TQListViewItem * it = list_it.current() ) { if ( categoryID == -1 ) it->setVisible( true ); // We're not filtering categories else if ( it == currentCategory || isParentOf( it, currentCategory ) || isParentOf( currentCategory, it ) ) @@ -112,9 +112,9 @@ void RecipeFilter::filterCategory( int categoryID ) currentCategory->setOpen( true ); } -bool RecipeFilter::hideIfEmpty( QListViewItem *parent ) +bool RecipeFilter::hideIfEmpty( TQListViewItem *parent ) { - QListViewItem * it; + TQListViewItem * it; if ( parent == 0 ) it = listview->firstChild(); else @@ -140,9 +140,9 @@ bool RecipeFilter::hideIfEmpty( QListViewItem *parent ) return parent_should_show; } -bool RecipeFilter::isParentOf( QListViewItem *parent, QListViewItem *to_check ) +bool RecipeFilter::isParentOf( TQListViewItem *parent, TQListViewItem *to_check ) { - for ( QListViewItem * it = to_check->parent(); it; it = it->parent() ) { + for ( TQListViewItem * it = to_check->parent(); it; it = it->parent() ) { if ( it == parent ) return true; } diff --git a/krecipes/src/recipefilter.h b/krecipes/src/recipefilter.h index b7f2574..eb4e4fd 100644 --- a/krecipes/src/recipefilter.h +++ b/krecipes/src/recipefilter.h @@ -12,12 +12,12 @@ #ifndef RECIPEFILTER_H #define RECIPEFILTER_H -#include +#include class KListView; -class QListViewItem; +class TQListViewItem; -class RecipeFilter : public QObject +class RecipeFilter : public TQObject { Q_OBJECT @@ -25,15 +25,15 @@ public: RecipeFilter( KListView * ); public slots: - void filter( const QString & ); + void filter( const TQString & ); void filterCategory( int categoryID ); private: - bool isParentOf( QListViewItem *parent, QListViewItem *to_check ); - bool hideIfEmpty( QListViewItem *parent = 0 ); + bool isParentOf( TQListViewItem *parent, TQListViewItem *to_check ); + bool hideIfEmpty( TQListViewItem *parent = 0 ); KListView *listview; - QListViewItem *currentCategory; + TQListViewItem *currentCategory; }; #endif //RECIPEFILTER_H diff --git a/krecipes/src/setupwizard.cpp b/krecipes/src/setupwizard.cpp index b268c3b..6f05c39 100644 --- a/krecipes/src/setupwizard.cpp +++ b/krecipes/src/setupwizard.cpp @@ -16,12 +16,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -33,7 +33,7 @@ #include "setupwizard.h" -SetupWizard::SetupWizard( QWidget *parent, const char *name, bool modal, WFlags f ) : KWizard( parent, name, modal, f ) +SetupWizard::SetupWizard( TQWidget *parent, const char *name, bool modal, WFlags f ) : KWizard( parent, name, modal, f ) { welcomePage = new WelcomePage( this ); addPage( welcomePage, i18n( "Welcome to Krecipes" ) ); @@ -60,7 +60,7 @@ SetupWizard::SetupWizard( QWidget *parent, const char *name, bool modal, WFlags addPage( savePage, i18n( "Finish & Save Settings" ) ); setFinishEnabled( savePage, true ); // Enable finish button - setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); + setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ); #if (!(HAVE_SQLITE || HAVE_SQLITE3)) #if (HAVE_MYSQL) @@ -110,82 +110,82 @@ void SetupWizard::showPages( DBType type ) } -WelcomePage::WelcomePage( QWidget *parent ) : QWidget( parent ) +WelcomePage::WelcomePage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); - QPixmap logoPixmap ( locate( "data", "krecipes/pics/wizard.png" ) ); - logo = new QLabel( this ); + TQPixmap logoPixmap ( locate( "data", "krecipes/pics/wizard.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( logoPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addWidget( logo, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addWidget( logo, 1, 1, TQt::AlignTop ); - QSpacerItem *spacer_from_image = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_from_image = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_from_image, 1, 2 ); - welcomeText = new QLabel( this ); + welcomeText = new TQLabel( this ); welcomeText->setText( i18n( "Thank you very much for choosing Krecipes.
    It looks like this is the first time you are using it. This wizard will help you with the initial setup so that you can start using it quickly.

    Welcome, and enjoy cooking!" ) ); welcomeText->setMinimumWidth( 200 ); welcomeText->setMaximumWidth( 10000 ); - welcomeText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - welcomeText->setAlignment( int( QLabel::WordBreak | QLabel::AlignTop ) ); + welcomeText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + welcomeText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignTop ) ); layout->addWidget( welcomeText, 1, 3 ); } -PermissionsSetupPage::PermissionsSetupPage( QWidget *parent ) : QWidget( parent ) +PermissionsSetupPage::PermissionsSetupPage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Logo - QPixmap permissionsSetupPixmap ( locate( "data", "krecipes/pics/dbpermissions.png" ) ); - logo = new QLabel( this ); + TQPixmap permissionsSetupPixmap ( locate( "data", "krecipes/pics/dbpermissions.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( permissionsSetupPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 8, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 8, 1, 1, TQt::AlignTop ); // Spacer to separate the logo - QSpacerItem *logoSpacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *logoSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( logoSpacer, 1, 2 ); // Explanation Text - permissionsText = new QLabel( this ); + permissionsText = new TQLabel( this ); permissionsText->setText( i18n( "This dialog will allow you to specify a MySQL account that has the necessary permissions to access the Krecipes MySQL database.

    Most users that use Krecipes and MySQL for the first time can just leave the default parameters and press \'Next\'.

    If you set a MySQL root password before, or you have already permissions as normal user, click on the appropriate option. Otherwise the account 'root' will be used, with no password.

    [For security reasons, we strongly encourage you to setup a MySQL root password if you have not done so yet. Just type as root: mysqladmin password your_password]" ) ); - permissionsText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - permissionsText->setAlignment( int( QLabel::WordBreak | QLabel::AlignTop ) ); + permissionsText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + permissionsText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignTop ) ); layout->addWidget( permissionsText, 1, 3 ); // Text spacer - QSpacerItem *textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *textSpacer = new TQSpacerItem( 10, 30, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // "The user already has permissions" checkbox - noSetupCheckBox = new QCheckBox( i18n( "I have already set the necessary permissions" ), this, "noSetupCheckBox" ); + noSetupCheckBox = new TQCheckBox( i18n( "I have already set the necessary permissions" ), this, "noSetupCheckBox" ); layout->addWidget( noSetupCheckBox, 3, 3 ); - QSpacerItem *checkBoxSpacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *checkBoxSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( checkBoxSpacer, 4, 3 ); // root checkbox - rootCheckBox = new QCheckBox( i18n( "I have already set a MySQL root/admin account" ), this, "rootCheckBox" ); + rootCheckBox = new TQCheckBox( i18n( "I have already set a MySQL root/admin account" ), this, "rootCheckBox" ); layout->addWidget( rootCheckBox, 5, 3 ); - QSpacerItem *rootInfoSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *rootInfoSpacer = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( rootInfoSpacer, 6, 3 ); // MySQL root/admin info - QGroupBox *rootInfoGBox = new QGroupBox( this, "rootInfoGBox" ); + TQGroupBox *rootInfoGBox = new TQGroupBox( this, "rootInfoGBox" ); rootInfoGBox->setTitle( i18n( "MySQL Administrator Account" ) ); rootInfoGBox->setEnabled( false ); // Disable by default rootInfoGBox->setColumns( 2 ); @@ -193,19 +193,19 @@ PermissionsSetupPage::PermissionsSetupPage( QWidget *parent ) : QWidget( parent layout->addWidget( rootInfoGBox, 7, 3 ); // User Entry - QLabel *userLabel = new QLabel( rootInfoGBox ); + TQLabel *userLabel = new TQLabel( rootInfoGBox ); userLabel->setText( i18n( "Username:" ) ); userEdit = new KLineEdit( rootInfoGBox ); userEdit->setText( "root" ); // Password Entry - QLabel *passLabel = new QLabel( rootInfoGBox ); + TQLabel *passLabel = new TQLabel( rootInfoGBox ); passLabel->setText( i18n( "Password:" ) ); passEdit = new KLineEdit( rootInfoGBox ); - passEdit->setEchoMode( QLineEdit::Password ); + passEdit->setEchoMode( TQLineEdit::Password ); // Bottom spacer - QSpacerItem *bottomSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem *bottomSpacer = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( bottomSpacer, 8, 1 ); // Connect Signals & slots @@ -231,7 +231,7 @@ bool PermissionsSetupPage::useAdmin() return ( rootCheckBox->isChecked() ); } -void PermissionsSetupPage::getAdmin( QString &adminName, QString &adminPass ) +void PermissionsSetupPage::getAdmin( TQString &adminName, TQString &adminPass ) { adminName = userEdit->text(); adminPass = passEdit->text(); @@ -244,56 +244,56 @@ void PermissionsSetupPage::noSetupCheckBoxChanged( bool on ) } -PSqlPermissionsSetupPage::PSqlPermissionsSetupPage( QWidget *parent ) : QWidget( parent ) +PSqlPermissionsSetupPage::PSqlPermissionsSetupPage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Logo - QPixmap permissionsSetupPixmap ( locate( "data", "krecipes/pics/dbpermissions.png" ) ); - logo = new QLabel( this ); + TQPixmap permissionsSetupPixmap ( locate( "data", "krecipes/pics/dbpermissions.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( permissionsSetupPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 8, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 8, 1, 1, TQt::AlignTop ); // Spacer to separate the logo - QSpacerItem *logoSpacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *logoSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( logoSpacer, 1, 2 ); // Explanation Text - permissionsText = new QLabel( this ); + permissionsText = new TQLabel( this ); permissionsText->setText( i18n( "This dialog will allow you to specify a PostgreSQL account that has the necessary permissions to access the Krecipes PostgreSQL database. This account may either be a PostgreSQL superuser or have the ability to both create new PostgreSQL users and databases.

    If no superuser or privileged account is given, the account 'postgres' will be attempted, with no password. If this is insufficient for your PostgreSQL setup, you must select the appropriate option below to enter the information of a privileged PostgreSQL account." ) ); - permissionsText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - permissionsText->setAlignment( int( QLabel::WordBreak | QLabel::AlignTop ) ); + permissionsText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + permissionsText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignTop ) ); layout->addWidget( permissionsText, 1, 3 ); // Text spacer - QSpacerItem *textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *textSpacer = new TQSpacerItem( 10, 30, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // "The user already has permissions" checkbox - noSetupCheckBox = new QCheckBox( i18n( "I have already set the necessary permissions" ), this, "noSetupCheckBox" ); + noSetupCheckBox = new TQCheckBox( i18n( "I have already set the necessary permissions" ), this, "noSetupCheckBox" ); layout->addWidget( noSetupCheckBox, 3, 3 ); - QSpacerItem *checkBoxSpacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *checkBoxSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( checkBoxSpacer, 4, 3 ); // root checkbox - rootCheckBox = new QCheckBox( i18n( "I have already set a superuser or privileged account" ), this, "rootCheckBox" ); + rootCheckBox = new TQCheckBox( i18n( "I have already set a superuser or privileged account" ), this, "rootCheckBox" ); layout->addWidget( rootCheckBox, 5, 3 ); - QSpacerItem *rootInfoSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *rootInfoSpacer = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( rootInfoSpacer, 6, 3 ); // MySQL root/admin info - QGroupBox *rootInfoGBox = new QGroupBox( this, "rootInfoGBox" ); + TQGroupBox *rootInfoGBox = new TQGroupBox( this, "rootInfoGBox" ); rootInfoGBox->setTitle( i18n( "PostgreSQL Superuser or Privileged Account" ) ); rootInfoGBox->setEnabled( false ); // Disable by default rootInfoGBox->setColumns( 2 ); @@ -301,19 +301,19 @@ PSqlPermissionsSetupPage::PSqlPermissionsSetupPage( QWidget *parent ) : QWidget( layout->addWidget( rootInfoGBox, 7, 3 ); // User Entry - QLabel *userLabel = new QLabel( rootInfoGBox ); + TQLabel *userLabel = new TQLabel( rootInfoGBox ); userLabel->setText( i18n( "Username:" ) ); userEdit = new KLineEdit( rootInfoGBox ); userEdit->setText( "postgres" ); // Password Entry - QLabel *passLabel = new QLabel( rootInfoGBox ); + TQLabel *passLabel = new TQLabel( rootInfoGBox ); passLabel->setText( i18n( "Password:" ) ); passEdit = new KLineEdit( rootInfoGBox ); - passEdit->setEchoMode( QLineEdit::Password ); + passEdit->setEchoMode( TQLineEdit::Password ); // Bottom spacer - QSpacerItem *bottomSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem *bottomSpacer = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( bottomSpacer, 8, 1 ); // Connect Signals & slots @@ -339,7 +339,7 @@ bool PSqlPermissionsSetupPage::useAdmin() return ( rootCheckBox->isChecked() ); } -void PSqlPermissionsSetupPage::getAdmin( QString &adminName, QString &adminPass ) +void PSqlPermissionsSetupPage::getAdmin( TQString &adminName, TQString &adminPass ) { adminName = userEdit->text(); adminPass = passEdit->text(); @@ -352,59 +352,59 @@ void PSqlPermissionsSetupPage::noSetupCheckBoxChanged( bool on ) } -ServerSetupPage::ServerSetupPage( QWidget *parent ) : QWidget( parent ) +ServerSetupPage::ServerSetupPage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Image - QPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); - logo = new QLabel( this ); + TQPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( serverSetupPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 8, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 8, 1, 1, TQt::AlignTop ); - QSpacerItem *spacer_from_image = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_from_image = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_from_image, 1, 2 ); // Explanation text - serverSetupText = new QLabel( this ); + serverSetupText = new TQLabel( this ); serverSetupText->setText( i18n( "In this dialog you can adjust the database server settings.

    Warning: Passwords are stored in plain text and could potentially be compromised. We recommend that you create a username and password combination solely for use by Krecipes." ) ); - serverSetupText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - serverSetupText->setAlignment( int( QLabel::AlignTop | QLabel::WordBreak ) ); + serverSetupText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + serverSetupText->setAlignment( int( TQLabel::AlignTop | TQLabel::WordBreak ) ); layout->addWidget( serverSetupText, 1, 3 ); // Text spacer - QSpacerItem* textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* textSpacer = new TQSpacerItem( 10, 30, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // Input Boxes - QGroupBox *inputGBox = new QGroupBox( this, "inputGBox" ); - inputGBox->setFrameStyle( QFrame::NoFrame ); + TQGroupBox *inputGBox = new TQGroupBox( this, "inputGBox" ); + inputGBox->setFrameStyle( TQFrame::NoFrame ); inputGBox->setInsideSpacing( 10 ); inputGBox->setColumns( 2 ); layout->addWidget( inputGBox, 3, 3 ); // Username Input - QLabel* usernameText = new QLabel( i18n( "Username:" ), inputGBox ); - usernameText->setFixedSize( QSize( 100, 20 ) ); - usernameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* usernameText = new TQLabel( i18n( "Username:" ), inputGBox ); + usernameText->setFixedSize( TQSize( 100, 20 ) ); + usernameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); usernameEdit = new KLineEdit( inputGBox ); - usernameEdit->setFixedSize( QSize( 120, 20 ) ); - usernameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + usernameEdit->setFixedSize( TQSize( 120, 20 ) ); + usernameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); // get username uid_t userID; - QString username; + TQString username; struct passwd *user; userID = getuid(); user = getpwuid ( userID ); @@ -415,43 +415,43 @@ ServerSetupPage::ServerSetupPage( QWidget *parent ) : QWidget( parent ) // Password - QLabel* passwordText = new QLabel( i18n( "Password:" ), inputGBox ); - passwordText->setFixedSize( QSize( 100, 20 ) ); - passwordText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* passwordText = new TQLabel( i18n( "Password:" ), inputGBox ); + passwordText->setFixedSize( TQSize( 100, 20 ) ); + passwordText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); passwordEdit = new KLineEdit( inputGBox ); - passwordEdit->setEchoMode( QLineEdit::Password ); - passwordEdit->setFixedSize( QSize( 120, 20 ) ); - passwordEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + passwordEdit->setEchoMode( TQLineEdit::Password ); + passwordEdit->setFixedSize( TQSize( 120, 20 ) ); + passwordEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); // DB Name - QLabel* dbNameText = new QLabel( i18n( "Database name:" ), inputGBox ); - dbNameText->setFixedSize( QSize( 100, 20 ) ); - dbNameText->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQLabel* dbNameText = new TQLabel( i18n( "Database name:" ), inputGBox ); + dbNameText->setFixedSize( TQSize( 100, 20 ) ); + dbNameText->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); dbNameEdit = new KLineEdit( inputGBox ); - dbNameEdit->setFixedSize( QSize( 120, 20 ) ); - dbNameEdit->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + dbNameEdit->setFixedSize( TQSize( 120, 20 ) ); + dbNameEdit->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); dbNameEdit->setText( "Krecipes" ); // Spacer from box - QSpacerItem* spacerFromBox = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerFromBox = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerFromBox, 4, 3 ); // Remote server checkbox - remoteServerCheckBox = new QCheckBox( i18n( "The server is remote" ), this, "remoteServerCheckBox" ); + remoteServerCheckBox = new TQCheckBox( i18n( "The server is remote" ), this, "remoteServerCheckBox" ); layout->addWidget( remoteServerCheckBox, 5, 3 ); // Spacer from CheckBox - QSpacerItem* spacerFromCheckBox = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerFromCheckBox = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerFromCheckBox, 6, 3 ); // Server & Client Box - QGroupBox *serverSettingsGBox = new QGroupBox( this, "serverSettingsGBox" ); + TQGroupBox *serverSettingsGBox = new TQGroupBox( this, "serverSettingsGBox" ); serverSettingsGBox->setTitle( i18n( "Server / Client Settings" ) ); serverSettingsGBox->setEnabled( false ); // Disable by default serverSettingsGBox->setInsideSpacing( 10 ); @@ -460,21 +460,21 @@ ServerSetupPage::ServerSetupPage( QWidget *parent ) : QWidget( parent ) // Server - ( void ) new QLabel( i18n( "Server:" ), serverSettingsGBox ); + ( void ) new TQLabel( i18n( "Server:" ), serverSettingsGBox ); serverEdit = new KLineEdit( serverSettingsGBox ); serverEdit->setText( "localhost" ); // Client - ( void ) new QLabel( i18n( "Client:" ), serverSettingsGBox ); + ( void ) new TQLabel( i18n( "Client:" ), serverSettingsGBox ); clientEdit = new KLineEdit( serverSettingsGBox ); clientEdit->setText( "localhost" ); // Bottom Spacers - QSpacerItem* bottomSpacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* bottomSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( bottomSpacer, 8, 1 ); - //QSpacerItem* spacerRight = new QSpacerItem( 10, 10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); + //TQSpacerItem* spacerRight = new TQSpacerItem( 10, 10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ); //layout->addItem( spacerRight, 7, 4 ); // Signals & Slots @@ -482,27 +482,27 @@ ServerSetupPage::ServerSetupPage( QWidget *parent ) : QWidget( parent ) } -QString ServerSetupPage::server( void ) +TQString ServerSetupPage::server( void ) { return ( serverEdit->text() ); } -QString ServerSetupPage::user( void ) +TQString ServerSetupPage::user( void ) { return ( usernameEdit->text() ); } -QString ServerSetupPage::password( void ) +TQString ServerSetupPage::password( void ) { return ( passwordEdit->text() ); } -QString ServerSetupPage::dbName( void ) +TQString ServerSetupPage::dbName( void ) { return ( dbNameEdit->text() ); } -void ServerSetupPage::getServerInfo( bool &isRemote, QString &host, QString &client, QString &dbName, QString &user, QString &pass, int &port ) +void ServerSetupPage::getServerInfo( bool &isRemote, TQString &host, TQString &client, TQString &dbName, TQString &user, TQString &pass, int &port ) { isRemote = remoteServerCheckBox->isChecked(); host = serverEdit->text(); @@ -513,52 +513,52 @@ void ServerSetupPage::getServerInfo( bool &isRemote, QString &host, QString &cli port = 0; } -SQLiteSetupPage::SQLiteSetupPage( QWidget *parent ) : QWidget( parent ) +SQLiteSetupPage::SQLiteSetupPage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Image - QPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); - logo = new QLabel( this ); + TQPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( serverSetupPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 4, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 4, 1, 1, TQt::AlignTop ); - QSpacerItem *spacer_from_image = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_from_image = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_from_image, 1, 2 ); // Explanation text - serverSetupText = new QLabel( this ); + serverSetupText = new TQLabel( this ); serverSetupText->setText( i18n( "In this dialog you can adjust SQLite settings." ) ); - serverSetupText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - serverSetupText->setAlignment( int( QLabel::AlignTop | QLabel::AlignJustify ) ); + serverSetupText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + serverSetupText->setAlignment( int( TQLabel::AlignTop | TQLabel::AlignJustify ) ); layout->addWidget( serverSetupText, 1, 3 ); // Text spacer - QSpacerItem* textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* textSpacer = new TQSpacerItem( 10, 30, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // Input Boxes - QHBox *hbox = new QHBox( this ); + TQHBox *hbox = new TQHBox( this ); - ( void ) new QLabel( i18n( "Database file:" ), hbox ); + ( void ) new TQLabel( i18n( "Database file:" ), hbox ); fileEdit = new KLineEdit( hbox ); fileEdit->setText( locateLocal ( "appdata", "krecipes.krecdb" ) ); hbox->setStretchFactor( fileEdit, 2 ); KIconLoader il; - QPushButton *file_select = new QPushButton( il.loadIcon( "fileopen", KIcon::NoGroup, 16 ), QString::null, hbox ); - QToolTip::add + TQPushButton *file_select = new TQPushButton( il.loadIcon( "fileopen", KIcon::NoGroup, 16 ), TQString::null, hbox ); + TQToolTip::add ( file_select, i18n( "Open file dialog" ) ); file_select->setFixedWidth( 25 ); @@ -566,48 +566,48 @@ SQLiteSetupPage::SQLiteSetupPage( QWidget *parent ) : QWidget( parent ) // Bottom Spacers - QSpacerItem* bottomSpacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + TQSpacerItem* bottomSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); layout->addItem( bottomSpacer, 4, 1 ); connect( file_select, SIGNAL( clicked() ), SLOT( selectFile() ) ); } -QString SQLiteSetupPage::dbFile( void ) const +TQString SQLiteSetupPage::dbFile( void ) const { return ( fileEdit->text() ); } void SQLiteSetupPage::selectFile() { - KFileDialog dialog( QString::null, "*.*|All Files", this, "dialog", true ); - if ( dialog.exec() == QDialog::Accepted ) { + KFileDialog dialog( TQString::null, "*.*|All Files", this, "dialog", true ); + if ( dialog.exec() == TQDialog::Accepted ) { fileEdit->setText( dialog.selectedFile() ); } } -SavePage::SavePage( QWidget *parent ) : QWidget( parent ) +SavePage::SavePage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); - QPixmap logoPixmap ( locate( "data", "krecipes/pics/save.png" ) ); - logo = new QLabel( this ); + TQPixmap logoPixmap ( locate( "data", "krecipes/pics/save.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( logoPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addWidget( logo, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addWidget( logo, 1, 1, TQt::AlignTop ); - QSpacerItem *spacer_from_image = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_from_image = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_from_image, 1, 2 ); - saveText = new QLabel( this ); + saveText = new TQLabel( this ); saveText->setText( i18n( "Congratulations; all the necessary configuration setup is done. Press 'Finish' to continue, and enjoy cooking!" ) ); - saveText->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); + saveText->setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ); - saveText->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); + saveText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) ); layout->addWidget( saveText, 1, 3 ); @@ -619,7 +619,7 @@ void SetupWizard::save( void ) KConfig *config = kapp->config(); // Save the database type - QString sDBType; + TQString sDBType; switch ( dbTypeSetupPage->dbType() ) { case MySQL: @@ -665,7 +665,7 @@ void SetupWizard::getOptions( bool &setupUser, bool &initializeData, bool &doUSD doUSDAImport = dataInitializePage->doUSDAImport(); } -void SetupWizard::getAdminInfo( bool &enabled, QString &adminUser, QString &adminPass, const QString &dbType ) +void SetupWizard::getAdminInfo( bool &enabled, TQString &adminUser, TQString &adminPass, const TQString &dbType ) { enabled = permissionsSetupPage->useAdmin() || pSqlPermissionsSetupPage->useAdmin(); if ( dbType == "MySQL" ) @@ -674,60 +674,60 @@ void SetupWizard::getAdminInfo( bool &enabled, QString &adminUser, QString &admi pSqlPermissionsSetupPage->getAdmin( adminUser, adminPass ); } -void SetupWizard::getServerInfo( bool &isRemote, QString &host, QString &client, QString &dbName, QString &user, QString &pass, int &port ) +void SetupWizard::getServerInfo( bool &isRemote, TQString &host, TQString &client, TQString &dbName, TQString &user, TQString &pass, int &port ) { serverSetupPage->getServerInfo( isRemote, host, client, dbName, user, pass, port ); if ( dbTypeSetupPage->dbType() == SQLite ) dbName = sqliteSetupPage->dbFile(); } -DataInitializePage::DataInitializePage( QWidget *parent ) : QWidget( parent ) +DataInitializePage::DataInitializePage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Explanation Text// Widgets - QLabel *logo; - //QLabel *serverSetupText; + TQLabel *logo; + //TQLabel *serverSetupText; //KLineEdit *usernameEdit; //KLineEdit *passwordEdit; //KLineEdit *dbNameEdit; - initializeText = new QLabel( this ); + initializeText = new TQLabel( this ); initializeText->setText( i18n( "Krecipes comes with some delicious default recipes and useful data.

    Would you like to initialize your database with those? Note that this will erase all your previous recipes if you have any. " ) ); - initializeText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - initializeText->setAlignment( int( QLabel::WordBreak | QLabel::AlignTop ) ); + initializeText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + initializeText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignTop ) ); layout->addWidget( initializeText, 1, 3 ); // Logo - QPixmap dataInitializePixmap ( locate( "data", "krecipes/pics/recipes.png" ) ); - logo = new QLabel( this ); + TQPixmap dataInitializePixmap ( locate( "data", "krecipes/pics/recipes.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( dataInitializePixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 8, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 8, 1, 1, TQt::AlignTop ); // Spacer to separate the logo - QSpacerItem *logoSpacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *logoSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( logoSpacer, 1, 2 ); // Initialize data checkbox - initializeCheckBox = new QCheckBox( i18n( "Yes please, initialize the database with the examples" ), this, "initializeCheckBox" ); + initializeCheckBox = new TQCheckBox( i18n( "Yes please, initialize the database with the examples" ), this, "initializeCheckBox" ); layout->addWidget( initializeCheckBox, 3, 3 ); - QSpacerItem *textInfoSpacer = new QSpacerItem( 0, 50, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *textInfoSpacer = new TQSpacerItem( 0, 50, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textInfoSpacer, 4, 3 ); - USDAImportText = new QLabel( i18n( "Krecipes can import nutrient data from the USDA's nutrient database for over 400 foods. A total of 43 food properties are included for each food, such as energy, fat, vitamin C, etc.

    Would you like to import this data now? Note that this operation is safe to use on an existing database, and no data loss will occur. This operation may take several minutes." ), this ); + USDAImportText = new TQLabel( i18n( "Krecipes can import nutrient data from the USDA's nutrient database for over 400 foods. A total of 43 food properties are included for each food, such as energy, fat, vitamin C, etc.

    Would you like to import this data now? Note that this operation is safe to use on an existing database, and no data loss will occur. This operation may take several minutes." ), this ); layout->addWidget( USDAImportText, 5, 3 ); - QSpacerItem *importInfoSpacer = new QSpacerItem( 0, 50, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem *importInfoSpacer = new TQSpacerItem( 0, 50, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( importInfoSpacer, 6, 3 ); - USDAImportCheckBox = new QCheckBox( i18n( "Yes please, load the database with nutrient data for 400+ foods. (Note: English only.)" ), this, "USDAImportCheckBox" ); + USDAImportCheckBox = new TQCheckBox( i18n( "Yes please, load the database with nutrient data for 400+ foods. (Note: English only.)" ), this, "USDAImportCheckBox" ); layout->addWidget( USDAImportCheckBox, 7, 3 ); } @@ -741,48 +741,48 @@ bool DataInitializePage::doUSDAImport( void ) return ( USDAImportCheckBox->isChecked() ); } -DBTypeSetupPage::DBTypeSetupPage( QWidget *parent ) : QWidget( parent ) +DBTypeSetupPage::DBTypeSetupPage( TQWidget *parent ) : TQWidget( parent ) { - QGridLayout * layout = new QGridLayout( this, 1, 1, 0, 0 ); - QSpacerItem *spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQGridLayout * layout = new TQGridLayout( this, 1, 1, 0, 0 ); + TQSpacerItem *spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); - QSpacerItem *spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); // Image - QPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); - logo = new QLabel( this ); + TQPixmap serverSetupPixmap ( locate( "data", "krecipes/pics/network.png" ) ); + logo = new TQLabel( this ); logo->setPixmap( serverSetupPixmap ); - logo->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); - layout->addMultiCellWidget( logo, 1, 4, 1, 1, Qt::AlignTop ); + logo->setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); + layout->addMultiCellWidget( logo, 1, 4, 1, 1, TQt::AlignTop ); - QSpacerItem *spacer_from_image = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem *spacer_from_image = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_from_image, 1, 2 ); // Explanation text - dbTypeSetupText = new QLabel( this ); + dbTypeSetupText = new TQLabel( this ); dbTypeSetupText->setText( i18n( "Choose the type of database that you want to use. Most users will want to choose a simple local database here. However, you can also use remote servers by means of a MySQL or PostgreSQL database." ) ); - dbTypeSetupText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); - dbTypeSetupText->setAlignment( int( QLabel::AlignTop | QLabel::WordBreak ) ); + dbTypeSetupText->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); + dbTypeSetupText->setAlignment( int( TQLabel::AlignTop | TQLabel::WordBreak ) ); layout->addWidget( dbTypeSetupText, 1, 3 ); // Text spacer - QSpacerItem* textSpacer = new QSpacerItem( 10, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* textSpacer = new TQSpacerItem( 10, 30, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( textSpacer, 2, 3 ); // Database type choice - bg = new QVButtonGroup( this ); + bg = new TQVButtonGroup( this ); layout->addWidget( bg, 3, 3 ); - liteCheckBox = new QRadioButton( i18n( "Simple Local File (SQLite)" ), bg, "liteCheckBox" ); - mysqlCheckBox = new QRadioButton( i18n( "Local or Remote MySQL Database" ), bg, "liteCheckBox" ); - psqlCheckBox = new QRadioButton( i18n( "Local or Remote PostgreSQL Database" ), bg, "psqlCheckBox" ); + liteCheckBox = new TQRadioButton( i18n( "Simple Local File (SQLite)" ), bg, "liteCheckBox" ); + mysqlCheckBox = new TQRadioButton( i18n( "Local or Remote MySQL Database" ), bg, "liteCheckBox" ); + psqlCheckBox = new TQRadioButton( i18n( "Local or Remote PostgreSQL Database" ), bg, "psqlCheckBox" ); bg->setButton( 0 ); // By default, SQLite #if (!HAVE_MYSQL) @@ -807,7 +807,7 @@ DBTypeSetupPage::DBTypeSetupPage( QWidget *parent ) : QWidget( parent ) #endif - QSpacerItem *spacer_bottom = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ); + TQSpacerItem *spacer_bottom = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::MinimumExpanding ); layout->addItem( spacer_bottom, 4, 3 ); connect( bg, SIGNAL( clicked( int ) ), this, SLOT( setPages( int ) ) ); diff --git a/krecipes/src/setupwizard.h b/krecipes/src/setupwizard.h index 5a24fa2..9f213d6 100644 --- a/krecipes/src/setupwizard.h +++ b/krecipes/src/setupwizard.h @@ -11,10 +11,10 @@ #ifndef SETUPWIZARD_H #define SETUPWIZARD_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -40,11 +40,11 @@ class SetupWizard: public KWizard Q_OBJECT public: - SetupWizard( QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0 ); + SetupWizard( TQWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0 ); ~SetupWizard(); void getOptions( bool &setupUser, bool &initializeData, bool &doUSDAImport ); - void getAdminInfo( bool &enabled, QString &adminUser, QString &adminPass, const QString &dbType ); - void getServerInfo( bool &isRemote, QString &host, QString &client, QString &dbName, QString &user, QString &pass, int &port ); + void getAdminInfo( bool &enabled, TQString &adminUser, TQString &adminPass, const TQString &dbType ); + void getServerInfo( bool &isRemote, TQString &host, TQString &client, TQString &dbName, TQString &user, TQString &pass, int &port ); private: // Widgets WelcomePage *welcomePage; @@ -62,37 +62,37 @@ private slots: }; -class WelcomePage: public QWidget +class WelcomePage: public TQWidget { public: // Methods - WelcomePage( QWidget *parent ); + WelcomePage( TQWidget *parent ); private: // Widgets - QLabel *logo; - QLabel *welcomeText; + TQLabel *logo; + TQLabel *welcomeText; }; -class PermissionsSetupPage: public QWidget +class PermissionsSetupPage: public TQWidget { Q_OBJECT public: // Methods - PermissionsSetupPage( QWidget *parent ); + PermissionsSetupPage( TQWidget *parent ); bool doUserSetup( void ); bool useAdmin( void ); - void getAdmin( QString &adminName, QString &adminPass ); + void getAdmin( TQString &adminName, TQString &adminPass ); private: // Widgets - QLabel *logo; - QLabel *permissionsText; - QCheckBox *noSetupCheckBox; - QCheckBox *rootCheckBox; - QLineEdit *userEdit; - QLineEdit *passEdit; + TQLabel *logo; + TQLabel *permissionsText; + TQCheckBox *noSetupCheckBox; + TQCheckBox *rootCheckBox; + TQLineEdit *userEdit; + TQLineEdit *passEdit; private slots: void rootCheckBoxChanged( bool on ); @@ -100,23 +100,23 @@ private slots: }; -class PSqlPermissionsSetupPage: public QWidget +class PSqlPermissionsSetupPage: public TQWidget { Q_OBJECT public: // Methods - PSqlPermissionsSetupPage( QWidget *parent ); + PSqlPermissionsSetupPage( TQWidget *parent ); bool doUserSetup( void ); bool useAdmin( void ); - void getAdmin( QString &adminName, QString &adminPass ); + void getAdmin( TQString &adminName, TQString &adminPass ); private: // Widgets - QLabel *logo; - QLabel *permissionsText; - QCheckBox *noSetupCheckBox; - QCheckBox *rootCheckBox; - QLineEdit *userEdit; - QLineEdit *passEdit; + TQLabel *logo; + TQLabel *permissionsText; + TQCheckBox *noSetupCheckBox; + TQCheckBox *rootCheckBox; + TQLineEdit *userEdit; + TQLineEdit *passEdit; private slots: void rootCheckBoxChanged( bool on ); @@ -124,97 +124,97 @@ private slots: }; -class ServerSetupPage: public QWidget +class ServerSetupPage: public TQWidget { public: // Methods - ServerSetupPage( QWidget *parent ); - QString user( void ); - QString password( void ); - QString dbName( void ); - QString server( void ); - QString client( void ); - void getServerInfo( bool &isRemote, QString &host, QString &client, QString &dbName, QString &user, QString &pass, int &port ); + ServerSetupPage( TQWidget *parent ); + TQString user( void ); + TQString password( void ); + TQString dbName( void ); + TQString server( void ); + TQString client( void ); + void getServerInfo( bool &isRemote, TQString &host, TQString &client, TQString &dbName, TQString &user, TQString &pass, int &port ); private: // Widgets - QLabel *logo; - QLabel *serverSetupText; + TQLabel *logo; + TQLabel *serverSetupText; KLineEdit *usernameEdit; KLineEdit *passwordEdit; KLineEdit *dbNameEdit; - QCheckBox *remoteServerCheckBox; + TQCheckBox *remoteServerCheckBox; KLineEdit *serverEdit; KLineEdit *clientEdit; }; -class SQLiteSetupPage: public QWidget +class SQLiteSetupPage: public TQWidget { Q_OBJECT public: // Methods - SQLiteSetupPage( QWidget *parent ); - QString dbFile() const; + SQLiteSetupPage( TQWidget *parent ); + TQString dbFile() const; private slots: void selectFile(); private: // Widgets - QLabel *logo; - QLabel *serverSetupText; + TQLabel *logo; + TQLabel *serverSetupText; KLineEdit *fileEdit; }; -class DataInitializePage: public QWidget +class DataInitializePage: public TQWidget { public: // Methods - DataInitializePage( QWidget *parent ); + DataInitializePage( TQWidget *parent ); bool doInitialization( void ); bool doUSDAImport( void ); private: // Widgets - QLabel *logo; - QLabel *initializeText; - QLabel *USDAImportText; - QCheckBox *initializeCheckBox; - QCheckBox *USDAImportCheckBox; + TQLabel *logo; + TQLabel *initializeText; + TQLabel *USDAImportText; + TQCheckBox *initializeCheckBox; + TQCheckBox *USDAImportCheckBox; }; -class SavePage: public QWidget +class SavePage: public TQWidget { public: // Methods - SavePage( QWidget *parent ); + SavePage( TQWidget *parent ); private: // Widgets - QLabel *logo; - QLabel *saveText; + TQLabel *logo; + TQLabel *saveText; }; -class DBTypeSetupPage: public QWidget +class DBTypeSetupPage: public TQWidget { Q_OBJECT public: // Methods - DBTypeSetupPage( QWidget *parent ); + DBTypeSetupPage( TQWidget *parent ); int dbType( void ); private: // Widgets - QLabel *dbTypeSetupText; - QLabel *logo; - QVButtonGroup *bg; - QRadioButton *liteCheckBox; - QRadioButton *mysqlCheckBox; - QRadioButton *psqlCheckBox; + TQLabel *dbTypeSetupText; + TQLabel *logo; + TQVButtonGroup *bg; + TQRadioButton *liteCheckBox; + TQRadioButton *mysqlCheckBox; + TQRadioButton *psqlCheckBox; private slots: void setPages( int rb ); // hides/shows pages given the radio button state signals: diff --git a/krecipes/src/tests/checks.h b/krecipes/src/tests/checks.h index f115f98..038395f 100644 --- a/krecipes/src/tests/checks.h +++ b/krecipes/src/tests/checks.h @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "datablocks/categorytree.h" #include "datablocks/rating.h" @@ -27,7 +27,7 @@ using std::endl; void check( const RatingList &rating, const RatingList &base ); -bool check(const QString &txt, const QString &a, const QString &b) +bool check(const TQString &txt, const TQString &a, const TQString &b) { if ( a != b ) { cout << "ERROR: Tested " << txt.latin1() << ", expected" << endl; @@ -40,7 +40,7 @@ bool check(const QString &txt, const QString &a, const QString &b) return true; } -bool check(const QString &txt, int a, int b) +bool check(const TQString &txt, int a, int b) { if ( a != b ) { cout << "ERROR: Tested " << txt.latin1() << ", expected" << endl; @@ -53,7 +53,7 @@ bool check(const QString &txt, int a, int b) return true; } -bool check(const QString &txt, double a, double b) +bool check(const TQString &txt, double a, double b) { if ( fabs(a - b) > 1e-10 ) { cout << "ERROR: Tested " << txt.latin1() << ", expected" << endl; @@ -66,7 +66,7 @@ bool check(const QString &txt, double a, double b) return true; } -bool check(const QString &txt, const QPixmap &a, const QPixmap &b) +bool check(const TQString &txt, const TQPixmap &a, const TQPixmap &b) { if ( a.size() != b.size() ) { @@ -79,17 +79,17 @@ bool check(const QString &txt, const QPixmap &a, const QPixmap &b) void check( const IngredientData &ing, const IngredientData &base_ing, int ing_num ) { - check( QString::number(ing_num)+": Ingredient name", ing.name, base_ing.name ); - check( QString::number(ing_num)+": Ingredient amount", ing.amount,base_ing.amount ); - check( QString::number(ing_num)+": Ingredient amount_offset", ing.amount_offset,base_ing.amount_offset ); - check( QString::number(ing_num)+": Ingredient singular unit", ing.units.name, base_ing.units.name ); - check( QString::number(ing_num)+": Ingredient plural unit", ing.units.plural, base_ing.units.plural ); - check( QString::number(ing_num)+": Ingredient group", ing.group, base_ing.group ); + check( TQString::number(ing_num)+": Ingredient name", ing.name, base_ing.name ); + check( TQString::number(ing_num)+": Ingredient amount", ing.amount,base_ing.amount ); + check( TQString::number(ing_num)+": Ingredient amount_offset", ing.amount_offset,base_ing.amount_offset ); + check( TQString::number(ing_num)+": Ingredient singular unit", ing.units.name, base_ing.units.name ); + check( TQString::number(ing_num)+": Ingredient plural unit", ing.units.plural, base_ing.units.plural ); + check( TQString::number(ing_num)+": Ingredient group", ing.group, base_ing.group ); ElementList::const_iterator prep_it = ing.prepMethodList.begin(); ElementList::const_iterator base_prep_it = base_ing.prepMethodList.begin(); for ( ; prep_it != ing.prepMethodList.end(); ++prep_it, ++base_prep_it ) { - check( QString::number(ing_num)+": Ingredient prep_method", (*prep_it).name, (*base_prep_it).name ); + check( TQString::number(ing_num)+": Ingredient prep_method", (*prep_it).name, (*base_prep_it).name ); } } @@ -108,7 +108,7 @@ void check( const Recipe &recipe, const Recipe &base ) ElementList::const_iterator cat_it = recipe.categoryList.begin(); ElementList::const_iterator base_cat_it = base.categoryList.begin(); for ( ; cat_it != recipe.categoryList.end() || base_cat_it != base.categoryList.end(); ++cat_it, ++base_cat_it ) { - check( QString::number(cat_num)+": Category", (*cat_it).name, (*base_cat_it).name ); + check( TQString::number(cat_num)+": Category", (*cat_it).name, (*base_cat_it).name ); ++cat_num; } check( "category count", cat_num-1, base.categoryList.count() ); @@ -117,7 +117,7 @@ void check( const Recipe &recipe, const Recipe &base ) ElementList::const_iterator author_it = recipe.authorList.begin(); ElementList::const_iterator base_author_it = base.authorList.begin(); for ( ; author_it != recipe.authorList.end() || base_author_it != base.authorList.end(); ++author_it, ++base_author_it ) { - check( QString::number(author_num)+": Author", (*author_it).name, (*base_author_it).name ); + check( TQString::number(author_num)+": Author", (*author_it).name, (*base_author_it).name ); ++author_num; } check( "author count", author_num-1, base.authorList.count() ); @@ -128,8 +128,8 @@ void check( const Recipe &recipe, const Recipe &base ) for ( ; ing_it != recipe.ingList.end() || base_ing_it != base.ingList.end(); ++ing_it, ++base_ing_it ) { check( *ing_it, *base_ing_it, ing_num ); - QValueList::const_iterator base_sub_it = (*base_ing_it).substitutes.begin(); - for ( QValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it, ++base_sub_it ) { + TQValueList::const_iterator base_sub_it = (*base_ing_it).substitutes.begin(); + for ( TQValueList::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it, ++base_sub_it ) { check( *sub_it, *base_sub_it, ing_num+1000 ); } diff --git a/krecipes/src/tests/exportertest.h b/krecipes/src/tests/exportertest.h index 9df5fb8..6998d6a 100644 --- a/krecipes/src/tests/exportertest.h +++ b/krecipes/src/tests/exportertest.h @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "checks.h" @@ -26,9 +26,9 @@ using std::endl; void check( BaseExporter &exporter, const RecipeList &recipeList ) { - QFile file("test.txt"); + TQFile file("test.txt"); if ( file.open( IO_WriteOnly ) ) { - QTextStream stream(&file); + TQTextStream stream(&file); exporter.writeStream(stream,recipeList); } else { diff --git a/krecipes/src/tests/importertest.h b/krecipes/src/tests/importertest.h index f8fad78..62ab682 100644 --- a/krecipes/src/tests/importertest.h +++ b/krecipes/src/tests/importertest.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include "checks.h" #include "datablocks/categorytree.h" diff --git a/krecipes/src/tests/kretest.cpp b/krecipes/src/tests/kretest.cpp index 2c739e5..90a8c27 100644 --- a/krecipes/src/tests/kretest.cpp +++ b/krecipes/src/tests/kretest.cpp @@ -10,8 +10,8 @@ #include -#include -#include +#include +#include #include @@ -29,7 +29,7 @@ main(int argc, char *argv[]) KreImporter importer; printf("Parsing kretest.txt.\n"); - QStringList files; files << "kretest.txt"; + TQStringList files; files << "kretest.txt"; importer.parseFiles(files); Recipe recipe; @@ -41,7 +41,7 @@ main(int argc, char *argv[]) recipe.categoryList.append( Element("Cookies & Squares",2) ); recipe.instructions = "Drop by spoonful on greased cookie sheet. Bake in moderate oven."; - recipe.prepTime = QTime(0,30); + recipe.prepTime = TQTime(0,30); if ( !recipe.photo.load( "test_photo.jpg", "JPEG" ) ) { printf("Unable to load test_photo.jpg\n"); exit(1); @@ -88,7 +88,7 @@ main(int argc, char *argv[]) ing8.units.name = "c."; ing8.prepMethodList.append( Element("softened") ); ing8.prepMethodList.append( Element("at room temperature") ); - ing8.groupID = 1; ing8.group = "Fat & Liquids"; + ing8.groupID = 1; ing8.group = "Fat & Litquids"; recipe.ingList.append( ing8 ); Ingredient ing6; @@ -96,7 +96,7 @@ main(int argc, char *argv[]) ing6.amount = 1; ing6.amount_offset = 0; ing6.units.name = "c."; - ing6.groupID = 1; ing6.group = "Fat & Liquids"; + ing6.groupID = 1; ing6.group = "Fat & Litquids"; recipe.ingList.append( ing6 ); Ingredient ing5; @@ -104,7 +104,7 @@ main(int argc, char *argv[]) ing5.amount = 2; ing5.amount_offset = 0; ing5.units.plural = ""; - ing5.groupID = 1; ing5.group = "Fat & Liquids"; + ing5.groupID = 1; ing5.group = "Fat & Litquids"; recipe.ingList.append( ing5 ); Ingredient ing7; @@ -112,7 +112,7 @@ main(int argc, char *argv[]) ing7.amount = 1; ing7.amount_offset = 0; ing7.units.name = "tsp."; - ing7.groupID = 1; ing7.group = "Fat & Liquids"; + ing7.groupID = 1; ing7.group = "Fat & Litquids"; recipe.ingList.append( ing7 ); Ingredient ing9; @@ -180,9 +180,9 @@ main(int argc, char *argv[]) KreImporter importer2; printf("Parsing test.txt.\n"); - QStringList files2; files2 << "test.txt"; + TQStringList files2; files2 << "test.txt"; importer2.parseFiles(files2); - QFile::remove("test.txt"); + TQFile::remove("test.txt"); check( importer2, recipe ); check( importer2, catTree ); printf("Recipe export successful.\n"); diff --git a/krecipes/src/tests/kretest.txt b/krecipes/src/tests/kretest.txt index 35b4ae6..8392347 100644 --- a/krecipes/src/tests/kretest.txt +++ b/krecipes/src/tests/kretest.txt @@ -136,7 +136,7 @@ iT/nkv50f2xJ/wA8l/Oiijkj2C7F/th/+eS/nR/a7n/lkv50UUKEewXZmtJudjtHJooorexkf//Z]]>< tsp. - + shortening 1 @@ -336,7 +336,7 @@ iT/nkv50f2xJ/wA8l/Oiijkj2C7F/th/+eS/nR/a7n/lkv50UUKEewXZmtJudjtHJooorexkf//Z]]>< tsp. - + shortening 1 diff --git a/krecipes/src/tests/mmftest.cpp b/krecipes/src/tests/mmftest.cpp index f79c4a8..ecf442e 100644 --- a/krecipes/src/tests/mmftest.cpp +++ b/krecipes/src/tests/mmftest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -30,7 +30,7 @@ main(int argc, char *argv[]) MMFImporter importer; printf("Parsing mmftest.txt.\n"); - QStringList files; files << "mmftest.txt"; + TQStringList files; files << "mmftest.txt"; importer.parseFiles(files); Recipe recipe; @@ -41,7 +41,7 @@ main(int argc, char *argv[]) recipe.categoryList.append( Element("Cookies & Squares",2) ); recipe.instructions = "Drop by spoonful on greased cookie sheet. Bake in moderate oven."; - recipe.prepTime = QTime(0,30); + recipe.prepTime = TQTime(0,30); Ingredient ing9; ing9.name = "a"; @@ -92,25 +92,25 @@ main(int argc, char *argv[]) ing8.amount = 1; ing8.prepMethodList.append( Element("softened") ); ing8.prepMethodList.append( Element("at room temperature") ); - ing8.groupID = 1; ing8.group = "Fat & Liquids"; + ing8.groupID = 1; ing8.group = "Fat & Litquids"; recipe.ingList.append( ing8 ); Ingredient ing6; ing6.name = "c. peanut butter"; ing6.amount = 1; - ing6.groupID = 1; ing6.group = "Fat & Liquids"; + ing6.groupID = 1; ing6.group = "Fat & Litquids"; recipe.ingList.append( ing6 ); Ingredient ing5; ing5.name = "eggs"; ing5.amount = 2; - ing5.groupID = 1; ing5.group = "Fat & Liquids"; + ing5.groupID = 1; ing5.group = "Fat & Litquids"; recipe.ingList.append( ing5 ); Ingredient ing7; ing7.name = "tsp. vanilla extract"; ing7.amount = 1; - ing7.groupID = 1; ing7.group = "Fat & Liquids"; + ing7.groupID = 1; ing7.group = "Fat & Litquids"; recipe.ingList.append( ing7 ); @@ -129,9 +129,9 @@ main(int argc, char *argv[]) MMFImporter importer2; printf("Parsing test.txt.\n"); - QStringList files2; files2 << "test.txt"; + TQStringList files2; files2 << "test.txt"; importer2.parseFiles(files2); - QFile::remove("test.txt"); + TQFile::remove("test.txt"); check( importer2, recipe ); printf("Recipe export successful.\n"); diff --git a/krecipes/src/tests/mmftest.txt b/krecipes/src/tests/mmftest.txt index 9d13af3..6210b66 100644 --- a/krecipes/src/tests/mmftest.txt +++ b/krecipes/src/tests/mmftest.txt @@ -12,7 +12,7 @@ 1 c. brown sugar 2 c. all-purpose flour 1 tsp. baking soda --------------------------------Fat & Liquids-------------------------------- +-------------------------------Fat & Litquids-------------------------------- 1 c. shortening; softened, at -room temperature 1 c. peanut butter @@ -37,7 +37,7 @@ 1 c. brown sugar 2 c. all-purpose flour 1 tsp. baking soda --------------------------------Fat & Liquids-------------------------------- +-------------------------------Fat & Litquids-------------------------------- 1 c. shortening; softened, at -room temperature 1 c. peanut butter diff --git a/krecipes/src/tests/mx2test.cpp b/krecipes/src/tests/mx2test.cpp index 71f45eb..ce597dc 100644 --- a/krecipes/src/tests/mx2test.cpp +++ b/krecipes/src/tests/mx2test.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -28,7 +28,7 @@ main(int argc, char *argv[]) MX2Importer importer; printf("Parsing mx2test.txt.\n"); - QStringList files; files << "mx2test.txt"; + TQStringList files; files << "mx2test.txt"; importer.parseFiles(files); Recipe recipe; @@ -51,7 +51,7 @@ main(int argc, char *argv[]) Ingredient ing2; ing2.name = "ingredient 2"; ing2.amount = 3.5; - ing2.units.plural = QString::null; + ing2.units.plural = TQString::null; recipe.ingList.append( ing2 ); Ingredient ing3; diff --git a/krecipes/src/tests/mxptest.cpp b/krecipes/src/tests/mxptest.cpp index 0cbfb90..476d062 100644 --- a/krecipes/src/tests/mxptest.cpp +++ b/krecipes/src/tests/mxptest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -28,7 +28,7 @@ main(int argc, char *argv[]) MXPImporter importer; printf("Parsing mxptest.txt.\n"); - QStringList files; files << "mxptest.txt"; + TQStringList files; files << "mxptest.txt"; importer.parseFiles(files); Recipe recipe; @@ -51,7 +51,7 @@ main(int argc, char *argv[]) Ingredient ing2; ing2.name = "ingredient 2"; ing2.amount = 3.5; - ing2.units.plural = QString::null; + ing2.units.plural = TQString::null; recipe.ingList.append( ing2 ); Ingredient ing3; diff --git a/krecipes/src/tests/nyctest.cpp b/krecipes/src/tests/nyctest.cpp index 70f9460..39263ee 100644 --- a/krecipes/src/tests/nyctest.cpp +++ b/krecipes/src/tests/nyctest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -28,7 +28,7 @@ main(int argc, char *argv[]) NYCGenericImporter importer; printf("Parsing nyctest.txt.\n"); - QStringList files; files << "nyctest.txt"; + TQStringList files; files << "nyctest.txt"; importer.parseFiles(files); Recipe recipe; @@ -39,7 +39,7 @@ main(int argc, char *argv[]) recipe.categoryList.append( Element("Cookies & Squares",2) ); recipe.instructions = "Drop by spoonful on greased cookie sheet. Bake in moderate oven."; - //recipe.prepTime = QTime(0,30); + //recipe.prepTime = TQTime(0,30); recipe.authorList.append( Element("Colleen Beamer") ); diff --git a/krecipes/src/tests/recipemltest.cpp b/krecipes/src/tests/recipemltest.cpp index 30c8a9b..2566207 100644 --- a/krecipes/src/tests/recipemltest.cpp +++ b/krecipes/src/tests/recipemltest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -30,7 +30,7 @@ main(int argc, char *argv[]) RecipeMLImporter importer; printf("Parsing recipemltest.txt.\n"); - QStringList files; files << "recipemltest.txt"; + TQStringList files; files << "recipemltest.txt"; importer.parseFiles(files); Recipe recipe; @@ -42,7 +42,7 @@ main(int argc, char *argv[]) recipe.categoryList.append( Element("Cookies & Squares",2) ); recipe.instructions = "Drop by spoonful on greased cookie sheet. Bake in moderate oven."; - recipe.prepTime = QTime(0,30); + recipe.prepTime = TQTime(0,30); recipe.authorList.append( Element("Colleen Beamer") ); recipe.authorList.append( Element("Mona Beamer") ); @@ -85,7 +85,7 @@ main(int argc, char *argv[]) ing8.units.name = "c."; ing8.prepMethodList.append( Element("softened") ); ing8.prepMethodList.append( Element("at room temperature") ); - ing8.groupID = 1; ing8.group = "Fat & Liquids"; + ing8.groupID = 1; ing8.group = "Fat & Litquids"; recipe.ingList.append( ing8 ); Ingredient ing6; @@ -93,7 +93,7 @@ main(int argc, char *argv[]) ing6.amount = 1; ing6.amount_offset = 0; ing6.units.name = "c."; - ing6.groupID = 1; ing6.group = "Fat & Liquids"; + ing6.groupID = 1; ing6.group = "Fat & Litquids"; recipe.ingList.append( ing6 ); Ingredient ing5; @@ -101,7 +101,7 @@ main(int argc, char *argv[]) ing5.amount = 2; ing5.amount_offset = 0; ing5.units.plural = ""; - ing5.groupID = 1; ing5.group = "Fat & Liquids"; + ing5.groupID = 1; ing5.group = "Fat & Litquids"; recipe.ingList.append( ing5 ); Ingredient ing7; @@ -109,7 +109,7 @@ main(int argc, char *argv[]) ing7.amount = 1; ing7.amount_offset = 0; ing7.units.name = "tsp."; - ing7.groupID = 1; ing7.group = "Fat & Liquids"; + ing7.groupID = 1; ing7.group = "Fat & Litquids"; recipe.ingList.append( ing7 ); Ingredient ing9; @@ -146,9 +146,9 @@ main(int argc, char *argv[]) RecipeMLImporter importer2; printf("Parsing test.txt.\n"); - QStringList files2; files2 << "test.txt"; + TQStringList files2; files2 << "test.txt"; importer2.parseFiles(files2); - QFile::remove("test.txt"); + TQFile::remove("test.txt"); check( importer2, recipe ); printf("Recipe export successful.\n"); diff --git a/krecipes/src/tests/recipemltest.txt b/krecipes/src/tests/recipemltest.txt index 330f757..321a33c 100644 --- a/krecipes/src/tests/recipemltest.txt +++ b/krecipes/src/tests/recipemltest.txt @@ -63,7 +63,7 @@ - Fat & Liquids + Fat & Litquids 1 @@ -186,7 +186,7 @@ - Fat & Liquids + Fat & Litquids 1 diff --git a/krecipes/src/tests/rezkonvtest.cpp b/krecipes/src/tests/rezkonvtest.cpp index cd1e983..eae593f 100644 --- a/krecipes/src/tests/rezkonvtest.cpp +++ b/krecipes/src/tests/rezkonvtest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using std::cout; @@ -30,7 +30,7 @@ main(int argc, char *argv[]) RezkonvImporter importer; printf("Parsing rezkonvtest.txt.\n"); - QStringList files; files << "rezkonvtest.txt"; + TQStringList files; files << "rezkonvtest.txt"; importer.parseFiles(files); Recipe recipe; @@ -103,7 +103,7 @@ main(int argc, char *argv[]) ing8.units.name = "c."; ing8.prepMethodList.append( Element("softened") ); ing8.prepMethodList.append( Element("at room temperature") ); - ing8.groupID = 1; ing8.group = "Fat & Liquids"; + ing8.groupID = 1; ing8.group = "Fat & Litquids"; recipe.ingList.append( ing8 ); Ingredient ing6; @@ -111,7 +111,7 @@ main(int argc, char *argv[]) ing6.amount = 1; ing6.amount_offset = 0; ing6.units.name = "c."; - ing6.groupID = 1; ing6.group = "Fat & Liquids"; + ing6.groupID = 1; ing6.group = "Fat & Litquids"; recipe.ingList.append( ing6 ); Ingredient ing5; @@ -119,7 +119,7 @@ main(int argc, char *argv[]) ing5.amount = 2; ing5.amount_offset = 0; ing5.units.plural = ""; - ing5.groupID = 1; ing5.group = "Fat & Liquids"; + ing5.groupID = 1; ing5.group = "Fat & Litquids"; recipe.ingList.append( ing5 ); Ingredient ing7; @@ -127,7 +127,7 @@ main(int argc, char *argv[]) ing7.amount = 1; ing7.amount_offset = 0; ing7.units.name = "tsp."; - ing7.groupID = 1; ing7.group = "Fat & Liquids"; + ing7.groupID = 1; ing7.group = "Fat & Litquids"; recipe.ingList.append( ing7 ); check( importer, recipe ); @@ -145,9 +145,9 @@ main(int argc, char *argv[]) RezkonvImporter importer2; printf("Parsing test.txt.\n"); - QStringList files2; files2 << "test.txt"; + TQStringList files2; files2 << "test.txt"; importer2.parseFiles(files2); - QFile::remove("test.txt"); + TQFile::remove("test.txt"); check( importer2, recipe ); printf("Recipe export successful.\n"); diff --git a/krecipes/src/tests/rezkonvtest.txt b/krecipes/src/tests/rezkonvtest.txt index 38e4ac2..6e2dbda 100644 --- a/krecipes/src/tests/rezkonvtest.txt +++ b/krecipes/src/tests/rezkonvtest.txt @@ -13,7 +13,7 @@ Kategorien: Snacks, Cookies & Squares 2 c. all-purpose flour 1 tsp. baking soda -=========================== Fat & Liquids =========================== +=========================== Fat & Litquids =========================== 1 c. shortening, softened,at room temperature 1 c. peanut butter 2 eggs @@ -41,7 +41,7 @@ Kategorien: Snacks, Cookies & Squares 2 c. all-purpose flour 1 tsp. baking soda -=========================== Fat & Liquids =========================== +=========================== Fat & Litquids =========================== 1 c. shortening, softened,at room temperature 1 c. peanut butter 2 eggs diff --git a/krecipes/src/widgets/amountunitinput.cpp b/krecipes/src/widgets/amountunitinput.cpp index 8432544..b66b66c 100644 --- a/krecipes/src/widgets/amountunitinput.cpp +++ b/krecipes/src/widgets/amountunitinput.cpp @@ -10,15 +10,15 @@ #include "amountunitinput.h" -#include -#include +#include +#include #include "fractioninput.h" #include "unitcombobox.h" #include "backends/recipedb.h" #include "datablocks/mixednumber.h" -AmountUnitInput::AmountUnitInput( QWidget *parent, RecipeDB *database, Unit::Type type, MixedNumber::Format format ) : QHBox(parent), +AmountUnitInput::AmountUnitInput( TQWidget *parent, RecipeDB *database, Unit::Type type, MixedNumber::Format format ) : TQHBox(parent), m_item(0), m_database(database) { amountInput = new FractionInput(this,format); diff --git a/krecipes/src/widgets/amountunitinput.h b/krecipes/src/widgets/amountunitinput.h index a7a9ab5..0b2967e 100644 --- a/krecipes/src/widgets/amountunitinput.h +++ b/krecipes/src/widgets/amountunitinput.h @@ -13,33 +13,33 @@ #ifndef AMOUNTUNITINPUT_H #define AMOUNTUNITINPUT_H -#include +#include #include "datablocks/unit.h" #include "datablocks/mixednumber.h" -class QListViewItem; +class TQListViewItem; class RecipeDB; class FractionInput; class UnitComboBox; -class AmountUnitInput : public QHBox +class AmountUnitInput : public TQHBox { Q_OBJECT public: - AmountUnitInput( QWidget *parent, RecipeDB *database, Unit::Type type = Unit::All, MixedNumber::Format f = MixedNumber::MixedNumberFormat ); + AmountUnitInput( TQWidget *parent, RecipeDB *database, Unit::Type type = Unit::All, MixedNumber::Format f = MixedNumber::MixedNumberFormat ); void setAmount( const MixedNumber &amount ); void setUnit( const Unit &unit ); MixedNumber amount() const; Unit unit() const; - QListViewItem *item() const { return m_item; } - void setItem( QListViewItem *it ){ m_item = it; } + TQListViewItem *item() const { return m_item; } + void setItem( TQListViewItem *it ){ m_item = it; } - void insertIntoListview( QListViewItem *it, int col ); + void insertIntoListview( TQListViewItem *it, int col ); public slots: void emitValueChanged(); @@ -52,7 +52,7 @@ private: FractionInput *amountInput; UnitComboBox *unitBox; - QListViewItem *m_item; + TQListViewItem *m_item; RecipeDB *m_database; }; diff --git a/krecipes/src/widgets/authorlistview.cpp b/krecipes/src/widgets/authorlistview.cpp index cfc4b70..17c3d4d 100644 --- a/krecipes/src/widgets/authorlistview.cpp +++ b/krecipes/src/widgets/authorlistview.cpp @@ -21,10 +21,10 @@ #include "dialogs/createelementdialog.h" #include "dialogs/dependanciesdialog.h" -AuthorListView::AuthorListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->authorCount() ) +AuthorListView::AuthorListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->authorCount() ) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void AuthorListView::init() @@ -52,7 +52,7 @@ void AuthorListView::checkCreateAuthor( const Element &el ) } -StdAuthorListView::StdAuthorListView( QWidget *parent, RecipeDB *db, bool editable ) : AuthorListView( parent, db ) +StdAuthorListView::StdAuthorListView( TQWidget *parent, RecipeDB *db, bool editable ) : AuthorListView( parent, db ) { addColumn( i18n( "Author" ) ); @@ -75,13 +75,13 @@ StdAuthorListView::StdAuthorListView( QWidget *parent, RecipeDB *db, bool editab delete il; - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( modAuthor( QListViewItem* ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem* ) ), this, SLOT( saveAuthor( QListViewItem* ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem* ) ), this, SLOT( modAuthor( TQListViewItem* ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem* ) ), this, SLOT( saveAuthor( TQListViewItem* ) ) ); } } -void StdAuthorListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdAuthorListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -91,8 +91,8 @@ void StdAuthorListView::createNew() { CreateElementDialog * elementDialog = new CreateElementDialog( this, i18n( "New Author" ) ); - if ( elementDialog->exec() == QDialog::Accepted ) { - QString result = elementDialog->newElementName(); + if ( elementDialog->exec() == TQDialog::Accepted ) { + TQString result = elementDialog->newElementName(); //check bounds first if ( checkBounds( result ) ) @@ -103,7 +103,7 @@ void StdAuthorListView::createNew() void StdAuthorListView::remove () { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) { int id = item->text( 1 ).toInt(); @@ -125,7 +125,7 @@ void StdAuthorListView::remove info.name = i18n("Recipes"); DependanciesDialog warnDialog( this, info, false ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removeAuthor( id ); } } @@ -133,7 +133,7 @@ void StdAuthorListView::remove void StdAuthorListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) AuthorListView::rename( item, 0 ); @@ -141,22 +141,22 @@ void StdAuthorListView::rename() void StdAuthorListView::createAuthor( const Element &author ) { - createElement(new QListViewItem( this, author.name, QString::number( author.id ) )); + createElement(new TQListViewItem( this, author.name, TQString::number( author.id ) )); } void StdAuthorListView::removeAuthor( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } -void StdAuthorListView::modAuthor( QListViewItem* i ) +void StdAuthorListView::modAuthor( TQListViewItem* i ) { if ( i ) AuthorListView::rename( i, 0 ); } -void StdAuthorListView::saveAuthor( QListViewItem* i ) +void StdAuthorListView::saveAuthor( TQListViewItem* i ) { if ( !checkBounds( i->text( 0 ) ) ) { reload(ForceReload); //reset the changed text @@ -183,10 +183,10 @@ void StdAuthorListView::saveAuthor( QListViewItem* i ) } } -bool StdAuthorListView::checkBounds( const QString &name ) +bool StdAuthorListView::checkBounds( const TQString &name ) { if ( name.length() > uint(database->maxAuthorNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Author name cannot be longer than %1 characters." ) ).arg( database->maxAuthorNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Author name cannot be longer than %1 characters." ) ).arg( database->maxAuthorNameLength() ) ); return false; } @@ -194,13 +194,13 @@ bool StdAuthorListView::checkBounds( const QString &name ) } -AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, const Element &author ) : QCheckListItem( qlv, QString::null, QCheckListItem::CheckBox ), +AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, const Element &author ) : TQCheckListItem( qlv, TQString::null, TQCheckListItem::CheckBox ), authorStored(author), m_listview(qlv) { } -AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, QListViewItem *after, const Element &author ) : QCheckListItem( qlv, after, QString::null, QCheckListItem::CheckBox ), +AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, TQListViewItem *after, const Element &author ) : TQCheckListItem( qlv, after, TQString::null, TQCheckListItem::CheckBox ), authorStored(author), m_listview(qlv) { @@ -211,15 +211,15 @@ Element AuthorCheckListItem::author() const return authorStored; } -QString AuthorCheckListItem::text( int column ) const +TQString AuthorCheckListItem::text( int column ) const { switch ( column ) { case 0: return ( authorStored.name ); case 1: - return ( QString::number( authorStored.id ) ); + return ( TQString::number( authorStored.id ) ); default: - return QString::null; + return TQString::null; } } @@ -229,7 +229,7 @@ void AuthorCheckListItem::stateChange( bool on ) } -AuthorCheckListView::AuthorCheckListView( QWidget *parent, RecipeDB *db ) : AuthorListView( parent, db ) +AuthorCheckListView::AuthorCheckListView( TQWidget *parent, RecipeDB *db ) : AuthorListView( parent, db ) { addColumn( i18n( "Author" ) ); @@ -246,7 +246,7 @@ void AuthorCheckListView::createAuthor( const Element &author ) void AuthorCheckListView::removeAuthor( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } @@ -254,8 +254,8 @@ void AuthorCheckListView::load( int limit, int offset ) { AuthorListView::load(limit,offset); - for ( QValueList::const_iterator author_it = m_selections.begin(); author_it != m_selections.end(); ++author_it ) { - QCheckListItem * item = ( QCheckListItem* ) findItem( QString::number( (*author_it).id ), 1 ); + for ( TQValueList::const_iterator author_it = m_selections.begin(); author_it != m_selections.end(); ++author_it ) { + TQCheckListItem * item = ( TQCheckListItem* ) findItem( TQString::number( (*author_it).id ), 1 ); if ( item ) { item->setOn(true); } diff --git a/krecipes/src/widgets/authorlistview.h b/krecipes/src/widgets/authorlistview.h index 2b6faa8..9718b4c 100644 --- a/krecipes/src/widgets/authorlistview.h +++ b/krecipes/src/widgets/authorlistview.h @@ -20,15 +20,15 @@ class KPopupMenu; class AuthorCheckListView; -class AuthorCheckListItem: public QCheckListItem +class AuthorCheckListItem: public TQCheckListItem { public: AuthorCheckListItem( AuthorCheckListView* qlv, const Element &author ); - AuthorCheckListItem( AuthorCheckListView* qlv, QListViewItem *after, const Element &author ); + AuthorCheckListItem( AuthorCheckListView* qlv, TQListViewItem *after, const Element &author ); Element author() const; - virtual QString text( int column ) const; + virtual TQString text( int column ) const; protected: virtual void stateChange( bool on ); @@ -44,7 +44,7 @@ class AuthorListView : public DBListViewBase Q_OBJECT public: - AuthorListView( QWidget *parent, RecipeDB *db ); + AuthorListView( TQWidget *parent, RecipeDB *db ); protected slots: void checkCreateAuthor( const Element &el ); @@ -61,25 +61,25 @@ class StdAuthorListView : public AuthorListView Q_OBJECT public: - StdAuthorListView( QWidget *parent, RecipeDB *db, bool editable = false ); + StdAuthorListView( TQWidget *parent, RecipeDB *db, bool editable = false ); protected: virtual void createAuthor( const Element & ); virtual void removeAuthor( int ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove (); void rename(); - void modAuthor( QListViewItem* i ); - void saveAuthor( QListViewItem* i ); + void modAuthor( TQListViewItem* i ); + void saveAuthor( TQListViewItem* i ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); KPopupMenu *kpop; }; @@ -88,11 +88,11 @@ private: class AuthorCheckListView : public AuthorListView { public: - AuthorCheckListView( QWidget *parent, RecipeDB *db ); + AuthorCheckListView( TQWidget *parent, RecipeDB *db ); virtual void stateChange(AuthorCheckListItem *,bool); - QValueList selections() const{ return m_selections; } + TQValueList selections() const{ return m_selections; } protected: virtual void createAuthor( const Element &ing ); @@ -101,7 +101,7 @@ protected: virtual void load( int limit, int offset ); private: - QValueList m_selections; + TQValueList m_selections; }; #endif //AUTHORLISTVIEW_H diff --git a/krecipes/src/widgets/categorycombobox.cpp b/krecipes/src/widgets/categorycombobox.cpp index 7ff75b4..17ede42 100644 --- a/krecipes/src/widgets/categorycombobox.cpp +++ b/krecipes/src/widgets/categorycombobox.cpp @@ -12,7 +12,7 @@ #include "categorycombobox.h" -#include +#include #include #include @@ -23,7 +23,7 @@ #include "datablocks/elementlist.h" #include "datablocks/categorytree.h" -CategoryComboBox::CategoryComboBox( QWidget *parent, RecipeDB *db ) : KComboBox( parent ), +CategoryComboBox::CategoryComboBox( TQWidget *parent, RecipeDB *db ) : KComboBox( parent ), database( db ), m_offset(0) { @@ -46,7 +46,7 @@ void CategoryComboBox::popup() void CategoryComboBox::reload() { - QString remember_cat_filter = currentText(); + TQString remember_cat_filter = currentText(); KConfig * config = KGlobal::config();config->setGroup( "Performance" ); int limit = config->readNumEntry( "CategoryLimit", -1 ); @@ -67,7 +67,7 @@ void CategoryComboBox::reload() int row = 1; loadCategories(&categoryList,row); - if ( listBox() ->findItem( remember_cat_filter, Qt::ExactMatch ) ) { + if ( listBox() ->findItem( remember_cat_filter, TQt::ExactMatch ) ) { setCurrentText( remember_cat_filter ); } } @@ -117,8 +117,8 @@ void CategoryComboBox::createCategory( const Element &element, int /*parent_id*/ insertItem( element.name, row ); //now update the map by pushing everything after this item down - QMap new_map; - for ( QMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { if ( it.key() >= row ) { new_map.insert( it.key() + 1, it.data() ); } @@ -132,7 +132,7 @@ void CategoryComboBox::createCategory( const Element &element, int /*parent_id*/ void CategoryComboBox::removeCategory( int id ) { int row = -1; - for ( QMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + for ( TQMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { if ( it.data() == id ) { row = it.key(); removeItem( row ); @@ -145,8 +145,8 @@ void CategoryComboBox::removeCategory( int id ) return ; //now update the map by pushing everything after this item up - QMap new_map; - for ( QMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { if ( it.key() > row ) { new_map.insert( it.key() - 1, it.data() ); } @@ -158,7 +158,7 @@ void CategoryComboBox::removeCategory( int id ) void CategoryComboBox::modifyCategory( const Element &element ) { - for ( QMap::const_iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + for ( TQMap::const_iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { if ( it.data() == element.id ) changeItem( element.name, it.key() ); } @@ -169,10 +169,10 @@ void CategoryComboBox::mergeCategories( int /*to_id*/, int from_id ) removeCategory( from_id ); } -int CategoryComboBox::findInsertionPoint( const QString &name ) +int CategoryComboBox::findInsertionPoint( const TQString &name ) { for ( int i = 1; i < count(); i++ ) { - if ( QString::localeAwareCompare( name, text( i ) ) < 0 ) + if ( TQString::localeAwareCompare( name, text( i ) ) < 0 ) return i; } diff --git a/krecipes/src/widgets/categorycombobox.h b/krecipes/src/widgets/categorycombobox.h index 5bb8186..71a7617 100644 --- a/krecipes/src/widgets/categorycombobox.h +++ b/krecipes/src/widgets/categorycombobox.h @@ -15,7 +15,7 @@ #include -#include +#include #include "datablocks/element.h" @@ -27,7 +27,7 @@ class CategoryComboBox : public KComboBox Q_OBJECT public: - CategoryComboBox( QWidget *parent, RecipeDB *db ); + CategoryComboBox( TQWidget *parent, RecipeDB *db ); void reload(); int id( int row ); @@ -45,13 +45,13 @@ private slots: void modifyCategory( const Element &element ); void mergeCategories( int /*to_id*/, int from_id ); - int findInsertionPoint( const QString &name ); + int findInsertionPoint( const TQString &name ); private: void loadCategories( CategoryTree *categoryList, int &row ); RecipeDB *database; - QMap categoryComboRows; // Contains the category id for every given row in the category combobox + TQMap categoryComboRows; // Contains the category id for every given row in the category combobox int m_offset; }; diff --git a/krecipes/src/widgets/categorylistview.cpp b/krecipes/src/widgets/categorylistview.cpp index 35186a7..c243d48 100644 --- a/krecipes/src/widgets/categorylistview.cpp +++ b/krecipes/src/widgets/categorylistview.cpp @@ -25,7 +25,7 @@ #include "dialogs/createcategorydialog.h" #include "dialogs/dependanciesdialog.h" -CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const Element &category, bool _exclusive ) : QCheckListItem( klv, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ), +CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const Element &category, bool _exclusive ) : TQCheckListItem( klv, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ), locked( false ), exclusive( _exclusive ), m_listview(klv) @@ -33,7 +33,7 @@ CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const setOn( false ); // Set unchecked by default } -CategoryCheckListItem::CategoryCheckListItem( QListViewItem* it, const Element &category, bool _exclusive ) : QCheckListItem( it, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ), +CategoryCheckListItem::CategoryCheckListItem( TQListViewItem* it, const Element &category, bool _exclusive ) : TQCheckListItem( it, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ), locked( false ), exclusive( _exclusive ), m_listview((CategoryCheckListView*)it->listView()) @@ -41,7 +41,7 @@ CategoryCheckListItem::CategoryCheckListItem( QListViewItem* it, const Element & setOn( false ); // Set unchecked by default } -CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, QListViewItem* it, const Element &category, bool _exclusive ) : QCheckListItem( klv, it, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ), +CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, TQListViewItem* it, const Element &category, bool _exclusive ) : TQCheckListItem( klv, it, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ), locked( false ), exclusive( _exclusive ), m_listview(klv) @@ -49,15 +49,15 @@ CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, QListV setOn( false ); // Set unchecked by default } -QString CategoryCheckListItem::text( int column ) const +TQString CategoryCheckListItem::text( int column ) const { if ( column == 1 ) - return ( QString::number( ctyStored.id ) ); + return ( TQString::number( ctyStored.id ) ); else return ( ctyStored.name ); } -void CategoryCheckListItem::setText( int column, const QString &text ) +void CategoryCheckListItem::setText( int column, const TQString &text ) { switch ( column ) { case 0: @@ -108,27 +108,27 @@ void CategoryCheckListItem::setParentsState( bool on ) -CategoryListItem::CategoryListItem( QListView* klv, const Element &category ) : QListViewItem( klv ), +CategoryListItem::CategoryListItem( TQListView* klv, const Element &category ) : TQListViewItem( klv ), CategoryItemInfo(category) {} -CategoryListItem::CategoryListItem( QListViewItem* it, const Element &category ) : QListViewItem( it ), +CategoryListItem::CategoryListItem( TQListViewItem* it, const Element &category ) : TQListViewItem( it ), CategoryItemInfo(category) {} -CategoryListItem::CategoryListItem( QListView* klv, QListViewItem* it, const Element &category ) : QListViewItem( klv, it ), +CategoryListItem::CategoryListItem( TQListView* klv, TQListViewItem* it, const Element &category ) : TQListViewItem( klv, it ), CategoryItemInfo(category) {} -QString CategoryListItem::text( int column ) const +TQString CategoryListItem::text( int column ) const { if ( column == 1 ) - return ( QString::number( ctyStored.id ) ); + return ( TQString::number( ctyStored.id ) ); else return ( ctyStored.name ); } -void CategoryListItem::setText( int column, const QString &text ) +void CategoryListItem::setText( int column, const TQString &text ) { if ( column == 0 ) ctyStored.name = text; @@ -136,18 +136,18 @@ void CategoryListItem::setText( int column, const QString &text ) -CategoryListView::CategoryListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->categoryTopLevelCount() ), +CategoryListView::CategoryListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->categoryTopLevelCount() ), m_item_to_delete(0) { - //connect( this, SIGNAL( spacePressed(QListViewItem*) ), SLOT( open(QListViewItem*) ) ); - //connect( this, SIGNAL( returnPressed(QListViewItem*) ), SLOT( open(QListViewItem*) ) ); - //connect( this, SIGNAL( executed(QListViewItem*) ), SLOT( open(QListViewItem*) ) ); + //connect( this, SIGNAL( spacePressed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) ); + //connect( this, SIGNAL( returnPressed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) ); + //connect( this, SIGNAL( executed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) ); - connect( this, SIGNAL( expanded(QListViewItem*) ), SLOT( open(QListViewItem*) ) ); + connect( this, SIGNAL( expanded(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) ); setRootIsDecorated( true ); setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void CategoryListView::init() @@ -175,7 +175,7 @@ void CategoryListView::load( int limit, int offset ) } } -void CategoryListView::populate( QListViewItem *item ) +void CategoryListView::populate( TQListViewItem *item ) { CategoryItemInfo *cat_item = dynamic_cast(item); if ( !cat_item || cat_item->isPopulated() ) return; @@ -196,19 +196,19 @@ void CategoryListView::populate( QListViewItem *item ) } } -void CategoryListView::populateAll( QListViewItem *parent ) +void CategoryListView::populateAll( TQListViewItem *parent ) { if ( !parent ) parent = firstChild(); - for ( QListViewItem *item = parent; item; item = item->nextSibling() ) { + for ( TQListViewItem *item = parent; item; item = item->nextSibling() ) { populate( item ); if ( item->firstChild() ) populateAll( item->firstChild() ); } } -void CategoryListView::open( QListViewItem *item ) +void CategoryListView::open( TQListViewItem *item ) { Q_ASSERT( item ); if ( !item->firstChild() || item->firstChild()->rtti() != PSEUDOLISTITEM_RTTI ) return; @@ -227,7 +227,7 @@ void CategoryListView::checkCreateCategory( const Element &el, int parent_id ) void CategoryListView::modifyCategory( const Element &category ) { - QListViewItem * item = items_map[ category.id ]; + TQListViewItem * item = items_map[ category.id ]; if ( item ) item->setText( 0, category.name ); @@ -235,9 +235,9 @@ void CategoryListView::modifyCategory( const Element &category ) void CategoryListView::modifyCategory( int id, int parent_id ) { - QMap::iterator item_it = items_map.find(id); + TQMap::iterator item_it = items_map.find(id); if ( item_it != items_map.end() ) { - QListViewItem *item = *item_it; + TQListViewItem *item = *item_it; Q_ASSERT( item ); removeElement(item,false); @@ -251,7 +251,7 @@ void CategoryListView::modifyCategory( int id, int parent_id ) createElement(item); } else { - QMap::iterator parent_item_it = items_map.find(parent_id); + TQMap::iterator parent_item_it = items_map.find(parent_id); if ( parent_item_it != items_map.end() && dynamic_cast(*parent_item_it)->isPopulated() ) { (*parent_item_it)->insertItem( item ); @@ -272,15 +272,15 @@ void CategoryListView::modifyCategory( int id, int parent_id ) void CategoryListView::mergeCategories( int id1, int id2 ) { - QListViewItem * to_item = items_map[ id1 ]; - QListViewItem *from_item = items_map[ id2 ]; + TQListViewItem * to_item = items_map[ id1 ]; + TQListViewItem *from_item = items_map[ id2 ]; CategoryItemInfo *info_item = dynamic_cast(to_item); if ( to_item && info_item->isPopulated() && from_item ) { //note that this takes care of any recipes that may be children as well - QListViewItem *next_sibling; - for ( QListViewItem * it = from_item->firstChild(); it; it = next_sibling ) { + TQListViewItem *next_sibling; + for ( TQListViewItem * it = from_item->firstChild(); it; it = next_sibling ) { next_sibling = it->nextSibling(); //get the sibling before we move the item removeElement(it,false); @@ -295,7 +295,7 @@ void CategoryListView::mergeCategories( int id1, int id2 ) } -StdCategoryListView::StdCategoryListView( QWidget *parent, RecipeDB *db, bool editable ) : CategoryListView( parent, db ), +StdCategoryListView::StdCategoryListView( TQWidget *parent, RecipeDB *db, bool editable ) : CategoryListView( parent, db ), clipboard_item( 0 ), clipboard_parent( 0 ) { @@ -327,10 +327,10 @@ StdCategoryListView::StdCategoryListView( QWidget *parent, RecipeDB *db, bool ed delete il; connect( kpop, SIGNAL( aboutToShow() ), SLOT( preparePopup() ) ); - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), SLOT( modCategory( QListViewItem* ) ) ); - connect( this, SIGNAL( itemRenamed ( QListViewItem* ) ), SLOT( saveCategory( QListViewItem* ) ) ); - connect( this, SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ), SLOT( changeCategoryParent( QListViewItem *, QListViewItem *, QListViewItem * ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), SLOT( modCategory( TQListViewItem* ) ) ); + connect( this, SIGNAL( itemRenamed ( TQListViewItem* ) ), SLOT( saveCategory( TQListViewItem* ) ) ); + connect( this, SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ), SLOT( changeCategoryParent( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) ); } } @@ -339,7 +339,7 @@ StdCategoryListView::~StdCategoryListView() delete clipboard_item; } -void StdCategoryListView::setPixmap( const QPixmap &icon ) +void StdCategoryListView::setPixmap( const TQPixmap &icon ) { m_folder_icon = icon; } @@ -351,7 +351,7 @@ void StdCategoryListView::preparePopup() kpop->setItemEnabled( kpop->idAt( 6 ), clipboard_item ); } -void StdCategoryListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdCategoryListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -363,8 +363,8 @@ void StdCategoryListView::createNew() database->loadCategories( &categories ); CreateCategoryDialog* categoryDialog = new CreateCategoryDialog( this, categories ); - if ( categoryDialog->exec() == QDialog::Accepted ) { - QString result = categoryDialog->newCategoryName(); + if ( categoryDialog->exec() == TQDialog::Accepted ) { + TQString result = categoryDialog->newCategoryName(); int subcategory = categoryDialog->subcategory(); //check bounds first @@ -377,7 +377,7 @@ void StdCategoryListView::createNew() void StdCategoryListView::remove () { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) { int id = item->text( 1 ).toInt(); @@ -399,7 +399,7 @@ void StdCategoryListView::remove info.name = i18n("Recipes"); DependanciesDialog warnDialog( this, info, false ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removeCategory( id ); } } @@ -407,7 +407,7 @@ void StdCategoryListView::remove void StdCategoryListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) CategoryListView::rename( item, 0 ); @@ -424,7 +424,7 @@ void StdCategoryListView::cut() clipboard_item = 0; } - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); if ( item ) { clipboard_item = item; @@ -439,7 +439,7 @@ void StdCategoryListView::cut() void StdCategoryListView::paste() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item && clipboard_item ) { if ( item->parent() ) item->parent() ->insertItem( clipboard_item ); @@ -453,7 +453,7 @@ void StdCategoryListView::paste() void StdCategoryListView::pasteAsSub() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item && clipboard_item ) { item->insertItem( clipboard_item ); @@ -462,22 +462,22 @@ void StdCategoryListView::pasteAsSub() } } -void StdCategoryListView::changeCategoryParent( QListViewItem *item, QListViewItem * /*afterFirst*/, QListViewItem * /*afterNow*/ ) +void StdCategoryListView::changeCategoryParent( TQListViewItem *item, TQListViewItem * /*afterFirst*/, TQListViewItem * /*afterNow*/ ) { int new_parent_id = -1; - if ( QListViewItem * parent = item->parent() ) + if ( TQListViewItem * parent = item->parent() ) new_parent_id = parent->text( 1 ).toInt(); int cat_id = item->text( 1 ).toInt(); - disconnect( SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ) ); + disconnect( SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) ); database->modCategory( cat_id, new_parent_id ); - connect( this, SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ), SLOT( changeCategoryParent( QListViewItem *, QListViewItem *, QListViewItem * ) ) ); + connect( this, SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ), SLOT( changeCategoryParent( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) ); } void StdCategoryListView::removeCategory( int id ) { - QListViewItem * item = items_map[ id ]; + TQListViewItem * item = items_map[ id ]; items_map.remove( id ); removeElement(item); @@ -505,7 +505,7 @@ void StdCategoryListView::createCategory( const Element &category, int parent_id if ( new_item ) { items_map.insert( category.id, new_item ); new_item->setPixmap( 0, m_folder_icon ); - createElement(new_item);//new QListViewItem(new_item); + createElement(new_item);//new TQListViewItem(new_item); CategoryTree list; CategoryTree *p_list = &list; @@ -516,13 +516,13 @@ void StdCategoryListView::createCategory( const Element &category, int parent_id } } -void StdCategoryListView::modCategory( QListViewItem* i ) +void StdCategoryListView::modCategory( TQListViewItem* i ) { if ( i ) CategoryListView::rename( i, 0 ); } -void StdCategoryListView::saveCategory( QListViewItem* i ) +void StdCategoryListView::saveCategory( TQListViewItem* i ) { CategoryListItem * cat_it = ( CategoryListItem* ) i; @@ -550,10 +550,10 @@ void StdCategoryListView::saveCategory( QListViewItem* i ) database->modCategory( cat_id, cat_it->categoryName() ); } -bool StdCategoryListView::checkBounds( const QString &name ) +bool StdCategoryListView::checkBounds( const TQString &name ) { if ( name.length() > uint(database->maxCategoryNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Category name cannot be longer than %1 characters." ) ).arg( database->maxCategoryNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Category name cannot be longer than %1 characters." ) ).arg( database->maxCategoryNameLength() ) ); return false; } @@ -562,7 +562,7 @@ bool StdCategoryListView::checkBounds( const QString &name ) -CategoryCheckListView::CategoryCheckListView( QWidget *parent, RecipeDB *db, bool _exclusive, const ElementList &init_items_checked ) : CategoryListView( parent, db ), +CategoryCheckListView::CategoryCheckListView( TQWidget *parent, RecipeDB *db, bool _exclusive, const ElementList &init_items_checked ) : CategoryListView( parent, db ), exclusive(_exclusive) { addColumn( i18n( "Category" ) ); @@ -578,7 +578,7 @@ CategoryCheckListView::CategoryCheckListView( QWidget *parent, RecipeDB *db, boo void CategoryCheckListView::removeCategory( int id ) { - QListViewItem * item = items_map[ id ]; + TQListViewItem * item = items_map[ id ]; items_map.remove( id ); removeElement(item); @@ -591,7 +591,7 @@ void CategoryCheckListView::createCategory( const Element &category, int parent_ new_item = new CategoryCheckListItem( this, category, exclusive ); } else { - QListViewItem *parent = items_map[ parent_id ]; + TQListViewItem *parent = items_map[ parent_id ]; if ( parent ) new_item = new CategoryCheckListItem( parent, category, exclusive ); } @@ -626,8 +626,8 @@ void CategoryCheckListView::load( int limit, int offset ) { CategoryListView::load(limit,offset); - for ( QValueList::const_iterator it = m_selections.begin(); it != m_selections.end(); ++it ) { - QCheckListItem * item = ( QCheckListItem* ) findItem( QString::number( (*it).id ), 1 ); + for ( TQValueList::const_iterator it = m_selections.begin(); it != m_selections.end(); ++it ) { + TQCheckListItem * item = ( TQCheckListItem* ) findItem( TQString::number( (*it).id ), 1 ); if ( item ) { item->setOn(true); } diff --git a/krecipes/src/widgets/categorylistview.h b/krecipes/src/widgets/categorylistview.h index 6b894a5..630653a 100644 --- a/krecipes/src/widgets/categorylistview.h +++ b/krecipes/src/widgets/categorylistview.h @@ -12,8 +12,8 @@ #ifndef CATEGORYLISTVIEW_H #define CATEGORYLISTVIEW_H -#include -#include +#include +#include #include "dblistviewbase.h" @@ -47,7 +47,7 @@ public: { return ctyStored.id; } - QString categoryName() const + TQString categoryName() const { return ctyStored.name; } @@ -59,15 +59,15 @@ private: bool populated; }; -class CategoryCheckListItem : public QCheckListItem, public CategoryItemInfo +class CategoryCheckListItem : public TQCheckListItem, public CategoryItemInfo { public: CategoryCheckListItem( CategoryCheckListView* klv, const Element &category, bool exclusive = true ); - CategoryCheckListItem( QListViewItem* it, const Element &category, bool exclusive = true ); - CategoryCheckListItem( CategoryCheckListView* klv, QListViewItem* it, const Element &category, bool exclusive = true ); + CategoryCheckListItem( TQListViewItem* it, const Element &category, bool exclusive = true ); + CategoryCheckListItem( CategoryCheckListView* klv, TQListViewItem* it, const Element &category, bool exclusive = true ); - virtual QString text( int column ) const; - virtual void setText( int column, const QString &text ); + virtual TQString text( int column ) const; + virtual void setText( int column, const TQString &text ); int rtti() const { @@ -87,15 +87,15 @@ private: }; -class CategoryListItem : public QListViewItem, public CategoryItemInfo +class CategoryListItem : public TQListViewItem, public CategoryItemInfo { public: - CategoryListItem( QListView* klv, const Element &category ); - CategoryListItem( QListViewItem* it, const Element &category ); - CategoryListItem( QListView* klv, QListViewItem* it, const Element &category ); + CategoryListItem( TQListView* klv, const Element &category ); + CategoryListItem( TQListViewItem* it, const Element &category ); + CategoryListItem( TQListView* klv, TQListViewItem* it, const Element &category ); - virtual QString text( int column ) const; - virtual void setText( int column, const QString &text ); + virtual TQString text( int column ) const; + virtual void setText( int column, const TQString &text ); int rtti() const { @@ -110,12 +110,12 @@ class CategoryListView : public DBListViewBase Q_OBJECT public: - CategoryListView( QWidget *parent, RecipeDB * ); + CategoryListView( TQWidget *parent, RecipeDB * ); - void populateAll( QListViewItem *parent = 0 ); + void populateAll( TQListViewItem *parent = 0 ); public slots: - void open( QListViewItem *item ); + void open( TQListViewItem *item ); protected: virtual void init(); @@ -126,14 +126,14 @@ protected: * subchildren that aren't expandable. The code is taken from KDE's KListView with * one line commented out. */ - void findDrop( const QPoint &pos, QListViewItem *&parent, QListViewItem *&after ) + void findDrop( const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after ) { - QPoint p ( contentsToViewport( pos ) ); + TQPoint p ( contentsToViewport( pos ) ); // Get the position to put it in - QListViewItem *atpos = itemAt( p ); + TQListViewItem *atpos = itemAt( p ); - QListViewItem *above; + TQListViewItem *above; if ( !atpos ) // put it at the end above = lastItem(); else { @@ -170,8 +170,8 @@ protected: // Ok, there's one more level of complexity. We may want to become a new // sibling, but of an upper-level group, rather than the "above" item - QListViewItem * betterAbove = above->parent(); - QListViewItem * last = above; + TQListViewItem * betterAbove = above->parent(); + TQListViewItem * last = above; while ( betterAbove ) { // We are allowed to become a sibling of "betterAbove" only if we are // after its last child @@ -200,12 +200,12 @@ protected slots: virtual void mergeCategories( int id1, int id2 ); virtual void checkCreateCategory( const Element &, int parent_id ); - virtual void populate( QListViewItem *item ); + virtual void populate( TQListViewItem *item ); - QMap items_map; + TQMap items_map; private: - QListViewItem *m_item_to_delete; + TQListViewItem *m_item_to_delete; }; @@ -214,18 +214,18 @@ class StdCategoryListView : public CategoryListView Q_OBJECT public: - StdCategoryListView( QWidget *parent, RecipeDB *, bool editable = false ); + StdCategoryListView( TQWidget *parent, RecipeDB *, bool editable = false ); ~StdCategoryListView(); protected: virtual void removeCategory( int id ); virtual void createCategory( const Element &category, int parent_id ); - void setPixmap( const QPixmap &pixmap ); + void setPixmap( const TQPixmap &pixmap ); private slots: void preparePopup(); - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove @@ -235,19 +235,19 @@ private slots: void paste(); void pasteAsSub(); - void changeCategoryParent( QListViewItem *item, QListViewItem * /*afterFirst*/, QListViewItem * /*afterNow*/ ); + void changeCategoryParent( TQListViewItem *item, TQListViewItem * /*afterFirst*/, TQListViewItem * /*afterNow*/ ); - void modCategory( QListViewItem* i ); - void saveCategory( QListViewItem* i ); + void modCategory( TQListViewItem* i ); + void saveCategory( TQListViewItem* i ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); KPopupMenu *kpop; - QListViewItem *clipboard_item; - QListViewItem *clipboard_parent; + TQListViewItem *clipboard_item; + TQListViewItem *clipboard_parent; - QPixmap m_folder_icon; + TQPixmap m_folder_icon; }; @@ -256,7 +256,7 @@ class CategoryCheckListView : public CategoryListView Q_OBJECT public: - CategoryCheckListView( QWidget *parent, RecipeDB *, bool exclusive=true, const ElementList &init_items_checked = ElementList() ); + CategoryCheckListView( TQWidget *parent, RecipeDB *, bool exclusive=true, const ElementList &init_items_checked = ElementList() ); virtual void stateChange( CategoryCheckListItem*, bool ); @@ -275,11 +275,11 @@ private: }; -class PseudoListItem : public QListViewItem +class PseudoListItem : public TQListViewItem { public: - PseudoListItem( QListView* lv ) : QListViewItem(lv){} - PseudoListItem( QListViewItem* it ) : QListViewItem(it){} + PseudoListItem( TQListView* lv ) : TQListViewItem(lv){} + PseudoListItem( TQListViewItem* it ) : TQListViewItem(it){} protected: int rtti() const { return PSEUDOLISTITEM_RTTI; } diff --git a/krecipes/src/widgets/conversiontable.cpp b/krecipes/src/widgets/conversiontable.cpp index 07abf0c..b444104 100644 --- a/krecipes/src/widgets/conversiontable.cpp +++ b/krecipes/src/widgets/conversiontable.cpp @@ -15,24 +15,24 @@ #include "datablocks/mixednumber.h" #include "widgets/fractioninput.h" -#include +#include #include #include -class ConversionTableToolTip : public QToolTip +class ConversionTableToolTip : public TQToolTip { public: - ConversionTableToolTip( ConversionTable *t ) : QToolTip( t->viewport() ), + ConversionTableToolTip( ConversionTable *t ) : TQToolTip( t->viewport() ), table( t ) {} - void maybeTip( const QPoint &pos ) + void maybeTip( const TQPoint &pos ) { if ( !table ) return ; - QPoint cp = table->viewportToContents( pos ); + TQPoint cp = table->viewportToContents( pos ); int row = table->rowAt( cp.y() ); int col = table->columnAt( cp.x() ); @@ -40,22 +40,22 @@ public: if ( row == col ) return ; - QString row_unit = table->verticalHeader() ->label( row ); - QString col_unit = table->horizontalHeader() ->label( col ); - QString text = table->text( row, col ); + TQString row_unit = table->verticalHeader() ->label( row ); + TQString col_unit = table->horizontalHeader() ->label( col ); + TQString text = table->text( row, col ); if ( text.isEmpty() ) text = "X"; //### Is this i18n friendly??? - QRect cr = table->cellGeometry( row, col ); + TQRect cr = table->cellGeometry( row, col ); cr.moveTopLeft( table->contentsToViewport( cr.topLeft() ) ); - tip( cr, QString( "1 %1 = %2 %3" ).arg( row_unit ).arg( text ).arg( col_unit ) ); + tip( cr, TQString( "1 %1 = %2 %3" ).arg( row_unit ).arg( text ).arg( col_unit ) ); } private: ConversionTable *table; }; -ConversionTable::ConversionTable( QWidget* parent, int maxrows, int maxcols ) : QTable( maxrows, maxcols, parent, "table" ) +ConversionTable::ConversionTable( TQWidget* parent, int maxrows, int maxcols ) : TQTable( maxrows, maxcols, parent, "table" ) { editBoxValue = -1; items.setAutoDelete( true ); @@ -85,12 +85,12 @@ void ConversionTable::unitCreated( const Unit &unit ) verticalHeader() ->setLabel( numCols() - 1, unit.name ); } -QTableItem* ConversionTable::item( int r, int c ) const +TQTableItem* ConversionTable::item( int r, int c ) const { return items.find( indexOf( r, c ) ); } -void ConversionTable::setItem( int r, int c, QTableItem *i ) +void ConversionTable::setItem( int r, int c, TQTableItem *i ) { items.replace( indexOf( r, c ), i ); i->setRow( r ); // Otherwise the item @@ -103,49 +103,49 @@ void ConversionTable::clearCell( int r, int c ) items.remove( indexOf( r, c ) ); } -void ConversionTable::takeItem( QTableItem *item ) +void ConversionTable::takeItem( TQTableItem *item ) { items.setAutoDelete( false ); items.remove( indexOf( item->row(), item->col() ) ); items.setAutoDelete( true ); } -void ConversionTable::insertWidget( int r, int c, QWidget *w ) +void ConversionTable::insertWidget( int r, int c, TQWidget *w ) { widgets.replace( indexOf( r, c ), w ); } -QWidget* ConversionTable::cellWidget( int r, int c ) const +TQWidget* ConversionTable::cellWidget( int r, int c ) const { return widgets.find( indexOf( r, c ) ); } void ConversionTable::clearCellWidget( int r, int c ) { - QWidget * w = widgets.take( indexOf( r, c ) ); + TQWidget * w = widgets.take( indexOf( r, c ) ); if ( w ) w->deleteLater(); } -ConversionTableItem::ConversionTableItem( QTable *t, EditType et ) : QTableItem( t, et, QString::null ) +ConversionTableItem::ConversionTableItem( TQTable *t, EditType et ) : TQTableItem( t, et, TQString::null ) { // we do not want this item to be replaced setReplaceable( false ); } -void ConversionTableItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ) +void ConversionTableItem::paint( TQPainter *p, const TQColorGroup &cg, const TQRect &cr, bool selected ) { - QColorGroup g( cg ); + TQColorGroup g( cg ); // Draw in gray all those cells which are not editable if ( row() == col() ) - g.setColor( QColorGroup::Base, gray ); - QTableItem::paint( p, g, cr, selected ); + g.setColor( TQColorGroup::Base, gray ); + TQTableItem::paint( p, g, cr, selected ); } -QWidget* ConversionTableItem::createEditor() const +TQWidget* ConversionTableItem::createEditor() const { FractionInput *editor = new FractionInput( table()->viewport(), MixedNumber::DecimalFormat ); @@ -156,7 +156,7 @@ QWidget* ConversionTableItem::createEditor() const return editor; } -void ConversionTableItem::setContentFromEditor( QWidget *w ) +void ConversionTableItem::setContentFromEditor( TQWidget *w ) { // the user changed the value of the combobox, so synchronize the // value of the item (its text), with the value of the combobox @@ -167,24 +167,24 @@ void ConversionTableItem::setContentFromEditor( QWidget *w ) emit ratioChanged( row(), col(), editor->value().toDouble() ); // Signal to store } else { - setText( QString::null ); + setText( TQString::null ); emit ratioRemoved( row(), col() ); } } else - QTableItem::setContentFromEditor( w ); + TQTableItem::setContentFromEditor( w ); } -void ConversionTableItem::setText( const QString &s ) +void ConversionTableItem::setText( const TQString &s ) { - QTableItem::setText( s ); + TQTableItem::setText( s ); } -QString ConversionTable::text( int r, int c ) const // without this function, the usual (text(r,c)) won't work +TQString ConversionTable::text( int r, int c ) const // without this function, the usual (text(r,c)) won't work { if ( item( r, c ) ) return item( r, c ) ->text(); //Note that item(r,c) was reimplemented here for large sparse tables... else - return QString::null; + return TQString::null; } void ConversionTable::initTable() @@ -199,7 +199,7 @@ void ConversionTable::initTable() void ConversionTable::createNewItem( int r, int c, double amount ) { - ConversionTableItem * ci = new ConversionTableItem( this, QTableItem::WhenCurrent ); + ConversionTableItem * ci = new ConversionTableItem( this, TQTableItem::WhenCurrent ); ci->setText( beautify( KGlobal::locale() ->formatNumber( amount, 5 ) ) ); setItem( r, c, ci ); // connect signal (forward) to know when it's actually changed @@ -227,7 +227,7 @@ int ConversionTable::getUnitID( int rc ) return ( *( unitIDs.at( rc ) ) ); } -QWidget * ConversionTable::beginEdit ( int row, int col, bool replace ) +TQWidget * ConversionTable::beginEdit ( int row, int col, bool replace ) { // If there's no item, create it first. if ( !item( row, col ) ) { @@ -235,10 +235,10 @@ QWidget * ConversionTable::beginEdit ( int row, int col, bool replace ) } // Then call normal beginEdit - return QTable::beginEdit( row, col, replace ); + return TQTable::beginEdit( row, col, replace ); } -void ConversionTableItem::setTextAndSave( const QString &s ) +void ConversionTableItem::setTextAndSave( const TQString &s ) { setText( s ); // Change text emit signalRepaintCell( row(), col() ); // Indicate to update the cell to the table. Otherwise it's not repainted @@ -247,7 +247,7 @@ void ConversionTableItem::setTextAndSave( const QString &s ) void ConversionTable::repaintCell( int r, int c ) { - QTable::updateCell( r, c ); + TQTable::updateCell( r, c ); } void ConversionTable::resize( int r, int c ) @@ -270,18 +270,18 @@ void ConversionTable::clear( void ) void ConversionTable::swapRows( int row1, int row2, bool /*swapHeader*/ ) { //if ( swapHeader ) - //((QTableHeader*)verticalHeader())->swapSections( row1, row2, FALSE ); + //((TQTableHeader*)verticalHeader())->swapSections( row1, row2, FALSE ); - QPtrVector tmpContents; + TQPtrVector tmpContents; tmpContents.resize( numCols() ); - QPtrVector tmpWidgets; + TQPtrVector tmpWidgets; tmpWidgets.resize( numCols() ); int i; items.setAutoDelete( FALSE ); widgets.setAutoDelete( FALSE ); for ( i = 0; i < numCols(); ++i ) { - QTableItem *i1, *i2; + TQTableItem *i1, *i2; i1 = item( row1, i ); i2 = item( row2, i ); if ( i1 || i2 ) { @@ -296,7 +296,7 @@ void ConversionTable::swapRows( int row1, int row2, bool /*swapHeader*/ ) items[ indexOf( row2, i ) ] ->setRow( row2 ); } - QWidget *w1, *w2; + TQWidget *w1, *w2; w1 = cellWidget( row1, i ); w2 = cellWidget( row2, i ); if ( w1 || w2 ) { @@ -327,18 +327,18 @@ void ConversionTable::swapRows( int row1, int row2, bool /*swapHeader*/ ) void ConversionTable::swapColumns( int col1, int col2, bool /*swapHeader*/ ) { //if ( swapHeader ) - //((QTableHeader*)horizontalHeader())->swapSections( col1, col2, FALSE ); + //((TQTableHeader*)horizontalHeader())->swapSections( col1, col2, FALSE ); - QPtrVector tmpContents; + TQPtrVector tmpContents; tmpContents.resize( numRows() ); - QPtrVector tmpWidgets; + TQPtrVector tmpWidgets; tmpWidgets.resize( numRows() ); int i; items.setAutoDelete( FALSE ); widgets.setAutoDelete( FALSE ); for ( i = 0; i < numRows(); ++i ) { - QTableItem *i1, *i2; + TQTableItem *i1, *i2; i1 = item( i, col1 ); i2 = item( i, col2 ); if ( i1 || i2 ) { @@ -353,7 +353,7 @@ void ConversionTable::swapColumns( int col1, int col2, bool /*swapHeader*/ ) items[ indexOf( i, col2 ) ] ->setCol( col2 ); } - QWidget *w1, *w2; + TQWidget *w1, *w2; w1 = cellWidget( i, col1 ); w2 = cellWidget( i, col2 ); if ( w1 || w2 ) { @@ -385,11 +385,11 @@ void ConversionTable::swapCells( int row1, int col1, int row2, int col2 ) { items.setAutoDelete( FALSE ); widgets.setAutoDelete( FALSE ); - QTableItem *i1, *i2; + TQTableItem *i1, *i2; i1 = item( row1, col1 ); i2 = item( row2, col2 ); if ( i1 || i2 ) { - QTableItem * tmp = i1; + TQTableItem * tmp = i1; items.remove( indexOf( row1, col1 ) ); items.insert( indexOf( row1, col1 ), i2 ); items.remove( indexOf( row2, col2 ) ); @@ -404,11 +404,11 @@ void ConversionTable::swapCells( int row1, int col1, int row2, int col2 ) } } - QWidget *w1, *w2; + TQWidget *w1, *w2; w1 = cellWidget( row1, col1 ); w2 = cellWidget( row2, col2 ); if ( w1 || w2 ) { - QWidget * tmp = w1; + TQWidget * tmp = w1; widgets.remove( indexOf( row1, col1 ) ); widgets.insert( indexOf( row1, col1 ), w2 ); widgets.remove( indexOf( row2, col2 ) ); diff --git a/krecipes/src/widgets/conversiontable.h b/krecipes/src/widgets/conversiontable.h index ca3f85c..0c5191c 100644 --- a/krecipes/src/widgets/conversiontable.h +++ b/krecipes/src/widgets/conversiontable.h @@ -10,9 +10,9 @@ ***************************************************************************/ #ifndef CONVERSIONTABLE_H #define CONVERSIONTABLE_H -#include -#include -#include +#include +#include +#include #include "datablocks/unitratio.h" #include "datablocks/elementlist.h" @@ -23,12 +23,12 @@ */ -class ConversionTable: public QTable +class ConversionTable: public TQTable { Q_OBJECT public: - ConversionTable( QWidget* parent, int maxrows, int maxcols ); + ConversionTable( TQWidget* parent, int maxrows, int maxcols ); ~ConversionTable(); void createNewItem( int r, int c, double amount ); void setUnitIDs( const IDList &idList ); @@ -38,33 +38,33 @@ public: setRatio( r.uID1, r.uID2, r.ratio ); } int getUnitID( int rc ); - QString text( int r, int c ) const; //Reimplement, otherwise it won't work this way + TQString text( int r, int c ) const; //Reimplement, otherwise it won't work this way void resize( int r, int c ); void clear( void ); private: //Internal Variables double editBoxValue; - QIntDict items; - QIntDict widgets; + TQIntDict items; + TQIntDict widgets; IDList unitIDs; // unit ID list to know the units by ID, not name //Internal Methods void resizeData( int ) {} ; - QTableItem *item( int r, int c ) const; - void setItem( int r, int c, QTableItem *i ); + TQTableItem *item( int r, int c ) const; + void setItem( int r, int c, TQTableItem *i ); void clearCell( int r, int c ); - void takeItem( QTableItem *item ); - void insertWidget( int r, int c, QWidget *w ); - QWidget *cellWidget( int r, int c ) const; + void takeItem( TQTableItem *item ); + void insertWidget( int r, int c, TQWidget *w ); + TQWidget *cellWidget( int r, int c ) const; void clearCellWidget( int r, int c ); void initTable(); void swapRows( int, int, bool ); void swapColumns( int, int, bool ); void swapCells( int, int, int, int ); protected: - QWidget* beginEdit ( int row, int col, bool replace ); + TQWidget* beginEdit ( int row, int col, bool replace ); private slots: void repaintCell( int r, int c ); @@ -76,19 +76,19 @@ signals: void ratioRemoved( int row, int col ); }; -class ConversionTableItem: public QObject, public QTableItem +class ConversionTableItem: public TQObject, public TQTableItem { Q_OBJECT public: - ConversionTableItem( QTable *t, EditType et ); - QWidget *createEditor() const; - void setContentFromEditor( QWidget *w ); - void setText( const QString &s ); - void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); - void setTextAndSave( const QString &s ); + ConversionTableItem( TQTable *t, EditType et ); + TQWidget *createEditor() const; + void setContentFromEditor( TQWidget *w ); + void setText( const TQString &s ); + void paint( TQPainter *p, const TQColorGroup &cg, const TQRect &cr, bool selected ); + void setTextAndSave( const TQString &s ); int alignment() const { - return Qt::AlignRight; + return TQt::AlignRight; } signals: void ratioChanged( int row, int col, double value ); diff --git a/krecipes/src/widgets/criteriacombobox.cpp b/krecipes/src/widgets/criteriacombobox.cpp index 1b037df..a5010e6 100644 --- a/krecipes/src/widgets/criteriacombobox.cpp +++ b/krecipes/src/widgets/criteriacombobox.cpp @@ -10,12 +10,12 @@ #include "criteriacombobox.h" -#include +#include #include "backends/recipedb.h" #include "datablocks/elementlist.h" -CriteriaComboBox::CriteriaComboBox( bool b, QWidget *parent, RecipeDB *db ) : KComboBox( b, parent ), +CriteriaComboBox::CriteriaComboBox( bool b, TQWidget *parent, RecipeDB *db ) : KComboBox( b, parent ), database( db ) { connect( db, SIGNAL(ratingCriteriaCreated(const Element &)), this, SLOT(addCriteria(const Element &)) ); diff --git a/krecipes/src/widgets/criteriacombobox.h b/krecipes/src/widgets/criteriacombobox.h index b3ec8f4..f04bde5 100644 --- a/krecipes/src/widgets/criteriacombobox.h +++ b/krecipes/src/widgets/criteriacombobox.h @@ -11,7 +11,7 @@ #ifndef CRITERIACOMBOBOX_H #define CRITERIACOMBOBOX_H -#include +#include #include @@ -24,7 +24,7 @@ class CriteriaComboBox : public KComboBox Q_OBJECT public: - CriteriaComboBox( bool, QWidget *parent, RecipeDB *db ); + CriteriaComboBox( bool, TQWidget *parent, RecipeDB *db ); void reload(); int criteriaID( int index ); @@ -34,7 +34,7 @@ protected slots: private: RecipeDB *database; - QMap< int, int > idMap; + TQMap< int, int > idMap; }; #endif //CRITERIACOMBOBOX_H diff --git a/krecipes/src/widgets/dblistviewbase.cpp b/krecipes/src/widgets/dblistviewbase.cpp index 0be4f38..41576da 100644 --- a/krecipes/src/widgets/dblistviewbase.cpp +++ b/krecipes/src/widgets/dblistviewbase.cpp @@ -20,39 +20,39 @@ //These two classes are used to identify the "Next" and "Prev" items, which are identified through rtti(). This also prevents renaming, even if it is enabled. -class PrevListViewItem : public QListViewItem +class PrevListViewItem : public TQListViewItem { public: - PrevListViewItem( QListView *parent ) : QListViewItem(parent){} + PrevListViewItem( TQListView *parent ) : TQListViewItem(parent){} virtual int rtti() const { return PREVLISTITEM_RTTI; } - QString text( int c ) const { + TQString text( int c ) const { if ( c == 0 ) { - return QString("<< %1").arg(i18n("Previous")); + return TQString("<< %1").arg(i18n("Previous")); } else - return QString::null; + return TQString::null; } }; -class NextListViewItem : public QListViewItem +class NextListViewItem : public TQListViewItem { public: - NextListViewItem( QListView *parent, QListViewItem *after ) : QListViewItem(parent,after){} + NextListViewItem( TQListView *parent, TQListViewItem *after ) : TQListViewItem(parent,after){} virtual int rtti() const { return NEXTLISTITEM_RTTI; } - QString text( int c ) const { + TQString text( int c ) const { if ( c == 0 ) { - return QString("%1 >>").arg(i18n("Next")); + return TQString("%1 >>").arg(i18n("Next")); } else - return QString::null; + return TQString::null; } }; -DBListViewBase::DBListViewBase( QWidget *parent, RecipeDB *db, int t ) : KListView(parent), +DBListViewBase::DBListViewBase( TQWidget *parent, RecipeDB *db, int t ) : KListView(parent), database(db), curr_limit(-1), curr_offset(0), @@ -69,7 +69,7 @@ DBListViewBase::DBListViewBase( QWidget *parent, RecipeDB *db, int t ) : KListVi curr_limit = config->readNumEntry( "Limit", -1 ); } - connect(this,SIGNAL(executed(QListViewItem*)),SLOT(slotDoubleClicked(QListViewItem*))); + connect(this,SIGNAL(executed(TQListViewItem*)),SLOT(slotDoubleClicked(TQListViewItem*))); } DBListViewBase::~DBListViewBase() @@ -97,7 +97,7 @@ void DBListViewBase::activateNext() emit nextGroupLoaded(); } -void DBListViewBase::rename( QListViewItem *it, int c ) +void DBListViewBase::rename( TQListViewItem *it, int c ) { if ( it->rtti() == PREVLISTITEM_RTTI || it->rtti() == NEXTLISTITEM_RTTI ) { return; @@ -106,7 +106,7 @@ void DBListViewBase::rename( QListViewItem *it, int c ) KListView::rename(it,c); } -void DBListViewBase::slotDoubleClicked( QListViewItem *it ) +void DBListViewBase::slotDoubleClicked( TQListViewItem *it ) { //we can't delete the item the was double clicked //and yet these functions will clear() the listview. @@ -126,11 +126,11 @@ void DBListViewBase::slotDoubleClicked( QListViewItem *it ) } } -void DBListViewBase::keyPressEvent( QKeyEvent *k ) +void DBListViewBase::keyPressEvent( TQKeyEvent *k ) { - if ( k->state() == Qt::ShiftButton ) { + if ( k->state() == TQt::ShiftButton ) { switch ( k->key() ) { - case Qt::Key_N: { + case TQt::Key_N: { if ( curr_offset + curr_limit >= total || curr_limit == -1 ) { k->accept(); return; @@ -141,7 +141,7 @@ void DBListViewBase::keyPressEvent( QKeyEvent *k ) k->accept(); break; } - case Qt::Key_P: { + case TQt::Key_P: { kapp->processEvents(); //if auto-repeating, user won't otherwise see change in the listview activatePrev(); k->accept(); @@ -161,7 +161,7 @@ void DBListViewBase::reload( ReloadFlags flag ) init(); - //m_progress = new KProgressDialog(this,0,QString::null,i18n("Loading..."),true); + //m_progress = new KProgressDialog(this,0,TQString::null,i18n("Loading..."),true); //m_progress->setAllowCancel(false); //m_progress->progressBar()->setPercentageVisible(false); //m_progress->progressBar()->setTotalSteps( m_totalSteps ); @@ -196,12 +196,12 @@ void DBListViewBase::setTotalItems(int i) } } -void DBListViewBase::createElement( QListViewItem *it ) +void DBListViewBase::createElement( TQListViewItem *it ) { Q_ASSERT(it); - QListViewItem *lastElement; - QMap::iterator map_it = lastElementMap.find(it->parent()); + TQListViewItem *lastElement; + TQMap::iterator map_it = lastElementMap.find(it->parent()); if ( map_it != lastElementMap.end() ) { lastElement = map_it.data(); } @@ -230,19 +230,19 @@ void DBListViewBase::createElement( QListViewItem *it ) } } - if ( QString::localeAwareCompare(it->text(c),lastElement->text(c)) >= 0 ) { + if ( TQString::localeAwareCompare(it->text(c),lastElement->text(c)) >= 0 ) { it->moveItem(lastElement); lastElementMap.insert(it->parent(),it); } else { - QListViewItem *last_it = 0; + TQListViewItem *last_it = 0; - for ( QListViewItem *search_it = it; search_it; search_it = search_it->nextSibling() ) { + for ( TQListViewItem *search_it = it; search_it; search_it = search_it->nextSibling() ) { if ( search_it->rtti() == NEXTLISTITEM_RTTI ) { it->moveItem(lastElement); lastElementMap.insert(it->parent(),it); } - else if ( QString::localeAwareCompare(it->text(c),search_it->text(c)) < 0 ) { //we assume the list is sorted, as it should stay + else if ( TQString::localeAwareCompare(it->text(c),search_it->text(c)) < 0 ) { //we assume the list is sorted, as it should stay if ( last_it ) it->moveItem(last_it); break; } @@ -253,14 +253,14 @@ void DBListViewBase::createElement( QListViewItem *it ) } } -void DBListViewBase::removeElement( QListViewItem *it, bool delete_item ) +void DBListViewBase::removeElement( TQListViewItem *it, bool delete_item ) { total--; if ( !it ) return; - QListViewItem *lastElement = lastElementMap[it->parent()]; + TQListViewItem *lastElement = lastElementMap[it->parent()]; if ( it == lastElement ) { - for ( QListViewItem *search_it = (it->parent())?it->parent()->firstChild():firstChild(); search_it->nextSibling(); search_it = search_it->nextSibling() ) { + for ( TQListViewItem *search_it = (it->parent())?it->parent()->firstChild():firstChild(); search_it->nextSibling(); search_it = search_it->nextSibling() ) { if ( it == search_it->nextSibling() ) { lastElementMap.insert(it->parent(),search_it); lastElement = search_it; @@ -286,11 +286,11 @@ void DBListViewBase::removeElement( QListViewItem *it, bool delete_item ) delete it; } -bool DBListViewBase::handleElement( const QString &name ) +bool DBListViewBase::handleElement( const TQString &name ) { total++; - QListViewItem *lastElement = lastElementMap[0]; + TQListViewItem *lastElement = lastElementMap[0]; int c = 0;//FIXME: the column used should be variable (set by a subclass) @@ -303,7 +303,7 @@ bool DBListViewBase::handleElement( const QString &name ) if ( lastElement->nextSibling() ){ child_count--; } //"Next" item if ( curr_limit != -1 && child_count >= curr_limit ) { - QListViewItem *firstElement = firstChild(); + TQListViewItem *firstElement = firstChild(); if (firstElement->rtti() == PREVLISTITEM_RTTI || firstElement->rtti() == 1006 ) { firstElement = firstElement->nextSibling(); } diff --git a/krecipes/src/widgets/dblistviewbase.h b/krecipes/src/widgets/dblistviewbase.h index 2db4fe6..1b04ff3 100644 --- a/krecipes/src/widgets/dblistviewbase.h +++ b/krecipes/src/widgets/dblistviewbase.h @@ -11,8 +11,8 @@ #ifndef LISTVIEWHANDLER_H #define LISTVIEWHANDLER_H -#include -#include +#include +#include #include @@ -34,7 +34,7 @@ class DBListViewBase : public KListView Q_OBJECT public: - DBListViewBase( QWidget *, RecipeDB *, int total ); + DBListViewBase( TQWidget *, RecipeDB *, int total ); ~DBListViewBase(); void reload( ReloadFlags flag = Load ); @@ -51,10 +51,10 @@ protected: */ virtual void init(){} virtual void load(int limit, int offset) = 0; - virtual void keyPressEvent( QKeyEvent *e ); - bool handleElement( const QString & ); - virtual void createElement( QListViewItem * ); - void removeElement( QListViewItem *, bool delete_item = true ); + virtual void keyPressEvent( TQKeyEvent *e ); + bool handleElement( const TQString & ); + virtual void createElement( TQListViewItem * ); + void removeElement( TQListViewItem *, bool delete_item = true ); bool reloading(){ return bulk_load; } void setSorting(int c){KListView::setSorting(c);} //don't do sorting, the database comes sorted from the database anyways @@ -65,8 +65,8 @@ protected: int curr_offset; protected slots: - void rename( QListViewItem *, int c ); - void slotDoubleClicked( QListViewItem * ); + void rename( TQListViewItem *, int c ); + void slotDoubleClicked( TQListViewItem * ); private: void activatePrev(); @@ -79,8 +79,8 @@ private: bool bulk_load; - QMap lastElementMap; - QListViewItem *delete_me_later; + TQMap lastElementMap; + TQListViewItem *delete_me_later; KProgressDialog *m_progress; int m_totalSteps; diff --git a/krecipes/src/widgets/fractioninput.cpp b/krecipes/src/widgets/fractioninput.cpp index e9ceac1..3754805 100644 --- a/krecipes/src/widgets/fractioninput.cpp +++ b/krecipes/src/widgets/fractioninput.cpp @@ -10,20 +10,20 @@ #include "fractioninput.h" -#include +#include #include #include "datablocks/ingredient.h" -FractionInput::FractionInput( QWidget *parent, MixedNumber::Format format ) : KLineEdit( parent ), +FractionInput::FractionInput( TQWidget *parent, MixedNumber::Format format ) : KLineEdit( parent ), m_allowRange(false), - m_validateTimer(new QTimer(this)), + m_validateTimer(new TQTimer(this)), m_format(format) { - setAlignment( Qt::AlignRight ); + setAlignment( TQt::AlignRight ); - connect( this, SIGNAL(textChanged(const QString&)), this, SLOT(slotStartValidateTimer()) ); + connect( this, SIGNAL(textChanged(const TQString&)), this, SLOT(slotStartValidateTimer()) ); connect( m_validateTimer, SIGNAL(timeout()), this, SLOT(validate()) ); } @@ -40,7 +40,7 @@ void FractionInput::setValue( double d, double amount_offset ) void FractionInput::setValue( const MixedNumber &m, double amount_offset ) { - QString text = m.toString( m_format ); + TQString text = m.toString( m_format ); if ( amount_offset > 0 ) { text += "-" + MixedNumber(m+amount_offset).toString( MixedNumber::MixedNumberFormat ); } @@ -110,7 +110,7 @@ void FractionInput::validate() setPaletteForegroundColor( KGlobalSettings::textColor() ); } else - setPaletteForegroundColor( Qt::red ); + setPaletteForegroundColor( TQt::red ); } bool FractionInput::isEmpty() const diff --git a/krecipes/src/widgets/fractioninput.h b/krecipes/src/widgets/fractioninput.h index 6b49020..37a9b76 100644 --- a/krecipes/src/widgets/fractioninput.h +++ b/krecipes/src/widgets/fractioninput.h @@ -15,7 +15,7 @@ #include "datablocks/mixednumber.h" -class QTimer; +class TQTimer; /** A KLineEdit widget extended to allow input of decimals and fractions or ranges of such. * Input is returned as a @ref MixedNumber class. @@ -26,7 +26,7 @@ class FractionInput : public KLineEdit Q_OBJECT public: - FractionInput( QWidget *parent = 0, MixedNumber::Format = MixedNumber::MixedNumberFormat ); + FractionInput( TQWidget *parent = 0, MixedNumber::Format = MixedNumber::MixedNumberFormat ); ~FractionInput(); void setAllowRange( bool b ){ m_allowRange = b; } @@ -54,7 +54,7 @@ private slots: private: bool m_allowRange; - QTimer *m_validateTimer; + TQTimer *m_validateTimer; MixedNumber::Format m_format; }; diff --git a/krecipes/src/widgets/headercombobox.cpp b/krecipes/src/widgets/headercombobox.cpp index 6f118c6..0857d55 100644 --- a/krecipes/src/widgets/headercombobox.cpp +++ b/krecipes/src/widgets/headercombobox.cpp @@ -10,19 +10,19 @@ #include "headercombobox.h" -#include +#include #include "backends/recipedb.h" #include "datablocks/elementlist.h" -HeaderComboBox::HeaderComboBox( bool b, QWidget *parent, RecipeDB *db ) : KComboBox( b, parent ), +HeaderComboBox::HeaderComboBox( bool b, TQWidget *parent, RecipeDB *db ) : KComboBox( b, parent ), database( db ) { } void HeaderComboBox::reload() { - QString remember_text = currentText(); + TQString remember_text = currentText(); ElementList headerList; database->loadIngredientGroups( &headerList ); @@ -34,7 +34,7 @@ void HeaderComboBox::reload() completionObject()->addItem((*it).name); } - if ( listBox()->findItem( remember_text, Qt::ExactMatch ) ) { + if ( listBox()->findItem( remember_text, TQt::ExactMatch ) ) { setCurrentText( remember_text ); } } diff --git a/krecipes/src/widgets/headercombobox.h b/krecipes/src/widgets/headercombobox.h index 09e47b8..bfde387 100644 --- a/krecipes/src/widgets/headercombobox.h +++ b/krecipes/src/widgets/headercombobox.h @@ -22,7 +22,7 @@ class HeaderComboBox : public KComboBox Q_OBJECT public: - HeaderComboBox( bool, QWidget *parent, RecipeDB *db ); + HeaderComboBox( bool, TQWidget *parent, RecipeDB *db ); void reload(); diff --git a/krecipes/src/widgets/headerlistview.cpp b/krecipes/src/widgets/headerlistview.cpp index 3c9a379..daa72db 100644 --- a/krecipes/src/widgets/headerlistview.cpp +++ b/krecipes/src/widgets/headerlistview.cpp @@ -23,10 +23,10 @@ #include "dialogs/createelementdialog.h" #include "dialogs/dependanciesdialog.h" -HeaderListView::HeaderListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->unitCount() ) +HeaderListView::HeaderListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->unitCount() ) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void HeaderListView::init() @@ -55,7 +55,7 @@ void HeaderListView::checkCreateHeader( const Element &el ) } -StdHeaderListView::StdHeaderListView( QWidget *parent, RecipeDB *db, bool editable ) : HeaderListView( parent, db ) +StdHeaderListView::StdHeaderListView( TQWidget *parent, RecipeDB *db, bool editable ) : HeaderListView( parent, db ) { addColumn( i18n( "Header" ) ); @@ -78,13 +78,13 @@ StdHeaderListView::StdHeaderListView( QWidget *parent, RecipeDB *db, bool editab delete il; - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), this, SLOT( modHeader( QListViewItem*, const QPoint &, int ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem*, const QString &, int ) ), this, SLOT( saveHeader( QListViewItem*, const QString &, int ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), this, SLOT( modHeader( TQListViewItem*, const TQPoint &, int ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem*, const TQString &, int ) ), this, SLOT( saveHeader( TQListViewItem*, const TQString &, int ) ) ); } } -void StdHeaderListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdHeaderListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -94,8 +94,8 @@ void StdHeaderListView::createNew() { CreateElementDialog * headerDialog = new CreateElementDialog( this, i18n("Header") ); - if ( headerDialog->exec() == QDialog::Accepted ) { - QString result = headerDialog->newElementName(); + if ( headerDialog->exec() == TQDialog::Accepted ) { + TQString result = headerDialog->newElementName(); //check bounds first if ( checkBounds( result ) ) @@ -107,7 +107,7 @@ void StdHeaderListView::createNew() void StdHeaderListView::remove() { // Find selected header item - QListViewItem * it = selectedItem(); + TQListViewItem * it = selectedItem(); if ( it ) { int headerID = it->text( 1 ).toInt(); @@ -124,7 +124,7 @@ void StdHeaderListView::remove() DependanciesDialog warnDialog( this, info ); warnDialog.setCustomWarning( i18n("You are about to permanantly delete recipes from your database.") ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removeIngredientGroup( headerID ); } } @@ -132,7 +132,7 @@ void StdHeaderListView::remove() void StdHeaderListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) HeaderListView::rename( item, 0 ); @@ -140,22 +140,22 @@ void StdHeaderListView::rename() void StdHeaderListView::createHeader( const Element &header ) { - createElement(new QListViewItem( this, header.name, QString::number( header.id ) )); + createElement(new TQListViewItem( this, header.name, TQString::number( header.id ) )); } void StdHeaderListView::removeHeader( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } -void StdHeaderListView::modHeader( QListViewItem* i, const QPoint & /*p*/, int c ) +void StdHeaderListView::modHeader( TQListViewItem* i, const TQPoint & /*p*/, int c ) { if ( i ) HeaderListView::rename( i, c ); } -void StdHeaderListView::saveHeader( QListViewItem* i, const QString &text, int /*c*/ ) +void StdHeaderListView::saveHeader( TQListViewItem* i, const TQString &text, int /*c*/ ) { if ( !checkBounds( text ) ) { reload(ForceReload); //reset the changed text @@ -181,10 +181,10 @@ void StdHeaderListView::saveHeader( QListViewItem* i, const QString &text, int / } } -bool StdHeaderListView::checkBounds( const QString &header ) +bool StdHeaderListView::checkBounds( const TQString &header ) { if ( header.length() > uint(database->maxIngGroupNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Header cannot be longer than %1 characters." ) ).arg( database->maxIngGroupNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Header cannot be longer than %1 characters." ) ).arg( database->maxIngGroupNameLength() ) ); return false; } else if ( header.stripWhiteSpace().isEmpty() ) diff --git a/krecipes/src/widgets/headerlistview.h b/krecipes/src/widgets/headerlistview.h index 47a690e..81f904f 100644 --- a/krecipes/src/widgets/headerlistview.h +++ b/krecipes/src/widgets/headerlistview.h @@ -25,7 +25,7 @@ class HeaderListView : public DBListViewBase Q_OBJECT public: - HeaderListView( QWidget *parent, RecipeDB *db ); + HeaderListView( TQWidget *parent, RecipeDB *db ); public slots: virtual void load( int curr_limit, int curr_offset ); @@ -45,24 +45,24 @@ class StdHeaderListView : public HeaderListView Q_OBJECT public: - StdHeaderListView( QWidget *parent, RecipeDB *db, bool editable = false ); + StdHeaderListView( TQWidget *parent, RecipeDB *db, bool editable = false ); protected: virtual void createHeader( const Element & ); virtual void removeHeader( int ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove(); void rename(); - void modHeader( QListViewItem* i, const QPoint &p, int c ); - void saveHeader( QListViewItem* i, const QString &text, int c ); + void modHeader( TQListViewItem* i, const TQPoint &p, int c ); + void saveHeader( TQListViewItem* i, const TQString &text, int c ); private: - bool checkBounds( const QString &unit ); + bool checkBounds( const TQString &unit ); KPopupMenu *kpop; }; diff --git a/krecipes/src/widgets/inglistviewitem.cpp b/krecipes/src/widgets/inglistviewitem.cpp index 08a41c7..495fd3e 100644 --- a/krecipes/src/widgets/inglistviewitem.cpp +++ b/krecipes/src/widgets/inglistviewitem.cpp @@ -18,15 +18,15 @@ #include "datablocks/unit.h" #include "datablocks/mixednumber.h" -IngSubListViewItem::IngSubListViewItem( QListViewItem* qli, const Ingredient &i ) : IngListViewItem( qli, 0, i ) +IngSubListViewItem::IngSubListViewItem( TQListViewItem* qli, const Ingredient &i ) : IngListViewItem( qli, 0, i ) { } -QString IngSubListViewItem::text( int column ) const +TQString IngSubListViewItem::text( int column ) const { if ( column == 0 ) { //kdDebug()<<"displaying col 0 for "< 0 ) { KConfig * config = KGlobal::config(); @@ -116,12 +116,12 @@ void IngListViewItem::setUnit( const Unit &unit ) m_ing.units.plural = unit.plural; } -void IngListViewItem::setPrepMethod( const QString &prepMethod ) +void IngListViewItem::setPrepMethod( const TQString &prepMethod ) { m_ing.prepMethodList = ElementList::split(",",prepMethod); } -void IngListViewItem::setText( int column, const QString &text ) +void IngListViewItem::setText( int column, const TQString &text ) { switch ( column ) { case 0: { @@ -144,7 +144,7 @@ void IngListViewItem::setText( int column, const QString &text ) } } -QString IngListViewItem::text( int column ) const +TQString IngListViewItem::text( int column ) const { switch ( column ) { case 0: @@ -160,7 +160,7 @@ QString IngListViewItem::text( int column ) const return m_ing.prepMethodList.join(","); break; default: - return ( QString::null ); + return ( TQString::null ); } } @@ -172,7 +172,7 @@ void IngListViewItem::init( const Ingredient &i ) } -IngGrpListViewItem::IngGrpListViewItem( QListView* qlv, QListViewItem *after, const QString &group, int id ) : QListViewItem( qlv, after ) +IngGrpListViewItem::IngGrpListViewItem( TQListView* qlv, TQListViewItem *after, const TQString &group, int id ) : TQListViewItem( qlv, after ) { init( group, id ); } @@ -182,7 +182,7 @@ int IngGrpListViewItem::rtti() const return INGGRPLISTVIEWITEM_RTTI; } -QString IngGrpListViewItem::group() const +TQString IngGrpListViewItem::group() const { return m_group; } @@ -192,18 +192,18 @@ int IngGrpListViewItem::id() const return m_id; } -QString IngGrpListViewItem::text( int column ) const +TQString IngGrpListViewItem::text( int column ) const { switch ( column ) { case 0: return m_group + ":"; break; default: - return ( QString::null ); + return ( TQString::null ); } } -void IngGrpListViewItem::setText( int column, const QString &text ) +void IngGrpListViewItem::setText( int column, const TQString &text ) { switch ( column ) { case 0: @@ -217,7 +217,7 @@ void IngGrpListViewItem::setText( int column, const QString &text ) } } -void IngGrpListViewItem::init( const QString &group, int id ) +void IngGrpListViewItem::init( const TQString &group, int id ) { m_group = group; m_id = id; diff --git a/krecipes/src/widgets/inglistviewitem.h b/krecipes/src/widgets/inglistviewitem.h index a870a5a..02c35de 100644 --- a/krecipes/src/widgets/inglistviewitem.h +++ b/krecipes/src/widgets/inglistviewitem.h @@ -11,7 +11,7 @@ #ifndef INGLISTVIEWITEM_H #define INGLISTVIEWITEM_H -#include "qlistview.h" +#include "ntqlistview.h" #include "datablocks/ingredient.h" @@ -19,12 +19,12 @@ #define INGLISTVIEWITEM_RTTI 1004 #define INGSUBLISTVIEWITEM_RTTI 1009 -class IngListViewItem : public QListViewItem +class IngListViewItem : public TQListViewItem { public: - IngListViewItem( QListView* qlv, const Ingredient &i ); - IngListViewItem( QListView* qlv, QListViewItem *after, const Ingredient &i ); - IngListViewItem( QListViewItem* qli, QListViewItem *after, const Ingredient &i ); + IngListViewItem( TQListView* qlv, const Ingredient &i ); + IngListViewItem( TQListView* qlv, TQListViewItem *after, const Ingredient &i ); + IngListViewItem( TQListViewItem* qli, TQListViewItem *after, const Ingredient &i ); int rtti() const; @@ -32,15 +32,15 @@ public: void setAmount( double amount, double amount_offset ); void setUnit( const Unit &unit ); - void setPrepMethod( const QString &prepMethod ); + void setPrepMethod( const TQString &prepMethod ); protected: Ingredient m_ing; - QString amount_str; + TQString amount_str; public: - virtual QString text( int column ) const; - virtual void setText( int column, const QString &text ); + virtual TQString text( int column ) const; + virtual void setText( int column, const TQString &text ); private: void init( const Ingredient &i ); @@ -50,33 +50,33 @@ private: class IngSubListViewItem : public IngListViewItem { public: - IngSubListViewItem( QListViewItem* qli, const Ingredient &i ); + IngSubListViewItem( TQListViewItem* qli, const Ingredient &i ); - virtual QString text( int column ) const; - virtual void setText( int column, const QString &text ); + virtual TQString text( int column ) const; + virtual void setText( int column, const TQString &text ); virtual int rtti() const; }; -class IngGrpListViewItem : public QListViewItem +class IngGrpListViewItem : public TQListViewItem { public: - IngGrpListViewItem( QListView* qlv, QListViewItem *after, const QString &group, int id ); + IngGrpListViewItem( TQListView* qlv, TQListViewItem *after, const TQString &group, int id ); int rtti() const; - QString group() const; + TQString group() const; int id() const; - virtual QString text( int column ) const; - virtual void setText( int column, const QString &text ); + virtual TQString text( int column ) const; + virtual void setText( int column, const TQString &text ); protected: - QString m_group; + TQString m_group; int m_id; private: - void init( const QString &group, int id ); + void init( const TQString &group, int id ); }; #endif diff --git a/krecipes/src/widgets/ingredientcombobox.cpp b/krecipes/src/widgets/ingredientcombobox.cpp index 7423f22..dbff22d 100644 --- a/krecipes/src/widgets/ingredientcombobox.cpp +++ b/krecipes/src/widgets/ingredientcombobox.cpp @@ -10,8 +10,8 @@ #include "ingredientcombobox.h" -#include -#include +#include +#include #include #include @@ -21,8 +21,8 @@ #include "backends/recipedb.h" #include "datablocks/elementlist.h" -IngredientComboBox::IngredientComboBox( bool b, QWidget *parent, RecipeDB *db, const QString &specialItem ) : KComboBox( b, parent ), - database( db ), loading_at(0), load_timer(new QTimer(this)), m_specialItem(specialItem) +IngredientComboBox::IngredientComboBox( bool b, TQWidget *parent, RecipeDB *db, const TQString &specialItem ) : KComboBox( b, parent ), + database( db ), loading_at(0), load_timer(new TQTimer(this)), m_specialItem(specialItem) { connect( load_timer, SIGNAL(timeout()), SLOT(loadMore()) ); completionObject()->setIgnoreCase(true); @@ -30,7 +30,7 @@ IngredientComboBox::IngredientComboBox( bool b, QWidget *parent, RecipeDB *db, c void IngredientComboBox::reload() { - QString remember_text; + TQString remember_text; if ( editable() ) remember_text = lineEdit()->text(); @@ -110,7 +110,7 @@ int IngredientComboBox::id( int row ) return ingredientComboRows[ row ]; } -int IngredientComboBox::id( const QString &ing ) +int IngredientComboBox::id( const TQString &ing ) { for ( int i = 0; i < count(); i++ ) { if ( ing == text( i ) ) @@ -124,7 +124,7 @@ void IngredientComboBox::createIngredient( const Element &element ) { int row = findInsertionPoint( element.name ); - QString remember_text; + TQString remember_text; if ( editable() ) remember_text = lineEdit()->text(); @@ -135,8 +135,8 @@ void IngredientComboBox::createIngredient( const Element &element ) lineEdit()->setText( remember_text ); //now update the map by pushing everything after this item down - QMap new_map; - for ( QMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { if ( it.key() >= row ) { new_map.insert( it.key() + 1, it.data() ); } @@ -150,7 +150,7 @@ void IngredientComboBox::createIngredient( const Element &element ) void IngredientComboBox::removeIngredient( int id ) { int row = -1; - for ( QMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + for ( TQMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { if ( it.data() == id ) { row = it.key(); completionObject()->removeItem( text(row) ); @@ -164,8 +164,8 @@ void IngredientComboBox::removeIngredient( int id ) return ; //now update the map by pushing everything after this item up - QMap new_map; - for ( QMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { if ( it.key() > row ) { new_map.insert( it.key() - 1, it.data() ); } @@ -175,10 +175,10 @@ void IngredientComboBox::removeIngredient( int id ) ingredientComboRows = new_map; } -int IngredientComboBox::findInsertionPoint( const QString &name ) +int IngredientComboBox::findInsertionPoint( const TQString &name ) { for ( int i = 0; i < count(); i++ ) { - if ( QString::localeAwareCompare( name, text( i ) ) < 0 ) + if ( TQString::localeAwareCompare( name, text( i ) ) < 0 ) return i; } diff --git a/krecipes/src/widgets/ingredientcombobox.h b/krecipes/src/widgets/ingredientcombobox.h index 8e18957..ed47069 100644 --- a/krecipes/src/widgets/ingredientcombobox.h +++ b/krecipes/src/widgets/ingredientcombobox.h @@ -13,11 +13,11 @@ #include -#include +#include #include "datablocks/element.h" -class QTimer; +class TQTimer; class RecipeDB; class ElementList; @@ -27,11 +27,11 @@ class IngredientComboBox : public KComboBox Q_OBJECT public: - IngredientComboBox( bool, QWidget *parent, RecipeDB *db, const QString &specialItem = QString::null ); + IngredientComboBox( bool, TQWidget *parent, RecipeDB *db, const TQString &specialItem = TQString::null ); void reload(); int id( int row ); - int id( const QString &ing ); + int id( const TQString &ing ); void startLoad(); void endLoad(); @@ -40,18 +40,18 @@ private slots: void createIngredient( const Element &element ); void removeIngredient( int id ); - int findInsertionPoint( const QString &name ); + int findInsertionPoint( const TQString &name ); void loadMore(); private: RecipeDB *database; - QMap ingredientComboRows; // Contains the category id for every given row in the category combobox + TQMap ingredientComboRows; // Contains the category id for every given row in the category combobox int loading_at; int ing_count; int load_limit; - QTimer *load_timer; - QString m_specialItem; + TQTimer *load_timer; + TQString m_specialItem; }; #endif //INGREDIENTCOMBOBOX_H diff --git a/krecipes/src/widgets/ingredientinputwidget.cpp b/krecipes/src/widgets/ingredientinputwidget.cpp index ef7975f..6468dba 100644 --- a/krecipes/src/widgets/ingredientinputwidget.cpp +++ b/krecipes/src/widgets/ingredientinputwidget.cpp @@ -14,14 +14,14 @@ #include "ingredientinputwidget.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -38,60 +38,60 @@ #include "profiling.h" -IngredientInput::IngredientInput( RecipeDB *db, QWidget *parent, bool allowHeader ) : QHBox(parent), database(db) +IngredientInput::IngredientInput( RecipeDB *db, TQWidget *parent, bool allowHeader ) : TQHBox(parent), database(db) { - QVBox *ingredientVBox = new QVBox( this ); - QHBox *typeHBox = new QHBox( ingredientVBox ); + TQVBox *ingredientVBox = new TQVBox( this ); + TQHBox *typeHBox = new TQHBox( ingredientVBox ); if ( allowHeader ) { - typeButtonGrp = new QButtonGroup(); - QRadioButton *ingredientRadioButton = new QRadioButton( i18n( "Ingredient:" ), typeHBox ); + typeButtonGrp = new TQButtonGroup(); + TQRadioButton *ingredientRadioButton = new TQRadioButton( i18n( "Ingredient:" ), typeHBox ); typeButtonGrp->insert( ingredientRadioButton, 0 ); - QRadioButton *headerRadioButton = new QRadioButton( i18n( "Ingredient grouping name", "Header:" ), typeHBox ); + TQRadioButton *headerRadioButton = new TQRadioButton( i18n( "Ingredient grouping name", "Header:" ), typeHBox ); typeButtonGrp->insert( headerRadioButton, 1 ); typeButtonGrp->setButton( 0 ); connect( typeButtonGrp, SIGNAL( clicked( int ) ), SLOT( typeButtonClicked( int ) ) ); } else { - (void) new QLabel( i18n( "Ingredient:" ), typeHBox ); + (void) new TQLabel( i18n( "Ingredient:" ), typeHBox ); typeButtonGrp = 0; } - header_ing_stack = new QWidgetStack(ingredientVBox); + header_ing_stack = new TQWidgetStack(ingredientVBox); ingredientBox = new IngredientComboBox( TRUE, header_ing_stack, database ); ingredientBox->setAutoCompletion( TRUE ); ingredientBox->lineEdit() ->disconnect( ingredientBox ); //so hitting enter doesn't enter the item into the box - ingredientBox->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ) ); + ingredientBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Fixed ) ); header_ing_stack->addWidget( ingredientBox ); headerBox = new HeaderComboBox( TRUE, header_ing_stack, database ); headerBox->setAutoCompletion( TRUE ); headerBox->lineEdit() ->disconnect( ingredientBox ); //so hitting enter doesn't enter the item into the box - headerBox->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ) ); + headerBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Fixed ) ); header_ing_stack->addWidget( headerBox ); - QVBox *amountVBox = new QVBox( this ); - amountLabel = new QLabel( i18n( "Amount:" ), amountVBox ); + TQVBox *amountVBox = new TQVBox( this ); + amountLabel = new TQLabel( i18n( "Amount:" ), amountVBox ); amountEdit = new FractionInput( amountVBox ); amountEdit->setAllowRange(true); - amountEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) ); + amountEdit->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); - QVBox *unitVBox = new QVBox( this ); - unitLabel = new QLabel( i18n( "Unit:" ), unitVBox ); + TQVBox *unitVBox = new TQVBox( this ); + unitLabel = new TQLabel( i18n( "Unit:" ), unitVBox ); unitBox = new KComboBox( TRUE, unitVBox ); unitBox->setAutoCompletion( TRUE ); unitBox->lineEdit() ->disconnect( unitBox ); //so hitting enter doesn't enter the item into the box - unitBox->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ) ); + unitBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Fixed ) ); - QVBox *prepMethodVBox = new QVBox( this ); - prepMethodLabel = new QLabel( i18n( "Preparation Method:" ), prepMethodVBox ); + TQVBox *prepMethodVBox = new TQVBox( this ); + prepMethodLabel = new TQLabel( i18n( "Preparation Method:" ), prepMethodVBox ); prepMethodBox = new PrepMethodComboBox( TRUE, prepMethodVBox, database ); prepMethodBox->setAutoCompletion( TRUE ); prepMethodBox->lineEdit() ->disconnect( prepMethodBox ); //so hitting enter doesn't enter the item into the box - prepMethodBox->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ) ); + prepMethodBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Fixed ) ); - orButton = new QCheckBox( i18n( "OR" ), this ); + orButton = new TQCheckBox( i18n( "OR" ), this ); setStretchFactor( ingredientVBox, 5 ); setStretchFactor( amountVBox, 1 ); @@ -108,7 +108,7 @@ IngredientInput::IngredientInput( RecipeDB *db, QWidget *parent, bool allowHeade connect( ingredientBox->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( signalIngredient() ) ); connect( headerBox->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( signalIngredient() ) ); connect( prepMethodBox->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( signalIngredient() ) ); - connect( amountEdit, SIGNAL( returnPressed( const QString & ) ), this, SLOT( signalIngredient() ) ); + connect( amountEdit, SIGNAL( returnPressed( const TQString & ) ), this, SLOT( signalIngredient() ) ); unitComboList = new UnitList; @@ -232,7 +232,7 @@ void IngredientInput::signalIngredient() bool IngredientInput::isInputValid() { if ( ingredientBox->currentText().stripWhiteSpace().isEmpty() ) { - KMessageBox::error( this, i18n( "Please enter an ingredient" ), QString::null ); + KMessageBox::error( this, i18n( "Please enter an ingredient" ), TQString::null ); ingredientBox->setFocus(); return false; } @@ -242,24 +242,24 @@ bool IngredientInput::isInputValid() bool IngredientInput::checkBounds() { if ( ingredientBox->currentText().length() > uint(database->maxIngredientNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Ingredient name cannot be longer than %1 characters." ) ).arg( database->maxIngredientNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Ingredient name cannot be longer than %1 characters." ) ).arg( database->maxIngredientNameLength() ) ); ingredientBox->lineEdit() ->setFocus(); ingredientBox->lineEdit() ->selectAll(); return false; } if ( unitBox->currentText().length() > uint(database->maxUnitNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Unit name cannot be longer than %1 characters." ) ).arg( database->maxUnitNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Unit name cannot be longer than %1 characters." ) ).arg( database->maxUnitNameLength() ) ); unitBox->lineEdit() ->setFocus(); unitBox->lineEdit() ->selectAll(); return false; } - QStringList prepMethodList = QStringList::split(",",prepMethodBox->currentText()); - for ( QStringList::const_iterator it = prepMethodList.begin(); it != prepMethodList.end(); ++it ) { + TQStringList prepMethodList = TQStringList::split(",",prepMethodBox->currentText()); + for ( TQStringList::const_iterator it = prepMethodList.begin(); it != prepMethodList.end(); ++it ) { if ( (*it).stripWhiteSpace().length() > uint(database->maxPrepMethodNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Preparation method cannot be longer than %1 characters." ) ).arg( database->maxPrepMethodNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Preparation method cannot be longer than %1 characters." ) ).arg( database->maxPrepMethodNameLength() ) ); prepMethodBox->lineEdit() ->setFocus(); prepMethodBox->lineEdit() ->selectAll(); return false; @@ -284,7 +284,7 @@ bool IngredientInput::checkAmountEdit() void IngredientInput::loadUnitListCombo() { - QString store_unit = unitBox->currentText(); + TQString store_unit = unitBox->currentText(); unitBox->clear(); // Empty the combo first unitBox->completionObject() ->clear(); @@ -337,23 +337,23 @@ Ingredient IngredientInput::ingredient() const return ing; } -QString IngredientInput::header() const +TQString IngredientInput::header() const { return headerBox->currentText().stripWhiteSpace(); } void IngredientInput::updateTabOrder() { - QWidget::setTabOrder( ingredientBox, amountEdit ); - QWidget::setTabOrder( amountEdit, unitBox ); - QWidget::setTabOrder( unitBox, prepMethodBox ); - QWidget::setTabOrder( prepMethodBox, orButton ); + TQWidget::setTabOrder( ingredientBox, amountEdit ); + TQWidget::setTabOrder( amountEdit, unitBox ); + TQWidget::setTabOrder( unitBox, prepMethodBox ); + TQWidget::setTabOrder( prepMethodBox, orButton ); } -IngredientInputWidget::IngredientInputWidget( RecipeDB *db, QWidget *parent ) : QVBox(parent), database(db) +IngredientInputWidget::IngredientInputWidget( RecipeDB *db, TQWidget *parent ) : TQVBox(parent), database(db) { - setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); m_ingInputs.append(new IngredientInput(database,this)); @@ -376,7 +376,7 @@ void IngredientInputWidget::clear() void IngredientInputWidget::updateInputs(bool on, IngredientInput* input) { - QValueList::iterator curr = m_ingInputs.find(input); + TQValueList::iterator curr = m_ingInputs.find(input); IngredientInput *prev_input = *curr; ++curr; @@ -384,7 +384,7 @@ void IngredientInputWidget::updateInputs(bool on, IngredientInput* input) IngredientInput *new_input = new IngredientInput(database,this,false); new_input->reloadCombos(); - QWidget::setTabOrder( prev_input, new_input ); + TQWidget::setTabOrder( prev_input, new_input ); new_input->updateTabOrder(); connect( new_input, SIGNAL(addIngredient()), this, SLOT(addIngredient()) ); @@ -409,7 +409,7 @@ void IngredientInputWidget::updateInputs(bool on, IngredientInput* input) void IngredientInputWidget::addIngredient() { if ( m_ingInputs[0]->isHeader() ) { - QString header = m_ingInputs[0]->header(); + TQString header = m_ingInputs[0]->header(); if ( header.isEmpty() ) return; @@ -417,13 +417,13 @@ void IngredientInputWidget::addIngredient() emit headerEntered( Element(header,group_id) ); } else { - for ( QValueList::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { + for ( TQValueList::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { if ( !(*it)->isInputValid() ) return; } - QValueList list; - for ( QValueList::const_iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { + TQValueList list; + for ( TQValueList::const_iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { Ingredient ing = (*it)->ingredient(); ing.ingredientID = createNewIngredientIfNecessary(ing.name,database); @@ -432,8 +432,8 @@ void IngredientInputWidget::addIngredient() if ( ing.units.id == -1 ) // this will happen if the dialog to create a unit was cancelled return ; - QValueList prepIDs = createNewPrepIfNecessary( ing.prepMethodList,database ); - QValueList::const_iterator id_it = prepIDs.begin(); + TQValueList prepIDs = createNewPrepIfNecessary( ing.prepMethodList,database ); + TQValueList::const_iterator id_it = prepIDs.begin(); for ( ElementList::iterator it = ing.prepMethodList.begin(); it != ing.prepMethodList.end(); ++it, ++id_it ) { (*it).id = *id_it; } @@ -451,7 +451,7 @@ void IngredientInputWidget::addIngredient() m_ingInputs[0]->setFocus(); //put cursor back to the ingredient name so user can begin next ingredient } -int IngredientInputWidget::createNewIngredientIfNecessary( const QString &ing, RecipeDB *database ) +int IngredientInputWidget::createNewIngredientIfNecessary( const TQString &ing, RecipeDB *database ) { int id = -1; if ( ing.isEmpty() ) @@ -465,13 +465,13 @@ int IngredientInputWidget::createNewIngredientIfNecessary( const QString &ing, R return id; } -int IngredientInputWidget::createNewUnitIfNecessary( const QString &unit, bool plural, int ingredientID, Unit &new_unit, RecipeDB *database ) +int IngredientInputWidget::createNewUnitIfNecessary( const TQString &unit, bool plural, int ingredientID, Unit &new_unit, RecipeDB *database ) { int id = database->findExistingUnitByName( unit ); if ( -1 == id ) { - CreateUnitDialog getUnit( 0, ( plural ) ? QString::null : unit, ( !plural ) ? QString::null : unit ); - if ( getUnit.exec() == QDialog::Accepted ) { + CreateUnitDialog getUnit( 0, ( plural ) ? TQString::null : unit, ( !plural ) ? TQString::null : unit ); + if ( getUnit.exec() == TQDialog::Accepted ) { new_unit = getUnit.newUnit(); database->createNewUnit( new_unit ); @@ -494,9 +494,9 @@ int IngredientInputWidget::createNewUnitIfNecessary( const QString &unit, bool p return id; } -QValueList IngredientInputWidget::createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *database ) +TQValueList IngredientInputWidget::createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *database ) { - QValueList ids; + TQValueList ids; if ( prepMethods.isEmpty() ) //no prep methods return ids; @@ -516,7 +516,7 @@ QValueList IngredientInputWidget::createNewPrepIfNecessary( const ElementLi } } -int IngredientInputWidget::createNewGroupIfNecessary( const QString &group, RecipeDB *database ) +int IngredientInputWidget::createNewGroupIfNecessary( const TQString &group, RecipeDB *database ) { if ( group.stripWhiteSpace().isEmpty() ) //no group return -1; @@ -535,7 +535,7 @@ int IngredientInputWidget::createNewGroupIfNecessary( const QString &group, Reci void IngredientInputWidget::reloadCombos() { - for ( QValueList::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) + for ( TQValueList::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) (*it)->reloadCombos(); } diff --git a/krecipes/src/widgets/ingredientinputwidget.h b/krecipes/src/widgets/ingredientinputwidget.h index 8a5f8f7..84d8023 100644 --- a/krecipes/src/widgets/ingredientinputwidget.h +++ b/krecipes/src/widgets/ingredientinputwidget.h @@ -15,18 +15,18 @@ #ifndef INGREDIENTINPUTWIDGET_H #define INGREDIENTINPUTWIDGET_H -#include +#include #include "datablocks/unit.h" -class QVBox; -class QHBox; -class QLabel; -class QButtonGroup; -class QWidgetStack; -class QGroupBox; -class QRadioButton; -class QCheckBox; +class TQVBox; +class TQHBox; +class TQLabel; +class TQButtonGroup; +class TQWidgetStack; +class TQGroupBox; +class TQRadioButton; +class TQCheckBox; class KComboBox; @@ -40,20 +40,20 @@ class Element; class ElementList; class IngredientInput; -class IngredientInputWidget : public QVBox +class IngredientInputWidget : public TQVBox { Q_OBJECT public: - IngredientInputWidget( RecipeDB *db, QWidget *parent ); + IngredientInputWidget( RecipeDB *db, TQWidget *parent ); ~IngredientInputWidget(); void clear(); - static int createNewIngredientIfNecessary( const QString &ing, RecipeDB *db ); - static int createNewUnitIfNecessary( const QString &unit, bool plural, int ingredient_id, Unit &new_unit, RecipeDB *db ); - static QValueList createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *db ); - static int createNewGroupIfNecessary( const QString &group, RecipeDB *db ); + static int createNewIngredientIfNecessary( const TQString &ing, RecipeDB *db ); + static int createNewUnitIfNecessary( const TQString &unit, bool plural, int ingredient_id, Unit &new_unit, RecipeDB *db ); + static TQValueList createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *db ); + static int createNewGroupIfNecessary( const TQString &group, RecipeDB *db ); signals: void ingredientEntered( const Ingredient &ing ); @@ -74,15 +74,15 @@ private: RecipeDB *database; - QValueList m_ingInputs; + TQValueList m_ingInputs; }; -class IngredientInput : public QHBox +class IngredientInput : public TQHBox { Q_OBJECT public: - IngredientInput( RecipeDB *db, QWidget *parent, bool allowHeader = true ); + IngredientInput( RecipeDB *db, TQWidget *parent, bool allowHeader = true ); ~IngredientInput(); void clear(); @@ -90,7 +90,7 @@ public: bool isHeader() const; Ingredient ingredient() const; - QString header() const; + TQString header() const; void reloadCombos(); void enableHeader( bool ); @@ -116,19 +116,19 @@ private: RecipeDB *database; UnitList *unitComboList; - QCheckBox *orButton; - QGroupBox *ingredientGBox; - QLabel *amountLabel; + TQCheckBox *orButton; + TQGroupBox *ingredientGBox; + TQLabel *amountLabel; FractionInput* amountEdit; - QLabel *unitLabel; + TQLabel *unitLabel; KComboBox* unitBox; - QLabel *prepMethodLabel; + TQLabel *prepMethodLabel; PrepMethodComboBox* prepMethodBox; - QLabel *ingredientLabel; + TQLabel *ingredientLabel; IngredientComboBox* ingredientBox; HeaderComboBox* headerBox; - QWidgetStack *header_ing_stack; - QButtonGroup *typeButtonGrp; + TQWidgetStack *header_ing_stack; + TQButtonGroup *typeButtonGrp; }; #endif //INGREDIENTINPUTWIDGET_H diff --git a/krecipes/src/widgets/ingredientlistview.cpp b/krecipes/src/widgets/ingredientlistview.cpp index 887896d..19f493d 100644 --- a/krecipes/src/widgets/ingredientlistview.cpp +++ b/krecipes/src/widgets/ingredientlistview.cpp @@ -21,7 +21,7 @@ #include "dialogs/createelementdialog.h" #include "dialogs/dependanciesdialog.h" -IngredientCheckListItem::IngredientCheckListItem( IngredientCheckListView* qlv, const Element &ing ) : QCheckListItem( qlv, QString::null, QCheckListItem::CheckBox ), +IngredientCheckListItem::IngredientCheckListItem( IngredientCheckListView* qlv, const Element &ing ) : TQCheckListItem( qlv, TQString::null, TQCheckListItem::CheckBox ), m_listview(qlv) { // Initialize the ingredient data with the the property data @@ -30,7 +30,7 @@ IngredientCheckListItem::IngredientCheckListItem( IngredientCheckListView* qlv, ingStored->name = ing.name; } -IngredientCheckListItem::IngredientCheckListItem( IngredientCheckListView* qlv, QListViewItem *after, const Element &ing ) : QCheckListItem( qlv, after, QString::null, QCheckListItem::CheckBox ), +IngredientCheckListItem::IngredientCheckListItem( IngredientCheckListView* qlv, TQListViewItem *after, const Element &ing ) : TQCheckListItem( qlv, after, TQString::null, TQCheckListItem::CheckBox ), m_listview(qlv) { // Initialize the ingredient data with the the property data @@ -47,7 +47,7 @@ int IngredientCheckListItem::id( void ) const { return ingStored->id; } -QString IngredientCheckListItem::name( void ) const +TQString IngredientCheckListItem::name( void ) const { return ingStored->name; } @@ -56,15 +56,15 @@ Element IngredientCheckListItem::ingredient() const return *ingStored; } -QString IngredientCheckListItem::text( int column ) const +TQString IngredientCheckListItem::text( int column ) const { switch ( column ) { case 0: return ( ingStored->name ); case 1: - return ( QString::number( ingStored->id ) ); + return ( TQString::number( ingStored->id ) ); default: - return QString::null; + return TQString::null; } } @@ -73,10 +73,10 @@ void IngredientCheckListItem::stateChange( bool on ) m_listview->stateChange(this,on); } -IngredientListView::IngredientListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db, db->ingredientCount() ) +IngredientListView::IngredientListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db, db->ingredientCount() ) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void IngredientListView::init() @@ -104,7 +104,7 @@ void IngredientListView::checkCreateIngredient( const Element &el ) } -StdIngredientListView::StdIngredientListView( QWidget *parent, RecipeDB *db, bool editable ) : IngredientListView( parent, db ) +StdIngredientListView::StdIngredientListView( TQWidget *parent, RecipeDB *db, bool editable ) : IngredientListView( parent, db ) { addColumn( i18n( "Ingredient" ) ); @@ -127,13 +127,13 @@ StdIngredientListView::StdIngredientListView( QWidget *parent, RecipeDB *db, boo delete il; - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( modIngredient( QListViewItem* ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem* ) ), this, SLOT( saveIngredient( QListViewItem* ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem* ) ), this, SLOT( modIngredient( TQListViewItem* ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem* ) ), this, SLOT( saveIngredient( TQListViewItem* ) ) ); } } -void StdIngredientListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdIngredientListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -143,8 +143,8 @@ void StdIngredientListView::createNew() { CreateElementDialog * elementDialog = new CreateElementDialog( this, i18n( "New Ingredient" ) ); - if ( elementDialog->exec() == QDialog::Accepted ) { - QString result = elementDialog->newElementName(); + if ( elementDialog->exec() == TQDialog::Accepted ) { + TQString result = elementDialog->newElementName(); if ( checkBounds( result ) ) database->createNewIngredient( result ); // Create the new author in the database @@ -154,7 +154,7 @@ void StdIngredientListView::createNew() void StdIngredientListView::remove () { - QListViewItem * it = currentItem(); + TQListViewItem * it = currentItem(); if ( it ) { int ingredientID = it->text( 1 ).toInt(); @@ -171,7 +171,7 @@ void StdIngredientListView::remove DependanciesDialog warnDialog( this, list ); warnDialog.setCustomWarning( i18n("You are about to permanantly delete recipes from your database.") ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removeIngredient( ingredientID ); } } @@ -179,7 +179,7 @@ void StdIngredientListView::remove void StdIngredientListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) IngredientListView::rename( item, 0 ); @@ -187,22 +187,22 @@ void StdIngredientListView::rename() void StdIngredientListView::createIngredient( const Element &ing ) { - createElement(new QListViewItem( this, ing.name, QString::number( ing.id ) )); + createElement(new TQListViewItem( this, ing.name, TQString::number( ing.id ) )); } void StdIngredientListView::removeIngredient( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } -void StdIngredientListView::modIngredient( QListViewItem* i ) +void StdIngredientListView::modIngredient( TQListViewItem* i ) { if ( i ) IngredientListView::rename( i, 0); } -void StdIngredientListView::saveIngredient( QListViewItem* i ) +void StdIngredientListView::saveIngredient( TQListViewItem* i ) { if ( !checkBounds( i->text( 0 ) ) ) { reload(ForceReload); //reset the changed text @@ -229,10 +229,10 @@ void StdIngredientListView::saveIngredient( QListViewItem* i ) } } -bool StdIngredientListView::checkBounds( const QString &name ) +bool StdIngredientListView::checkBounds( const TQString &name ) { if ( name.length() > uint(database->maxIngredientNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Ingredient name cannot be longer than %1 characters." ) ).arg( database->maxIngredientNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Ingredient name cannot be longer than %1 characters." ) ).arg( database->maxIngredientNameLength() ) ); return false; } @@ -241,7 +241,7 @@ bool StdIngredientListView::checkBounds( const QString &name ) -IngredientCheckListView::IngredientCheckListView( QWidget *parent, RecipeDB *db ) : IngredientListView( parent, db ) +IngredientCheckListView::IngredientCheckListView( TQWidget *parent, RecipeDB *db ) : IngredientListView( parent, db ) { addColumn( i18n( "Ingredient" ) ); @@ -258,7 +258,7 @@ void IngredientCheckListView::createIngredient( const Element &ing ) void IngredientCheckListView::removeIngredient( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } @@ -266,8 +266,8 @@ void IngredientCheckListView::load( int limit, int offset ) { IngredientListView::load(limit,offset); - for ( QValueList::const_iterator ing_it = m_selections.begin(); ing_it != m_selections.end(); ++ing_it ) { - QCheckListItem * item = ( QCheckListItem* ) findItem( QString::number( (*ing_it).id ), 1 ); + for ( TQValueList::const_iterator ing_it = m_selections.begin(); ing_it != m_selections.end(); ++ing_it ) { + TQCheckListItem * item = ( TQCheckListItem* ) findItem( TQString::number( (*ing_it).id ), 1 ); if ( item ) { item->setOn(true); } diff --git a/krecipes/src/widgets/ingredientlistview.h b/krecipes/src/widgets/ingredientlistview.h index 5487a11..877ec97 100644 --- a/krecipes/src/widgets/ingredientlistview.h +++ b/krecipes/src/widgets/ingredientlistview.h @@ -23,18 +23,18 @@ class IngredientCheckListView; /** @author Unai Garro */ -class IngredientCheckListItem: public QCheckListItem +class IngredientCheckListItem: public TQCheckListItem { public: IngredientCheckListItem( IngredientCheckListView* qlv, const Element &ing ); - IngredientCheckListItem( IngredientCheckListView* qlv, QListViewItem *after, const Element &ing ); + IngredientCheckListItem( IngredientCheckListView* qlv, TQListViewItem *after, const Element &ing ); ~IngredientCheckListItem( void ); int id( void ) const; - QString name( void ) const; + TQString name( void ) const; Element ingredient() const; - virtual QString text( int column ) const; + virtual TQString text( int column ) const; protected: virtual void stateChange( bool on ); @@ -51,7 +51,7 @@ class IngredientListView : public DBListViewBase Q_OBJECT public: - IngredientListView( QWidget *parent, RecipeDB *db ); + IngredientListView( TQWidget *parent, RecipeDB *db ); protected slots: virtual void createIngredient( const Element & ) = 0; @@ -72,25 +72,25 @@ class StdIngredientListView : public IngredientListView Q_OBJECT public: - StdIngredientListView( QWidget *parent, RecipeDB *db, bool editable = false ); + StdIngredientListView( TQWidget *parent, RecipeDB *db, bool editable = false ); protected: virtual void createIngredient( const Element & ); virtual void removeIngredient( int ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove (); void rename(); - void modIngredient( QListViewItem* i ); - void saveIngredient( QListViewItem* i ); + void modIngredient( TQListViewItem* i ); + void saveIngredient( TQListViewItem* i ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); KPopupMenu *kpop; }; @@ -100,11 +100,11 @@ private: class IngredientCheckListView : public IngredientListView { public: - IngredientCheckListView( QWidget *parent, RecipeDB *db ); + IngredientCheckListView( TQWidget *parent, RecipeDB *db ); virtual void stateChange(IngredientCheckListItem *,bool); - QValueList selections() const{ return m_selections; } + TQValueList selections() const{ return m_selections; } protected: virtual void createIngredient( const Element &ing ); @@ -113,7 +113,7 @@ protected: virtual void load( int limit, int offset ); private: - QValueList m_selections; + TQValueList m_selections; }; #endif //INGREDIENTLISTVIEW_H diff --git a/krecipes/src/widgets/kdateedit.cpp b/krecipes/src/widgets/kdateedit.cpp index 7bab504..e29fa1a 100644 --- a/krecipes/src/widgets/kdateedit.cpp +++ b/krecipes/src/widgets/kdateedit.cpp @@ -21,10 +21,10 @@ Boston, MA 02110-1301 USA */ -#include -#include -#include -#include +#include +#include +#include +#include //#include #include @@ -34,9 +34,9 @@ #include "kdateedit.h" -QRect desktopGeometry(QWidget* w) +TQRect desktopGeometry(TQWidget* w) { - QDesktopWidget *dw = QApplication::desktop(); + TQDesktopWidget *dw = TQApplication::desktop(); if (dw->isVirtualDesktop()) { KConfigGroup group(KGlobal::config(), "Windows"); if (group.readBoolEntry("XineramaEnabled", true) && @@ -52,14 +52,14 @@ QRect desktopGeometry(QWidget* w) } } -class DateValidator : public QValidator +class DateValidator : public TQValidator { public: - DateValidator( const QStringList &keywords, QWidget* parent, const char* name = 0 ) - : QValidator( parent, name ), mKeywords( keywords ) + DateValidator( const TQStringList &keywords, TQWidget* parent, const char* name = 0 ) + : TQValidator( parent, name ), mKeywords( keywords ) {} - virtual State validate( QString &str, int& ) const + virtual State validate( TQString &str, int& ) const { int length = str.length(); @@ -79,19 +79,19 @@ class DateValidator : public QValidator } private: - QStringList mKeywords; + TQStringList mKeywords; }; -KDateEdit::KDateEdit( QWidget *parent, const char *name ) - : QComboBox( true, parent, name ), +KDateEdit::KDateEdit( TQWidget *parent, const char *name ) + : TQComboBox( true, parent, name ), mReadOnly( false ), mDiscardNextMousePress( false ) { // need at least one entry for popup to work setMaxCount( 1 ); - mDate = QDate::currentDate(); - QString today = KGlobal::locale()->formatDate( mDate, true ); + mDate = TQDate::currentDate(); + TQString today = KGlobal::locale()->formatDate( mDate, true ); insertItem( today ); setCurrentItem( 0 ); @@ -100,15 +100,15 @@ KDateEdit::KDateEdit( QWidget *parent, const char *name ) connect( lineEdit(), SIGNAL( returnPressed() ), this, SLOT( lineEnterPressed() ) ); - connect( this, SIGNAL( textChanged( const QString& ) ), - SLOT( slotTextChanged( const QString& ) ) ); + connect( this, SIGNAL( textChanged( const TQString& ) ), + SLOT( slotTextChanged( const TQString& ) ) ); mPopup = new KDatePickerPopup( KDatePickerPopup::DatePicker | KDatePickerPopup::Words ); mPopup->hide(); mPopup->installEventFilter( this ); - connect( mPopup, SIGNAL( dateChanged( QDate ) ), - SLOT( dateSelected( QDate ) ) ); + connect( mPopup, SIGNAL( dateChanged( TQDate ) ), + SLOT( dateSelected( TQDate ) ) ); // handle keyword entry setupKeywords(); @@ -125,13 +125,13 @@ KDateEdit::~KDateEdit() mPopup = 0; } -void KDateEdit::setDate( const QDate& date ) +void KDateEdit::setDate( const TQDate& date ) { assignDate( date ); updateView(); } -QDate KDateEdit::date() const +TQDate KDateEdit::date() const { return mDate; } @@ -152,9 +152,9 @@ void KDateEdit::popup() if ( mReadOnly ) return; - QRect desk = desktopGeometry( this ); + TQRect desk = desktopGeometry( this ); - QPoint popupPoint = mapToGlobal( QPoint( 0,0 ) ); + TQPoint popupPoint = mapToGlobal( TQPoint( 0,0 ) ); int dateFrameHeight = mPopup->sizeHint().height(); if ( popupPoint.y() + height() + dateFrameHeight > desk.bottom() ) @@ -175,26 +175,26 @@ void KDateEdit::popup() if ( mDate.isValid() ) mPopup->setDate( mDate ); else - mPopup->setDate( QDate::currentDate() ); + mPopup->setDate( TQDate::currentDate() ); mPopup->popup( popupPoint ); // The combo box is now shown pressed. Make it show not pressed again // by causing its (invisible) list box to emit a 'selected' signal. // First, ensure that the list box contains the date currently displayed. - QDate date = parseDate(); + TQDate date = parseDate(); assignDate( date ); updateView(); // Now, simulate an Enter to unpress it - QListBox *lb = listBox(); + TQListBox *lb = listBox(); if (lb) { lb->setCurrentItem(0); - QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, 0, 0); - QApplication::postEvent(lb, keyEvent); + TQKeyEvent* keyEvent = new TQKeyEvent(TQEvent::KeyPress, TQt::Key_Enter, 0, 0); + TQApplication::postEvent(lb, keyEvent); } } -void KDateEdit::dateSelected( QDate date ) +void KDateEdit::dateSelected( TQDate date ) { if (assignDate( date ) ) { updateView(); @@ -206,7 +206,7 @@ void KDateEdit::dateSelected( QDate date ) } } -void KDateEdit::dateEntered( QDate date ) +void KDateEdit::dateEntered( TQDate date ) { if (assignDate( date ) ) { updateView(); @@ -218,7 +218,7 @@ void KDateEdit::lineEnterPressed() { bool replaced = false; - QDate date = parseDate( &replaced ); + TQDate date = parseDate( &replaced ); if (assignDate( date ) ) { if ( replaced ) @@ -228,18 +228,18 @@ void KDateEdit::lineEnterPressed() } } -QDate KDateEdit::parseDate( bool *replaced ) const +TQDate KDateEdit::parseDate( bool *replaced ) const { - QString text = currentText(); - QDate result; + TQString text = currentText(); + TQDate result; if ( replaced ) (*replaced) = false; if ( text.isEmpty() ) - result = QDate(); + result = TQDate(); else if ( mKeywordMap.contains( text.lower() ) ) { - QDate today = QDate::currentDate(); + TQDate today = TQDate::currentDate(); int i = mKeywordMap[ text.lower() ]; if ( i >= 100 ) { /* A day name has been entered. Convert to offset from today. @@ -268,30 +268,30 @@ QDate KDateEdit::parseDate( bool *replaced ) const return result; } -bool KDateEdit::eventFilter( QObject *object, QEvent *event ) +bool KDateEdit::eventFilter( TQObject *object, TQEvent *event ) { if ( object == lineEdit() ) { // We only process the focus out event if the text has changed // since we got focus - if ( (event->type() == QEvent::FocusOut) && mTextChanged ) { + if ( (event->type() == TQEvent::FocusOut) && mTextChanged ) { lineEnterPressed(); mTextChanged = false; - } else if ( event->type() == QEvent::KeyPress ) { + } else if ( event->type() == TQEvent::KeyPress ) { // Up and down arrow keys step the date - QKeyEvent* keyEvent = (QKeyEvent*)event; + TQKeyEvent* keyEvent = (TQKeyEvent*)event; - if ( keyEvent->key() == Qt::Key_Return ) { + if ( keyEvent->key() == TQt::Key_Return ) { lineEnterPressed(); return true; } int step = 0; - if ( keyEvent->key() == Qt::Key_Up ) + if ( keyEvent->key() == TQt::Key_Up ) step = 1; - else if ( keyEvent->key() == Qt::Key_Down ) + else if ( keyEvent->key() == TQt::Key_Down ) step = -1; if ( step && !mReadOnly ) { - QDate date = parseDate(); + TQDate date = parseDate(); if ( date.isValid() ) { date = date.addDays( step ); if ( assignDate( date ) ) { @@ -305,12 +305,12 @@ bool KDateEdit::eventFilter( QObject *object, QEvent *event ) } else { // It's a date picker event switch ( event->type() ) { - case QEvent::MouseButtonDblClick: - case QEvent::MouseButtonPress: { - QMouseEvent *mouseEvent = (QMouseEvent*)event; + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseButtonPress: { + TQMouseEvent *mouseEvent = (TQMouseEvent*)event; if ( !mPopup->rect().contains( mouseEvent->pos() ) ) { - QPoint globalPos = mPopup->mapToGlobal( mouseEvent->pos() ); - if ( QApplication::widgetAt( globalPos, true ) == this ) { + TQPoint globalPos = mPopup->mapToGlobal( mouseEvent->pos() ); + if ( TQApplication::widgetAt( globalPos, true ) == this ) { // The date picker is being closed by a click on the // KDateEdit widget. Avoid popping it up again immediately. mDiscardNextMousePress = true; @@ -327,19 +327,19 @@ bool KDateEdit::eventFilter( QObject *object, QEvent *event ) return false; } -void KDateEdit::mousePressEvent( QMouseEvent *event ) +void KDateEdit::mousePressEvent( TQMouseEvent *event ) { - if ( event->button() == Qt::LeftButton && mDiscardNextMousePress ) { + if ( event->button() == TQt::LeftButton && mDiscardNextMousePress ) { mDiscardNextMousePress = false; return; } - QComboBox::mousePressEvent( event ); + TQComboBox::mousePressEvent( event ); } -void KDateEdit::slotTextChanged( const QString& ) +void KDateEdit::slotTextChanged( const TQString& ) { - QDate date = parseDate(); + TQDate date = parseDate(); if ( assignDate( date ) ) emit dateChanged( date ); @@ -356,7 +356,7 @@ void KDateEdit::setupKeywords() mKeywordMap.insert( i18n( "yesterday" ), -1 ); #if 0 //depends on KDE 3.2 - QString dayName; + TQString dayName; for ( int i = 1; i <= 7; ++i ) { dayName = KGlobal::locale()->calendar()->weekDayName( i ).lower(); mKeywordMap.insert( dayName, i + 100 ); @@ -364,7 +364,7 @@ void KDateEdit::setupKeywords() #endif } -bool KDateEdit::assignDate( const QDate& date ) +bool KDateEdit::assignDate( const TQDate& date ) { mDate = date; mTextChanged = false; @@ -373,7 +373,7 @@ bool KDateEdit::assignDate( const QDate& date ) void KDateEdit::updateView() { - QString dateString; + TQString dateString; if ( mDate.isValid() ) dateString = KGlobal::locale()->formatDate( mDate, true ); diff --git a/krecipes/src/widgets/kdateedit.h b/krecipes/src/widgets/kdateedit.h index bfe7d9e..3bbcbbf 100644 --- a/krecipes/src/widgets/kdateedit.h +++ b/krecipes/src/widgets/kdateedit.h @@ -23,13 +23,13 @@ #ifndef KDATEEDIT_H #define KDATEEDIT_H -#include -#include -#include +#include +#include +#include #include "kdatepickerpopup.h" -class QEvent; +class TQEvent; /** A date editing widget that consists of an editable combo box. @@ -48,19 +48,19 @@ class QEvent; @author David Jarvie @author Tobias Koenig */ -class KDateEdit : public QComboBox +class KDateEdit : public TQComboBox { Q_OBJECT public: - KDateEdit( QWidget *parent = 0, const char *name = 0 ); + KDateEdit( TQWidget *parent = 0, const char *name = 0 ); virtual ~KDateEdit(); /** @return The date entered. This date could be invalid, you have to check validity yourself. */ - QDate date() const; + TQDate date() const; /** Sets whether the widget is read-only for the user. If read-only, @@ -82,7 +82,7 @@ class KDateEdit : public QComboBox This signal is emitted whenever the user modifies the date. The passed date can be invalid. */ - void dateChanged( const QDate &date ); + void dateChanged( const TQDate &date ); public slots: /** @@ -91,30 +91,30 @@ class KDateEdit : public QComboBox @param date The new date to display. This date must be valid or it will not be set */ - void setDate( const QDate &date ); + void setDate( const TQDate &date ); protected slots: void lineEnterPressed(); - void slotTextChanged( const QString& ); - void dateEntered( QDate ); - void dateSelected( QDate ); + void slotTextChanged( const TQString& ); + void dateEntered( TQDate ); + void dateSelected( TQDate ); protected: - virtual bool eventFilter( QObject*, QEvent* ); - virtual void mousePressEvent( QMouseEvent* ); + virtual bool eventFilter( TQObject*, TQEvent* ); + virtual void mousePressEvent( TQMouseEvent* ); /** Sets the date, without altering the display. This method is used internally to set the widget's date value. As a virtual method, it allows derived classes to perform additional validation on the date value before it is set. Derived classes should return true if - QDate::isValid(@p date) returns false. + TQDate::isValid(@p date) returns false. @param date The new date to set. @return True if the date was set, false if it was considered invalid and remains unchanged. */ - virtual bool assignDate( const QDate &date ); + virtual bool assignDate( const TQDate &date ); /** Fills the keyword map. Reimplement it if you want additional @@ -123,17 +123,17 @@ class KDateEdit : public QComboBox void setupKeywords(); private: - QDate parseDate( bool* = 0 ) const; + TQDate parseDate( bool* = 0 ) const; void updateView(); KDatePickerPopup *mPopup; - QDate mDate; + TQDate mDate; bool mReadOnly; bool mTextChanged; bool mDiscardNextMousePress; - QMap mKeywordMap; + TQMap mKeywordMap; }; #endif diff --git a/krecipes/src/widgets/kdatepickerpopup.cpp b/krecipes/src/widgets/kdatepickerpopup.cpp index 5a58ccd..ffad16c 100644 --- a/krecipes/src/widgets/kdatepickerpopup.cpp +++ b/krecipes/src/widgets/kdatepickerpopup.cpp @@ -19,26 +19,26 @@ Boston, MA 02110-1301 USA */ -#include -#include +#include +#include #include #include "kdatepickerpopup.h" -KDatePickerPopup::KDatePickerPopup( int items, const QDate &date, QWidget *parent, +KDatePickerPopup::KDatePickerPopup( int items, const TQDate &date, TQWidget *parent, const char *name ) - : QPopupMenu( parent, name ) + : TQPopupMenu( parent, name ) { mItems = items; mDatePicker = new KDatePicker( this ); mDatePicker->setCloseButton( false ); - connect( mDatePicker, SIGNAL( dateEntered( QDate ) ), - SLOT( slotDateChanged( QDate ) ) ); - connect( mDatePicker, SIGNAL( dateSelected( QDate ) ), - SLOT( slotDateChanged( QDate ) ) ); + connect( mDatePicker, SIGNAL( dateEntered( TQDate ) ), + SLOT( slotDateChanged( TQDate ) ) ); + connect( mDatePicker, SIGNAL( dateSelected( TQDate ) ), + SLOT( slotDateChanged( TQDate ) ) ); mDatePicker->setDate( date ); @@ -76,7 +76,7 @@ KDatePicker *KDatePickerPopup::datePicker() const return mDatePicker; } -void KDatePickerPopup::setDate( const QDate &date ) +void KDatePickerPopup::setDate( const TQDate &date ) { mDatePicker->setDate( date ); } @@ -89,7 +89,7 @@ void KDatePickerPopup::setItems( int items ) } #endif -void KDatePickerPopup::slotDateChanged( QDate date ) +void KDatePickerPopup::slotDateChanged( TQDate date ) { emit dateChanged( date ); hide(); @@ -97,27 +97,27 @@ void KDatePickerPopup::slotDateChanged( QDate date ) void KDatePickerPopup::slotToday() { - emit dateChanged( QDate::currentDate() ); + emit dateChanged( TQDate::currentDate() ); } void KDatePickerPopup::slotYesterday() { - emit dateChanged( QDate::currentDate().addDays( -1 ) ); + emit dateChanged( TQDate::currentDate().addDays( -1 ) ); } void KDatePickerPopup::slotNoDate() { - emit dateChanged( QDate() ); + emit dateChanged( TQDate() ); } void KDatePickerPopup::slotLastWeek() { - emit dateChanged( QDate::currentDate().addDays( -7 ) ); + emit dateChanged( TQDate::currentDate().addDays( -7 ) ); } void KDatePickerPopup::slotLastMonth() { - emit dateChanged( QDate::currentDate().addMonths( -1 ) ); + emit dateChanged( TQDate::currentDate().addMonths( -1 ) ); } #include "kdatepickerpopup.moc" diff --git a/krecipes/src/widgets/kdatepickerpopup.h b/krecipes/src/widgets/kdatepickerpopup.h index 6a09a26..d3e4e72 100644 --- a/krecipes/src/widgets/kdatepickerpopup.h +++ b/krecipes/src/widgets/kdatepickerpopup.h @@ -21,19 +21,19 @@ #ifndef KDATEPICKERPOPUP_H #define KDATEPICKERPOPUP_H -#include -#include +#include +#include #include /** @short This menu helps the user to select a date quickly. - This menu helps the user to select a date quicly. It offers various ways of selecting, e.g. with a KDatePicker or with words like "Tomorrow". + This menu helps the user to select a date tquicly. It offers various ways of selecting, e.g. with a KDatePicker or with words like "Tomorrow". The available items are: - @li NoDate: A menu-item with "No Date". If choosen, the datepicker will emit a null QDate. + @li NoDate: A menu-item with "No Date". If choosen, the datepicker will emit a null TQDate. @li DatePicker: Show a KDatePicker-widget. @li Words: Show items like "Today", "Tomorrow" or "Next Week". @@ -41,7 +41,7 @@ @author Bram Schoenmakers */ -class KDatePickerPopup: public QPopupMenu +class KDatePickerPopup: public TQPopupMenu { Q_OBJECT public: @@ -55,8 +55,8 @@ class KDatePickerPopup: public QPopupMenu @param parent The object's parent. @param name The object's name. */ - KDatePickerPopup( int items = 2, const QDate &date = QDate::currentDate(), - QWidget *parent = 0, const char *name = 0 ); + KDatePickerPopup( int items = 2, const TQDate &date = TQDate::currentDate(), + TQWidget *parent = 0, const char *name = 0 ); /** @return A pointer to the private variable mDatePicker, an instance of @@ -64,7 +64,7 @@ class KDatePickerPopup: public QPopupMenu */ KDatePicker *datePicker() const; - void setDate( const QDate &date ); + void setDate( const TQDate &date ); #if 0 /** Set items which should be shown and rebuilds the menu afterwards. Only if the menu is not visible. @@ -81,10 +81,10 @@ class KDatePickerPopup: public QPopupMenu This signal emits the new date (selected with datepicker or other menu-items). */ - void dateChanged ( QDate ); + void dateChanged ( TQDate ); protected slots: - void slotDateChanged ( QDate ); + void slotDateChanged ( TQDate ); void slotToday(); void slotYesterday(); diff --git a/krecipes/src/widgets/krelistview.cpp b/krecipes/src/widgets/krelistview.cpp index 3df8fae..99b1b81 100644 --- a/krecipes/src/widgets/krelistview.cpp +++ b/krecipes/src/widgets/krelistview.cpp @@ -19,20 +19,20 @@ #include "widgets/dblistviewbase.h" -KreListView::KreListView( QWidget *parent, const QString &title, bool filter, int filterCol, QWidget *embeddedWidget ) : QVBox( parent ) +KreListView::KreListView( TQWidget *parent, const TQString &title, bool filter, int filterCol, TQWidget *embeddedWidget ) : TQVBox( parent ) { filteredColumn = filterCol; - QWidget *header = this; + TQWidget *header = this; if ( filter || embeddedWidget ) { - header = new QHBox( this ); - ( ( QHBox* ) header ) ->setSpacing( 15 ); + header = new TQHBox( this ); + ( ( TQHBox* ) header ) ->setSpacing( 15 ); } if ( !title.isNull() ) { - listLabel = new QLabel( header ); - listLabel->setFrameShape( QFrame::GroupBoxPanel ); - listLabel->setFrameShadow( QFrame::Sunken ); + listLabel = new TQLabel( header ); + listLabel->setFrameShape( TQFrame::GroupBoxPanel ); + listLabel->setFrameShadow( TQFrame::Sunken ); listLabel->setPaletteForegroundColor( KGlobalSettings::highlightedTextColor() ); listLabel->setPaletteBackgroundColor( KGlobalSettings::highlightColor().light( 120 ) ); // 120, to match the kremenu settings listLabel->setText( title ); @@ -40,37 +40,37 @@ KreListView::KreListView( QWidget *parent, const QString &title, bool filter, in } if ( filter ) { - filterBox = new QHBox( header ); - filterBox->setFrameShape( QFrame::Box ); + filterBox = new TQHBox( header ); + filterBox->setFrameShape( TQFrame::Box ); filterBox->setMargin( 2 ); - filterLabel = new QLabel( filterBox ); + filterLabel = new TQLabel( filterBox ); filterLabel->setText( i18n( "Search:" ) ); filterEdit = new KLineEdit( filterBox ); } list = new KListView( this ); - list->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); - setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); + list->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ); + setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ); setSpacing( 10 ); // If the user provides a widget, embed it into the header if ( embeddedWidget ) - embeddedWidget->reparent( header, QPoint( 0, 0 ) ); + embeddedWidget->reparent( header, TQPoint( 0, 0 ) ); //Connect Signals & Slots if ( filter ) { - connect( filterEdit, SIGNAL( textChanged( const QString& ) ), SIGNAL( textChanged(const QString&) ) ); - connect( this, SIGNAL( textChanged( const QString& ) ), SLOT( filter( const QString& ) ) ); + connect( filterEdit, SIGNAL( textChanged( const TQString& ) ), SIGNAL( textChanged(const TQString&) ) ); + connect( this, SIGNAL( textChanged( const TQString& ) ), SLOT( filter( const TQString& ) ) ); } } KreListView::~KreListView() {} -void KreListView::filter( const QString& s ) +void KreListView::filter( const TQString& s ) { - for ( QListViewItem * it = list->firstChild();it;it = it->nextSibling() ) { + for ( TQListViewItem * it = list->firstChild();it;it = it->nextSibling() ) { if ( it->rtti() == NEXTLISTITEM_RTTI || it->rtti() == PREVLISTITEM_RTTI ) continue; @@ -99,9 +99,9 @@ void KreListView::refilter() } } -void KreListView::setCustomFilter( QObject *receiver, const char *slot ) +void KreListView::setCustomFilter( TQObject *receiver, const char *slot ) { - connect( this, SIGNAL( textChanged( const QString& ) ), receiver, slot ); + connect( this, SIGNAL( textChanged( const TQString& ) ), receiver, slot ); } void KreListView::setListView( DBListViewBase *list_view ) diff --git a/krecipes/src/widgets/krelistview.h b/krecipes/src/widgets/krelistview.h index d6ad342..29288f7 100644 --- a/krecipes/src/widgets/krelistview.h +++ b/krecipes/src/widgets/krelistview.h @@ -11,8 +11,8 @@ #ifndef KRELISTVIEW_H #define KRELISTVIEW_H -#include -#include +#include +#include #include #include @@ -22,12 +22,12 @@ class DBListViewBase; @author Unai Garro */ -class KreListView: public QVBox +class KreListView: public TQVBox { Q_OBJECT public: - KreListView( QWidget *parent, const QString &title = QString::null, bool filter = false, int filterCol = 0, QWidget *embeddedWidget = 0 ); + KreListView( TQWidget *parent, const TQString &title = TQString::null, bool filter = false, int filterCol = 0, TQWidget *embeddedWidget = 0 ); ~KreListView(); KListView *listView() { @@ -41,25 +41,25 @@ public: } void setListView( DBListViewBase *list_view ); - void setCustomFilter( QObject *receiver, const char *slot ); - QString filterText() const { return filterEdit->text(); } + void setCustomFilter( TQObject *receiver, const char *slot ); + TQString filterText() const { return filterEdit->text(); } public slots: void refilter(); signals: - void textChanged( const QString & ); + void textChanged( const TQString & ); private: - QHBox *filterBox; - QLabel *listLabel; + TQHBox *filterBox; + TQLabel *listLabel; int filteredColumn; - QLabel *filterLabel; + TQLabel *filterLabel; KLineEdit *filterEdit; KListView *list; private slots: - void filter( const QString& s ); + void filter( const TQString& s ); }; #endif diff --git a/krecipes/src/widgets/kremenu.cpp b/krecipes/src/widgets/kremenu.cpp index 892ff75..ca76921 100644 --- a/krecipes/src/widgets/kremenu.cpp +++ b/krecipes/src/widgets/kremenu.cpp @@ -11,14 +11,14 @@ ***************************************************************************/ #include "kremenu.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -30,11 +30,11 @@ #include #include -KreMenu::KreMenu( QWidget *parent, const char *name ) : -#if QT_VERSION >= 0x030200 - QWidget( parent, name, Qt::WNoAutoErase ) +KreMenu::KreMenu( TQWidget *parent, const char *name ) : +#if TQT_VERSION >= 0x030200 + TQWidget( parent, name, TQt::WNoAutoErase ) #else - QWidget( parent, name ) + TQWidget( parent, name ) #endif { Menu newMenu; @@ -45,19 +45,19 @@ KreMenu::KreMenu( QWidget *parent, const char *name ) : m_currentMenu = &( *currentMenuId ); setMouseTracking( true ); - setFocusPolicy( QWidget::StrongFocus ); - setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); + setFocusPolicy( TQWidget::StrongFocus ); + setSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Preferred ); } KreMenu::~KreMenu() {} -void KreMenu::childEvent ( QChildEvent *e ) +void KreMenu::childEvent ( TQChildEvent *e ) { - if ( e->type() == QChildEvent::ChildInserted ) { + if ( e->type() == TQChildEvent::ChildInserted ) { - QObject * child = e->child(); + TQObject * child = e->child(); if ( child->inherits( "KreMenuButton" ) ) { KreMenuButton * button = ( KreMenuButton* ) child; @@ -81,8 +81,8 @@ void KreMenu::childEvent ( QChildEvent *e ) connect ( button, SIGNAL( clicked( KreMenuButton* ) ), this, SLOT( collectClicks( KreMenuButton* ) ) ); } } - else if ( e->type() == QChildEvent::ChildRemoved ) { - QObject * child = e->child(); + else if ( e->type() == TQChildEvent::ChildRemoved ) { + TQObject * child = e->child(); KreMenuButton *button = ( KreMenuButton* ) child; if ( m_currentMenu->positionList.find( button ) != m_currentMenu->positionList.end() ) // Ensure that what was removed was a button @@ -104,7 +104,7 @@ void KreMenu::childEvent ( QChildEvent *e ) } } - QWidget::childEvent( e ); + TQWidget::childEvent( e ); } void KreMenu::collectClicks( KreMenuButton *w ) @@ -118,7 +118,7 @@ void KreMenu::collectClicks( KreMenuButton *w ) emit clicked( panel ); } -MenuId KreMenu::createSubMenu( const QString &title, const QString &icon ) +MenuId KreMenu::createSubMenu( const TQString &title, const TQString &icon ) { // Create the new menu @@ -164,40 +164,40 @@ void KreMenu::highlightButton( KreMenuButton *button ) buttonMenu->activeButton = button; } -void KreMenu::keyPressEvent( QKeyEvent *e ) +void KreMenu::keyPressEvent( TQKeyEvent *e ) { switch ( e->key() ) { - case Qt::Key_Up: { + case TQt::Key_Up: { int current_index = m_currentMenu->positionList[ m_currentMenu->activeButton ]; if ( current_index > 0 ) { highlightButton( m_currentMenu->widgetList[ current_index - 1 ] ); //simulate a mouse click - QMouseEvent me( QEvent::MouseButtonPress, QPoint(), 0, 0 ); + TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(), 0, 0 ); KApplication::sendEvent( m_currentMenu->activeButton, &me ); e->accept(); } break; } - case Qt::Key_Down: { + case TQt::Key_Down: { int current_index = m_currentMenu->positionList[ m_currentMenu->activeButton ]; if ( current_index < int( m_currentMenu->positionList.count() ) - 1 ) { highlightButton( m_currentMenu->widgetList[ current_index + 1 ] ); //simulate a mouse click - QMouseEvent me( QEvent::MouseButtonPress, QPoint(), 0, 0 ); + TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(), 0, 0 ); KApplication::sendEvent( m_currentMenu->activeButton, &me ); e->accept(); } break; } - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Space: { + case TQt::Key_Enter: + case TQt::Key_Return: + case TQt::Key_Space: { //simulate a mouse click - QMouseEvent me( QEvent::MouseButtonPress, QPoint(), 0, 0 ); + TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(), 0, 0 ); KApplication::sendEvent( m_currentMenu->activeButton, &me ); e->accept(); @@ -208,43 +208,43 @@ void KreMenu::keyPressEvent( QKeyEvent *e ) } } -QSize KreMenu::sizeHint() const +TQSize KreMenu::sizeHint() const { return minimumSizeHint(); } //the minimum size hint will be the minimum size hint of the largest child -QSize KreMenu::minimumSizeHint() const +TQSize KreMenu::minimumSizeHint() const { int width = 30; - QObjectList *childElements = queryList( 0, 0, false, false ); //only first-generation children (not recursive) - QObjectListIterator it( *childElements ); + TQObjectList *childElements = queryList( 0, 0, false, false ); //only first-generation children (not recursive) + TQObjectListIterator it( *childElements ); - QObject *obj; + TQObject *obj; while ( ( obj = it.current() ) != 0 ) { ++it; if ( obj->isWidgetType() ) { - int obj_width_hint = ( ( QWidget* ) obj ) ->minimumSizeHint().width(); + int obj_width_hint = ( ( TQWidget* ) obj ) ->minimumSizeHint().width(); if ( obj_width_hint > width ) width = obj_width_hint; } } - return QSize( width, 150 ); + return TQSize( width, 150 ); } -void KreMenu::paintEvent( QPaintEvent * ) +void KreMenu::paintEvent( TQPaintEvent * ) { // Make sure the size is bigger than the minimum necessary //if (minimumWidth() <45) setMinimumWidth(45); // FIXME: can somehow setMinimumWidth be restricted? This may not be the best place to do this // Get gradient colors - QColor c = colorGroup().button(); - QColor c1 = c.dark( 130 ); - QColor c2 = c.light( 120 ); + TQColor c = colorGroup().button(); + TQColor c1 = c.dark( 130 ); + TQColor c2 = c.light( 120 ); // Draw the gradient KPixmap kpm; @@ -252,17 +252,17 @@ void KreMenu::paintEvent( QPaintEvent * ) KPixmapEffect::unbalancedGradient ( kpm, c2, c1, KPixmapEffect::HorizontalGradient, -150, -150 ); // Draw the handle - QPainter painter( &kpm ); + TQPainter painter( &kpm ); painter.setPen( c1 ); painter.drawLine( width() - 5, 20, width() - 5, height() - 20 ); painter.end(); //Set the border transparent using a mask - QBitmap mask( kpm.size() ); - mask.fill( Qt::color0 ); + TQBitmap mask( kpm.size() ); + mask.fill( TQt::color0 ); painter.begin( &mask ); - painter.setPen( Qt::color1 ); - painter.setBrush( Qt::color1 ); + painter.setPen( TQt::color1 ); + painter.setBrush( TQt::color1 ); painter.drawRoundRect( 0, 0, width(), height(), ( int ) ( 2.0 / width() * height() ), 2 ); painter.end(); kpm.setMask( mask ); @@ -288,7 +288,7 @@ void KreMenu::paintEvent( QPaintEvent * ) bitBlt( this, 0, 0, &kpm ); } -void KreMenu::resizeEvent( QResizeEvent* e ) +void KreMenu::resizeEvent( TQResizeEvent* e ) { emit resized( ( e->size() ).width(), ( e->size() ).height() ); } @@ -299,10 +299,10 @@ void KreMenu::showMenu( MenuId id ) // Hide the buttons in the current menu // and show the ones in the new menu - QObjectList * childElements = queryList(); - QObjectListIterator it( *childElements ); + TQObjectList * childElements = queryList(); + TQObjectListIterator it( *childElements ); - QObject *obj; + TQObject *obj; while ( ( obj = it.current() ) != 0 ) { ++it; if ( obj->inherits( "KreMenuButton" ) ) { @@ -325,16 +325,16 @@ void KreMenu::showMenu( MenuId id ) KreMenuButton::KreMenuButton( KreMenu *parent, KrePanel _panel, MenuId id, const char *name ) : -#if QT_VERSION >= 0x030200 - QWidget( parent, name, Qt::WNoAutoErase ), +#if TQT_VERSION >= 0x030200 + TQWidget( parent, name, TQt::WNoAutoErase ), #else - QWidget( parent, name ), + TQWidget( parent, name ), #endif panel( _panel ) { icon = 0; highlighted = false; - text = QString::null; + text = TQString::null; if ( id == 0 ) menuId = parent->mainMenu(); @@ -346,7 +346,7 @@ KreMenuButton::KreMenuButton( KreMenu *parent, KrePanel _panel, MenuId id, const resize( parent->size().width(), 55 ); connect ( parent, SIGNAL( resized( int, int ) ), this, SLOT( rescale() ) ); connect( this, SIGNAL( clicked() ), this, SLOT( forwardClicks() ) ); - setCursor( QCursor( KCursor::handCursor() ) ); + setCursor( TQCursor( KCursor::handCursor() ) ); } @@ -355,7 +355,7 @@ KreMenuButton::~KreMenuButton() delete icon; } -void KreMenuButton::setTitle( const QString &s ) +void KreMenuButton::setTitle( const TQString &s ) { text = s; @@ -373,7 +373,7 @@ void KreMenuButton::setTitle( const QString &s ) update(); } -void KreMenuButton::mousePressEvent ( QMouseEvent * ) +void KreMenuButton::mousePressEvent ( TQMouseEvent * ) { emit clicked(); } @@ -382,31 +382,31 @@ void KreMenuButton::rescale() { resize( parentWidget() ->width() - 10, height() ); } -QSize KreMenuButton::sizeHint() const +TQSize KreMenuButton::sizeHint() const { if ( parentWidget() ) - return ( QSize( parentWidget() ->size().width() - 10, 40 ) ); + return ( TQSize( parentWidget() ->size().width() - 10, 40 ) ); else - return QSize( 100, 30 ); + return TQSize( 100, 30 ); } -QSize KreMenuButton::minimumSizeHint() const +TQSize KreMenuButton::minimumSizeHint() const { - int text_width = QMAX( fontMetrics().width( text.section( '\n', 0, 0 ) ), fontMetrics().width( text.section( '\n', 1, 1 ) ) ); + int text_width = TQMAX( fontMetrics().width( text.section( '\n', 0, 0 ) ), fontMetrics().width( text.section( '\n', 1, 1 ) ) ); if ( icon ) - return QSize( 40 + icon->width() + text_width, 30 ); + return TQSize( 40 + icon->width() + text_width, 30 ); else - return QSize( 40 + text_width, 30 ); + return TQSize( 40 + text_width, 30 ); } -void KreMenuButton::paintEvent( QPaintEvent * ) +void KreMenuButton::paintEvent( TQPaintEvent * ) { if ( !isShown() ) return ; // First draw the gradient int darken = 130, lighten = 120; - QColor c1, c2, c1h, c2h; //non-highlighted and highlighted versions + TQColor c1, c2, c1h, c2h; //non-highlighted and highlighted versions // Set the gradient colors @@ -422,9 +422,9 @@ void KreMenuButton::paintEvent( QPaintEvent * ) // draw the gradient now - QPainter painter; + TQPainter painter; KPixmap kpm; - kpm.resize( ( ( QWidget * ) parent() ) ->size() ); // use parent's same size to obtain the same gradient + kpm.resize( ( ( TQWidget * ) parent() ) ->size() ); // use parent's same size to obtain the same gradient if ( !highlighted ) { @@ -469,13 +469,13 @@ void KreMenuButton::paintEvent( QPaintEvent * ) // Make sure it fits in the area // If not, resize and reposition horizontally to be centered - QPixmap scaledIcon = *icon; + TQPixmap scaledIcon = *icon; if ( ( icon->height() > height() ) || ( icon->width() > width() / 3 ) ) // Nice effect, make sure you take less than half in width and fit in height (try making the menu very short in width) { - QImage image; + TQImage image; image = ( *icon ); - scaledIcon.convertFromImage( image.smoothScale( width() / 3, height(), QImage::ScaleMin ) ); + scaledIcon.convertFromImage( image.smoothScale( width() / 3, height(), TQImage::ScaleMin ) ); } // Calculate the icon's vertical position @@ -525,16 +525,16 @@ void KreMenuButton::paintEvent( QPaintEvent * ) painter.begin( &area ); painter.setPen( c1h ); - painter.setBrush( Qt::NoBrush ); + painter.setBrush( TQt::NoBrush ); painter.drawRoundRect( 0, 0, areaw, areah, roundx, roundy ); painter.end(); // Make it round - QBitmap mask( QSize( areaw, areah ) ); - mask.fill( Qt::color0 ); + TQBitmap mask( TQSize( areaw, areah ) ); + mask.fill( TQt::color0 ); painter.begin( &mask ); - painter.setPen( Qt::color1 ); - painter.setBrush( Qt::color1 ); + painter.setPen( TQt::color1 ); + painter.setBrush( TQt::color1 ); painter.drawRoundRect( 0, 0, areaw, areah, roundx, roundy ); painter.end(); area.setMask( mask ); @@ -544,7 +544,7 @@ void KreMenuButton::paintEvent( QPaintEvent * ) } // Finally, draw the text besides the icon - QRect r = rect(); + TQRect r = rect(); r.setLeft( areax + 5 ); r.setWidth( areaw - 10 ); @@ -554,7 +554,7 @@ void KreMenuButton::paintEvent( QPaintEvent * ) else painter.setPen( KGlobalSettings::textColor() ); painter.setClipRect( r ); - painter.drawText( r, Qt::AlignVCenter, text ); + painter.drawText( r, TQt::AlignVCenter, text ); painter.end(); // Copy the offscreen button to the widget @@ -562,11 +562,11 @@ void KreMenuButton::paintEvent( QPaintEvent * ) } -void KreMenuButton::setIconSet( const QIconSet &is ) +void KreMenuButton::setIconSet( const TQIconSet &is ) { delete icon; - icon = new QPixmap( is.pixmap( QIconSet::Small, QIconSet::Normal, QIconSet::On ) ); + icon = new TQPixmap( is.pixmap( TQIconSet::Small, TQIconSet::Normal, TQIconSet::On ) ); setMinimumWidth( minimumSizeHint().width() ); if ( parentWidget() ->minimumWidth() < minimumSizeHint().width() ) @@ -618,18 +618,18 @@ void Menu::addButton( KreMenuButton* button ) widgetNumber++; } -void Menu::copyMap( QMap &destMap, const QMap &origMap ) +void Menu::copyMap( TQMap &destMap, const TQMap &origMap ) { - QMap::ConstIterator it; + TQMap::ConstIterator it; destMap.clear(); for ( it = origMap.begin(); it != origMap.end(); ++it ) { destMap[ it.key() ] = it.data(); } } -void Menu::copyMap( QMap &destMap, const QMap &origMap ) +void Menu::copyMap( TQMap &destMap, const TQMap &origMap ) { - QMap::ConstIterator it; + TQMap::ConstIterator it; destMap.clear(); for ( it = origMap.begin(); it != origMap.end(); ++it ) { destMap[ it.key() ] = it.data(); diff --git a/krecipes/src/widgets/kremenu.h b/krecipes/src/widgets/kremenu.h index 24cdc74..0903b6c 100644 --- a/krecipes/src/widgets/kremenu.h +++ b/krecipes/src/widgets/kremenu.h @@ -12,12 +12,12 @@ #ifndef KREMENU_H #define KREMENU_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "krecipesview.h" //for KrePanel enum @@ -30,7 +30,7 @@ class Menu; class KreMenu; class KreMenuButton; -typedef QValueList ::Iterator MenuId; +typedef TQValueList ::Iterator MenuId; class Menu @@ -46,26 +46,26 @@ public: // Variables - QMap positionList; // Stores the indexes for the widgets - QMap widgetList; // Stores the widgets for each position (just the inverse mapping) + TQMap positionList; // Stores the indexes for the widgets + TQMap widgetList; // Stores the widgets for each position (just the inverse mapping) KreMenuButton* activeButton; // Indicates which button is highlighted int childPos; int widgetNumber; private: // Methods - void copyMap( QMap &destMap, const QMap &origMap ); - void copyMap( QMap &destMap, const QMap &origMap ); + void copyMap( TQMap &destMap, const TQMap &origMap ); + void copyMap( TQMap &destMap, const TQMap &origMap ); }; -class KreMenu : public QWidget +class KreMenu : public TQWidget { Q_OBJECT public: - KreMenu( QWidget *parent = 0, const char *name = 0 ); + KreMenu( TQWidget *parent = 0, const char *name = 0 ); ~KreMenu(); - MenuId createSubMenu( const QString &title, const QString &icon ); + MenuId createSubMenu( const TQString &title, const TQString &icon ); MenuId mainMenu( void ) { return mainMenuId; @@ -74,21 +74,21 @@ public: { return currentMenuId; } - QSize sizeHint() const; - QSize minimumSizeHint() const; - void resizeEvent( QResizeEvent* e ); + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + void resizeEvent( TQResizeEvent* e ); void highlightButton( KreMenuButton *button ); protected: - virtual void paintEvent ( QPaintEvent *e ); - virtual void childEvent ( QChildEvent *e ); - virtual void keyPressEvent( QKeyEvent *e ); + virtual void paintEvent ( TQPaintEvent *e ); + virtual void childEvent ( TQChildEvent *e ); + virtual void keyPressEvent( TQKeyEvent *e ); private: //Variables - QValueList menus; + TQValueList menus; MenuId mainMenuId; MenuId currentMenuId; Menu *m_currentMenu; @@ -103,7 +103,7 @@ private slots: }; -class KreMenuButton: public QWidget +class KreMenuButton: public TQWidget { Q_OBJECT public: @@ -111,10 +111,10 @@ public: ~KreMenuButton(); - QSize sizeHint() const; - QSize minimumSizeHint() const; + TQSize sizeHint() const; + TQSize minimumSizeHint() const; - QString title( void ) + TQString title( void ) { return text; } @@ -122,7 +122,7 @@ public: { highlighted = active; } - void setIconSet( const QIconSet &is ); + void setIconSet( const TQIconSet &is ); MenuId menuId; MenuId subMenuId; @@ -138,13 +138,13 @@ signals: void clicked( MenuId ); // sent together with clicked() public slots: - void setTitle( const QString &s ); + void setTitle( const TQString &s ); void rescale( void ); private: // Button parts - QPixmap* icon; - QString text; + TQPixmap* icon; + TQString text; bool highlighted; KrePanel panel; @@ -160,8 +160,8 @@ private slots: protected: - virtual void paintEvent( QPaintEvent *e ); - virtual void mousePressEvent ( QMouseEvent * e ); + virtual void paintEvent( TQPaintEvent *e ); + virtual void mousePressEvent ( TQMouseEvent * e ); }; diff --git a/krecipes/src/widgets/kreruler.cpp b/krecipes/src/widgets/kreruler.cpp index 69c63a6..3ac9a19 100644 --- a/krecipes/src/widgets/kreruler.cpp +++ b/krecipes/src/widgets/kreruler.cpp @@ -28,10 +28,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "krepagelayout.h" @@ -41,12 +41,12 @@ public: } ~KoRulerPrivate() {} - QWidget *canvas; + TQWidget *canvas; int flags; int oldMx, oldMy; bool whileMovingBorderLeft, whileMovingBorderRight; bool whileMovingBorderTop, whileMovingBorderBottom; - QPixmap pmFirst, pmLeft; + TQPixmap pmFirst, pmLeft; KoPageLayout layout; KoTabulatorList tabList; // Do we have to remove a certain tab in the DC Event? @@ -55,7 +55,7 @@ public: KoTabulator currTab; // The action we're currently doing - basically only valid between press and release time KoRuler::Action action; - QPopupMenu *rb_menu; + TQPopupMenu *rb_menu; int mRemoveTab, mPageLayout; // menu item ids int frameEnd; double i_right; @@ -81,9 +81,9 @@ const int KoRuler::F_HELPLINES = 4; const int KoRuler::F_NORESIZE = 8; /*================================================================*/ -KoRuler::KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, +KoRuler::KoRuler( TQWidget *_parent, TQWidget *_canvas, Orientation _orientation, const KoPageLayout& _layout, int _flags, KoUnit::Unit _unit ) - : QFrame( _parent ), buffer( width(), height() ), m_zoom(1.0), m_1_zoom(1.0), + : TQFrame( _parent ), buffer( width(), height() ), m_zoom(1.0), m_1_zoom(1.0), m_unit( _unit ) { setWFlags( WResizeNoErase | WRepaintNoErase ); @@ -124,12 +124,12 @@ KoRuler::KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, d->currTab.type = T_INVALID; d->removeTab.type = T_INVALID; - if ( orientation == Qt::Horizontal ) { - frameStart = qRound( zoomIt(d->layout.ptLeft) ); - d->frameEnd = qRound( zoomIt(d->layout.ptWidth - d->layout.ptRight) ); + if ( orientation == TQt::Horizontal ) { + frameStart = tqRound( zoomIt(d->layout.ptLeft) ); + d->frameEnd = tqRound( zoomIt(d->layout.ptWidth - d->layout.ptRight) ); } else { - frameStart = qRound( zoomIt(d->layout.ptTop) ); - d->frameEnd = qRound( zoomIt(d->layout.ptHeight - d->layout.ptBottom) ); + frameStart = tqRound( zoomIt(d->layout.ptTop) ); + d->frameEnd = tqRound( zoomIt(d->layout.ptHeight - d->layout.ptBottom) ); } m_bFrameStartSet = false; @@ -156,10 +156,10 @@ void KoRuler::setMousePos( int mx, int my ) { if ( !showMPos || ( mx == mposX && my == mposY ) ) return; - QPainter p( this ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( this ); + p.setRasterOp( TQt::NotROP ); - if ( orientation == Qt::Horizontal ) { + if ( orientation == TQt::Horizontal ) { if ( hasToDelete ) p.drawLine( mposX, 1, mposX, height() - 1 ); p.drawLine( mx, 1, mx, height() - 1 ); @@ -201,23 +201,23 @@ double KoRuler::lineDistance() const } /*================================================================*/ -void KoRuler::drawHorizontal( QPainter *_painter ) +void KoRuler::drawHorizontal( TQPainter *_painter ) { - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); - resize( width(), QMAX( fm.height() + 4, 20 ) ); + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); + resize( width(), TQMAX( fm.height() + 4, 20 ) ); // Use a double-buffer pixmap - QPainter p( &buffer ); - p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( QColorGroup::Background ) ) ); + TQPainter p( &buffer ); + p.fillRect( 0, 0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); - int totalw = qRound( zoomIt(d->layout.ptWidth) ); - QString str; + int totalw = tqRound( zoomIt(d->layout.ptWidth) ); + TQString str; - p.setBrush( colorGroup().brush( QColorGroup::Base ) ); + p.setBrush( colorGroup().brush( TQColorGroup::Base ) ); // Draw white rect - QRect r; + TQRect r; if ( !d->whileMovingBorderLeft ) r.setLeft( -diffx + frameStart ); else @@ -237,9 +237,9 @@ void KoRuler::drawHorizontal( QPainter *_painter ) int maxwidth = 0; for ( double i = 0.0;i <= (double)totalw;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxwidth = QMAX( maxwidth, textwidth ); + maxwidth = TQMAX( maxwidth, textwidth ); } // Make sure that the ruler stays readable at lower zoom levels @@ -248,11 +248,11 @@ void KoRuler::drawHorizontal( QPainter *_painter ) } for ( double i = 0.0;i <= (double)totalw;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxwidth = QMAX( maxwidth, textwidth ); - p.drawText( qRound(i) - diffx - qRound(textwidth * 0.5), - qRound(( height() - fm.height() ) * 0.5), + maxwidth = TQMAX( maxwidth, textwidth ); + p.drawText( tqRound(i) - diffx - tqRound(textwidth * 0.5), + tqRound(( height() - fm.height() ) * 0.5), textwidth, height(), AlignLeft | AlignTop, str ); } @@ -261,7 +261,7 @@ void KoRuler::drawHorizontal( QPainter *_painter ) if ( dist > maxwidth + 2 ) { for ( double i = dist * 0.5;i <= (double)totalw;i += dist ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( ii - diffx, 7, ii - diffx, height() - 7 ); } } @@ -271,7 +271,7 @@ void KoRuler::drawHorizontal( QPainter *_painter ) if ( dist * 0.5 > maxwidth + 2 ) { for ( double i = dist * 0.25;i <= (double)totalw;i += dist * 0.5 ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( ii - diffx, 9, ii - diffx, height() - 9 ); } } @@ -279,18 +279,18 @@ void KoRuler::drawHorizontal( QPainter *_painter ) // Draw ending bar (at page width) //int constant=zoomIt(1); //p.drawLine( totalw - diffx + constant, 1, totalw - diffx + constant, height() - 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( colorGroup().color( TQColorGroup::Base ) ); //p.drawLine( totalw - diffx, 1, totalw - diffx, height() - 1 ); // Draw starting bar (at 0) - //p.setPen( colorGroup().color( QColorGroup::Text ) ); + //p.setPen( colorGroup().color( TQColorGroup::Text ) ); //p.drawLine( -diffx, 1, -diffx, height() - 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( colorGroup().color( TQColorGroup::Base ) ); //p.drawLine( -diffx - constant, 1, -diffx - constant, height() - 1 ); // Show the mouse position if ( d->action == A_NONE && showMPos ) { - p.setPen( colorGroup().color( QColorGroup::Text ) ); + p.setPen( colorGroup().color( TQColorGroup::Text ) ); p.drawLine( mposX, 1, mposX, height() - 1 ); } hasToDelete = false; @@ -301,28 +301,28 @@ void KoRuler::drawHorizontal( QPainter *_painter ) /*================================================================*/ -void KoRuler::drawVertical( QPainter *_painter ) +void KoRuler::drawVertical( TQPainter *_painter ) { - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); - resize( QMAX( fm.height() + 4, 20 ), height() ); + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); + resize( TQMAX( fm.height() + 4, 20 ), height() ); - QPainter p( &buffer ); - p.fillRect( 0, 0, width(), height(), QBrush( colorGroup().brush( QColorGroup::Background ) ) ); + TQPainter p( &buffer ); + p.fillRect( 0, 0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); - int totalh = qRound( zoomIt(d->layout.ptHeight) ); + int totalh = tqRound( zoomIt(d->layout.ptHeight) ); // Clip rect - this gives basically always a rect like (2,2,width-2,height-2) - QRect paintRect = _painter->clipRegion( QPainter::CoordPainter ).boundingRect(); + TQRect paintRect = _painter->clipRegion( TQPainter::CoordPainter ).boundingRect(); // Ruler rect - QRect rulerRect( 0, -diffy, width(), totalh ); + TQRect rulerRect( 0, -diffy, width(), totalh ); if ( paintRect.intersects( rulerRect ) ) { - QString str; + TQString str; - p.setBrush( colorGroup().brush( QColorGroup::Base ) ); + p.setBrush( colorGroup().brush( TQColorGroup::Base ) ); // Draw white rect - QRect r; + TQRect r; if ( !d->whileMovingBorderTop ) r.setTop( -diffy + frameStart ); else @@ -342,9 +342,9 @@ void KoRuler::drawVertical( QPainter *_painter ) int maxheight = 0; for ( double i = 0.0;i <= (double)totalh;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textwidth = fm.width( str ); - maxheight = QMAX( maxheight, textwidth ); + maxheight = TQMAX( maxheight, textwidth ); } // Make sure that the ruler stays readable at lower zoom levels @@ -353,13 +353,13 @@ void KoRuler::drawVertical( QPainter *_painter ) } for ( double i = 0.0;i <= (double)totalh;i += dist ) { - str = QString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); + str = TQString::number( KoUnit::toUserValue( i / m_zoom, m_unit ) ); int textheight = fm.height(); int textwidth = fm.width( str ); - maxheight = QMAX( maxheight, textwidth ); + maxheight = TQMAX( maxheight, textwidth ); p.save(); - p.translate( qRound(( width() - textheight ) * 0.5), - qRound(i) - diffy + qRound(textwidth * 0.5) ); + p.translate( tqRound(( width() - textheight ) * 0.5), + tqRound(i) - diffy + tqRound(textwidth * 0.5) ); p.rotate( -90 ); p.drawText( 0, 0, textwidth + 1, textheight, AlignLeft | AlignTop, str ); p.restore(); @@ -369,7 +369,7 @@ void KoRuler::drawVertical( QPainter *_painter ) if ( dist > maxheight + 2 ) { for ( double i = dist * 0.5;i <= (double)totalh;i += dist ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( 7, ii - diffy, width() - 7, ii - diffy ); } } @@ -378,26 +378,26 @@ void KoRuler::drawVertical( QPainter *_painter ) if ( dist * 0.5 > maxheight + 2 ) { for ( double i = dist * 0.25;i <=(double)totalh;i += dist *0.5 ) { - int ii=qRound(i); + int ii=tqRound(i); p.drawLine( 9, ii - diffy, width() - 9, ii - diffy ); } } // Draw ending bar (at page height) //p.drawLine( 1, totalh - diffy + 1, width() - 1, totalh - diffy + 1 ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( colorGroup().color( TQColorGroup::Base ) ); //p.drawLine( 1, totalh - diffy, width() - 1, totalh - diffy ); // Draw starting bar (at 0) - //p.setPen( colorGroup().color( QColorGroup::Text ) ); + //p.setPen( colorGroup().color( TQColorGroup::Text ) ); //p.drawLine( 1, -diffy, width() - 1, -diffy ); - //p.setPen( colorGroup().color( QColorGroup::Base ) ); + //p.setPen( colorGroup().color( TQColorGroup::Base ) ); //p.drawLine( 1, -diffy - 1, width() - 1, -diffy - 1 ); } // Show the mouse position if ( d->action == A_NONE && showMPos ) { - p.setPen( colorGroup().color( QColorGroup::Text ) ); + p.setPen( colorGroup().color( TQColorGroup::Text ) ); p.drawLine( 1, mposY, width() - 1, mposY ); } hasToDelete = false; @@ -406,7 +406,7 @@ void KoRuler::drawVertical( QPainter *_painter ) _painter->drawPixmap( 0, 0, buffer ); } -void KoRuler::mousePressEvent( QMouseEvent *e ) +void KoRuler::mousePressEvent( TQMouseEvent *e ) { if( !d->m_bReadWrite) return; @@ -422,7 +422,7 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) d->rb_menu->setItemEnabled(d->mRemoveTab, false); else d->rb_menu->setItemEnabled(d->mRemoveTab, true); - d->rb_menu->popup( QCursor::pos() ); + d->rb_menu->popup( TQCursor::pos() ); d->action = A_NONE; d->mousePressed = false; return; @@ -447,8 +447,8 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) d->whileMovingBorderBottom = true; if ( d->canvas ) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.end(); } @@ -458,13 +458,13 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) drawLine(d->oldMx, -1); } else if ( d->action == A_TAB ) { if ( d->canvas && d->currTab.type != T_INVALID ) { - drawLine( qRound( applyRtlAndZoom(d->currTab.ptPos) ) + frameStart - diffx, -1 ); + drawLine( tqRound( applyRtlAndZoom(d->currTab.ptPos) ) + frameStart - diffx, -1 ); } } else if ( d->flags & F_HELPLINES ) { - setCursor( orientation == Qt::Horizontal ? - Qt::sizeVerCursor : Qt::sizeHorCursor ); + setCursor( orientation == TQt::Horizontal ? + TQt::sizeVerCursor : TQt::sizeHorCursor ); d->action = A_HELPLINES; } default: @@ -472,7 +472,7 @@ void KoRuler::mousePressEvent( QMouseEvent *e ) } } -void KoRuler::mouseReleaseEvent( QMouseEvent *e ) +void KoRuler::mouseReleaseEvent( TQMouseEvent *e ) { d->mousePressed = false; @@ -496,8 +496,8 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) d->whileMovingBorderBottom = false; if ( d->canvas ) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.end(); } @@ -520,7 +520,7 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) emit newRightIndent( d->i_right ); } else if ( d->action == A_TAB ) { if ( d->canvas && !fakeMovement ) { - drawLine( qRound( applyRtlAndZoom( d->currTab.ptPos ) ) + frameStart - diffx, -1); + drawLine( tqRound( applyRtlAndZoom( d->currTab.ptPos ) ) + frameStart - diffx, -1); } if ( willRemoveTab( e->y() ) ) { @@ -547,37 +547,37 @@ void KoRuler::mouseReleaseEvent( QMouseEvent *e ) } else if( d->action == A_HELPLINES ) { - emit addHelpline( e->pos(), orientation == Qt::Horizontal); + emit addHelpline( e->pos(), orientation == TQt::Horizontal); setCursor( ArrowCursor ); } d->currTab.type = T_INVALID; // added (DF) } -void KoRuler::mouseMoveEvent( QMouseEvent *e ) +void KoRuler::mouseMoveEvent( TQMouseEvent *e ) { hasToDelete = false; int pw = d->frameEnd - frameStart; - int ph = qRound(zoomIt(d->layout.ptHeight)); + int ph = tqRound(zoomIt(d->layout.ptHeight)); int left = frameStart - diffx; - int top = qRound(zoomIt(d->layout.ptTop)); + int top = tqRound(zoomIt(d->layout.ptTop)); top -= diffy; int right = d->frameEnd - diffx; - int bottom = qRound(zoomIt(d->layout.ptBottom)); + int bottom = tqRound(zoomIt(d->layout.ptBottom)); bottom = ph - bottom - diffy; // Cumulate first-line-indent - int ip_first = qRound( zoomIt( i_first + ( d->rtl ? d->i_right : i_left) ) ); - int ip_left = qRound(zoomIt(i_left)); - int ip_right = qRound(zoomIt(d->i_right)); + int ip_first = tqRound( zoomIt( i_first + ( d->rtl ? d->i_right : i_left) ) ); + int ip_left = tqRound(zoomIt(i_left)); + int ip_right = tqRound(zoomIt(d->i_right)); int mx = e->x(); mx = mx+diffx < 0 ? 0 : mx; int my = e->y(); my = my+diffy < 0 ? 0 : my; - QToolTip::remove( this); + TQToolTip::remove( this); switch ( orientation ) { - case Qt::Horizontal: { + case TQt::Horizontal: { if ( !d->mousePressed ) { setCursor( ArrowCursor ); d->action = A_NONE; @@ -595,10 +595,10 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if ( !m_bFrameStartSet ) { if ( mx > left - 5 && mx < left + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_BR_LEFT; } else if ( mx > right - 5 && mx < right + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_BR_RIGHT; } } @@ -609,7 +609,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) int newPos=mx; if( newPos!=right && gridSize!=0.0 && (e->state() & ShiftButton)==0) { // apply grid. double grid=zoomIt(gridSize * 16); - newPos=qRound( ((newPos * 16 / grid) * grid) / 16 ); + newPos=tqRound( ((newPos * 16 / grid) * grid) / 16 ); } if(newPos-left < 0) newPos=left; else if (right-newPos < 0) newPos=right; @@ -702,8 +702,8 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if ( d->canvas) { if (d->rtl) newValue = unZoomIt(pw) - newValue; if(newValue == d->currTab.ptPos) break; // no change - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); // prevent 1st drawLine when we just created a new tab // (it's a NOT line) double pt; @@ -711,7 +711,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) if( d->currTab != d->removeTab ) { pt = applyRtlAndZoom(d->currTab.ptPos); - pt_fr = qRound(pt) + frameStart - diffx; + pt_fr = tqRound(pt) + frameStart - diffx; p.drawLine( pt_fr, 0, pt_fr, d->canvas->height() ); } @@ -722,7 +722,7 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) d->currTab.ptPos = newValue; pt = applyRtlAndZoom( newValue ); - pt_fr = qRound(pt) + frameStart - diffx; + pt_fr = tqRound(pt) + frameStart - diffx; p.drawLine( pt_fr, 0, pt_fr, d->canvas->height() ); p.end(); @@ -737,32 +737,32 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) } if( d->action == A_HELPLINES ) { - emit moveHelpLines( e->pos(), orientation == Qt::Horizontal); + emit moveHelpLines( e->pos(), orientation == TQt::Horizontal); } return; } break; - case Qt::Vertical: { + case TQt::Vertical: { if ( !d->mousePressed ) { setCursor( ArrowCursor ); d->action = A_NONE; if ( d->flags & F_NORESIZE ) break; if ( my > top - 5 && my < top + 5 ) { - QToolTip::add( this, i18n("Top margin") ); - setCursor( Qt::sizeVerCursor ); + TQToolTip::add( this, i18n("Top margin") ); + setCursor( TQt::sizeVerCursor ); d->action = A_BR_TOP; } else if ( my > bottom - 5 && my < bottom + 5 ) { - QToolTip::add( this, i18n("Bottom margin") ); - setCursor( Qt::sizeVerCursor ); + TQToolTip::add( this, i18n("Bottom margin") ); + setCursor( TQt::sizeVerCursor ); d->action = A_BR_BOTTOM; } } else { switch ( d->action ) { case A_BR_TOP: { if ( d->canvas && my < bottom-20 && my+diffy-2 > 0) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.drawLine( 0, my, d->canvas->width(), my ); p.end(); @@ -776,8 +776,8 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) } break; case A_BR_BOTTOM: { if ( d->canvas && my > top+20 && my+diffy < ph-2) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( 0, d->oldMy, d->canvas->width(), d->oldMy ); p.drawLine( 0, my, d->canvas->width(), my ); p.end(); @@ -796,20 +796,20 @@ void KoRuler::mouseMoveEvent( QMouseEvent *e ) } if( d->action == A_HELPLINES ) { - emit moveHelpLines( e->pos(), orientation == Qt::Horizontal); + emit moveHelpLines( e->pos(), orientation == TQt::Horizontal); } d->oldMx = mx; d->oldMy = my; } -void KoRuler::resizeEvent( QResizeEvent *e ) +void KoRuler::resizeEvent( TQResizeEvent *e ) { - QFrame::resizeEvent( e ); + TQFrame::resizeEvent( e ); buffer.resize( size() ); } -void KoRuler::mouseDoubleClickEvent( QMouseEvent* ) +void KoRuler::mouseDoubleClickEvent( TQMouseEvent* ) { handleDoubleClick(); } @@ -855,8 +855,8 @@ double KoRuler::makeIntern( double _v ) void KoRuler::setupMenu() { - d->rb_menu = new QPopupMenu(); - Q_CHECK_PTR( d->rb_menu ); + d->rb_menu = new TQPopupMenu(); + TQ_CHECK_PTR( d->rb_menu ); for ( uint i = 0 ; i <= KoUnit::U_LASTUNIT ; ++i ) { KoUnit::Unit unit = static_cast( i ); @@ -924,9 +924,9 @@ void KoRuler::searchTab(int mx) { d->currTab.type = T_INVALID; KoTabulatorList::ConstIterator it = d->tabList.begin(); for ( ; it != d->tabList.end() ; ++it ) { - pos = qRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; + pos = tqRound(applyRtlAndZoom((*it).ptPos)) - diffx + frameStart; if ( mx > pos - 5 && mx < pos + 5 ) { - setCursor( Qt::sizeHorCursor ); + setCursor( TQt::sizeHorCursor ); d->action = A_TAB; d->currTab = *it; break; @@ -936,8 +936,8 @@ void KoRuler::searchTab(int mx) { void KoRuler::drawLine(int oldX, int newX) { - QPainter p( d->canvas ); - p.setRasterOp( Qt::NotROP ); + TQPainter p( d->canvas ); + p.setRasterOp( TQt::NotROP ); p.drawLine( oldX, 0, oldX, d->canvas->height() ); if(newX!=-1) p.drawLine( newX, 0, newX, d->canvas->height() ); @@ -1023,19 +1023,19 @@ void KoRuler::slotMenuActivated( int i ) } } -QSize KoRuler::minimumSizeHint() const +TQSize KoRuler::minimumSizeHint() const { - QSize size; - QFont font = KGlobalSettings::toolBarFont(); - QFontMetrics fm( font ); + TQSize size; + TQFont font = KGlobalSettings::toolBarFont(); + TQFontMetrics fm( font ); - size.setWidth( QMAX( fm.height() + 4, 20 ) ); - size.setHeight( QMAX( fm.height() + 4, 20 ) ); + size.setWidth( TQMAX( fm.height() + 4, 20 ) ); + size.setHeight( TQMAX( fm.height() + 4, 20 ) ); return size; } -QSize KoRuler::sizeHint() const +TQSize KoRuler::sizeHint() const { return minimumSizeHint(); } diff --git a/krecipes/src/widgets/kreruler.h b/krecipes/src/widgets/kreruler.h index b313e02..c1ecf40 100644 --- a/krecipes/src/widgets/kreruler.h +++ b/krecipes/src/widgets/kreruler.h @@ -25,8 +25,8 @@ #ifndef KRERULER_H #define KRERULER_H -#include -#include +#include +#include #include @@ -38,7 +38,7 @@ #include "kreunit.h" class KoPageLayout; -class QPainter; +class TQPainter; enum KoTabulators { T_LEFT = 0, T_CENTER = 1, T_RIGHT = 2, T_DEC_PNT = 3, T_INVALID = -1 }; enum KoTabulatorFilling { TF_BLANK = 0, TF_DOTS = 1, TF_LINE = 2, TF_DASH = 3, TF_DASH_DOT = 4, TF_DASH_DOT_DOT = 5}; @@ -67,11 +67,11 @@ struct KoTabulator { /** * Alignment character. */ - QChar alignChar; + TQChar alignChar; bool operator==( const KoTabulator & t ) const { - return QABS( ptPos - t.ptPos ) < 1E-4 && type == t.type && - filling == t.filling && QABS( ptWidth - t.ptWidth ) < 1E-4; + return TQABS( ptPos - t.ptPos ) < 1E-4 && type == t.type && + filling == t.filling && TQABS( ptWidth - t.ptWidth ) < 1E-4; } bool operator!=( const KoTabulator & t ) const { return !operator==(t); @@ -88,7 +88,7 @@ struct KoTabulator { } }; -typedef QValueList KoTabulatorList; +typedef TQValueList KoTabulatorList; class KoRulerPrivate; @@ -102,7 +102,7 @@ class KoRulerPrivate; * It also offers a popupmenu upon right-clicking, for changing the unit, * the page layout, or removing a tab. */ -class KoRuler : public QFrame +class KoRuler : public TQFrame { Q_OBJECT friend class KoRulerPrivate; // for the Action enum @@ -116,7 +116,7 @@ public: * Create a ruler * TODO document params */ - KoRuler( QWidget *_parent, QWidget *_canvas, Orientation _orientation, + KoRuler( TQWidget *_parent, TQWidget *_canvas, Orientation _orientation, const KoPageLayout& _layout, int _flags, KoUnit::Unit _unit ); ~KoRuler(); @@ -156,7 +156,7 @@ public: /** * Set a global offset to the X and Y coordinates. - * Usually the main drawing area is a QScrollView, and this is called + * Usually the main drawing area is a TQScrollView, and this is called * with contentsX() and contentsY(), each time those values change. */ void setOffset( int _diffx, int _diffy ); @@ -240,14 +240,14 @@ public: void setPageLayoutMenuItemEnabled(bool b); /** - * Reimplemented from QWidget + * Reimplemented from TQWidget */ - virtual QSize minimumSizeHint() const; + virtual TQSize minimumSizeHint() const; /** - * Reimplemented from QWidget + * Reimplemented from TQWidget */ - virtual QSize sizeHint() const; + virtual TQSize sizeHint() const; signals: void newPageLayout( const KoPageLayout & ); @@ -264,25 +264,25 @@ signals: void tabListChanged( const KoTabulatorList & ); void unitChanged( KoUnit::Unit ); - void addHelpline(const QPoint &, bool ); - void moveHelpLines( const QPoint &, bool ); + void addHelpline(const TQPoint &, bool ); + void moveHelpLines( const TQPoint &, bool ); protected: enum Action {A_NONE, A_BR_LEFT, A_BR_RIGHT, A_BR_TOP, A_BR_BOTTOM, A_LEFT_INDENT, A_FIRST_INDENT, A_TAB, A_RIGHT_INDENT, A_HELPLINES }; - void drawContents( QPainter *_painter ) - { orientation == Qt::Horizontal ? drawHorizontal( _painter ) : drawVertical( _painter ); } + void drawContents( TQPainter *_painter ) + { orientation == TQt::Horizontal ? drawHorizontal( _painter ) : drawVertical( _painter ); } - void drawHorizontal( QPainter *_painter ); - void drawVertical( QPainter *_painter ); + void drawHorizontal( TQPainter *_painter ); + void drawVertical( TQPainter *_painter ); - void mousePressEvent( QMouseEvent *e ); - void mouseReleaseEvent( QMouseEvent *e ); - void mouseMoveEvent( QMouseEvent *e ); - void mouseDoubleClickEvent( QMouseEvent* ); - void resizeEvent( QResizeEvent *e ); + void mousePressEvent( TQMouseEvent *e ); + void mouseReleaseEvent( TQMouseEvent *e ); + void mouseMoveEvent( TQMouseEvent *e ); + void mouseDoubleClickEvent( TQMouseEvent* ); + void resizeEvent( TQResizeEvent *e ); void handleDoubleClick(); double makeIntern( double _v ); @@ -305,10 +305,10 @@ private: KoRulerPrivate *d; - Qt::Orientation orientation; + TQt::Orientation orientation; int diffx, diffy; double i_left, i_first; - QPixmap buffer; + TQPixmap buffer; double m_zoom, m_1_zoom; KoUnit::Unit m_unit; bool hasToDelete; @@ -336,13 +336,13 @@ inline double KoRuler::zoomIt(const double &value) const { inline int KoRuler::zoomIt(const int &value) const { if (m_zoom==1.0) return value; - return qRound(m_zoom*value); + return tqRound(m_zoom*value); } inline unsigned int KoRuler::zoomIt(const unsigned int &value) const { if (m_zoom==1.0) return value; - return static_cast(qRound(m_zoom*value)); + return static_cast(tqRound(m_zoom*value)); } inline double KoRuler::unZoomIt(const double &value) const { @@ -354,13 +354,13 @@ inline double KoRuler::unZoomIt(const double &value) const { inline int KoRuler::unZoomIt(const int &value) const { if(m_zoom==1.0) return value; - return qRound(value*m_1_zoom); + return tqRound(value*m_1_zoom); } inline unsigned int KoRuler::unZoomIt(const unsigned int &value) const { if(m_zoom==1.0) return value; - return static_cast(qRound(value*m_1_zoom)); + return static_cast(tqRound(value*m_1_zoom)); } #endif diff --git a/krecipes/src/widgets/kretextedit.cpp b/krecipes/src/widgets/kretextedit.cpp index 55565d2..84c1a94 100644 --- a/krecipes/src/widgets/kretextedit.cpp +++ b/krecipes/src/widgets/kretextedit.cpp @@ -10,12 +10,12 @@ #include "kretextedit.h" -#include +#include #include #include -KreTextEdit::KreTextEdit( QWidget *parent ) : KTextEdit( parent ), KCompletionBase() +KreTextEdit::KreTextEdit( TQWidget *parent ) : KTextEdit( parent ), KCompletionBase() { KCompletion * comp = completionObject(); //creates the completion object comp->setIgnoreCase( true ); @@ -30,7 +30,7 @@ void KreTextEdit::haltCompletion() completing = false; } -void KreTextEdit::keyPressEvent( QKeyEvent *e ) +void KreTextEdit::keyPressEvent( TQKeyEvent *e ) { // Filter key-events if completion mode is not set to CompletionNone KKey key( e ); @@ -40,9 +40,9 @@ void KreTextEdit::keyPressEvent( QKeyEvent *e ) bool noModifier = ( e->state() == NoButton || e->state() == ShiftButton ); if ( noModifier ) { - QString keycode = e->text(); + TQString keycode = e->text(); if ( !keycode.isEmpty() && keycode.unicode() ->isPrint() ) { - QTextEdit::keyPressEvent ( e ); + TQTextEdit::keyPressEvent ( e ); tryCompletion(); e->accept(); return ; @@ -56,7 +56,7 @@ void KreTextEdit::keyPressEvent( QKeyEvent *e ) cut = keys[ TextCompletion ]; //using just the standard Ctrl+E isn't user-friendly enough for Grandma... - if ( completing && ( cut.contains( key ) || e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return ) ) { + if ( completing && ( cut.contains( key ) || e->key() == TQt::Key_Enter || e->key() == TQt::Key_Return ) ) { int paraFrom, indexFrom, paraTo, indexTo; getSelection ( ¶From, &indexFrom, ¶To, &indexTo ); @@ -93,10 +93,10 @@ void KreTextEdit::keyPressEvent( QKeyEvent *e ) //any other key events will end any text completion execpt for modifiers switch ( e->key() ) { - case Qt::Key_Shift: - case Qt::Key_Control: - case Qt::Key_Alt: - case Qt::Key_Meta: + case TQt::Key_Shift: + case TQt::Key_Control: + case TQt::Key_Alt: + case TQt::Key_Meta: break; default: completing = false; @@ -107,12 +107,12 @@ void KreTextEdit::keyPressEvent( QKeyEvent *e ) KTextEdit::keyPressEvent ( e ); } -void KreTextEdit::setCompletedText( const QString &txt ) +void KreTextEdit::setCompletedText( const TQString &txt ) { int para, index; getCursorPosition( ¶, &index ); - QString para_text = text( para ); + TQString para_text = text( para ); int word_length = index - completion_begin; insert( txt.right( txt.length() - word_length ) ); @@ -122,7 +122,7 @@ void KreTextEdit::setCompletedText( const QString &txt ) completing = true; } -void KreTextEdit::setCompletedItems( const QStringList &/*items*/ ) +void KreTextEdit::setCompletedItems( const TQStringList &/*items*/ ) {} void KreTextEdit::tryCompletion() @@ -130,14 +130,14 @@ void KreTextEdit::tryCompletion() int para, index; getCursorPosition( ¶, &index ); - QString para_text = text( para ); + TQString para_text = text( para ); if ( para_text.at( index ).isSpace() || completing ) { if ( !completing ) completion_begin = para_text.findRev( ' ', index - 1 ) + 1; - QString completing_word = para_text.mid( completion_begin, index - completion_begin ); + TQString completing_word = para_text.mid( completion_begin, index - completion_begin ); - QString match = compObj() ->makeCompletion( completing_word ); + TQString match = compObj() ->makeCompletion( completing_word ); if ( !match.isNull() && match != completing_word ) setCompletedText( match ); @@ -152,25 +152,25 @@ void KreTextEdit::rotateText( KCompletionBase::KeyBindingType type ) if ( comp && completing && ( type == KCompletionBase::PrevCompletionMatch || type == KCompletionBase::NextCompletionMatch ) ) { - QString input = ( type == KCompletionBase::PrevCompletionMatch ) ? comp->previousMatch() : comp->nextMatch(); + TQString input = ( type == KCompletionBase::PrevCompletionMatch ) ? comp->previousMatch() : comp->nextMatch(); // Skip rotation if previous/next match is null or the same text int para, index; getCursorPosition( ¶, &index ); - QString para_text = text( para ); - QString complete_word = para_text.mid( completion_begin, index - completion_begin ); + TQString para_text = text( para ); + TQString complete_word = para_text.mid( completion_begin, index - completion_begin ); if ( input.isNull() || input == complete_word ) return ; setCompletedText( input ); } } -void KreTextEdit::addCompletionItem( const QString &name ) +void KreTextEdit::addCompletionItem( const TQString &name ) { compObj() ->addItem( name ); } -void KreTextEdit::removeCompletionItem( const QString &name ) +void KreTextEdit::removeCompletionItem( const TQString &name ) { compObj() ->removeItem( name ); } diff --git a/krecipes/src/widgets/kretextedit.h b/krecipes/src/widgets/kretextedit.h index 3b60221..4259e7e 100644 --- a/krecipes/src/widgets/kretextedit.h +++ b/krecipes/src/widgets/kretextedit.h @@ -24,18 +24,18 @@ class KreTextEdit : public KTextEdit, KCompletionBase Q_OBJECT public: - KreTextEdit( QWidget *parent ); + KreTextEdit( TQWidget *parent ); - virtual void setCompletedText( const QString &text ); - virtual void setCompletedItems( const QStringList &items ); + virtual void setCompletedText( const TQString &text ); + virtual void setCompletedItems( const TQStringList &items ); public slots: - void addCompletionItem( const QString & ); - void removeCompletionItem( const QString & ); + void addCompletionItem( const TQString & ); + void removeCompletionItem( const TQString & ); void clearCompletionItems(); protected: - void keyPressEvent( QKeyEvent * ); + void keyPressEvent( TQKeyEvent * ); private slots: void haltCompletion(); diff --git a/krecipes/src/widgets/kwidgetlistbox.cpp b/krecipes/src/widgets/kwidgetlistbox.cpp index 6a6be93..4cdf4ab 100644 --- a/krecipes/src/widgets/kwidgetlistbox.cpp +++ b/krecipes/src/widgets/kwidgetlistbox.cpp @@ -24,8 +24,8 @@ #include #include -KWidgetListbox::KWidgetListbox(QWidget *parent, const char *name) - : QTable(parent, name) +KWidgetListbox::KWidgetListbox(TQWidget *parent, const char *name) + : TQTable(parent, name) { setNumRows(0); setNumCols(1); @@ -34,12 +34,12 @@ KWidgetListbox::KWidgetListbox(QWidget *parent, const char *name) setTopMargin(0); horizontalHeader()->hide(); verticalHeader()->hide(); - setSelectionMode(QTable::NoSelection); - setFocusStyle(QTable::FollowStyle); + setSelectionMode(TQTable::NoSelection); + setFocusStyle(TQTable::FollowStyle); connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(selectionChanged(int, int))); - setHScrollBarMode(QScrollView::AlwaysOff); - setVScrollBarMode(QScrollView::Auto); + setHScrollBarMode(TQScrollView::AlwaysOff); + setVScrollBarMode(TQScrollView::Auto); } KWidgetListbox::~KWidgetListbox() @@ -54,7 +54,7 @@ void KWidgetListbox::clear() setNumRows(0); } -int KWidgetListbox::insertItem(QWidget* item, int index) +int KWidgetListbox::insertItem(TQWidget* item, int index) { int row = index; @@ -78,7 +78,7 @@ int KWidgetListbox::insertItem(QWidget* item, int index) return row; } -void KWidgetListbox::setSelected(QWidget* item) +void KWidgetListbox::setSelected(TQWidget* item) { setSelected(index(item)); } @@ -90,7 +90,7 @@ void KWidgetListbox::selectionChanged(int row, int col) emit selected(row); } -void KWidgetListbox::removeItem(QWidget* item) +void KWidgetListbox::removeItem(TQWidget* item) { removeItem(index(item)); } @@ -111,17 +111,17 @@ int KWidgetListbox::selected() const return currentRow(); } -QWidget* KWidgetListbox::selectedItem() const +TQWidget* KWidgetListbox::selectedItem() const { return item(selected()); } -QWidget* KWidgetListbox::item(int index) const +TQWidget* KWidgetListbox::item(int index) const { return cellWidget(index, 0); } -int KWidgetListbox::index(QWidget* itm) const +int KWidgetListbox::index(TQWidget* itm) const { for(int i = 0; i < numRows(); ++i) if(item(i) == itm) @@ -157,7 +157,7 @@ void KWidgetListbox::updateColors() void KWidgetListbox::setItemColors(int index, bool even) { - QWidget* itm = item(index); + TQWidget* itm = item(index); if ( !itm){ kdDebug()<<"no widget at index "< +#include /** @author See README for the list of authors */ -typedef bool (*show_callback) (int index, QWidget* widget, void* data); +typedef bool (*show_callback) (int index, TQWidget* widget, void* data); -class KWidgetListbox : public QTable +class KWidgetListbox : public TQTable { Q_OBJECT public: - KWidgetListbox(QWidget *parent = 0, const char *name = 0); + KWidgetListbox(TQWidget *parent = 0, const char *name = 0); ~KWidgetListbox(); - int insertItem(QWidget* item, int index = -1); - void setSelected(QWidget* item); + int insertItem(TQWidget* item, int index = -1); + void setSelected(TQWidget* item); void setSelected(int index); - void removeItem(QWidget* item); + void removeItem(TQWidget* item); void removeItem(int index); void clear(); int selected() const; - QWidget* selectedItem() const; - QWidget* item(int index) const; - int index(QWidget* itm) const; + TQWidget* selectedItem() const; + TQWidget* item(int index) const; + int index(TQWidget* itm) const; uint count() const { return numRows(); }; void showItems(show_callback func = 0, void* data = 0); - void paintCell(QPainter* p, int row, int col, const QRect& cr, - bool selected, const QColorGroup& cg); + void paintCell(TQPainter* p, int row, int col, const TQRect& cr, + bool selected, const TQColorGroup& cg); protected: void setItemColors(int index, bool even); void updateColors(); bool even(int index); - virtual void showEvent(QShowEvent* e); + virtual void showEvent(TQShowEvent* e); protected slots: void selectionChanged(int row, int col); diff --git a/krecipes/src/widgets/paneldeco.cpp b/krecipes/src/widgets/paneldeco.cpp index c1dde32..8db7921 100644 --- a/krecipes/src/widgets/paneldeco.cpp +++ b/krecipes/src/widgets/paneldeco.cpp @@ -9,9 +9,9 @@ ***************************************************************************/ #include "paneldeco.h" -#include -#include -#include +#include +#include +#include #include #include @@ -20,20 +20,20 @@ // Panel decoration -PanelDeco::PanelDeco( QWidget *parent, const char *name, const QString &title, const QString &iconName ) : QVBox( parent, name ) +PanelDeco::PanelDeco( TQWidget *parent, const char *name, const TQString &title, const TQString &iconName ) : TQVBox( parent, name ) { // Top decoration tDeco = new TopDeco( this, "TopDecoration", title, iconName ); - hbox = new QHBox( this ); + hbox = new TQHBox( this ); //Left decoration lDeco = new LeftDeco( hbox, "LeftDecoration" ); //The widget stack (panels) - stack = new QWidgetStack( hbox ); - stack->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + stack = new TQWidgetStack( hbox ); + stack->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); } @@ -41,27 +41,27 @@ PanelDeco::PanelDeco( QWidget *parent, const char *name, const QString &title, c PanelDeco::~PanelDeco() {} -void PanelDeco::childEvent( QChildEvent *e ) +void PanelDeco::childEvent( TQChildEvent *e ) { - if ( e->type() == QEvent::ChildInserted ) { - QObject * obj = e->child(); - if ( obj->inherits( "QWidget" ) ) { - QWidget * w = ( QWidget* ) obj; + if ( e->type() == TQEvent::ChildInserted ) { + TQObject * obj = e->child(); + if ( obj->inherits( "TQWidget" ) ) { + TQWidget * w = ( TQWidget* ) obj; if ( w != hbox && w != tDeco ) - w->reparent( stack, QPoint( 0, 0 ) ); + w->reparent( stack, TQPoint( 0, 0 ) ); } } } -int PanelDeco::id( QWidget* w ) +int PanelDeco::id( TQWidget* w ) { return ( stack->id( w ) ); } -void PanelDeco::raise( QWidget *w ) +void PanelDeco::raise( TQWidget *w ) { - QWidget * old_w = visiblePanel(); + TQWidget * old_w = visiblePanel(); stack->raiseWidget( w ); @@ -69,23 +69,23 @@ void PanelDeco::raise( QWidget *w ) emit panelRaised( w, old_w ); } -QWidget* PanelDeco::visiblePanel( void ) +TQWidget* PanelDeco::visiblePanel( void ) { return ( stack->visibleWidget() ); } -void PanelDeco::setHeader( const QString &title, const QString &icon ) +void PanelDeco::setHeader( const TQString &title, const TQString &icon ) { tDeco->setHeader( title, icon ); } // Left part of the decoration -LeftDeco::LeftDeco( QWidget *parent, const char *name ) : -#if QT_VERSION >= 0x030200 - QWidget( parent, name, Qt::WNoAutoErase ) +LeftDeco::LeftDeco( TQWidget *parent, const char *name ) : +#if TQT_VERSION >= 0x030200 + TQWidget( parent, name, TQt::WNoAutoErase ) #else - QWidget( parent, name ) + TQWidget( parent, name ) #endif {} @@ -94,19 +94,19 @@ LeftDeco::~LeftDeco() // Top part of the decoration -TopDeco::TopDeco( QWidget *parent, const char *name, const QString &title, const QString &iconName ) : -#if QT_VERSION >= 0x030200 - QWidget( parent, name, Qt::WNoAutoErase ) +TopDeco::TopDeco( TQWidget *parent, const char *name, const TQString &title, const TQString &iconName ) : +#if TQT_VERSION >= 0x030200 + TQWidget( parent, name, TQt::WNoAutoErase ) #else - QWidget( parent, name ) + TQWidget( parent, name ) #endif { setMinimumHeight( 30 ); icon = 0; - panelTitle = QString::null; + panelTitle = TQString::null; if ( !iconName.isNull() ) { KIconLoader il; - icon = new QPixmap( il.loadIcon( iconName, KIcon::NoGroup, 22 ) ); + icon = new TQPixmap( il.loadIcon( iconName, KIcon::NoGroup, 22 ) ); } if ( !title.isNull() ) { @@ -120,11 +120,11 @@ TopDeco::~TopDeco() } -void TopDeco::paintEvent( QPaintEvent * ) +void TopDeco::paintEvent( TQPaintEvent * ) { // Get gradient colors - QColor c1 = colorGroup().button().light( 120 ); - QColor c2 = paletteBackgroundColor(); + TQColor c1 = colorGroup().button().light( 120 ); + TQColor c2 = paletteBackgroundColor(); // Draw the gradient KPixmap kpm; @@ -132,7 +132,7 @@ void TopDeco::paintEvent( QPaintEvent * ) KPixmapEffect::unbalancedGradient ( kpm, c1, c2, KPixmapEffect::VerticalGradient, 150, 150 ); // Add a line on top - QPainter painter( &kpm ); + TQPainter painter( &kpm ); painter.setPen( colorGroup().button().dark( 130 ) ); painter.drawLine( 0, 0, width(), 0 ); @@ -148,34 +148,34 @@ void TopDeco::paintEvent( QPaintEvent * ) // Finally, draw the text besides the icon if ( !panelTitle.isNull() ) { xpos += 15; - QRect r = rect(); + TQRect r = rect(); r.setLeft( xpos ); - painter.setPen( QColor( 0x00, 0x00, 0x00 ) ); - QFont ft = font(); + painter.setPen( TQColor( 0x00, 0x00, 0x00 ) ); + TQFont ft = font(); ft.setBold( true ); painter.setFont( ft ); - painter.drawText( r, Qt::AlignVCenter, panelTitle ); + painter.drawText( r, TQt::AlignVCenter, panelTitle ); } painter.end(); // Copy the pixmap to the widget bitBlt( this, 0, 0, &kpm ); } -void TopDeco::setHeader( const QString &title, const QString &iconName ) +void TopDeco::setHeader( const TQString &title, const TQString &iconName ) { if ( !title.isNull() ) panelTitle = title; if ( !iconName.isNull() ) { KIconLoader il; - icon = new QPixmap( il.loadIcon( iconName, KIcon::NoGroup, 22 ) ); + icon = new TQPixmap( il.loadIcon( iconName, KIcon::NoGroup, 22 ) ); } if ( !title.isNull() || !iconName.isNull() ) update(); } -QSize TopDeco::sizeHint( void ) +TQSize TopDeco::sizeHint( void ) { - return ( QSize( parentWidget() ->width(), 30 ) ); + return ( TQSize( parentWidget() ->width(), 30 ) ); } #include "paneldeco.moc" diff --git a/krecipes/src/widgets/paneldeco.h b/krecipes/src/widgets/paneldeco.h index 10ac326..a7114e4 100644 --- a/krecipes/src/widgets/paneldeco.h +++ b/krecipes/src/widgets/paneldeco.h @@ -11,14 +11,14 @@ #define PANELDECO_H -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include /** @@ -29,57 +29,57 @@ class PanelDeco; class LeftDeco; class TopDeco; -class PanelDeco : public QVBox +class PanelDeco : public TQVBox { Q_OBJECT public: // Methods - PanelDeco( QWidget *parent = 0, const char *name = 0, const QString &title = QString::null, const QString &iconName = QString::null ); + PanelDeco( TQWidget *parent = 0, const char *name = 0, const TQString &title = TQString::null, const TQString &iconName = TQString::null ); ~PanelDeco(); - int id( QWidget* w ); // obtain the id of the given panel - QWidget* visiblePanel( void ); // obtain the current active panel no. + int id( TQWidget* w ); // obtain the id of the given panel + TQWidget* visiblePanel( void ); // obtain the current active panel no. signals: - void panelRaised( QWidget *w, QWidget *old_w ); + void panelRaised( TQWidget *w, TQWidget *old_w ); private: - QHBox *hbox; + TQHBox *hbox; LeftDeco *lDeco; TopDeco *tDeco; - QWidgetStack *stack; + TQWidgetStack *stack; public slots: - void raise( QWidget *w ); - void setHeader( const QString &title = QString::null, const QString &icon = QString::null ); + void raise( TQWidget *w ); + void setHeader( const TQString &title = TQString::null, const TQString &icon = TQString::null ); protected: - virtual void childEvent( QChildEvent *e ); + virtual void childEvent( TQChildEvent *e ); }; -class LeftDeco: public QWidget +class LeftDeco: public TQWidget { Q_OBJECT public: - LeftDeco( QWidget *parent = 0, const char *name = 0 ); + LeftDeco( TQWidget *parent = 0, const char *name = 0 ); ~LeftDeco(); }; -class TopDeco: public QWidget +class TopDeco: public TQWidget { Q_OBJECT public: - TopDeco( QWidget *parent = 0, const char *name = 0, const QString &title = QString::null, const QString &iconName = QString::null ); + TopDeco( TQWidget *parent = 0, const char *name = 0, const TQString &title = TQString::null, const TQString &iconName = TQString::null ); ~TopDeco(); - virtual QSize sizeHint( void ); + virtual TQSize sizeHint( void ); public slots: - void setHeader( const QString &title = QString::null, const QString &iconName = QString::null ); + void setHeader( const TQString &title = TQString::null, const TQString &iconName = TQString::null ); protected: - virtual void paintEvent( QPaintEvent *e ); + virtual void paintEvent( TQPaintEvent *e ); private: - QPixmap *icon; - QString panelTitle; + TQPixmap *icon; + TQString panelTitle; }; #endif diff --git a/krecipes/src/widgets/prepmethodcombobox.cpp b/krecipes/src/widgets/prepmethodcombobox.cpp index ec5a4bb..d228673 100644 --- a/krecipes/src/widgets/prepmethodcombobox.cpp +++ b/krecipes/src/widgets/prepmethodcombobox.cpp @@ -10,7 +10,7 @@ #include "prepmethodcombobox.h" -#include +#include #include @@ -26,11 +26,11 @@ public: PrepMethodCompletion() : KCompletion() {} - virtual QString makeCompletion( const QString &string ) { + virtual TQString makeCompletion( const TQString &string ) { kdDebug()<<"original makeCompletion( "<text(); @@ -96,7 +96,7 @@ int PrepMethodComboBox::id( int row ) return prepMethodComboRows[ row ]; } -int PrepMethodComboBox::id( const QString &ing ) +int PrepMethodComboBox::id( const TQString &ing ) { for ( int i = 0; i < count(); i++ ) { if ( ing == text( i ) ) @@ -110,7 +110,7 @@ void PrepMethodComboBox::createPrepMethod( const Element &element ) { int row = findInsertionPoint( element.name ); - QString remember_text; + TQString remember_text; if ( editable() ) remember_text = lineEdit()->text(); @@ -121,8 +121,8 @@ void PrepMethodComboBox::createPrepMethod( const Element &element ) lineEdit()->setText( remember_text ); //now update the map by pushing everything after this item down - QMap new_map; - for ( QMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { if ( it.key() >= row ) { new_map.insert( it.key() + 1, it.data() ); } @@ -136,7 +136,7 @@ void PrepMethodComboBox::createPrepMethod( const Element &element ) void PrepMethodComboBox::removePrepMethod( int id ) { int row = -1; - for ( QMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + for ( TQMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { if ( it.data() == id ) { row = it.key(); completionObject()->removeItem( text(row) ); @@ -150,8 +150,8 @@ void PrepMethodComboBox::removePrepMethod( int id ) return ; //now update the map by pushing everything after this item up - QMap new_map; - for ( QMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { if ( it.key() > row ) { new_map.insert( it.key() - 1, it.data() ); } @@ -161,10 +161,10 @@ void PrepMethodComboBox::removePrepMethod( int id ) prepMethodComboRows = new_map; } -int PrepMethodComboBox::findInsertionPoint( const QString &name ) +int PrepMethodComboBox::findInsertionPoint( const TQString &name ) { for ( int i = 0; i < count(); i++ ) { - if ( QString::localeAwareCompare( name, text( i ) ) < 0 ) + if ( TQString::localeAwareCompare( name, text( i ) ) < 0 ) return i; } @@ -174,7 +174,7 @@ int PrepMethodComboBox::findInsertionPoint( const QString &name ) void PrepMethodComboBox::setSelected( int prepID ) { //do a reverse lookup on the row->id map - QMap::const_iterator it; + TQMap::const_iterator it; for ( it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { if ( it.data() == prepID ) { setCurrentItem(it.key()); diff --git a/krecipes/src/widgets/prepmethodcombobox.h b/krecipes/src/widgets/prepmethodcombobox.h index e4b4d48..559626a 100644 --- a/krecipes/src/widgets/prepmethodcombobox.h +++ b/krecipes/src/widgets/prepmethodcombobox.h @@ -13,7 +13,7 @@ #include -#include +#include #include "datablocks/element.h" @@ -25,23 +25,23 @@ class PrepMethodComboBox : public KComboBox Q_OBJECT public: - PrepMethodComboBox( bool, QWidget *parent, RecipeDB *db, const QString &specialItem = QString::null ); + PrepMethodComboBox( bool, TQWidget *parent, RecipeDB *db, const TQString &specialItem = TQString::null ); void reload(); int id( int row ); - int id( const QString &ing ); + int id( const TQString &ing ); void setSelected( int prepID ); private slots: void createPrepMethod( const Element &element ); void removePrepMethod( int id ); - int findInsertionPoint( const QString &name ); + int findInsertionPoint( const TQString &name ); private: RecipeDB *database; - QMap prepMethodComboRows; // Contains the prep method id for every given row in the combobox - QString m_specialItem; + TQMap prepMethodComboRows; // Contains the prep method id for every given row in the combobox + TQString m_specialItem; }; #endif //PREPMETHODCOMBOBOX_H diff --git a/krecipes/src/widgets/prepmethodlistview.cpp b/krecipes/src/widgets/prepmethodlistview.cpp index a4b148e..e267e30 100644 --- a/krecipes/src/widgets/prepmethodlistview.cpp +++ b/krecipes/src/widgets/prepmethodlistview.cpp @@ -21,10 +21,10 @@ #include "dialogs/createelementdialog.h" #include "dialogs/dependanciesdialog.h" -PrepMethodListView::PrepMethodListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->prepMethodCount()) +PrepMethodListView::PrepMethodListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->prepMethodCount()) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void PrepMethodListView::init() @@ -52,7 +52,7 @@ void PrepMethodListView::checkCreatePrepMethod( const Element &el ) } -StdPrepMethodListView::StdPrepMethodListView( QWidget *parent, RecipeDB *db, bool editable ) : PrepMethodListView( parent, db ) +StdPrepMethodListView::StdPrepMethodListView( TQWidget *parent, RecipeDB *db, bool editable ) : PrepMethodListView( parent, db ) { addColumn( i18n( "Preparation Method" ) ); @@ -75,13 +75,13 @@ StdPrepMethodListView::StdPrepMethodListView( QWidget *parent, RecipeDB *db, boo delete il; - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( modPrepMethod( QListViewItem* ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem* ) ), this, SLOT( savePrepMethod( QListViewItem* ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem* ) ), this, SLOT( modPrepMethod( TQListViewItem* ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem* ) ), this, SLOT( savePrepMethod( TQListViewItem* ) ) ); } } -void StdPrepMethodListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdPrepMethodListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -91,8 +91,8 @@ void StdPrepMethodListView::createNew() { CreateElementDialog * elementDialog = new CreateElementDialog( this, i18n( "New Preparation Method" ) ); - if ( elementDialog->exec() == QDialog::Accepted ) { - QString result = elementDialog->newElementName(); + if ( elementDialog->exec() == TQDialog::Accepted ) { + TQString result = elementDialog->newElementName(); //check bounds first if ( checkBounds( result ) ) @@ -103,7 +103,7 @@ void StdPrepMethodListView::createNew() void StdPrepMethodListView::remove () { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) { ElementList dependingRecipes; @@ -118,7 +118,7 @@ void StdPrepMethodListView::remove info.name = i18n("Recipes"); DependanciesDialog warnDialog( this, info ); warnDialog.setCustomWarning( i18n("You are about to permanantly delete recipes from your database.") ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removePrepMethod( prepMethodID ); } } @@ -126,7 +126,7 @@ void StdPrepMethodListView::remove void StdPrepMethodListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) PrepMethodListView::rename( item, 0 ); @@ -134,22 +134,22 @@ void StdPrepMethodListView::rename() void StdPrepMethodListView::createPrepMethod( const Element &ing ) { - createElement(new QListViewItem( this, ing.name, QString::number( ing.id ) )); + createElement(new TQListViewItem( this, ing.name, TQString::number( ing.id ) )); } void StdPrepMethodListView::removePrepMethod( int id ) { - QListViewItem * item = findItem( QString::number( id ), 1 ); + TQListViewItem * item = findItem( TQString::number( id ), 1 ); removeElement(item); } -void StdPrepMethodListView::modPrepMethod( QListViewItem* i ) +void StdPrepMethodListView::modPrepMethod( TQListViewItem* i ) { if ( i ) PrepMethodListView::rename( i, 0 ); } -void StdPrepMethodListView::savePrepMethod( QListViewItem* i ) +void StdPrepMethodListView::savePrepMethod( TQListViewItem* i ) { if ( !checkBounds( i->text( 0 ) ) ) { reload(ForceReload); //reset the changed text @@ -176,10 +176,10 @@ void StdPrepMethodListView::savePrepMethod( QListViewItem* i ) } } -bool StdPrepMethodListView::checkBounds( const QString &name ) +bool StdPrepMethodListView::checkBounds( const TQString &name ) { if ( name.length() > uint(database->maxPrepMethodNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Preparation method cannot be longer than %1 characters." ) ).arg( database->maxPrepMethodNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Preparation method cannot be longer than %1 characters." ) ).arg( database->maxPrepMethodNameLength() ) ); return false; } diff --git a/krecipes/src/widgets/prepmethodlistview.h b/krecipes/src/widgets/prepmethodlistview.h index f9fd266..3bdcef0 100644 --- a/krecipes/src/widgets/prepmethodlistview.h +++ b/krecipes/src/widgets/prepmethodlistview.h @@ -23,7 +23,7 @@ class PrepMethodListView : public DBListViewBase Q_OBJECT public: - PrepMethodListView( QWidget *parent, RecipeDB *db ); + PrepMethodListView( TQWidget *parent, RecipeDB *db ); public slots: virtual void load( int curr_limit, int curr_offset ); @@ -44,25 +44,25 @@ class StdPrepMethodListView : public PrepMethodListView Q_OBJECT public: - StdPrepMethodListView( QWidget *parent, RecipeDB *db, bool editable = false ); + StdPrepMethodListView( TQWidget *parent, RecipeDB *db, bool editable = false ); protected: virtual void createPrepMethod( const Element & ); virtual void removePrepMethod( int ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove (); void rename(); - void modPrepMethod( QListViewItem* i ); - void savePrepMethod( QListViewItem* i ); + void modPrepMethod( TQListViewItem* i ); + void savePrepMethod( TQListViewItem* i ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); KPopupMenu *kpop; }; diff --git a/krecipes/src/widgets/propertylistview.cpp b/krecipes/src/widgets/propertylistview.cpp index 2e94788..a175f74 100644 --- a/krecipes/src/widgets/propertylistview.cpp +++ b/krecipes/src/widgets/propertylistview.cpp @@ -21,19 +21,19 @@ #include "backends/recipedb.h" #include "dialogs/createpropertydialog.h" -PropertyCheckListItem::PropertyCheckListItem( QListView* klv, const IngredientProperty &property ) : QCheckListItem( klv, QString::null, QCheckListItem::CheckBox ), +PropertyCheckListItem::PropertyCheckListItem( TQListView* klv, const IngredientProperty &property ) : TQCheckListItem( klv, TQString::null, TQCheckListItem::CheckBox ), m_property( property ) { //setOn( false ); // Set unchecked by default } -PropertyCheckListItem::PropertyCheckListItem( QListViewItem* it, const IngredientProperty &property ) : QCheckListItem( it, QString::null, QCheckListItem::CheckBox ), +PropertyCheckListItem::PropertyCheckListItem( TQListViewItem* it, const IngredientProperty &property ) : TQCheckListItem( it, TQString::null, TQCheckListItem::CheckBox ), m_property( property ) { //setOn( false ); // Set unchecked by default } -QString PropertyCheckListItem::text( int column ) const +TQString PropertyCheckListItem::text( int column ) const { switch ( column ) { case 0: @@ -43,23 +43,23 @@ QString PropertyCheckListItem::text( int column ) const return m_property.units; break; case 2: - return QString::number( m_property.id ); + return TQString::number( m_property.id ); break; } - return QString::null; + return TQString::null; } -HidePropertyCheckListItem::HidePropertyCheckListItem( QListView* klv, const IngredientProperty &property, bool enable ) : PropertyCheckListItem( klv, property ) +HidePropertyCheckListItem::HidePropertyCheckListItem( TQListView* klv, const IngredientProperty &property, bool enable ) : PropertyCheckListItem( klv, property ) { m_holdSettings = true; setOn( enable ); // Set checked by default m_holdSettings = false; } -HidePropertyCheckListItem::HidePropertyCheckListItem( QListViewItem* it, const IngredientProperty &property, bool enable ) : PropertyCheckListItem( it, property ) +HidePropertyCheckListItem::HidePropertyCheckListItem( TQListViewItem* it, const IngredientProperty &property, bool enable ) : PropertyCheckListItem( it, property ) { m_holdSettings = true; setOn( enable ); // Set checked by default @@ -73,7 +73,7 @@ void HidePropertyCheckListItem::stateChange( bool on ) config->setGroup("Formatting"); config->sync(); - QStringList hiddenList = config->readListEntry("HiddenProperties"); + TQStringList hiddenList = config->readListEntry("HiddenProperties"); if ( on ) hiddenList.remove(m_property.name); else if ( !hiddenList.contains(m_property.name) ) @@ -83,11 +83,11 @@ void HidePropertyCheckListItem::stateChange( bool on ) } } -PropertyListView::PropertyListView( QWidget *parent, RecipeDB *db ) : KListView( parent ), +PropertyListView::PropertyListView( TQWidget *parent, RecipeDB *db ) : KListView( parent ), database( db ) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); connect( db, SIGNAL( propertyCreated( const IngredientProperty & ) ), SLOT( createProperty( const IngredientProperty & ) ) ); connect( db, SIGNAL( propertyRemoved( int ) ), SLOT( removeProperty( int ) ) ); @@ -112,7 +112,7 @@ void PropertyListView::reload() -StdPropertyListView::StdPropertyListView( QWidget *parent, RecipeDB *db, bool editable ) : PropertyListView( parent, db ) +StdPropertyListView::StdPropertyListView( TQWidget *parent, RecipeDB *db, bool editable ) : PropertyListView( parent, db ) { addColumn( i18n( "Property" ) ); addColumn( i18n( "Units" ) ); @@ -138,13 +138,13 @@ StdPropertyListView::StdPropertyListView( QWidget *parent, RecipeDB *db, bool ed delete il; - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( modProperty( QListViewItem* ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem* ) ), this, SLOT( saveProperty( QListViewItem* ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem* ) ), this, SLOT( modProperty( TQListViewItem* ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem* ) ), this, SLOT( saveProperty( TQListViewItem* ) ) ); } } -void StdPropertyListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdPropertyListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -156,9 +156,9 @@ void StdPropertyListView::createNew() database->loadUnits( &list ); CreatePropertyDialog* propertyDialog = new CreatePropertyDialog( this, &list ); - if ( propertyDialog->exec() == QDialog::Accepted ) { - QString name = propertyDialog->newPropertyName(); - QString units = propertyDialog->newUnitsName(); + if ( propertyDialog->exec() == TQDialog::Accepted ) { + TQString name = propertyDialog->newPropertyName(); + TQString units = propertyDialog->newUnitsName(); if ( !( ( name.isEmpty() ) || ( units.isEmpty() ) ) ) // Make sure none of the fields are empty { //check bounds first @@ -172,7 +172,7 @@ void StdPropertyListView::createNew() void StdPropertyListView::remove () { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) { switch ( KMessageBox::warningContinueCancel( this, i18n( "Are you sure you want to delete this property?" ) ) ) { @@ -187,7 +187,7 @@ void StdPropertyListView::remove void StdPropertyListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) PropertyListView::rename( item, 0 ); @@ -195,7 +195,7 @@ void StdPropertyListView::rename() void StdPropertyListView::removeProperty( int id ) { - QListViewItem * item = findItem( QString::number( id ), 2 ); + TQListViewItem * item = findItem( TQString::number( id ), 2 ); Q_ASSERT( item ); @@ -204,16 +204,16 @@ void StdPropertyListView::removeProperty( int id ) void StdPropertyListView::createProperty( const IngredientProperty &property ) { - ( void ) new QListViewItem( this, property.name, property.units, QString::number( property.id ) ); + ( void ) new TQListViewItem( this, property.name, property.units, TQString::number( property.id ) ); } -void StdPropertyListView::modProperty( QListViewItem* i ) +void StdPropertyListView::modProperty( TQListViewItem* i ) { if ( i ) PropertyListView::rename( i, 0 ); } -void StdPropertyListView::saveProperty( QListViewItem* i ) +void StdPropertyListView::saveProperty( TQListViewItem* i ) { if ( !checkBounds( i->text( 0 ) ) ) { reload(); //reset the changed text @@ -239,10 +239,10 @@ kdDebug() << "saveProp: " << i->text( 0 ) << endl; database->modProperty( prop_id, i->text( 0 ) ); } -bool StdPropertyListView::checkBounds( const QString &name ) +bool StdPropertyListView::checkBounds( const TQString &name ) { if ( name.length() > database->maxPropertyNameLength() ) { - KMessageBox::error( this, QString( i18n( "Property name cannot be longer than %1 characters." ) ).arg( database->maxPropertyNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Property name cannot be longer than %1 characters." ) ).arg( database->maxPropertyNameLength() ) ); return false; } @@ -251,7 +251,7 @@ bool StdPropertyListView::checkBounds( const QString &name ) -PropertyConstraintListView::PropertyConstraintListView( QWidget *parent, RecipeDB *db ) : PropertyListView( parent, db ) +PropertyConstraintListView::PropertyConstraintListView( TQWidget *parent, RecipeDB *db ) : PropertyListView( parent, db ) { addColumn( i18n( "Enabled" ) ); addColumn( i18n( "Property" ) ); @@ -264,7 +264,7 @@ PropertyConstraintListView::PropertyConstraintListView( QWidget *parent, RecipeD void PropertyConstraintListView::removeProperty( int id ) { - QListViewItem * item = findItem( QString::number( id ), 4 ); + TQListViewItem * item = findItem( TQString::number( id ), 4 ); Q_ASSERT( item ); @@ -277,7 +277,7 @@ void PropertyConstraintListView::createProperty( const IngredientProperty &prope } -CheckPropertyListView::CheckPropertyListView( QWidget *parent, RecipeDB *db, bool editable ) : StdPropertyListView( parent, db, editable ) +CheckPropertyListView::CheckPropertyListView( TQWidget *parent, RecipeDB *db, bool editable ) : StdPropertyListView( parent, db, editable ) { } diff --git a/krecipes/src/widgets/propertylistview.h b/krecipes/src/widgets/propertylistview.h index f578c1c..fe8741e 100644 --- a/krecipes/src/widgets/propertylistview.h +++ b/krecipes/src/widgets/propertylistview.h @@ -20,15 +20,15 @@ class RecipeDB; class KPopupMenu; -class PropertyCheckListItem : public QCheckListItem +class PropertyCheckListItem : public TQCheckListItem { public: - PropertyCheckListItem( QListView* klv, const IngredientProperty &property ); - PropertyCheckListItem( QListViewItem* it, const IngredientProperty &property ); + PropertyCheckListItem( TQListView* klv, const IngredientProperty &property ); + PropertyCheckListItem( TQListViewItem* it, const IngredientProperty &property ); ~PropertyCheckListItem( void ) {} - virtual QString text( int column ) const; + virtual TQString text( int column ) const; IngredientProperty property() const { @@ -43,8 +43,8 @@ protected: class HidePropertyCheckListItem : public PropertyCheckListItem { public: - HidePropertyCheckListItem( QListView* klv, const IngredientProperty &property, bool enable = false ); - HidePropertyCheckListItem( QListViewItem* it, const IngredientProperty &property, bool enable = false ); + HidePropertyCheckListItem( TQListView* klv, const IngredientProperty &property, bool enable = false ); + HidePropertyCheckListItem( TQListViewItem* it, const IngredientProperty &property, bool enable = false ); protected: virtual void stateChange( bool on ); @@ -54,10 +54,10 @@ private: }; -class ConstraintsListItem: public QCheckListItem +class ConstraintsListItem: public TQCheckListItem { public: - ConstraintsListItem( QListView* klv, const IngredientProperty &pty ) : QCheckListItem( klv, QString::null, QCheckListItem::CheckBox ) + ConstraintsListItem( TQListView* klv, const IngredientProperty &pty ) : TQCheckListItem( klv, TQString::null, TQCheckListItem::CheckBox ) { // Initialize the constraint data with the the property data ctStored = new Constraint(); @@ -100,26 +100,26 @@ public: void setMax( double maxValue ) { ctStored->max = maxValue; - setText( 3, QString::number( maxValue ) ); + setText( 3, TQString::number( maxValue ) ); } void setMin( double minValue ) { ctStored->min = minValue; - setText( 2, QString::number( minValue ) ); + setText( 2, TQString::number( minValue ) ); } - virtual QString text( int column ) const + virtual TQString text( int column ) const { switch ( column ) { case 1: return ( ctStored->name ); case 2: - return ( QString::number( ctStored->min ) ); + return ( TQString::number( ctStored->min ) ); case 3: - return ( QString::number( ctStored->max ) ); + return ( TQString::number( ctStored->max ) ); case 4: - return ( QString::number( ctStored->id ) ); + return ( TQString::number( ctStored->id ) ); default: - return ( QString::null ); + return ( TQString::null ); } } }; @@ -130,7 +130,7 @@ class PropertyListView : public KListView Q_OBJECT public: - PropertyListView( QWidget *parent, RecipeDB * ); + PropertyListView( TQWidget *parent, RecipeDB * ); public slots: void reload( void ); @@ -151,25 +151,25 @@ class StdPropertyListView : public PropertyListView Q_OBJECT public: - StdPropertyListView( QWidget *parent, RecipeDB *, bool editable = false ); + StdPropertyListView( TQWidget *parent, RecipeDB *, bool editable = false ); protected: virtual void removeProperty( int id ); virtual void createProperty( const IngredientProperty &property ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void createNew(); void remove (); void rename(); - void modProperty( QListViewItem* i ); - void saveProperty( QListViewItem* i ); + void modProperty( TQListViewItem* i ); + void saveProperty( TQListViewItem* i ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); KPopupMenu *kpop; }; @@ -179,7 +179,7 @@ private: class PropertyConstraintListView : public PropertyListView { public: - PropertyConstraintListView( QWidget *parent, RecipeDB * ); + PropertyConstraintListView( TQWidget *parent, RecipeDB * ); protected: virtual void removeProperty( int id ); @@ -191,13 +191,13 @@ class CheckPropertyListView : public StdPropertyListView Q_OBJECT public: - CheckPropertyListView( QWidget *parent, RecipeDB *, bool editable = false ); + CheckPropertyListView( TQWidget *parent, RecipeDB *, bool editable = false ); protected: virtual void createProperty( const IngredientProperty &property ); private: - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); }; #endif //PROPERTYLISTVIEW_H diff --git a/krecipes/src/widgets/ratingdisplaywidget.ui b/krecipes/src/widgets/ratingdisplaywidget.ui index c4387a4..5493a84 100644 --- a/krecipes/src/widgets/ratingdisplaywidget.ui +++ b/krecipes/src/widgets/ratingdisplaywidget.ui @@ -1,6 +1,6 @@ RatingDisplayWidget - + RatingDisplayWidget @@ -23,7 +23,7 @@ unnamed - + layout4 @@ -48,7 +48,7 @@ - + icon @@ -84,7 +84,7 @@ - + layout5 @@ -92,7 +92,7 @@ unnamed - + raterName @@ -151,7 +151,7 @@ NoSelection - + comment @@ -170,7 +170,7 @@ WordBreak|AlignTop - + layout4 diff --git a/krecipes/src/widgets/ratingwidget.cpp b/krecipes/src/widgets/ratingwidget.cpp index ed5580f..baaafa1 100644 --- a/krecipes/src/widgets/ratingwidget.cpp +++ b/krecipes/src/widgets/ratingwidget.cpp @@ -17,17 +17,17 @@ #include #include -#include -#include +#include +#include namespace { static const int RATING_WIDGET_MAX_STAR_SIZE = 24; } -const QPixmap& RatingWidget::pixmap(const QString& value_) { - static QIntDict pixmaps; +const TQPixmap& RatingWidget::pixmap(const TQString& value_) { + static TQIntDict pixmaps; if(pixmaps.isEmpty()) { - pixmaps.insert(-1, new QPixmap()); + pixmaps.insert(-1, new TQPixmap()); } bool ok; int n = value_.toInt(&ok); @@ -38,30 +38,30 @@ const QPixmap& RatingWidget::pixmap(const QString& value_) { return *pixmaps[n]; } - QString picName = QString::fromLatin1("stars%1").arg(n); - QPixmap* pix = new QPixmap(UserIcon(picName)); + TQString picName = TQString::fromLatin1("stars%1").arg(n); + TQPixmap* pix = new TQPixmap(UserIcon(picName)); pixmaps.insert(n, pix); return *pix; } -RatingWidget::RatingWidget(int stars, QWidget* parent_, const char* name_/*=0*/) - : QHBox(parent_, name_), m_currIndex(-1), m_min(0), m_max(stars*2) { - m_pixOn = UserIcon(QString::fromLatin1("star_on")); - m_pixOff = UserIcon(QString::fromLatin1("star_off")); - m_pixHalf = UserIcon(QString::fromLatin1("star_half")); +RatingWidget::RatingWidget(int stars, TQWidget* parent_, const char* name_/*=0*/) + : TQHBox(parent_, name_), m_currIndex(-1), m_min(0), m_max(stars*2) { + m_pixOn = UserIcon(TQString::fromLatin1("star_on")); + m_pixOff = UserIcon(TQString::fromLatin1("star_off")); + m_pixHalf = UserIcon(TQString::fromLatin1("star_half")); setSpacing(0); // find maximum width and height int w = KMAX(RATING_WIDGET_MAX_STAR_SIZE, KMAX(m_pixOn.width(), m_pixOff.width())); int h = KMAX(RATING_WIDGET_MAX_STAR_SIZE, KMAX(m_pixOn.height(), m_pixOff.height())); for(int i = 0; i < stars; ++i) { - QLabel* l = new QLabel(this); + TQLabel* l = new TQLabel(this); l->setFixedSize(w, h); m_widgets.append(l); } init(); - QBoxLayout* l = dynamic_cast(layout()); + TQBoxLayout* l = dynamic_cast(layout()); if(l) { l->addStretch(1); } @@ -74,7 +74,7 @@ void RatingWidget::init() { m_widgets.at(i)->setPixmap(m_pixOff); } for( ; i < m_widgets.count(); ++i) { - m_widgets.at(i)->setPixmap(QPixmap()); + m_widgets.at(i)->setPixmap(TQPixmap()); } update(); } @@ -92,25 +92,25 @@ void RatingWidget::update() { m_widgets.at(m_currIndex/2)->setPixmap(m_pixHalf); } - QHBox::update(); + TQHBox::update(); } -void RatingWidget::mousePressEvent(QMouseEvent* event_) { +void RatingWidget::mousePressEvent(TQMouseEvent* event_) { // only react to left button - if(event_->button() != Qt::LeftButton) { + if(event_->button() != TQt::LeftButton) { return; } int idx; - QWidget* child = childAt(event_->pos()); + TQWidget* child = childAt(event_->pos()); bool left = false; if(child) { - QRect child_geom_left_half = child->geometry(); + TQRect child_geom_left_half = child->geometry(); child_geom_left_half.setWidth(child_geom_left_half.width()/2); if ( child_geom_left_half.contains(event_->pos()) ) left = true; - idx = m_widgets.findRef(static_cast(child)); + idx = m_widgets.findRef(static_cast(child)); // if the widget is clicked beyond the maximum value, clear it // remember total and min are values, but index is zero-based! if(idx > m_total-1) { @@ -140,12 +140,12 @@ void RatingWidget::clear() { update(); } -QString RatingWidget::text() const { +TQString RatingWidget::text() const { // index is index of the list, which is zero-based. Add 1! - return m_currIndex == -1 ? QString::null : QString::number(double(m_currIndex+1)/2); + return m_currIndex == -1 ? TQString::null : TQString::number(double(m_currIndex+1)/2); } -void RatingWidget::setText(const QString& text_) { +void RatingWidget::setText(const TQString& text_) { bool ok; // text is value, subtract one to get index m_currIndex =text_.toInt(&ok)-1; diff --git a/krecipes/src/widgets/ratingwidget.h b/krecipes/src/widgets/ratingwidget.h index ac7e213..268b3b6 100644 --- a/krecipes/src/widgets/ratingwidget.h +++ b/krecipes/src/widgets/ratingwidget.h @@ -14,28 +14,28 @@ #ifndef RATINGWIDGET_H #define RATINGWIDGET_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include /** * @author Robby Stephenson */ -class RatingWidget : public QHBox { +class RatingWidget : public TQHBox { Q_OBJECT -typedef QPtrList LabelList; +typedef TQPtrList LabelList; public: - RatingWidget(int stars, QWidget* parent, const char* name = 0); + RatingWidget(int stars, TQWidget* parent, const char* name = 0); void clear(); - QString text() const; - void setText(const QString& text); + TQString text() const; + void setText(const TQString& text); - static const QPixmap& pixmap(const QString& value); + static const TQPixmap& pixmap(const TQString& value); public slots: void update(); @@ -44,7 +44,7 @@ signals: void modified(); protected: - virtual void mousePressEvent(QMouseEvent* e); + virtual void mousePressEvent(TQMouseEvent* e); private: void init(); @@ -56,8 +56,8 @@ private: int m_min; int m_max; - QPixmap m_pixOn; - QPixmap m_pixOff; - QPixmap m_pixHalf; + TQPixmap m_pixOn; + TQPixmap m_pixOff; + TQPixmap m_pixHalf; }; #endif diff --git a/krecipes/src/widgets/recipelistview.cpp b/krecipes/src/widgets/recipelistview.cpp index 9740aa1..5071663 100644 --- a/krecipes/src/widgets/recipelistview.cpp +++ b/krecipes/src/widgets/recipelistview.cpp @@ -11,9 +11,9 @@ #include "recipelistview.h" -#include -#include -#include +#include +#include +#include #include #include @@ -25,42 +25,42 @@ #include "backends/recipedb.h" -class UncategorizedItem : public QListViewItem +class UncategorizedItem : public TQListViewItem { public: - UncategorizedItem( QListView *lv ) : QListViewItem( lv, i18n("Uncategorized") ){} + UncategorizedItem( TQListView *lv ) : TQListViewItem( lv, i18n("Uncategorized") ){} int rtti() const { return 1006; } }; -RecipeItemDrag::RecipeItemDrag( RecipeListItem *recipeItem, QWidget *dragSource, const char *name ) - : QStoredDrag( RECIPEITEMMIMETYPE, dragSource, name ) +RecipeItemDrag::RecipeItemDrag( RecipeListItem *recipeItem, TQWidget *dragSource, const char *name ) + : TQStoredDrag( RECIPEITEMMIMETYPE, dragSource, name ) { if ( recipeItem ) { - QByteArray data; - QDataStream out( data, IO_WriteOnly ); + TQByteArray data; + TQDataStream out( data, IO_WriteOnly ); out << recipeItem->recipeID(); out << recipeItem->title(); setEncodedData( data ); } } -bool RecipeItemDrag::canDecode( QMimeSource* e ) +bool RecipeItemDrag::canDecode( TQMimeSource* e ) { return e->provides( RECIPEITEMMIMETYPE ); } -bool RecipeItemDrag::decode( const QMimeSource* e, RecipeListItem& item ) +bool RecipeItemDrag::decode( const TQMimeSource* e, RecipeListItem& item ) { if ( !e ) return false; - QByteArray data = e->encodedData( RECIPEITEMMIMETYPE ); + TQByteArray data = e->encodedData( RECIPEITEMMIMETYPE ); if ( data.isEmpty() ) return false; - QString title; + TQString title; int recipeID; - QDataStream in( data, IO_ReadOnly ); + TQDataStream in( data, IO_ReadOnly ); in >> recipeID; in >> title; @@ -70,17 +70,17 @@ bool RecipeItemDrag::decode( const QMimeSource* e, RecipeListItem& item ) return true; } -class RecipeListToolTip : public QToolTip +class RecipeListToolTip : public TQToolTip { public: - RecipeListToolTip( RecipeListView *view ) : QToolTip(view->viewport()), m_view(view) + RecipeListToolTip( RecipeListView *view ) : TQToolTip(view->viewport()), m_view(view) {} - void maybeTip( const QPoint &point ) + void maybeTip( const TQPoint &point ) { - QListViewItem *item = m_view->itemAt( point ); + TQListViewItem *item = m_view->itemAt( point ); if ( item ) { - QString text = m_view->tooltip(item,0); + TQString text = m_view->tooltip(item,0); if ( !text.isEmpty() ) tip( m_view->itemRect( item ), text ); } @@ -92,7 +92,7 @@ private: }; -RecipeListView::RecipeListView( QWidget *parent, RecipeDB *db ) : StdCategoryListView( parent, db ), +RecipeListView::RecipeListView( TQWidget *parent, RecipeDB *db ) : StdCategoryListView( parent, db ), flat_list( false ), m_uncat_item(0), m_progress_dlg(0) @@ -105,7 +105,7 @@ RecipeListView::RecipeListView( QWidget *parent, RecipeDB *db ) : StdCategoryLis KIconLoader il; setPixmap( il.loadIcon( "categories", KIcon::NoGroup, 16 ) ); - setSelectionMode( QListView::Extended ); + setSelectionMode( TQListView::Extended ); (void)new RecipeListToolTip(this); } @@ -120,12 +120,12 @@ void RecipeListView::init() StdCategoryListView::init(); } -QDragObject *RecipeListView::dragObject() +TQDragObject *RecipeListView::dragObject() { RecipeListItem * item = dynamic_cast( currentItem() ); if ( item != 0 ) { RecipeItemDrag * obj = new RecipeItemDrag( item, this, "Recipe drag item" ); - /*const QPixmap *pm = item->pixmap(0); + /*const TQPixmap *pm = item->pixmap(0); if( pm ) obj->setPixmap( *pm );*/ return obj; @@ -133,12 +133,12 @@ QDragObject *RecipeListView::dragObject() return 0; } -bool RecipeListView::acceptDrag( QDropEvent *event ) const +bool RecipeListView::acceptDrag( TQDropEvent *event ) const { return RecipeItemDrag::canDecode( event ); } -QString RecipeListView::tooltip(QListViewItem *item, int /*column*/) const +TQString RecipeListView::tooltip(TQListViewItem *item, int /*column*/) const { if ( item->rtti() == RECIPELISTITEM_RTTI ) { RecipeListItem *recipe_it = (RecipeListItem*)item; @@ -148,7 +148,7 @@ QString RecipeListView::tooltip(QListViewItem *item, int /*column*/) const KLocale *locale = KGlobal::locale(); - return QString("
    %7
    __________
    %1 %2
    %3 %4
    %5 %6") + return TQString("
    %7
    __________
    %1 %2
    %3 %4
    %5 %6") .arg(i18n("Created:")).arg(locale->formatDateTime(r.ctime)) .arg(i18n("Modified:")).arg(locale->formatDateTime(r.mtime)) .arg(i18n("Last Accessed:")).arg(locale->formatDateTime(r.atime)) @@ -157,13 +157,13 @@ QString RecipeListView::tooltip(QListViewItem *item, int /*column*/) const else if ( item->rtti() == CATEGORYLISTITEM_RTTI ) { CategoryListItem *cat_it = (CategoryListItem*)item; - return QString("%1
    %2: %3") + return TQString("%1
    %2: %3") .arg(cat_it->categoryName()) .arg(i18n("Recipes")) - .arg(QString::number(WHATEVER THE CHILD COUNT IS)); + .arg(TQString::number(WHATEVER THE CHILD COUNT IS)); }*/ - return QString::null; + return TQString::null; } void RecipeListView::load(int limit, int offset) @@ -200,7 +200,7 @@ void RecipeListView::load(int limit, int offset) } } -void RecipeListView::populate( QListViewItem *item ) +void RecipeListView::populate( TQListViewItem *item ) { CategoryItemInfo *cat_item = dynamic_cast(item); if ( !cat_item || cat_item->isPopulated() ) return; @@ -231,12 +231,12 @@ void RecipeListView::populate( QListViewItem *item ) } } -void RecipeListView::populateAll( QListViewItem *parent ) +void RecipeListView::populateAll( TQListViewItem *parent ) { bool first = false; if ( !parent ) { first = true; - m_progress_dlg = new KProgressDialog(this,"populate_all_prog_dlg",QString::null,i18n("Loading recipes"),true); + m_progress_dlg = new KProgressDialog(this,"populate_all_prog_dlg",TQString::null,i18n("Loading recipes"),true); m_progress_dlg->setAllowCancel(false); m_progress_dlg->progressBar()->setTotalSteps(0); m_progress_dlg->progressBar()->setPercentageVisible(false); @@ -250,7 +250,7 @@ void RecipeListView::populateAll( QListViewItem *parent ) parent = parent->firstChild(); } - for ( QListViewItem *item = parent; item; item = item->nextSibling() ) { + for ( TQListViewItem *item = parent; item; item = item->nextSibling() ) { if ( m_progress_dlg && m_progress_dlg->wasCancelled() ) break; @@ -295,7 +295,7 @@ void RecipeListView::createRecipe( const Element &recipe_el, const ElementList & for ( ElementList::const_iterator cat_it = categories.begin(); cat_it != categories.end(); ++cat_it ) { int cur_cat_id = ( *cat_it ).id; - QListViewItemIterator iterator( this ); + TQListViewItemIterator iterator( this ); while ( iterator.current() ) { if ( iterator.current() ->rtti() == 1001 ) { CategoryListItem * cat_item = ( CategoryListItem* ) iterator.current(); @@ -309,7 +309,7 @@ void RecipeListView::createRecipe( const Element &recipe_el, const ElementList & } } -void RecipeListView::createElement( QListViewItem *item ) +void RecipeListView::createElement( TQListViewItem *item ) { CategoryItemInfo *cat_item = dynamic_cast(item); if ( cat_item && !cat_item->isPopulated() ) { @@ -336,7 +336,7 @@ void RecipeListView::modifyRecipe( const Element &recipe, const ElementList &cat void RecipeListView::removeRecipe( int id ) { - QListViewItemIterator iterator( this ); + TQListViewItemIterator iterator( this ); while ( iterator.current() ) { if ( iterator.current() ->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current(); @@ -356,11 +356,11 @@ void RecipeListView::removeRecipe( int id ) void RecipeListView::removeRecipe( int recipe_id, int cat_id ) { - QListViewItem * item = items_map[ cat_id ]; + TQListViewItem * item = items_map[ cat_id ]; //find out if this is the only category the recipe belongs to int finds = 0; - QListViewItemIterator iterator( this ); + TQListViewItemIterator iterator( this ); while ( iterator.current() ) { if ( iterator.current() ->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current(); @@ -375,8 +375,8 @@ void RecipeListView::removeRecipe( int recipe_id, int cat_id ) } //do this to only iterate over children of 'item' - QListViewItem *pEndItem = NULL; - QListViewItem *pStartItem = item; + TQListViewItem *pEndItem = NULL; + TQListViewItem *pStartItem = item; do { if ( pStartItem->nextSibling() ) pEndItem = pStartItem->nextSibling(); @@ -385,7 +385,7 @@ void RecipeListView::removeRecipe( int recipe_id, int cat_id ) } while ( pStartItem && !pEndItem ); - iterator = QListViewItemIterator( item ); + iterator = TQListViewItemIterator( item ); while ( iterator.current() != pEndItem ) { if ( iterator.current() ->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current(); @@ -412,7 +412,7 @@ void RecipeListView::removeRecipe( int recipe_id, int cat_id ) void RecipeListView::removeCategory( int id ) { - QListViewItem * item = items_map[ id ]; + TQListViewItem * item = items_map[ id ]; if ( !item ) return ; //this may have been deleted already by its parent being deleted @@ -421,10 +421,10 @@ void RecipeListView::removeCategory( int id ) StdCategoryListView::removeCategory( id ); } -void RecipeListView::moveChildrenToRoot( QListViewItem *item ) +void RecipeListView::moveChildrenToRoot( TQListViewItem *item ) { - QListViewItem * next_sibling; - for ( QListViewItem * it = item->firstChild(); it; it = next_sibling ) { + TQListViewItem * next_sibling; + for ( TQListViewItem * it = item->firstChild(); it; it = next_sibling ) { next_sibling = it->nextSibling(); if ( it->rtti() == 1000 ) { RecipeListItem *recipe_it = (RecipeListItem*) it; diff --git a/krecipes/src/widgets/recipelistview.h b/krecipes/src/widgets/recipelistview.h index 83061a3..23135f4 100644 --- a/krecipes/src/widgets/recipelistview.h +++ b/krecipes/src/widgets/recipelistview.h @@ -14,13 +14,13 @@ #ifndef RECIPELISTVIEW_H #define RECIPELISTVIEW_H -#include +#include #include "categorylistview.h" #include "datablocks/recipe.h" -class QDragObject; -class QDropEvent; +class TQDragObject; +class TQDropEvent; class KProgressDialog; @@ -30,30 +30,30 @@ class RecipeDB; #define RECIPEITEMMIMETYPE "data/x-kde.recipe.item" -class RecipeListItem : public QListViewItem +class RecipeListItem : public TQListViewItem { public: - RecipeListItem( QListView* qlv, const Recipe &r ) : QListViewItem( qlv ) + RecipeListItem( TQListView* qlv, const Recipe &r ) : TQListViewItem( qlv ) { init( r ); } - RecipeListItem( QListView* qlv, QListViewItem *after, const Recipe &r ) : QListViewItem( qlv, after ) + RecipeListItem( TQListView* qlv, TQListViewItem *after, const Recipe &r ) : TQListViewItem( qlv, after ) { init( r ); } - RecipeListItem( CategoryListItem* it, const Recipe &r ) : QListViewItem( it ) + RecipeListItem( CategoryListItem* it, const Recipe &r ) : TQListViewItem( it ) { init( r ); } - RecipeListItem( CategoryListItem* it, QListViewItem *after, const Recipe &r ) : QListViewItem( it, after ) + RecipeListItem( CategoryListItem* it, TQListViewItem *after, const Recipe &r ) : TQListViewItem( it, after ) { init( r ); } - RecipeListItem( QListViewItem* it, const Recipe &r ) : QListViewItem( it ) + RecipeListItem( TQListViewItem* it, const Recipe &r ) : TQListViewItem( it ) { init( r ); } @@ -72,7 +72,7 @@ public: { return recipeStored->recipeID; } - QString title() const + TQString title() const { return recipeStored->title; } @@ -81,7 +81,7 @@ public: { recipeStored->recipeID = id; } - void setTitle( const QString &title ) + void setTitle( const TQString &title ) { recipeStored->title = title; } @@ -90,17 +90,17 @@ protected: Recipe *recipeStored; public: - virtual QString text( int column ) const + virtual TQString text( int column ) const { switch ( column ) { case 0: return ( recipeStored->title ); break; case 1: - return ( QString::number( recipeStored->recipeID ) ); + return ( TQString::number( recipeStored->recipeID ) ); break; default: - return ( QString::null ); + return ( TQString::null ); } } @@ -115,12 +115,12 @@ private: } }; -class RecipeItemDrag : public QStoredDrag +class RecipeItemDrag : public TQStoredDrag { public: - RecipeItemDrag( RecipeListItem *recipeItem, QWidget *dragSource = 0, const char *name = 0 ); - static bool canDecode( QMimeSource* e ); - static bool decode( const QMimeSource* e, RecipeListItem& item ); + RecipeItemDrag( RecipeListItem *recipeItem, TQWidget *dragSource = 0, const char *name = 0 ); + static bool canDecode( TQMimeSource* e ); + static bool decode( const TQMimeSource* e, RecipeListItem& item ); }; class RecipeListView : public StdCategoryListView @@ -128,10 +128,10 @@ class RecipeListView : public StdCategoryListView Q_OBJECT public: - RecipeListView( QWidget *parent, RecipeDB *db ); + RecipeListView( TQWidget *parent, RecipeDB *db ); public slots: - void populateAll( QListViewItem *parent = 0 ); + void populateAll( TQListViewItem *parent = 0 ); protected slots: virtual void createRecipe( const Recipe &, int parent_id ); @@ -142,23 +142,23 @@ protected slots: protected: virtual void init(); - virtual void createElement( QListViewItem * ); + virtual void createElement( TQListViewItem * ); virtual void removeCategory( int id ); - virtual QDragObject *dragObject(); - virtual bool acceptDrag( QDropEvent *event ) const; - virtual void populate( QListViewItem *item ); - virtual QString tooltip(QListViewItem *item, int column) const; + virtual TQDragObject *dragObject(); + virtual bool acceptDrag( TQDropEvent *event ) const; + virtual void populate( TQListViewItem *item ); + virtual TQString tooltip(TQListViewItem *item, int column) const; friend class RecipeListToolTip; void load(int limit, int offset); private: - void moveChildrenToRoot( QListViewItem * ); + void moveChildrenToRoot( TQListViewItem * ); bool flat_list; - QListViewItem *m_uncat_item; - QListViewItem *lastElementCurrLevel; + TQListViewItem *m_uncat_item; + TQListViewItem *lastElementCurrLevel; KProgressDialog *m_progress_dlg; }; diff --git a/krecipes/src/widgets/unitcombobox.cpp b/krecipes/src/widgets/unitcombobox.cpp index 32766a0..bfb2ec5 100644 --- a/krecipes/src/widgets/unitcombobox.cpp +++ b/krecipes/src/widgets/unitcombobox.cpp @@ -10,7 +10,7 @@ #include "unitcombobox.h" -#include +#include #include #include @@ -19,7 +19,7 @@ #include "backends/recipedb.h" #include "datablocks/elementlist.h" -UnitComboBox::UnitComboBox( QWidget *parent, RecipeDB *db, Unit::Type type ) : KComboBox( parent ), +UnitComboBox::UnitComboBox( TQWidget *parent, RecipeDB *db, Unit::Type type ) : KComboBox( parent ), database( db ), m_type(type) { connect( database, SIGNAL( unitCreated( const Unit & ) ), SLOT( createUnit( const Unit & ) ) ); @@ -43,7 +43,7 @@ Unit UnitComboBox::unit() const void UnitComboBox::reload() { - QString remember_filter = currentText(); + TQString remember_filter = currentText(); UnitList unitList; database->loadUnits( &unitList, m_type ); @@ -54,7 +54,7 @@ void UnitComboBox::reload() //Now load the categories loadUnits(unitList); - if ( listBox()->findItem( remember_filter, Qt::ExactMatch ) ) { + if ( listBox()->findItem( remember_filter, TQt::ExactMatch ) ) { setCurrentText( remember_filter ); } } @@ -72,7 +72,7 @@ void UnitComboBox::loadUnits( const UnitList &unitList ) void UnitComboBox::setSelected( int unitID ) { //do a reverse lookup on the row->id map - QMap::const_iterator it; + TQMap::const_iterator it; for ( it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { if ( it.data() == unitID ) { setCurrentItem(it.key()); @@ -93,8 +93,8 @@ void UnitComboBox::createUnit( const Unit &element ) insertItem( element.name, row ); //now update the map by pushing everything after this item down - QMap new_map; - for ( QMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { if ( it.key() >= row ) { new_map.insert( it.key() + 1, it.data() ); } @@ -108,7 +108,7 @@ void UnitComboBox::createUnit( const Unit &element ) void UnitComboBox::removeUnit( int id ) { int row = -1; - for ( QMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + for ( TQMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { if ( it.data() == id ) { row = it.key(); removeItem( row ); @@ -121,8 +121,8 @@ void UnitComboBox::removeUnit( int id ) return ; //now update the map by pushing everything after this item up - QMap new_map; - for ( QMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + TQMap new_map; + for ( TQMap::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { if ( it.key() > row ) { new_map.insert( it.key() - 1, it.data() ); } @@ -132,10 +132,10 @@ void UnitComboBox::removeUnit( int id ) unitComboRows = new_map; } -int UnitComboBox::findInsertionPoint( const QString &name ) +int UnitComboBox::findInsertionPoint( const TQString &name ) { for ( int i = 1; i < count(); i++ ) { - if ( QString::localeAwareCompare( name, text( i ) ) < 0 ) + if ( TQString::localeAwareCompare( name, text( i ) ) < 0 ) return i; } diff --git a/krecipes/src/widgets/unitcombobox.h b/krecipes/src/widgets/unitcombobox.h index 9f21be3..edde9dc 100644 --- a/krecipes/src/widgets/unitcombobox.h +++ b/krecipes/src/widgets/unitcombobox.h @@ -13,7 +13,7 @@ #include -#include +#include #include "datablocks/unit.h" @@ -24,7 +24,7 @@ class UnitComboBox : public KComboBox Q_OBJECT public: - UnitComboBox( QWidget *parent, RecipeDB *db, Unit::Type type = Unit::All ); + UnitComboBox( TQWidget *parent, RecipeDB *db, Unit::Type type = Unit::All ); void reload(); int id( int row ) const; @@ -38,13 +38,13 @@ private slots: void createUnit( const Unit & ); void removeUnit( int id ); - int findInsertionPoint( const QString &name ); + int findInsertionPoint( const TQString &name ); private: void loadUnits( const UnitList &unitList ); RecipeDB *database; - QMap unitComboRows; // Contains the unit id for every given row in the unit combobox + TQMap unitComboRows; // Contains the unit id for every given row in the unit combobox Unit::Type m_type; }; diff --git a/krecipes/src/widgets/unitlistview.cpp b/krecipes/src/widgets/unitlistview.cpp index 1259d4a..fc1a14f 100644 --- a/krecipes/src/widgets/unitlistview.cpp +++ b/krecipes/src/widgets/unitlistview.cpp @@ -14,8 +14,8 @@ #include "unitlistview.h" -#include -#include +#include +#include #include #include @@ -30,15 +30,15 @@ #include "dialogs/dependanciesdialog.h" #include "datablocks/unit.h" -class UnitListViewItem : public QListViewItem +class UnitListViewItem : public TQListViewItem { public: - UnitListViewItem( QListView* qlv, const Unit &u ) : QListViewItem( qlv ), m_unit(u) + UnitListViewItem( TQListView* qlv, const Unit &u ) : TQListViewItem( qlv ), m_unit(u) { updateType(m_unit.type); } - virtual QString text( int column ) const + virtual TQString text( int column ) const { switch ( column ) { case 0: return m_unit.name; @@ -46,8 +46,8 @@ public: case 2: return m_unit.plural; case 3: return m_unit.plural_abbrev; case 4: return m_type; - case 5: return QString::number(m_unit.id); - default: return QString::null; + case 5: return TQString::number(m_unit.id); + default: return TQString::null; } } @@ -57,7 +57,7 @@ public: void setUnit( const Unit &u ) { m_unit = u; } protected: - virtual void setText( int column, const QString &text ) { + virtual void setText( int column, const TQString &text ) { switch ( column ) { case 0: m_unit.name = text; break; case 1: m_unit.name_abbrev = text; break; @@ -77,13 +77,13 @@ private: } Unit m_unit; - QString m_type; + TQString m_type; }; -UnitListView::UnitListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->unitCount() ) +UnitListView::UnitListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent,db,db->unitCount() ) { setAllColumnsShowFocus( true ); - setDefaultRenameAction( QListView::Reject ); + setDefaultRenameAction( TQListView::Reject ); } void UnitListView::init() @@ -111,7 +111,7 @@ void UnitListView::checkCreateUnit( const Unit &el ) } -StdUnitListView::StdUnitListView( QWidget *parent, RecipeDB *db, bool editable ) : UnitListView( parent, db ) +StdUnitListView::StdUnitListView( TQWidget *parent, RecipeDB *db, bool editable ) : UnitListView( parent, db ) { addColumn( i18n( "Unit" ) ); addColumn( i18n( "Abbreviation" ) ); @@ -140,7 +140,7 @@ StdUnitListView::StdUnitListView( QWidget *parent, RecipeDB *db, bool editable ) kpop->insertItem( il.loadIcon( "edit", KIcon::NoGroup, 16 ), i18n( "&Rename" ), this, SLOT( rename() ), CTRL + Key_R ); kpop->polish(); - typeComboBox = new QComboBox( false, viewport() ); + typeComboBox = new TQComboBox( false, viewport() ); typeComboBox->insertItem(i18n("Other")); typeComboBox->insertItem(i18n("Mass")); typeComboBox->insertItem(i18n("Volume")); @@ -150,15 +150,15 @@ StdUnitListView::StdUnitListView( QWidget *parent, RecipeDB *db, bool editable ) connect( typeComboBox, SIGNAL( activated(int) ), SLOT( updateType(int) ) ); connect( this, SIGNAL( selectionChanged() ), SLOT( hideTypeCombo() ) ); - connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) ); - connect( this, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), this, SLOT( modUnit( QListViewItem*, const QPoint &, int ) ) ); - connect( this, SIGNAL( itemRenamed( QListViewItem*, const QString &, int ) ), this, SLOT( saveUnit( QListViewItem*, const QString &, int ) ) ); + connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) ); + connect( this, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), this, SLOT( modUnit( TQListViewItem*, const TQPoint &, int ) ) ); + connect( this, SIGNAL( itemRenamed( TQListViewItem*, const TQString &, int ) ), this, SLOT( saveUnit( TQListViewItem*, const TQString &, int ) ) ); } } -void StdUnitListView::insertTypeComboBox( QListViewItem* it ) +void StdUnitListView::insertTypeComboBox( TQListViewItem* it ) { - QRect r; + TQRect r; // Constraints Box1 r = header() ->sectionRect( 4 ); //start at the section 2 header @@ -187,7 +187,7 @@ void StdUnitListView::hideTypeCombo() typeComboBox->hide(); } -void StdUnitListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p ) +void StdUnitListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p ) { if ( i ) kpop->exec( p ); @@ -197,7 +197,7 @@ void StdUnitListView::createNew() { CreateUnitDialog * unitDialog = new CreateUnitDialog( this ); - if ( unitDialog->exec() == QDialog::Accepted ) { + if ( unitDialog->exec() == TQDialog::Accepted ) { Unit result = unitDialog->newUnit(); //check bounds first @@ -222,7 +222,7 @@ void StdUnitListView::remove() ElementList recipeDependancies, propertyDependancies, weightDependancies; database->findUnitDependancies( unitID, &propertyDependancies, &recipeDependancies, &weightDependancies ); - QValueList lists; + TQValueList lists; if ( !recipeDependancies.isEmpty() ) { ListInfo info; info.list = recipeDependancies; @@ -248,7 +248,7 @@ void StdUnitListView::remove() DependanciesDialog warnDialog( this, lists ); if ( !recipeDependancies.isEmpty() ) warnDialog.setCustomWarning( i18n("You are about to permanantly delete recipes from your database.") ); - if ( warnDialog.exec() == QDialog::Accepted ) + if ( warnDialog.exec() == TQDialog::Accepted ) database->removeUnit( unitID ); } } @@ -256,12 +256,12 @@ void StdUnitListView::remove() void StdUnitListView::rename() { - QListViewItem * item = currentItem(); + TQListViewItem * item = currentItem(); if ( item ) { CreateUnitDialog unitDialog( this, item->text(0), item->text(2), item->text(1), item->text(3), false ); - if ( unitDialog.exec() == QDialog::Accepted ) { + if ( unitDialog.exec() == TQDialog::Accepted ) { UnitListViewItem *unit_item = (UnitListViewItem*)item; Unit origUnit = unit_item->unit(); Unit newUnit = unitDialog.newUnit(); @@ -276,21 +276,21 @@ void StdUnitListView::rename() saveUnit( unit_item, newUnit.name, 0 ); //saveUnit will call database->modUnit which deletes the list item we were using - unit_item = (UnitListViewItem*) findItem( QString::number(unit.id), 5 ); + unit_item = (UnitListViewItem*) findItem( TQString::number(unit.id), 5 ); } if ( newUnit.plural != origUnit.plural ) { unit.plural = newUnit.plural; unit_item->setUnit( unit ); saveUnit( unit_item, newUnit.plural, 2 ); - unit_item = (UnitListViewItem*) findItem( QString::number(unit.id), 5 ); + unit_item = (UnitListViewItem*) findItem( TQString::number(unit.id), 5 ); } if ( !newUnit.name_abbrev.stripWhiteSpace().isEmpty() && newUnit.name_abbrev != origUnit.name_abbrev ) { unit.name_abbrev = newUnit.name_abbrev; unit_item->setUnit( unit ); saveUnit( unit_item, newUnit.name_abbrev, 1 ); - unit_item = (UnitListViewItem*) findItem( QString::number(unit.id), 5 ); + unit_item = (UnitListViewItem*) findItem( TQString::number(unit.id), 5 ); } if ( !newUnit.plural_abbrev.stripWhiteSpace().isEmpty() && newUnit.plural_abbrev != origUnit.plural_abbrev ) { unit.plural_abbrev = newUnit.plural_abbrev; @@ -308,11 +308,11 @@ void StdUnitListView::createUnit( const Unit &unit ) void StdUnitListView::removeUnit( int id ) { - QListViewItem * item = findItem( QString::number( id ), 5 ); + TQListViewItem * item = findItem( TQString::number( id ), 5 ); removeElement(item); } -void StdUnitListView::modUnit( QListViewItem* i, const QPoint & /*p*/, int c ) +void StdUnitListView::modUnit( TQListViewItem* i, const TQPoint & /*p*/, int c ) { if ( i ) { if ( c != 4 ) @@ -323,7 +323,7 @@ void StdUnitListView::modUnit( QListViewItem* i, const QPoint & /*p*/, int c ) } } -void StdUnitListView::saveUnit( QListViewItem* i, const QString &text, int c ) +void StdUnitListView::saveUnit( TQListViewItem* i, const TQString &text, int c ) { //skip abbreviations if ( c == 0 || c == 2 ) { @@ -357,7 +357,7 @@ void StdUnitListView::saveUnit( QListViewItem* i, const QString &text, int c ) bool StdUnitListView::checkBounds( const Unit &unit ) { if ( unit.name.length() > uint(database->maxUnitNameLength()) || unit.plural.length() > uint(database->maxUnitNameLength()) ) { - KMessageBox::error( this, QString( i18n( "Unit name cannot be longer than %1 characters." ) ).arg( database->maxUnitNameLength() ) ); + KMessageBox::error( this, TQString( i18n( "Unit name cannot be longer than %1 characters." ) ).arg( database->maxUnitNameLength() ) ); return false; } else if ( unit.name.stripWhiteSpace().isEmpty() || unit.plural.stripWhiteSpace().isEmpty() ) diff --git a/krecipes/src/widgets/unitlistview.h b/krecipes/src/widgets/unitlistview.h index 6833f5d..011e0ac 100644 --- a/krecipes/src/widgets/unitlistview.h +++ b/krecipes/src/widgets/unitlistview.h @@ -17,7 +17,7 @@ #include "datablocks/unit.h" -class QComboBox; +class TQComboBox; class RecipeDB; class KPopupMenu; @@ -27,7 +27,7 @@ class UnitListView : public DBListViewBase Q_OBJECT public: - UnitListView( QWidget *parent, RecipeDB *db ); + UnitListView( TQWidget *parent, RecipeDB *db ); public slots: virtual void load( int curr_limit, int curr_offset ); @@ -47,14 +47,14 @@ class StdUnitListView : public UnitListView Q_OBJECT public: - StdUnitListView( QWidget *parent, RecipeDB *db, bool editable = false ); + StdUnitListView( TQWidget *parent, RecipeDB *db, bool editable = false ); protected: virtual void createUnit( const Unit & ); virtual void removeUnit( int ); private slots: - void showPopup( KListView *, QListViewItem *, const QPoint & ); + void showPopup( KListView *, TQListViewItem *, const TQPoint & ); void hideTypeCombo(); void updateType( int type ); @@ -62,15 +62,15 @@ private slots: void remove(); void rename(); - void modUnit( QListViewItem* i, const QPoint &p, int c ); - void saveUnit( QListViewItem* i, const QString &text, int c ); + void modUnit( TQListViewItem* i, const TQPoint &p, int c ); + void saveUnit( TQListViewItem* i, const TQString &text, int c ); private: bool checkBounds( const Unit &unit ); - void insertTypeComboBox( QListViewItem* ); + void insertTypeComboBox( TQListViewItem* ); KPopupMenu *kpop; - QComboBox *typeComboBox; + TQComboBox *typeComboBox; }; #endif //UNITLISTVIEW_H diff --git a/krecipes/src/widgets/weightinput.cpp b/krecipes/src/widgets/weightinput.cpp index 2bf2d2c..f188866 100644 --- a/krecipes/src/widgets/weightinput.cpp +++ b/krecipes/src/widgets/weightinput.cpp @@ -17,7 +17,7 @@ #include "datablocks/weight.h" #include "prepmethodcombobox.h" -WeightInput::WeightInput( QWidget *parent, RecipeDB *database, Unit::Type type, MixedNumber::Format format ) : +WeightInput::WeightInput( TQWidget *parent, RecipeDB *database, Unit::Type type, MixedNumber::Format format ) : AmountUnitInput(parent,database,type,format), m_database(database) { diff --git a/krecipes/src/widgets/weightinput.h b/krecipes/src/widgets/weightinput.h index 088bf26..dda7d7a 100644 --- a/krecipes/src/widgets/weightinput.h +++ b/krecipes/src/widgets/weightinput.h @@ -23,7 +23,7 @@ class WeightInput : public AmountUnitInput Q_OBJECT public: - WeightInput( QWidget *parent, RecipeDB *database, Unit::Type type = Unit::All, MixedNumber::Format f = MixedNumber::MixedNumberFormat ); + WeightInput( TQWidget *parent, RecipeDB *database, Unit::Type type = Unit::All, MixedNumber::Format f = MixedNumber::MixedNumberFormat ); Element prepMethod() const; void setPrepMethod( const Element & ); -- cgit v1.2.1
    "+(*rc_it).name+":