diff options
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 <<EOF #include "confdefs.h" -#include <qglobal.h> -#include <qapplication.h> +#include <ntqglobal.h> +#include <ntqapplication.h> EOF if test "$kde_qtver" = "2"; then cat >> conftest.$ac_ext <<EOF -#include <qevent.h> -#include <qstring.h> -#include <qstyle.h> +#include <ntqevent.h> +#include <ntqstring.h> +#include <ntqstyle.h> EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext <<EOF -#if QT_VERSION < 210 +#if TQT_VERSION < 210 #error 1 #endif EOF @@ -1113,8 +1113,8 @@ fi if test "$kde_qtver" = "3"; then cat >> conftest.$ac_ext <<EOF -#include <qcursor.h> -#include <qstylefactory.h> +#include <ntqcursor.h> +#include <ntqstylefactory.h> #include <private/qucomextra_p.h> 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 <qdom.h> + #include <ntqdom.h> ], [ 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 <qapplication.h>], +[#include <ntqapplication.h>], [ int argc; char** argv; @@ -3439,7 +3439,7 @@ AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY], AC_TRY_COMPILE( [ -#include <qglobal.h> +#include <ntqglobal.h> #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 <qimageio.h> -#include <qstring.h> +#include <ntqstring.h> 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 <kconfig.h> #include <kglobal.h> -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<<config->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<<database->databaseName(); return command; } -QStringList MySQLRecipeDB::restoreCommand() const +TQStringList MySQLRecipeDB::restoreCommand() const { KConfig *config = KGlobal::config(); config->setGroup("Server"); - QStringList command; + TQStringList command; command<<config->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."<<endl; } - if ( qRound(version*100) < 84 ) { + if ( tqRound(version*100) < 84 ) { database->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."<<endl; } - 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() ) { @@ -436,24 +436,24 @@ void MySQLRecipeDB::portOldDatabases( float version ) kdDebug()<<"Update to 0.85 failed. Maybe you should try again."<<endl; } - if ( qRound(version*100) < 86 ) { + if ( tqRound(version*100) < 86 ) { database->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."<<endl; } - if ( qRound(version*100) < 87 ) { + if ( tqRound(version*100) < 87 ) { //Load this default data so the user knows what rating criteria is - database->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."<<endl; } - if ( qRound(version*100) < 93 ) { + if ( tqRound(version*100) < 93 ) { database->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."<<endl; } - if ( qRound(version*100) < 94 ) { + if ( tqRound(version*100) < 94 ) { database->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."<<endl; } - 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)'" ); @@ -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 <klocale.h> #include <kconfig.h> -#include <qvariant.h> +#include <ntqvariant.h> //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<<config->readEntry( "PgDumpPath", "pg_dump" )<<"-d"<<database->databaseName() <<"-U"<<config->readEntry( "Username" ); int port = config->readNumEntry( "Port", 0 ); if ( port > 0 ) - command<<"-p"<<QString::number(port); + command<<"-p"<<TQString::number(port); return command; } -QStringList PSqlRecipeDB::restoreCommand() const +TQStringList PSqlRecipeDB::restoreCommand() const { KConfig *config = KGlobal::config(); config->setGroup("Server"); - QStringList command; + TQStringList command; command<<config->readEntry( "PsqlPath", "psql" )<<database->databaseName() <<"-U"<<config->readEntry( "Username" ); int port = config->readNumEntry( "Port", 0 ); if ( port > 0 ) - command<<"-p"<<QString::number(port); + command<<"-p"<<TQString::number(port); return command; } -void PSqlRecipeDB::createTable( const QString &tableName ) +void PSqlRecipeDB::createTable( const TQString &tableName ) { - QStringList commands; + TQStringList commands; if ( tableName == "recipes" ) commands << "CREATE TABLE recipes (id SERIAL NOT NULL PRIMARY KEY,title CHARACTER VARYING, yield_amount FLOAT, yield_amount_offset FLOAT, yield_type_id INTEGER DEFAULT '-1', instructions TEXT, photo TEXT, prep_time TIME, ctime TIMESTAMP, mtime TIMESTAMP, atime TIMESTAMP );"; @@ -147,7 +147,7 @@ void PSqlRecipeDB::createTable( const QString &tableName ) else if ( tableName == "db_info" ) { commands << "CREATE TABLE db_info (ver FLOAT NOT NULL,generated_by CHARACTER VARYING 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 << "CREATE TABLE ingredient_groups (id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING);"; @@ -167,36 +167,36 @@ void PSqlRecipeDB::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 PSqlRecipeDB::initializeData() { - QSqlRecipeDB::initializeData(); + TQSqlRecipeDB::initializeData(); - QSqlQuery updateSeq( "SELECT setval('units_id_seq',(SELECT COUNT(1) FROM units))", database ); + TQSqlQuery updateSeq( "SELECT setval('units_id_seq',(SELECT COUNT(1) FROM units))", database ); updateSeq.exec( "SELECT setval('categories_id_seq',(SELECT COUNT(1) FROM categories))" ); } void PSqlRecipeDB::portOldDatabases( float version ) { kdDebug() << "Current database version is..." << version << "\n"; - QString command; + TQString command; - if ( qRound(version*10) < 7 ) { + if ( tqRound(version*10) < 7 ) { //version added } - 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); - 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."<<endl; } - 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 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."<<endl; } - 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 @@ -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."<<endl; } - if ( qRound(version*100) < 87 ) { + if ( tqRound(version*100) < 87 ) { //Load this default data so the user knows what rating criteria is - database->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."<<endl; } - if ( qRound(version*100) < 93 ) { + if ( tqRound(version*100) < 93 ) { database->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."<<endl; } - if ( qRound(version*100) < 94 ) { + if ( tqRound(version*100) < 94 ) { database->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."<<endl; } - 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 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: "<<command<<endl; - QSqlQuery query( command, database ); + TQSqlQuery query( command, database ); command = "SELECT * FROM "+table_name+";"; query.exec( command ); if ( query.isActive() ) { while ( query.next() ) { - QStringList dataList; + TQStringList dataList; for ( int i = 0 ;; ++i ) { - QVariant variant = query.value(i); - if ( variant.type() == QVariant::Invalid ) break; + TQVariant variant = query.value(i); + if ( variant.type() == TQVariant::Invalid ) break; dataList << "'"+variant.toString()+"'"; } command = "INSERT INTO "+table_name+"_copy VALUES("+dataList.join(",")+");"; kdDebug()<<"calling: "<<command<<endl; - QSqlQuery insert_query( command, database ); + TQSqlQuery insert_query( command, database ); emit progress(); } } query.exec( "DROP TABLE "+table_name+";" ); - query.exec( QString(new_table_sql).arg(table_name).arg(new_col_info+",") ); + query.exec( TQString(new_table_sql).arg(table_name).arg(new_col_info+",") ); query.exec( "SELECT * FROM "+table_name+"_copy;" ); if ( query.isActive() ) { while ( query.next() ) { - QStringList dataList; + TQStringList dataList; for ( int i = 0 ;; ++i ) { if ( i == col_index ) dataList << default_value; - QVariant variant = query.value(i); - if ( variant.type() == QVariant::Invalid ) break; + TQVariant variant = query.value(i); + if ( variant.type() == TQVariant::Invalid ) break; dataList << "'"+variant.toString()+"'"; } command = "INSERT INTO "+table_name+" VALUES(" +dataList.join(",")+");"; - QSqlQuery insert_query( command, database ); + TQSqlQuery insert_query( command, database ); kdDebug()<<"calling: "<<command<<endl; emit progress(); @@ -507,10 +507,10 @@ int PSqlRecipeDB::lastInsertID() return last_insert_id; } -int PSqlRecipeDB::getNextInsertID( const QString &table, const QString &column ) +int PSqlRecipeDB::getNextInsertID( const TQString &table, const TQString &column ) { - QString command = QString( "SELECT nextval('%1_%2_seq');" ).arg( table ).arg( column ); - QSqlQuery getID( command, database ); + TQString command = TQString( "SELECT nextval('%1_%2_seq');" ).arg( table ).arg( column ); + TQSqlQuery getID( command, database ); if ( getID.isActive() && getID.first() ) { last_insert_id = getID.value( 0 ).toInt(); @@ -521,38 +521,38 @@ int PSqlRecipeDB::getNextInsertID( const QString &table, const QString &column ) return last_insert_id; } -void PSqlRecipeDB::givePermissions( const QString & /*dbName*/, const QString &username, const QString &password, const QString & /*clientHost*/ ) +void PSqlRecipeDB::givePermissions( const TQString & /*dbName*/, const TQString &username, const TQString &password, const TQString & /*clientHost*/ ) { - 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" << "db_info" << "ingredient_groups" << "ingredient_weights" << "prep_method_list" << "yield_types" << "ratings" << "rating_criteria" << "rating_criterion_list"; //we also have to grant permissions on the sequences created tables << "authors_id_seq" << "categories_id_seq" << "ingredient_properties_id_seq" << "ingredient_weights_id_seq" << "ingredients_id_seq" << "prep_methods_id_seq" << "recipes_id_seq" << "units_id_seq" << "ingredient_groups_id_seq" << "yield_types_id_seq" << "ingredient_list_id_seq" << "ratings_id_seq" << "rating_criteria_id_seq"; - QString command; + TQString command; kdDebug() << "I'm doing the query to create the new user" << endl; command = "CREATE USER " + username; if ( !password.isEmpty() ) command.append( "WITH PASSWORD '" + password + "'" ); command.append( ";" ); - QSqlQuery permissionsToSet( command, database ); + TQSqlQuery permissionsToSet( command, database ); kdDebug() << "I'm doing the query to setup permissions\n"; - command = QString( "GRANT ALL ON %1 TO %2;" ).arg( tables.join( "," ) ).arg( username ); + command = TQString( "GRANT ALL ON %1 TO %2;" ).arg( tables.join( "," ) ).arg( username ); permissionsToSet.exec( command ); } void PSqlRecipeDB::empty( void ) { - QSqlRecipeDB::empty(); + TQSqlRecipeDB::empty(); - QStringList tables; + TQStringList tables; tables << "authors_id_seq" << "categories_id_seq" << "ingredient_properties_id_seq" << "ingredient_weights_id_seq" << "ingredients_id_seq" << "prep_methods_id_seq" << "recipes_id_seq" << "units_id_seq" << "ingredient_groups_id_seq" << "yield_types_id_seq" << "ingredient_list_id_seq" << "prep_method_list_id_seq" << "ratings_id_seq" << "rating_criteria_id_seq"; - 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 ); } } diff --git a/krecipes/src/backends/PostgreSQL/psqlrecipedb.h b/krecipes/src/backends/PostgreSQL/psqlrecipedb.h index 9727909..3593a34 100644 --- a/krecipes/src/backends/PostgreSQL/psqlrecipedb.h +++ b/krecipes/src/backends/PostgreSQL/psqlrecipedb.h @@ -14,14 +14,14 @@ #ifndef PSQLRECIPEDB_H #define PSQLRECIPEDB_H -#define PSQL_DRIVER "QPSQL7" +#define PSQL_DRIVER "TQPSQL7" #include "qsqlrecipedb.h" /** @author Jason Kivlighn */ -class PSqlRecipeDB : public QSqlRecipeDB +class PSqlRecipeDB : public TQSqlRecipeDB { Q_OBJECT @@ -30,30 +30,30 @@ private: void createDB( void ); public: - PSqlRecipeDB( const QString& host, const QString& user = QString::null, const QString& pass = QString::null, const QString& DBName = DEFAULT_DB_NAME, int port = 0 ); + PSqlRecipeDB( const TQString& host, const TQString& user = TQString::null, const TQString& pass = TQString::null, const TQString& DBName = DEFAULT_DB_NAME, int port = 0 ); ~PSqlRecipeDB( void ); int lastInsertID(); void initializeData(); - void createTable( const QString &tableName ); - void givePermissions( const QString &dbName, const QString &username, const QString &password, const QString &clientHost ); + void createTable( const TQString &tableName ); + void givePermissions( const TQString &dbName, const TQString &username, const TQString &password, const TQString &clientHost ); protected: - virtual QString qsqlDriverPlugin() const + virtual TQString qsqlDriverPlugin() const { return PSQL_DRIVER; } - virtual int getNextInsertID( const QString &table, const QString &column ); + virtual int getNextInsertID( const TQString &table, const TQString &column ); virtual void empty( void ); private: void portOldDatabases( float version ); - QStringList backupCommand() const; - QStringList restoreCommand() const; + TQStringList backupCommand() const; + 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 ); int last_insert_id; }; diff --git a/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.cpp b/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.cpp index e6175d3..777dedb 100644 --- a/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.cpp +++ b/krecipes/src/backends/SQLite/libqsqlite/krecqsqlitedb.cpp @@ -22,7 +22,7 @@ #include "krecqsqlitedb.h" #include "krecqsqliteresult.h" -#include <qvaluelist.h> +#include <ntqvaluelist.h> #include <kdebug.h> @@ -37,10 +37,10 @@ #endif #include <stdlib.h> -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<QString, QCString> tableString; - QMap<int, QCString> tableInt; + TQMap<TQString, TQCString> tableString; + TQMap<int, TQCString> 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 <qvaluelist.h> -#include <qstringlist.h> -#include <qobject.h> +#include <ntqvaluelist.h> +#include <ntqstringlist.h> +#include <ntqobject.h> #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 <qdatetime.h> -#include <qmap.h> -#include <qvaluelist.h> +#include <ntqdatetime.h> +#include <ntqmap.h> +#include <ntqvaluelist.h> /** * 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<QString, QCString> TableString; + typedef TQMap<TQString, TQCString> TableString; /** * TableInt is used to establish a relation between a * position of a column and the row value */ - typedef QMap<int, QCString> TableInt; + typedef TQMap<int, TQCString> 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<QSQLiteResultRow> Columns; + typedef TQValueList<TQSQLiteResultRow> 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 <qbuffer.h> +#include <ntqbuffer.h> #include <kdebug.h> #include <kconfig.h> @@ -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<<binary<<database->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<<binary<<database->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."<<endl; } - if ( qRound(version*100) < 87 ) { + if ( tqRound(version*100) < 87 ) { //Load this default data so the user knows what rating criteria is - database->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."<<endl; } - if ( qRound(version*100) < 93 ) { + if ( tqRound(version*100) < 93 ) { database->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: "<<command<<endl; database->exec( command ); command = "SELECT * FROM "+table_name; kdDebug()<<"calling: "<<command<<endl; - QSqlQuery copyQuery = database->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 <qstring.h> +#include <ntqstring.h> #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 <qdatetime.h> -#include <qregexp.h> -#include <qfile.h> +#include <ntqdatetime.h> +#include <ntqregexp.h> +#include <ntqfile.h> -#include <qptrvector.h> +#include <ntqptrvector.h> #include <unistd.h> #include <kdebug.h> @@ -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 <sqlite.h> #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"<<endl; - return QSqlRecord(); + return TQSqlRecord(); } int KreSQLiteResult::size() @@ -160,7 +160,7 @@ int KreSQLiteResult::numRowsAffected() /* Execute \a query. */ -bool KreSQLiteResult::reset(const QString& query) +bool KreSQLiteResult::reset(const TQString& query) { // this is where we build a query. if (!driver()) @@ -178,7 +178,7 @@ bool KreSQLiteResult::reset(const QString& query) int res = result.getStatus(); if (res != SQLITE_OK ) { - setLastError(QSqlError("Unable to execute statement", result.getError(), QSqlError::Statement, res)); + setLastError(TQSqlError("Unable to execute statement", result.getError(), TQSqlError::Statement, res)); } setActive(true); @@ -187,13 +187,13 @@ bool KreSQLiteResult::reset(const QString& query) ///////////////////////////////////////////////////////// -KreSQLiteDriver::KreSQLiteDriver(QObject * parent, const char * name) - : QSqlDriver(parent, name ? name : QSQLITE_DRIVER_NAME) +KreSQLiteDriver::KreSQLiteDriver(TQObject * parent, const char * name) + : TQSqlDriver(parent, name ? name : TQSQLITE_DRIVER_NAME) { } -KreSQLiteDriver::KreSQLiteDriver(QSQLiteDB *connection, QObject *parent, const char *name) - : QSqlDriver(parent, name ? name : QSQLITE_DRIVER_NAME) +KreSQLiteDriver::KreSQLiteDriver(TQSQLiteDB *connection, TQObject *parent, const char *name) + : TQSqlDriver(parent, name ? name : TQSQLITE_DRIVER_NAME) { db = connection; setOpen(true); @@ -221,7 +221,7 @@ bool KreSQLiteDriver::hasFeature(DriverFeature f) const SQLite dbs have no user name, passwords, hosts or ports. just file names. */ -bool KreSQLiteDriver::open(const QString & file, const QString &, const QString &, const QString &, int) +bool KreSQLiteDriver::open(const TQString & file, const TQString &, const TQString &, const TQString &, int) { if (isOpen()) close(); @@ -229,9 +229,9 @@ bool KreSQLiteDriver::open(const QString & file, const QString &, const QString if (file.isEmpty()) return false; - db = new QSQLiteDB; - if ( !db->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: "<<r<<endl; break; } default: - r = QSqlDriver::formatValue( field, trimStrings ); + r = TQSqlDriver::formatValue( field, trimStrings ); } } return r; diff --git a/krecipes/src/backends/SQLite/qsql_sqlite.h b/krecipes/src/backends/SQLite/qsql_sqlite.h index 8d19ff2..d173f32 100644 --- a/krecipes/src/backends/SQLite/qsql_sqlite.h +++ b/krecipes/src/backends/SQLite/qsql_sqlite.h @@ -8,46 +8,46 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef QSQL_SQLITE_H -#define QSQL_SQLITE_H +#ifndef TQSQL_SQLITE_H +#define TQSQL_SQLITE_H -#include <qsqldriver.h> -#include <qsqlresult.h> -#include <qsqlrecord.h> -#include <qsqlindex.h> +#include <ntqsqldriver.h> +#include <ntqsqlresult.h> +#include <ntqsqlrecord.h> +#include <ntqsqlindex.h> -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 <qapplication.h> +#include <ntqapplication.h> #include <kprogress.h> #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 <qobject.h> -#include <qwidget.h> +#include <ntqobject.h> +#include <ntqwidget.h> 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 <qbuffer.h> -#include <qtextcodec.h> -#include <qvariant.h> +#include <ntqbuffer.h> +#include <ntqtextcodec.h> +#include <ntqvariant.h> #include <kapplication.h> #include <kdebug.h> @@ -33,10 +33,10 @@ #include <kmessagebox.h> #include <kmdcodec.h> -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!"<<endl; @@ -111,21 +111,21 @@ void QSqlRecipeDB::connect( bool create_db, bool create_tables ) } else { // 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() ); } //Now Reopen the Database and signal & exit if it fails if ( !database->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<int> ids ) +void TQSqlRecipeDB::loadRecipes( RecipeList *rlist, int items, TQValueList<int> ids ) { // Empty the recipe first rlist->empty(); - QMap <int, RecipeList::Iterator> recipeIterators; // Stores the iterator of each recipe in the list; + TQMap <int, RecipeList::Iterator> 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<int>::const_iterator it = ids.begin(); it != ids.end(); ++it ) { - QString number_str = QString::number(*it); + TQStringList ids_str; + for ( TQValueList<int>::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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::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<RatingCriteria>::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<RatingCriteria>::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( "<!doc>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.<br><br><b>Warning: After updating, this database will no longer be compatible with previous versions of Krecipes.<br><br>Cancelling this operation may result in corrupting the database.</b>" ) ) ) { 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"<<endl; + //TQTime dbg_timer; dbg_timer.start(); kdDebug()<<" calling TQSqlRecipeDB::loadCategories"<<endl; loadCategories( list_child, -1, -1, id ); //limit and offset won't be used // kdDebug()<<" done in "<<dbg_timer.elapsed()<<" ms"<<endl; } @@ -2074,48 +2074,48 @@ void QSqlRecipeDB::loadCategories( CategoryTree *list, int limit, int offset, in emit progressDone(); } -void QSqlRecipeDB::createNewCategory( const QString &categoryName, int parent_id ) +void TQSqlRecipeDB::createNewCategory( const TQString &categoryName, int parent_id ) { - QString command; - QString real_name = categoryName.left( maxCategoryNameLength() ); + TQString command; + TQString real_name = categoryName.left( maxCategoryNameLength() ); - command = QString( "INSERT INTO categories VALUES(%3,'%1',%2);" ) + command = TQString( "INSERT INTO categories VALUES(%3,'%1',%2);" ) .arg( escapeAndEncode( real_name ) ) .arg( parent_id ) .arg( getNextInsertIDStr( "categories", "id" ) ); - QSqlQuery categoryToCreate( command, database ); + TQSqlQuery categoryToCreate( command, database ); emit categoryCreated( Element( real_name, lastInsertID() ), parent_id ); } -void QSqlRecipeDB::modCategory( int categoryID, const QString &newLabel ) +void TQSqlRecipeDB::modCategory( int categoryID, const TQString &newLabel ) { - QString command = QString( "UPDATE categories SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( categoryID ); - QSqlQuery categoryToUpdate( command, database ); + TQString command = TQString( "UPDATE categories SET name='%1' WHERE id=%2;" ).arg( escapeAndEncode( newLabel ) ).arg( categoryID ); + TQSqlQuery categoryToUpdate( command, database ); emit categoryModified( Element( newLabel, categoryID ) ); } -void QSqlRecipeDB::modCategory( int categoryID, int new_parent_id ) +void TQSqlRecipeDB::modCategory( int categoryID, int new_parent_id ) { - QString command = QString( "UPDATE categories SET parent_id=%1 WHERE id=%2;" ).arg( new_parent_id ).arg( categoryID ); - QSqlQuery categoryToUpdate( command, database ); + TQString command = TQString( "UPDATE categories SET parent_id=%1 WHERE id=%2;" ).arg( new_parent_id ).arg( categoryID ); + TQSqlQuery categoryToUpdate( command, database ); emit categoryModified( categoryID, new_parent_id ); } -void QSqlRecipeDB::removeCategory( int categoryID ) +void TQSqlRecipeDB::removeCategory( int categoryID ) { - QString command; + TQString command; - command = QString( "DELETE FROM categories WHERE id=%1;" ).arg( categoryID ); - QSqlQuery categoryToRemove( command, database ); + command = TQString( "DELETE FROM categories WHERE id=%1;" ).arg( categoryID ); + TQSqlQuery categoryToRemove( command, database ); - command = QString( "DELETE FROM category_list WHERE category_id=%1;" ).arg( categoryID ); + command = TQString( "DELETE FROM category_list WHERE category_id=%1;" ).arg( categoryID ); categoryToRemove.exec( command ); //recursively delete subcategories - command = QString( "SELECT id FROM categories WHERE parent_id=%1;" ).arg( categoryID ); + command = TQString( "SELECT id FROM categories WHERE parent_id=%1;" ).arg( categoryID ); categoryToRemove.exec( command ); if ( categoryToRemove.isActive() ) { while ( categoryToRemove.next() ) { @@ -2127,12 +2127,12 @@ void QSqlRecipeDB::removeCategory( int categoryID ) } -void QSqlRecipeDB::loadAuthors( ElementList *list, int limit, int offset ) +void TQSqlRecipeDB::loadAuthors( ElementList *list, int limit, int offset ) { list->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<int> ids; - QSqlQuery recipeToLoad( query, database ); + TQValueList<int> 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 <qglobal.h> -#include <qobject.h> -#include <qsqldatabase.h> -#include <qimage.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qstring.h> +#include <ntqglobal.h> +#include <ntqobject.h> +#include <ntqsqldatabase.h> +#include <ntqimage.h> +#include <ntqfileinfo.h> +#include <ntqregexp.h> +#include <ntqstring.h> #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<int> ids = QValueList<int>() ); + void loadRecipes( RecipeList *, int items = All, TQValueList<int> ids = TQValueList<int>() ); 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 <kfilterdev.h> #include <kmessagebox.h> -#include <qfile.h> -#include <qstringlist.h> -#include <qtextstream.h> +#include <ntqfile.h> +#include <ntqstringlist.h> +#include <ntqtextstream.h> #include <map> @@ -65,14 +65,14 @@ struct ingredient_nutrient_data { int usda_id; - QString name; - QValueList<double> data; + TQString name; + TQValueList<double> 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'"<<endl; return InvalidTypes; } - QString from_str; + TQString from_str; switch ( from.units.type ) { case Unit::Other: from_str = "Other"; break; case Unit::Mass: from_str = "Mass"; break; @@ -264,22 +264,22 @@ RecipeDB::ConversionStatus RecipeDB::convertIngredientUnits( const Ingredient &f } } -bool RecipeDB::backup( const QString &backup_file, QString *errMsg ) +bool RecipeDB::backup( const TQString &backup_file, TQString *errMsg ) { kdDebug()<<"Backing up current database to "<<backup_file<<endl; KProcess *p = new KProcess; //p->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<<endl; return false; } - dumpStream = new QTextStream( dumpFile ); + dumpStream = new TQTextStream( dumpFile ); - QStringList command = backupCommand(); + TQStringList command = backupCommand(); if ( command.count() == 0 ) { kdDebug()<<"Backup not available for this database backend"<<endl; return false; @@ -295,21 +295,21 @@ bool RecipeDB::backup( const QString &backup_file, QString *errMsg ) kdDebug()<<"Running '"<<command.first()<<"' to create backup file"<<endl; *p << command /*<< ">" << 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("<center><b>%1</b></center>%2") + emit progressBegin(0,TQString::null, + TQString("<center><b>%1</b></center>%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."<<endl; - QFile::remove(backup_file); + TQFile::remove(backup_file); } if ( p->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."<<endl; - if ( errMsg ) *errMsg = QString("%1\n%2").arg(i18n("Backup failed.")).arg(appOutput); - QFile::remove(backup_file); + if ( errMsg ) *errMsg = TQString("%1\n%2").arg(i18n("Backup failed.")).arg(appOutput); + TQFile::remove(backup_file); delete p; delete dumpStream; delete dumpFile; @@ -369,24 +369,24 @@ void RecipeDB::initializeData( void ) // Populate with data // Read the commands form the data file - QFile datafile( KGlobal::dirs() ->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: "<<command[0]<<endl; *process << command; //process->setComm( KProcess::Stdin ); if ( process->start( KProcess::NotifyOnExit ) ) { - emit progressBegin(0,QString::null, - QString("<center><b>%1</b></center>%2") + emit progressBegin(0,TQString::null, + TQString("<center><b>%1</b></center>%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<int> ids; ids << id; + TQValueList<int> 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 [email protected]." << 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: "<<wholeQuery<<endl; return wholeQuery+";"; } //These are helper functions solely for use by the USDA data importer -void getIngredientNameAndID( std::multimap<int, QString> * ); -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, TQString> * ); +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<int, QString> *ings_and_ids = new std::multimap<int, QString>; + std::multimap<int, TQString> *ings_and_ids = new std::multimap<int, TQString>; getIngredientNameAndID( ings_and_ids ); - QTextStream stream( &file ); - QValueList<ingredient_nutrient_data> *data = new QValueList<ingredient_nutrient_data>; + TQTextStream stream( &file ); + TQValueList<ingredient_nutrient_data> *data = new TQValueList<ingredient_nutrient_data>; 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<int, QString>::iterator current_pair; + std::multimap<int, TQString>::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<ingredient_nutrient_data>::const_iterator it; - QValueList<ingredient_nutrient_data>::const_iterator data_end = data->end(); + TQValueList<ingredient_nutrient_data>::const_iterator it; + TQValueList<ingredient_nutrient_data>::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<double>::const_iterator property_it; - QValueList<double>::const_iterator property_end = ( *it ).data.end(); + TQValueList<double>::const_iterator property_it; + TQValueList<double>::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<int, QString> *data ) +void getIngredientNameAndID( std::multimap<int, TQString> *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 <qobject.h> -#include <qstring.h> -#include <qvaluelist.h> +#include <ntqobject.h> +#include <ntqstring.h> +#include <ntqvaluelist.h> #include <dcopclient.h> @@ -36,7 +36,7 @@ */ class KProcess; -class QTextStream; +class TQTextStream; class CategoryTree; class RecipeSearchParameters; @@ -45,12 +45,12 @@ class WeightList; typedef struct { - QValueList <int> recipeIdList; + TQValueList <int> 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<int> ids = QValueList<int>()/*, KProgressDialog *progress_dlg = 0*/ ) = 0; + virtual void loadRecipes( RecipeList *, int items = All, TQValueList<int> ids = TQValueList<int>()/*, 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 <qstring.h> -#include <qstringlist.h> -#include <qdatetime.h> +#include <ntqstring.h> +#include <ntqstringlist.h> +#include <ntqdatetime.h> 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 <klocale.h> -#include <qstring.h> +#include <ntqstring.h> 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 <qapplication.h> -#include <qfile.h> +#include <ntqapplication.h> +#include <ntqfile.h> #include <kdebug.h> #include <kglobal.h> @@ -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!"<<endl; - QFile::remove(file+".new"); + TQFile::remove(file+".new"); } } } @@ -79,7 +79,7 @@ ConvertSQLite3::~ConvertSQLite3() void ConvertSQLite3::processOutput( KProcIO* p ) { - QString error_str, buffer; + TQString error_str, buffer; while ( p->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 <qobject.h> +#include <ntqobject.h> 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 <qstring.h> +#include <ntqstring.h> #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 <qstring.h> +#include <ntqstring.h> /** @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 <Element>() +ElementList::ElementList() : TQValueList <Element>() {} 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 <qvaluelist.h> -#include <qregexp.h> +#include <ntqvaluelist.h> +#include <ntqregexp.h> #include "element.h" /** @author Unai Garro */ -class ElementList: public QValueList<Element> +class ElementList: public TQValueList<Element> { 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<int> IDList; +typedef TQValueList<int> 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 <qstringlist.h> +#include <ntqstringlist.h> #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 <qstring.h> -#include <qvaluelist.h> +#include <ntqstring.h> +#include <ntqvaluelist.h> #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<IngredientData> substitutes; + TQValueList<IngredientData> 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<Ingredient>() +IngredientList::IngredientList() : TQValueList<Ingredient>() {} IngredientList::~IngredientList() @@ -39,7 +39,7 @@ bool IngredientList::contains( const Ingredient &ing, bool compareAmount, Recipe } } if ( !ret ) { - for ( QValueList<IngredientData>::const_iterator it = ing.substitutes.begin(); it != ing.substitutes.end(); ++it ) { + for ( TQValueList<IngredientData>::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<IngredientData>::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::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<IngredientData>::const_iterator sub_it = ( *it ).substitutes.begin(); sub_it != ( *it ).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::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<Ingredient>::find( it, i ); + return TQValueList<Ingredient>::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<Ingredient>::find( it, i ); + return TQValueList<Ingredient>::find( it, i ); } IngredientData& IngredientList::findSubstitute( const Ingredient &i ) // Search by id (which uses search by item, with comparison defined on header) { - QValueList<Ingredient>::iterator result = QValueList<Ingredient>::find(i); + TQValueList<Ingredient>::iterator result = TQValueList<Ingredient>::find(i); if ( result == end() ) { for ( IngredientList::iterator it = begin(); it != end(); ++it ) { - QValueList<IngredientData>::iterator result = (*it).substitutes.find(i); + TQValueList<IngredientData>::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<Ingredient>::iterator result = QValueList<Ingredient>::find(i); + TQValueList<Ingredient>::iterator result = TQValueList<Ingredient>::find(i); if ( result == end() ) { for ( IngredientList::iterator it = begin(); it != end(); ++it ) { - QValueList<IngredientData>::iterator result = (*it).substitutes.find(i); + TQValueList<IngredientData>::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::const_iterator> IngredientList::_groupMembers( int id, IngredientList::const_iterator begin ) const +TQValueList<IngredientList::const_iterator> IngredientList::_groupMembers( int id, IngredientList::const_iterator begin ) const { bool first_found = false; - QValueList<IngredientList::const_iterator> matches; + TQValueList<IngredientList::const_iterator> 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<IngredientList::const_iterator> members = _groupMembers( ( *begin() ).groupID, begin() ); + TQValueList<IngredientList::const_iterator> members = _groupMembers( ( *begin() ).groupID, begin() ); - for ( QValueList<IngredientList::const_iterator>::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { + for ( TQValueList<IngredientList::const_iterator>::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<IngredientList::const_iterator> members = _groupMembers( ( *it ).groupID, it ); + TQValueList<IngredientList::const_iterator> members = _groupMembers( ( *it ).groupID, it ); - for ( QValueList<IngredientList::const_iterator>::const_iterator members_it = members.begin(); members_it != members.end(); ++members_it ) { + for ( TQValueList<IngredientList::const_iterator>::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 <qvaluelist.h> -#include <qregexp.h> +#include <ntqvaluelist.h> +#include <ntqregexp.h> #include "datablocks/ingredient.h" @@ -23,7 +23,7 @@ class RecipeDB; /** @author Unai Garro */ -class IngredientList: public QValueList <Ingredient> +class IngredientList: public TQValueList <Ingredient> { 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<IngredientList::const_iterator> _groupMembers( int id, IngredientList::const_iterator begin ) const; - QValueList<IngredientList::const_iterator> usedGroups; + TQValueList<IngredientList::const_iterator> _groupMembers( int id, IngredientList::const_iterator begin ) const; + TQValueList<IngredientList::const_iterator> 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 <qstring.h> +#include <ntqstring.h> #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<IngredientProperty>::find( ip ); + return TQValueList<IngredientProperty>::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 <qvaluelist.h> +#include <ntqvaluelist.h> #include "datablocks/ingredientproperty.h" -class IngredientPropertyList : public QValueList<IngredientProperty> +class IngredientPropertyList : public TQValueList<IngredientProperty> { 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 <qcolor.h> -#include <qstring.h> +#include <ntqcolor.h> +#include <ntqstring.h> //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 <qregexp.h> +#include <ntqregexp.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> -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 <qstring.h> +#include <ntqstring.h> /** 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 <qpainter.h> -#include <qbitmap.h> +#include <ntqpainter.h> +#include <ntqbitmap.h> #include <kiconloader.h> -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 <qvaluelist.h> -#include <qstring.h> +#include <ntqvaluelist.h> +#include <ntqstring.h> -#include <qpixmap.h> +#include <ntqpixmap.h> 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 <qstring.h> -#include <qpixmap.h> -#include <qdatetime.h> +#include <ntqstring.h> +#include <ntqpixmap.h> +#include <ntqdatetime.h> #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 <Recipe>() +RecipeList::RecipeList() : TQValueList <Recipe>() {} 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 <qvaluelist.h> +#include <ntqvaluelist.h> /** @author Unai Garro */ -class RecipeList: public QValueList <Recipe> +class RecipeList: public TQValueList <Recipe> { 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 <qstring.h> -#include <qvaluelist.h> +#include <ntqstring.h> +#include <ntqvaluelist.h> 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 <qvaluelist.h> +#include <ntqvaluelist.h> #include "unitratio.h" /** @author Unai Garro */ -class UnitRatioList : public QValueList <UnitRatio> +class UnitRatioList : public TQValueList <UnitRatio> { 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 <qstring.h> -#include <qvaluelist.h> +#include <ntqstring.h> +#include <ntqvaluelist.h> #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<Weight> +class WeightList : public TQValueList<Weight> { public: - WeightList() : QValueList<Weight>(){} + WeightList() : TQValueList<Weight>(){} }; #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 <qvariant.h> -#include <qpushbutton.h> -#include <qtabwidget.h> -#include <qwidget.h> -#include <qcheckbox.h> -#include <qframe.h> -#include <qcombobox.h> -#include <qheader.h> -#include <qlistview.h> -#include <qgroupbox.h> -#include <qspinbox.h> -#include <qdatetimeedit.h> +#include <ntqvariant.h> +#include <ntqpushbutton.h> +#include <ntqtabwidget.h> +#include <ntqwidget.h> +#include <ntqcheckbox.h> +#include <ntqframe.h> +#include <ntqcombobox.h> +#include <ntqheader.h> +#include <ntqlistview.h> +#include <ntqgroupbox.h> +#include <ntqspinbox.h> +#include <ntqdatetimeedit.h> #include <kpushbutton.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qscrollview.h> -#include <qhbox.h> -#include <qradiobutton.h> -#include <qbuttongroup.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqlabel.h> +#include <ntqlineedit.h> +#include <ntqscrollview.h> +#include <ntqhbox.h> +#include <ntqradiobutton.h> +#include <ntqbuttongroup.h> #include <kapplication.h> #include <kcursor.h> @@ -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> &, int ) ), SIGNAL( recipesSelected( const QValueList<int> &, int ) ) ); + connect( actionHandler, SIGNAL( recipesSelected( const TQValueList<int> &, int ) ), SIGNAL( recipesSelected( const TQValueList<int> &, 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 <qwidget.h> - -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 <ntqwidget.h> + +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> &, int ); + void recipesSelected( const TQValueList<int> &, 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 <klocale.h> #include <kmessagebox.h> -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 <qwidget.h> -#include <qpushbutton.h> -#include <qhbox.h> -#include <qlayout.h> +#include <ntqwidget.h> +#include <ntqpushbutton.h> +#include <ntqhbox.h> +#include <ntqlayout.h> #include <kiconloader.h> #include <klistview.h> @@ -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 <qpushbutton.h> -#include <qgroupbox.h> -#include <qvbox.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqvbox.h> +#include <ntqlabel.h> +#include <ntqspinbox.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> #include <kdebug.h> #include <khtml_part.h> @@ -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( "<html><body><div style=\"vertical-align: middle; border: %1px %2 %3;\"><center><h1>%4</h1></center></div></body></html>" ).arg( b.width ).arg( b.style ).arg( b.color.name() ).arg( i18n( "Border Preview" ) ); + TQString html_str = TQString( "<html><body><div style=\"vertical-align: middle; border: %1px %2 %3;\"><center><h1>%4</h1></center></div></body></html>" ).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 <kdialogbase.h> #include <kcolordialog.h> -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 <qwidget.h> -#include <qpushbutton.h> -#include <qhbox.h> -#include <qlayout.h> +#include <ntqwidget.h> +#include <ntqpushbutton.h> +#include <ntqhbox.h> +#include <ntqlayout.h> #include <kiconloader.h> #include <klistview.h> @@ -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 <qvariant.h> -#include <qpushbutton.h> +#include <ntqvariant.h> +#include <ntqpushbutton.h> #include <kcombobox.h> -#include <qlabel.h> +#include <ntqlabel.h> #include <klineedit.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qvbox.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqvbox.h> #include <kcombobox.h> #include <klineedit.h> @@ -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( "<b>Result:</b>" ) ); - 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( "<b>Result:</b>" ) ); - 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( "<b>Approximated result:</b>" ) ); - 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( "<b>Error:</b>" ) ); 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 <kdialogbase.h> -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 <qpushbutton.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qvbox.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqlayout.h> +#include <ntqlabel.h> +#include <ntqvbox.h> #include <kcombobox.h> #include <klineedit.h> #include <klocale.h> -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 <qmap.h> +#include <ntqmap.h> #include <kdialogbase.h> #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<QString, int> idMap; + TQMap<TQString, int> 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 <klocale.h> -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 <qpushbutton.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qvbox.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqlayout.h> +#include <ntqvbox.h> #include <klineedit.h> #include <kdialogbase.h> @@ -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 <qgroupbox.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qvbox.h> +#include <ntqgroupbox.h> +#include <ntqlabel.h> +#include <ntqpushbutton.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqvbox.h> #include <kmessagebox.h> #include <klocale.h> @@ -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 <kdialogbase.h> -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 <klocale.h> -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 <qcombobox.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qgroupbox.h> -#include <qvbox.h> -#include <qlabel.h> +#include <ntqcombobox.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqvbox.h> +#include <ntqlabel.h> #include <klineedit.h> #include <kdialogbase.h> @@ -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 <qlabel.h> +#include <ntqlabel.h> #include <klocale.h> #include <klineedit.h> #include <kcombobox.h> -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 <kdialogbase.h> -#include <qpushbutton.h> -#include <qgroupbox.h> -#include <qlayout.h> -#include <qvbox.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqlayout.h> +#include <ntqvbox.h> #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 <qpushbutton.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qwidgetstack.h> -#include <qwidget.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qhbox.h> +#include <ntqpushbutton.h> +#include <ntqbuttongroup.h> +#include <ntqradiobutton.h> +#include <ntqwidgetstack.h> +#include <ntqwidget.h> +#include <ntqlineedit.h> +#include <ntqlabel.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqhbox.h> #include <kconfig.h> #include <kdebug.h> @@ -35,80 +35,80 @@ #include <kurlrequester.h> #include <knuminput.h> -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 <kdialogbase.h> -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 <qvbox.h> +#include <ntqvbox.h> #include <klocale.h> #include <kglobal.h> #include <kconfig.h> #include <kmessagebox.h> -DependanciesDialog::DependanciesDialog( QWidget *parent, const QValueList<ListInfo> &lists, bool deps_are_deleted ) : KDialogBase( parent, "DependanciesDialog", true, QString::null, +DependanciesDialog::DependanciesDialog( TQWidget *parent, const TQValueList<ListInfo> &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<ListInfo> lists; + TQValueList<ListInfo> lists; lists << list; init( lists ); } @@ -41,16 +41,16 @@ DependanciesDialog::DependanciesDialog( QWidget *parent, const ListInfo &list, b DependanciesDialog::~DependanciesDialog() {} -void DependanciesDialog::init( const QValueList<ListInfo> &lists ) +void DependanciesDialog::init( const TQValueList<ListInfo> &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( "<b>WARNING:</b> 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<ListInfo> &lists ) instructionsLabel->setText( i18n( "<b>WARNING:</b> The following currently use the element you have chosen to be removed." ) ); } - for ( QValueList<ListInfo>::const_iterator list_it = lists.begin(); list_it != lists.end(); ++list_it ) { + for ( TQValueList<ListInfo>::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("<b>%1</b><br><br>%2").arg(m_msg).arg(i18n("Are you sure you wish to proceed?")), - QString::null,KStdGuiItem::yes(),KStdGuiItem::no(),"doubleCheckDelete") ) + TQString("<b>%1</b><br><br>%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 <qgroupbox.h> -#include <qlabel.h> +#include <ntqgroupbox.h> +#include <ntqlabel.h> #include <klistview.h> #include <kdialogbase.h> @@ -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<ListInfo> &lists, bool deps_are_deleted = true ); - DependanciesDialog( QWidget *parent, const ListInfo &list, bool deps_are_deleted = true ); + DependanciesDialog( TQWidget *parent, const TQValueList<ListInfo> &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<ListInfo> &lists ); + void init( const TQValueList<ListInfo> &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 <klocale.h> #include <kstandarddirs.h> -DietViewDialog::DietViewDialog( QWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const QValueList <int> &dishNumbers ) - : KDialogBase( parent, "dietViewDialog", true, QString::null, +DietViewDialog::DietViewDialog( TQWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList <int> &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 <int> &dishNumbers ) +void DietViewDialog::showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList <int> &dishNumbers ) { // Header - QString htmlCode = QString( "<html><head><title>%1</title>" ).arg( i18n( "Diet" ) ); + TQString htmlCode = TQString( "<html><head><title>%1</title>" ).arg( i18n( "Diet" ) ); // CSS htmlCode += "<STYLE type=\"text/css\">\n"; @@ -63,59 +63,59 @@ void DietViewDialog::showDiet( const RecipeList &recipeList, int dayNumber, int htmlCode += "</head><body>"; // /Header // Calendar border - htmlCode += QString( "<div id=\"calendar\">" ); + htmlCode += TQString( "<div id=\"calendar\">" ); // Title - htmlCode += QString( "<center><div STYLE=\"width: 100%\">" ); - htmlCode += QString( "<h1>%1</h1></div></center>" ).arg( i18n( "Diet" ) ); + htmlCode += TQString( "<center><div STYLE=\"width: 100%\">" ); + htmlCode += TQString( "<h1>%1</h1></div></center>" ).arg( i18n( "Diet" ) ); // Diet table - htmlCode += QString( "<center><div STYLE=\"width: 98%\">" ); - htmlCode += QString( "<table><tbody>" ); + htmlCode += TQString( "<center><div STYLE=\"width: 98%\">" ); + htmlCode += TQString( "<table><tbody>" ); - QValueList <int>::ConstIterator it; + TQValueList <int>::ConstIterator it; it = dishNumbers.begin(); RecipeList::ConstIterator rit; rit = recipeList.begin(); for ( int row = 0, day = 0; row <= ( ( dayNumber - 1 ) / 7 ); row++ ) // New row (week) { - htmlCode += QString( "<tr>" ); + htmlCode += TQString( "<tr>" ); for ( int col = 0; ( col < 7 ) && ( day < dayNumber ); col++, day++ ) // New column (day) { - htmlCode += QString( "<td><div class=\"day\">" ); - htmlCode += QString( "<div class=\"dayheader\"><center>" ); - htmlCode += QString( i18n( "Day %1" ) ).arg( day + 1 ); - htmlCode += QString( "</center></div>" ); + htmlCode += TQString( "<td><div class=\"day\">" ); + htmlCode += TQString( "<div class=\"dayheader\"><center>" ); + htmlCode += TQString( i18n( "Day %1" ) ).arg( day + 1 ); + htmlCode += TQString( "</center></div>" ); for ( int meal = 0;meal < mealNumber;meal++ ) // Meals in each cell { int dishNumber = *it; - htmlCode += QString( "<div class=\"meal\">" ); + htmlCode += TQString( "<div class=\"meal\">" ); for ( int dish = 0; dish < dishNumber;dish++ ) // Dishes in each Meal { - htmlCode += QString( "<div class=\"dish\">" ); + htmlCode += TQString( "<div class=\"dish\">" ); htmlCode += ( *rit ).title; htmlCode += "<br>"; - htmlCode += QString( "</div>" ); + htmlCode += TQString( "</div>" ); rit++; } it++; - htmlCode += QString( "</div>" ); + htmlCode += TQString( "</div>" ); } it = dishNumbers.begin(); // meals have same dish number everyday - htmlCode += QString( "</div></td>" ); + htmlCode += TQString( "</div></td>" ); } - htmlCode += QString( "</tr>" ); + htmlCode += TQString( "</tr>" ); } - htmlCode += QString( "</tbody></table>" ); - htmlCode += QString( "</div></center>" ); - htmlCode += QString( "</div></body></html>" ); + htmlCode += TQString( "</tbody></table>" ); + htmlCode += TQString( "</div></center>" ); + htmlCode += TQString( "</div></body></html>" ); - resize( QSize( 600, 400 ) ); + resize( TQSize( 600, 400 ) ); // Display it dietView->begin( KURL( locateLocal( "tmp", "/" ) ) ); // Initialize to tmp dir, where photos and logos can be stored diff --git a/krecipes/src/dialogs/dietviewdialog.h b/krecipes/src/dialogs/dietviewdialog.h index a388316..e0f68bd 100644 --- a/krecipes/src/dialogs/dietviewdialog.h +++ b/krecipes/src/dialogs/dietviewdialog.h @@ -11,10 +11,10 @@ #ifndef DIETVIEWDIALOG_H #define DIETVIEWDIALOG_H -#include <qpushbutton.h> -#include <qlayout.h> -#include <qvbox.h> -#include <qwidget.h> +#include <ntqpushbutton.h> +#include <ntqlayout.h> +#include <ntqvbox.h> +#include <ntqwidget.h> #include <khtml_part.h> #include <khtmlview.h> @@ -27,14 +27,14 @@ class DietViewDialog: public KDialogBase Q_OBJECT public: - DietViewDialog( QWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const QValueList <int> &dishNumbers ); + DietViewDialog( TQWidget *parent, const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList <int> &dishNumbers ); ~DietViewDialog(); private: // Widgets KHTMLPart *dietView; // Private methods - void showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const QValueList <int> &dishNumbers ); + void showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const TQValueList <int> &dishNumbers ); private slots: void print( void ); void slotOk( void ); diff --git a/krecipes/src/dialogs/dietwizarddialog.cpp b/krecipes/src/dialogs/dietwizarddialog.cpp index 50a4435..c07f25c 100644 --- a/krecipes/src/dialogs/dietwizarddialog.cpp +++ b/krecipes/src/dialogs/dietwizarddialog.cpp @@ -14,11 +14,11 @@ #include "backends/recipedb.h" #include "dietviewdialog.h" -#include <qbitmap.h> -#include <qheader.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qwmatrix.h> +#include <ntqbitmap.h> +#include <ntqheader.h> +#include <ntqlayout.h> +#include <ntqpainter.h> +#include <ntqwmatrix.h> #include <kapplication.h> #include <kcursor.h> @@ -35,7 +35,7 @@ #include "profiling.h" -DietWizardDialog::DietWizardDialog( QWidget *parent, RecipeDB *db ) : QVBox( parent ) +DietWizardDialog::DietWizardDialog( TQWidget *parent, RecipeDB *db ) : TQVBox( parent ) { // Initialize internal variables database = db; @@ -46,47 +46,47 @@ DietWizardDialog::DietWizardDialog( QWidget *parent, RecipeDB *db ) : QVBox( par //Design the dialog setSpacing( 5 ); // Options Box - optionsBox = new QHBox( this ); + optionsBox = new TQHBox( this ); - daysSliderBox = new QVGroupBox( i18n( "Number of Days" ), optionsBox ); - dayNumberLabel = new QLabel( daysSliderBox ); + daysSliderBox = new TQVGroupBox( i18n( "Number of Days" ), optionsBox ); + dayNumberLabel = new TQLabel( daysSliderBox ); dayNumberLabel->setText( "- 1 -" ); - dayNumberLabel->setAlignment( Qt::AlignHCenter ); - dayNumberSelector = new QSlider( daysSliderBox ); + dayNumberLabel->setAlignment( TQt::AlignHCenter ); + dayNumberSelector = new TQSlider( daysSliderBox ); - dayNumberSelector->setOrientation( Qt::Horizontal ); + dayNumberSelector->setOrientation( TQt::Horizontal ); dayNumberSelector->setRange( 1, 10 ); dayNumberSelector->setSteps( 1, 1 ); - dayNumberSelector->setTickmarks( QSlider::Below ); + dayNumberSelector->setTickmarks( TQSlider::Below ); dayNumberSelector->setFixedWidth( 100 ); - mealsSliderBox = new QVGroupBox( i18n( "Meals per Day" ), optionsBox ); - mealNumberLabel = new QLabel( mealsSliderBox ); + mealsSliderBox = new TQVGroupBox( i18n( "Meals per Day" ), optionsBox ); + mealNumberLabel = new TQLabel( mealsSliderBox ); mealNumberLabel->setText( "- 1 -" ); - mealNumberLabel->setAlignment( Qt::AlignHCenter ); - mealNumberSelector = new QSlider( mealsSliderBox ); + mealNumberLabel->setAlignment( TQt::AlignHCenter ); + mealNumberSelector = new TQSlider( mealsSliderBox ); - mealNumberSelector->setOrientation( Qt::Horizontal ); + mealNumberSelector->setOrientation( TQt::Horizontal ); mealNumberSelector->setRange( 1, 10 ); mealNumberSelector->setSteps( 1, 1 ); - mealNumberSelector->setTickmarks( QSlider::Below ); + mealNumberSelector->setTickmarks( TQSlider::Below ); mealNumberSelector->setFixedWidth( 100 ); // Tabs - mealTabs = new QTabWidget( this ); + mealTabs = new TQTabWidget( this ); mealTabs->setMargin( 5 ); // Button bar KIconLoader il; - QHBox *bottom_layout = new QHBox( this ); - //bottom_layout->layout()->addItem( new QSpacerItem( 10,10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + TQHBox *bottom_layout = new TQHBox( this ); + //bottom_layout->layout()->addItem( new TQSpacerItem( 10,10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); - okButton = new QPushButton( bottom_layout ); + okButton = new TQPushButton( bottom_layout ); okButton->setIconSet( il.loadIconSet( "button_ok", KIcon::Small ) ); okButton->setText( i18n( "Create the diet" ) ); - QPushButton *clearButton = new QPushButton( bottom_layout ); + TQPushButton *clearButton = new TQPushButton( bottom_layout ); clearButton->setIconSet( il.loadIconSet( "editclear", KIcon::Small ) ); clearButton->setText( i18n( "Clear" ) ); @@ -132,7 +132,7 @@ void DietWizardDialog::reload( ReloadFlags flag ) } } -void DietWizardDialog::newTab( const QString &name ) +void DietWizardDialog::newTab( const TQString &name ) { mealTab = new MealInput( mealTabs, database ); mealTab->reload(); @@ -142,7 +142,7 @@ void DietWizardDialog::newTab( const QString &name ) void DietWizardDialog::changeMealNumber( int mn ) { - mealNumberLabel->setText( QString( i18n( "- %1 -" ) ).arg( mn ) ); + mealNumberLabel->setText( TQString( i18n( "- %1 -" ) ).arg( mn ) ); if ( mn > mealNumber ) { while ( mealNumber != mn ) { @@ -165,15 +165,15 @@ void DietWizardDialog::changeDayNumber( int dn ) if ( dn < 7 ) { dayNumber = dn; - dayNumberLabel->setText( QString( i18n( "- %1 -" ) ).arg( dn ) ); + dayNumberLabel->setText( TQString( i18n( "- %1 -" ) ).arg( dn ) ); } else if ( dn == 7 ) { dayNumber = 7; - dayNumberLabel->setText( QString( i18n( "- 1 week -" ) ) ); + dayNumberLabel->setText( TQString( i18n( "- 1 week -" ) ) ); } else { dayNumber = ( dn - 6 ) * 7; - dayNumberLabel->setText( QString( i18n( "- %1 weeks -" ) ).arg( dn - 6 ) ); + dayNumberLabel->setText( TQString( i18n( "- %1 weeks -" ) ).arg( dn - 6 ) ); } } @@ -192,7 +192,7 @@ void DietWizardDialog::createDiet( void ) // temporal iterator list so elements can be removed without reloading them again from the DB // this list prevents the same meal from showing up in the same day twice - QValueList <RecipeList::Iterator> tempRList; + TQValueList <RecipeList::Iterator> tempRList; bool alert = false; @@ -205,10 +205,10 @@ void DietWizardDialog::createDiet( void ) for ( int dish = 0;dish < dishNo;dish++ ) { bool found = false; - QValueList <RecipeList::Iterator> tempDishRList = tempRList; + TQValueList <RecipeList::Iterator> tempDishRList = tempRList; while ( ( !found ) && !tempDishRList.empty() ) { int random_index = ( int ) ( ( float ) ( kapp->random() ) / ( float ) RAND_MAX * tempDishRList.count() ); - QValueList<RecipeList::Iterator>::Iterator iit = tempDishRList.at( random_index ); // note that at() retrieves an iterator to the iterator list, so we need to use * in order to get the RecipeList::Iterator + TQValueList<RecipeList::Iterator>::Iterator iit = tempDishRList.at( random_index ); // note that at() retrieves an iterator to the iterator list, so we need to use * in order to get the RecipeList::Iterator RecipeList::Iterator rit = *iit; if ( found = ( ( ( !categoryFiltering( meal, dish ) ) || checkCategories( *rit, meal, dish ) ) && checkConstraints( *rit, meal, dish ) ) ) // Check that the recipe is inside the constraint limits and in the categories specified @@ -235,7 +235,7 @@ void DietWizardDialog::createDiet( void ) { // make a list of dishnumbers - QValueList<int> dishNumbers; + TQValueList<int> dishNumbers; for ( int meal = 0;meal < mealNumber;meal++ ) { int dishNo = ( ( MealInput* ) ( mealTabs->page( meal ) ) ) ->dishNo(); @@ -254,7 +254,7 @@ void DietWizardDialog::createDiet( void ) } -void DietWizardDialog::populateIteratorList( RecipeList &rl, QValueList <RecipeList::Iterator> *il ) +void DietWizardDialog::populateIteratorList( RecipeList &rl, TQValueList <RecipeList::Iterator> *il ) { il->clear(); RecipeList::Iterator it; @@ -306,52 +306,52 @@ int DietWizardDialog::getNecessaryFlags() const } -MealInput::MealInput( QWidget *parent, RecipeDB *db ) : QWidget( parent ), +MealInput::MealInput( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ), database( db ) { // Design the dialog - QVBoxLayout *layout = new QVBoxLayout( this ); + TQVBoxLayout *layout = new TQVBoxLayout( this ); layout->setSpacing( 10 ); // Options box - mealOptions = new QHBox( this ); + mealOptions = new TQHBox( this ); mealOptions->setSpacing( 10 ); layout->addWidget( mealOptions ); // Number of dishes input - dishNumberBox = new QHBox( mealOptions ); + dishNumberBox = new TQHBox( mealOptions ); dishNumberBox->setSpacing( 10 ); - dishNumberLabel = new QLabel( i18n( "No. of dishes: " ), dishNumberBox ); - dishNumberInput = new QSpinBox( dishNumberBox ); + dishNumberLabel = new TQLabel( i18n( "No. of dishes: " ), dishNumberBox ); + dishNumberInput = new TQSpinBox( dishNumberBox ); dishNumberInput->setMinValue( 1 ); dishNumberInput->setMaxValue( 10 ); - dishNumberBox->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + dishNumberBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); // Toolbar - toolBar = new QHGroupBox( mealOptions ); - toolBar->setFrameStyle ( QFrame::Panel | QFrame::Sunken ); - toolBar->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) ); + toolBar = new TQHGroupBox( mealOptions ); + toolBar->setFrameStyle ( TQFrame::Panel | TQFrame::Sunken ); + toolBar->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ) ); // Next dish/ Previous dish buttons KIconLoader il; - buttonPrev = new QToolButton( toolBar ); + buttonPrev = new TQToolButton( toolBar ); buttonPrev->setUsesTextLabel( true ); buttonPrev->setTextLabel( i18n( "Previous Dish" ) ); buttonPrev->setIconSet( il.loadIconSet( "back", KIcon::Small ) ); - buttonPrev->setTextPosition( QToolButton::Under ); - buttonNext = new QToolButton( toolBar ); + buttonPrev->setTextPosition( TQToolButton::Under ); + buttonNext = new TQToolButton( toolBar ); buttonNext->setUsesTextLabel( true ); buttonNext->setTextLabel( i18n( "Next Dish" ) ); buttonNext->setIconSet( il.loadIconSet( "forward", KIcon::Small ) ); - buttonNext->setTextPosition( QToolButton::Under ); + buttonNext->setTextPosition( TQToolButton::Under ); // Dish widgets - dishStack = new QWidgetStack( this ); + dishStack = new TQWidgetStack( this ); layout->addWidget( dishStack ); - dishStack->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + dishStack->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); // Add default dishes DishInput *newDish = new DishInput( this, database, i18n( "1st Course" ) ); dishStack->addWidget( newDish ); @@ -377,7 +377,7 @@ MealInput::~MealInput() void MealInput::reload( ReloadFlags flag ) { - QValueList<DishInput*>::iterator it; + TQValueList<DishInput*>::iterator it; for ( it = dishInputList.begin(); it != dishInputList.end(); ++it ) { DishInput *di = ( *it ); di->reload(flag); @@ -393,7 +393,7 @@ void MealInput::changeDishNumber( int dn ) { if ( dn > dishNumber ) { while ( dishNumber != dn ) { - DishInput * newDish = new DishInput( this, database, QString( i18n( "Dish %1" ) ).arg( dishNumber + 1 ) ); + DishInput * newDish = new DishInput( this, database, TQString( i18n( "Dish %1" ) ).arg( dishNumber + 1 ) ); newDish->reload(); dishStack->addWidget( newDish ); dishInputList.append( newDish ); @@ -402,7 +402,7 @@ void MealInput::changeDishNumber( int dn ) } } else if ( dn < dishNumber ) { - QValueList <DishInput*>::Iterator it; + TQValueList <DishInput*>::Iterator it; while ( dishNumber != dn ) { it = dishInputList.fromLast(); DishInput *lastDish = ( *it ); @@ -422,7 +422,7 @@ void MealInput::changeDishNumber( int dn ) void MealInput::nextDish( void ) { // First get the place of the current dish input in the list - QValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); + TQValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); //Show the next dish if it exists it++; @@ -435,7 +435,7 @@ void MealInput::nextDish( void ) void MealInput::prevDish( void ) { // First get the place of the current dish input in the list - QValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); + TQValueList <DishInput*>::iterator it = dishInputList.find( ( DishInput* ) ( dishStack->visibleWidget() ) ); //Show the previous dish if it exists it--; @@ -446,12 +446,12 @@ void MealInput::prevDish( void ) void MealInput::showDish( int dn ) { - QValueList <DishInput*>::iterator it = dishInputList.at( dn ); + TQValueList <DishInput*>::iterator it = dishInputList.at( dn ); if ( it != dishInputList.end() ) dishStack->raiseWidget( *it ); } -DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QWidget( parent ), +DishInput::DishInput( TQWidget* parent, RecipeDB *db, const TQString &title ) : TQWidget( parent ), database(db) { @@ -460,28 +460,28 @@ DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QW // Design the widget - QVBoxLayout *layout = new QVBoxLayout( this ); + TQVBoxLayout *layout = new TQVBoxLayout( this ); layout->setSpacing( 10 ); //Horizontal Box to hold the KListView's - listBox = new QHGroupBox( i18n( "Dish Characteristics" ), this ); + listBox = new TQHGroupBox( i18n( "Dish Characteristics" ), this ); layout->addWidget( listBox ); // Dish id dishTitle = new DishTitle( listBox, title ); //Categories list - categoriesBox = new QVBox( listBox ); - categoriesEnabledBox = new QCheckBox( categoriesBox ); + categoriesBox = new TQVBox( listBox ); + categoriesEnabledBox = new TQCheckBox( categoriesBox ); categoriesEnabledBox->setText( i18n( "Enable Category Filtering" ) ); categoriesView = new CategoryCheckListView( categoriesBox, database, false ); - categoriesView->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); + categoriesView->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ); categoriesView->setEnabled( false ); // Disable it by default //Constraints list constraintsView = new PropertyConstraintListView( listBox, database ); - constraintsView->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); + constraintsView->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ); constraintsView->reload(); // KDoubleInput based edit boxes @@ -494,7 +494,7 @@ DishInput::DishInput( QWidget* parent, RecipeDB *db, const QString &title ) : QW // Connect Signals & Slots - connect( constraintsView, SIGNAL( executed( QListViewItem* ) ), this, SLOT( insertConstraintsEditBoxes( QListViewItem* ) ) ); + connect( constraintsView, SIGNAL( executed( TQListViewItem* ) ), this, SLOT( insertConstraintsEditBoxes( TQListViewItem* ) ) ); connect( constraintsView, SIGNAL( selectionChanged() ), this, SLOT( hideConstraintInputs() ) ); connect( constraintsEditBox1, SIGNAL( valueChanged( double ) ), this, SLOT( setMinValue( double ) ) ); connect( constraintsEditBox2, SIGNAL( valueChanged( double ) ), this, SLOT( setMaxValue( double ) ) ); @@ -506,9 +506,9 @@ DishInput::~DishInput() void DishInput::clear() { - QListViewItemIterator it( categoriesView ); + TQListViewItemIterator it( categoriesView ); while ( it.current() ) { - QCheckListItem * item = ( QCheckListItem* ) it.current(); + TQCheckListItem * item = ( TQCheckListItem* ) it.current(); item->setOn( false ); ++it; } @@ -534,9 +534,9 @@ void DishInput::reload( ReloadFlags flag ) categoriesView->reload(flag); } -void DishInput::insertConstraintsEditBoxes( QListViewItem* it ) +void DishInput::insertConstraintsEditBoxes( TQListViewItem* it ) { - QRect r; + TQRect r; // Constraints Box1 r = constraintsView->header() ->sectionRect( 2 ); //start at the section 2 header @@ -612,7 +612,7 @@ void DishInput::setMaxValue( double maxValue ) it->setMax( maxValue ); } -DishTitle::DishTitle( QWidget *parent, const QString &title ) : QWidget( parent ) +DishTitle::DishTitle( TQWidget *parent, const TQString &title ) : TQWidget( parent ) { titleText = title; } @@ -621,73 +621,73 @@ DishTitle::DishTitle( QWidget *parent, const QString &title ) : QWidget( parent DishTitle::~DishTitle() {} -void DishTitle::paintEvent( QPaintEvent * ) +void DishTitle::paintEvent( TQPaintEvent * ) { // Now draw the text - if ( QT_VERSION >= 0x030200 ) { - // Case 1: Qt 3.2+ + if ( TQT_VERSION >= 0x030200 ) { + // Case 1: TQt 3.2+ - QPainter painter( this ); + TQPainter painter( this ); // First draw the decoration painter.setPen( KGlobalSettings::activeTitleColor() ); - painter.setBrush( QBrush( KGlobalSettings::activeTitleColor() ) ); + painter.setBrush( TQBrush( KGlobalSettings::activeTitleColor() ) ); painter.drawRoundRect( 0, 20, 30, height() - 40, 50, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ) ); // Now draw the text - QFont titleFont = KGlobalSettings::windowTitleFont (); + TQFont titleFont = KGlobalSettings::windowTitleFont (); titleFont.setPointSize( 15 ); painter.setFont( titleFont ); painter.rotate( -90 ); - painter.setPen( QColor( 0x00, 0x00, 0x00 ) ); + painter.setPen( TQColor( 0x00, 0x00, 0x00 ) ); painter.drawText( 0, 0, -height(), 30, AlignCenter, titleText ); - painter.setPen( QColor( 0xFF, 0xFF, 0xFF ) ); + painter.setPen( TQColor( 0xFF, 0xFF, 0xFF ) ); painter.drawText( -1, -1, -height() - 1, 29, AlignCenter, titleText ); painter.end(); } else { - // Case 2: Qt 3.1 + // Case 2: TQt 3.1 // Use a pixmap - QSize pmSize( height(), width() ); //inverted size so we can rotate later - QPixmap pm( pmSize ); - pm.fill( QColor( 0xFF, 0xFF, 0xFF ) ); - QPainter painter( &pm ); + TQSize pmSize( height(), width() ); //inverted size so we can rotate later + TQPixmap pm( pmSize ); + pm.fill( TQColor( 0xFF, 0xFF, 0xFF ) ); + TQPainter painter( &pm ); // First draw the decoration painter.setPen( KGlobalSettings::activeTitleColor() ); - painter.setBrush( QBrush( KGlobalSettings::activeTitleColor() ) ); + painter.setBrush( TQBrush( KGlobalSettings::activeTitleColor() ) ); painter.drawRoundRect( 20, 0, height() - 40, 30, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ), 50 ); // Now draw the text - QFont titleFont = KGlobalSettings::windowTitleFont (); + TQFont titleFont = KGlobalSettings::windowTitleFont (); titleFont.setPointSize( 15 ); painter.setFont( titleFont ); - painter.setPen( QColor( 0x00, 0x00, 0x00 ) ); + painter.setPen( TQColor( 0x00, 0x00, 0x00 ) ); painter.drawText( 0, 0, height(), 30, AlignCenter, titleText ); - painter.setPen( QColor( 0xFF, 0xFF, 0xFF ) ); + painter.setPen( TQColor( 0xFF, 0xFF, 0xFF ) ); painter.drawText( -1, -1, height() - 1, 29, AlignCenter, titleText ); painter.end(); //Set the border transparent using a mask - QBitmap mask( pm.size() ); - mask.fill( Qt::color0 ); + TQBitmap mask( pm.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( 20, 0, height() - 40, 30, ( int ) ( 50.0 / ( height() - 40 ) * 35.0 ), 50 ); painter.end(); pm.setMask( mask ); //And Rotate - QWMatrix m ; + TQWMatrix m ; m.rotate( -90 ); pm = pm.xForm( m ); @@ -695,14 +695,14 @@ void DishTitle::paintEvent( QPaintEvent * ) } } -QSize DishTitle::sizeHint () const +TQSize DishTitle::sizeHint () const { - return ( QSize( 40, 200 ) ); + return ( TQSize( 40, 200 ) ); } -QSize DishTitle::minimumSizeHint() const +TQSize DishTitle::minimumSizeHint() const { - return ( QSize( 40, 200 ) ); + return ( TQSize( 40, 200 ) ); } bool DietWizardDialog::checkCategories( Recipe &rec, int meal, int dish ) diff --git a/krecipes/src/dialogs/dietwizarddialog.h b/krecipes/src/dialogs/dietwizarddialog.h index 05570a7..797a824 100644 --- a/krecipes/src/dialogs/dietwizarddialog.h +++ b/krecipes/src/dialogs/dietwizarddialog.h @@ -15,20 +15,20 @@ #include <stdlib.h> // For RAND_MAX -#include <qcheckbox.h> -#include <qhbox.h> -#include <qhgroupbox.h> -#include <qlabel.h> -#include <qptrlist.h> -#include <qpushbutton.h> -#include <qslider.h> -#include <qspinbox.h> -#include <qtabwidget.h> -#include <qtoolbutton.h> -#include <qvaluelist.h> -#include <qvbox.h> -#include <qvgroupbox.h> -#include <qwidgetstack.h> +#include <ntqcheckbox.h> +#include <ntqhbox.h> +#include <ntqhgroupbox.h> +#include <ntqlabel.h> +#include <ntqptrlist.h> +#include <ntqpushbutton.h> +#include <ntqslider.h> +#include <ntqspinbox.h> +#include <ntqtabwidget.h> +#include <ntqtoolbutton.h> +#include <ntqvaluelist.h> +#include <ntqvbox.h> +#include <ntqvgroupbox.h> +#include <ntqwidgetstack.h> #include <klistview.h> @@ -56,14 +56,14 @@ class PropertyConstraintListView; */ -class DietWizardDialog: public QVBox +class DietWizardDialog: public TQVBox { Q_OBJECT public: - DietWizardDialog( QWidget *parent, RecipeDB* db ); + DietWizardDialog( TQWidget *parent, RecipeDB* db ); ~DietWizardDialog(); private: @@ -76,16 +76,16 @@ private: RecipeList *dietRList; //Widgets - QHBox *optionsBox; - QVGroupBox *mealsSliderBox; - QLabel *mealNumberLabel; - QSlider *mealNumberSelector; - QVGroupBox *daysSliderBox; - QLabel *dayNumberLabel; - QSlider *dayNumberSelector; - QTabWidget *mealTabs; + TQHBox *optionsBox; + TQVGroupBox *mealsSliderBox; + TQLabel *mealNumberLabel; + TQSlider *mealNumberSelector; + TQVGroupBox *daysSliderBox; + TQLabel *dayNumberLabel; + TQSlider *dayNumberSelector; + TQTabWidget *mealTabs; MealInput *mealTab; // points to the current tab - QPushButton *okButton; + TQPushButton *okButton; //Methods bool checkCategories( Recipe &rec, int meal, int dish ); @@ -93,7 +93,7 @@ private: bool checkLimits( IngredientPropertyList &properties, ConstraintList &constraints ); void loadConstraints( int meal, int dish, ConstraintList *constraints ) const; void loadEnabledCategories( int meal, int dish, ElementList *categories ); - void newTab( const QString &name ); + void newTab( const TQString &name ); bool categoryFiltering( int meal, int dish ) const; int getNecessaryFlags() const; @@ -108,19 +108,19 @@ private slots: void createDiet( void ); void clear(); void createShoppingList( void ); - void populateIteratorList( RecipeList &rl, QValueList <RecipeList::Iterator> *il ); + void populateIteratorList( RecipeList &rl, TQValueList <RecipeList::Iterator> *il ); signals: void dietReady( void ); }; -class MealInput: public QWidget +class MealInput: public TQWidget { Q_OBJECT public: // Methods - MealInput( QWidget *parent, RecipeDB *database ); + MealInput( TQWidget *parent, RecipeDB *database ); ~MealInput(); void reload( ReloadFlags flag = Load ); int dishNo( void ) @@ -131,7 +131,7 @@ public: void showDish( int dn ); // Public widgets and variables - QValueList <DishInput*> dishInputList; // The list of dishes + TQValueList <DishInput*> dishInputList; // The list of dishes private: // Widgets @@ -140,20 +140,20 @@ private: RecipeDB *database; // Settings section for the meal - QHBox *mealOptions; + TQHBox *mealOptions; // Dish number setting - QHBox *dishNumberBox; - QLabel *dishNumberLabel; - QSpinBox *dishNumberInput; + TQHBox *dishNumberBox; + TQLabel *dishNumberLabel; + TQSpinBox *dishNumberInput; // Move <-> buttons - QHGroupBox *toolBar; - QToolButton *buttonNext; - QToolButton *buttonPrev; + TQHGroupBox *toolBar; + TQToolButton *buttonNext; + TQToolButton *buttonPrev; // Settings for the dish - QWidgetStack *dishStack; + TQWidgetStack *dishStack; public slots: void nextDish( void ); @@ -164,19 +164,19 @@ private slots: }; -class DishInput: public QWidget +class DishInput: public TQWidget { Q_OBJECT public: - DishInput( QWidget *parent, RecipeDB *database, const QString &title ); + DishInput( TQWidget *parent, RecipeDB *database, const TQString &title ); ~DishInput(); // Methods bool isCategoryFilteringEnabled( void ) const; void loadConstraints( ConstraintList *constraints ) const; void loadEnabledCategories( ElementList* categories ); void reload( ReloadFlags flag = Load ); - void setDishTitle( const QString & text ); + void setDishTitle( const TQString & text ); void clear(); @@ -184,10 +184,10 @@ private: // Variables bool categoryFiltering; // Widgets - QHGroupBox *listBox; + TQHGroupBox *listBox; DishTitle *dishTitle; - QVBox *categoriesBox; - QCheckBox *categoriesEnabledBox; + TQVBox *categoriesBox; + TQCheckBox *categoriesEnabledBox; CategoryCheckListView *categoriesView; PropertyConstraintListView *constraintsView; KDoubleNumInput *constraintsEditBox1; @@ -196,27 +196,27 @@ private: private slots: void enableCategories( bool enable ); - void insertConstraintsEditBoxes( QListViewItem* it ); + void insertConstraintsEditBoxes( TQListViewItem* it ); void hideConstraintInputs(); void setMinValue( double minValue ); void setMaxValue( double maxValue ); }; -class DishTitle: public QWidget +class DishTitle: public TQWidget { Q_OBJECT public: - DishTitle( QWidget *parent, const QString &title ); + DishTitle( TQWidget *parent, const TQString &title ); ~DishTitle(); - virtual QSize sizeHint () const; - virtual QSize minimumSizeHint() const; + virtual TQSize sizeHint () const; + virtual TQSize minimumSizeHint() const; protected: //Variables - QString titleText; + TQString titleText; //Methods - virtual void paintEvent( QPaintEvent *p ); + virtual void paintEvent( TQPaintEvent *p ); }; #endif diff --git a/krecipes/src/dialogs/editratingdialog.cpp b/krecipes/src/dialogs/editratingdialog.cpp index 505240f..fc8d943 100644 --- a/krecipes/src/dialogs/editratingdialog.cpp +++ b/krecipes/src/dialogs/editratingdialog.cpp @@ -12,20 +12,20 @@ #include <klocale.h> -#include <qvariant.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qcombobox.h> +#include <ntqvariant.h> +#include <ntqpushbutton.h> +#include <ntqlabel.h> +#include <ntqcombobox.h> #include <knuminput.h> -#include <qheader.h> +#include <ntqheader.h> #include <klistview.h> -#include <qtextedit.h> -#include <qlineedit.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qpainter.h> -#include <qvbox.h> +#include <ntqtextedit.h> +#include <ntqlineedit.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqpainter.h> +#include <ntqvbox.h> #include <kpopupmenu.h> #include <klocale.h> @@ -41,19 +41,19 @@ class RatingCriteriaListView : public KListView { public: - RatingCriteriaListView( QWidget *parent = 0, const char *name = 0 ) : KListView(parent,name){} + RatingCriteriaListView( TQWidget *parent = 0, const char *name = 0 ) : KListView(parent,name){} - void rename( QListViewItem *it, int c ) + void rename( TQListViewItem *it, int c ) { if ( c == 1 ) - it->setPixmap(c,QPixmap()); + it->setPixmap(c,TQPixmap()); KListView::rename(it,c); } }; -EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, const Rating &rating, QWidget* parent, const char* name ) +EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, const Rating &rating, TQWidget* parent, const char* name ) : KDialogBase( parent, name, true, i18n( "Rating" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { @@ -65,7 +65,7 @@ EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, const Ratin * Constructs a EditRatingDialog as a child of 'parent', with the * name 'name' and widget flags set to 'f'. */ -EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, QWidget* parent, const char* name ) +EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, TQWidget* parent, const char* name ) : KDialogBase( parent, name, true, i18n( "Rating" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ) { @@ -74,48 +74,48 @@ EditRatingDialog::EditRatingDialog( const ElementList &criteriaList, QWidget* pa void EditRatingDialog::init( const ElementList &criteriaList ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - layout2 = new QHBox( page ); + layout2 = new TQHBox( page ); - raterLabel = new QLabel( layout2, "raterLabel" ); - raterEdit = new QLineEdit( layout2, "raterEdit" ); + raterLabel = new TQLabel( layout2, "raterLabel" ); + raterEdit = new TQLineEdit( layout2, "raterEdit" ); - layout8 = new QHBox( page ); + layout8 = new TQHBox( page ); - criteriaLabel = new QLabel( layout8, "criteriaLabel" ); + criteriaLabel = new TQLabel( layout8, "criteriaLabel" ); - criteriaComboBox = new QComboBox( FALSE, layout8, "criteriaComboBox" ); - criteriaComboBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, (QSizePolicy::SizeType)0, 0, 0, criteriaComboBox->sizePolicy().hasHeightForWidth() ) ); + criteriaComboBox = new TQComboBox( FALSE, layout8, "criteriaComboBox" ); + criteriaComboBox->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, (TQSizePolicy::SizeType)0, 0, 0, criteriaComboBox->sizePolicy().hasHeightForWidth() ) ); criteriaComboBox->setEditable( TRUE ); criteriaComboBox->lineEdit()->disconnect( criteriaComboBox ); //so hitting enter doesn't enter the item into the box - starsLabel = new QLabel( layout8, "starsLabel" ); + starsLabel = new TQLabel( layout8, "starsLabel" ); starsWidget = new RatingWidget( 5, layout8, "starsWidget" ); - addButton = new QPushButton( layout8, "addButton" ); + addButton = new TQPushButton( layout8, "addButton" ); - removeButton = new QPushButton( layout8, "removeButton" ); + removeButton = new TQPushButton( layout8, "removeButton" ); criteriaListView = new RatingCriteriaListView( page, "criteriaListView" ); criteriaListView->addColumn( i18n( "Criteria" ) ); criteriaListView->addColumn( i18n( "Stars" ) ); - criteriaListView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, criteriaListView->sizePolicy().hasHeightForWidth() ) ); + criteriaListView->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 0, criteriaListView->sizePolicy().hasHeightForWidth() ) ); criteriaListView->setSorting(-1); criteriaListView->setItemsRenameable( true ); criteriaListView->setRenameable( 0, true ); criteriaListView->setRenameable( 1, true ); - commentsLabel = new QLabel( page, "commentsLabel" ); + commentsLabel = new TQLabel( page, "commentsLabel" ); - commentsEdit = new QTextEdit( page, "commentsEdit" ); + commentsEdit = new TQTextEdit( page, "commentsEdit" ); languageChange(); - resize( QSize(358, 331).expandedTo(minimumSizeHint()) ); + resize( TQSize(358, 331).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); - connect( criteriaListView, SIGNAL(itemRenamed(QListViewItem*,const QString &,int)), this, SLOT(itemRenamed(QListViewItem*,const QString &,int)) ); + connect( criteriaListView, SIGNAL(itemRenamed(TQListViewItem*,const TQString &,int)), this, SLOT(itemRenamed(TQListViewItem*,const TQString &,int)) ); connect( addButton, SIGNAL(clicked()), this, SLOT(slotAddRatingCriteria()) ); connect( removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveRatingCriteria()) ); @@ -136,7 +136,7 @@ void EditRatingDialog::init( const ElementList &criteriaList ) */ EditRatingDialog::~EditRatingDialog() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, TQt does it all for us } /* @@ -155,24 +155,24 @@ void EditRatingDialog::languageChange() raterLabel->setText( i18n( "Rater:" ) ); } -void EditRatingDialog::itemRenamed(QListViewItem* it, const QString &, int c) +void EditRatingDialog::itemRenamed(TQListViewItem* it, const TQString &, int c) { if ( c == 1 ) { bool ok = false; MixedNumber stars_mn = MixedNumber::fromString(it->text(c),&ok); if ( ok && !it->text(c).isEmpty() ) { - double stars = QMAX(0,QMIN(stars_mn.toDouble(),5)); //force to between 0 and 5 - QPixmap starsPic = Rating::starsPixmap( stars ); + double stars = TQMAX(0,TQMIN(stars_mn.toDouble(),5)); //force to between 0 and 5 + TQPixmap starsPic = Rating::starsPixmap( stars ); it->setPixmap(c,starsPic); - it->setText(2,QString::number(stars)); + it->setText(2,TQString::number(stars)); } else { double stars = it->text(2).toDouble(); //col 2 holds the old value, which we'll set it back to - QPixmap starsPic = Rating::starsPixmap( stars ); + TQPixmap starsPic = Rating::starsPixmap( stars ); it->setPixmap(c,starsPic); } - it->setText(c,QString::null); + it->setText(c,TQString::null); } } @@ -180,7 +180,7 @@ Rating EditRatingDialog::rating() const { Rating r; - for ( QListViewItem *it = criteriaListView->firstChild(); it; it = it->nextSibling() ) { + for ( TQListViewItem *it = criteriaListView->firstChild(); it; it = it->nextSibling() ) { RatingCriteria rc; rc.name = it->text(0); rc.stars = it->text(2).toDouble(); @@ -226,13 +226,13 @@ void EditRatingDialog::slotAddRatingCriteria() void EditRatingDialog::addRatingCriteria( const RatingCriteria &rc ) { - QListViewItem * it = new QListViewItem(criteriaListView,rc.name); + TQListViewItem * it = new TQListViewItem(criteriaListView,rc.name); - QPixmap stars = Rating::starsPixmap(rc.stars); + TQPixmap stars = Rating::starsPixmap(rc.stars); if ( !stars.isNull() ) //there aren't zero stars it->setPixmap(1,stars); - it->setText(2,QString::number(rc.stars)); + it->setText(2,TQString::number(rc.stars)); } void EditRatingDialog::slotRemoveRatingCriteria() diff --git a/krecipes/src/dialogs/editratingdialog.h b/krecipes/src/dialogs/editratingdialog.h index bf981c8..fd62442 100644 --- a/krecipes/src/dialogs/editratingdialog.h +++ b/krecipes/src/dialogs/editratingdialog.h @@ -13,18 +13,18 @@ #include <kdialogbase.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QLabel; -class QComboBox; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQLabel; +class TQComboBox; class KDoubleSpinBox; -class QPushButton; +class TQPushButton; class KListView; -class QListViewItem; -class QTextEdit; -class QLineEdit; +class TQListViewItem; +class TQTextEdit; +class TQLineEdit; class RatingWidget; class Rating; @@ -37,33 +37,33 @@ class EditRatingDialog : public KDialogBase Q_OBJECT public: - EditRatingDialog( const ElementList &criteriaList, const Rating &, QWidget* parent = 0, const char* name = 0 ); - EditRatingDialog( const ElementList &criteriaList, QWidget* parent = 0, const char* name = 0 ); + EditRatingDialog( const ElementList &criteriaList, const Rating &, TQWidget* parent = 0, const char* name = 0 ); + EditRatingDialog( const ElementList &criteriaList, TQWidget* parent = 0, const char* name = 0 ); ~EditRatingDialog(); - QLabel* criteriaLabel; - QComboBox* criteriaComboBox; - QLabel* starsLabel; + TQLabel* criteriaLabel; + TQComboBox* criteriaComboBox; + TQLabel* starsLabel; RatingWidget *starsWidget; - QPushButton* addButton; - QPushButton* removeButton; + TQPushButton* addButton; + TQPushButton* removeButton; RatingCriteriaListView* criteriaListView; - QLabel* commentsLabel; - QTextEdit* commentsEdit; - QLabel* raterLabel; - QLineEdit* raterEdit; + TQLabel* commentsLabel; + TQTextEdit* commentsEdit; + TQLabel* raterLabel; + TQLineEdit* raterEdit; Rating rating() const; protected: - QHBox* layout8; - QHBox* layout2; + TQHBox* layout8; + TQHBox* layout2; protected slots: virtual void languageChange(); void slotAddRatingCriteria(); void slotRemoveRatingCriteria(); - void itemRenamed(QListViewItem* it, const QString &, int c); + void itemRenamed(TQListViewItem* it, const TQString &, int c); private: void init(const ElementList &criteriaList); diff --git a/krecipes/src/dialogs/ingredientgroupsdialog.cpp b/krecipes/src/dialogs/ingredientgroupsdialog.cpp index 9110fcc..f43ae4d 100644 --- a/krecipes/src/dialogs/ingredientgroupsdialog.cpp +++ b/krecipes/src/dialogs/ingredientgroupsdialog.cpp @@ -10,9 +10,9 @@ #include "ingredientgroupsdialog.h" -#include <qpushbutton.h> -#include <qlayout.h> -#include <qvbox.h> +#include <ntqpushbutton.h> +#include <ntqlayout.h> +#include <ntqvbox.h> #include <klocale.h> #include <kdialog.h> @@ -20,37 +20,37 @@ #include "widgets/krelistview.h" #include "widgets/headerlistview.h" -IngredientGroupsDialog::IngredientGroupsDialog( RecipeDB *db, QWidget *parent, const char *name ) : QWidget(parent,name), database(db) +IngredientGroupsDialog::IngredientGroupsDialog( RecipeDB *db, TQWidget *parent, const char *name ) : TQWidget(parent,name), database(db) { - QHBoxLayout* layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); headerListView = new KreListView ( this, i18n( "Header list" ), true, 0 ); StdHeaderListView *list_view = new StdHeaderListView( headerListView, database, true ); headerListView->setListView( list_view ); - headerListView->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::MinimumExpanding ) ); + headerListView->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::MinimumExpanding ) ); layout->addWidget(headerListView); - QVBoxLayout *buttonLayout = new QVBoxLayout(this); - QPushButton *addHeaderButton = new QPushButton( this ); + TQVBoxLayout *buttonLayout = new TQVBoxLayout(this); + TQPushButton *addHeaderButton = new TQPushButton( this ); addHeaderButton->setText( "+" ); - addHeaderButton->setMinimumSize( QSize( 30, 30 ) ); - addHeaderButton->setMaximumSize( QSize( 30, 30 ) ); - addHeaderButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addHeaderButton->setMinimumSize( TQSize( 30, 30 ) ); + addHeaderButton->setMaximumSize( TQSize( 30, 30 ) ); + addHeaderButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); addHeaderButton->setFlat( true ); buttonLayout->addWidget(addHeaderButton); - QSpacerItem* spacer_buttons = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Fixed ); + TQSpacerItem* spacer_buttons = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Fixed ); buttonLayout->addItem( spacer_buttons ); - QPushButton *removeHeaderButton = new QPushButton( this ); + TQPushButton *removeHeaderButton = new TQPushButton( this ); removeHeaderButton->setText( "-" ); - removeHeaderButton->setMinimumSize( QSize( 30, 30 ) ); - removeHeaderButton->setMaximumSize( QSize( 30, 30 ) ); - removeHeaderButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removeHeaderButton->setMinimumSize( TQSize( 30, 30 ) ); + removeHeaderButton->setMaximumSize( TQSize( 30, 30 ) ); + removeHeaderButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); removeHeaderButton->setFlat( true ); buttonLayout->addWidget(removeHeaderButton); - QSpacerItem* spacer_below_buttons = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacer_below_buttons = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::MinimumExpanding ); buttonLayout->addItem( spacer_below_buttons ); layout->addLayout(buttonLayout); diff --git a/krecipes/src/dialogs/ingredientgroupsdialog.h b/krecipes/src/dialogs/ingredientgroupsdialog.h index 3a2dec8..4ab722f 100644 --- a/krecipes/src/dialogs/ingredientgroupsdialog.h +++ b/krecipes/src/dialogs/ingredientgroupsdialog.h @@ -11,17 +11,17 @@ #ifndef INGREDIENTGROUPSDIALOG_H #define INGREDIENTGROUPSDIALOG_H -#include <qwidget.h> +#include <ntqwidget.h> #include "widgets/dblistviewbase.h" class KreListView; class RecipeDB; -class IngredientGroupsDialog : public QWidget +class IngredientGroupsDialog : public TQWidget { public: - IngredientGroupsDialog( RecipeDB *db, QWidget *parent, const char *name ); + IngredientGroupsDialog( RecipeDB *db, TQWidget *parent, const char *name ); void reload( ReloadFlags flag = Load ); diff --git a/krecipes/src/dialogs/ingredientmatcherdialog.cpp b/krecipes/src/dialogs/ingredientmatcherdialog.cpp index fb5d174..ae8d6a3 100644 --- a/krecipes/src/dialogs/ingredientmatcherdialog.cpp +++ b/krecipes/src/dialogs/ingredientmatcherdialog.cpp @@ -21,11 +21,11 @@ #include "datablocks/mixednumber.h" #include "recipeactionshandler.h" -#include <qheader.h> -#include <qpainter.h> -#include <qstringlist.h> -#include <qlayout.h> -#include <qgroupbox.h> +#include <ntqheader.h> +#include <ntqpainter.h> +#include <ntqstringlist.h> +#include <ntqlayout.h> +#include <ntqgroupbox.h> #include <kapplication.h> #include <kcursor.h> @@ -39,50 +39,50 @@ #include "profiling.h" -IngredientMatcherDialog::IngredientMatcherDialog( QWidget *parent, RecipeDB *db ) : QWidget( parent ) +IngredientMatcherDialog::IngredientMatcherDialog( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ) { // Initialize internal variables database = db; //Design the dialog - QVBoxLayout *dialogLayout = new QVBoxLayout( this, 11, 6 ); + TQVBoxLayout *dialogLayout = new TQVBoxLayout( this, 11, 6 ); // Ingredient list - QHBoxLayout *layout2 = new QHBoxLayout( 0, 0, 6, "layout2" ); + TQHBoxLayout *layout2 = new TQHBoxLayout( 0, 0, 6, "layout2" ); - allIngListView = new KreListView( this, QString::null, true, 0 ); + allIngListView = new KreListView( this, TQString::null, true, 0 ); StdIngredientListView *list_view = new StdIngredientListView(allIngListView,database); - list_view->setSelectionMode( QListView::Multi ); + list_view->setSelectionMode( TQListView::Multi ); allIngListView->setListView(list_view); layout2->addWidget( allIngListView ); - QVBoxLayout *layout1 = new QVBoxLayout( 0, 0, 6, "layout1" ); + TQVBoxLayout *layout1 = new TQVBoxLayout( 0, 0, 6, "layout1" ); KIconLoader il; - addButton = new QPushButton( this, "addButton" ); + addButton = new TQPushButton( this, "addButton" ); addButton->setIconSet( il.loadIconSet( "forward", KIcon::Small ) ); - addButton->setFixedSize( QSize( 32, 32 ) ); + addButton->setFixedSize( TQSize( 32, 32 ) ); layout1->addWidget( addButton ); - removeButton = new QPushButton( this, "removeButton" ); + removeButton = new TQPushButton( this, "removeButton" ); removeButton->setIconSet( il.loadIconSet( "back", KIcon::Small ) ); - removeButton->setFixedSize( QSize( 32, 32 ) ); + removeButton->setFixedSize( TQSize( 32, 32 ) ); layout1->addWidget( removeButton ); - QSpacerItem *spacer1 = new QSpacerItem( 51, 191, QSizePolicy::Minimum, QSizePolicy::Expanding ); + TQSpacerItem *spacer1 = new TQSpacerItem( 51, 191, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); layout1->addItem( spacer1 ); layout2->addLayout( layout1 ); - ingListView = new KreListView( this, QString::null, true ); + ingListView = new KreListView( this, TQString::null, true ); ingListView->listView() ->addColumn( i18n( "Ingredient (required?)" ) ); ingListView->listView() ->addColumn( i18n( "Amount Available" ) ); layout2->addWidget( ingListView ); dialogLayout->addLayout( layout2 ); // Box to select allowed number of missing ingredients - missingBox = new QHBox( this ); - missingNumberLabel = new QLabel( missingBox ); + missingBox = new TQHBox( this ); + missingNumberLabel = new TQLabel( missingBox ); missingNumberLabel->setText( i18n( "Missing ingredients allowed:" ) ); missingNumberSpinBox = new KIntSpinBox( missingBox ); missingNumberSpinBox->setMinValue( -1 ); @@ -91,7 +91,7 @@ IngredientMatcherDialog::IngredientMatcherDialog( QWidget *parent, RecipeDB *db // Found recipe list recipeListView = new KreListView( this, i18n( "Matching Recipes" ), false, 1, missingBox ); - recipeListView->listView() ->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); + recipeListView->listView() ->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ); recipeListView->listView() ->setAllColumnsShowFocus( true ); recipeListView->listView() ->addColumn( i18n( "Title" ) ); @@ -108,15 +108,15 @@ IngredientMatcherDialog::IngredientMatcherDialog( QWidget *parent, RecipeDB *db RecipeActionsHandler *actionHandler = new RecipeActionsHandler( recipeListView->listView(), database, RecipeActionsHandler::Open | RecipeActionsHandler::Edit | RecipeActionsHandler::Export ); - QHBox *buttonBox = new QHBox( this ); + TQHBox *buttonBox = new TQHBox( this ); - okButton = new QPushButton( buttonBox ); + okButton = new TQPushButton( buttonBox ); okButton->setIconSet( il.loadIconSet( "button_ok", KIcon::Small ) ); okButton->setText( i18n( "Find matching recipes" ) ); - //buttonBox->layout()->addItem( new QSpacerItem( 10,10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + //buttonBox->layout()->addItem( new TQSpacerItem( 10,10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); - clearButton = new QPushButton( buttonBox ); + clearButton = new TQPushButton( buttonBox ); clearButton->setIconSet( il.loadIconSet( "editclear", KIcon::Small ) ); clearButton->setText( i18n( "Clear" ) ); dialogLayout->addWidget(buttonBox); @@ -128,20 +128,20 @@ IngredientMatcherDialog::IngredientMatcherDialog( QWidget *parent, RecipeDB *db connect ( actionHandler, SIGNAL( recipeSelected( int, int ) ), SIGNAL( recipeSelected( int, int ) ) ); connect( addButton, SIGNAL( clicked() ), this, SLOT( addIngredient() ) ); connect( removeButton, SIGNAL( clicked() ), this, SLOT( removeIngredient() ) ); - connect( ingListView->listView(), SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), SLOT( itemRenamed( QListViewItem*, const QPoint &, int ) ) ); + connect( ingListView->listView(), SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), SLOT( itemRenamed( TQListViewItem*, const TQPoint &, int ) ) ); } IngredientMatcherDialog::~IngredientMatcherDialog() { } -void IngredientMatcherDialog::itemRenamed( QListViewItem* item, const QPoint &, int col ) +void IngredientMatcherDialog::itemRenamed( TQListViewItem* item, const TQPoint &, int col ) { if ( col == 1 ) { KDialogBase amountEditDialog(this,"IngredientMatcherAmountEdit", false, i18n("Enter amount"), KDialogBase::Cancel | KDialogBase::Ok, KDialogBase::Ok); - QGroupBox *box = new QGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); + TQGroupBox *box = new TQGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); AmountUnitInput *amountEdit = new AmountUnitInput( box, database ); // Set the values from the item if ( !item->text(1).isEmpty() ) { @@ -158,7 +158,7 @@ void IngredientMatcherDialog::itemRenamed( QListViewItem* item, const QPoint &, amountEditDialog.setMainWidget(box); - if ( amountEditDialog.exec() == QDialog::Accepted ) { + if ( amountEditDialog.exec() == TQDialog::Accepted ) { MixedNumber amount = amountEdit->amount(); Unit unit = amountEdit->unit(); @@ -166,13 +166,13 @@ void IngredientMatcherDialog::itemRenamed( QListViewItem* item, const QPoint &, amount = -1; unit.id = -1; - item->setText(1,QString::null); + item->setText(1,TQString::null); } else { item->setText(1,amount.toString()+" "+((amount.toDouble()>1)?unit.plural:unit.name)); } item->setText(2,amount.toString()); - item->setText(3,QString::number(unit.id)); + item->setText(3,TQString::number(unit.id)); IngredientList::iterator ing_it = m_item_ing_map[item]; (*ing_it).amount = amount.toDouble(); @@ -183,13 +183,13 @@ void IngredientMatcherDialog::itemRenamed( QListViewItem* item, const QPoint &, void IngredientMatcherDialog::addIngredient() { - QPtrList<QListViewItem> items = allIngListView->listView()->selectedItems(); + TQPtrList<TQListViewItem> items = allIngListView->listView()->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { bool dup = false; - for ( QListViewItem *exists_it = ingListView->listView()->firstChild(); exists_it; exists_it = exists_it->nextSibling() ) { + for ( TQListViewItem *exists_it = ingListView->listView()->firstChild(); exists_it; exists_it = exists_it->nextSibling() ) { if ( exists_it->text( 0 ) == item->text( 0 ) ) { dup = true; break; @@ -197,7 +197,7 @@ void IngredientMatcherDialog::addIngredient() } if ( !dup ) { - QListViewItem * new_item = new QCheckListItem( ingListView->listView(), item->text( 0 ), QCheckListItem::CheckBox ); + TQListViewItem * new_item = new TQCheckListItem( ingListView->listView(), item->text( 0 ), TQCheckListItem::CheckBox ); ingListView->listView() ->setSelected( new_item, true ); ingListView->listView() ->ensureItemVisible( new_item ); @@ -212,7 +212,7 @@ void IngredientMatcherDialog::addIngredient() void IngredientMatcherDialog::removeIngredient() { - QListViewItem * item = ingListView->listView() ->selectedItem(); + TQListViewItem * item = ingListView->listView() ->selectedItem(); if ( item ) { for ( IngredientList::iterator it = m_ingredientList.begin(); it != m_ingredientList.end(); ++it ) { if ( *m_item_ing_map.find( item ) == it ) { @@ -228,7 +228,7 @@ void IngredientMatcherDialog::removeIngredient() void IngredientMatcherDialog::unselectIngredients() { ingListView->listView()->clear(); - for ( QListViewItem *it = allIngListView->listView()->firstChild(); it; it = it->nextSibling() ) + for ( TQListViewItem *it = allIngListView->listView()->firstChild(); it; it = it->nextSibling() ) allIngListView->listView()->setSelected(it,false); } @@ -250,8 +250,8 @@ void IngredientMatcherDialog::findRecipes( void ) // Now show the recipes with ingredients that are contained in the previous set // of ingredients RecipeList incompleteRecipes; - QValueList <int> missingNumbers; - QValueList <IngredientList> missingIngredients; + TQValueList <int> missingNumbers; + TQValueList <IngredientList> missingIngredients; RecipeList::Iterator it; for ( it = rlist.begin();it != rlist.end();++it ) { @@ -283,14 +283,14 @@ void IngredientMatcherDialog::findRecipes( void ) START_TIMER("Ingredient Matcher: searching for and displaying partial matches"); IngredientList requiredIngredients; - for ( QListViewItem *it = ingListView->listView()->firstChild(); it; it = it->nextSibling() ) { - if ( ((QCheckListItem*)it)->isOn() ) + for ( TQListViewItem *it = ingListView->listView()->firstChild(); it; it = it->nextSibling() ) { + if ( ((TQCheckListItem*)it)->isOn() ) requiredIngredients << *m_item_ing_map[it]; } // Classify recipes with missing ingredients in different lists by ammount - QValueList<int>::Iterator nit; - QValueList<IngredientList>::Iterator ilit; + TQValueList<int>::Iterator nit; + TQValueList<IngredientList>::Iterator ilit; int missingNoAllowed = missingNumberSpinBox->value(); if ( missingNoAllowed == -1 ) // "Any" @@ -333,7 +333,7 @@ void IngredientMatcherDialog::reload( ReloadFlags flag ) ( ( StdIngredientListView* ) allIngListView->listView() ) ->reload(flag); } -void SectionItem::paintCell ( QPainter * p, const QColorGroup & /*cg*/, int column, int width, int /*align*/ ) +void SectionItem::paintCell ( TQPainter * p, const TQColorGroup & /*cg*/, int column, int width, int /*align*/ ) { // Draw the section's deco p->setPen( KGlobalSettings::activeTitleColor() ); @@ -342,11 +342,11 @@ void SectionItem::paintCell ( QPainter * p, const QColorGroup & /*cg*/, int colu // Draw the section's text if ( column == 0 ) { - QFont titleFont = KGlobalSettings::windowTitleFont (); + TQFont titleFont = KGlobalSettings::windowTitleFont (); p->setFont( titleFont ); p->setPen( KGlobalSettings::activeTextColor() ); - p->drawText( 0, 0, width, height(), Qt::AlignLeft | Qt::AlignVCenter, mText ); + p->drawText( 0, 0, width, height(), TQt::AlignLeft | TQt::AlignVCenter, mText ); } } diff --git a/krecipes/src/dialogs/ingredientmatcherdialog.h b/krecipes/src/dialogs/ingredientmatcherdialog.h index eacd80c..13fb9c1 100644 --- a/krecipes/src/dialogs/ingredientmatcherdialog.h +++ b/krecipes/src/dialogs/ingredientmatcherdialog.h @@ -19,12 +19,12 @@ #include "widgets/recipelistview.h" #include "widgets/dblistviewbase.h" -#include <qfontmetrics.h> -#include <qlabel.h> -#include <qlistview.h> -#include <qpushbutton.h> -#include <qhbox.h> -#include <qvbox.h> +#include <ntqfontmetrics.h> +#include <ntqlabel.h> +#include <ntqlistview.h> +#include <ntqpushbutton.h> +#include <ntqhbox.h> +#include <ntqvbox.h> #include <kstringhandler.h> #include <klocale.h> @@ -41,18 +41,18 @@ class MixedNumber; class CustomRecipeListItem : public RecipeListItem { public: - CustomRecipeListItem( QListView* qlv, const Recipe &r, const IngredientList &il ) : RecipeListItem( qlv, r ) + CustomRecipeListItem( TQListView* qlv, const Recipe &r, const IngredientList &il ) : RecipeListItem( qlv, r ) { - ingredientListStored = new QStringList(); + ingredientListStored = new TQStringList(); IngredientList::ConstIterator ili; for ( ili = il.begin();ili != il.end();++ili ) { if ( (*ili).substitutes.count() > 0 ) { - QStringList subs; + TQStringList subs; subs << ( *ili ).name; - for ( QValueList<IngredientData>::const_iterator it = (*ili).substitutes.begin(); it != (*ili).substitutes.end(); ++it ) { + for ( TQValueList<IngredientData>::const_iterator it = (*ili).substitutes.begin(); it != (*ili).substitutes.end(); ++it ) { subs << (*it).name; } - ingredientListStored->append( subs.join(QString(" %1 ").arg(i18n("OR"))) ); + ingredientListStored->append( subs.join(TQString(" %1 ").arg(i18n("OR"))) ); } else ingredientListStored->append( ( *ili ).name ); @@ -60,7 +60,7 @@ public: moveItem( qlv->lastItem() ); } - CustomRecipeListItem( QListView* qlv, const Recipe &r ) : RecipeListItem( qlv, r ) + CustomRecipeListItem( TQListView* qlv, const Recipe &r ) : RecipeListItem( qlv, r ) { ingredientListStored = 0; @@ -73,10 +73,10 @@ public: } private: - QStringList *ingredientListStored; + TQStringList *ingredientListStored; public: - virtual QString text( int column ) const + virtual TQString text( int column ) const { if ( column == 2 && ingredientListStored ) return ingredientListStored->join ( "," ); @@ -85,38 +85,38 @@ public: } }; -class SectionItem: public QListViewItem +class SectionItem: public TQListViewItem { public: - SectionItem( QListView* qlv, QString sectionText ) : QListViewItem( qlv, qlv->lastItem() ) + SectionItem( TQListView* qlv, TQString sectionText ) : TQListViewItem( qlv, qlv->lastItem() ) { mText = sectionText; } ~SectionItem( void ) {} - virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ); + virtual void paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align ); private: - QString mText; + TQString mText; public: - virtual QString text( int column ) const + virtual TQString text( int column ) const { if ( column == 0 ) return ( mText ); else - return ( QString::null ); + return ( TQString::null ); } }; -class IngredientMatcherDialog: public QWidget +class IngredientMatcherDialog: public TQWidget { Q_OBJECT public: - IngredientMatcherDialog( QWidget *parent, RecipeDB* db ); + IngredientMatcherDialog( TQWidget *parent, RecipeDB* db ); ~IngredientMatcherDialog(); void reload( ReloadFlags flag = Load ); @@ -133,24 +133,24 @@ private: KreListView *ingListView; KreListView *recipeListView; - QHBox *missingBox; - QLabel *missingNumberLabel; + TQHBox *missingBox; + TQLabel *missingNumberLabel; KIntSpinBox *missingNumberSpinBox; - QPushButton *okButton; - QPushButton *clearButton; - QPushButton *addButton; - QPushButton *removeButton; + TQPushButton *okButton; + TQPushButton *clearButton; + TQPushButton *addButton; + TQPushButton *removeButton; IngredientList m_ingredientList; - QMap<QListViewItem*, IngredientList::iterator> m_item_ing_map; + TQMap<TQListViewItem*, IngredientList::iterator> m_item_ing_map; private slots: void findRecipes( void ); void unselectIngredients(); void addIngredient(); void removeIngredient(); - void itemRenamed( QListViewItem*, const QPoint &, int col ); + void itemRenamed( TQListViewItem*, const TQPoint &, int col ); }; #endif diff --git a/krecipes/src/dialogs/ingredientparserdialog.cpp b/krecipes/src/dialogs/ingredientparserdialog.cpp index 0e14a8f..b342eee 100644 --- a/krecipes/src/dialogs/ingredientparserdialog.cpp +++ b/krecipes/src/dialogs/ingredientparserdialog.cpp @@ -10,17 +10,17 @@ #include "ingredientparserdialog.h" -#include <qpushbutton.h> -#include <qtextedit.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qheader.h> -#include <qapplication.h> -#include <qclipboard.h> -#include <qvbox.h> +#include <ntqpushbutton.h> +#include <ntqtextedit.h> +#include <ntqlabel.h> +#include <ntqlineedit.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqheader.h> +#include <ntqapplication.h> +#include <ntqclipboard.h> +#include <ntqvbox.h> #include <klocale.h> #include <kdebug.h> @@ -33,25 +33,25 @@ #include "datablocks/mixednumber.h" #include "widgets/inglistviewitem.h" -IngredientParserDialog::IngredientParserDialog( const UnitList &units, QWidget* parent, const char* name ) +IngredientParserDialog::IngredientParserDialog( const UnitList &units, TQWidget* parent, const char* name ) : KDialogBase( parent, name, true, i18n( "Ingredient Parser" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), m_unitList(units) { setButtonBoxOrientation( Vertical ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - textLabel1 = new QLabel( page, "textLabel1" ); - textLabel1->setTextFormat( QLabel::RichText ); + textLabel1 = new TQLabel( page, "textLabel1" ); + textLabel1->setTextFormat( TQLabel::RichText ); - ingredientTextEdit = new QTextEdit( page, "ingredientTextEdit" ); - ingredientTextEdit->setTextFormat( QTextEdit::PlainText ); + ingredientTextEdit = new TQTextEdit( page, "ingredientTextEdit" ); + ingredientTextEdit->setTextFormat( TQTextEdit::PlainText ); parseButton = new KPushButton( page, "parseButton" ); - previewLabel = new QLabel( page, "previewLabel" ); - previewLabel->setTextFormat( QLabel::RichText ); + previewLabel = new TQLabel( page, "previewLabel" ); + previewLabel->setTextFormat( TQLabel::RichText ); previewIngView = new KListView( page, "previewIngView" ); previewIngView->setSorting(-1); @@ -61,7 +61,7 @@ IngredientParserDialog::IngredientParserDialog( const UnitList &units, QWidget* previewIngView->addColumn( i18n( "Preparation Method" ) ); languageChange(); - setInitialSize( QSize(577, 371).expandedTo(minimumSizeHint()) ); + setInitialSize( TQSize(577, 371).expandedTo(minimumSizeHint()) ); previewIngView->setItemsRenameable( true ); previewIngView->setRenameable( 0, true ); @@ -69,16 +69,16 @@ IngredientParserDialog::IngredientParserDialog( const UnitList &units, QWidget* previewIngView->setRenameable( 2, true ); previewIngView->setRenameable( 3, true ); - previewIngView->setSelectionMode( QListView::Extended ); + previewIngView->setSelectionMode( TQListView::Extended ); - ingredientTextEdit->setText( QApplication::clipboard()->text() ); + ingredientTextEdit->setText( TQApplication::clipboard()->text() ); ingredientTextEdit->selectAll(); - QWidget *buttonWidget = new QWidget( page ); - QHBoxLayout *buttonBox = new QHBoxLayout(buttonWidget); - QSpacerItem *horizontalSpacing = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - buttonGroup = new QPushButton( i18n("Set &Header"), buttonWidget ); - QWhatsThis::add( buttonGroup, i18n("If an ingredient header is detected as an ingredient, select it and click this button so that Krecipes will recognize it as a header. All the ingredients below the header will be included within that group.\n\nAlternatively, if you select multiple ingredients and click this button, those ingredients will be grouped together.") ); + TQWidget *buttonWidget = new TQWidget( page ); + TQHBoxLayout *buttonBox = new TQHBoxLayout(buttonWidget); + TQSpacerItem *horizontalSpacing = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + buttonGroup = new TQPushButton( i18n("Set &Header"), buttonWidget ); + TQWhatsThis::add( buttonGroup, i18n("If an ingredient header is detected as an ingredient, select it and click this button so that Krecipes will recognize it as a header. All the ingredients below the header will be included within that group.\n\nAlternatively, if you select multiple ingredients and click this button, those ingredients will be grouped together.") ); buttonBox->addWidget( buttonGroup ); buttonBox->addItem( horizontalSpacing ); @@ -92,7 +92,7 @@ IngredientParserDialog::IngredientParserDialog( const UnitList &units, QWidget* IngredientParserDialog::~IngredientParserDialog() { - // 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 IngredientParserDialog::languageChange() @@ -108,9 +108,9 @@ void IngredientParserDialog::languageChange() void IngredientParserDialog::accept() { - for ( QListViewItem *it = previewIngView->firstChild(); it; it = it->nextSibling() ) { + for ( TQListViewItem *it = previewIngView->firstChild(); it; it = it->nextSibling() ) { if ( it->rtti() == INGGRPLISTVIEWITEM_RTTI ) { - QString group = ((IngGrpListViewItem*)it)->group(); + TQString group = ((IngGrpListViewItem*)it)->group(); for ( IngListViewItem *sub_it = (IngListViewItem*)it->firstChild(); sub_it; sub_it = (IngListViewItem*)sub_it->nextSibling() ) { Ingredient ing = sub_it->ingredient(); ing.group = group; @@ -121,7 +121,7 @@ void IngredientParserDialog::accept() m_ingList.append(((IngListViewItem*)it)->ingredient()); } - QDialog::accept(); + TQDialog::accept(); } void IngredientParserDialog::removeIngredient() @@ -133,21 +133,21 @@ void IngredientParserDialog::removeIngredient() void IngredientParserDialog::convertToHeader() { - QPtrList<QListViewItem> items = previewIngView->selectedItems(); + TQPtrList<TQListViewItem> items = previewIngView->selectedItems(); if ( items.count() == 0 ) return; else if ( items.count() > 1 ) convertToHeader(items); else { //items.count = 1 - QListViewItem *item = items.first(); + TQListViewItem *item = items.first(); if ( item->rtti() == INGLISTVIEWITEM_RTTI ) { - QListViewItem *new_item = new IngGrpListViewItem(previewIngView, + TQListViewItem *new_item = new IngGrpListViewItem(previewIngView, (item->parent())?item->parent():item, ((IngListViewItem*)item)->ingredient().name, -1); - QListViewItem *next_sibling; - QListViewItem *last_item = 0; - for ( QListViewItem * it = (item->parent())?item->nextSibling():new_item->nextSibling(); it; it = next_sibling ) { + TQListViewItem *next_sibling; + TQListViewItem *last_item = 0; + for ( TQListViewItem * it = (item->parent())?item->nextSibling():new_item->nextSibling(); it; it = next_sibling ) { if ( it->rtti() == INGGRPLISTVIEWITEM_RTTI ) break; @@ -172,22 +172,22 @@ void IngredientParserDialog::convertToHeader() } } -void IngredientParserDialog::convertToHeader( const QPtrList<QListViewItem> &items ) +void IngredientParserDialog::convertToHeader( const TQPtrList<TQListViewItem> &items ) { if ( items.count() > 0 ) { - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item = it.current(); + TQPtrListIterator<TQListViewItem> it(items); + TQListViewItem *item = it.current(); if ( item->rtti() != INGLISTVIEWITEM_RTTI ) return; - QString group = ((IngListViewItem*)item)->ingredient().name; - QListViewItem *ingGroupItem = new IngGrpListViewItem(previewIngView, + TQString group = ((IngListViewItem*)item)->ingredient().name; + TQListViewItem *ingGroupItem = new IngGrpListViewItem(previewIngView, (item->parent())?item->parent():item, group, -1); delete item; //delete the ingredient header which was detected as an ingredient ++it; - QListViewItem *last_item = 0; + TQListViewItem *last_item = 0; while ( (item = it.current()) != 0 ) { //ignore anything that isn't an ingredient (e.g. headers) if ( item->rtti() == INGLISTVIEWITEM_RTTI ) { @@ -215,12 +215,12 @@ void IngredientParserDialog::parseText() { previewIngView->clear(); - QListViewItem *last_item = 0; + TQListViewItem *last_item = 0; int line_num = 0; - QStringList ingredients = QStringList::split("\n",ingredientTextEdit->text()); - for ( QStringList::const_iterator it = ingredients.begin(); it != ingredients.end(); ++it ) { - QString line = (*it).simplifyWhiteSpace(); + TQStringList ingredients = TQStringList::split("\n",ingredientTextEdit->text()); + for ( TQStringList::const_iterator it = ingredients.begin(); it != ingredients.end(); ++it ) { + TQString line = (*it).simplifyWhiteSpace(); ++line_num; int format_at = 0; @@ -260,7 +260,7 @@ void IngredientParserDialog::parseText() first_space = line.length(); bool isUnit = false; - QString unitCheck = line.mid(format_at,first_space-format_at); + TQString unitCheck = line.mid(format_at,first_space-format_at); for ( UnitList::const_iterator unit_it = m_unitList.begin(); unit_it != m_unitList.end(); ++unit_it ) { if ( (*unit_it).name == unitCheck || (*unit_it).plural == unitCheck || (*unit_it).name_abbrev == unitCheck || (*unit_it).plural_abbrev == unitCheck ) { @@ -279,7 +279,7 @@ void IngredientParserDialog::parseText() //======ingredient======// - int ing_end = line.find( QRegExp("(,|;)"), format_at+1 ); + int ing_end = line.find( TQRegExp("(,|;)"), format_at+1 ); if ( ing_end == -1 ) ing_end = line.length(); diff --git a/krecipes/src/dialogs/ingredientparserdialog.h b/krecipes/src/dialogs/ingredientparserdialog.h index 948f0cb..5e3909c 100644 --- a/krecipes/src/dialogs/ingredientparserdialog.h +++ b/krecipes/src/dialogs/ingredientparserdialog.h @@ -16,35 +16,35 @@ #include "datablocks/ingredientlist.h" #include "datablocks/unit.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QLabel; -class QTextEdit; -class QLineEdit; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQLabel; +class TQTextEdit; +class TQLineEdit; class KPushButton; class KListView; -class QListViewItem; -class QPushButton; +class TQListViewItem; +class TQPushButton; class IngredientParserDialog : public KDialogBase { Q_OBJECT public: - IngredientParserDialog( const UnitList &units, QWidget* parent = 0, const char* name = 0 ); + IngredientParserDialog( const UnitList &units, TQWidget* parent = 0, const char* name = 0 ); ~IngredientParserDialog(); IngredientList ingredients() const { return m_ingList; } protected: - QLabel* textLabel1; - QLabel *previewLabel; - QTextEdit* ingredientTextEdit; + TQLabel* textLabel1; + TQLabel *previewLabel; + TQTextEdit* ingredientTextEdit; KPushButton* parseButton; KListView* previewIngView; - QPushButton* buttonGroup; + TQPushButton* buttonGroup; protected slots: virtual void accept(); @@ -56,7 +56,7 @@ protected slots: virtual void languageChange(); private: - void convertToHeader( const QPtrList<QListViewItem> &items ); + void convertToHeader( const TQPtrList<TQListViewItem> &items ); UnitList m_unitList; IngredientList m_ingList; diff --git a/krecipes/src/dialogs/ingredientsdialog.cpp b/krecipes/src/dialogs/ingredientsdialog.cpp index ab7012a..ba1bfa6 100644 --- a/krecipes/src/dialogs/ingredientsdialog.cpp +++ b/krecipes/src/dialogs/ingredientsdialog.cpp @@ -34,14 +34,14 @@ #include <kglobal.h> #include <kconfig.h> -#include <qheader.h> -#include <qmessagebox.h> -#include <qtabwidget.h> +#include <ntqheader.h> +#include <ntqmessagebox.h> +#include <ntqtabwidget.h> -class WeightListItem : public QListViewItem +class WeightListItem : public TQListViewItem { public: - WeightListItem( QListView *listview, QListViewItem *item, const Weight &w ) : QListViewItem(listview,item), m_weight(w){} + WeightListItem( TQListView *listview, TQListViewItem *item, const Weight &w ) : TQListViewItem(listview,item), m_weight(w){} void setWeight( const Weight &w ) { m_weight = w; } Weight weight() const { return m_weight; } @@ -62,23 +62,23 @@ public: m_weight.weightUnit = (m_weight.weight>1)?unit.plural:unit.name; } - virtual QString text( int c ) const + virtual TQString text( int c ) const { if ( c == 0 ) - return QString::number(m_weight.weight)+" "+m_weight.weightUnit; + return TQString::number(m_weight.weight)+" "+m_weight.weightUnit; else if ( c == 1 ) - return QString::number(m_weight.perAmount)+" " + return TQString::number(m_weight.perAmount)+" " +m_weight.perAmountUnit - +((m_weight.prepMethodID!=-1)?", "+m_weight.prepMethod:QString::null); + +((m_weight.prepMethodID!=-1)?", "+m_weight.prepMethod:TQString::null); else - return QString::null; + return TQString::null; } private: Weight m_weight; }; -IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( parent ) +IngredientsDialog::IngredientsDialog( TQWidget* parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database @@ -90,49 +90,49 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( // Design dialog - QHBoxLayout* page_layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* page_layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); - QTabWidget *tabWidget = new QTabWidget( this ); + TQTabWidget *tabWidget = new TQTabWidget( this ); - QWidget *ingredientTab = new QWidget( tabWidget ); + TQWidget *ingredientTab = new TQWidget( tabWidget ); - layout = new QGridLayout( ingredientTab, 1, 1, 0, 0 ); - QSpacerItem* spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + layout = new TQGridLayout( ingredientTab, 1, 1, 0, 0 ); + TQSpacerItem* spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_left, 1, 0 ); - QSpacerItem* spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_top, 0, 1 ); ingredientListView = new KreListView ( ingredientTab, i18n( "Ingredient list" ), true, 0 ); StdIngredientListView *list_view = new StdIngredientListView( ingredientListView, database, true ); ingredientListView->setListView( list_view ); layout->addMultiCellWidget ( ingredientListView, 1, 5, 1, 1 ); - ingredientListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + ingredientListView->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); - QSpacerItem* spacer_rightIngredients = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_rightIngredients = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_rightIngredients, 1, 2 ); - addIngredientButton = new QPushButton( ingredientTab ); + addIngredientButton = new TQPushButton( ingredientTab ); addIngredientButton->setText( "+" ); layout->addWidget( addIngredientButton, 1, 3 ); - addIngredientButton->setMinimumSize( QSize( 30, 30 ) ); - addIngredientButton->setMaximumSize( QSize( 30, 30 ) ); - addIngredientButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addIngredientButton->setMinimumSize( TQSize( 30, 30 ) ); + addIngredientButton->setMaximumSize( TQSize( 30, 30 ) ); + addIngredientButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); addIngredientButton->setFlat( true ); - removeIngredientButton = new QPushButton( ingredientTab ); + removeIngredientButton = new TQPushButton( ingredientTab ); removeIngredientButton->setText( "-" ); layout->addWidget( removeIngredientButton, 3, 3 ); - removeIngredientButton->setMinimumSize( QSize( 30, 30 ) ); - removeIngredientButton->setMaximumSize( QSize( 30, 30 ) ); - removeIngredientButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removeIngredientButton->setMinimumSize( TQSize( 30, 30 ) ); + removeIngredientButton->setMaximumSize( TQSize( 30, 30 ) ); + removeIngredientButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); removeIngredientButton->setFlat( true ); - QSpacerItem* spacer_Ing_Buttons = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_Ing_Buttons = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacer_Ing_Buttons, 2, 3 ); - QSpacerItem* spacer_Ing_Units = new QSpacerItem( 30, 5, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_Ing_Units = new TQSpacerItem( 30, 5, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( spacer_Ing_Units, 1, 4 ); @@ -140,10 +140,10 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( config->setGroup( "Advanced" ); bool show_id = config->readBoolEntry( "ShowID", false ); - QScrollView *scrollView1 = new QScrollView( ingredientTab, "scrollView1" ); + TQScrollView *scrollView1 = new TQScrollView( ingredientTab, "scrollView1" ); scrollView1->enableClipper(true); - QWidget *rightWidget = new QWidget(scrollView1); - QGridLayout *rightLayout = new QGridLayout( rightWidget, 1, 1, 0, 0 ); + TQWidget *rightWidget = new TQWidget(scrollView1); + TQGridLayout *rightLayout = new TQGridLayout( rightWidget, 1, 1, 0, 0 ); unitsListView = new KreListView ( rightWidget, i18n( "Unit list" ) ); unitsListView->listView() ->addColumn( i18n( "Units" ) ); @@ -152,29 +152,29 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( unitsListView->listView() ->setAllColumnsShowFocus( true ); rightLayout->addMultiCellWidget ( unitsListView, 1, 4, 0, 0 ); unitsListView->listView() ->setMinimumWidth( 150 ); - unitsListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + unitsListView->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); - QSpacerItem* spacer_rightUnits = new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_rightUnits = new TQSpacerItem( 5, 5, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); rightLayout->addItem( spacer_rightUnits, 1, 1 ); - addUnitButton = new QPushButton( rightWidget ); + addUnitButton = new TQPushButton( rightWidget ); addUnitButton->setText( "+" ); rightLayout->addWidget( addUnitButton, 1, 2 ); - addUnitButton->resize( QSize( 30, 30 ) ); - addUnitButton->setMinimumSize( QSize( 30, 30 ) ); - addUnitButton->setMaximumSize( QSize( 30, 30 ) ); - addUnitButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addUnitButton->resize( TQSize( 30, 30 ) ); + addUnitButton->setMinimumSize( TQSize( 30, 30 ) ); + addUnitButton->setMaximumSize( TQSize( 30, 30 ) ); + addUnitButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); addUnitButton->setFlat( true ); - removeUnitButton = new QPushButton( rightWidget ); + removeUnitButton = new TQPushButton( rightWidget ); removeUnitButton->setText( "-" ); rightLayout->addWidget( removeUnitButton, 3, 2 ); - removeUnitButton->resize( QSize( 30, 30 ) ); - removeUnitButton->setMinimumSize( QSize( 30, 30 ) ); - removeUnitButton->setMaximumSize( QSize( 30, 30 ) ); - removeUnitButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removeUnitButton->resize( TQSize( 30, 30 ) ); + removeUnitButton->setMinimumSize( TQSize( 30, 30 ) ); + removeUnitButton->setMaximumSize( TQSize( 30, 30 ) ); + removeUnitButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); removeUnitButton->setFlat( true ); - QSpacerItem* spacer_Units_Properties = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_Units_Properties = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); rightLayout->addItem( spacer_Units_Properties, 2, 2 ); @@ -186,28 +186,28 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( propertiesListView->listView() ->addColumn( i18n( "Units" ) ); propertiesListView->listView() ->addColumn( i18n( "Id" ), show_id ? -1 : 0 ); propertiesListView->listView() ->setAllColumnsShowFocus( true ); - propertiesListView->listView() ->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + propertiesListView->listView() ->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); propertiesListView->listView() ->setSorting( -1 ); // Disable sorting. For the moment, the order is important to identify the per_units ID corresponding to this row. So the user shouldn't change this order. - addPropertyButton = new QPushButton( rightWidget ); + addPropertyButton = new TQPushButton( rightWidget ); addPropertyButton->setText( "+" ); rightLayout->addWidget( addPropertyButton, 6, 2 ); - addPropertyButton->resize( QSize( 30, 30 ) ); - addPropertyButton->setMinimumSize( QSize( 30, 30 ) ); - addPropertyButton->setMaximumSize( QSize( 30, 30 ) ); - addPropertyButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addPropertyButton->resize( TQSize( 30, 30 ) ); + addPropertyButton->setMinimumSize( TQSize( 30, 30 ) ); + addPropertyButton->setMaximumSize( TQSize( 30, 30 ) ); + addPropertyButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); addPropertyButton->setFlat( true ); - removePropertyButton = new QPushButton( rightWidget ); + removePropertyButton = new TQPushButton( rightWidget ); removePropertyButton->setText( "-" ); rightLayout->addWidget( removePropertyButton, 8, 2 ); - removePropertyButton->resize( QSize( 30, 30 ) ); - removePropertyButton->setMinimumSize( QSize( 30, 30 ) ); - removePropertyButton->setMaximumSize( QSize( 30, 30 ) ); - removePropertyButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removePropertyButton->resize( TQSize( 30, 30 ) ); + removePropertyButton->setMinimumSize( TQSize( 30, 30 ) ); + removePropertyButton->setMaximumSize( TQSize( 30, 30 ) ); + removePropertyButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); removePropertyButton->setFlat( true ); - QSpacerItem* spacer_Prop_Buttons = new QSpacerItem( 9, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_Prop_Buttons = new TQSpacerItem( 9, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); rightLayout->addItem( spacer_Prop_Buttons, 7, 2 ); weightsListView = new KreListView ( rightWidget, i18n( "Ingredient Weights" ) ); @@ -216,45 +216,45 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( weightsListView->listView() ->setAllColumnsShowFocus( true ); rightLayout->addMultiCellWidget ( weightsListView, 10, 14, 0, 0 ); weightsListView->listView() ->setMinimumWidth( 150 ); - weightsListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + weightsListView->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); - //QSpacerItem* spacer_rightWeights = new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::Minimum ); + //TQSpacerItem* spacer_rightWeights = new TQSpacerItem( 5, 5, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); //layout->addItem( spacer_rightWeights, 1, 6 ); - addWeightButton = new QPushButton( rightWidget ); + addWeightButton = new TQPushButton( rightWidget ); addWeightButton->setText( "+" ); rightLayout->addWidget( addWeightButton, 10, 2 ); - addWeightButton->resize( QSize( 30, 30 ) ); - addWeightButton->setMinimumSize( QSize( 30, 30 ) ); - addWeightButton->setMaximumSize( QSize( 30, 30 ) ); - addWeightButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addWeightButton->resize( TQSize( 30, 30 ) ); + addWeightButton->setMinimumSize( TQSize( 30, 30 ) ); + addWeightButton->setMaximumSize( TQSize( 30, 30 ) ); + addWeightButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); addWeightButton->setFlat( true ); - removeWeightButton = new QPushButton( rightWidget ); + removeWeightButton = new TQPushButton( rightWidget ); removeWeightButton->setText( "-" ); rightLayout->addWidget( removeWeightButton, 12, 2 ); - removeWeightButton->resize( QSize( 30, 30 ) ); - removeWeightButton->setMinimumSize( QSize( 30, 30 ) ); - removeWeightButton->setMaximumSize( QSize( 30, 30 ) ); - removeWeightButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removeWeightButton->resize( TQSize( 30, 30 ) ); + removeWeightButton->setMinimumSize( TQSize( 30, 30 ) ); + removeWeightButton->setMaximumSize( TQSize( 30, 30 ) ); + removeWeightButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); removeWeightButton->setFlat( true ); - QSpacerItem* spacer_Weight_Properties = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_Weight_Properties = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); rightLayout->addItem( spacer_Weight_Properties, 11, 2 ); - QSpacerItem* spacerBottom = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding ); + TQSpacerItem* spacerBottom = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Expanding ); rightLayout->addItem( spacerBottom, 13, 2 ); - scrollView1->setResizePolicy( QScrollView::AutoOneFit ); + scrollView1->setResizePolicy( TQScrollView::AutoOneFit ); layout->addMultiCellWidget(scrollView1,1,4,5,5); - QPushButton *loadUsdaButton = new QPushButton( ingredientTab ); + TQPushButton *loadUsdaButton = new TQPushButton( ingredientTab ); loadUsdaButton->setText( i18n( "Load USDA data" ) ); loadUsdaButton->setFlat( true ); layout->addWidget(loadUsdaButton,5,5); scrollView1->addChild(rightWidget); - scrollView1->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Ignored ); + scrollView1->setSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Ignored ); inputBox = new KDoubleNumInput( propertiesListView->listView() ->viewport() ); @@ -282,11 +282,11 @@ IngredientsDialog::IngredientsDialog( QWidget* parent, RecipeDB *db ) : QWidget( () ) ); connect( addPropertyButton, SIGNAL( clicked() ), this, SLOT( addPropertyToIngredient() ) ); connect( removePropertyButton, SIGNAL( clicked() ), this, SLOT( removePropertyFromIngredient() ) ); - connect( propertiesListView->listView(), SIGNAL( executed( QListViewItem* ) ), this, SLOT( insertPropertyEditBox( QListViewItem* ) ) ); + connect( propertiesListView->listView(), SIGNAL( executed( TQListViewItem* ) ), this, SLOT( insertPropertyEditBox( TQListViewItem* ) ) ); connect( propertiesListView->listView(), SIGNAL( selectionChanged() ), inputBox, SLOT( hide() ) ); connect( inputBox, SIGNAL( valueChanged( double ) ), this, SLOT( setPropertyAmount( double ) ) ); - connect( weightsListView->listView(), SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), SLOT( itemRenamed( QListViewItem*, const QPoint &, int ) ) ); + connect( weightsListView->listView(), SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), SLOT( itemRenamed( TQListViewItem*, const TQPoint &, int ) ) ); connect( loadUsdaButton, SIGNAL( clicked() ), this, SLOT( openUSDADialog() ) ); } @@ -313,7 +313,7 @@ void IngredientsDialog::reloadUnitList() int ingredientID = -1; // Find selected ingredient - QListViewItem *it; + TQListViewItem *it; it = ingredientListView->listView() ->selectedItem(); if ( it ) { // Check if an ingredient is selected first @@ -331,7 +331,7 @@ void IngredientsDialog::reloadUnitList() for ( UnitList::const_iterator unit_it = unitList->begin(); unit_it != unitList->end(); ++unit_it ) { if ( !( *unit_it ).name.isEmpty() ) { - ( void ) new QListViewItem( unitsListView->listView(), ( *unit_it ).name, QString::number( ( *unit_it ).id ) ); + ( void ) new TQListViewItem( unitsListView->listView(), ( *unit_it ).name, TQString::number( ( *unit_it ).id ) ); } } @@ -343,15 +343,15 @@ void IngredientsDialog::reloadUnitList() void IngredientsDialog::addWeight() { - QListViewItem *it = ingredientListView->listView()->selectedItem(); + TQListViewItem *it = ingredientListView->listView()->selectedItem(); if ( it ) { CreateIngredientWeightDialog weightDialog( this, database ); - if ( weightDialog.exec() == QDialog::Accepted ) { + if ( weightDialog.exec() == TQDialog::Accepted ) { Weight w = weightDialog.weight(); w.ingredientID = it->text( 1 ).toInt(); database->addIngredientWeight( w ); - QListViewItem * lastElement = weightsListView->listView()->lastItem(); + TQListViewItem * lastElement = weightsListView->listView()->lastItem(); WeightListItem *weight_it = new WeightListItem( weightsListView->listView(), lastElement, w ); weight_it->setAmountUnit( w.perAmount, database->unitName(w.perAmountUnitID), @@ -364,9 +364,9 @@ void IngredientsDialog::addWeight() void IngredientsDialog::removeWeight() { - QListViewItem *it = weightsListView->listView() ->selectedItem(); + TQListViewItem *it = weightsListView->listView() ->selectedItem(); if ( it ) { - switch ( KMessageBox::warningContinueCancel(this, i18n("Recipes may require this information for nutrient analysis. Are you sure you want to delete this entry?"), QString::null, KStdGuiItem::cont(), "DeleteIngredientWeight") ) { + switch ( KMessageBox::warningContinueCancel(this, i18n("Recipes may require this information for nutrient analysis. Are you sure you want to delete this entry?"), TQString::null, KStdGuiItem::cont(), "DeleteIngredientWeight") ) { case KMessageBox::Continue: database->removeIngredientWeight( ((WeightListItem*)it)->weight().id ); delete it; @@ -376,7 +376,7 @@ void IngredientsDialog::removeWeight() } } -void IngredientsDialog::itemRenamed( QListViewItem* item, const QPoint &, int col ) +void IngredientsDialog::itemRenamed( TQListViewItem* item, const TQPoint &, int col ) { WeightListItem *weight_it = (WeightListItem*)item; Weight w = weight_it->weight(); @@ -385,7 +385,7 @@ void IngredientsDialog::itemRenamed( QListViewItem* item, const QPoint &, int co KDialogBase amountEditDialog(this,"WeightAmountEdit", false, i18n("Enter amount"), KDialogBase::Cancel | KDialogBase::Ok, KDialogBase::Ok); - QGroupBox *box = new QGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); + TQGroupBox *box = new TQGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); AmountUnitInput *amountEdit = new AmountUnitInput( box, database, Unit::Mass, MixedNumber::DecimalFormat ); WeightListItem *it = (WeightListItem*)item; @@ -396,7 +396,7 @@ void IngredientsDialog::itemRenamed( QListViewItem* item, const QPoint &, int co amountEditDialog.setMainWidget(box); - if ( amountEditDialog.exec() == QDialog::Accepted ) { + if ( amountEditDialog.exec() == TQDialog::Accepted ) { MixedNumber amount = amountEdit->amount(); Unit unit = amountEdit->unit(); @@ -408,7 +408,7 @@ void IngredientsDialog::itemRenamed( QListViewItem* item, const QPoint &, int co KDialogBase amountEditDialog(this,"PerAmountEdit", false, i18n("Enter amount"), KDialogBase::Cancel | KDialogBase::Ok, KDialogBase::Ok); - QGroupBox *box = new QGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); + TQGroupBox *box = new TQGroupBox( 1, Horizontal, i18n("Amount"), &amountEditDialog ); WeightInput *amountEdit = new WeightInput( box, database, Unit::All, MixedNumber::DecimalFormat ); WeightListItem *it = (WeightListItem*)item; @@ -420,7 +420,7 @@ void IngredientsDialog::itemRenamed( QListViewItem* item, const QPoint &, int co amountEditDialog.setMainWidget(box); - if ( amountEditDialog.exec() == QDialog::Accepted ) { + if ( amountEditDialog.exec() == TQDialog::Accepted ) { MixedNumber amount = amountEdit->amount(); Unit unit = amountEdit->unit(); @@ -434,7 +434,7 @@ void IngredientsDialog::addUnitToIngredient( void ) { // Find selected ingredient item - QListViewItem * it; + TQListViewItem * it; int ingredientID = -1; if ( ( it = ingredientListView->listView() ->selectedItem() ) ) { ingredientID = it->text( 1 ).toInt(); @@ -446,14 +446,14 @@ void IngredientsDialog::addUnitToIngredient( void ) SelectUnitDialog unitsDialog( this, allUnits, SelectUnitDialog::HideEmptyUnit ); - if ( unitsDialog.exec() == QDialog::Accepted ) + if ( unitsDialog.exec() == TQDialog::Accepted ) { int unitID = unitsDialog.unitID(); if ( !( database->ingredientContainsUnit( ingredientID, unitID ) ) ) database->addUnitToIngredient( ingredientID, unitID ); // Add chosen unit to ingredient in database else { - QMessageBox::information( this, i18n( "Unit Exists" ), i18n( "The ingredient contains already the unit that you have chosen." ) ); + TQMessageBox::information( this, i18n( "Unit Exists" ), i18n( "The ingredient contains already the unit that you have chosen." ) ); } reloadUnitList(); // Reload the list from database } @@ -464,7 +464,7 @@ void IngredientsDialog::removeUnitFromIngredient( void ) { // Find selected ingredient/unit item combination - QListViewItem * it; + TQListViewItem * it; int ingredientID = -1, unitID = -1; if ( ( it = ingredientListView->listView() ->selectedItem() ) ) ingredientID = it->text( 1 ).toInt(); @@ -477,7 +477,7 @@ void IngredientsDialog::removeUnitFromIngredient( void ) database->findIngredientUnitDependancies( ingredientID, unitID, &dependingRecipes, &dependingPropertiesInfo ); - QValueList<ListInfo> lists; + TQValueList<ListInfo> lists; if ( !dependingRecipes.isEmpty() ) { ListInfo info; info.list = dependingRecipes; @@ -498,7 +498,7 @@ void IngredientsDialog::removeUnitFromIngredient( void ) DependanciesDialog warnDialog( this, lists ); if ( !dependingRecipes.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->removeUnitFromIngredient( ingredientID, unitID ); } reloadUnitList(); // Reload the list from database @@ -516,7 +516,7 @@ void IngredientsDialog:: reloadPropertyList( void ) //If none is selected, select first item - QListViewItem *it; + TQListViewItem *it; it = ingredientListView->listView() ->selectedItem(); //Populate this data into the KListView @@ -524,9 +524,9 @@ void IngredientsDialog:: reloadPropertyList( void ) database->loadProperties( propertiesList, it->text( 1 ).toInt() ); // load the list for this ingredient for ( IngredientPropertyList::const_iterator prop_it = propertiesList->begin(); prop_it != propertiesList->end(); ++prop_it ) { - QListViewItem * lastElement = propertiesListView->listView() ->lastItem(); + TQListViewItem * lastElement = propertiesListView->listView() ->lastItem(); //Insert property after the last one (it's important to keep the order in the case of the properties to be able to identify the per_units ID later on). - ( void ) new QListViewItem( propertiesListView->listView(), lastElement, (*prop_it).name, QString::number( (*prop_it).amount ), (*prop_it).units + QString( "/" ) + (*prop_it).perUnit.name, QString::number( (*prop_it).id ) ); + ( void ) new TQListViewItem( propertiesListView->listView(), lastElement, (*prop_it).name, TQString::number( (*prop_it).amount ), (*prop_it).units + TQString( "/" ) + (*prop_it).perUnit.name, TQString::number( (*prop_it).id ) ); // Store the perUnits with the ID for using later Element perUnitEl; perUnitEl.id = (*prop_it).perUnit.id; @@ -542,19 +542,19 @@ void IngredientsDialog::reloadWeightList( void ) weightsListView->listView() ->clear(); //If none is selected, select first item - QListViewItem *it = ingredientListView->listView() ->selectedItem(); + TQListViewItem *it = ingredientListView->listView() ->selectedItem(); //Populate this data into the KListView if ( it ) { // make sure that the ingredient list is not empty WeightList list = database->ingredientWeightUnits( it->text( 1 ).toInt() ); // load the list for this ingredient for ( WeightList::const_iterator weight_it = list.begin(); weight_it != list.end(); ++weight_it ) { - QListViewItem * lastElement = weightsListView->listView() ->lastItem(); + TQListViewItem * lastElement = weightsListView->listView() ->lastItem(); Weight w = *weight_it; WeightListItem *weight_it1 = new WeightListItem( weightsListView->listView(), lastElement, w ); weight_it1->setAmountUnit( w.perAmount, database->unitName(w.perAmountUnitID), - Element((w.prepMethodID==-1)?QString::null:database->prepMethodName(w.prepMethodID),w.prepMethodID) + Element((w.prepMethodID==-1)?TQString::null:database->prepMethodName(w.prepMethodID),w.prepMethodID) ); weight_it1->setWeightUnit( w.weight, database->unitName(w.weightUnitID) ); } @@ -572,7 +572,7 @@ void IngredientsDialog::addPropertyToIngredient( void ) { // Find selected ingredient item - QListViewItem * it; + TQListViewItem * it; int ingredientID = -1; if ( ( it = ingredientListView->listView() ->selectedItem() ) ) { ingredientID = it->text( 1 ).toInt(); @@ -585,7 +585,7 @@ void IngredientsDialog::addPropertyToIngredient( void ) database->loadPossibleUnits( ingredientID, &unitList ); SelectPropertyDialog propertyDialog( this, &allProperties, &unitList, SelectPropertyDialog::HideEmptyUnit ); - if ( propertyDialog.exec() == QDialog::Accepted ) + if ( propertyDialog.exec() == TQDialog::Accepted ) { int propertyID = propertyDialog.propertyID(); @@ -595,7 +595,7 @@ void IngredientsDialog::addPropertyToIngredient( void ) database->addPropertyToIngredient( ingredientID, propertyID, 0, perUnitsID ); // Add result chosen property to ingredient in database, with amount 0 by default } else { - QMessageBox::information( this, i18n( "Property Exists" ), i18n( "The property you tried to add already exists in the ingredient with the same per units." ) ); + TQMessageBox::information( this, i18n( "Property Exists" ), i18n( "The property you tried to add already exists in the ingredient with the same per units." ) ); } reloadPropertyList(); // Reload the list from database } @@ -606,7 +606,7 @@ void IngredientsDialog::removePropertyFromIngredient( void ) { // Find selected ingredient/property item combination - QListViewItem * it; + TQListViewItem * it; int ingredientID = -1, propertyID = -1; int perUnitsID = -1; if ( ( it = ingredientListView->listView() ->selectedItem() ) ) @@ -626,9 +626,9 @@ void IngredientsDialog::removePropertyFromIngredient( void ) } } -void IngredientsDialog::insertPropertyEditBox( QListViewItem* it ) +void IngredientsDialog::insertPropertyEditBox( TQListViewItem* it ) { - QRect r = propertiesListView->listView() ->header() ->sectionRect( 1 ); + TQRect r = propertiesListView->listView() ->header() ->sectionRect( 1 ); r.moveBy( 0, propertiesListView->listView() ->itemRect( it ).y() ); //Move down to the item, note that its height is same as header's right now. @@ -642,12 +642,12 @@ void IngredientsDialog::insertPropertyEditBox( QListViewItem* it ) void IngredientsDialog::setPropertyAmount( double amount ) { - QListViewItem *ing_it = ingredientListView->listView() ->selectedItem(); // Find selected ingredient - QListViewItem *prop_it = propertiesListView->listView() ->selectedItem(); + TQListViewItem *ing_it = ingredientListView->listView() ->selectedItem(); // Find selected ingredient + TQListViewItem *prop_it = propertiesListView->listView() ->selectedItem(); if ( ing_it && prop_it ) // Appart from property, Check if an ingredient is selected first, just in case { - prop_it->setText( 1, QString::number( amount ) ); + prop_it->setText( 1, TQString::number( amount ) ); int propertyID = prop_it->text( 3 ).toInt(); int ingredientID = ing_it->text( 1 ).toInt(); int per_units = perUnitListBack->getElement( findPropertyNo( prop_it ) ).id ; @@ -655,11 +655,11 @@ void IngredientsDialog::setPropertyAmount( double amount ) } } -int IngredientsDialog::findPropertyNo( QListViewItem * /*it*/ ) +int IngredientsDialog::findPropertyNo( TQListViewItem * /*it*/ ) { bool found = false; int i = 0; - QListViewItem* item = propertiesListView->listView() ->firstChild(); + TQListViewItem* item = propertiesListView->listView() ->firstChild(); while ( i < propertiesListView->listView() ->childCount() && !found ) { if ( item == propertiesListView->listView() ->currentItem() ) found = true; @@ -684,19 +684,19 @@ void IngredientsDialog::reload( ReloadFlags flag ) void IngredientsDialog::openUSDADialog( void ) { - QListViewItem * ing_it = ingredientListView->listView() ->selectedItem(); // Find selected ingredient + TQListViewItem * ing_it = ingredientListView->listView() ->selectedItem(); // Find selected ingredient if ( ing_it ) { KApplication::setOverrideCursor( KCursor::waitCursor() ); USDADataDialog usda_dialog( Element( ing_it->text( 0 ), ing_it->text( 1 ).toInt() ), database, this ); KApplication::restoreOverrideCursor(); - if ( usda_dialog.exec() == QDialog::Accepted ) { + if ( usda_dialog.exec() == TQDialog::Accepted ) { reloadPropertyList(); //update property list upon success reloadWeightList(); } } else - QMessageBox::information( this, QString::null, i18n( "No ingredient selected." ) ); + TQMessageBox::information( this, TQString::null, i18n( "No ingredient selected." ) ); } #include "ingredientsdialog.moc" diff --git a/krecipes/src/dialogs/ingredientsdialog.h b/krecipes/src/dialogs/ingredientsdialog.h index 0701090..5e048f7 100644 --- a/krecipes/src/dialogs/ingredientsdialog.h +++ b/krecipes/src/dialogs/ingredientsdialog.h @@ -13,10 +13,10 @@ #ifndef INGREDIENTSDIALOG_H #define INGREDIENTSDIALOG_H -#include <qpushbutton.h> -#include <qvbox.h> -#include <qlayout.h> -#include <qwidget.h> +#include <ntqpushbutton.h> +#include <ntqvbox.h> +#include <ntqlayout.h> +#include <ntqwidget.h> #include <knuminput.h> #include "widgets/krelistview.h" @@ -35,31 +35,31 @@ class UnitsDialog; class IngredientGroupsDialog; class MixedNumber; -class IngredientsDialog: public QWidget +class IngredientsDialog: public TQWidget { Q_OBJECT public: - IngredientsDialog( QWidget* parent, RecipeDB *db ); + IngredientsDialog( TQWidget* parent, RecipeDB *db ); ~IngredientsDialog(); void reload( ReloadFlags flag = Load ); private: // Widgets - QGridLayout* layout; - QPushButton* addIngredientButton; - QPushButton* removeIngredientButton; - QPushButton* addUnitButton; - QPushButton* removeUnitButton; - QPushButton* addPropertyButton; - QPushButton* removePropertyButton; - QPushButton* addWeightButton; - QPushButton* removeWeightButton; + TQGridLayout* layout; + TQPushButton* addIngredientButton; + TQPushButton* removeIngredientButton; + TQPushButton* addUnitButton; + TQPushButton* removeUnitButton; + TQPushButton* addPropertyButton; + TQPushButton* removePropertyButton; + TQPushButton* addWeightButton; + TQPushButton* removeWeightButton; KreListView* ingredientListView; KreListView* unitsListView; KreListView* propertiesListView; KreListView* weightsListView; - QPushButton* pushButton5; + TQPushButton* pushButton5; KDoubleNumInput* inputBox; IngredientGroupsDialog *groupsDialog; @@ -68,7 +68,7 @@ private: void reloadUnitList( void ); void reloadPropertyList( void ); void reloadWeightList( void ); - int findPropertyNo( QListViewItem *it ); + int findPropertyNo( TQListViewItem *it ); // Internal Variables RecipeDB *database; @@ -84,10 +84,10 @@ private slots: void updateLists( void ); void addPropertyToIngredient( void ); void removePropertyFromIngredient( void ); - void insertPropertyEditBox( QListViewItem* it ); + void insertPropertyEditBox( TQListViewItem* it ); void setPropertyAmount( double amount ); void openUSDADialog( void ); - void itemRenamed( QListViewItem*, const QPoint &, int col ); + void itemRenamed( TQListViewItem*, const TQPoint &, int col ); }; #endif diff --git a/krecipes/src/dialogs/pagesetupdialog.cpp b/krecipes/src/dialogs/pagesetupdialog.cpp index 05d81bb..2586312 100644 --- a/krecipes/src/dialogs/pagesetupdialog.cpp +++ b/krecipes/src/dialogs/pagesetupdialog.cpp @@ -10,15 +10,15 @@ #include "pagesetupdialog.h" -#include <qdir.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qfileinfo.h> -#include <qpushbutton.h> -#include <qpopupmenu.h> -#include <qtooltip.h> -#include <qtabwidget.h> -#include <qlabel.h> +#include <ntqdir.h> +#include <ntqlayout.h> +#include <ntqhbox.h> +#include <ntqfileinfo.h> +#include <ntqpushbutton.h> +#include <ntqpopupmenu.h> +#include <ntqtooltip.h> +#include <ntqtabwidget.h> +#include <ntqlabel.h> #include <khtmlview.h> #include <kapplication.h> @@ -36,11 +36,11 @@ #include "setupdisplay.h" -PageSetupDialog::PageSetupDialog( QWidget *parent, const Recipe &sample, const QString &configEntry ) : KDialog( parent, 0, true ), m_configEntry(configEntry) +PageSetupDialog::PageSetupDialog( TQWidget *parent, const Recipe &sample, const TQString &configEntry ) : KDialog( parent, 0, true ), m_configEntry(configEntry) { KIconLoader il; - QVBoxLayout * layout = new QVBoxLayout( this ); + TQVBoxLayout * layout = new TQVBoxLayout( this ); KToolBar *toolbar = new KToolBar( this ); KActionCollection *actionCollection = new KActionCollection( this ); @@ -51,14 +51,14 @@ PageSetupDialog::PageSetupDialog( QWidget *parent, const Recipe &sample, const Q KPopupMenu *open_popup = custom_open->popupMenu(); open_popup->insertTitle( i18n( "Styles" ) ); - QDir included_layouts( getIncludedLayoutDir(), "*.klo", QDir::Name | QDir::IgnoreCase, QDir::Files ); + TQDir included_layouts( getIncludedLayoutDir(), "*.klo", TQDir::Name | TQDir::IgnoreCase, TQDir::Files ); for ( unsigned int i = 0; i < included_layouts.count(); i++ ) { int id = open_popup->insertItem( included_layouts[ i ].left(included_layouts[ i ].find(".")), this, SLOT( loadLayout( int ) ) ); included_layouts_map.insert( id, included_layouts[ i ] ); } open_popup->insertTitle( i18n( "Templates" ) ); - QDir included_templates( getIncludedLayoutDir(), "*.template", QDir::Name | QDir::IgnoreCase, QDir::Files ); + TQDir included_templates( getIncludedLayoutDir(), "*.template", TQDir::Name | TQDir::IgnoreCase, TQDir::Files ); for ( unsigned int i = 0; i < included_templates.count(); i++ ) { int id = open_popup->insertItem( included_templates[ i ].left(included_templates[ i ].find(".")).replace("_"," "), this, SLOT( loadTemplate( int ) ) ); included_layouts_map.insert( id, included_templates[ i ] ); @@ -77,15 +77,15 @@ PageSetupDialog::PageSetupDialog( QWidget *parent, const Recipe &sample, const Q shown_items->plug( toolbar ); layout->addWidget( toolbar ); - QLabel *help = new QLabel(i18n("<i>Usage: Right-click any element to edit the look of that element.</i>"),this); + TQLabel *help = new TQLabel(i18n("<i>Usage: Right-click any element to edit the look of that element.</i>"),this); layout->addWidget( help ); m_htmlPart = new SetupDisplay(sample, this); layout->addWidget( m_htmlPart->view() ); - QHBox *buttonsBox = new QHBox( this ); - QPushButton *okButton = new QPushButton( il.loadIconSet( "ok", KIcon::Small ), i18n( "Save and Close" ), buttonsBox ); - QPushButton *cancelButton = new QPushButton( il.loadIconSet( "cancel", KIcon::Small ), i18n( "&Cancel" ), buttonsBox ); + TQHBox *buttonsBox = new TQHBox( this ); + TQPushButton *okButton = new TQPushButton( il.loadIconSet( "ok", KIcon::Small ), i18n( "Save and Close" ), buttonsBox ); + TQPushButton *cancelButton = new TQPushButton( il.loadIconSet( "cancel", KIcon::Small ), i18n( "&Cancel" ), buttonsBox ); layout->addWidget( buttonsBox ); connect( m_htmlPart, SIGNAL(itemVisibilityChanged(KreDisplayItem*,bool)), this, SLOT(updateItemVisibility(KreDisplayItem*,bool)) ); @@ -94,16 +94,16 @@ PageSetupDialog::PageSetupDialog( QWidget *parent, const Recipe &sample, const Q KConfig *config = KGlobal::config(); config->setGroup( "Page Setup" ); - QSize defaultSize(300,400); + TQSize defaultSize(300,400); resize(config->readSizeEntry( "WindowSize", &defaultSize )); //let's do everything we can to be sure at least some layout is loaded - QString layoutFile = config->readEntry( m_configEntry+"Layout", locate( "appdata", "layouts/Default.klo" ) ); - if ( layoutFile.isEmpty() || !QFile::exists( layoutFile ) ) + TQString layoutFile = config->readEntry( m_configEntry+"Layout", locate( "appdata", "layouts/Default.klo" ) ); + if ( layoutFile.isEmpty() || !TQFile::exists( layoutFile ) ) layoutFile = locate( "appdata", "layouts/Default.klo" ); - QString tmpl = config->readEntry( m_configEntry+"Template", locate( "appdata", "layouts/Default.template" ) ); - if ( tmpl.isEmpty() || !QFile::exists( tmpl ) ) + TQString tmpl = config->readEntry( m_configEntry+"Template", locate( "appdata", "layouts/Default.template" ) ); + if ( tmpl.isEmpty() || !TQFile::exists( tmpl ) ) tmpl = locate( "appdata", "layouts/Default.template" ); kdDebug()<<"tmpl: "<<tmpl<<endl; active_template = tmpl; @@ -133,7 +133,7 @@ void PageSetupDialog::accept() config->setGroup( "Page Setup" ); config->writeEntry( "WindowSize", size() ); - QDialog::accept(); + TQDialog::accept(); } void PageSetupDialog::reject() @@ -150,7 +150,7 @@ void PageSetupDialog::reject() } } - QDialog::reject(); + TQDialog::reject(); } void PageSetupDialog::updateItemVisibility( KreDisplayItem *item, bool visible ) @@ -164,8 +164,8 @@ void PageSetupDialog::initShownItems() PropertiesMap properties = m_htmlPart->properties(); - QValueList<QString> nameList; - QMap<QString,KreDisplayItem*> nameMap; + TQValueList<TQString> nameList; + TQMap<TQString,KreDisplayItem*> nameMap; for ( PropertiesMap::const_iterator it = properties.begin(); it != properties.end(); ++it ) { nameList << it.key()->name; @@ -173,7 +173,7 @@ void PageSetupDialog::initShownItems() } qHeapSort( nameList ); - for ( QValueList<QString>::const_iterator it = nameList.begin(); it != nameList.end(); ++it ) { + for ( TQValueList<TQString>::const_iterator it = nameList.begin(); it != nameList.end(); ++it ) { KreDisplayItem *item = nameMap[*it]; if ( properties[item] & SetupDisplay::Visibility ) { int new_id = shown_items_popup->insertItem ( *it ); @@ -194,7 +194,7 @@ void PageSetupDialog::setItemShown( int id ) void PageSetupDialog::loadFile() { - QString file = KFileDialog::getOpenFileName( locateLocal( "appdata", "layouts/" ), QString("*.klo *.template|%1").arg(i18n("Krecipes style or template file")), this, i18n( "Select Layout" ) ); + TQString file = KFileDialog::getOpenFileName( locateLocal( "appdata", "layouts/" ), TQString("*.klo *.template|%1").arg(i18n("Krecipes style or template file")), this, i18n( "Select Layout" ) ); if ( file.endsWith(".klo") ) loadLayout( file ); @@ -215,7 +215,7 @@ void PageSetupDialog::loadLayout( int popup_param ) loadLayout( getIncludedLayoutDir() + "/" + included_layouts_map[ popup_param ] ); } -void PageSetupDialog::loadLayout( const QString &filename ) +void PageSetupDialog::loadLayout( const TQString &filename ) { if ( m_htmlPart->hasChanges() ) { switch ( KMessageBox::questionYesNoCancel( this, i18n( "This layout has been modified.\nDo you want to save it?" ), i18n( "Save Layout?" ) ) ) { @@ -259,7 +259,7 @@ void PageSetupDialog::saveLayout() void PageSetupDialog::saveAsLayout() { - QString filename = KFileDialog::getSaveFileName( KGlobal::instance() ->dirs() ->saveLocation( "appdata", "layouts/" ), "*.klo|Krecipes Layout (*.klo)", this, QString::null ); + TQString filename = KFileDialog::getSaveFileName( KGlobal::instance() ->dirs() ->saveLocation( "appdata", "layouts/" ), "*.klo|Krecipes Layout (*.klo)", this, TQString::null ); if ( !filename.isEmpty() ) { if ( haveWritePerm( filename ) ) { @@ -278,30 +278,30 @@ void PageSetupDialog::saveAsLayout() } } -QString PageSetupDialog::getIncludedLayoutDir() const +TQString PageSetupDialog::getIncludedLayoutDir() const { - QFileInfo file_info( locate( "appdata", "layouts/Default.klo" ) ); + TQFileInfo file_info( locate( "appdata", "layouts/Default.klo" ) ); return file_info.dirPath( true ); } -void PageSetupDialog::setActiveFile( const QString &filename ) +void PageSetupDialog::setActiveFile( const TQString &filename ) { active_filename = filename; have_write_perm = haveWritePerm( filename ); } -bool PageSetupDialog::haveWritePerm( const QString &filename ) +bool PageSetupDialog::haveWritePerm( const TQString &filename ) { - QFileInfo info( filename ); + TQFileInfo info( filename ); if ( info.exists() ) //check that we can write to this particular file { - QFileInfo info( filename ); + TQFileInfo info( filename ); return info.isWritable(); } else //check that we can write to the directory since the file doesn't exist { - QFileInfo dir_info( info.dirPath( true ) ); + TQFileInfo dir_info( info.dirPath( true ) ); return dir_info.isWritable(); } } diff --git a/krecipes/src/dialogs/pagesetupdialog.h b/krecipes/src/dialogs/pagesetupdialog.h index 50d6f3e..e125188 100644 --- a/krecipes/src/dialogs/pagesetupdialog.h +++ b/krecipes/src/dialogs/pagesetupdialog.h @@ -11,7 +11,7 @@ #ifndef PAGESETUPDIALOG_H #define PAGESETUPDIALOG_H -#include <qmap.h> +#include <ntqmap.h> #include <kdialog.h> @@ -30,7 +30,7 @@ class PageSetupDialog : public KDialog Q_OBJECT public: - PageSetupDialog( QWidget *parent, const Recipe &sample, const QString &configEntry = QString::null ); + PageSetupDialog( TQWidget *parent, const Recipe &sample, const TQString &configEntry = TQString::null ); ~PageSetupDialog() {} @@ -42,7 +42,7 @@ protected: private slots: void loadFile(); void loadLayout( int ); - void loadLayout( const QString &filename ); + void loadLayout( const TQString &filename ); void loadTemplate( int ); void reloadLayout(); void saveLayout(); @@ -51,21 +51,21 @@ private slots: void setItemShown( int id ); private: - QString getIncludedLayoutDir() const; - void setActiveFile( const QString &filename ); - bool haveWritePerm( const QString &filename ); + TQString getIncludedLayoutDir() const; + void setActiveFile( const TQString &filename ); + bool haveWritePerm( const TQString &filename ); void initShownItems(); SetupDisplay *m_htmlPart; - QString active_filename; - QString active_template; + TQString active_filename; + TQString active_template; bool have_write_perm; - QString m_configEntry; + TQString m_configEntry; - QMap<int, KreDisplayItem*> popup_widget_map; - QMap<KreDisplayItem*, int> widget_popup_map; - QMap<int, QString> included_layouts_map; + TQMap<int, KreDisplayItem*> popup_widget_map; + TQMap<KreDisplayItem*, int> widget_popup_map; + TQMap<int, TQString> included_layouts_map; KPopupMenu *shown_items_popup; }; diff --git a/krecipes/src/dialogs/prepmethodsdialog.cpp b/krecipes/src/dialogs/prepmethodsdialog.cpp index 4b5d5e0..e74c1e5 100644 --- a/krecipes/src/dialogs/prepmethodsdialog.cpp +++ b/krecipes/src/dialogs/prepmethodsdialog.cpp @@ -20,27 +20,27 @@ #include <klocale.h> #include <kmessagebox.h> -PrepMethodsDialog::PrepMethodsDialog( QWidget* parent, RecipeDB *db ) : QWidget( parent ) +PrepMethodsDialog::PrepMethodsDialog( 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() ); //PrepMethod List prepMethodListView = new StdPrepMethodListView( this, database, true ); layout->addWidget( prepMethodListView ); //Buttons - QVBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); + TQVBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); - newPrepMethodButton = new QPushButton( this ); + newPrepMethodButton = new TQPushButton( this ); newPrepMethodButton->setText( i18n( "Create ..." ) ); newPrepMethodButton->setFlat( true ); vboxl->addWidget( newPrepMethodButton ); - removePrepMethodButton = new QPushButton( this ); + removePrepMethodButton = new TQPushButton( this ); removePrepMethodButton->setText( i18n( "Delete" ) ); removePrepMethodButton->setFlat( true ); vboxl->addWidget( removePrepMethodButton ); diff --git a/krecipes/src/dialogs/prepmethodsdialog.h b/krecipes/src/dialogs/prepmethodsdialog.h index d24c5c1..9b684e7 100644 --- a/krecipes/src/dialogs/prepmethodsdialog.h +++ b/krecipes/src/dialogs/prepmethodsdialog.h @@ -13,10 +13,10 @@ #ifndef PREPMETHODSDIALOG_H #define PREPMETHODSDIALOG_H -#include <qwidget.h> -#include <qpushbutton.h> -#include <qhbox.h> -#include <qlayout.h> +#include <ntqwidget.h> +#include <ntqpushbutton.h> +#include <ntqhbox.h> +#include <ntqlayout.h> #include <kiconloader.h> #include <klistview.h> @@ -29,25 +29,25 @@ class StdPrepMethodListView; @author Unai Garro */ -class PrepMethodsDialog: public QWidget +class PrepMethodsDialog: public TQWidget { Q_OBJECT public: - PrepMethodsDialog( QWidget* parent, RecipeDB *db ); + PrepMethodsDialog( TQWidget* parent, RecipeDB *db ); ~PrepMethodsDialog(); void reload( ReloadFlags flag = Load ); private: // Internal data RecipeDB *database; //Widgets - QGridLayout *layout; + TQGridLayout *layout; StdPrepMethodListView *prepMethodListView; - QHBox *buttonBar; - QPushButton *newPrepMethodButton; - QPushButton *removePrepMethodButton; + TQHBox *buttonBar; + TQPushButton *newPrepMethodButton; + TQPushButton *removePrepMethodButton; KIconLoader *il; }; #endif diff --git a/krecipes/src/dialogs/propertiesdialog.cpp b/krecipes/src/dialogs/propertiesdialog.cpp index 02ed6d9..8f5bcbd 100644 --- a/krecipes/src/dialogs/propertiesdialog.cpp +++ b/krecipes/src/dialogs/propertiesdialog.cpp @@ -20,7 +20,7 @@ #include "createpropertydialog.h" #include "widgets/propertylistview.h" -PropertiesDialog::PropertiesDialog( QWidget *parent, RecipeDB *db ) : QWidget( parent ) +PropertiesDialog::PropertiesDialog( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database @@ -28,27 +28,27 @@ PropertiesDialog::PropertiesDialog( QWidget *parent, RecipeDB *db ) : QWidget( p // Design dialog - QHBoxLayout* layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); propertyListView = new CheckPropertyListView( this, database, true ); propertyListView->reload(); KConfig *config = KGlobal::config(); config->setGroup("Formatting"); - QStringList hiddenList = config->readListEntry("HiddenProperties"); - for ( QCheckListItem *item = (QCheckListItem*)propertyListView->firstChild(); item; item = (QCheckListItem*)item->nextSibling() ) { + TQStringList hiddenList = config->readListEntry("HiddenProperties"); + for ( TQCheckListItem *item = (TQCheckListItem*)propertyListView->firstChild(); item; item = (TQCheckListItem*)item->nextSibling() ) { if ( !hiddenList.contains(item->text(0)) ) item->setOn(true); } layout->addWidget ( propertyListView ); - QVBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); - addPropertyButton = new QPushButton( this ); + TQVBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); + addPropertyButton = new TQPushButton( this ); addPropertyButton->setText( i18n( "Create ..." ) ); addPropertyButton->setFlat( true ); vboxl->addWidget( addPropertyButton ); - removePropertyButton = new QPushButton( this ); + removePropertyButton = new TQPushButton( this ); removePropertyButton->setText( i18n( "Delete" ) ); removePropertyButton->setFlat( true ); vboxl->addWidget( removePropertyButton ); diff --git a/krecipes/src/dialogs/propertiesdialog.h b/krecipes/src/dialogs/propertiesdialog.h index d197154..77638d3 100644 --- a/krecipes/src/dialogs/propertiesdialog.h +++ b/krecipes/src/dialogs/propertiesdialog.h @@ -13,9 +13,9 @@ #ifndef PROPERTIESDIALOG_H #define PROPERTIESDIALOG_H -#include <qlayout.h> -#include <qpushbutton.h> -#include <qvbox.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> +#include <ntqvbox.h> #include <klistview.h> class RecipeDB; @@ -24,11 +24,11 @@ class StdPropertyListView; /** @author Unai Garro */ -class PropertiesDialog: public QWidget +class PropertiesDialog: public TQWidget { Q_OBJECT public: - PropertiesDialog( QWidget *parent, RecipeDB *db ); + PropertiesDialog( TQWidget *parent, RecipeDB *db ); ~PropertiesDialog(); void reload( void ); @@ -37,9 +37,9 @@ private: RecipeDB *database; // Widgets - QGridLayout* layout; - QPushButton* addPropertyButton; - QPushButton* removePropertyButton; + TQGridLayout* layout; + TQPushButton* addPropertyButton; + TQPushButton* removePropertyButton; StdPropertyListView* propertyListView; }; diff --git a/krecipes/src/dialogs/recipeimportdialog.cpp b/krecipes/src/dialogs/recipeimportdialog.cpp index a57ba69..40e8448 100644 --- a/krecipes/src/dialogs/recipeimportdialog.cpp +++ b/krecipes/src/dialogs/recipeimportdialog.cpp @@ -17,22 +17,22 @@ #include <klistview.h> #include <kdebug.h> -#include <qvbox.h> -#include <qlayout.h> -#include <qheader.h> -#include <qvariant.h> -#include <qdict.h> +#include <ntqvbox.h> +#include <ntqlayout.h> +#include <ntqheader.h> +#include <ntqvariant.h> +#include <ntqdict.h> #include "datablocks/recipe.h" -RecipeImportDialog::RecipeImportDialog( const RecipeList &list, QWidget *parent ) +RecipeImportDialog::RecipeImportDialog( const RecipeList &list, TQWidget *parent ) : KDialogBase( parent, "RecipeImportDialog", true, i18n( "Import Recipes" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), list_copy( list ) { setButtonBoxOrientation( Vertical ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); kListView = new KListView( page ); kListView->addColumn( i18n( "Recipes" ) ); @@ -42,7 +42,7 @@ RecipeImportDialog::RecipeImportDialog( const RecipeList &list, QWidget *parent languageChange(); - setInitialSize( QSize( 600, 480 ).expandedTo( minimumSizeHint() ) ); + setInitialSize( TQSize( 600, 480 ).expandedTo( minimumSizeHint() ) ); loadListView(); } @@ -58,11 +58,11 @@ void RecipeImportDialog::languageChange() void RecipeImportDialog::loadListView() { - CustomCheckListItem * head_item = new CustomCheckListItem( kListView, QString( i18n( "All (%1)" ) ).arg( list_copy.count() ), QCheckListItem::CheckBox ); + CustomCheckListItem * head_item = new CustomCheckListItem( kListView, TQString( i18n( "All (%1)" ) ).arg( list_copy.count() ), TQCheckListItem::CheckBox ); head_item->setOpen( true ); //get all categories - QStringList categoryList; + TQStringList categoryList; RecipeList::const_iterator recipe_it; for ( recipe_it = list_copy.begin(); recipe_it != list_copy.end(); ++recipe_it ) { @@ -73,18 +73,18 @@ void RecipeImportDialog::loadListView() } //create all category check list items - QDict<CustomCheckListItem> all_categories; + TQDict<CustomCheckListItem> all_categories; - QStringList::iterator it; + TQStringList::iterator it; for ( it = categoryList.begin(); it != categoryList.end(); ++it ) { - CustomCheckListItem *category_item = new CustomCheckListItem( head_item, *it, QCheckListItem::CheckBox ); + CustomCheckListItem *category_item = new CustomCheckListItem( head_item, *it, TQCheckListItem::CheckBox ); //category_item->setOpen(true); all_categories.insert( *it, category_item ); } //add recipes to category check list items - recipe_items = new QMap<CustomCheckListItem*, RecipeList::const_iterator>; //we won't be able to identify a recipe later if we just put a value in here. The iterator will be unique so we'll use it. This is safe since the list is constant (iterators won't become invlalid). + recipe_items = new TQMap<CustomCheckListItem*, RecipeList::const_iterator>; //we won't be able to identify a recipe later if we just put a value in here. The iterator will be unique so we'll use it. This is safe since the list is constant (iterators won't become invlalid). CustomCheckListItem *item = 0; CustomCheckListItem *category_item = 0; @@ -93,10 +93,10 @@ void RecipeImportDialog::loadListView() if ( ( *recipe_it ).categoryList.count() == 0 ) { if ( !category_item ) //don't create this until there are recipes to put in it { - category_item = new CustomCheckListItem( head_item, i18n( "Uncategorized" ), QCheckListItem::CheckBox ); + category_item = new CustomCheckListItem( head_item, i18n( "Uncategorized" ), TQCheckListItem::CheckBox ); all_categories.insert( i18n( "Uncategorized" ), category_item ); } - CustomCheckListItem *item = new CustomCheckListItem( category_item, ( *recipe_it ).title, QCheckListItem::CheckBox ); + CustomCheckListItem *item = new CustomCheckListItem( category_item, ( *recipe_it ).title, TQCheckListItem::CheckBox ); recipe_items->insert( item, recipe_it ); } else { @@ -104,20 +104,20 @@ void RecipeImportDialog::loadListView() CustomCheckListItem *category_item = all_categories[ ( *cat_it ).name ]; - item = new CustomCheckListItem( category_item, item, ( *recipe_it ).title, QCheckListItem::CheckBox ); + item = new CustomCheckListItem( category_item, item, ( *recipe_it ).title, TQCheckListItem::CheckBox ); recipe_items->insert( item, recipe_it ); } } } //append the number of recipes in each category to the check list item text - QDictIterator<CustomCheckListItem> categories_it( all_categories ); + TQDictIterator<CustomCheckListItem> categories_it( all_categories ); for ( ; categories_it.current(); ++categories_it ) { int count = 0; - for ( QCheckListItem * it = static_cast<QCheckListItem*>( categories_it.current() ->firstChild() ); it; it = static_cast<QCheckListItem*>( it->nextSibling() ) ) { + for ( TQCheckListItem * it = static_cast<TQCheckListItem*>( categories_it.current() ->firstChild() ); it; it = static_cast<TQCheckListItem*>( it->nextSibling() ) ) { count++; } - categories_it.current() ->setText( 0, categories_it.current() ->text( 0 ) + QString( " (%1)" ).arg( count ) ); + categories_it.current() ->setText( 0, categories_it.current() ->text( 0 ) + TQString( " (%1)" ).arg( count ) ); } head_item->setOn( true ); //this will check all recipes @@ -127,9 +127,9 @@ RecipeList RecipeImportDialog::getSelectedRecipes() { RecipeList selected_recipes; - QValueList<RecipeList::const_iterator> already_included_recipes; + TQValueList<RecipeList::const_iterator> already_included_recipes; - QMap<CustomCheckListItem*, RecipeList::const_iterator>::const_iterator it; + TQMap<CustomCheckListItem*, RecipeList::const_iterator>::const_iterator it; for ( it = recipe_items->begin(); it != recipe_items->end(); ++it ) { if ( static_cast<CustomCheckListItem*>( it.key() ) ->isOn() && ( already_included_recipes.contains( it.data() ) == 0 ) ) //make sure it isn't already in the list @@ -142,28 +142,28 @@ RecipeList RecipeImportDialog::getSelectedRecipes() return selected_recipes; } -CustomCheckListItem::CustomCheckListItem( QListView *parent, const QString & s, Type t ) - : QCheckListItem( parent, s, t ), m_locked( false ) +CustomCheckListItem::CustomCheckListItem( TQListView *parent, const TQString & s, Type t ) + : TQCheckListItem( parent, s, t ), m_locked( false ) {} -CustomCheckListItem::CustomCheckListItem( CustomCheckListItem *parent, const QString & s, Type t ) - : QCheckListItem( parent, s, t ), m_locked( false ) +CustomCheckListItem::CustomCheckListItem( CustomCheckListItem *parent, const TQString & s, Type t ) + : TQCheckListItem( parent, s, t ), m_locked( false ) {} -CustomCheckListItem::CustomCheckListItem( QCheckListItem *parent, QCheckListItem *after, const QString & s, Type t ) - : QCheckListItem( parent, after, s, t ), m_locked( false ) +CustomCheckListItem::CustomCheckListItem( TQCheckListItem *parent, TQCheckListItem *after, const TQString & s, Type t ) + : TQCheckListItem( parent, after, s, t ), m_locked( false ) {} void CustomCheckListItem::stateChange( bool on ) { if ( !m_locked ) { - for ( QCheckListItem * it = static_cast<QCheckListItem*>( firstChild() ); it; it = static_cast<QCheckListItem*>( it->nextSibling() ) ) { + for ( TQCheckListItem * it = static_cast<TQCheckListItem*>( firstChild() ); it; it = static_cast<TQCheckListItem*>( it->nextSibling() ) ) { it->setOn( on ); } } if ( !on ) { - QListViewItem * parent = this->parent(); + TQListViewItem * parent = this->parent(); if ( parent && ( parent->rtti() == 1 ) ) { CustomCheckListItem * item = static_cast<CustomCheckListItem*>( parent ); item->setLocked( true ); @@ -172,8 +172,8 @@ void CustomCheckListItem::stateChange( bool on ) } } - QString thisText = text(0); - QListViewItemIterator it( listView() ); + TQString thisText = text(0); + TQListViewItemIterator it( listView() ); while ( it.current() ) { if ( it.current()->rtti() == 1 && it.current()->text(0) == thisText ) { CustomCheckListItem * item = static_cast<CustomCheckListItem*>( it.current() ); diff --git a/krecipes/src/dialogs/recipeimportdialog.h b/krecipes/src/dialogs/recipeimportdialog.h index d41c1b4..7339c65 100644 --- a/krecipes/src/dialogs/recipeimportdialog.h +++ b/krecipes/src/dialogs/recipeimportdialog.h @@ -13,9 +13,9 @@ #ifndef RECIPEIMPORTDIALOG_H #define RECIPEIMPORTDIALOG_H -#include <qvaluelist.h> -#include <qmap.h> -#include <qlistview.h> +#include <ntqvaluelist.h> +#include <ntqmap.h> +#include <ntqlistview.h> #include <kdialogbase.h> @@ -23,7 +23,7 @@ class KListView; -class QListViewItem; +class TQListViewItem; class Recipe; class CustomCheckListItem; @@ -34,7 +34,7 @@ class CustomCheckListItem; class RecipeImportDialog : public KDialogBase { public: - RecipeImportDialog( const RecipeList &all_recipes, QWidget *parent = 0 ); + RecipeImportDialog( const RecipeList &all_recipes, TQWidget *parent = 0 ); ~RecipeImportDialog(); RecipeList getSelectedRecipes(); @@ -47,20 +47,20 @@ private: KListView* kListView; - QMap<CustomCheckListItem*, RecipeList::const_iterator> *recipe_items; + TQMap<CustomCheckListItem*, RecipeList::const_iterator> *recipe_items; const RecipeList list_copy; }; -/** A specialized QCheckListItem that sets the state of its children to its +/** A specialized TQCheckListItem that sets the state of its children to its * current state. * @author Jason Kivlighn */ -class CustomCheckListItem : public QCheckListItem +class CustomCheckListItem : public TQCheckListItem { public: - CustomCheckListItem( QListView *parent, const QString &, Type ); - CustomCheckListItem( CustomCheckListItem *parent, const QString &, Type ); - CustomCheckListItem( QCheckListItem *parent, QCheckListItem *after, const QString &, Type ); + CustomCheckListItem( TQListView *parent, const TQString &, Type ); + CustomCheckListItem( CustomCheckListItem *parent, const TQString &, Type ); + CustomCheckListItem( TQCheckListItem *parent, TQCheckListItem *after, const TQString &, Type ); protected: virtual void stateChange( bool ); diff --git a/krecipes/src/dialogs/recipeinputdialog.cpp b/krecipes/src/dialogs/recipeinputdialog.cpp index 7595a53..76a0c82 100644 --- a/krecipes/src/dialogs/recipeinputdialog.cpp +++ b/krecipes/src/dialogs/recipeinputdialog.cpp @@ -14,19 +14,19 @@ #include "recipeinputdialog.h" -#include <qstring.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qimage.h> -#include <qmessagebox.h> -#include <qtooltip.h> -#include <qdatetimeedit.h> -#include <qdragobject.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qwidgetstack.h> -#include <qpainter.h> +#include <ntqstring.h> +#include <ntqlayout.h> +#include <ntqhbox.h> +#include <ntqvbox.h> +#include <ntqimage.h> +#include <ntqmessagebox.h> +#include <ntqtooltip.h> +#include <ntqdatetimeedit.h> +#include <ntqdragobject.h> +#include <ntqbuttongroup.h> +#include <ntqradiobutton.h> +#include <ntqwidgetstack.h> +#include <ntqpainter.h> #include <kapplication.h> #include <kcompletionbox.h> @@ -62,34 +62,34 @@ typedef enum ColorStatus { GreenStatus, RedStatus, YellowStatus }; -ClickableLed::ClickableLed( QWidget *parent ) : KLed(parent) +ClickableLed::ClickableLed( TQWidget *parent ) : KLed(parent) { } -void ClickableLed::mouseReleaseEvent( QMouseEvent* ) +void ClickableLed::mouseReleaseEvent( TQMouseEvent* ) { emit clicked(); } -ImageDropLabel::ImageDropLabel( QWidget *parent, QPixmap &_sourcePhoto ) : QLabel( parent ), +ImageDropLabel::ImageDropLabel( TQWidget *parent, TQPixmap &_sourcePhoto ) : TQLabel( parent ), sourcePhoto( _sourcePhoto ) { setAcceptDrops( TRUE ); } -void ImageDropLabel::dragEnterEvent( QDragEnterEvent* event ) +void ImageDropLabel::dragEnterEvent( TQDragEnterEvent* event ) { - event->accept( QImageDrag::canDecode( event ) ); + event->accept( TQImageDrag::canDecode( event ) ); } -void ImageDropLabel::dropEvent( QDropEvent* event ) +void ImageDropLabel::dropEvent( TQDropEvent* event ) { - QImage image; + TQImage image; - if ( QImageDrag::decode( event, image ) ) { + if ( TQImageDrag::decode( event, image ) ) { if ( ( image.width() > width() || image.height() > height() ) || ( image.width() < width() && image.height() < height() ) ) { - QPixmap pm_scaled; - pm_scaled.convertFromImage( image.smoothScale( width(), height(), QImage::ScaleMin ) ); + TQPixmap pm_scaled; + pm_scaled.convertFromImage( image.smoothScale( width(), height(), TQImage::ScaleMin ) ); setPixmap( pm_scaled ); sourcePhoto = pm_scaled; // to save scaled later on @@ -104,157 +104,157 @@ void ImageDropLabel::dropEvent( QDropEvent* event ) } -RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( parent ) +RecipeInputDialog::RecipeInputDialog( TQWidget* parent, RecipeDB *db ) : TQVBox( parent ) { // Adjust internal parameters loadedRecipe = new Recipe(); loadedRecipe->recipeID = -1; // No loaded recipe initially - loadedRecipe->title = QString::null; - loadedRecipe->instructions = QString::null; + loadedRecipe->title = TQString::null; + loadedRecipe->instructions = TQString::null; database = db; KIconLoader *il = new KIconLoader; // Tabs - tabWidget = new QTabWidget( this, "tabWidget" ); - tabWidget->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + tabWidget = new TQTabWidget( this, "tabWidget" ); + tabWidget->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); //------- Recipe Tab ----------------- // Recipe Photo - recipeTab = new QGroupBox( tabWidget ); - recipeTab->setFrameStyle( QFrame::NoFrame ); - recipeTab->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + recipeTab = new TQGroupBox( tabWidget ); + recipeTab->setFrameStyle( TQFrame::NoFrame ); + recipeTab->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); // Design the Dialog - QGridLayout* recipeLayout = new QGridLayout( recipeTab, 1, 1, 0, 0 ); + TQGridLayout* recipeLayout = new TQGridLayout( recipeTab, 1, 1, 0, 0 ); // Border - QSpacerItem* spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); recipeLayout->addItem( spacer_left, 1, 0 ); - QSpacerItem* spacer_right = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_right = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); recipeLayout->addItem( spacer_right, 1, 8 ); - QSpacerItem* spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum , QSizePolicy::Fixed ); + TQSpacerItem* spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum , TQSizePolicy::Fixed ); recipeLayout->addItem( spacer_top, 0, 1 ); - QSpacerItem* spacer_bottom = new QSpacerItem( 10, 10, QSizePolicy::Minimum , QSizePolicy::MinimumExpanding ); + TQSpacerItem* spacer_bottom = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum , TQSizePolicy::MinimumExpanding ); recipeLayout->addItem( spacer_bottom, 8, 1 ); - QPixmap image1( defaultPhoto ); + TQPixmap image1( defaultPhoto ); photoLabel = new ImageDropLabel( recipeTab, sourcePhoto ); photoLabel->setPixmap( image1 ); - photoLabel->setFixedSize( QSize( 221, 166 ) ); - photoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - photoLabel->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); + photoLabel->setFixedSize( TQSize( 221, 166 ) ); + photoLabel->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); + photoLabel->setAlignment( TQt::AlignHCenter | TQt::AlignVCenter ); recipeLayout->addMultiCellWidget( photoLabel, 3, 7, 1, 1 ); - QVBox *photoButtonsBox = new QVBox( recipeTab ); + TQVBox *photoButtonsBox = new TQVBox( recipeTab ); - changePhotoButton = new QPushButton( photoButtonsBox ); - changePhotoButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ) ); + changePhotoButton = new TQPushButton( photoButtonsBox ); + changePhotoButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Ignored ) ); changePhotoButton->setText( "..." ); - QToolTip::add + TQToolTip::add ( changePhotoButton, i18n( "Select photo" ) ); - QPushButton *clearPhotoButton = new QPushButton( photoButtonsBox ); + TQPushButton *clearPhotoButton = new TQPushButton( photoButtonsBox ); clearPhotoButton->setPixmap( il->loadIcon( "clear_left", KIcon::NoGroup, 16 ) ); - QToolTip::add + TQToolTip::add ( clearPhotoButton, i18n( "Clear photo" ) ); recipeLayout->addMultiCellWidget( photoButtonsBox, 3, 7, 2, 2 ); //Title->photo spacer - QSpacerItem* title_photo = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* title_photo = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); recipeLayout->addItem( title_photo, 2, 3 ); // Title - QVBox *titleBox = new QVBox( recipeTab ); + TQVBox *titleBox = new TQVBox( recipeTab ); titleBox->setSpacing( 5 ); - titleLabel = new QLabel( i18n( "Recipe Name" ), titleBox ); + titleLabel = new TQLabel( i18n( "Recipe Name" ), titleBox ); titleEdit = new KLineEdit( titleBox ); - titleEdit->setMinimumSize( QSize( 360, 30 ) ); - titleEdit->setMaximumSize( QSize( 10000, 30 ) ); - titleEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + titleEdit->setMinimumSize( TQSize( 360, 30 ) ); + titleEdit->setMaximumSize( TQSize( 10000, 30 ) ); + titleEdit->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); recipeLayout->addMultiCellWidget( titleBox, 1, 1, 1, 7 ); // Photo ->author spacer - QSpacerItem* title_spacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* title_spacer = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); recipeLayout->addItem( title_spacer, 2, 1 ); // Author(s) & Categories - QVBox *authorBox = new QVBox( recipeTab ); // contains label and authorInput (input widgets) + TQVBox *authorBox = new TQVBox( recipeTab ); // contains label and authorInput (input widgets) authorBox->setSpacing( 5 ); recipeLayout->addWidget( authorBox, 3, 4 ); - authorLabel = new QLabel( i18n( "Authors" ), authorBox ); - QHBox *authorInput = new QHBox( authorBox ); // Contains input + button + authorLabel = new TQLabel( i18n( "Authors" ), authorBox ); + TQHBox *authorInput = new TQHBox( authorBox ); // Contains input + button authorShow = new KLineEdit( authorInput ); authorShow->setReadOnly( true ); - authorShow->setMinimumSize( QSize( 100, 20 ) ); - authorShow->setMaximumSize( QSize( 10000, 20 ) ); - authorShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + authorShow->setMinimumSize( TQSize( 100, 20 ) ); + authorShow->setMaximumSize( TQSize( 10000, 20 ) ); + authorShow->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); - addAuthorButton = new QPushButton( authorInput ); + addAuthorButton = new TQPushButton( authorInput ); addAuthorButton->setText( "+" ); - addAuthorButton->setFixedSize( QSize( 20, 20 ) ); + addAuthorButton->setFixedSize( TQSize( 20, 20 ) ); addAuthorButton->setFlat( true ); - QSpacerItem* author_category = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* author_category = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); recipeLayout->addItem( author_category, 3, 5 ); - QVBox *categoryBox = new QVBox( recipeTab ); // Contains the label and categoryInput (input widgets) + TQVBox *categoryBox = new TQVBox( recipeTab ); // Contains the label and categoryInput (input widgets) categoryBox->setSpacing( 5 ); - categoryLabel = new QLabel( i18n( "Categories" ), categoryBox ); - QHBox *categoryInput = new QHBox( categoryBox ); // Contains the input widgets + categoryLabel = new TQLabel( i18n( "Categories" ), categoryBox ); + TQHBox *categoryInput = new TQHBox( categoryBox ); // Contains the input widgets categoryShow = new KLineEdit( categoryInput ); categoryShow->setReadOnly( true ); - categoryShow->setMinimumSize( QSize( 100, 20 ) ); - categoryShow->setMaximumSize( QSize( 10000, 20 ) ); - categoryShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + categoryShow->setMinimumSize( TQSize( 100, 20 ) ); + categoryShow->setMaximumSize( TQSize( 10000, 20 ) ); + categoryShow->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); recipeLayout->addWidget( categoryBox, 4, 4 ); - addCategoryButton = new QPushButton( categoryInput ); + addCategoryButton = new TQPushButton( categoryInput ); addCategoryButton->setText( "+" ); - addCategoryButton->setFixedSize( QSize( 20, 20 ) ); + addCategoryButton->setFixedSize( TQSize( 20, 20 ) ); addCategoryButton->setFlat( true ); //Category ->Servings spacer - QSpacerItem* category_yield = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* category_yield = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); recipeLayout->addItem( category_yield, 5, 4 ); - QHBox *serv_prep_box = new QHBox( recipeTab ); + TQHBox *serv_prep_box = new TQHBox( recipeTab ); serv_prep_box->setSpacing( 5 ); // Backup options - QGroupBox *yieldGBox = new QGroupBox( serv_prep_box, "yieldGBox" ); + TQGroupBox *yieldGBox = new TQGroupBox( serv_prep_box, "yieldGBox" ); yieldGBox->setTitle( i18n( "Yield" ) ); yieldGBox->setColumns( 2 ); - yieldLabel = new QLabel( i18n( "Amount" ), yieldGBox ); - /*QLabel *yieldTypeLabel = */new QLabel( i18n( "Type" ), yieldGBox ); + yieldLabel = new TQLabel( i18n( "Amount" ), yieldGBox ); + /*TQLabel *yieldTypeLabel = */new TQLabel( i18n( "Type" ), yieldGBox ); yieldNumInput = new FractionInput( yieldGBox ); yieldNumInput->setAllowRange(true); yieldTypeEdit = new KLineEdit( yieldGBox ); - QVBox *prepTimeBox = new QVBox( serv_prep_box ); - prepTimeBox->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) ); + TQVBox *prepTimeBox = new TQVBox( serv_prep_box ); + prepTimeBox->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); prepTimeBox->setSpacing( 5 ); - ( void ) new QLabel( i18n( "Preparation Time" ), prepTimeBox ); - prepTimeEdit = new QTimeEdit( prepTimeBox ); - prepTimeEdit->setMinValue( QTime( 0, 0 ) ); - prepTimeEdit->setDisplay( QTimeEdit::Hours | QTimeEdit::Minutes ); + ( void ) new TQLabel( i18n( "Preparation Time" ), prepTimeBox ); + prepTimeEdit = new TQTimeEdit( prepTimeBox ); + prepTimeEdit->setMinValue( TQTime( 0, 0 ) ); + prepTimeEdit->setDisplay( TQTimeEdit::Hours | TQTimeEdit::Minutes ); recipeLayout->addWidget( serv_prep_box, 6, 4 ); @@ -262,15 +262,15 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p //------- Ingredients Tab ----------------- - ingredientGBox = new QGroupBox( recipeTab ); - ingredientGBox->setFrameStyle( QFrame::NoFrame ); - ingredientGBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); - QGridLayout* ingredientsLayout = new QGridLayout( ingredientGBox ); + ingredientGBox = new TQGroupBox( recipeTab ); + ingredientGBox->setFrameStyle( TQFrame::NoFrame ); + ingredientGBox->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); + TQGridLayout* ingredientsLayout = new TQGridLayout( ingredientGBox ); // Border - QSpacerItem* spacerBoxLeft = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacerBoxLeft = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); ingredientsLayout->addItem( spacerBoxLeft, 1, 0 ); - QSpacerItem* spacerBoxTop = new QSpacerItem( 10, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerBoxTop = new TQSpacerItem( 10, 20, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); ingredientsLayout->addItem( spacerBoxTop, 0, 1 ); //Input Widgets @@ -278,98 +278,98 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p ingredientsLayout->addMultiCellWidget( ingInput, 1, 1, 1, 5 ); // Spacers to list and buttons - QSpacerItem* spacerToList = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerToList = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); ingredientsLayout->addItem( spacerToList, 2, 1 ); - QSpacerItem* spacerToButtons = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacerToButtons = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); ingredientsLayout->addItem( spacerToButtons, 3, 4 ); // Add, Up,down,... buttons addButton = new KPushButton( ingredientGBox ); - addButton->setFixedSize( QSize( 31, 31 ) ); + addButton->setFixedSize( TQSize( 31, 31 ) ); addButton->setFlat( true ); - QPixmap pm = il->loadIcon( "new", KIcon::NoGroup, 16 ); + TQPixmap pm = il->loadIcon( "new", KIcon::NoGroup, 16 ); addButton->setPixmap( pm ); - addButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + addButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); ingredientsLayout->addWidget( addButton, 3, 5 ); // Spacer to the rest of buttons - QSpacerItem* spacerToOtherButtons = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerToOtherButtons = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); ingredientsLayout->addItem( spacerToOtherButtons, 4, 5 ); upButton = new KPushButton( ingredientGBox ); - upButton->setFixedSize( QSize( 31, 31 ) ); + upButton->setFixedSize( TQSize( 31, 31 ) ); upButton->setFlat( true ); pm = il->loadIcon( "up", KIcon::NoGroup, 16 ); upButton->setPixmap( pm ); - upButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + upButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); ingredientsLayout->addWidget( upButton, 5, 5 ); downButton = new KPushButton( ingredientGBox ); - downButton->setFixedSize( QSize( 31, 31 ) ); + downButton->setFixedSize( TQSize( 31, 31 ) ); downButton->setFlat( true ); pm = il->loadIcon( "down", KIcon::NoGroup, 16 ); downButton->setPixmap( pm ); - downButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + downButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); ingredientsLayout->addWidget( downButton, 6, 5 ); removeButton = new KPushButton( ingredientGBox ); - removeButton->setFixedSize( QSize( 31, 31 ) ); + removeButton->setFixedSize( TQSize( 31, 31 ) ); removeButton->setFlat( true ); pm = il->loadIcon( "remove", KIcon::NoGroup, 16 ); removeButton->setPixmap( pm ); - removeButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + removeButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); ingredientsLayout->addWidget( removeButton, 7, 5 ); ingParserButton = new KPushButton( ingredientGBox ); - ingParserButton->setFixedSize( QSize( 31, 31 ) ); + ingParserButton->setFixedSize( TQSize( 31, 31 ) ); ingParserButton->setFlat( true ); pm = il->loadIcon( "editpaste", KIcon::NoGroup, 16 ); ingParserButton->setPixmap( pm ); - ingParserButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + ingParserButton->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) ); ingredientsLayout->addWidget( ingParserButton, 8, 5 ); - QToolTip::add + TQToolTip::add ( addButton, i18n( "Add ingredient" ) ); - QToolTip::add + TQToolTip::add ( upButton, i18n( "Move ingredient up" ) ); - QToolTip::add + TQToolTip::add ( downButton, i18n( "Move ingredient down" ) ); - QToolTip::add + TQToolTip::add ( removeButton, i18n( "Remove ingredient" ) ); - QToolTip::add + TQToolTip::add ( ingParserButton, i18n( "Paste Ingredients" ) ); // Ingredient List ingredientList = new KListView( ingredientGBox, "ingredientList" ); ingredientList->addColumn( i18n( "Ingredient" ) ); ingredientList->addColumn( i18n( "Amount" ) ); - ingredientList->setColumnAlignment( 1, Qt::AlignHCenter ); + ingredientList->setColumnAlignment( 1, TQt::AlignHCenter ); ingredientList->addColumn( i18n( "Units" ) ); ingredientList->addColumn( i18n( "Preparation Method" ) ); ingredientList->setSorting( -1 ); // Do not sort - ingredientList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::MinimumExpanding ) ); + ingredientList->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::MinimumExpanding ) ); ingredientList->setItemsRenameable( true ); ingredientList->setRenameable( 0, false ); //name ingredientList->setRenameable( 1, true ); //amount ingredientList->setRenameable( 2, true ); //units ingredientList->setRenameable( 3, true ); //prep method - ingredientList->setDefaultRenameAction( QListView::Reject ); + ingredientList->setDefaultRenameAction( TQListView::Reject ); ingredientsLayout->addMultiCellWidget( ingredientList, 3, 9, 1, 3 ); - QHBoxLayout *propertyStatusLayout = new QHBoxLayout( ingredientGBox, 0, 5 ); - QLabel *propertyLabel = new QLabel( i18n("Property Status:"), ingredientGBox ); - propertyStatusLabel = new QLabel( ingredientGBox ); + TQHBoxLayout *propertyStatusLayout = new TQHBoxLayout( ingredientGBox, 0, 5 ); + TQLabel *propertyLabel = new TQLabel( i18n("Property Status:"), ingredientGBox ); + propertyStatusLabel = new TQLabel( ingredientGBox ); propertyStatusLed = new ClickableLed( ingredientGBox ); - propertyStatusLed->setFixedSize( QSize(16,16) ); - propertyStatusButton = new QPushButton( i18n("Details..."), ingredientGBox ); - //QPushButton *propertyUpdateButton = new QPushButton( i18n("Update"), ingredientGBox ); + propertyStatusLed->setFixedSize( TQSize(16,16) ); + propertyStatusButton = new TQPushButton( i18n("Details..."), ingredientGBox ); + //TQPushButton *propertyUpdateButton = new TQPushButton( i18n("Update"), ingredientGBox ); propertyStatusLayout->addWidget( propertyLabel ); propertyStatusLayout->addWidget( propertyStatusLabel ); propertyStatusLayout->addWidget( propertyStatusLed ); propertyStatusLayout->addWidget( propertyStatusButton ); //propertyStatusLayout->addWidget( propertyUpdateButton ); - QSpacerItem* propertySpacerRight = new QSpacerItem( 10, 10, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); + TQSpacerItem* propertySpacerRight = new TQSpacerItem( 10, 10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum ); propertyStatusLayout->addItem( propertySpacerRight ); KGuiItem updateGuiItem; @@ -381,8 +381,8 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p updateGuiItem ); propertyStatusDialog->setHelp("property-status"); - statusTextView = new QTextEdit(0); - statusTextView->setTextFormat( Qt::RichText ); + statusTextView = new TQTextEdit(0); + statusTextView->setTextFormat( TQt::RichText ); statusTextView->setReadOnly(true); propertyStatusDialog->setMainWidget( statusTextView ); propertyStatusDialog->resize( 400, 300 ); @@ -391,20 +391,20 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p // ------- Recipe Instructions Tab ----------- - instructionsTab = new QGroupBox( recipeTab ); - instructionsTab->setFrameStyle( QFrame::NoFrame ); - instructionsTab->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + instructionsTab = new TQGroupBox( recipeTab ); + instructionsTab->setFrameStyle( TQFrame::NoFrame ); + instructionsTab->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); - QVBoxLayout *instructionsLayout = new QVBoxLayout( instructionsTab ); + TQVBoxLayout *instructionsLayout = new TQVBoxLayout( instructionsTab ); instructionsEdit = new KreTextEdit( instructionsTab ); - instructionsEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + instructionsEdit->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); instructionsEdit->setTabChangesFocus ( true ); instructionsLayout->addWidget( instructionsEdit ); - spellCheckButton = new QToolButton( instructionsTab ); + spellCheckButton = new TQToolButton( instructionsTab ); spellCheckButton->setIconSet( il->loadIconSet( "spellcheck", KIcon::Small ) ); - QToolTip::add + TQToolTip::add ( spellCheckButton, i18n( "Check spelling" ) ); instructionsLayout->addWidget( spellCheckButton ); @@ -413,9 +413,9 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p // ------- Recipe Ratings Tab ----------- - QVBox *ratingsTab = new QVBox(recipeTab); + TQVBox *ratingsTab = new TQVBox(recipeTab); ratingListDisplayWidget = new KWidgetListbox(ratingsTab); - QPushButton *addRatingButton = new QPushButton(i18n("Add Rating..."),ratingsTab); + TQPushButton *addRatingButton = new TQPushButton(i18n("Add Rating..."),ratingsTab); connect( addRatingButton, SIGNAL(clicked()), this, SLOT(slotAddRating()) ); @@ -429,19 +429,19 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p // Functions Box - QHBox* functionsLayout = new QHBox( this ); + TQHBox* functionsLayout = new TQHBox( this ); - functionsBox = new QGroupBox( 1, Qt::Vertical, functionsLayout ); - functionsBox->setFrameStyle( QFrame::NoFrame ); + functionsBox = new TQGroupBox( 1, TQt::Vertical, functionsLayout ); + functionsBox->setFrameStyle( TQFrame::NoFrame ); - saveButton = new QToolButton( functionsBox ); + saveButton = new TQToolButton( functionsBox ); saveButton->setIconSet( il->loadIconSet( "filesave", KIcon::Small ) ); saveButton->setEnabled( false ); - showButton = new QToolButton( functionsBox ); + showButton = new TQToolButton( functionsBox ); showButton->setIconSet( il->loadIconSet( "viewmag", KIcon::Small ) ); - closeButton = new QToolButton( functionsBox ); + closeButton = new TQToolButton( functionsBox ); closeButton->setIconSet( il->loadIconSet( "fileclose", KIcon::Small ) ); - resizeButton = new QToolButton( functionsBox ); + resizeButton = new TQToolButton( functionsBox ); resizeButton->setIconSet( il->loadIconSet( "2uparrow", KIcon::Small ) ); //TODO: give me an icon :) saveButton->setTextLabel( i18n( "Save recipe" ), true ); @@ -453,7 +453,7 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p resizeButton->setTextLabel( i18n( "Resize recipe" ), true ); resizeButton->setUsesTextLabel( true ); - functionsLayout->layout() ->addItem( new QSpacerItem( 10, 10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + functionsLayout->layout() ->addItem( new TQSpacerItem( 10, 10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); // Dialog design tabWidget->resize( size().expandedTo( minimumSizeHint() ) ); @@ -473,15 +473,15 @@ RecipeInputDialog::RecipeInputDialog( QWidget* parent, RecipeDB *db ) : QVBox( p connect( ingParserButton, SIGNAL( clicked() ), this, SLOT( slotIngredientParser() ) ); connect( photoLabel, SIGNAL( changed() ), this, SIGNAL( changed() ) ); connect( this, SIGNAL( changed() ), this, SLOT( recipeChanged() ) ); - connect( yieldNumInput, SIGNAL( textChanged( const QString & ) ), this, SLOT( recipeChanged() ) ); - connect( yieldTypeEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( recipeChanged() ) ); - connect( prepTimeEdit, SIGNAL( valueChanged( const QTime & ) ), SLOT( recipeChanged() ) ); - connect( titleEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( recipeChanged( const QString& ) ) ); + connect( yieldNumInput, SIGNAL( textChanged( const TQString & ) ), this, SLOT( recipeChanged() ) ); + connect( yieldTypeEdit, SIGNAL( textChanged( const TQString & ) ), this, SLOT( recipeChanged() ) ); + connect( prepTimeEdit, SIGNAL( valueChanged( const TQTime & ) ), SLOT( recipeChanged() ) ); + connect( titleEdit, SIGNAL( textChanged( const TQString& ) ), this, SLOT( recipeChanged( const TQString& ) ) ); connect( instructionsEdit, SIGNAL( textChanged() ), this, SLOT( recipeChanged() ) ); connect( addCategoryButton, SIGNAL( clicked() ), this, SLOT( addCategory() ) ); connect( addAuthorButton, SIGNAL( clicked() ), this, SLOT( addAuthor() ) ); - connect( titleEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( prepTitleChanged( const QString& ) ) ); - connect( ingredientList, SIGNAL( itemRenamed( QListViewItem*, const QString &, int ) ), SLOT( syncListView( QListViewItem*, const QString &, int ) ) ); + connect( titleEdit, SIGNAL( textChanged( const TQString& ) ), this, SLOT( prepTitleChanged( const TQString& ) ) ); + connect( ingredientList, SIGNAL( itemRenamed( TQListViewItem*, const TQString &, int ) ), SLOT( syncListView( TQListViewItem*, const TQString &, int ) ) ); connect ( ingInput, SIGNAL( ingredientEntered(const Ingredient&) ), this, SLOT( addIngredient(const Ingredient&) ) ); connect ( ingInput, SIGNAL( headerEntered(const Element&) ), this, SLOT( addIngredientHeader(const Element&) ) ); @@ -520,11 +520,11 @@ void RecipeInputDialog::recipeRemoved( int id ) } } -void RecipeInputDialog::prepTitleChanged( const QString &title ) +void RecipeInputDialog::prepTitleChanged( const TQString &title ) { //we don't want the menu to grow due to a long title //### KStringHandler::rsqueeze does this but I can't remember when it was added (compatibility issue...) - QString short_title = title.left( 20 ); + TQString short_title = title.left( 20 ); if ( title.length() > 20 ) short_title.append( "..." ); @@ -581,10 +581,10 @@ void RecipeInputDialog::reload( void ) //show ingredient list IngredientList list_copy = loadedRecipe->ingList; for ( IngredientList group_list = list_copy.firstGroup(); group_list.count() != 0; group_list = list_copy.nextGroup() ) { - QListViewItem * lastElement = ingredientList->lastItem(); - QListViewItem *ing_header = 0; + TQListViewItem * lastElement = ingredientList->lastItem(); + TQListViewItem *ing_header = 0; - QString group = group_list[ 0 ].group; + TQString group = group_list[ 0 ].group; if ( !group.isEmpty() ) { if ( lastElement && lastElement->parent() ) lastElement = lastElement->parent(); @@ -605,7 +605,7 @@ void RecipeInputDialog::reload( void ) lastElement = new IngListViewItem ( ingredientList, lastElement, *ing_it ); } - for ( QValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { new IngSubListViewItem ( lastElement, *sub_it ); lastElement->setOpen(true); } @@ -622,9 +622,9 @@ void RecipeInputDialog::reload( void ) sourcePhoto = loadedRecipe->photo; if ( ( sourcePhoto.width() > photoLabel->width() || sourcePhoto.height() > photoLabel->height() ) || ( sourcePhoto.width() < photoLabel->width() && sourcePhoto.height() < photoLabel->height() ) ) { - QImage pm = sourcePhoto.convertToImage(); - QPixmap pm_scaled; - pm_scaled.convertFromImage( pm.smoothScale( photoLabel->width(), photoLabel->height(), QImage::ScaleMin ) ); + TQImage pm = sourcePhoto.convertToImage(); + TQPixmap pm_scaled; + pm_scaled.convertFromImage( pm.smoothScale( photoLabel->width(), photoLabel->height(), TQImage::ScaleMin ) ); photoLabel->setPixmap( pm_scaled ); sourcePhoto = pm_scaled; // to save scaled later on @@ -634,9 +634,9 @@ void RecipeInputDialog::reload( void ) } } else { - QPixmap photo = QPixmap( defaultPhoto ); + TQPixmap photo = TQPixmap( defaultPhoto ); photoLabel->setPixmap( photo ); - sourcePhoto = QPixmap(); + sourcePhoto = TQPixmap(); } @@ -668,15 +668,15 @@ void RecipeInputDialog::reload( void ) void RecipeInputDialog::changePhoto( void ) { // standard filedialog - KURL filename = KFileDialog::getOpenURL( QString::null, QString( "*.png *.jpg *.jpeg *.xpm *.gif|%1 (*.png *.jpg *.jpeg *.xpm *.gif)" ).arg( i18n( "Images" ) ), this ); - QPixmap pixmap ( filename.path() ); + KURL filename = KFileDialog::getOpenURL( TQString::null, TQString( "*.png *.jpg *.jpeg *.xpm *.gif|%1 (*.png *.jpg *.jpeg *.xpm *.gif)" ).arg( i18n( "Images" ) ), this ); + TQPixmap pixmap ( filename.path() ); if ( !( pixmap.isNull() ) ) { // If photo is bigger than the label, or smaller in width, than photoLabel, scale it sourcePhoto = pixmap; if ( ( sourcePhoto.width() > photoLabel->width() || sourcePhoto.height() > photoLabel->height() ) || ( sourcePhoto.width() < photoLabel->width() && sourcePhoto.height() < photoLabel->height() ) ) { - QImage pm = sourcePhoto.convertToImage(); - QPixmap pm_scaled; - pm_scaled.convertFromImage( pm.smoothScale( photoLabel->width(), photoLabel->height(), QImage::ScaleMin ) ); + TQImage pm = sourcePhoto.convertToImage(); + TQPixmap pm_scaled; + pm_scaled.convertFromImage( pm.smoothScale( photoLabel->width(), photoLabel->height(), TQImage::ScaleMin ) ); photoLabel->setPixmap( pm_scaled ); sourcePhoto = pm_scaled; // to save scaled later on @@ -691,19 +691,19 @@ void RecipeInputDialog::changePhoto( void ) void RecipeInputDialog::clearPhoto( void ) { - sourcePhoto = QPixmap(); - photoLabel->setPixmap( QPixmap( defaultPhoto ) ); + sourcePhoto = TQPixmap(); + photoLabel->setPixmap( TQPixmap( defaultPhoto ) ); emit changed(); } void RecipeInputDialog::moveIngredientUp( void ) { - QListViewItem * it = ingredientList->selectedItem(); + TQListViewItem * it = ingredientList->selectedItem(); if ( !it || it->rtti() == INGSUBLISTVIEWITEM_RTTI ) return ; - QListViewItem *iabove = it->itemAbove(); + TQListViewItem *iabove = it->itemAbove(); while ( iabove && iabove->rtti() == INGSUBLISTVIEWITEM_RTTI ) iabove = iabove->itemAbove(); @@ -755,17 +755,17 @@ void RecipeInputDialog::moveIngredientUp( void ) void RecipeInputDialog::moveIngredientDown( void ) { - QListViewItem * it = ingredientList->selectedItem(); + TQListViewItem * it = ingredientList->selectedItem(); if ( !it || it->rtti() == INGSUBLISTVIEWITEM_RTTI ) return ; - QListViewItem *ibelow = it->itemBelow(); + TQListViewItem *ibelow = it->itemBelow(); while ( ibelow && ibelow->rtti() == INGSUBLISTVIEWITEM_RTTI ) ibelow = ibelow->itemBelow(); if ( ibelow ) { if ( it->rtti() == INGGRPLISTVIEWITEM_RTTI ) { - QListViewItem * next_sibling = it->nextSibling(); + TQListViewItem * next_sibling = it->nextSibling(); if ( next_sibling ) { int it_index = ingItemIndex( ingredientList, it ); @@ -795,7 +795,7 @@ void RecipeInputDialog::moveIngredientDown( void ) ibelow->insertItem( it ); } else { //move the item out of the group - QListViewItem *parent = it->parent(); //store this because we can't get it after we do it->takeItem() + TQListViewItem *parent = it->parent(); //store this because we can't get it after we do it->takeItem() parent->takeItem( it ); ingredientList->insertItem( it ); it->moveItem( parent ); //Move the Item @@ -832,9 +832,9 @@ void RecipeInputDialog::moveIngredientDown( void ) void RecipeInputDialog::removeIngredient( void ) { - QListViewItem * it = ingredientList->selectedItem(); + TQListViewItem * it = ingredientList->selectedItem(); if ( it && (it->rtti() == INGLISTVIEWITEM_RTTI || it->rtti() == INGSUBLISTVIEWITEM_RTTI) ) { - QListViewItem *iselect = it->itemBelow(); + TQListViewItem *iselect = it->itemBelow(); while ( iselect && iselect->rtti() == INGSUBLISTVIEWITEM_RTTI ) iselect = iselect->itemBelow(); @@ -854,7 +854,7 @@ void RecipeInputDialog::removeIngredient( void ) loadedRecipe->ingList.removeSubstitute( ing ); int ingID = ing_item->ingredient().ingredientID; - QMap<int,QString>::iterator map_it; + TQMap<int,TQString>::iterator map_it; if ( (map_it = propertyStatusMapRed.find(ingID)) != propertyStatusMapRed.end() ) propertyStatusMapRed.remove( map_it ); else if ( (map_it = propertyStatusMapYellow.find(ingID)) != propertyStatusMapYellow.end() ) @@ -881,7 +881,7 @@ void RecipeInputDialog::removeIngredient( void ) loadedRecipe->ingList.removeSubstitute( ing ); int ingID = sub_item->ingredient().ingredientID; - QMap<int,QString>::iterator map_it; + TQMap<int,TQString>::iterator map_it; if ( (map_it = propertyStatusMapRed.find(ingID)) != propertyStatusMapRed.end() ) propertyStatusMapRed.remove( map_it ); else if ( (map_it = propertyStatusMapYellow.find(ingID)) != propertyStatusMapYellow.end() ) @@ -896,7 +896,7 @@ void RecipeInputDialog::removeIngredient( void ) } -int RecipeInputDialog::createNewYieldIfNecessary( const QString &yield ) +int RecipeInputDialog::createNewYieldIfNecessary( const TQString &yield ) { if ( yield.stripWhiteSpace().isEmpty() ) //no yield return -1; @@ -913,7 +913,7 @@ int RecipeInputDialog::createNewYieldIfNecessary( const QString &yield ) } } -void RecipeInputDialog::syncListView( QListViewItem* it, const QString &new_text, int col ) +void RecipeInputDialog::syncListView( TQListViewItem* it, const TQString &new_text, int col ) { if ( it->rtti() != INGLISTVIEWITEM_RTTI ) return ; @@ -958,12 +958,12 @@ void RecipeInputDialog::syncListView( QListViewItem* it, const QString &new_text if ( new_text.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() ) ); ing_item->setUnit( old_unit ); break; } - QString approp_unit = new_ing.amount > 1 ? new_ing.units.plural : new_ing.units.name; + TQString approp_unit = new_ing.amount > 1 ? new_ing.units.plural : new_ing.units.name; if ( approp_unit != new_text.stripWhiteSpace() ) { Unit new_unit; @@ -986,14 +986,14 @@ void RecipeInputDialog::syncListView( QListViewItem* it, const QString &new_text } case 3: //prep method { - QString old_text = new_ing.prepMethodList.join(","); + TQString old_text = new_ing.prepMethodList.join(","); - QStringList prepMethodList = QStringList::split(",",new_text.stripWhiteSpace()); + TQStringList prepMethodList = TQStringList::split(",",new_text.stripWhiteSpace()); - for ( QStringList::const_iterator it = prepMethodList.begin(); it != prepMethodList.end(); ++it ) { + 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() ) ); ing_item->setPrepMethod( old_text ); break; } @@ -1002,9 +1002,9 @@ void RecipeInputDialog::syncListView( QListViewItem* it, const QString &new_text if ( old_text != new_text.stripWhiteSpace() ) { new_ing.prepMethodList = ElementList::split(",",new_text.stripWhiteSpace()); - QValueList<int> new_ids = IngredientInputWidget::createNewPrepIfNecessary( new_ing.prepMethodList, database ); + TQValueList<int> new_ids = IngredientInputWidget::createNewPrepIfNecessary( new_ing.prepMethodList, database ); - QValueList<int>::const_iterator id_it = new_ids.begin(); + TQValueList<int>::const_iterator id_it = new_ids.begin(); for ( ElementList::iterator it = new_ing.prepMethodList.begin(); it != new_ing.prepMethodList.end(); ++it, ++id_it ) { (*it).id = *id_it; } @@ -1029,7 +1029,7 @@ void RecipeInputDialog::recipeChanged( void ) } -void RecipeInputDialog::recipeChanged( const QString & /*t*/ ) +void RecipeInputDialog::recipeChanged( const TQString & /*t*/ ) { recipeChanged(); // jumps to the real slot function } @@ -1043,7 +1043,7 @@ bool RecipeInputDialog::save ( void ) { //check bounds first if ( titleEdit->text().length() > uint(database->maxRecipeTitleLength()) ) { - KMessageBox::error( this, QString( i18n( "Recipe title cannot be longer than %1 characters." ) ).arg( database->maxRecipeTitleLength() ), i18n( "Unable to save recipe" ) ); + KMessageBox::error( this, TQString( i18n( "Recipe title cannot be longer than %1 characters." ) ).arg( database->maxRecipeTitleLength() ), i18n( "Unable to save recipe" ) ); return false; } @@ -1076,9 +1076,9 @@ void RecipeInputDialog::saveRecipe( void ) void RecipeInputDialog::newRecipe( void ) { loadedRecipe->empty(); - QPixmap image( defaultPhoto ); + TQPixmap image( defaultPhoto ); photoLabel->setPixmap( image ); - sourcePhoto = QPixmap(); + sourcePhoto = TQPixmap(); instructionsEdit->setText( i18n( "Write the recipe instructions here" ) ); instructionsEdit->clearCompletionItems(); @@ -1088,7 +1088,7 @@ void RecipeInputDialog::newRecipe( void ) categoryShow->clear(); yieldNumInput->setValue( 1, 0 ); yieldTypeEdit->setText(""); - prepTimeEdit->setTime( QTime( 0, 0 ) ); + prepTimeEdit->setTime( TQTime( 0, 0 ) ); instructionsEdit->selectAll(); @@ -1116,7 +1116,7 @@ void RecipeInputDialog::addCategory( void ) { SelectCategoriesDialog *editCategoriesDialog = new SelectCategoriesDialog( this, loadedRecipe->categoryList, database ); - if ( editCategoriesDialog->exec() == QDialog::Accepted ) { // user presses Ok + if ( editCategoriesDialog->exec() == TQDialog::Accepted ) { // user presses Ok loadedRecipe->categoryList.clear(); editCategoriesDialog->getSelectedCategories( &( loadedRecipe->categoryList ) ); // get the category list chosen emit( recipeChanged() ); //Indicate that the recipe changed @@ -1133,7 +1133,7 @@ void RecipeInputDialog::addCategory( void ) void RecipeInputDialog::showCategories( void ) { - QString categories; + TQString categories; for ( ElementList::const_iterator cat_it = loadedRecipe->categoryList.begin(); cat_it != loadedRecipe->categoryList.end(); ++cat_it ) { if ( !categories.isEmpty() ) categories += ","; @@ -1147,7 +1147,7 @@ void RecipeInputDialog::addAuthor( void ) SelectAuthorsDialog * editAuthorsDialog = new SelectAuthorsDialog( this, loadedRecipe->authorList, database ); - if ( editAuthorsDialog->exec() == QDialog::Accepted ) { // user presses Ok + if ( editAuthorsDialog->exec() == TQDialog::Accepted ) { // user presses Ok loadedRecipe->authorList.clear(); editAuthorsDialog->getSelectedAuthors( &( loadedRecipe->authorList ) ); // get the category list chosen emit( recipeChanged() ); //Indicate that the recipe changed @@ -1161,7 +1161,7 @@ void RecipeInputDialog::addAuthor( void ) void RecipeInputDialog::showAuthors( void ) { - QString authors; + TQString authors; for ( ElementList::const_iterator author_it = loadedRecipe->authorList.begin(); author_it != loadedRecipe->authorList.end(); ++author_it ) { if ( !authors.isEmpty() ) authors += ","; @@ -1235,7 +1235,7 @@ void RecipeInputDialog::showRecipe( void ) void RecipeInputDialog::spellCheck( void ) { - QString text = instructionsEdit->text(); + TQString text = instructionsEdit->text(); KSpellConfig default_cfg( this ); KSpell::modalCheck( text, &default_cfg ); KMessageBox::information( this, i18n( "Spell check complete." ) ); @@ -1249,11 +1249,11 @@ void RecipeInputDialog::resizeRecipe( void ) yieldNumInput->value( loadedRecipe->yield.amount, loadedRecipe->yield.amount_offset ); ResizeRecipeDialog dlg( this, loadedRecipe ); - if ( dlg.exec() == QDialog::Accepted ) + if ( dlg.exec() == TQDialog::Accepted ) reload(); } -int RecipeInputDialog::ingItemIndex( QListView *listview, const QListViewItem *item ) const +int RecipeInputDialog::ingItemIndex( TQListView *listview, const TQListViewItem *item ) const { if ( !item ) return -1; @@ -1261,7 +1261,7 @@ int RecipeInputDialog::ingItemIndex( QListView *listview, const QListViewItem *i if ( item == listview->firstChild() ) return 0; else { - QListViewItemIterator it( listview->firstChild() ); + TQListViewItemIterator it( listview->firstChild() ); uint j = 0; for ( ; it.current() && it.current() != item; ++it ) { if ( it.current() ->rtti() == INGLISTVIEWITEM_RTTI ) { @@ -1282,9 +1282,9 @@ void RecipeInputDialog::slotIngredientParser() UnitList units; database->loadUnits(&units); IngredientParserDialog dlg(units,this); - if ( dlg.exec() == QDialog::Accepted ) { + if ( dlg.exec() == TQDialog::Accepted ) { IngredientList ings = dlg.ingredients(); - QStringList usedGroups; + TQStringList usedGroups; bool haveHeader = false; for ( IngredientList::iterator it = ings.begin(); it != ings.end(); ++it ) { if ( !(*it).group.isEmpty() && usedGroups.find((*it).group) == usedGroups.end() ) { @@ -1296,8 +1296,8 @@ void RecipeInputDialog::slotIngredientParser() (*it).ingredientID = IngredientInputWidget::createNewIngredientIfNecessary((*it).name,database); (*it).units.id = IngredientInputWidget::createNewUnitIfNecessary((*it).units.name,false,(*it).ingredientID,(*it).units,database); - QValueList<int> prepIDs = IngredientInputWidget::createNewPrepIfNecessary((*it).prepMethodList,database); - QValueList<int>::const_iterator prep_id_it = prepIDs.begin(); + TQValueList<int> prepIDs = IngredientInputWidget::createNewPrepIfNecessary((*it).prepMethodList,database); + TQValueList<int>::const_iterator prep_id_it = prepIDs.begin(); for ( ElementList::iterator prep_it = (*it).prepMethodList.begin(); prep_it != (*it).prepMethodList.end(); ++prep_it, ++prep_id_it ) { (*prep_it).id = *prep_id_it; } @@ -1305,7 +1305,7 @@ void RecipeInputDialog::slotIngredientParser() addIngredient( *it, !haveHeader ); if ( usedGroups.count() > 0 && (*it).group.isEmpty() ) { - QListViewItem *last_item = ingredientList->lastItem(); + TQListViewItem *last_item = ingredientList->lastItem(); if ( last_item->parent() ) { last_item->parent()->takeItem( last_item ); ingredientList->insertItem( last_item ); @@ -1322,7 +1322,7 @@ void RecipeInputDialog::slotAddRating() database->loadRatingCriterion(&criteriaList); EditRatingDialog ratingDlg(criteriaList,this); - if ( ratingDlg.exec() == QDialog::Accepted ) { + if ( ratingDlg.exec() == TQDialog::Accepted ) { Rating r = ratingDlg.rating(); for ( RatingCriteriaList::iterator rc_it = r.ratingCriteriaList.begin(); rc_it != r.ratingCriteriaList.end(); ++rc_it ) { @@ -1344,9 +1344,9 @@ void RecipeInputDialog::slotAddRating() void RecipeInputDialog::addRating( const Rating &rating, RatingDisplayWidget *item ) { - int average = qRound(rating.average()); + int average = tqRound(rating.average()); if ( average >= 0 ) - item->icon->setPixmap( UserIcon(QString("rating%1").arg(average) ) ); + item->icon->setPixmap( UserIcon(TQString("rating%1").arg(average) ) ); else //no rating criteria, therefore no average (we don't want to automatically assume a zero average) item->icon->clear(); @@ -1355,17 +1355,17 @@ void RecipeInputDialog::addRating( const Rating &rating, RatingDisplayWidget *it item->criteriaListView->clear(); for ( RatingCriteriaList::const_iterator rc_it = rating.ratingCriteriaList.begin(); rc_it != rating.ratingCriteriaList.end(); ++rc_it ) { - QListViewItem * it = new QListViewItem(item->criteriaListView,(*rc_it).name); + TQListViewItem * it = new TQListViewItem(item->criteriaListView,(*rc_it).name); int stars = int((*rc_it).stars * 2); //multiply by two to make it easier to work with half-stars - QPixmap star = UserIcon(QString::fromLatin1("star_on")); + TQPixmap star = UserIcon(TQString::fromLatin1("star_on")); int 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 ); painter.drawTiledPixmap(0,0,pixmapWidth,18,star); it->setPixmap(1,generatedPixmap); } @@ -1381,13 +1381,13 @@ void RecipeInputDialog::addRating( const Rating &rating, RatingDisplayWidget *it void RecipeInputDialog::slotEditRating() { - RatingDisplayWidget *sender = (RatingDisplayWidget*)(QObject::sender()->parent()); + RatingDisplayWidget *sender = (RatingDisplayWidget*)(TQObject::sender()->parent()); ElementList criteriaList; database->loadRatingCriterion(&criteriaList); EditRatingDialog ratingDlg(criteriaList,*sender->rating_it,this); - if ( ratingDlg.exec() == QDialog::Accepted ) { + if ( ratingDlg.exec() == TQDialog::Accepted ) { Rating r = ratingDlg.rating(); for ( RatingCriteriaList::iterator rc_it = r.ratingCriteriaList.begin(); rc_it != r.ratingCriteriaList.end(); ++rc_it ) { @@ -1407,7 +1407,7 @@ void RecipeInputDialog::slotEditRating() void RecipeInputDialog::slotRemoveRating() { - RatingDisplayWidget *sender = (RatingDisplayWidget*)(QObject::sender()->parent()); + RatingDisplayWidget *sender = (RatingDisplayWidget*)(TQObject::sender()->parent()); loadedRecipe->ratingList.remove(sender->rating_it); //FIXME: sender is removed but never deleted (sender->deleteLater() doesn't work) @@ -1421,7 +1421,7 @@ void RecipeInputDialog::addIngredient( const Ingredient &ing, bool noHeader ) Ingredient ingCopy = ing; //Append to the ListView - QListViewItem* lastElement = ingredientList->lastItem(); + TQListViewItem* lastElement = ingredientList->lastItem(); while ( lastElement && lastElement->rtti() == INGSUBLISTVIEWITEM_RTTI ) lastElement = lastElement->itemAbove(); @@ -1436,14 +1436,14 @@ void RecipeInputDialog::addIngredient( const Ingredient &ing, bool noHeader ) ingCopy.groupID = header->id(); lastElement = new IngListViewItem( header, lastElement, ingCopy ); - for ( QValueList<IngredientData>::const_iterator it = ingCopy.substitutes.begin(); it != ingCopy.substitutes.end(); ++it ) { + for ( TQValueList<IngredientData>::const_iterator it = ingCopy.substitutes.begin(); it != ingCopy.substitutes.end(); ++it ) { new IngSubListViewItem( lastElement, *it ); } lastElement->setOpen(true); } else { lastElement = new IngListViewItem( ingredientList, lastElement, ingCopy ); - for ( QValueList<IngredientData>::const_iterator it = ing.substitutes.begin(); it != ing.substitutes.end(); ++it ) { + for ( TQValueList<IngredientData>::const_iterator it = ing.substitutes.begin(); it != ing.substitutes.end(); ++it ) { new IngSubListViewItem( lastElement, *it ); } lastElement->setOpen(true); @@ -1462,7 +1462,7 @@ void RecipeInputDialog::addIngredient( const Ingredient &ing, bool noHeader ) void RecipeInputDialog::addIngredientHeader( const Element &header ) { - QListViewItem *last_item = ingredientList->lastItem(); + TQListViewItem *last_item = ingredientList->lastItem(); if ( last_item && last_item->parent() ) last_item = last_item->parent(); @@ -1488,15 +1488,15 @@ void RecipeInputDialog::updatePropertyStatus( const Ingredient &ing, bool update database->loadProperties( &ingPropertyList, ing.ingredientID ); if ( ingPropertyList.count() == 0 ) { - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%1:</b> No nutrient information available")).arg(ing.name)); + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> No nutrient information available")).arg(ing.name)); } - QMap<int,bool> ratioCache; //unit->conversion possible + TQMap<int,bool> ratioCache; //unit->conversion possible IngredientPropertyList::const_iterator prop_it; for ( prop_it = ingPropertyList.begin(); prop_it != ingPropertyList.end(); ++prop_it ) { Ingredient result; - QMap<int,bool>::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); + TQMap<int,bool>::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 ); ratioCache.insert((*prop_it).perUnit.id,status==RecipeDB::Success||status==RecipeDB::MismatchedPrepMethod); @@ -1505,37 +1505,37 @@ void RecipeInputDialog::updatePropertyStatus( const Ingredient &ing, bool update case RecipeDB::Success: break; case RecipeDB::MissingUnitConversion: { if ( ing.units.type != Unit::Other && ing.units.type == (*prop_it).perUnit.type ) { - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%3:</b> Unit conversion missing for conversion from '%1' to '%2'")) + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%3:</b> Unit conversion missing for conversion from '%1' to '%2'")) .arg(ing.units.name.isEmpty()?i18n("-No unit-"):ing.units.name) .arg((*prop_it).perUnit.name) .arg(ing.name)); } else { WeightList weights = database->ingredientWeightUnits( ing.ingredientID ); - QValueList< QPair<int,int> > usedIds; - QStringList missingConversions; + TQValueList< TQPair<int,int> > usedIds; + TQStringList missingConversions; for ( WeightList::const_iterator weight_it = weights.begin(); weight_it != weights.end(); ++weight_it ) { //skip entries that only differ in how it's prepared - QPair<int,int> usedPair((*weight_it).perAmountUnitID,(*weight_it).weightUnitID); + TQPair<int,int> usedPair((*weight_it).perAmountUnitID,(*weight_it).weightUnitID); if ( usedIds.find(usedPair) != usedIds.end() ) continue; - QString toUnit = database->unitName((*weight_it).perAmountUnitID).name; + TQString toUnit = database->unitName((*weight_it).perAmountUnitID).name; if ( toUnit.isEmpty() ) toUnit = i18n("-No unit-"); - QString fromUnit = database->unitName((*weight_it).weightUnitID).name; + TQString fromUnit = database->unitName((*weight_it).weightUnitID).name; if ( fromUnit.isEmpty() ) fromUnit = i18n("-No unit-"); - QString ingUnit = ing.units.name; + TQString ingUnit = ing.units.name; if ( ingUnit.isEmpty() ) ingUnit = i18n("-No unit-"); - QString propUnit = (*prop_it).perUnit.name; + TQString propUnit = (*prop_it).perUnit.name; if ( propUnit.isEmpty() ) propUnit = i18n("-No unit-"); missingConversions << conversionPath( ingUnit, toUnit, fromUnit, propUnit); usedIds << usedPair; } - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%1:</b> Either an appropriate ingredient weight entry is needed, or Krecipes needs conversion information to perform one of the following conversions: %2")) + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> Either an appropriate ingredient weight entry is needed, or Krecipes needs conversion information to perform one of the following conversions: %2")) .arg(ing.name) .arg("<ul><li>"+missingConversions.join("</li><li>")+"</li></ul>") ); @@ -1543,16 +1543,16 @@ void RecipeInputDialog::updatePropertyStatus( const Ingredient &ing, bool update break; } case RecipeDB::MissingIngredientWeight: - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%1:</b> No ingredient weight entries")).arg(ing.name)); + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> No ingredient weight entries")).arg(ing.name)); break; case RecipeDB::MismatchedPrepMethod: if ( ing.prepMethodList.count() == 0 ) - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%1:</b> There is no ingredient weight entry for when no preparation method is specified")).arg(ing.name)); + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> There is no ingredient weight entry for when no preparation method is specified")).arg(ing.name)); else - propertyStatusMapRed.insert(ing.ingredientID,QString(i18n("<b>%1:</b> There is no ingredient weight entry for when prepared in any of the following manners: %2")).arg(ing.name).arg("<ul><li>"+ing.prepMethodList.join("</li><li>")+"</li></ul>")); + propertyStatusMapRed.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> There is no ingredient weight entry for when prepared in any of the following manners: %2")).arg(ing.name).arg("<ul><li>"+ing.prepMethodList.join("</li><li>")+"</li></ul>")); break; case RecipeDB::MismatchedPrepMethodUsingApprox: - propertyStatusMapYellow.insert(ing.ingredientID,QString(i18n("<b>%1:</b> There is no ingredient weight entry for when prepared in any of the following manners (defaulting to a weight entry without a preparation method specified): %2")).arg(ing.name).arg("<ul><li>"+ing.prepMethodList.join("</li><li>")+"</li></ul>")); + propertyStatusMapYellow.insert(ing.ingredientID,TQString(i18n("<b>%1:</b> There is no ingredient weight entry for when prepared in any of the following manners (defaulting to a weight entry without a preparation method specified): %2")).arg(ing.name).arg("<ul><li>"+ing.prepMethodList.join("</li><li>")+"</li></ul>")); break; default: kdDebug()<<"Code error: Unhandled conversion status code "<<status<<endl; break; } @@ -1567,18 +1567,18 @@ void RecipeInputDialog::showStatusIndicator() { if ( propertyStatusMapRed.count() == 0 ) { if ( propertyStatusMapYellow.count() == 0 ) { - propertyStatusLed->setColor( Qt::green ); + propertyStatusLed->setColor( TQt::green ); propertyStatusLabel->setText( i18n("Complete") ); propertyStatusButton->setEnabled(false); } else { - propertyStatusLed->setColor( Qt::yellow ); + propertyStatusLed->setColor( TQt::yellow ); propertyStatusLabel->setText( i18n("Complete, but approximations made") ); propertyStatusButton->setEnabled(true); } } else { - propertyStatusLed->setColor( Qt::red ); + propertyStatusLed->setColor( TQt::red ); propertyStatusLabel->setText( i18n("Incomplete") ); propertyStatusButton->setEnabled(true); } @@ -1589,14 +1589,14 @@ void RecipeInputDialog::showStatusIndicator() statusTextView->setText(statusMessage()); } -QString RecipeInputDialog::statusMessage() const +TQString RecipeInputDialog::statusMessage() const { - QString statusMessage; + TQString statusMessage; if ( propertyStatusMapRed.count() > 0 ) { statusMessage.append( i18n("The nutrient information for this recipe is incomplete because the following information is missing:") ); statusMessage.append("<ul>"); - for ( QMap<int,QString>::const_iterator it = propertyStatusMapRed.begin(); it != propertyStatusMapRed.end(); ++it ) { + for ( TQMap<int,TQString>::const_iterator it = propertyStatusMapRed.begin(); it != propertyStatusMapRed.end(); ++it ) { statusMessage.append("<li>"); statusMessage.append(it.data()); statusMessage.append("</li>"); @@ -1607,7 +1607,7 @@ QString RecipeInputDialog::statusMessage() const if ( propertyStatusMapYellow.count() > 0 ) { statusMessage.append( i18n("The following approximations will be made when determining nutrient information:") ); statusMessage.append("<ul>"); - for ( QMap<int,QString>::const_iterator it = propertyStatusMapYellow.begin(); it != propertyStatusMapYellow.end(); ++it ) { + for ( TQMap<int,TQString>::const_iterator it = propertyStatusMapYellow.begin(); it != propertyStatusMapYellow.end(); ++it ) { statusMessage.append("<li>"); statusMessage.append(it.data()); statusMessage.append("</li>"); @@ -1618,11 +1618,11 @@ QString RecipeInputDialog::statusMessage() const return statusMessage; } -QString RecipeInputDialog::conversionPath( const QString &ingUnit, const QString &toUnit, const QString &fromUnit, const QString &propUnit ) const +TQString RecipeInputDialog::conversionPath( const TQString &ingUnit, const TQString &toUnit, const TQString &fromUnit, const TQString &propUnit ) const { - QString path = "'"+ingUnit+"'"; + TQString path = "'"+ingUnit+"'"; - QString lastUnit = ingUnit; + TQString lastUnit = ingUnit; if ( lastUnit != toUnit ) { path.append(" => '"+toUnit+"'"); lastUnit = toUnit; diff --git a/krecipes/src/dialogs/recipeinputdialog.h b/krecipes/src/dialogs/recipeinputdialog.h index 7b09345..085f0d3 100644 --- a/krecipes/src/dialogs/recipeinputdialog.h +++ b/krecipes/src/dialogs/recipeinputdialog.h @@ -23,22 +23,22 @@ #include <kiconloader.h> #include <kled.h> -#include <qlabel.h> -#include <qgroupbox.h> -#include <qmap.h> -#include <qobject.h> -#include <qtabwidget.h> -#include <qtoolbutton.h> -#include <qvbox.h> +#include <ntqlabel.h> +#include <ntqgroupbox.h> +#include <ntqmap.h> +#include <ntqobject.h> +#include <ntqtabwidget.h> +#include <ntqtoolbutton.h> +#include <ntqvbox.h> #include "datablocks/elementlist.h" -class QTabWidget; -class QTimeEdit; -class QDragEvent; -class QButtonGroup; -class QWidgetStack; -class QTextEdit; +class TQTabWidget; +class TQTimeEdit; +class TQDragEvent; +class TQButtonGroup; +class TQWidgetStack; +class TQTextEdit; class KreTextEdit; class KWidgetListbox; @@ -58,13 +58,13 @@ class ClickableLed; /** @author Unai Garro */ -class RecipeInputDialog: public QVBox +class RecipeInputDialog: public TQVBox { Q_OBJECT public: - RecipeInputDialog( QWidget* parent, RecipeDB* db ); + RecipeInputDialog( TQWidget* parent, RecipeDB* db ); void loadRecipe( int recipeID ); ~RecipeInputDialog(); void newRecipe( void ); @@ -81,40 +81,40 @@ private: bool unsavedChanges; // Widgets - QTabWidget* tabWidget; - QGroupBox* recipeTab; - QGroupBox* instructionsTab; + TQTabWidget* tabWidget; + TQGroupBox* recipeTab; + TQGroupBox* instructionsTab; //Recipe Photo ImageDropLabel *photoLabel; - QPixmap sourcePhoto; - QPushButton *changePhotoButton; + TQPixmap sourcePhoto; + TQPushButton *changePhotoButton; //Recipe Body KreTextEdit* instructionsEdit; - QLabel* titleLabel; + TQLabel* titleLabel; KLineEdit* titleEdit; //Additional recipe data - QLabel* yieldLabel; + TQLabel* yieldLabel; FractionInput* yieldNumInput; KLineEdit* yieldTypeEdit; - QTimeEdit *prepTimeEdit; - QLabel* authorLabel; + TQTimeEdit *prepTimeEdit; + TQLabel* authorLabel; KLineEdit* authorShow; - QPushButton* addAuthorButton; - QLabel* categoryLabel; + TQPushButton* addAuthorButton; + TQLabel* categoryLabel; KLineEdit* categoryShow; - QPushButton* addCategoryButton; + TQPushButton* addCategoryButton; //Ingredient inputs KListView* ingredientList; - QGroupBox *ingredientGBox; + TQGroupBox *ingredientGBox; IngredientInputWidget *ingInput; ClickableLed *propertyStatusLed; - QLabel *propertyStatusLabel; - QPushButton *propertyStatusButton; - QTextEdit *statusTextView; + TQLabel *propertyStatusLabel; + TQPushButton *propertyStatusButton; + TQTextEdit *statusTextView; KDialogBase *propertyStatusDialog; // Buttons to move ingredients up & down... @@ -125,28 +125,28 @@ private: KPushButton* ingParserButton; //Function buttons - QGroupBox* functionsBox; - QToolButton* saveButton; - QToolButton* closeButton; - QToolButton* showButton; - QToolButton* resizeButton; + TQGroupBox* functionsBox; + TQToolButton* saveButton; + TQToolButton* closeButton; + TQToolButton* showButton; + TQToolButton* resizeButton; - QToolButton* spellCheckButton; + TQToolButton* spellCheckButton; KWidgetListbox *ratingListDisplayWidget; - QMap<int,QString> propertyStatusMapRed; - QMap<int,QString> propertyStatusMapYellow; + TQMap<int,TQString> propertyStatusMapRed; + TQMap<int,TQString> propertyStatusMapYellow; // Internal functions - int createNewYieldIfNecessary( const QString &yield ); + int createNewYieldIfNecessary( const TQString &yield ); void saveRecipe( void ); void showCategories( void ); void showAuthors( void ); - int ingItemIndex( QListView *listview, const QListViewItem *item ) const; + int ingItemIndex( TQListView *listview, const TQListViewItem *item ) const; void addRating( const Rating &rating, RatingDisplayWidget *item ); - QString statusMessage() const; - QString conversionPath( const QString &ingUnit, const QString &toUnit, const QString &fromUnit, const QString &propUnit ) const; + TQString statusMessage() const; + TQString conversionPath( const TQString &ingUnit, const TQString &toUnit, const TQString &fromUnit, const TQString &propUnit ) const; // Signals & Slots @@ -156,16 +156,16 @@ private slots: void moveIngredientUp( void ); void moveIngredientDown( void ); void removeIngredient( void ); - void syncListView( QListViewItem* it, const QString &new_text, int col ); + void syncListView( TQListViewItem* it, const TQString &new_text, int col ); void recipeChanged( void ); - void recipeChanged( const QString &t ); + void recipeChanged( const TQString &t ); void enableChangedSignal( bool en = true ); void addCategory( void ); void addAuthor( void ); void enableSaveButton( bool enabled ); void closeOptions( void ); void showRecipe( void ); - void prepTitleChanged( const QString &title ); + void prepTitleChanged( const TQString &title ); void recipeRemoved( int id ); void slotIngredientParser(); void slotAddRating(); @@ -185,10 +185,10 @@ public slots: signals: void changed( void ); void closeRecipe( void ); - void createButton( QWidget* w, const QString &title ); + void createButton( TQWidget* w, const TQString &title ); void enableSaveOption( bool en = true ); void showRecipe( int recipeID ); //Indicates krecipesview to show it - void titleChanged( const QString &title ); + void titleChanged( const TQString &title ); }; @@ -198,31 +198,31 @@ class ClickableLed : public KLed Q_OBJECT public: - ClickableLed( QWidget *parent ); + ClickableLed( TQWidget *parent ); protected: - virtual void mouseReleaseEvent( QMouseEvent* ); + virtual void mouseReleaseEvent( TQMouseEvent* ); signals: void clicked(); }; -class ImageDropLabel : public QLabel +class ImageDropLabel : public TQLabel { Q_OBJECT public: - ImageDropLabel( QWidget *parent, QPixmap &_sourcePhoto ); + ImageDropLabel( TQWidget *parent, TQPixmap &_sourcePhoto ); signals: void changed(); protected: - void dragEnterEvent( QDragEnterEvent* event ); - void dropEvent( QDropEvent* event ); + void dragEnterEvent( TQDragEnterEvent* event ); + void dropEvent( TQDropEvent* event ); private: - QPixmap &sourcePhoto; + TQPixmap &sourcePhoto; }; #endif diff --git a/krecipes/src/dialogs/recipeprintpreview.cpp b/krecipes/src/dialogs/recipeprintpreview.cpp index ed90855..8a7a96f 100644 --- a/krecipes/src/dialogs/recipeprintpreview.cpp +++ b/krecipes/src/dialogs/recipeprintpreview.cpp @@ -10,7 +10,7 @@ #include "recipeprintpreview.h" -#include <qvbox.h> +#include <ntqvbox.h> #include <kdebug.h> #include <klocale.h> @@ -18,7 +18,7 @@ #include "recipeviewdialog.h" #include "pagesetupdialog.h" -RecipePrintPreview::RecipePrintPreview( QWidget *parent, RecipeDB *db, const QValueList<int> &ids ) +RecipePrintPreview::RecipePrintPreview( TQWidget *parent, RecipeDB *db, const TQValueList<int> &ids ) : KDialogBase( parent, "RecipePrintPreview", true, i18n("Print Preview"), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Help, KDialogBase::Ok ) { @@ -29,12 +29,12 @@ RecipePrintPreview::RecipePrintPreview( QWidget *parent, RecipeDB *db, const QVa setSizeGripEnabled( true ); // Initialize UI Elements - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); recipeView = new RecipeViewDialog( page, db ); recipeView->loadRecipes( ids, "Print" ); - setInitialSize( QSize(450,500), false ); + setInitialSize( TQSize(450,500), false ); } RecipePrintPreview::~RecipePrintPreview() @@ -50,7 +50,7 @@ void RecipePrintPreview::slotOk() void RecipePrintPreview::slotUser1( void ) { PageSetupDialog pageSetup( this, Recipe(), "Print" ); - if ( pageSetup.exec() == QDialog::Accepted ) + if ( pageSetup.exec() == TQDialog::Accepted ) reload(); } diff --git a/krecipes/src/dialogs/recipeprintpreview.h b/krecipes/src/dialogs/recipeprintpreview.h index 0e85613..1912a96 100644 --- a/krecipes/src/dialogs/recipeprintpreview.h +++ b/krecipes/src/dialogs/recipeprintpreview.h @@ -11,8 +11,8 @@ #ifndef RECIPEPRINTPREVIEW_H #define RECIPEPRINTPREVIEW_H -#include <qstring.h> -#include <qvaluelist.h> +#include <ntqstring.h> +#include <ntqvaluelist.h> #include <kdialogbase.h> @@ -24,7 +24,7 @@ class RecipePrintPreview : public KDialogBase Q_OBJECT public: - RecipePrintPreview( QWidget *parent, RecipeDB *db, const QValueList<int> &ids ); + RecipePrintPreview( TQWidget *parent, RecipeDB *db, const TQValueList<int> &ids ); ~RecipePrintPreview(); void reload(); diff --git a/krecipes/src/dialogs/recipeviewdialog.cpp b/krecipes/src/dialogs/recipeviewdialog.cpp index 9290f2c..d47d7cd 100644 --- a/krecipes/src/dialogs/recipeviewdialog.cpp +++ b/krecipes/src/dialogs/recipeviewdialog.cpp @@ -12,9 +12,9 @@ #include "recipeviewdialog.h" -#include <qlayout.h> -#include <qstyle.h> -#include <qfile.h> +#include <ntqlayout.h> +#include <ntqstyle.h> +#include <ntqfile.h> #include <kapplication.h> #include <kcursor.h> @@ -34,7 +34,7 @@ #include "exporters/htmlexporter.h" #include "recipeprintpreview.h" -RecipeViewDialog::RecipeViewDialog( QWidget *parent, RecipeDB *db, int recipeID ) : QVBox( parent ), +RecipeViewDialog::RecipeViewDialog( TQWidget *parent, RecipeDB *db, int recipeID ) : TQVBox( parent ), database(db) { // Initialize UI Elements @@ -57,12 +57,12 @@ RecipeViewDialog::~RecipeViewDialog() bool RecipeViewDialog::loadRecipe( int recipeID ) { - QValueList<int> ids; + TQValueList<int> ids; ids.append( recipeID ); return loadRecipes( ids ); } -bool RecipeViewDialog::loadRecipes( const QValueList<int> &ids, const QString &layoutConfig ) +bool RecipeViewDialog::loadRecipes( const TQValueList<int> &ids, const TQString &layoutConfig ) { KApplication::setOverrideCursor( KCursor::waitCursor() ); @@ -78,26 +78,26 @@ bool RecipeViewDialog::loadRecipes( const QValueList<int> &ids, const QString &l return success; } -bool RecipeViewDialog::showRecipes( const QValueList<int> &ids, const QString &layoutConfig ) +bool RecipeViewDialog::showRecipes( const TQValueList<int> &ids, const TQString &layoutConfig ) { KProgressDialog * progress_dialog = 0; if ( ids.count() > 1 ) //we don't want a progress bar coming up when there is only one recipe... it may show up during the splash screen { - progress_dialog = new KProgressDialog( this, "open_progress_dialog", QString::null, i18n( "Opening recipes, please wait..." ), true ); + progress_dialog = new KProgressDialog( this, "open_progress_dialog", TQString::null, i18n( "Opening recipes, please wait..." ), true ); progress_dialog->resize( 240, 80 ); } HTMLExporter html_generator( tmp_filename + ".html", "html" ); - if ( layoutConfig != QString::null ) { + if ( layoutConfig != TQString::null ) { KConfig *config = KGlobal::config(); config->setGroup( "Page Setup" ); - QString styleFile = config->readEntry( layoutConfig+"Layout", locate( "appdata", "layouts/Default.klo" ) ); - if ( !styleFile.isEmpty() && QFile::exists( styleFile ) ) + TQString styleFile = config->readEntry( layoutConfig+"Layout", locate( "appdata", "layouts/Default.klo" ) ); + if ( !styleFile.isEmpty() && TQFile::exists( styleFile ) ) html_generator.setStyle( styleFile ); - QString templateFile = config->readEntry( layoutConfig+"Template", locate( "appdata", "layouts/Default.template" ) ); - if ( !templateFile.isEmpty() && QFile::exists( templateFile ) ) + TQString templateFile = config->readEntry( layoutConfig+"Template", locate( "appdata", "layouts/Default.template" ) ); + if ( !templateFile.isEmpty() && TQFile::exists( templateFile ) ) html_generator.setTemplate( templateFile ); } @@ -135,7 +135,7 @@ void RecipeViewDialog::printNoPreview( void ) } } -void RecipeViewDialog::reload( const QString &layoutConfig ) +void RecipeViewDialog::reload( const TQString &layoutConfig ) { loadRecipes( ids_loaded, layoutConfig ); } @@ -146,7 +146,7 @@ void RecipeViewDialog::removeOldFiles() RecipeList recipe_list; database->loadRecipes( &recipe_list, RecipeDB::Title, ids_loaded ); - QValueList<int> recipe_ids; + TQValueList<int> recipe_ids; for ( RecipeList::const_iterator it = recipe_list.begin(); it != recipe_list.end(); ++it ) recipe_ids << ( *it ).recipeID; diff --git a/krecipes/src/dialogs/recipeviewdialog.h b/krecipes/src/dialogs/recipeviewdialog.h index ffc7c12..0463a1e 100644 --- a/krecipes/src/dialogs/recipeviewdialog.h +++ b/krecipes/src/dialogs/recipeviewdialog.h @@ -13,24 +13,24 @@ #ifndef RECIPEVIEWDIALOG_H #define RECIPEVIEWDIALOG_H -#include <qvbox.h> -#include <qstring.h> +#include <ntqvbox.h> +#include <ntqstring.h> class RecipeDB; class Recipe; class KHTMLPart; -class QPushButton; +class TQPushButton; /** @author Unai Garro */ -class RecipeViewDialog : public QVBox +class RecipeViewDialog : public TQVBox { Q_OBJECT public: - RecipeViewDialog( QWidget *parent, RecipeDB *db, int recipeID = -1 ); + RecipeViewDialog( TQWidget *parent, RecipeDB *db, int recipeID = -1 ); ~RecipeViewDialog(); @@ -38,18 +38,18 @@ public: bool loadRecipe( int recipeID ); /** @return Boolean indicating whether or not the recipes were successfully loaded */ - bool loadRecipes( const QValueList<int> &ids, const QString &layoutConfig = QString::null ); + bool loadRecipes( const TQValueList<int> &ids, const TQString &layoutConfig = TQString::null ); int recipesLoaded() const { return ids_loaded.count(); } - const QValueList<int> currentRecipes() const + const TQValueList<int> currentRecipes() const { return ids_loaded; } - void reload( const QString &layoutConfig = QString::null ); + void reload( const TQString &layoutConfig = TQString::null ); public slots: void printNoPreview( void ); @@ -61,11 +61,11 @@ private: KHTMLPart *recipeView; RecipeDB *database; bool recipe_loaded; - QValueList<int> ids_loaded; - QString tmp_filename; + TQValueList<int> ids_loaded; + TQString tmp_filename; // Internal Methods - bool showRecipes( const QValueList<int> &ids, const QString &layoutConfig ); + bool showRecipes( const TQValueList<int> &ids, const TQString &layoutConfig ); void removeOldFiles(); private slots: diff --git a/krecipes/src/dialogs/refineshoppinglistdialog.cpp b/krecipes/src/dialogs/refineshoppinglistdialog.cpp index b293150..e160c2e 100644 --- a/krecipes/src/dialogs/refineshoppinglistdialog.cpp +++ b/krecipes/src/dialogs/refineshoppinglistdialog.cpp @@ -10,13 +10,13 @@ #include "refineshoppinglistdialog.h" -#include <qvariant.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qheader.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> +#include <ntqvariant.h> +#include <ntqpushbutton.h> +#include <ntqlabel.h> +#include <ntqheader.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> #include <klocale.h> #include <kiconloader.h> @@ -31,46 +31,46 @@ #include "shoppingcalculator.h" #include "datablocks/mixednumber.h" -RefineShoppingListDialog::RefineShoppingListDialog( QWidget* parent, RecipeDB *db, const ElementList &recipeList ) - : KDialogBase( parent, "refinedialog", true, QString::null, +RefineShoppingListDialog::RefineShoppingListDialog( TQWidget* parent, RecipeDB *db, const ElementList &recipeList ) + : KDialogBase( parent, "refinedialog", true, TQString::null, KDialogBase::Ok, KDialogBase::Ok ), database( db ) { setButtonText( KDialogBase::Ok, i18n( "&Done" ) ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - helpLabel = new QLabel( page, "helpLabel" ); - helpLabel->setTextFormat( QLabel::RichText ); + helpLabel = new TQLabel( page, "helpLabel" ); + helpLabel->setTextFormat( TQLabel::RichText ); - QWidget *layout2Widget = new QWidget(page); + TQWidget *layout2Widget = new TQWidget(page); - QHBoxLayout *layout2 = new QHBoxLayout( layout2Widget, 0, 6, "layout2" ); + TQHBoxLayout *layout2 = new TQHBoxLayout( layout2Widget, 0, 6, "layout2" ); - allIngListView = new KreListView( layout2Widget, QString::null, true, 0 ); + allIngListView = new KreListView( layout2Widget, TQString::null, true, 0 ); StdIngredientListView *list_view = new StdIngredientListView(allIngListView,database); list_view->reload(); allIngListView->setListView(list_view); layout2->addWidget( allIngListView ); - layout1 = new QVBoxLayout( 0, 0, 6, "layout1" ); + layout1 = new TQVBoxLayout( 0, 0, 6, "layout1" ); KIconLoader il; - addButton = new QPushButton( layout2Widget, "addButton" ); + addButton = new TQPushButton( layout2Widget, "addButton" ); addButton->setIconSet( il.loadIconSet( "forward", KIcon::Small ) ); - addButton->setFixedSize( QSize( 32, 32 ) ); + addButton->setFixedSize( TQSize( 32, 32 ) ); layout1->addWidget( addButton ); - removeButton = new QPushButton( layout2Widget, "removeButton" ); + removeButton = new TQPushButton( layout2Widget, "removeButton" ); removeButton->setIconSet( il.loadIconSet( "back", KIcon::Small ) ); - removeButton->setFixedSize( QSize( 32, 32 ) ); + removeButton->setFixedSize( TQSize( 32, 32 ) ); layout1->addWidget( removeButton ); - spacer1 = new QSpacerItem( 51, 191, QSizePolicy::Minimum, QSizePolicy::Expanding ); + spacer1 = new TQSpacerItem( 51, 191, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); layout1->addItem( spacer1 ); layout2->addLayout( layout1 ); - ingListView = new KreListView( layout2Widget, QString::null, true ); + ingListView = new KreListView( layout2Widget, TQString::null, true ); ingListView->listView() ->addColumn( i18n( "Ingredients in Shopping List" ) ); ingListView->listView() ->addColumn( i18n( "Amount" ) ); ingListView->listView() ->addColumn( i18n( "Unit" ) ); @@ -86,7 +86,7 @@ RefineShoppingListDialog::RefineShoppingListDialog( QWidget* parent, RecipeDB *d connect( addButton, SIGNAL( clicked() ), this, SLOT( addIngredient() ) ); connect( removeButton, SIGNAL( clicked() ), this, SLOT( removeIngredient() ) ); - connect( ingListView->listView(), SIGNAL( itemRenamed( QListViewItem*, const QString &, int ) ), SLOT( itemRenamed( QListViewItem*, const QString &, int ) ) ); + connect( ingListView->listView(), SIGNAL( itemRenamed( TQListViewItem*, const TQString &, int ) ), SLOT( itemRenamed( TQListViewItem*, const TQString &, int ) ) ); KApplication::setOverrideCursor( KCursor::waitCursor() ); calculateShopping( recipeList, &ingredientList, database ); @@ -114,7 +114,7 @@ void RefineShoppingListDialog::accept() ShoppingListViewDialog view( this, ingredientList ); view.exec(); - QDialog::accept(); + TQDialog::accept(); } void RefineShoppingListDialog::loadData() @@ -124,7 +124,7 @@ void RefineShoppingListDialog::loadData() (*it).amount = (*it).amount+(*it).amount_offset; (*it).amount_offset = 0; - QString amount_str; + TQString amount_str; if ( ( *it ).amount > 0 ) { KConfig * config = kapp->config(); config->setGroup( "Formatting" ); @@ -135,16 +135,16 @@ void RefineShoppingListDialog::loadData() amount_str = beautify( KGlobal::locale() ->formatNumber( ( *it ).amount, 5 ) ); } - QListViewItem *new_item = new QListViewItem( ingListView->listView(), ( *it ).name, amount_str, ( *it ).amount > 1 ? ( *it ).units.plural : ( *it ).units.name ); + TQListViewItem *new_item = new TQListViewItem( ingListView->listView(), ( *it ).name, amount_str, ( *it ).amount > 1 ? ( *it ).units.plural : ( *it ).units.name ); item_ing_map.insert( new_item, it ); } } void RefineShoppingListDialog::addIngredient() { - QListViewItem * item = allIngListView->listView() ->selectedItem(); + TQListViewItem * item = allIngListView->listView() ->selectedItem(); if ( item ) { - QListViewItem * new_item = new QListViewItem( ingListView->listView(), item->text( 0 ) ); + TQListViewItem * new_item = new TQListViewItem( ingListView->listView(), item->text( 0 ) ); ingListView->listView() ->setSelected( new_item, true ); ingListView->listView() ->ensureItemVisible( new_item ); allIngListView->listView() ->setSelected( item, false ); @@ -155,7 +155,7 @@ void RefineShoppingListDialog::addIngredient() void RefineShoppingListDialog::removeIngredient() { - QListViewItem * item = ingListView->listView() ->selectedItem(); + TQListViewItem * item = ingListView->listView() ->selectedItem(); if ( item ) { for ( IngredientList::iterator it = ingredientList.begin(); it != ingredientList.end(); ++it ) { if ( *item_ing_map.find( item ) == it ) { @@ -168,7 +168,7 @@ void RefineShoppingListDialog::removeIngredient() } } -void RefineShoppingListDialog::itemRenamed( QListViewItem* item, const QString &new_text, int col ) +void RefineShoppingListDialog::itemRenamed( TQListViewItem* item, const TQString &new_text, int col ) { if ( col == 1 ) { IngredientList::iterator found_it = *item_ing_map.find( item ); @@ -179,7 +179,7 @@ void RefineShoppingListDialog::itemRenamed( QListViewItem* item, const QString & ( *found_it ).amount = amount.toDouble(); } else { //revert back to the valid amount string - QString amount_str; + TQString amount_str; if ( ( *found_it ).amount > 0 ) { KConfig * config = kapp->config(); config->setGroup( "Formatting" ); diff --git a/krecipes/src/dialogs/refineshoppinglistdialog.h b/krecipes/src/dialogs/refineshoppinglistdialog.h index 08c4bb9..b427413 100644 --- a/krecipes/src/dialogs/refineshoppinglistdialog.h +++ b/krecipes/src/dialogs/refineshoppinglistdialog.h @@ -11,20 +11,20 @@ #ifndef REFINESHOPPINGLISTDIALOG_H #define REFINESHOPPINGLISTDIALOG_H -#include <qvariant.h> -#include <qmap.h> +#include <ntqvariant.h> +#include <ntqmap.h> #include <kdialogbase.h> #include "datablocks/ingredientlist.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QLabel; -class QListViewItem; -class QPushButton; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQLabel; +class TQListViewItem; +class TQPushButton; class RecipeDB; class ElementList; @@ -35,32 +35,32 @@ class RefineShoppingListDialog : public KDialogBase Q_OBJECT public: - RefineShoppingListDialog( QWidget* parent, RecipeDB *db, const ElementList &recipeList ); + RefineShoppingListDialog( TQWidget* parent, RecipeDB *db, const ElementList &recipeList ); ~RefineShoppingListDialog(); - QLabel* helpLabel; + TQLabel* helpLabel; KreListView* allIngListView; - QPushButton* addButton; - QPushButton* removeButton; + TQPushButton* addButton; + TQPushButton* removeButton; KreListView* ingListView; protected: - QVBoxLayout* layout1; - QSpacerItem* spacer1; + TQVBoxLayout* layout1; + TQSpacerItem* spacer1; protected slots: virtual void languageChange(); virtual void accept(); void addIngredient(); void removeIngredient(); - void itemRenamed( QListViewItem*, const QString &, int ); + void itemRenamed( TQListViewItem*, const TQString &, int ); private: void loadData(); RecipeDB *database; IngredientList ingredientList; - QMap<QListViewItem*, IngredientList::iterator> item_ing_map; + TQMap<TQListViewItem*, IngredientList::iterator> item_ing_map; }; #endif // REFINESHOPPINGLISTDIALOG_H diff --git a/krecipes/src/dialogs/resizerecipedialog.cpp b/krecipes/src/dialogs/resizerecipedialog.cpp index 6d4131c..3b3ef34 100644 --- a/krecipes/src/dialogs/resizerecipedialog.cpp +++ b/krecipes/src/dialogs/resizerecipedialog.cpp @@ -14,19 +14,19 @@ #include <cmath> -#include <qvbox.h> -#include <qvariant.h> -#include <qbuttongroup.h> -#include <qframe.h> -#include <qlabel.h> +#include <ntqvbox.h> +#include <ntqvariant.h> +#include <ntqbuttongroup.h> +#include <ntqframe.h> +#include <ntqlabel.h> #include <knuminput.h> #include <klineedit.h> -#include <qradiobutton.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qimage.h> -#include <qpixmap.h> +#include <ntqradiobutton.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqimage.h> +#include <ntqpixmap.h> #include <klocale.h> #include <kmessagebox.h> @@ -38,43 +38,43 @@ #define FACTOR_RADIO_BUTTON 0 #define SERVINGS_RADIO_BUTTON 1 -ResizeRecipeDialog::ResizeRecipeDialog( QWidget *parent, Recipe *recipe ) +ResizeRecipeDialog::ResizeRecipeDialog( TQWidget *parent, Recipe *recipe ) : KDialogBase( parent, "ResizeRecipeDialog", true, i18n( "Resize Recipe" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), m_recipe( recipe ) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - buttonGroup = new QButtonGroup( page ); - buttonGroup->setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 5, ( QSizePolicy::SizeType ) 7, 0, 1, buttonGroup->sizePolicy().hasHeightForWidth() ) ); + buttonGroup = new TQButtonGroup( page ); + buttonGroup->setSizePolicy( TQSizePolicy( ( TQSizePolicy::SizeType ) 5, ( TQSizePolicy::SizeType ) 7, 0, 1, buttonGroup->sizePolicy().hasHeightForWidth() ) ); buttonGroup->setLineWidth( 0 ); - buttonGroup->setColumnLayout( 0, Qt::Vertical ); + buttonGroup->setColumnLayout( 0, TQt::Vertical ); buttonGroup->layout() ->setSpacing( 6 ); buttonGroup->layout() ->setMargin( 11 ); - buttonGroupLayout = new QVBoxLayout( buttonGroup->layout() ); - buttonGroupLayout->setAlignment( Qt::AlignTop ); + buttonGroupLayout = new TQVBoxLayout( buttonGroup->layout() ); + buttonGroupLayout->setAlignment( TQt::AlignTop ); - yieldRadioButton = new QRadioButton( buttonGroup ); + yieldRadioButton = new TQRadioButton( buttonGroup ); buttonGroup->insert( yieldRadioButton, SERVINGS_RADIO_BUTTON ); buttonGroupLayout->addWidget( yieldRadioButton ); - yieldFrame = new QFrame( buttonGroup ); - yieldFrame->setFrameShape( QFrame::Box ); - yieldFrame->setFrameShadow( QFrame::Sunken ); + yieldFrame = new TQFrame( buttonGroup ); + yieldFrame->setFrameShape( TQFrame::Box ); + yieldFrame->setFrameShadow( TQFrame::Sunken ); yieldFrame->setLineWidth( 1 ); - yieldFrameLayout = new QGridLayout( yieldFrame, 1, 1, 11, 6 ); + yieldFrameLayout = new TQGridLayout( yieldFrame, 1, 1, 11, 6 ); - currentYieldLabel = new QLabel( yieldFrame ); + currentYieldLabel = new TQLabel( yieldFrame ); yieldFrameLayout->addWidget( currentYieldLabel, 0, 0 ); - newYieldLabel = new QLabel( yieldFrame ); + newYieldLabel = new TQLabel( yieldFrame ); yieldFrameLayout->addMultiCellWidget( newYieldLabel, 1, 1, 0, 1 ); currentYieldInput = new KLineEdit( yieldFrame ); currentYieldInput->setReadOnly( TRUE ); - currentYieldInput->setAlignment( Qt::AlignRight ); + currentYieldInput->setAlignment( TQt::AlignRight ); yieldFrameLayout->addMultiCellWidget( currentYieldInput, 0, 0, 1, 2 ); newYieldInput = new FractionInput( yieldFrame ); @@ -82,22 +82,22 @@ ResizeRecipeDialog::ResizeRecipeDialog( QWidget *parent, Recipe *recipe ) buttonGroupLayout->addWidget( yieldFrame ); - factorRadioButton = new QRadioButton( buttonGroup ); + factorRadioButton = new TQRadioButton( buttonGroup ); buttonGroup->insert( factorRadioButton, FACTOR_RADIO_BUTTON ); buttonGroupLayout->addWidget( factorRadioButton ); - factorFrame = new QFrame( buttonGroup ); - factorFrame->setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 7, ( QSizePolicy::SizeType ) 5, 1, 0, factorFrame->sizePolicy().hasHeightForWidth() ) ); - factorFrame->setFrameShape( QFrame::Box ); - factorFrame->setFrameShadow( QFrame::Sunken ); + factorFrame = new TQFrame( buttonGroup ); + factorFrame->setSizePolicy( TQSizePolicy( ( TQSizePolicy::SizeType ) 7, ( TQSizePolicy::SizeType ) 5, 1, 0, factorFrame->sizePolicy().hasHeightForWidth() ) ); + factorFrame->setFrameShape( TQFrame::Box ); + factorFrame->setFrameShadow( TQFrame::Sunken ); factorFrame->setLineWidth( 1 ); - factorFrameLayout = new QHBoxLayout( factorFrame, 11, 6 ); + factorFrameLayout = new TQHBoxLayout( factorFrame, 11, 6 ); - factorLabel = new QLabel( factorFrame ); + factorLabel = new TQLabel( factorFrame ); factorFrameLayout->addWidget( factorLabel ); factorInput = new FractionInput( factorFrame ); - factorInput->setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 7, ( QSizePolicy::SizeType ) 5, 0, 0, factorInput->sizePolicy().hasHeightForWidth() ) ); + factorInput->setSizePolicy( TQSizePolicy( ( TQSizePolicy::SizeType ) 7, ( TQSizePolicy::SizeType ) 5, 0, 0, factorInput->sizePolicy().hasHeightForWidth() ) ); factorFrameLayout->addWidget( factorInput ); buttonGroupLayout->addWidget( factorFrame ); @@ -123,7 +123,7 @@ ResizeRecipeDialog::ResizeRecipeDialog( QWidget *parent, Recipe *recipe ) void ResizeRecipeDialog::languageChange() { - buttonGroup->setTitle( QString::null ); + buttonGroup->setTitle( TQString::null ); yieldRadioButton->setText( i18n( "Scale by yield" ) ); newYieldLabel->setText( i18n( "New yield:" ) ); currentYieldLabel->setText( i18n( "Current yield:" ) ); @@ -174,7 +174,7 @@ void ResizeRecipeDialog::accept() } } - QDialog::accept(); + TQDialog::accept(); } //TODO YIELD: handle ranges diff --git a/krecipes/src/dialogs/resizerecipedialog.h b/krecipes/src/dialogs/resizerecipedialog.h index 219e79d..043ccbf 100644 --- a/krecipes/src/dialogs/resizerecipedialog.h +++ b/krecipes/src/dialogs/resizerecipedialog.h @@ -17,17 +17,17 @@ class Recipe; -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; class FractionInput; -class QButtonGroup; -class QFrame; -class QLabel; +class TQButtonGroup; +class TQFrame; +class TQLabel; class KIntNumInput; class KLineEdit; -class QRadioButton; -class QPushButton; +class TQRadioButton; +class TQPushButton; /** *@author Jason Kivlighn @@ -37,7 +37,7 @@ class ResizeRecipeDialog : public KDialogBase Q_OBJECT public: - ResizeRecipeDialog( QWidget *parent, Recipe* ); + ResizeRecipeDialog( TQWidget *parent, Recipe* ); protected slots: void accept(); @@ -49,21 +49,21 @@ private: Recipe *m_recipe; - QButtonGroup* buttonGroup; - QRadioButton* yieldRadioButton; - QFrame* yieldFrame; - QLabel* currentYieldLabel; - QLabel* newYieldLabel; + TQButtonGroup* buttonGroup; + TQRadioButton* yieldRadioButton; + TQFrame* yieldFrame; + TQLabel* currentYieldLabel; + TQLabel* newYieldLabel; KLineEdit* currentYieldInput; FractionInput* newYieldInput; - QRadioButton* factorRadioButton; - QFrame* factorFrame; - QLabel* factorLabel; + TQRadioButton* factorRadioButton; + TQFrame* factorFrame; + TQLabel* factorLabel; FractionInput* factorInput; - QVBoxLayout* buttonGroupLayout; - QGridLayout* yieldFrameLayout; - QHBoxLayout* factorFrameLayout; + TQVBoxLayout* buttonGroupLayout; + TQGridLayout* yieldFrameLayout; + TQHBoxLayout* factorFrameLayout; }; #endif //RESIZERECIPEDIALOG_H diff --git a/krecipes/src/dialogs/selectauthorsdialog.cpp b/krecipes/src/dialogs/selectauthorsdialog.cpp index 9618253..d400aef 100644 --- a/krecipes/src/dialogs/selectauthorsdialog.cpp +++ b/krecipes/src/dialogs/selectauthorsdialog.cpp @@ -12,8 +12,8 @@ #include "selectauthorsdialog.h" -#include <qmessagebox.h> -#include <qvbox.h> +#include <ntqmessagebox.h> +#include <ntqvbox.h> #include <kconfig.h> #include <kdialog.h> @@ -23,39 +23,39 @@ #include "backends/recipedb.h" -SelectAuthorsDialog::SelectAuthorsDialog( QWidget *parent, const ElementList ¤tAuthors, RecipeDB *db ) +SelectAuthorsDialog::SelectAuthorsDialog( TQWidget *parent, const ElementList ¤tAuthors, RecipeDB *db ) : KDialogBase( parent, "SelectAuthorsDialog", true, i18n("Authors"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), database(db) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); //Design UI // Combo to Pick authors - QHBox *topBox = new QHBox(page); + TQHBox *topBox = new TQHBox(page); topBox->setSpacing(6); authorsCombo = new KComboBox( true, topBox ); - authorsCombo->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + authorsCombo->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); authorsCombo->completionObject() ->setCompletionMode( KGlobalSettings::CompletionPopupAuto ); authorsCombo->lineEdit() ->disconnect( authorsCombo ); //so hitting enter doesn't enter the item into the box // Add/Remove buttons il = new KIconLoader; - addAuthorButton = new QPushButton( topBox ); - QPixmap pm = il->loadIcon( "down", KIcon::NoGroup, 16 ); + addAuthorButton = new TQPushButton( topBox ); + TQPixmap pm = il->loadIcon( "down", KIcon::NoGroup, 16 ); addAuthorButton->setIconSet( pm ); - removeAuthorButton = new QPushButton( topBox ); + removeAuthorButton = new TQPushButton( topBox ); pm = il->loadIcon( "up", KIcon::NoGroup, 16 ); removeAuthorButton->setIconSet( pm ); // Author List authorListView = new KListView( page ); - authorListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + authorListView->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); KConfig * config = KGlobal::config(); config->setGroup( "Advanced" ); @@ -74,7 +74,7 @@ SelectAuthorsDialog::SelectAuthorsDialog( QWidget *parent, const ElementList &cu connect ( addAuthorButton, SIGNAL( clicked() ), this, SLOT( addAuthor() ) ); connect ( removeAuthorButton, SIGNAL( clicked() ), this, SLOT( removeAuthor() ) ); - authorsCombo->setEditText(QString::null); + authorsCombo->setEditText(TQString::null); authorsCombo->lineEdit()->setFocus(); } @@ -84,7 +84,7 @@ SelectAuthorsDialog::~SelectAuthorsDialog() void SelectAuthorsDialog::getSelectedAuthors( ElementList *newAuthors ) { - for ( QListViewItem * it = authorListView->firstChild();it; it = it->nextSibling() ) { + for ( TQListViewItem * it = authorListView->firstChild();it; it = it->nextSibling() ) { Element author; author.id = it->text( 0 ).toInt(); author.name = it->text( 1 ); @@ -102,7 +102,7 @@ void SelectAuthorsDialog::loadAuthors( const ElementList ¤tAuthors ) // Load the ListView with the authors of this recipe authorListView->clear(); for ( ElementList::const_iterator author_it = currentAuthors.begin(); author_it != currentAuthors.end(); ++author_it ) { - ( void ) new QListViewItem( authorListView, QString::number( ( *author_it ).id ), ( *author_it ).name ); + ( void ) new TQListViewItem( authorListView, TQString::number( ( *author_it ).id ), ( *author_it ).name ); } } @@ -111,7 +111,7 @@ void SelectAuthorsDialog::addAuthor( void ) { //check bounds first if ( authorsCombo->currentText().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() ) ); authorsCombo->lineEdit() ->selectAll(); return ; } @@ -127,14 +127,14 @@ void SelectAuthorsDialog::addAuthor( void ) int currentItem = authorsCombo->currentItem(); Element currentElement = authorList.getElement( currentItem ); - ( void ) new QListViewItem( authorListView, QString::number( currentElement.id ), currentElement.name ); + ( void ) new TQListViewItem( authorListView, TQString::number( currentElement.id ), currentElement.name ); } void SelectAuthorsDialog::removeAuthor( void ) { // Find the selected item first - QListViewItem * it; + TQListViewItem * it; it = authorListView->selectedItem(); if ( it ) { // Check if an author is selected first @@ -149,7 +149,7 @@ void SelectAuthorsDialog::createNewAuthorIfNecessary( void ) if ( !authorsCombo->contains( authorsCombo->currentText() ) && !( authorsCombo->currentText().stripWhiteSpace() ).isEmpty() ) // author is not in the list and is not empty { // Create new author - QString newAuthorName = authorsCombo->currentText(); + TQString newAuthorName = authorsCombo->currentText(); database->createNewAuthor( newAuthorName ); //List again the authors reloadAuthorsCombo(); diff --git a/krecipes/src/dialogs/selectauthorsdialog.h b/krecipes/src/dialogs/selectauthorsdialog.h index 0417ca2..c555a17 100644 --- a/krecipes/src/dialogs/selectauthorsdialog.h +++ b/krecipes/src/dialogs/selectauthorsdialog.h @@ -13,8 +13,8 @@ #ifndef SELECTAUTHORSDIALOG_H #define SELECTAUTHORSDIALOG_H -#include <qlayout.h> -#include <qpushbutton.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> #include <kdialogbase.h> #include <kiconloader.h> @@ -35,7 +35,7 @@ class SelectAuthorsDialog: public KDialogBase public: - SelectAuthorsDialog( QWidget *parent, const ElementList ¤tAuthors, RecipeDB *db ); + SelectAuthorsDialog( TQWidget *parent, const ElementList ¤tAuthors, RecipeDB *db ); ~SelectAuthorsDialog(); void getSelectedAuthors( ElementList *newAuthors ); @@ -44,10 +44,10 @@ private: //Widgets KComboBox *authorsCombo; KListView *authorListView; - QPushButton *okButton; - QPushButton *cancelButton; - QPushButton *addAuthorButton; - QPushButton *removeAuthorButton; + TQPushButton *okButton; + TQPushButton *cancelButton; + TQPushButton *addAuthorButton; + TQPushButton *removeAuthorButton; KIconLoader *il; //Variables diff --git a/krecipes/src/dialogs/selectcategoriesdialog.cpp b/krecipes/src/dialogs/selectcategoriesdialog.cpp index bfe57db..6674182 100644 --- a/krecipes/src/dialogs/selectcategoriesdialog.cpp +++ b/krecipes/src/dialogs/selectcategoriesdialog.cpp @@ -13,7 +13,7 @@ #include "selectcategoriesdialog.h" #include "createcategorydialog.h" -#include <qvbox.h> +#include <ntqvbox.h> #include <klocale.h> #include <kdebug.h> @@ -24,12 +24,12 @@ #include "backends/recipedb.h" #include "widgets/categorylistview.h" -SelectCategoriesDialog::SelectCategoriesDialog( QWidget *parent, const ElementList &items_on, RecipeDB *db ) +SelectCategoriesDialog::SelectCategoriesDialog( TQWidget *parent, const ElementList &items_on, RecipeDB *db ) : KDialogBase( parent, "SelectCategoriesDialog", true, i18n("Categories"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), database(db) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); //Design UI @@ -38,7 +38,7 @@ SelectCategoriesDialog::SelectCategoriesDialog( QWidget *parent, const ElementLi categoryListView->reload(); //New category button - QPushButton *newCatButton = new QPushButton( page ); + TQPushButton *newCatButton = new TQPushButton( page ); newCatButton->setText( i18n( "&New Category..." ) ); newCatButton->setFlat( true ); @@ -65,7 +65,7 @@ void SelectCategoriesDialog::loadCategories( const ElementList &items_on ) ElementList::const_iterator it; for ( it = items_on.begin(); it != items_on.end(); ++it ) { - CategoryCheckListItem *new_item = (CategoryCheckListItem*)categoryListView->findItem(QString::number((*it).id),1); + CategoryCheckListItem *new_item = (CategoryCheckListItem*)categoryListView->findItem(TQString::number((*it).id),1); if ( new_item ) { new_item->setOn(true); } @@ -78,13 +78,13 @@ void SelectCategoriesDialog::createNewCategory( void ) 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 if ( result.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 ; } @@ -92,7 +92,7 @@ void SelectCategoriesDialog::createNewCategory( void ) //a listview item will automatically be created, but we need to turn it on Element new_cat( result, database->lastInsertID() ); - QCheckListItem *new_item = ((QCheckListItem*)categoryListView->findItem( QString::number(new_cat.id), 1 )); + TQCheckListItem *new_item = ((TQCheckListItem*)categoryListView->findItem( TQString::number(new_cat.id), 1 )); if ( new_item ) new_item->setOn(true); } diff --git a/krecipes/src/dialogs/selectcategoriesdialog.h b/krecipes/src/dialogs/selectcategoriesdialog.h index e9851b6..f65ad1f 100644 --- a/krecipes/src/dialogs/selectcategoriesdialog.h +++ b/krecipes/src/dialogs/selectcategoriesdialog.h @@ -13,8 +13,8 @@ #ifndef SELECTCATEGORIESDIALOG_H #define SELECTCATEGORIESDIALOG_H -#include <qlayout.h> -#include <qpushbutton.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> #include <klistview.h> #include <kdialogbase.h> @@ -36,7 +36,7 @@ class SelectCategoriesDialog: public KDialogBase public: - SelectCategoriesDialog( QWidget *parent, const ElementList &items_on, RecipeDB* db ); + SelectCategoriesDialog( TQWidget *parent, const ElementList &items_on, RecipeDB* db ); ~SelectCategoriesDialog(); void getSelectedCategories( ElementList *selected ); private: diff --git a/krecipes/src/dialogs/selectpropertydialog.cpp b/krecipes/src/dialogs/selectpropertydialog.cpp index acf3c79..8b46d12 100644 --- a/krecipes/src/dialogs/selectpropertydialog.cpp +++ b/krecipes/src/dialogs/selectpropertydialog.cpp @@ -18,7 +18,7 @@ #include "datablocks/ingredientpropertylist.h" -SelectPropertyDialog::SelectPropertyDialog( QWidget* parent, IngredientPropertyList *propertyList, UnitList *unitList, OptionFlag showEmpty ) +SelectPropertyDialog::SelectPropertyDialog( TQWidget* parent, IngredientPropertyList *propertyList, UnitList *unitList, OptionFlag showEmpty ) : KDialogBase( parent, "SelectPropertyDialog", true, i18n( "Choose Property" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), m_showEmpty(showEmpty) { @@ -27,15 +27,15 @@ SelectPropertyDialog::SelectPropertyDialog( QWidget* parent, IngredientPropertyL unitListBack = new UnitList; // Initialize Widgets - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); + box = new TQGroupBox( page ); box->setTitle( i18n( "Choose Property" ) ); - box->setColumnLayout( 0, Qt::Vertical ); + 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 ); propertyChooseView = new KListView( box, "propertyChooseView" ); @@ -48,10 +48,10 @@ SelectPropertyDialog::SelectPropertyDialog( QWidget* parent, IngredientPropertyL propertyChooseView->setAllColumnsShowFocus( true ); boxLayout->addWidget( propertyChooseView ); - QHBoxLayout *layout2 = new QHBoxLayout; + TQHBoxLayout *layout2 = new TQHBoxLayout; - perUnitsLabel = new QLabel( box ); - perUnitsLabel->setGeometry( QRect( 5, 285, 100, 30 ) ); + perUnitsLabel = new TQLabel( box ); + perUnitsLabel->setGeometry( TQRect( 5, 285, 100, 30 ) ); perUnitsLabel->setText( i18n( "Per units:" ) ); layout2->addWidget( perUnitsLabel ); @@ -59,7 +59,7 @@ SelectPropertyDialog::SelectPropertyDialog( QWidget* parent, IngredientPropertyL layout2->addWidget( perUnitsBox ); boxLayout->addLayout( layout2 ); - resize( QSize( 200, 380 ).expandedTo( minimumSizeHint() ) ); + resize( TQSize( 200, 380 ).expandedTo( minimumSizeHint() ) ); clearWState( WState_Polished ); // Load data @@ -75,7 +75,7 @@ SelectPropertyDialog::~SelectPropertyDialog() int SelectPropertyDialog::propertyID( void ) { - QListViewItem * it; + TQListViewItem * it; if ( ( it = propertyChooseView->selectedItem() ) ) { return ( it->text( 0 ).toInt() ); } @@ -98,13 +98,13 @@ int SelectPropertyDialog::perUnitsID() void SelectPropertyDialog::loadProperties( IngredientPropertyList *propertyList ) { for ( IngredientPropertyList::const_iterator prop_it = propertyList->begin(); prop_it != propertyList->end(); ++prop_it ) { - ( void ) new QListViewItem( propertyChooseView, QString::number( (*prop_it).id ), (*prop_it).name ); + ( void ) new TQListViewItem( propertyChooseView, TQString::number( (*prop_it).id ), (*prop_it).name ); } } void SelectPropertyDialog::loadUnits( UnitList *unitList ) { for ( UnitList::const_iterator unit_it = unitList->begin(); unit_it != unitList->end(); ++unit_it ) { - QString unitName = ( *unit_it ).name; + TQString unitName = ( *unit_it ).name; if ( unitName.isEmpty() ) { if ( m_showEmpty == ShowEmptyUnit ) unitName = " "+i18n("-No unit-"); diff --git a/krecipes/src/dialogs/selectpropertydialog.h b/krecipes/src/dialogs/selectpropertydialog.h index f3eacf9..1b6fa7c 100644 --- a/krecipes/src/dialogs/selectpropertydialog.h +++ b/krecipes/src/dialogs/selectpropertydialog.h @@ -13,12 +13,12 @@ #ifndef SELECTPROPERTYDIALOG_H #define SELECTPROPERTYDIALOG_H -#include <qwidget.h> -#include <qlayout.h> -#include <qgroupbox.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qvbox.h> +#include <ntqwidget.h> +#include <ntqlayout.h> +#include <ntqgroupbox.h> +#include <ntqlabel.h> +#include <ntqpushbutton.h> +#include <ntqvbox.h> #include <klistview.h> #include <kcombobox.h> @@ -37,15 +37,15 @@ public: typedef enum OptionFlag { ShowEmptyUnit, HideEmptyUnit } ; // Methods - SelectPropertyDialog( QWidget* parent, IngredientPropertyList *propertyList, UnitList *unitList, OptionFlag showEmpty = ShowEmptyUnit ); + SelectPropertyDialog( TQWidget* parent, IngredientPropertyList *propertyList, UnitList *unitList, OptionFlag showEmpty = ShowEmptyUnit ); ~SelectPropertyDialog(); int propertyID( void ); int perUnitsID( void ); private: //Widgets - QGroupBox *box; + TQGroupBox *box; KListView *propertyChooseView; - QLabel *perUnitsLabel; + TQLabel *perUnitsLabel; KComboBox *perUnitsBox; OptionFlag m_showEmpty; diff --git a/krecipes/src/dialogs/selectrecipedialog.cpp b/krecipes/src/dialogs/selectrecipedialog.cpp index 502e5dc..b738c3b 100644 --- a/krecipes/src/dialogs/selectrecipedialog.cpp +++ b/krecipes/src/dialogs/selectrecipedialog.cpp @@ -12,9 +12,9 @@ #include "selectrecipedialog.h" -#include <qsignalmapper.h> -#include <qtabwidget.h> -#include <qtooltip.h> +#include <ntqsignalmapper.h> +#include <ntqtabwidget.h> +#include <ntqtooltip.h> #include <klocale.h> #include <kdebug.h> @@ -37,45 +37,45 @@ #include "widgets/categorylistview.h" #include "widgets/categorycombobox.h" -SelectRecipeDialog::SelectRecipeDialog( QWidget *parent, RecipeDB* db ) - : QWidget( parent ) +SelectRecipeDialog::SelectRecipeDialog( TQWidget *parent, RecipeDB* db ) + : TQWidget( parent ) { //Store pointer to Recipe Database database = db; - QVBoxLayout *tabLayout = new QVBoxLayout( this ); - tabWidget = new QTabWidget( this ); - tabWidget->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + TQVBoxLayout *tabLayout = new TQVBoxLayout( this ); + tabWidget = new TQTabWidget( this ); + tabWidget->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); tabLayout->addWidget( tabWidget ); - basicSearchTab = new QGroupBox( this ); - basicSearchTab->setFrameStyle( QFrame::NoFrame ); - basicSearchTab->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); + basicSearchTab = new TQGroupBox( this ); + basicSearchTab->setFrameStyle( TQFrame::NoFrame ); + basicSearchTab->setSizePolicy( TQSizePolicy( TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding ) ); //Design dialog - layout = new QGridLayout( basicSearchTab, 1, 1, 0, 0 ); + layout = new TQGridLayout( basicSearchTab, 1, 1, 0, 0 ); // Border Spacers - QSpacerItem* spacer_left = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* spacer_left = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addMultiCell( spacer_left, 1, 4, 0, 0 ); - QSpacerItem* spacer_top = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacer_top = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addMultiCell( spacer_top, 0, 0, 1, 4 ); - searchBar = new QHBox( basicSearchTab ); + searchBar = new TQHBox( basicSearchTab ); searchBar->setSpacing( 7 ); layout->addWidget( searchBar, 1, 1 ); KIconLoader *il = new KIconLoader; - QPushButton *clearSearchButton = new QPushButton( searchBar ); + TQPushButton *clearSearchButton = new TQPushButton( searchBar ); clearSearchButton->setPixmap( il->loadIcon( "locationbar_erase", KIcon::NoGroup, 16 ) ); - searchLabel = new QLabel( searchBar ); + searchLabel = new TQLabel( searchBar ); searchLabel->setText( i18n( "Search:" ) ); searchLabel->setFixedWidth( searchLabel->fontMetrics().width( i18n( "Search:" ) ) + 5 ); searchBox = new KLineEdit( searchBar ); - QSpacerItem* searchSpacer = new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Minimum ); + TQSpacerItem* searchSpacer = new TQSpacerItem( 10, 10, TQSizePolicy::Fixed, TQSizePolicy::Minimum ); layout->addItem( searchSpacer, 1, 2 ); #ifdef ENABLE_SLOW @@ -83,28 +83,28 @@ SelectRecipeDialog::SelectRecipeDialog( QWidget *parent, RecipeDB* db ) layout->addWidget( categoryBox, 1, 3 ); #endif - QSpacerItem* spacerFromSearchBar = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Fixed ); + TQSpacerItem* spacerFromSearchBar = new TQSpacerItem( 10, 10, TQSizePolicy::Minimum, TQSizePolicy::Fixed ); layout->addItem( spacerFromSearchBar, 2, 1 ); recipeListView = new RecipeListView( basicSearchTab, database ); recipeListView->reload(); - recipeListView->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Expanding ); + recipeListView->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Expanding ); layout->addMultiCellWidget( recipeListView, 3, 3, 1, 3 ); - buttonBar = new QHBox( basicSearchTab ); + buttonBar = new TQHBox( basicSearchTab ); layout->addMultiCellWidget( buttonBar, 4, 4, 1, 3 ); - openButton = new QPushButton( buttonBar ); + openButton = new TQPushButton( buttonBar ); openButton->setText( i18n( "Open Recipe(s)" ) ); openButton->setDisabled( true ); - QPixmap pm = il->loadIcon( "ok", KIcon::NoGroup, 16 ); + TQPixmap pm = il->loadIcon( "ok", KIcon::NoGroup, 16 ); openButton->setIconSet( pm ); - editButton = new QPushButton( buttonBar ); + editButton = new TQPushButton( buttonBar ); editButton->setText( i18n( "Edit Recipe" ) ); editButton->setDisabled( true ); pm = il->loadIcon( "edit", KIcon::NoGroup, 16 ); editButton->setIconSet( pm ); - removeButton = new QPushButton( buttonBar ); + removeButton = new TQPushButton( buttonBar ); removeButton->setText( i18n( "Delete" ) ); removeButton->setDisabled( true ); removeButton->setMaximumWidth( 100 ); @@ -116,7 +116,7 @@ SelectRecipeDialog::SelectRecipeDialog( QWidget *parent, RecipeDB* db ) advancedSearch = new AdvancedSearchDialog( this, database ); tabWidget->insertTab( advancedSearch, i18n( "Advanced" ) ); - QToolTip::add( clearSearchButton, i18n( "Clear search" ) ); + TQToolTip::add( clearSearchButton, i18n( "Clear search" ) ); //Takes care of all recipe actions and provides a popup menu to 'recipeListView' actionHandler = new RecipeActionsHandler( recipeListView, database ); @@ -137,13 +137,13 @@ SelectRecipeDialog::SelectRecipeDialog( QWidget *parent, RecipeDB* db ) KConfig * config = kapp->config(); config->setGroup( "Performance" ); if ( config->readBoolEntry("SearchAsYouType",true) ) { - connect( searchBox, SIGNAL( returnPressed( const QString& ) ), recipeFilter, SLOT( filter( const QString& ) ) ); - connect( searchBox, SIGNAL( textChanged( const QString& ) ), this, SLOT( ensurePopulated() ) ); - connect( searchBox, SIGNAL( textChanged( const QString& ) ), recipeFilter, SLOT( filter( const QString& ) ) ); + connect( searchBox, SIGNAL( returnPressed( const TQString& ) ), recipeFilter, SLOT( filter( const TQString& ) ) ); + connect( searchBox, SIGNAL( textChanged( const TQString& ) ), this, SLOT( ensurePopulated() ) ); + connect( searchBox, SIGNAL( textChanged( const TQString& ) ), recipeFilter, SLOT( filter( const TQString& ) ) ); } else { - connect( searchBox, SIGNAL( returnPressed( const QString& ) ), this, SLOT( ensurePopulated() ) ); - connect( searchBox, SIGNAL( returnPressed( const QString& ) ), recipeFilter, SLOT( filter( const QString& ) ) ); + connect( searchBox, SIGNAL( returnPressed( const TQString& ) ), this, SLOT( ensurePopulated() ) ); + connect( searchBox, SIGNAL( returnPressed( const TQString& ) ), recipeFilter, SLOT( filter( const TQString& ) ) ); } connect( recipeListView, SIGNAL( selectionChanged() ), this, SLOT( haveSelectedItems() ) ); @@ -156,10 +156,10 @@ SelectRecipeDialog::SelectRecipeDialog( QWidget *parent, RecipeDB* db ) connect( recipeListView, SIGNAL( prevGroupLoaded() ), SLOT( refilter() ) ); connect( advancedSearch, SIGNAL( recipeSelected( int, int ) ), SIGNAL( recipeSelected( int, int ) ) ); - connect( advancedSearch, SIGNAL( recipesSelected( const QValueList<int> &, int ) ), SIGNAL( recipesSelected( const QValueList<int> &, int ) ) ); + connect( advancedSearch, SIGNAL( recipesSelected( const TQValueList<int> &, int ) ), SIGNAL( recipesSelected( const TQValueList<int> &, int ) ) ); connect( actionHandler, SIGNAL( recipeSelected( int, int ) ), SIGNAL( recipeSelected( int, int ) ) ); - connect( actionHandler, SIGNAL( recipesSelected( const QValueList<int> &, int ) ), SIGNAL( recipesSelected( const QValueList<int> &, int ) ) ); + connect( actionHandler, SIGNAL( recipesSelected( const TQValueList<int> &, int ) ), SIGNAL( recipesSelected( const TQValueList<int> &, int ) ) ); delete il; } @@ -171,8 +171,8 @@ SelectRecipeDialog::~SelectRecipeDialog() void SelectRecipeDialog::clearSearch() { - searchBox->setText( QString::null ); - recipeFilter->filter( QString::null ); + searchBox->setText( TQString::null ); + recipeFilter->filter( TQString::null ); } void SelectRecipeDialog::reload( ReloadFlags flag ) @@ -208,7 +208,7 @@ void SelectRecipeDialog::haveSelectedItems() void SelectRecipeDialog::getCurrentRecipe( Recipe *recipe ) { - QPtrList<QListViewItem> items = recipeListView->selectedItems(); + TQPtrList<TQListViewItem> items = recipeListView->selectedItems(); if ( items.count() == 1 && items.at(0)->rtti() == 1000 ) { RecipeListItem * recipe_it = ( RecipeListItem* )items.at(0); database->loadRecipe( recipe, RecipeDB::All, recipe_it->recipeID() ); @@ -229,9 +229,9 @@ void SelectRecipeDialog::filterComboCategory( int row ) recipeFilter->filter( searchBox->text() ); if ( categoryID != -1 ) { - QListViewItemIterator it( recipeListView ); + TQListViewItemIterator it( recipeListView ); while ( it.current() ) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); if ( item->isVisible() ) { item->setOpen( true ); //will only open if already populated //(could be the selected category's parent diff --git a/krecipes/src/dialogs/selectrecipedialog.h b/krecipes/src/dialogs/selectrecipedialog.h index ae689e6..e9ea0f6 100644 --- a/krecipes/src/dialogs/selectrecipedialog.h +++ b/krecipes/src/dialogs/selectrecipedialog.h @@ -14,12 +14,12 @@ #define SELECTRECIPEDIALOG_H -#include <qwidget.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qcursor.h> -#include <qintdict.h> +#include <ntqwidget.h> +#include <ntqpushbutton.h> +#include <ntqlabel.h> +#include <ntqlayout.h> +#include <ntqcursor.h> +#include <ntqintdict.h> #include <kcombobox.h> #include <klineedit.h> @@ -31,8 +31,8 @@ #include "recipeactionshandler.h" #include "widgets/dblistviewbase.h" -class QHBox; -class QGroupBox; +class TQHBox; +class TQGroupBox; class RecipeDB; class ElementList; @@ -46,11 +46,11 @@ class CategoryComboBox; /** @author Unai Garro */ -class SelectRecipeDialog : public QWidget +class SelectRecipeDialog : public TQWidget { Q_OBJECT public: - SelectRecipeDialog( QWidget *parent, RecipeDB *db ); + SelectRecipeDialog( TQWidget *parent, RecipeDB *db ); ~SelectRecipeDialog(); @@ -62,16 +62,16 @@ public: private: // Widgets - QGridLayout *layout; - QTabWidget *tabWidget; - QGroupBox *basicSearchTab; - QHBox *searchBar; + TQGridLayout *layout; + TQTabWidget *tabWidget; + TQGroupBox *basicSearchTab; + TQHBox *searchBar; RecipeListView* recipeListView; - QHBox *buttonBar; - QPushButton *openButton; - QPushButton *removeButton; - QPushButton *editButton; - QLabel *searchLabel; + TQHBox *buttonBar; + TQPushButton *openButton; + TQPushButton *removeButton; + TQPushButton *editButton; + TQLabel *searchLabel; KLineEdit *searchBox; CategoryComboBox *categoryBox; AdvancedSearchDialog *advancedSearch; @@ -82,7 +82,7 @@ private: signals: void recipeSelected( int id, int action ); - void recipesSelected( const QValueList<int> &ids, int action ); + void recipesSelected( const TQValueList<int> &ids, int action ); void recipeSelected( bool ); private slots: diff --git a/krecipes/src/dialogs/selectunitdialog.cpp b/krecipes/src/dialogs/selectunitdialog.cpp index fff6c29..2478fc1 100644 --- a/krecipes/src/dialogs/selectunitdialog.cpp +++ b/krecipes/src/dialogs/selectunitdialog.cpp @@ -16,16 +16,16 @@ #include <kglobal.h> #include <klocale.h> -SelectUnitDialog::SelectUnitDialog( QWidget* parent, const UnitList &unitList, OptionFlag showEmpty ) +SelectUnitDialog::SelectUnitDialog( TQWidget* parent, const UnitList &unitList, OptionFlag showEmpty ) : KDialogBase( parent, "SelectUnitDialog", true, i18n( "Choose Unit" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), m_showEmpty(showEmpty) { - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); - box = new QGroupBox( page ); + box = new TQGroupBox( page ); box->setTitle( i18n( "Choose Unit" ) ); - box->setColumnLayout( 0, Qt::Vertical ); - QVBoxLayout *boxLayout = new QVBoxLayout( box->layout() ); + box->setColumnLayout( 0, TQt::Vertical ); + TQVBoxLayout *boxLayout = new TQVBoxLayout( box->layout() ); unitChooseView = new KListView( box ); @@ -36,11 +36,11 @@ SelectUnitDialog::SelectUnitDialog( QWidget* parent, const UnitList &unitList, O unitChooseView->addColumn( i18n( "Unit" ) ); unitChooseView->setSorting(1); - unitChooseView->setGeometry( QRect( 5, 30, 180, 250 ) ); + unitChooseView->setGeometry( TQRect( 5, 30, 180, 250 ) ); unitChooseView->setAllColumnsShowFocus( true ); boxLayout->addWidget( unitChooseView ); - resize( QSize( 200, 350 ) ); + resize( TQSize( 200, 350 ) ); loadUnits( unitList ); } @@ -52,7 +52,7 @@ SelectUnitDialog::~SelectUnitDialog() int SelectUnitDialog::unitID( void ) { - QListViewItem * it; + TQListViewItem * it; if ( ( it = unitChooseView->selectedItem() ) ) { return ( it->text( 0 ).toInt() ); } @@ -63,7 +63,7 @@ int SelectUnitDialog::unitID( void ) void SelectUnitDialog::loadUnits( const UnitList &unitList ) { for ( UnitList::const_iterator unit_it = unitList.begin(); unit_it != unitList.end(); ++unit_it ) { - QString unitName = ( *unit_it ).name; + TQString unitName = ( *unit_it ).name; if ( unitName.isEmpty() ) { if ( m_showEmpty == ShowEmptyUnit ) unitName = " "+i18n("-No unit-"); @@ -71,7 +71,7 @@ void SelectUnitDialog::loadUnits( const UnitList &unitList ) continue; } - ( void ) new QListViewItem( unitChooseView, QString::number( ( *unit_it ).id ), unitName ); + ( void ) new TQListViewItem( unitChooseView, TQString::number( ( *unit_it ).id ), unitName ); } } diff --git a/krecipes/src/dialogs/selectunitdialog.h b/krecipes/src/dialogs/selectunitdialog.h index f9371ca..03b4762 100644 --- a/krecipes/src/dialogs/selectunitdialog.h +++ b/krecipes/src/dialogs/selectunitdialog.h @@ -13,11 +13,11 @@ #ifndef SELECTUNITDIALOG_H #define SELECTUNITDIALOG_H -#include <qwidget.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qgroupbox.h> -#include <qvbox.h> +#include <ntqwidget.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> +#include <ntqgroupbox.h> +#include <ntqvbox.h> #include <klistview.h> #include <kdialogbase.h> @@ -32,7 +32,7 @@ class SelectUnitDialog : public KDialogBase public: typedef enum OptionFlag { ShowEmptyUnit, HideEmptyUnit } ; - SelectUnitDialog( QWidget* parent, const UnitList &unitList, OptionFlag = ShowEmptyUnit ); + SelectUnitDialog( TQWidget* parent, const UnitList &unitList, OptionFlag = ShowEmptyUnit ); ~SelectUnitDialog(); @@ -40,7 +40,7 @@ public: private: //Widgets - QGroupBox *box; + TQGroupBox *box; KListView *unitChooseView; OptionFlag m_showEmpty; diff --git a/krecipes/src/dialogs/setupdisplay.cpp b/krecipes/src/dialogs/setupdisplay.cpp index 1ab66d8..1b1db6a 100644 --- a/krecipes/src/dialogs/setupdisplay.cpp +++ b/krecipes/src/dialogs/setupdisplay.cpp @@ -25,16 +25,16 @@ #include <dom/dom_doc.h> #include <dom/css_rule.h> -#include <qinputdialog.h> -#include <qaction.h> -#include <qlabel.h> -#include <qfile.h> -#include <qregexp.h> -#include <qtextedit.h> -#include <qtooltip.h> -#include <qobjectlist.h> -#include <qvaluelist.h> -#include <qlayout.h> +#include <ntqinputdialog.h> +#include <ntqaction.h> +#include <ntqlabel.h> +#include <ntqfile.h> +#include <ntqregexp.h> +#include <ntqtextedit.h> +#include <ntqtooltip.h> +#include <ntqobjectlist.h> +#include <ntqvaluelist.h> +#include <ntqlayout.h> #include "datablocks/mixednumber.h" #include "dialogs/borderdialog.h" @@ -42,27 +42,27 @@ #include <cmath> -KreDisplayItem::KreDisplayItem( const QString &n, const QString &_name ) : nodeId(n), name(_name) +KreDisplayItem::KreDisplayItem( const TQString &n, const TQString &_name ) : nodeId(n), name(_name) { clear(); } void KreDisplayItem::clear() { - alignment = Qt::AlignHCenter; + alignment = TQt::AlignHCenter; show = true; - backgroundColor = QColor(255,255,255); - textColor = QColor(0,0,0); + backgroundColor = TQColor(255,255,255); + textColor = TQColor(0,0,0); columns = 1; } -SetupDisplay::SetupDisplay( const Recipe &sample, QWidget *parent ) : KHTMLPart(parent), +SetupDisplay::SetupDisplay( const Recipe &sample, TQWidget *parent ) : KHTMLPart(parent), box_properties( new PropertiesMap ), - node_item_map( new QMap<QString, KreDisplayItem*> ), + node_item_map( new TQMap<TQString, KreDisplayItem*> ), has_changes( false ), popup(0) { - connect( this, SIGNAL( popupMenu(const QString &,const QPoint &) ), SLOT( nodeClicked(const QString &,const QPoint &) ) ); + connect( this, SIGNAL( popupMenu(const TQString &,const TQPoint &) ), SLOT( nodeClicked(const TQString &,const TQPoint &) ) ); if ( sample.recipeID != -1 ) m_sample = sample; @@ -71,7 +71,7 @@ SetupDisplay::SetupDisplay( const Recipe &sample, QWidget *parent ) : KHTMLPart( m_sample.yield.amount = 0; m_sample.categoryList.append( Element(i18n( "Category 1, Category 2, ..." ) ) ); m_sample.instructions = i18n("Instructions"); - m_sample.prepTime = QTime(0,0); + m_sample.prepTime = TQTime(0,0); m_sample.authorList.append( Element(i18n( "Author 1, Author 2, ..." )) ); @@ -132,22 +132,22 @@ SetupDisplay::~SetupDisplay() delete node_item_map; } -void SetupDisplay::loadHTMLView( const QString &templateFile, const QString &styleFile ) +void SetupDisplay::loadHTMLView( const TQString &templateFile, const TQString &styleFile ) { kdDebug()<<"loading template: "<<templateFile<<" style: "<<styleFile<<endl; - QString tmp_filename = locateLocal( "tmp", "krecipes_recipe_view" ); + TQString tmp_filename = locateLocal( "tmp", "krecipes_recipe_view" ); HTMLExporter exporter( tmp_filename + ".html", "html" ); - if ( templateFile != QString::null ) + if ( templateFile != TQString::null ) exporter.setTemplate( templateFile ); - if ( styleFile != QString::null ) + if ( styleFile != TQString::null ) exporter.setStyle( styleFile ); RecipeList recipeList; recipeList.append(m_sample); - QFile file(tmp_filename + ".html"); + TQFile file(tmp_filename + ".html"); if ( file.open( IO_WriteOnly ) ) { - QTextStream stream(&file); + TQTextStream stream(&file); exporter.writeStream(stream,recipeList); } else { @@ -166,7 +166,7 @@ void SetupDisplay::reload() loadHTMLView( m_activeTemplate, m_activeStyle ); } -void SetupDisplay::loadTemplate( const QString &filename ) +void SetupDisplay::loadTemplate( const TQString &filename ) { bool storeChangedState = has_changes; KTempFile tmpFile; @@ -178,29 +178,29 @@ void SetupDisplay::loadTemplate( const QString &filename ) m_activeTemplate = filename; } -void SetupDisplay::createItem( const QString &node, const QString &name, unsigned int properties ) +void SetupDisplay::createItem( const TQString &node, const TQString &name, unsigned int properties ) { KreDisplayItem * item = new KreDisplayItem( node, name ); box_properties->insert( item, properties ); node_item_map->insert( node, item ); } -void SetupDisplay::loadLayout( const QString &filename ) +void SetupDisplay::loadLayout( const TQString &filename ) { - QFile input( filename ); + TQFile input( filename ); if ( input.open( IO_ReadOnly ) ) { - QDomDocument doc; - QString error; + TQDomDocument doc; + TQString error; int line; int column; if ( !doc.setContent( &input, &error, &line, &column ) ) { - kdDebug() << QString( i18n( "\"%1\" at line %2, column %3. This may not be a Krecipes layout file." ) ).arg( error ).arg( line ).arg( column ) << endl; + kdDebug() << TQString( i18n( "\"%1\" at line %2, column %3. This may not be a Krecipes layout file." ) ).arg( error ).arg( line ).arg( column ) << endl; return ; } m_styleSheet = DOM::CSSStyleSheet(); - QMap<QString,KreDisplayItem*>::iterator it; + TQMap<TQString,KreDisplayItem*>::iterator it; for ( it = node_item_map->begin(); it != node_item_map->end(); ++it ) { it.data()->clear(); } @@ -215,9 +215,9 @@ void SetupDisplay::loadLayout( const QString &filename ) kdDebug() << "Unable to open file: " << filename << endl; } -void SetupDisplay::beginObject( const QString &object ) +void SetupDisplay::beginObject( const TQString &object ) { - QMap<QString, KreDisplayItem*>::iterator map_it = node_item_map->find( object ); + TQMap<TQString, KreDisplayItem*>::iterator map_it = node_item_map->find( object ); if ( map_it != node_item_map->end() ) m_currentItem = map_it.data(); else @@ -229,7 +229,7 @@ void SetupDisplay::endObject() m_currentItem = 0; } -void SetupDisplay::loadBackgroundColor( const QString &object, const QColor &color ) +void SetupDisplay::loadBackgroundColor( const TQString &object, const TQColor &color ) { if ( m_currentItem ) { m_currentItem->backgroundColor = color; @@ -237,7 +237,7 @@ void SetupDisplay::loadBackgroundColor( const QString &object, const QColor &col } } -void SetupDisplay::loadFont( const QString &object, const QFont &font ) +void SetupDisplay::loadFont( const TQString &object, const TQFont &font ) { if ( m_currentItem ) { m_currentItem->font = font; @@ -245,7 +245,7 @@ void SetupDisplay::loadFont( const QString &object, const QFont &font ) } } -void SetupDisplay::loadTextColor( const QString &object, const QColor &color ) +void SetupDisplay::loadTextColor( const TQString &object, const TQColor &color ) { if ( m_currentItem ) { m_currentItem->textColor = color; @@ -253,7 +253,7 @@ void SetupDisplay::loadTextColor( const QString &object, const QColor &color ) } } -void SetupDisplay::loadVisibility( const QString &object, bool visible ) +void SetupDisplay::loadVisibility( const TQString &object, bool visible ) { if ( m_currentItem ) { m_currentItem->show = visible; @@ -263,7 +263,7 @@ void SetupDisplay::loadVisibility( const QString &object, bool visible ) } } -void SetupDisplay::loadAlignment( const QString &object, int alignment ) +void SetupDisplay::loadAlignment( const TQString &object, int alignment ) { if ( m_currentItem ) { m_currentItem->alignment = alignment; @@ -271,7 +271,7 @@ void SetupDisplay::loadAlignment( const QString &object, int alignment ) } } -void SetupDisplay::loadBorder( const QString &object, const KreBorder& border ) +void SetupDisplay::loadBorder( const TQString &object, const KreBorder& border ) { if ( m_currentItem ) { m_currentItem->border = border; @@ -279,60 +279,60 @@ void SetupDisplay::loadBorder( const QString &object, const KreBorder& border ) } } -void SetupDisplay::loadColumns( const QString &/*object*/, int cols ) +void SetupDisplay::loadColumns( const TQString &/*object*/, int cols ) { if ( m_currentItem ) { m_currentItem->columns = cols; } } -void SetupDisplay::saveLayout( const QString &filename ) +void SetupDisplay::saveLayout( const TQString &filename ) { - QDomImplementation dom_imp; - QDomDocument doc = dom_imp.createDocument( QString::null, "krecipes-layout", dom_imp.createDocumentType( "krecipes-layout", QString::null, QString::null ) ); + TQDomImplementation dom_imp; + TQDomDocument doc = dom_imp.createDocument( TQString::null, "krecipes-layout", dom_imp.createDocumentType( "krecipes-layout", TQString::null, TQString::null ) ); - QDomElement layout_tag = doc.documentElement(); + TQDomElement layout_tag = doc.documentElement(); layout_tag.setAttribute( "version", 0.4 ); - //layout_tag.setAttribute( "generator", QString("Krecipes v%1").arg(krecipes_version()) ); + //layout_tag.setAttribute( "generator", TQString("Krecipes v%1").arg(krecipes_version()) ); doc.appendChild( layout_tag ); - for ( QMap<QString, KreDisplayItem*>::const_iterator it = node_item_map->begin(); it != node_item_map->end(); ++it ) { - QDomElement base_tag = doc.createElement( it.key() ); + for ( TQMap<TQString, KreDisplayItem*>::const_iterator it = node_item_map->begin(); it != node_item_map->end(); ++it ) { + TQDomElement base_tag = doc.createElement( it.key() ); layout_tag.appendChild( base_tag ); int properties = (*box_properties)[it.data()]; if ( properties & BackgroundColor ) { - QDomElement backgroundcolor_tag = doc.createElement( "background-color" ); + TQDomElement backgroundcolor_tag = doc.createElement( "background-color" ); backgroundcolor_tag.appendChild( doc.createTextNode( it.data()->backgroundColor.name() ) ); base_tag.appendChild( backgroundcolor_tag ); } if ( properties & TextColor ) { - QDomElement textcolor_tag = doc.createElement( "text-color" ); + TQDomElement textcolor_tag = doc.createElement( "text-color" ); textcolor_tag.appendChild( doc.createTextNode( it.data()->textColor.name() ) ); base_tag.appendChild( textcolor_tag ); } if ( properties & Font ) { - QDomElement font_tag = doc.createElement( "font" ); + TQDomElement font_tag = doc.createElement( "font" ); font_tag.appendChild( doc.createTextNode( it.data()->font.toString() ) ); base_tag.appendChild( font_tag ); } if ( properties & Visibility ) { - QDomElement visibility_tag = doc.createElement( "visible" ); + TQDomElement visibility_tag = doc.createElement( "visible" ); visibility_tag.appendChild( doc.createTextNode( (it.data()->show) ? "true" : "false" ) ); base_tag.appendChild( visibility_tag ); } if ( properties & Alignment ) { - QDomElement alignment_tag = doc.createElement( "alignment" ); - alignment_tag.appendChild( doc.createTextNode( QString::number( it.data()->alignment ) ) ); + TQDomElement alignment_tag = doc.createElement( "alignment" ); + alignment_tag.appendChild( doc.createTextNode( TQString::number( it.data()->alignment ) ) ); base_tag.appendChild( alignment_tag ); } if ( properties & Border ) { - QDomElement border_tag = doc.createElement( "border" ); + TQDomElement border_tag = doc.createElement( "border" ); border_tag.setAttribute( "width", it.data()->border.width ); border_tag.setAttribute( "style", it.data()->border.style ); border_tag.setAttribute( "color", it.data()->border.color.name() ); @@ -340,17 +340,17 @@ void SetupDisplay::saveLayout( const QString &filename ) } if ( properties & Columns ) { - QDomElement columns_tag = doc.createElement( "columns" ); - columns_tag.appendChild( doc.createTextNode( QString::number( it.data()->columns ) ) ); + TQDomElement columns_tag = doc.createElement( "columns" ); + columns_tag.appendChild( doc.createTextNode( TQString::number( it.data()->columns ) ) ); base_tag.appendChild( columns_tag ); } } - QFile out_file( filename ); + TQFile out_file( filename ); if ( out_file.open( IO_WriteOnly ) ) { has_changes = false; - QTextStream stream( &out_file ); + TQTextStream stream( &out_file ); stream << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" << doc.toString(); } else @@ -376,7 +376,7 @@ void SetupDisplay::begin(const KURL &url, int xOffset, int yOffset) #endif } -void SetupDisplay::nodeClicked(const QString &/*url*/,const QPoint &point) +void SetupDisplay::nodeClicked(const TQString &/*url*/,const TQPoint &point) { DOM::Node node = nodeUnderMouse(); DOM::Element element; @@ -389,7 +389,7 @@ void SetupDisplay::nodeClicked(const QString &/*url*/,const QPoint &point) while ( !element.parentNode().isNull() ) { if ( element.hasAttribute("class") ) { - QString id = element.getAttribute("class").string(); + TQString id = element.getAttribute("class").string(); if ( node_item_map->keys().contains(id) ) break; } @@ -434,24 +434,24 @@ void SetupDisplay::nodeClicked(const QString &/*url*/,const QPoint &point) } if ( properties & Alignment ) { - QPopupMenu * sub_popup = new QPopupMenu( popup ); + TQPopupMenu * sub_popup = new TQPopupMenu( popup ); - QActionGroup *alignment_actions = new QActionGroup( this ); + TQActionGroup *alignment_actions = new TQActionGroup( this ); alignment_actions->setExclusive( true ); - QAction *c_action = new QAction( i18n( "Center" ), i18n( "Center" ), 0, alignment_actions, 0, true ); - QAction *l_action = new QAction( i18n( "Left" ), i18n( "Left" ), 0, alignment_actions, 0, true ); - QAction *r_action = new QAction( i18n( "Right" ), i18n( "Right" ), 0, alignment_actions, 0, true ); + TQAction *c_action = new TQAction( i18n( "Center" ), i18n( "Center" ), 0, alignment_actions, 0, true ); + TQAction *l_action = new TQAction( i18n( "Left" ), i18n( "Left" ), 0, alignment_actions, 0, true ); + TQAction *r_action = new TQAction( i18n( "Right" ), i18n( "Right" ), 0, alignment_actions, 0, true ); int align = item->alignment; - if ( align & Qt::AlignHCenter ) + if ( align & TQt::AlignHCenter ) c_action->setOn(true); - if ( align & Qt::AlignLeft ) + if ( align & TQt::AlignLeft ) l_action->setOn(true); - if ( align & Qt::AlignRight ) + if ( align & TQt::AlignRight ) r_action->setOn(true); - connect( alignment_actions, SIGNAL( selected( QAction* ) ), SLOT( setAlignment( QAction* ) ) ); + connect( alignment_actions, SIGNAL( selected( TQAction* ) ), SLOT( setAlignment( TQAction* ) ) ); popup->insertItem( i18n( "Alignment" ), sub_popup ); @@ -479,7 +479,7 @@ void SetupDisplay::applyStylesheet() void SetupDisplay::setBackgroundColor() { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); - if ( KColorDialog::getColor( item->backgroundColor, view() ) == QDialog::Accepted ) { + if ( KColorDialog::getColor( item->backgroundColor, view() ) == TQDialog::Accepted ) { m_currentItem = item; loadBackgroundColor(m_currNodeId,item->backgroundColor); m_currentItem = 0; @@ -493,7 +493,7 @@ void SetupDisplay::setBorder() { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); BorderDialog borderDialog( item->border, view() ); - if ( borderDialog.exec() == QDialog::Accepted ) { + if ( borderDialog.exec() == TQDialog::Accepted ) { m_currentItem = item; loadBorder( m_currNodeId, borderDialog.border() ); m_currentItem = 0; @@ -506,7 +506,7 @@ void SetupDisplay::setBorder() void SetupDisplay::setColumns() { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); - int cols = QInputDialog::getInteger( QString::null, i18n("Select the number of columns to use:"), item->columns, 1, 100, 1, 0, view() ); + int cols = TQInputDialog::getInteger( TQString::null, i18n("Select the number of columns to use:"), item->columns, 1, 100, 1, 0, view() ); if ( cols > 0 ) { m_currentItem = item; loadColumns( m_currNodeId, cols ); @@ -520,7 +520,7 @@ void SetupDisplay::setColumns() void SetupDisplay::setTextColor() { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); - if ( KColorDialog::getColor( item->textColor, view() ) == QDialog::Accepted ) { + if ( KColorDialog::getColor( item->textColor, view() ) == TQDialog::Accepted ) { m_currentItem = item; loadTextColor(m_currNodeId,item->textColor); m_currentItem = 0; @@ -546,7 +546,7 @@ void SetupDisplay::setShown( int id ) void SetupDisplay::setFont() { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); - if ( KFontDialog::getFont( item->font, false, view() ) == QDialog::Accepted ) { + if ( KFontDialog::getFont( item->font, false, view() ) == TQDialog::Accepted ) { m_currentItem = item; loadFont(m_currNodeId,item->font); m_currentItem = 0; @@ -556,25 +556,25 @@ void SetupDisplay::setFont() } } -void SetupDisplay::setAlignment( QAction *action ) +void SetupDisplay::setAlignment( TQAction *action ) { KreDisplayItem *item = *node_item_map->find( m_currNodeId ); //TODO: isn't there a simpler way to do this... //preserve non-horizontal alignment flags - if ( item->alignment & Qt::AlignRight ) - item->alignment ^= Qt::AlignRight; - if ( item->alignment & Qt::AlignHCenter ) - item->alignment ^= Qt::AlignHCenter; - if ( item->alignment & Qt::AlignLeft ) - item->alignment ^= Qt::AlignLeft; + if ( item->alignment & TQt::AlignRight ) + item->alignment ^= TQt::AlignRight; + if ( item->alignment & TQt::AlignHCenter ) + item->alignment ^= TQt::AlignHCenter; + if ( item->alignment & TQt::AlignLeft ) + item->alignment ^= TQt::AlignLeft; if ( action->text() == i18n( "Center" ) ) - item->alignment |= Qt::AlignHCenter; + item->alignment |= TQt::AlignHCenter; else if ( action->text() == i18n( "Left" ) ) - item->alignment |= Qt::AlignLeft; + item->alignment |= TQt::AlignLeft; else if ( action->text() == i18n( "Right" ) ) - item->alignment |= Qt::AlignRight; + item->alignment |= TQt::AlignRight; m_currentItem = item; loadAlignment(m_currNodeId,item->alignment); diff --git a/krecipes/src/dialogs/setupdisplay.h b/krecipes/src/dialogs/setupdisplay.h index d0370ed..83f761f 100644 --- a/krecipes/src/dialogs/setupdisplay.h +++ b/krecipes/src/dialogs/setupdisplay.h @@ -15,9 +15,9 @@ #include <dom/html_element.h> #include <dom/css_stylesheet.h> -#include <qdom.h> -#include <qwidget.h> -#include <qmap.h> +#include <ntqdom.h> +#include <ntqwidget.h> +#include <ntqmap.h> #include "datablocks/recipe.h" #include "datablocks/kreborder.h" @@ -27,31 +27,31 @@ class KPopupMenu; -class QAction; -class QLabel; -class QWidget; +class TQAction; +class TQLabel; +class TQWidget; class StyleSheet; class KreDisplayItem { public: - KreDisplayItem( const QString &id, const QString &name ); + KreDisplayItem( const TQString &id, const TQString &name ); void clear(); - QString nodeId; - QString name; + TQString nodeId; + TQString name; KreBorder border; int alignment; int columns; bool show; - QColor backgroundColor; - QColor textColor; - QFont font; + TQColor backgroundColor; + TQColor textColor; + TQFont font; }; -typedef QMap< KreDisplayItem*, unsigned int > PropertiesMap; +typedef TQMap< KreDisplayItem*, unsigned int > PropertiesMap; /** @brief A KHTMLPart for editing specific CSS properties * @@ -64,14 +64,14 @@ class SetupDisplay : public KHTMLPart, protected KLOManager Q_OBJECT public: - SetupDisplay( const Recipe &, QWidget *parent ); + SetupDisplay( const Recipe &, TQWidget *parent ); ~SetupDisplay(); enum Properties { None = 0, BackgroundColor = 1, TextColor = 2, Font = 4, Visibility = 8, Alignment = 32, Columns = 64, Border = 128 }; - void saveLayout( const QString & ); - void loadLayout( const QString & ); - void loadTemplate( const QString &filename ); + void saveLayout( const TQString & ); + void loadLayout( const TQString & ); + void loadTemplate( const TQString &filename ); bool hasChanges() const { @@ -93,19 +93,19 @@ signals: protected: virtual void begin (const KURL &url=KURL(), int xOffset=0, int yOffset=0); - 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(); protected slots: - void nodeClicked(const QString &url,const QPoint &point); + void nodeClicked(const TQString &url,const TQPoint &point); void changeMade(); //slots to set properties of item boxes @@ -115,23 +115,23 @@ protected slots: void setTextColor(); void setFont(); void setShown( int id ); - void setAlignment( QAction * ); + void setAlignment( TQAction * ); private: PropertiesMap *box_properties; - QMap<QString, KreDisplayItem*> *node_item_map; + TQMap<TQString, KreDisplayItem*> *node_item_map; bool has_changes; // Methods void applyStylesheet(); - void loadPageLayout( const QDomElement &tag ); - void loadHTMLView( const QString &templateFile = QString::null, const QString &styleFile = QString::null ); + void loadPageLayout( const TQDomElement &tag ); + void loadHTMLView( const TQString &templateFile = TQString::null, const TQString &styleFile = TQString::null ); - void createItem( const QString &id, const QString &name, unsigned int properties ); + void createItem( const TQString &id, const TQString &name, unsigned int properties ); //the name of the element under the mouse on a right-click - QString m_currNodeId; + TQString m_currNodeId; //the item corresponding to the current point of processing the KLO KreDisplayItem *m_currentItem; @@ -140,8 +140,8 @@ private: DOM::CSSStyleSheet m_styleSheet; Recipe m_sample; - QString m_activeTemplate; - QString m_activeStyle; + TQString m_activeTemplate; + TQString m_activeStyle; }; #endif //SETUPDISPLAY_H diff --git a/krecipes/src/dialogs/shoppinglistdialog.cpp b/krecipes/src/dialogs/shoppinglistdialog.cpp index 1963cb2..f0ebc85 100644 --- a/krecipes/src/dialogs/shoppinglistdialog.cpp +++ b/krecipes/src/dialogs/shoppinglistdialog.cpp @@ -30,22 +30,22 @@ class ShoppingListView : public KListView { public: - ShoppingListView( QWidget *parent ) : KListView( parent ) + ShoppingListView( TQWidget *parent ) : KListView( parent ) {} protected: - bool acceptDrag( QDropEvent *event ) const + bool acceptDrag( TQDropEvent *event ) const { return RecipeItemDrag::canDecode( event ); } - QDragObject *dragObject() + TQDragObject *dragObject() { RecipeListItem * item = dynamic_cast<RecipeListItem*>( selectedItem() ); 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; @@ -55,39 +55,39 @@ protected: }; -ShoppingListDialog::ShoppingListDialog( QWidget *parent, RecipeDB *db ) : QWidget( parent ) +ShoppingListDialog::ShoppingListDialog( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database database = db; // Design dialog - layout = new QGridLayout( this, 2, 2, KDialog::marginHint(), KDialog::spacingHint() ); + layout = new TQGridLayout( this, 2, 2, KDialog::marginHint(), KDialog::spacingHint() ); recipeListView = new KreListView ( this, i18n( "Full recipe list" ), true, 1 ); layout->addWidget( recipeListView, 0, 0 ); listview = new RecipeListView( recipeListView, database ); - listview->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::MinimumExpanding ); + listview->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::MinimumExpanding ); listview->setDragEnabled( true ); listview->setAcceptDrops( true ); listview->setDropVisualizer( false ); - connect( recipeListView, SIGNAL( textChanged(const QString&) ), SLOT( ensurePopulated() ) ); - connect( listview, SIGNAL( dropped( KListView*, QDropEvent*, QListViewItem* ) ), - this, SLOT( slotDropped( KListView*, QDropEvent*, QListViewItem* ) ) ); + connect( recipeListView, SIGNAL( textChanged(const TQString&) ), SLOT( ensurePopulated() ) ); + connect( listview, SIGNAL( dropped( KListView*, TQDropEvent*, TQListViewItem* ) ), + this, SLOT( slotDropped( KListView*, TQDropEvent*, TQListViewItem* ) ) ); recipeListView->setListView( listview ); - recipeListView->setCustomFilter( new RecipeFilter( recipeListView->listView() ), SLOT( filter( const QString & ) ) ); - recipeListView->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + recipeListView->setCustomFilter( new RecipeFilter( recipeListView->listView() ), SLOT( filter( const TQString & ) ) ); + recipeListView->setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); - QBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); + TQBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); KIconLoader il; - addRecipeButton = new QPushButton( this ); + addRecipeButton = new TQPushButton( this ); addRecipeButton->setIconSet( il.loadIconSet( "forward", KIcon::Small ) ); - addRecipeButton->setFixedSize( QSize( 32, 32 ) ); + addRecipeButton->setFixedSize( TQSize( 32, 32 ) ); addRecipeButton->setFlat( true ); vboxl->addWidget( addRecipeButton ); - removeRecipeButton = new QPushButton( this ); + removeRecipeButton = new TQPushButton( this ); removeRecipeButton->setIconSet( il.loadIconSet( "back", KIcon::Small ) ); - removeRecipeButton->setFixedSize( QSize( 32, 32 ) ); + removeRecipeButton->setFixedSize( TQSize( 32, 32 ) ); removeRecipeButton->setFlat( true ); vboxl->addWidget( removeRecipeButton ); vboxl->addStretch(); @@ -96,12 +96,12 @@ ShoppingListDialog::ShoppingListDialog( QWidget *parent, RecipeDB *db ) : QWidge shopRecipeListView = new KreListView ( this, i18n("Shopping List") ); ShoppingListView *slistview = new ShoppingListView( shopRecipeListView ); - slistview->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::MinimumExpanding ); + slistview->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::MinimumExpanding ); slistview->setDragEnabled( true ); slistview->setAcceptDrops( true ); slistview->setDropVisualizer( false ); - connect( slistview, SIGNAL( dropped( KListView*, QDropEvent*, QListViewItem* ) ), - this, SLOT( slotDropped( KListView*, QDropEvent*, QListViewItem* ) ) ); + connect( slistview, SIGNAL( dropped( KListView*, TQDropEvent*, TQListViewItem* ) ), + this, SLOT( slotDropped( KListView*, TQDropEvent*, TQListViewItem* ) ) ); shopRecipeListView->setListView( slistview ); layout->addWidget( shopRecipeListView, 0, 2 ); @@ -113,24 +113,24 @@ ShoppingListDialog::ShoppingListDialog( QWidget *parent, RecipeDB *db ) : QWidge shopRecipeListView->listView() ->addColumn( i18n( "Id" ), show_id ? -1 : 0 ); shopRecipeListView->listView() ->setSorting( -1 ); - shopRecipeListView->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); + shopRecipeListView->setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding ); shopRecipeListView->listView() ->setAllColumnsShowFocus( true ); - buttonBar = new QHBox( this, "buttonBar" ); + buttonBar = new TQHBox( this, "buttonBar" ); layout->addMultiCellWidget( buttonBar, 1, 1, 0, 2 ); layout->setColStretch( 0, 1 ); layout->setColStretch( 1, 0 ); layout->setColStretch( 2, 1 ); - okButton = new QPushButton( buttonBar, "okButton" ); + okButton = new TQPushButton( buttonBar, "okButton" ); okButton->setText( i18n( "&OK" ) ); - QPixmap pm = il.loadIcon( "ok", KIcon::NoGroup, 16 ); + TQPixmap pm = il.loadIcon( "ok", KIcon::NoGroup, 16 ); okButton->setIconSet( pm ); - //buttonBar->layout()->addItem( new QSpacerItem( 10,10, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); + //buttonBar->layout()->addItem( new TQSpacerItem( 10,10, TQSizePolicy::MinimumExpanding, TQSizePolicy::Fixed ) ); - clearButton = new QPushButton( buttonBar, "clearButton" ); + clearButton = new TQPushButton( buttonBar, "clearButton" ); clearButton->setText( i18n( "Clear" ) ); pm = il.loadIcon( "editclear", KIcon::NoGroup, 16 ); clearButton->setIconSet( pm ); @@ -174,17 +174,17 @@ void ShoppingListDialog::reload( ReloadFlags flag ) void ShoppingListDialog::addRecipe( void ) { - QPtrList<QListViewItem> items = recipeListView->listView()->selectedItems(); + TQPtrList<TQListViewItem> items = recipeListView->listView()->selectedItems(); - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { addRecipe( item ); ++it; } } -void ShoppingListDialog::addRecipe( QListViewItem *item ) +void ShoppingListDialog::addRecipe( TQListViewItem *item ) { if ( item ) { if ( item->rtti() == 1000 ) { @@ -200,7 +200,7 @@ void ShoppingListDialog::addRecipe( QListViewItem *item ) void ShoppingListDialog::removeRecipe( void ) { - QListViewItem * it; + TQListViewItem * it; it = shopRecipeListView->listView() ->selectedItem(); if ( it ) delete it; @@ -236,7 +236,7 @@ void ShoppingListDialog::clear() shopRecipeListView->listView() ->clear(); } -void ShoppingListDialog::slotDropped( KListView *list, QDropEvent *e, QListViewItem * /*after*/ ) +void ShoppingListDialog::slotDropped( KListView *list, TQDropEvent *e, TQListViewItem * /*after*/ ) { Recipe r; RecipeListItem *item = new RecipeListItem( recipeListView->listView(), r ); // needs parent, use this temporarily @@ -250,7 +250,7 @@ void ShoppingListDialog::slotDropped( KListView *list, QDropEvent *e, QListViewI } //find and delete the item if we just dropped onto the recipe list from the shopping list else if ( list == recipeListView->listView() && e->source() == shopRecipeListView->listView() ) { - QListViewItemIterator list_it = QListViewItemIterator( shopRecipeListView->listView() ); + TQListViewItemIterator list_it = TQListViewItemIterator( shopRecipeListView->listView() ); while ( list_it.current() ) { if ( ( ( RecipeListItem* ) list_it.current() ) ->recipeID() == item->recipeID() ) { delete list_it.current(); diff --git a/krecipes/src/dialogs/shoppinglistdialog.h b/krecipes/src/dialogs/shoppinglistdialog.h index 2c25ae9..a0daa1d 100644 --- a/krecipes/src/dialogs/shoppinglistdialog.h +++ b/krecipes/src/dialogs/shoppinglistdialog.h @@ -13,8 +13,8 @@ #ifndef SHOPPINGLISTDIALOG_H #define SHOPPINGLISTDIALOG_H -#include <qhbox.h> -#include <qlayout.h> +#include <ntqhbox.h> +#include <ntqlayout.h> #include <kpushbutton.h> #include <kiconloader.h> @@ -31,12 +31,12 @@ class RecipeListView; @author Unai Garro */ -class ShoppingListDialog: public QWidget +class ShoppingListDialog: public TQWidget { Q_OBJECT public: - ShoppingListDialog( QWidget *parent, RecipeDB *db ); + ShoppingListDialog( TQWidget *parent, RecipeDB *db ); ~ShoppingListDialog(); void reload( ReloadFlags flag = Load ); void createShopping( const RecipeList &rlist ); @@ -47,16 +47,16 @@ private: RecipeDB *database; // Internal Methods void reloadRecipeList( ReloadFlags flag = Load ); - void addRecipe( QListViewItem *item ); + void addRecipe( TQListViewItem *item ); // Widgets - QGridLayout* layout; - QPushButton* addRecipeButton; - QPushButton* removeRecipeButton; + TQGridLayout* layout; + TQPushButton* addRecipeButton; + TQPushButton* removeRecipeButton; KreListView* recipeListView; KreListView* shopRecipeListView; - QHBox *buttonBar; - QPushButton* okButton; - QPushButton* clearButton; + TQHBox *buttonBar; + TQPushButton* okButton; + TQPushButton* clearButton; ShoppingListViewDialog *shoppingListDisplay; RecipeActionsHandler *actionHandler; RecipeListView *listview; @@ -69,7 +69,7 @@ private slots: void removeRecipe( void ); void showShoppingList( void ); void clear( void ); - void slotDropped( KListView *list, QDropEvent *e, QListViewItem *after ); + void slotDropped( KListView *list, TQDropEvent *e, TQListViewItem *after ); void ensurePopulated(); }; diff --git a/krecipes/src/dialogs/shoppinglistviewdialog.cpp b/krecipes/src/dialogs/shoppinglistviewdialog.cpp index 24e04d2..02ffe6c 100644 --- a/krecipes/src/dialogs/shoppinglistviewdialog.cpp +++ b/krecipes/src/dialogs/shoppinglistviewdialog.cpp @@ -14,24 +14,24 @@ #include "datablocks/ingredientlist.h" #include "datablocks/mixednumber.h" -#include <qpushbutton.h> +#include <ntqpushbutton.h> #include <klocale.h> #include <kapplication.h> #include <kconfig.h> #include <kiconloader.h> -ShoppingListViewDialog::ShoppingListViewDialog( QWidget *parent, const IngredientList &ingredientList ) - : KDialogBase( parent, "shoppingviewdialog", true, QString::null, +ShoppingListViewDialog::ShoppingListViewDialog( TQWidget *parent, const IngredientList &ingredientList ) + : KDialogBase( parent, "shoppingviewdialog", true, TQString::null, KDialogBase::Close | KDialogBase::User1, KDialogBase::Close, false, KStdGuiItem::print() ) { // Design dialog - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); shoppingListView = new KHTMLPart( page ); - setInitialSize( QSize(350, 450) ); + setInitialSize( TQSize(350, 450) ); connect ( this, SIGNAL( user1Clicked() ), this, SLOT( print() ) ); connect ( this, SIGNAL( closeClicked() ), this, SLOT( accept() ) ); @@ -50,14 +50,14 @@ ShoppingListViewDialog::~ShoppingListViewDialog() void ShoppingListViewDialog::display( const IngredientList &ingredientList ) { - QString recipeHTML; + TQString recipeHTML; // Create HTML Code // Headers - recipeHTML = QString( "<html><head><title>%1</title></head><body>" ).arg( i18n( "Shopping List" ) ); + recipeHTML = TQString( "<html><head><title>%1</title></head><body>" ).arg( i18n( "Shopping List" ) ); recipeHTML += "<center><div STYLE=\"width: 95%\">"; - recipeHTML += QString( "<center><h1>%1</h1></center>" ).arg( i18n( "Shopping List" ) ); + recipeHTML += TQString( "<center><h1>%1</h1></center>" ).arg( i18n( "Shopping List" ) ); // Ingredient List @@ -71,15 +71,15 @@ void ShoppingListViewDialog::display( const IngredientList &ingredientList ) bool useFraction = config->readBoolEntry( "Fraction" ); for ( IngredientList::const_iterator ing_it = ingredientList.begin(); ing_it != ingredientList.end(); ++ing_it ) { - QString color = ( counter ) ? "#CBCEFF" : "#BFC2F0"; + TQString color = ( counter ) ? "#CBCEFF" : "#BFC2F0"; counter = !counter; MixedNumber::Format number_format = ( useFraction ) ? MixedNumber::MixedNumberFormat : MixedNumber::DecimalFormat; - QString amount_str = MixedNumber( ( *ing_it ).amount ).toString( number_format ); + TQString amount_str = MixedNumber( ( *ing_it ).amount ).toString( number_format ); - 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 ); - recipeHTML += QString( "<tr bgcolor=\"%1\"><td>- %2:</td><td>%3 %4</td></tr>" ).arg( color ).arg( ( *ing_it ).name ).arg( amount_str ).arg( unit ); + recipeHTML += TQString( "<tr bgcolor=\"%1\"><td>- %2:</td><td>%3 %4</td></tr>" ).arg( color ).arg( ( *ing_it ).name ).arg( amount_str ).arg( unit ); } recipeHTML += "</tbody></table></div>"; // Close diff --git a/krecipes/src/dialogs/shoppinglistviewdialog.h b/krecipes/src/dialogs/shoppinglistviewdialog.h index 4cfd4b6..69a66a2 100644 --- a/krecipes/src/dialogs/shoppinglistviewdialog.h +++ b/krecipes/src/dialogs/shoppinglistviewdialog.h @@ -13,9 +13,9 @@ #ifndef SHOPPINGLISTVIEWDIALOG_H #define SHOPPINGLISTVIEWDIALOG_H -#include <qlayout.h> -#include <qvbox.h> -#include <qwidget.h> +#include <ntqlayout.h> +#include <ntqvbox.h> +#include <ntqwidget.h> #include <khtml_part.h> #include <khtmlview.h> @@ -28,7 +28,7 @@ class ShoppingListViewDialog: public KDialogBase Q_OBJECT public: - ShoppingListViewDialog( QWidget *parent, const IngredientList &ingredientList ); + ShoppingListViewDialog( TQWidget *parent, const IngredientList &ingredientList ); ~ShoppingListViewDialog(); public slots: diff --git a/krecipes/src/dialogs/similarcategoriesdialog.cpp b/krecipes/src/dialogs/similarcategoriesdialog.cpp index 3d37113..944dec0 100644 --- a/krecipes/src/dialogs/similarcategoriesdialog.cpp +++ b/krecipes/src/dialogs/similarcategoriesdialog.cpp @@ -9,15 +9,15 @@ #include "similarcategoriesdialog.h" -#include <qvariant.h> -#include <qpushbutton.h> -#include <qcombobox.h> -#include <qslider.h> -#include <qlabel.h> -#include <qheader.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> +#include <ntqvariant.h> +#include <ntqpushbutton.h> +#include <ntqcombobox.h> +#include <ntqslider.h> +#include <ntqlabel.h> +#include <ntqheader.h> +#include <ntqlayout.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> #include <klistview.h> #include <klocale.h> @@ -27,90 +27,90 @@ #include "widgets/categorycombobox.h" #include "backends/recipedb.h" -SimilarCategoriesDialog::SimilarCategoriesDialog( ElementList &list, QWidget* parent ) - : QDialog( parent, "SimilarCategoriesDialog", true ), +SimilarCategoriesDialog::SimilarCategoriesDialog( ElementList &list, TQWidget* parent ) + : TQDialog( parent, "SimilarCategoriesDialog", true ), m_elementList(list) { - SimilarCategoriesDialogLayout = new QVBoxLayout( this, 11, 6, "SimilarCategoriesDialogLayout"); + SimilarCategoriesDialogLayout = new TQVBoxLayout( this, 11, 6, "SimilarCategoriesDialogLayout"); - layout6 = new QHBoxLayout( 0, 0, 6, "layout6"); + layout6 = new TQHBoxLayout( 0, 0, 6, "layout6"); - layout4 = new QGridLayout( 0, 1, 1, 0, 6, "layout4"); + layout4 = new TQGridLayout( 0, 1, 1, 0, 6, "layout4"); categoriesBox = new KLineEdit( this ); layout4->addWidget( categoriesBox, 0, 1 ); - thresholdSlider = new QSlider( this, "thresholdSlider" ); + thresholdSlider = new TQSlider( this, "thresholdSlider" ); thresholdSlider->setValue( 40 ); - thresholdSlider->setOrientation( QSlider::Horizontal ); + thresholdSlider->setOrientation( TQSlider::Horizontal ); layout4->addWidget( thresholdSlider, 1, 1 ); - thresholdLabel = new QLabel( this, "thresholdLabel" ); + thresholdLabel = new TQLabel( this, "thresholdLabel" ); layout4->addWidget( thresholdLabel, 1, 0 ); - categoryLabel = new QLabel( this, "categoryLabel" ); + categoryLabel = new TQLabel( this, "categoryLabel" ); layout4->addWidget( categoryLabel, 0, 0 ); layout6->addLayout( layout4 ); - layout5 = new QVBoxLayout( 0, 0, 6, "layout5"); + layout5 = new TQVBoxLayout( 0, 0, 6, "layout5"); - searchButton = new QPushButton( this, "searchButton" ); + searchButton = new TQPushButton( this, "searchButton" ); layout5->addWidget( searchButton ); - spacer4 = new QSpacerItem( 20, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + spacer4 = new TQSpacerItem( 20, 51, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); layout5->addItem( spacer4 ); layout6->addLayout( layout5 ); SimilarCategoriesDialogLayout->addLayout( layout6 ); - layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); + layout9 = new TQHBoxLayout( 0, 0, 6, "layout9"); - layout8 = new QVBoxLayout( 0, 0, 6, "layout8"); + layout8 = new TQVBoxLayout( 0, 0, 6, "layout8"); - allLabel = new QLabel( this, "allLabel" ); + allLabel = new TQLabel( this, "allLabel" ); layout8->addWidget( allLabel ); allListView = new KListView( this, "allListView" ); - allListView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 1, allListView->sizePolicy().hasHeightForWidth() ) ); + allListView->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 1, allListView->sizePolicy().hasHeightForWidth() ) ); layout8->addWidget( allListView ); layout9->addLayout( layout8 ); - layout1 = new QVBoxLayout( 0, 0, 6, "layout1"); + layout1 = new TQVBoxLayout( 0, 0, 6, "layout1"); - removeButton = new QPushButton( this, "removeButton" ); + removeButton = new TQPushButton( this, "removeButton" ); layout1->addWidget( removeButton ); - addButton = new QPushButton( this, "addButton" ); + addButton = new TQPushButton( this, "addButton" ); layout1->addWidget( addButton ); - spacer1 = new QSpacerItem( 20, 61, QSizePolicy::Minimum, QSizePolicy::Expanding ); + spacer1 = new TQSpacerItem( 20, 61, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); layout1->addItem( spacer1 ); layout9->addLayout( layout1 ); - layout7 = new QVBoxLayout( 0, 0, 6, "layout7"); + layout7 = new TQVBoxLayout( 0, 0, 6, "layout7"); - toMergeLabel = new QLabel( this, "toMergeLabel" ); + toMergeLabel = new TQLabel( this, "toMergeLabel" ); layout7->addWidget( toMergeLabel ); toMergeListView = new KListView( this, "toMergeListView" ); - toMergeListView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 1, toMergeListView->sizePolicy().hasHeightForWidth() ) ); + toMergeListView->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 1, toMergeListView->sizePolicy().hasHeightForWidth() ) ); layout7->addWidget( toMergeListView ); layout9->addLayout( layout7 ); SimilarCategoriesDialogLayout->addLayout( layout9 ); - layout10 = new QHBoxLayout( 0, 0, 6, "layout10"); - spacer2 = new QSpacerItem( 310, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + layout10 = new TQHBoxLayout( 0, 0, 6, "layout10"); + spacer2 = new TQSpacerItem( 310, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); layout10->addItem( spacer2 ); - mergeButton = new QPushButton( this, "mergeButton" ); + mergeButton = new TQPushButton( this, "mergeButton" ); layout10->addWidget( mergeButton ); - cancelButton = new QPushButton( this, "cancelButton" ); + cancelButton = new TQPushButton( this, "cancelButton" ); layout10->addWidget( cancelButton ); SimilarCategoriesDialogLayout->addLayout( layout10 ); languageChange(); - resize( QSize(573, 429).expandedTo(minimumSizeHint()) ); + resize( TQSize(573, 429).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); connect( searchButton, SIGNAL(clicked()), this, SLOT(findMatches()) ); @@ -125,7 +125,7 @@ SimilarCategoriesDialog::SimilarCategoriesDialog( ElementList &list, QWidget* pa */ SimilarCategoriesDialog::~SimilarCategoriesDialog() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, TQt does it all for us } /* @@ -214,9 +214,9 @@ int minimum(int a,int b,int c) } /** @return an array of adjacent letter pairs contained in the input string */ -QStringList letterPairs(const QString& str) { +TQStringList letterPairs(const TQString& str) { int numPairs = str.length()-1; - QStringList pairs; + TQStringList pairs; for (int i=0; i<numPairs; i++) { pairs << str.mid(i,2); } @@ -224,14 +224,14 @@ QStringList letterPairs(const QString& str) { } /** @return an ArrayList of 2-character Strings. */ -QValueList<QStringList> wordLetterPairs(const QString &str) { - QValueList<QStringList> allPairs; +TQValueList<TQStringList> wordLetterPairs(const TQString &str) { + TQValueList<TQStringList> allPairs; // Tokenize the string and put the tokens/words into an array - QStringList words = QStringList::split("\\s",str); + TQStringList words = TQStringList::split("\\s",str); // For each word for (uint w=0; w < words.count(); w++) { // Find the pairs of characters - QStringList pairsInWord = letterPairs(words[w]); + TQStringList pairsInWord = letterPairs(words[w]); for (uint p=0; p < pairsInWord.count(); p++) { allPairs.append(pairsInWord[p]); } @@ -240,15 +240,15 @@ QValueList<QStringList> wordLetterPairs(const QString &str) { } /** @return lexical similarity value in the range [0,1] */ -double compareStrings(const QString &str1, const QString &str2) { - QValueList<QStringList> pairs1 = wordLetterPairs(str1.upper()); - QValueList<QStringList> pairs2 = wordLetterPairs(str2.upper()); +double compareStrings(const TQString &str1, const TQString &str2) { + TQValueList<TQStringList> pairs1 = wordLetterPairs(str1.upper()); + TQValueList<TQStringList> pairs2 = wordLetterPairs(str2.upper()); int intersection = 0; int size_union = pairs1.count() + pairs2.count(); for (uint i=0; i<pairs1.count(); i++) { - QStringList pair1=pairs1[i]; + TQStringList pair1=pairs1[i]; for(uint j=0; j<pairs2.count(); j++) { - QStringList pair2=pairs2[j]; + TQStringList pair2=pairs2[j]; if (pair1 == pair2) { intersection++; pairs2.remove( pairs2.at(j) ); @@ -266,12 +266,12 @@ double compareStrings(const QString &str1, const QString &str2) { #if 0 void RecipeActionsHandler::mergeSimilar() { - QPtrList<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 1 ) - KMessageBox::sorry( kapp->mainWidget(), i18n("Please select only one category."), QString::null ); + KMessageBox::sorry( kapp->mainWidget(), i18n("Please select only one category."), TQString::null ); else if ( items.count() == 1 && items.at(0)->rtti() == 1001 ) { CategoryListItem * cat_it = ( CategoryListItem* ) items.at(0); - QString name = cat_it->categoryName(); + TQString name = cat_it->categoryName(); const double max_allowed_distance = 0.60; const int length = name.length(); ElementList categories; @@ -280,7 +280,7 @@ void RecipeActionsHandler::mergeSimilar() ElementList matches; for ( ElementList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { #if 0 - if ( levenshtein_distance(name.latin1(),(*it).name.latin1())/double(QMAX(length,(*it).name.length())) >= max_allowed_distance ) { + if ( levenshtein_distance(name.latin1(),(*it).name.latin1())/double(TQMAX(length,(*it).name.length())) >= max_allowed_distance ) { #else if ( compareStrings(name,(*it).name) >= max_allowed_distance ) { #endif @@ -307,19 +307,19 @@ void SimilarCategoriesDialog::findMatches() toMergeListView->clear(); const double threshold = (100 - thresholdSlider->value())/100.0; - const QString name = categoriesBox->text(); + const TQString name = categoriesBox->text(); for ( ElementList::const_iterator it = m_elementList.begin(); it != m_elementList.end(); ++it ) { //kdDebug()<<(*it).name<<" (result/threshold): "<<compareStrings(name,(*it).name)<<"/"<<threshold<<endl; #if 0 - if ( levenshtein_distance(name.latin1(),(*it).name.latin1())/double(QMAX(length,(*it).name.length())) >= max_allowed_distance ) { + if ( levenshtein_distance(name.latin1(),(*it).name.latin1())/double(TQMAX(length,(*it).name.length())) >= max_allowed_distance ) { #else if ( compareStrings(name,(*it).name) >= threshold ) { #endif kdDebug()<<(*it).name<<" matches"<<endl; //if ( id != (*it).id ) { - (void) new QListViewItem(allListView,(*it).name,QString::number((*it).id)); - (void) new QListViewItem(toMergeListView,(*it).name,QString::number((*it).id)); + (void) new TQListViewItem(allListView,(*it).name,TQString::number((*it).id)); + (void) new TQListViewItem(toMergeListView,(*it).name,TQString::number((*it).id)); //} } } @@ -328,54 +328,54 @@ void SimilarCategoriesDialog::findMatches() void SimilarCategoriesDialog::mergeMatches() { if ( !toMergeListView->firstChild() ) { - KMessageBox::sorry( this, i18n("No categories selected to merge."), QString::null ); + KMessageBox::sorry( this, i18n("No categories selected to merge."), TQString::null ); return; } //const int id = categoriesBox->id(categoriesBox->currentItem()); - //for ( QListViewItem *item = toMergeListView->firstChild(); item; item = item->nextSibling() ) { + //for ( TQListViewItem *item = toMergeListView->firstChild(); item; item = item->nextSibling() ) { // m_database->mergeCategories(id,item->text(1).toInt()); //} allListView->clear(); //toMergeListView->clear(); - QDialog::accept(); + TQDialog::accept(); } -QValueList<int> SimilarCategoriesDialog::matches() const +TQValueList<int> SimilarCategoriesDialog::matches() const { - QValueList<int> ids; - for ( QListViewItem *item = toMergeListView->firstChild(); item; item = item->nextSibling() ) { + TQValueList<int> ids; + for ( TQListViewItem *item = toMergeListView->firstChild(); item; item = item->nextSibling() ) { ids << item->text(1).toInt(); } return ids; } -QString SimilarCategoriesDialog::element() const +TQString SimilarCategoriesDialog::element() const { return categoriesBox->text(); } void SimilarCategoriesDialog::addCategory() { - QListViewItem *item = allListView->selectedItem(); + TQListViewItem *item = allListView->selectedItem(); if ( item ) { //make sure it isn't already in the list - for ( QListViewItem *search_it = toMergeListView->firstChild(); search_it; search_it = search_it->nextSibling() ) { + for ( TQListViewItem *search_it = toMergeListView->firstChild(); search_it; search_it = search_it->nextSibling() ) { if ( search_it->text(0) == item->text(0) ) return; } - (void) new QListViewItem(toMergeListView,item->text(0),item->text(1)); + (void) new TQListViewItem(toMergeListView,item->text(0),item->text(1)); } } void SimilarCategoriesDialog::removeCategory() { - QListViewItem *item = toMergeListView->selectedItem(); + TQListViewItem *item = toMergeListView->selectedItem(); if ( item ) delete item; } diff --git a/krecipes/src/dialogs/similarcategoriesdialog.h b/krecipes/src/dialogs/similarcategoriesdialog.h index 3fadc5d..41a3e92 100644 --- a/krecipes/src/dialogs/similarcategoriesdialog.h +++ b/krecipes/src/dialogs/similarcategoriesdialog.h @@ -10,64 +10,64 @@ #ifndef SIMILARCATEGORIESDIALOG_H #define SIMILARCATEGORIESDIALOG_H -#include <qvariant.h> -#include <qdialog.h> -#include <qvaluevector.h> +#include <ntqvariant.h> +#include <ntqdialog.h> +#include <ntqvaluevector.h> #include "datablocks/elementlist.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QSlider; -class QLabel; -class QPushButton; -class QListViewItem; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQSlider; +class TQLabel; +class TQPushButton; +class TQListViewItem; class KListView; class KLineEdit; class RecipeDB; -class SimilarCategoriesDialog : public QDialog +class SimilarCategoriesDialog : public TQDialog { Q_OBJECT public: - SimilarCategoriesDialog( ElementList &, QWidget* parent = 0 ); + SimilarCategoriesDialog( ElementList &, TQWidget* parent = 0 ); ~SimilarCategoriesDialog(); - QValueList<int> matches() const; - QString element() const; + TQValueList<int> matches() const; + TQString element() const; KLineEdit* categoriesBox; - QSlider* thresholdSlider; - QLabel* thresholdLabel; - QLabel* categoryLabel; - QPushButton* searchButton; - QLabel* allLabel; + TQSlider* thresholdSlider; + TQLabel* thresholdLabel; + TQLabel* categoryLabel; + TQPushButton* searchButton; + TQLabel* allLabel; KListView* allListView; - QPushButton* removeButton; - QPushButton* addButton; - QLabel* toMergeLabel; + TQPushButton* removeButton; + TQPushButton* addButton; + TQLabel* toMergeLabel; KListView* toMergeListView; - QPushButton* mergeButton; - QPushButton* cancelButton; + TQPushButton* mergeButton; + TQPushButton* cancelButton; protected: - QVBoxLayout* SimilarCategoriesDialogLayout; - QHBoxLayout* layout6; - QGridLayout* layout4; - QVBoxLayout* layout5; - QSpacerItem* spacer4; - QHBoxLayout* layout9; - QVBoxLayout* layout8; - QVBoxLayout* layout1; - QSpacerItem* spacer1; - QVBoxLayout* layout7; - QHBoxLayout* layout10; - QSpacerItem* spacer2; + TQVBoxLayout* SimilarCategoriesDialogLayout; + TQHBoxLayout* layout6; + TQGridLayout* layout4; + TQVBoxLayout* layout5; + TQSpacerItem* spacer4; + TQHBoxLayout* layout9; + TQVBoxLayout* layout8; + TQVBoxLayout* layout1; + TQSpacerItem* spacer1; + TQVBoxLayout* layout7; + TQHBoxLayout* layout10; + TQSpacerItem* spacer2; protected slots: virtual void languageChange(); diff --git a/krecipes/src/dialogs/unitsdialog.cpp b/krecipes/src/dialogs/unitsdialog.cpp index e60f72a..deb3162 100644 --- a/krecipes/src/dialogs/unitsdialog.cpp +++ b/krecipes/src/dialogs/unitsdialog.cpp @@ -10,8 +10,8 @@ * (at your option) any later version. * ***************************************************************************/ -#include <qlayout.h> -#include <qtabwidget.h> +#include <ntqlayout.h> +#include <ntqtabwidget.h> #include "unitsdialog.h" #include "createelementdialog.h" @@ -27,30 +27,30 @@ #include <kmessagebox.h> #include <kprogress.h> -UnitsDialog::UnitsDialog( QWidget *parent, RecipeDB *db ) : QWidget( parent ) +UnitsDialog::UnitsDialog( TQWidget *parent, RecipeDB *db ) : TQWidget( parent ) { // Store pointer to database database = db; // Design dialog - QHBoxLayout* page_layout = new QHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* page_layout = new TQHBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); - QTabWidget *tabWidget = new QTabWidget( this ); + TQTabWidget *tabWidget = new TQTabWidget( this ); - QWidget *unitTab = new QWidget( tabWidget ); - QHBoxLayout* layout = new QHBoxLayout( unitTab, KDialog::marginHint(), KDialog::spacingHint() ); + TQWidget *unitTab = new TQWidget( tabWidget ); + TQHBoxLayout* layout = new TQHBoxLayout( unitTab, KDialog::marginHint(), KDialog::spacingHint() ); unitListView = new StdUnitListView( unitTab, database, true ); layout->addWidget( unitListView ); - QVBoxLayout* vboxl = new QVBoxLayout( KDialog::spacingHint() ); - newUnitButton = new QPushButton( unitTab ); + TQVBoxLayout* vboxl = new TQVBoxLayout( KDialog::spacingHint() ); + newUnitButton = new TQPushButton( unitTab ); newUnitButton->setText( i18n( "Create ..." ) ); newUnitButton->setFlat( true ); vboxl->addWidget( newUnitButton ); - removeUnitButton = new QPushButton( unitTab ); + removeUnitButton = new TQPushButton( unitTab ); removeUnitButton->setText( i18n( "Delete" ) ); removeUnitButton->setFlat( true ); vboxl->addWidget( removeUnitButton ); @@ -110,7 +110,7 @@ void UnitsDialog::loadConversionTable( ConversionTable *table, Unit::Type type ) UnitList unitList; database->loadUnits( &unitList, type ); - QStringList unitNames; + TQStringList unitNames; IDList unitIDs; // We need to store these in the table, so rows and cols are identified by unitID, not name. table->clear(); for ( UnitList::const_iterator unit_it = unitList.begin(); unit_it != unitList.end(); ++unit_it ) { @@ -171,7 +171,7 @@ void UnitsDialog::saveAllRatios( UnitRatioList &ratioList ) #if 0 ConversionTable *conversionTable = massConversionTable; - KProgressDialog progress_dialog( this, "progress_dialog", i18n( "Finding Unit Ratios" ), QString::null, true ); + KProgressDialog progress_dialog( this, "progress_dialog", i18n( "Finding Unit Ratios" ), TQString::null, true ); progress_dialog.progressBar() ->setTotalSteps( ratioList.count() * ratioList.count() ); for ( UnitRatioList::const_iterator current_it = ratioList.begin(); current_it != ratioList.end(); ++current_it ) { diff --git a/krecipes/src/dialogs/unitsdialog.h b/krecipes/src/dialogs/unitsdialog.h index d11b9f0..2056f90 100644 --- a/krecipes/src/dialogs/unitsdialog.h +++ b/krecipes/src/dialogs/unitsdialog.h @@ -12,9 +12,9 @@ #ifndef UNITSDIALOG_H #define UNITSDIALOG_H -#include <qwidget.h> +#include <ntqwidget.h> #include <klistview.h> -#include <qpushbutton.h> +#include <ntqpushbutton.h> #include "datablocks/unitratiolist.h" #include "datablocks/unit.h" @@ -27,15 +27,15 @@ class StdUnitListView; /** @author Unai Garro */ -class UnitsDialog: public QWidget +class UnitsDialog: public TQWidget { Q_OBJECT public: - UnitsDialog( QWidget *parent, RecipeDB *db ); + UnitsDialog( TQWidget *parent, RecipeDB *db ); ~UnitsDialog(); - virtual QSize sizeHint () const + virtual TQSize sizeHint () const { - return QSize( 300, 200 ); + return TQSize( 300, 200 ); } public slots: @@ -46,12 +46,12 @@ private: StdUnitListView *unitListView; ConversionTable *massConversionTable; ConversionTable *volumeConversionTable; - QPushButton *newUnitButton; - QPushButton *removeUnitButton; + TQPushButton *newUnitButton; + TQPushButton *removeUnitButton; // Internal methods void saveAllRatios( UnitRatioList &ratioList ); - bool checkBounds( const QString &name ); + bool checkBounds( const TQString &name ); // Internal Variables RecipeDB *database; diff --git a/krecipes/src/dialogs/usdadatadialog.cpp b/krecipes/src/dialogs/usdadatadialog.cpp index 25f74d3..b5bce00 100644 --- a/krecipes/src/dialogs/usdadatadialog.cpp +++ b/krecipes/src/dialogs/usdadatadialog.cpp @@ -17,12 +17,12 @@ #include <klocale.h> #include <kmessagebox.h> -#include <qfile.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qtextstream.h> -#include <qvbox.h> +#include <ntqfile.h> +#include <ntqlabel.h> +#include <ntqlayout.h> +#include <ntqpushbutton.h> +#include <ntqtextstream.h> +#include <ntqvbox.h> #include "backends/recipedb.h" #include "backends/usda_property_data.h" @@ -30,19 +30,19 @@ #include "widgets/krelistview.h" #include "datablocks/weight.h" -USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *parent ) - : KDialogBase( parent, "usdaDataDialog", true, QString::null, +USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, TQWidget *parent ) + : KDialogBase( parent, "usdaDataDialog", true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok ), ingredient( ing ), database( db ) { - setCaption( QString( i18n( "Load ingredient properties for: \"%1\"" ) ).arg( ingredient.name ) ); + setCaption( TQString( i18n( "Load ingredient properties for: \"%1\"" ) ).arg( ingredient.name ) ); - QVBox *page = makeVBoxMainWidget(); + TQVBox *page = makeVBoxMainWidget(); setButtonText( KDialogBase::Ok, i18n( "&Load" ) ); - KreListView *krelistview = new KreListView( page, QString::null, true, 0 ); + KreListView *krelistview = new KreListView( page, TQString::null, true, 0 ); listView = krelistview->listView(); listView->addColumn( i18n( "USDA Ingredient" ) ); @@ -51,7 +51,7 @@ USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *paren loadDataFromFile(); - connect( listView, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), this, SLOT( slotOk() ) ); + connect( listView, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), this, SLOT( slotOk() ) ); } USDADataDialog::~USDADataDialog() @@ -59,32 +59,32 @@ USDADataDialog::~USDADataDialog() void USDADataDialog::loadDataFromFile() { - QString abbrev_file = locate( "appdata", "data/abbrev.txt" ); + TQString abbrev_file = locate( "appdata", "data/abbrev.txt" ); if ( abbrev_file.isEmpty() ) { kdDebug() << "Unable to find abbrev.txt data file." << endl; return ; } - QFile file( abbrev_file ); + TQFile file( abbrev_file ); if ( !file.open( IO_ReadOnly ) ) { kdDebug() << "Unable to open data file: " << abbrev_file << endl; return ; } int index = 0; - QTextStream stream( &file ); + TQTextStream stream( &file ); while ( !stream.atEnd() ) { - QString line = stream.readLine(); + TQString line = stream.readLine(); if ( line.isEmpty() ) { continue; } - QStringList fields = QStringList::split( "^", line, true ); + TQStringList fields = TQStringList::split( "^", line, true ); loaded_data << fields; - QString ing_id = fields[ 0 ].mid( 1, fields[ 1 ].length() - 2 ); - QString ing_name = fields[ 1 ].mid( 1, fields[ 1 ].length() - 2 ); - ( void ) new QListViewItem( listView, ing_name, QString::number( index ) ); //using an index instead of the actual id will help find the data later + TQString ing_id = fields[ 0 ].mid( 1, fields[ 1 ].length() - 2 ); + TQString ing_name = fields[ 1 ].mid( 1, fields[ 1 ].length() - 2 ); + ( void ) new TQListViewItem( listView, ing_name, TQString::number( index ) ); //using an index instead of the actual id will help find the data later index++; } @@ -92,10 +92,10 @@ void USDADataDialog::loadDataFromFile() void USDADataDialog::slotOk() { - QListViewItem * item = listView->selectedItem(); + TQListViewItem * item = listView->selectedItem(); if ( item ) { int index = item->text( 1 ).toInt(); - QStringList data = loaded_data[ index ]; + TQStringList data = loaded_data[ index ]; int grams_id = database->findExistingUnitByName( "g" ); //get this id because all data is given per gram if ( grams_id == -1 ) { @@ -119,7 +119,7 @@ void USDADataDialog::slotOk() database->loadProperties( &existing_ing_props, ingredient.id ); int i = 0; - for ( QStringList::const_iterator it = data.at( 2 ); !property_data_list[ i ].name.isEmpty(); ++it, ++i ) { + for ( TQStringList::const_iterator it = data.at( 2 ); !property_data_list[ i ].name.isEmpty(); ++it, ++i ) { int property_id = property_list.findByName( property_data_list[ i ].name ); if ( property_id == -1 ) { database->addProperty( property_data_list[ i ].name, property_data_list[ i ].unit ); @@ -144,12 +144,12 @@ void USDADataDialog::slotOk() i++; - QString amountAndWeight = data[i].mid( 1, data[i].length() - 2 ); + TQString amountAndWeight = data[i].mid( 1, data[i].length() - 2 ); if ( !amountAndWeight.isEmpty() ) { int spaceIndex = amountAndWeight.find(" "); w.perAmount = amountAndWeight.left(spaceIndex).toDouble(); - QString perAmountUnit = amountAndWeight.right(amountAndWeight.length()-spaceIndex-1); + TQString perAmountUnit = amountAndWeight.right(amountAndWeight.length()-spaceIndex-1); if ( !parseUSDAUnitAndPrep( perAmountUnit, w.perAmountUnit, w.prepMethod ) ) continue; diff --git a/krecipes/src/dialogs/usdadatadialog.h b/krecipes/src/dialogs/usdadatadialog.h index 6c0712c..9ee9e48 100644 --- a/krecipes/src/dialogs/usdadatadialog.h +++ b/krecipes/src/dialogs/usdadatadialog.h @@ -13,8 +13,8 @@ #include <kdialogbase.h> -#include <qstringlist.h> -#include <qvaluelist.h> +#include <ntqstringlist.h> +#include <ntqvaluelist.h> #include "datablocks/element.h" @@ -27,7 +27,7 @@ class USDADataDialog : public KDialogBase Q_OBJECT public: - USDADataDialog( const Element &, RecipeDB *database, QWidget *parent = 0 ); + USDADataDialog( const Element &, RecipeDB *database, TQWidget *parent = 0 ); ~USDADataDialog(); private: @@ -38,7 +38,7 @@ private: Element ingredient; RecipeDB *database; - QValueList<QStringList> loaded_data; + TQValueList<TQStringList> loaded_data; private slots: void slotOk(); diff --git a/krecipes/src/exporters/baseexporter.cpp b/krecipes/src/exporters/baseexporter.cpp index 3fe10b1..ecac79a 100644 --- a/krecipes/src/exporters/baseexporter.cpp +++ b/krecipes/src/exporters/baseexporter.cpp @@ -11,8 +11,8 @@ #include "baseexporter.h" -#include <qfile.h> -#include <qfileinfo.h> +#include <ntqfile.h> +#include <ntqfileinfo.h> #include <kaboutdata.h> #include <kdebug.h> @@ -24,7 +24,7 @@ #include "backends/recipedb.h" -BaseExporter::BaseExporter( const QString& _filename, const QString &format ) : +BaseExporter::BaseExporter( const TQString& _filename, const TQString &format ) : file( 0 ), tar_file( 0 ), filename( _filename ), @@ -32,7 +32,7 @@ BaseExporter::BaseExporter( const QString& _filename, const QString &format ) : compress(false) { //automatically append extension - QString extension = format.right( format.length()-2 ); + TQString extension = format.right( format.length()-2 ); if ( filename.right( extension.length() ) != extension ) filename += "." + extension; } @@ -53,7 +53,7 @@ void BaseExporter::setCompressed( bool b ) compress = b; } -void BaseExporter::exporter( const QValueList<int> &ids, RecipeDB *database, KProgressDialog *progress_dlg ) +void BaseExporter::exporter( const TQValueList<int> &ids, RecipeDB *database, KProgressDialog *progress_dlg ) { m_progress_dlg = progress_dlg; @@ -65,12 +65,12 @@ void BaseExporter::exporter( const QValueList<int> &ids, RecipeDB *database, KPr void BaseExporter::exporter( int id, RecipeDB *database, KProgressDialog *progress_dlg ) { - QValueList<int> single_recipe_list; + TQValueList<int> single_recipe_list; single_recipe_list << id ; exporter( single_recipe_list, database, progress_dlg ); } -void BaseExporter::writeStream( QTextStream &stream, const RecipeList &recipe_list ) +void BaseExporter::writeStream( TQTextStream &stream, const RecipeList &recipe_list ) { stream << createHeader(recipe_list); stream << createContent(recipe_list); @@ -85,11 +85,11 @@ bool BaseExporter::createFile() if ( !filename.isEmpty() ) { if ( compress ) { tar_file = new KTar( filename, "application/x-gzip" ); - QFileInfo fi( filename ); - file = new QFile( locateLocal( "tmp",fi.fileName()+"ml" ) ); + TQFileInfo fi( filename ); + file = new TQFile( locateLocal( "tmp",fi.fileName()+"ml" ) ); } else - file = new QFile(filename); + file = new TQFile(filename); return (file != 0); } @@ -97,20 +97,20 @@ bool BaseExporter::createFile() return false; } -QString BaseExporter::fileName() const +TQString BaseExporter::fileName() const { return filename; } -void BaseExporter::saveToFile( const QValueList<int> &ids, RecipeDB *database ) +void BaseExporter::saveToFile( const TQValueList<int> &ids, RecipeDB *database ) { if ( file->open( IO_WriteOnly ) ) { if ( m_progress_dlg ) m_progress_dlg->progressBar()->setTotalSteps( ids.count()/progressInterval() ); - QValueList<int> ids_copy = ids; - QTextStream stream( file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + TQValueList<int> ids_copy = ids; + TQTextStream stream( file ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); RecipeList recipe_list; if ( headerFlags() != RecipeDB::None ) { @@ -120,7 +120,7 @@ void BaseExporter::saveToFile( const QValueList<int> &ids, RecipeDB *database ) recipe_list.clear(); for ( uint i = 0; i < ids.count(); i += progressInterval() ) { - QValueList<int> sub_list; + TQValueList<int> sub_list; for ( int sub_i = 0; sub_i < progressInterval(); ++sub_i ) { if ( ids_copy.count() == 0 ) break; @@ -131,7 +131,7 @@ void BaseExporter::saveToFile( const QValueList<int> &ids, RecipeDB *database ) RecipeList recipe_list; database->loadRecipes( &recipe_list, supportedItems(), sub_list ); - QString content = createContent( recipe_list ); + TQString content = createContent( recipe_list ); if ( !content.isEmpty() ) stream << content; @@ -151,8 +151,8 @@ void BaseExporter::saveToFile( const QValueList<int> &ids, RecipeDB *database ) file->close(); file->open( IO_ReadOnly ); - QFileInfo fi( file->name() ); - QByteArray data = file->readAll(); + TQFileInfo fi( file->name() ); + TQByteArray data = file->readAll(); tar_file->writeFile( fi.fileName(), fi.owner(), fi.group(), data.size(), data ); tar_file->close(); } @@ -161,12 +161,12 @@ void BaseExporter::saveToFile( const QValueList<int> &ids, RecipeDB *database ) } } -QString BaseExporter::krecipes_version() const +TQString BaseExporter::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. + return TQString::null; //Oh, well. We couldn't get the version. } diff --git a/krecipes/src/exporters/baseexporter.h b/krecipes/src/exporters/baseexporter.h index bf909fe..112add3 100644 --- a/krecipes/src/exporters/baseexporter.h +++ b/krecipes/src/exporters/baseexporter.h @@ -12,14 +12,14 @@ #ifndef BASEEXPORTER_H #define BASEEXPORTER_H -#include <qstringlist.h> +#include <ntqstringlist.h> #include <kapplication.h> #include <kprogress.h> #include "datablocks/recipelist.h" -class QFile; +class TQFile; class KTar; @@ -28,7 +28,7 @@ class RecipeDB; class BaseExporter { public: - BaseExporter( const QString &file, const QString &ext ); + BaseExporter( const TQString &file, const TQString &ext ); virtual ~BaseExporter(); /** Subclasses must report which items it is able to work with. @@ -39,7 +39,7 @@ public: /** Export the recipes with the given ids to the file specified in the constructor. * Optionally, a progress dialog may be given to specify the progress made. */ - void exporter( const QValueList<int> &ids, RecipeDB *database, KProgressDialog * = 0 ); + void exporter( const TQValueList<int> &ids, RecipeDB *database, KProgressDialog * = 0 ); /** Convenience function for the above, which exports a single recipe. */ void exporter( int id, RecipeDB *database, KProgressDialog * = 0 ); @@ -48,17 +48,17 @@ public: * Note that this can differ somewhat from the filename passed in the * constructor. */ - QString fileName() const; + TQString fileName() const; /** Write the given recipe list to a text stream. * This can be used to export recipes without use of the database. */ - void writeStream( QTextStream &, const RecipeList & ); + void writeStream( TQTextStream &, const RecipeList & ); protected: - virtual QString createContent( const RecipeList & ) = 0; - virtual QString createFooter(){ return QString(); } - virtual QString createHeader( const RecipeList & ){ return QString(); } + virtual TQString createContent( const RecipeList & ) = 0; + virtual TQString createFooter(){ return TQString(); } + virtual TQString createHeader( const RecipeList & ){ return TQString(); } /** The number of recipes to load into memory at once. This many recipes will be * loaded from the database, processed, and then another batch of this many will be @@ -79,15 +79,15 @@ protected: * KGlobal::instance()->aboutData()->version() * This can be used by exporters to put the version of the app exporting the file. */ - QString krecipes_version() const; + TQString krecipes_version() const; private: bool createFile(); - void saveToFile( const QValueList<int> &ids, RecipeDB *database ); + void saveToFile( const TQValueList<int> &ids, RecipeDB *database ); - QFile* file; + TQFile* file; KTar *tar_file; - QString filename; + TQString filename; KProgressDialog *m_progress_dlg; bool compress; }; diff --git a/krecipes/src/exporters/cookmlexporter.cpp b/krecipes/src/exporters/cookmlexporter.cpp index 7b5988e..047d586 100644 --- a/krecipes/src/exporters/cookmlexporter.cpp +++ b/krecipes/src/exporters/cookmlexporter.cpp @@ -10,11 +10,11 @@ #include "cookmlexporter.h" -#include <qbuffer.h> -#include <qdom.h> -#include <qimage.h> -#include <qpixmap.h> -#include <qfile.h> +#include <ntqbuffer.h> +#include <ntqdom.h> +#include <ntqimage.h> +#include <ntqpixmap.h> +#include <ntqfile.h> #include <kconfig.h> #include <kdebug.h> @@ -26,7 +26,7 @@ #include "backends/recipedb.h" -CookMLExporter::CookMLExporter( const QString& filename, const QString &format ) : +CookMLExporter::CookMLExporter( const TQString& filename, const TQString &format ) : BaseExporter( filename, format ) {} @@ -39,32 +39,32 @@ int CookMLExporter::supportedItems() const return RecipeDB::All ^ RecipeDB::Ratings; } -QString CookMLExporter::createHeader( const RecipeList& ) +TQString CookMLExporter::createHeader( const RecipeList& ) { - QString xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; + TQString xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; xml += "<!DOCTYPE cookml PUBLIC \"-\" \"cookml.dtd\">"; xml += "<cookml version=\"1.0.13\" prog=\"Krecipes\" progver=\""+krecipes_version()+"\">"; return xml; } -QString CookMLExporter::createFooter() +TQString CookMLExporter::createFooter() { return "</cookml>"; } -QString CookMLExporter::createContent( const RecipeList& recipes ) +TQString CookMLExporter::createContent( const RecipeList& recipes ) { - QString xml; - QDomDocument doc; + TQString xml; + 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" ); recipe_tag.setAttribute( "lang", ( KGlobal::locale() ) ->language() ); //cookml_tag.appendChild( recipe_tag ); - QDomElement head_tag = doc.createElement( "head" ); + TQDomElement head_tag = doc.createElement( "head" ); head_tag.setAttribute( "title", ( *recipe_it ).title ); head_tag.setAttribute( "servingqty", ( *recipe_it ).yield.amount ); head_tag.setAttribute( "servingtype", ( *recipe_it ).yield.type ); @@ -72,35 +72,35 @@ QString CookMLExporter::createContent( const RecipeList& recipes ) recipe_tag.appendChild( head_tag ); 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 ) ); head_tag.appendChild( cat_tag ); } for ( ElementList::const_iterator author_it = ( *recipe_it ).authorList.begin(); author_it != ( *recipe_it ).authorList.end(); ++author_it ) { - QDomElement sourceline_tag = doc.createElement( "sourceline" ); + TQDomElement sourceline_tag = doc.createElement( "sourceline" ); sourceline_tag.appendChild( doc.createTextNode( ( *author_it ).name ) ); head_tag.appendChild( sourceline_tag ); } - QDomElement picbin_tag = doc.createElement( "picbin" ); + TQDomElement picbin_tag = doc.createElement( "picbin" ); picbin_tag.setAttribute( "format", "JPG" ); - QByteArray data; - QBuffer buffer( data ); + TQByteArray data; + TQBuffer buffer( data ); buffer.open( IO_WriteOnly ); - QImageIO iio( &buffer, "JPEG" ); + TQImageIO iio( &buffer, "JPEG" ); iio.setImage( ( *recipe_it ).photo.convertToImage() ); iio.write(); - //( *recipe_it ).photo.save( &buffer, "JPEG" ); don't need QImageIO in QT 3.2 + //( *recipe_it ).photo.save( &buffer, "JPEG" ); don't need TQImageIO in QT 3.2 picbin_tag.appendChild( doc.createTextNode( KCodecs::base64Encode( data, true ) ) ); head_tag.appendChild( picbin_tag ); - QDomElement part_tag = doc.createElement( "part" ); + TQDomElement part_tag = doc.createElement( "part" ); for ( IngredientList::const_iterator ing_it = ( *recipe_it ).ingList.begin(); ing_it != ( *recipe_it ).ingList.end(); ++ing_it ) { - QDomElement ingredient_tag = doc.createElement( "ingredient" ); - ingredient_tag.setAttribute( "qty", QString::number( ( *ing_it ).amount ) ); + TQDomElement ingredient_tag = doc.createElement( "ingredient" ); + ingredient_tag.setAttribute( "qty", TQString::number( ( *ing_it ).amount ) ); ingredient_tag.setAttribute( "unit", ( ( *ing_it ).amount > 1 ) ? ( *ing_it ).units.plural : ( *ing_it ).units.name ); ingredient_tag.setAttribute( "item", ( *ing_it ).name ); ingredient_tag.setAttribute( "preparation", ( *ing_it ).prepMethodList.join(",") ); @@ -108,10 +108,10 @@ QString CookMLExporter::createContent( const RecipeList& recipes ) } recipe_tag.appendChild( part_tag ); - QDomElement preparation_tag = doc.createElement( "preparation" ); + TQDomElement preparation_tag = doc.createElement( "preparation" ); recipe_tag.appendChild( preparation_tag ); - QDomElement text_tag = doc.createElement( "text" ); + TQDomElement text_tag = doc.createElement( "text" ); preparation_tag.appendChild( text_tag ); text_tag.appendChild( doc.createTextNode( ( *recipe_it ).instructions ) ); diff --git a/krecipes/src/exporters/cookmlexporter.h b/krecipes/src/exporters/cookmlexporter.h index ce62b73..7e8d99a 100644 --- a/krecipes/src/exporters/cookmlexporter.h +++ b/krecipes/src/exporters/cookmlexporter.h @@ -24,15 +24,15 @@ class CookMLExporter : public BaseExporter { public: - CookMLExporter( const QString&, const QString& ); + CookMLExporter( const TQString&, const TQString& ); virtual ~CookMLExporter(); 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(); }; #endif //COOKMLEXPORTER_H diff --git a/krecipes/src/exporters/htmlbookexporter.cpp b/krecipes/src/exporters/htmlbookexporter.cpp index e1e98f4..72f09c3 100644 --- a/krecipes/src/exporters/htmlbookexporter.cpp +++ b/krecipes/src/exporters/htmlbookexporter.cpp @@ -10,15 +10,15 @@ #include "htmlbookexporter.h" -#include <qfile.h> -#include <qstylesheet.h> +#include <ntqfile.h> +#include <ntqstylesheet.h> #include <kdebug.h> #include "backends/recipedb.h" #include "datablocks/categorytree.h" -HTMLBookExporter::HTMLBookExporter( CategoryTree *categories, const QString& basedir, const QString &format ) : +HTMLBookExporter::HTMLBookExporter( CategoryTree *categories, const TQString& basedir, const TQString &format ) : HTMLExporter( basedir+"/index", format ), m_categories(categories), m_basedir(basedir) { } @@ -32,74 +32,74 @@ int HTMLBookExporter::headerFlags() const return RecipeDB::Categories | RecipeDB::Title; } -QString HTMLBookExporter::createContent( const RecipeList& recipes ) +TQString HTMLBookExporter::createContent( const RecipeList& recipes ) { RecipeList::const_iterator recipe_it; for ( 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 ) { - QMap<QString,QTextStream*>::iterator stream_it = fileMap.find( (*cat_it).name ); + TQMap<TQString,TQTextStream*>::iterator stream_it = fileMap.find( (*cat_it).name ); (**stream_it) << "<br /><br />"; - (**stream_it) << QString("<a name=\""+(*recipe_it).title+"\" />"); + (**stream_it) << TQString("<a name=\""+(*recipe_it).title+"\" />"); (**stream_it) << HTMLExporter::createContent(*recipe_it); - (**stream_it) << QString("[ <a href=\"#top\">Top</a> ]"); - (**stream_it) << QString("[ <a href=\"index.html\">Back</a> ]"); + (**stream_it) << TQString("[ <a href=\"#top\">Top</a> ]"); + (**stream_it) << TQString("[ <a href=\"index.html\">Back</a> ]"); (**stream_it) << "<br /><br />"; } } - return QString::null; + return TQString::null; } -QString HTMLBookExporter::createHeader( const RecipeList &list ) +TQString HTMLBookExporter::createHeader( const RecipeList &list ) { - QString output = HTMLExporter::createHeader(list); + TQString output = HTMLExporter::createHeader(list); - QString catLinks; - QTextStream catLinksStream(&catLinks,IO_WriteOnly); + TQString catLinks; + TQTextStream catLinksStream(&catLinks,IO_WriteOnly); createCategoryStructure(catLinksStream,list); return output+"<h1>Krecipes Recipes</h1><div>"+catLinks+"</li></ul></div>"; } -QString HTMLBookExporter::createFooter() +TQString HTMLBookExporter::createFooter() { - QMap<QString,QTextStream*>::const_iterator it; + TQMap<TQString,TQTextStream*>::const_iterator it; for ( it = fileMap.begin(); it != fileMap.end(); ++it ) { (**it) << HTMLExporter::createFooter(); (*it)->device()->close(); //does it matter the order of deletion here? - QIODevice *file = (*it)->device(); + TQIODevice *file = (*it)->device(); delete *it; delete file; } - QString output = HTMLExporter::createFooter(); + TQString output = HTMLExporter::createFooter(); return output; } -void HTMLBookExporter::createCategoryStructure( QTextStream &xml, const RecipeList &recipes ) +void HTMLBookExporter::createCategoryStructure( TQTextStream &xml, const RecipeList &recipes ) { - QValueList<int> categoriesUsed; + TQValueList<int> 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 ) { - QMap<QString,QTextStream*>::iterator stream_it = fileMap.find( (*cat_it).name ); + TQMap<TQString,TQTextStream*>::iterator stream_it = fileMap.find( (*cat_it).name ); if ( categoriesUsed.find( ( *cat_it ).id ) == categoriesUsed.end() ) { categoriesUsed << ( *cat_it ).id; - QString catPageName = m_basedir+"/"+escape((*cat_it).name)+".html"; - QFile *catPage = new QFile( catPageName ); + TQString catPageName = m_basedir+"/"+escape((*cat_it).name)+".html"; + TQFile *catPage = new TQFile( catPageName ); catPage->open( IO_WriteOnly ); - QTextStream *stream = new QTextStream( catPage ); - stream->setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream *stream = new TQTextStream( catPage ); + stream->setEncoding( TQTextStream::UnicodeUTF8 ); (*stream) << HTMLExporter::createHeader(recipes); - (*stream) << QString("<a name=\"top\" />"); + (*stream) << TQString("<a name=\"top\" />"); (*stream) << "<h1>"<<(*cat_it).name<<"</h1>"; stream_it = fileMap.insert((*cat_it).name,stream); } - (**stream_it) << QString("[ <a href=\"#" + (*recipe_it).title + "\">" + (*recipe_it).title + "</a> ]"); + (**stream_it) << TQString("[ <a href=\"#" + (*recipe_it).title + "\">" + (*recipe_it).title + "</a> ]"); } } @@ -113,7 +113,7 @@ void HTMLBookExporter::createCategoryStructure( QTextStream &xml, const RecipeLi } } -bool HTMLBookExporter::removeIfUnused( const QValueList<int> &cat_ids, CategoryTree *parent, bool parent_should_show ) +bool HTMLBookExporter::removeIfUnused( const TQValueList<int> &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() ) { @@ -137,13 +137,13 @@ bool HTMLBookExporter::removeIfUnused( const QValueList<int> &cat_ids, CategoryT return parent_should_show; } -void HTMLBookExporter::writeCategoryStructure( QTextStream &xml, const CategoryTree *categoryTree ) +void HTMLBookExporter::writeCategoryStructure( TQTextStream &xml, const CategoryTree *categoryTree ) { if ( categoryTree->category.id != -2 ) { if ( categoryTree->category.id != -1 ) { - QString catPageName = QStyleSheet::escape(categoryTree->category.name)+".html"; + TQString catPageName = TQStyleSheet::escape(categoryTree->category.name)+".html"; - xml << "\t<li>\n\t\t<a href=\""+catPageName+"\">"+QStyleSheet::escape( categoryTree->category.name ).replace("\"",""") + "</a>\n"; + xml << "\t<li>\n\t\t<a href=\""+catPageName+"\">"+TQStyleSheet::escape( categoryTree->category.name ).replace("\"",""") + "</a>\n"; } for ( CategoryTree * child_it = categoryTree->firstChild(); child_it; child_it = child_it->nextSibling() ) { diff --git a/krecipes/src/exporters/htmlbookexporter.h b/krecipes/src/exporters/htmlbookexporter.h index ca0d7fe..1766c0e 100644 --- a/krecipes/src/exporters/htmlbookexporter.h +++ b/krecipes/src/exporters/htmlbookexporter.h @@ -11,8 +11,8 @@ #ifndef HTMLBOOKEXPORTER_H #define HTMLBOOKEXPORTER_H -#include <qmap.h> -#include <qvaluelist.h> +#include <ntqmap.h> +#include <ntqvaluelist.h> #include "baseexporter.h" #include "htmlexporter.h" @@ -27,26 +27,26 @@ class CategoryTree; class HTMLBookExporter : public HTMLExporter { public: - HTMLBookExporter( CategoryTree *categories, const QString&, const QString& ); + HTMLBookExporter( CategoryTree *categories, const TQString&, const TQString& ); virtual ~HTMLBookExporter(); 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: - void createCategoryStructure( QTextStream &xml, const RecipeList &recipes ); - bool removeIfUnused( const QValueList<int> &cat_ids, CategoryTree *parent, bool parent_should_show = false ); - void writeCategoryStructure( QTextStream &xml, const CategoryTree *categoryTree ); + void createCategoryStructure( TQTextStream &xml, const RecipeList &recipes ); + bool removeIfUnused( const TQValueList<int> &cat_ids, CategoryTree *parent, bool parent_should_show = false ); + void writeCategoryStructure( TQTextStream &xml, const CategoryTree *categoryTree ); - QMap<QString,QTextStream*> fileMap; + TQMap<TQString,TQTextStream*> fileMap; RecipeDB *database; CategoryTree *m_categories; - QString m_basedir; + TQString m_basedir; }; #endif //HTMLBOOKEXPORTER_H diff --git a/krecipes/src/exporters/htmlexporter.cpp b/krecipes/src/exporters/htmlexporter.cpp index 0d56c98..31e8c40 100644 --- a/krecipes/src/exporters/htmlexporter.cpp +++ b/krecipes/src/exporters/htmlexporter.cpp @@ -14,14 +14,14 @@ #include "htmlexporter.h" -#include <qptrdict.h> -#include <qimage.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qstylesheet.h> //for QStyleSheet::escape() to escape for HTML +#include <ntqptrdict.h> +#include <ntqimage.h> +#include <ntqfileinfo.h> +#include <ntqdir.h> +#include <ntqstylesheet.h> //for TQStyleSheet::escape() to escape for HTML #include <dom/dom_element.h> -#include <qpainter.h> -#include <qfileinfo.h> +#include <ntqpainter.h> +#include <ntqfileinfo.h> #include <kconfig.h> #include <kdebug.h> @@ -42,15 +42,15 @@ #include <cmath> //for ceil() -HTMLExporter::HTMLExporter( const QString& filename, const QString &format ) : +HTMLExporter::HTMLExporter( const TQString& filename, const TQString &format ) : BaseExporter( filename, format ) { KConfig *config = KGlobal::config(); config->setGroup( "Page Setup" ); //let's do everything we can to be sure at least some layout is loaded - QString template_filename = config->readEntry( "Template", locate( "appdata", "layouts/Default.template" ) ); - if ( template_filename.isEmpty() || !QFile::exists( template_filename ) ) + TQString template_filename = config->readEntry( "Template", locate( "appdata", "layouts/Default.template" ) ); + if ( template_filename.isEmpty() || !TQFile::exists( template_filename ) ) template_filename = locate( "appdata", "layouts/Default.template" ); kdDebug() << "Using template file: " << template_filename << endl; @@ -58,7 +58,7 @@ HTMLExporter::HTMLExporter( const QString& filename, const QString &format ) : //let's do everything we can to be sure at least some layout is loaded m_layoutFilename = config->readEntry( "Layout", locate( "appdata", "layouts/Default.klo" ) ); - if ( m_layoutFilename.isEmpty() || !QFile::exists( m_layoutFilename ) ) + if ( m_layoutFilename.isEmpty() || !TQFile::exists( m_layoutFilename ) ) m_layoutFilename = locate( "appdata", "layouts/Default.klo" ); kdDebug() << "Using layout file: " << m_layoutFilename << endl; } @@ -67,18 +67,18 @@ HTMLExporter::~HTMLExporter() { } -void HTMLExporter::setTemplate( const QString &filename ) +void HTMLExporter::setTemplate( const TQString &filename ) { - QFile templateFile( filename ); + TQFile templateFile( filename ); if ( templateFile.open( IO_ReadOnly ) ) { m_templateFilename = filename; - m_templateContent = QString( templateFile.readAll() ); + m_templateContent = TQString( templateFile.readAll() ); } else kdDebug()<<"couldn't find/open template file"<<endl; } -void HTMLExporter::setStyle( const QString &filename ) +void HTMLExporter::setStyle( const TQString &filename ) { m_layoutFilename = filename; } @@ -87,16 +87,16 @@ int HTMLExporter::supportedItems() const { int items = RecipeDB::All ^ RecipeDB::Properties; - QMap<QString,bool>::const_iterator it = m_visibilityMap.find("properties"); + TQMap<TQString,bool>::const_iterator it = m_visibilityMap.find("properties"); if ( it == m_visibilityMap.end() || it.data() == true ) items |= RecipeDB::Properties; return RecipeDB::All; } -QString HTMLExporter::createContent( const Recipe& recipe ) +TQString HTMLExporter::createContent( const Recipe& recipe ) { - QString templateCopy = m_templateContent; + TQString templateCopy = m_templateContent; storePhoto( recipe ); @@ -104,9 +104,9 @@ QString HTMLExporter::createContent( const Recipe& recipe ) return templateCopy; } -QString HTMLExporter::createContent( const RecipeList& recipes ) +TQString HTMLExporter::createContent( const RecipeList& recipes ) { - QString fileContent; + TQString fileContent; RecipeList::const_iterator recipe_it; for ( recipe_it = recipes.begin(); recipe_it != recipes.end(); ++recipe_it ) { @@ -116,7 +116,7 @@ QString HTMLExporter::createContent( const RecipeList& recipes ) return fileContent; } -QString HTMLExporter::createHeader( const RecipeList & ) +TQString HTMLExporter::createHeader( const RecipeList & ) { m_visibilityMap.clear(); m_columnsMap.clear(); @@ -127,7 +127,7 @@ QString HTMLExporter::createHeader( const RecipeList & ) m_error = false; if ( m_templateContent.isEmpty() ) { - QString errorStr = i18n("<html><body>\n" + TQString errorStr = i18n("<html><body>\n" "<p><b>Error: </b>Unable to find a layout file, which is" " needed to view the recipe.</p>" "<p>Krecipes was probably not properly installed.</p>" @@ -136,9 +136,9 @@ QString HTMLExporter::createHeader( const RecipeList & ) return errorStr; } - QFile layoutFile( m_layoutFilename ); - QString error; int line; int column; - QDomDocument doc; + TQFile layoutFile( m_layoutFilename ); + TQString error; int line; int column; + TQDomDocument doc; if ( !doc.setContent( &layoutFile, &error, &line, &column ) ) { kdDebug()<<"Unable to load style information. Will create HTML without it..."<<endl; } @@ -146,34 +146,34 @@ QString HTMLExporter::createHeader( const RecipeList & ) processDocument(doc); //put all the recipe photos into this directory - QDir dir; - QFileInfo fi(fileName()); + TQDir dir; + TQFileInfo fi(fileName()); dir.mkdir( fi.dirPath(true) + "/" + fi.baseName() + "_photos" ); RecipeList::const_iterator recipe_it; KLocale*loc = KGlobal::locale(); - QString encoding = loc->encoding(); + TQString encoding = loc->encoding(); - QString output = "<html>"; + TQString output = "<html>"; output += "<head>"; output += "<meta name=\"lang\" content=\"" + loc->language() + "\">\n"; output += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; - output += QString( "<title>%1</title>" ).arg( i18n( "Krecipes Recipes" ) ); + output += TQString( "<title>%1</title>" ).arg( i18n( "Krecipes Recipes" ) ); output += "<style type=\"text/css\">\n"; - QString cssContent; - QFileInfo info(m_templateFilename); - QFile cssFile(info.dirPath(true) + "/" + info.baseName() + ".css"); + TQString cssContent; + TQFileInfo info(m_templateFilename); + TQFile cssFile(info.dirPath(true) + "/" + info.baseName() + ".css"); kdDebug()<<info.dirPath(true) + "/" + info.baseName() + ".css"<<endl; if ( cssFile.open( IO_ReadOnly ) ) { - cssContent = QString( cssFile.readAll() ); + cssContent = TQString( cssFile.readAll() ); } output += cssContent; output += m_cachedCSS; - m_cachedCSS = QString::null; + m_cachedCSS = TQString::null; output += "</style>"; output += "</head>"; output += "<body class=\"background\">"; @@ -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()<<object<<" has "<<cols<<" columns"<<endl; } -QString HTMLExporter::createFooter() +TQString HTMLExporter::createFooter() { if ( m_error ) - return QString::null; + return TQString::null; return "</body></html>"; } 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<QString,bool>::const_iterator it = m_visibilityMap.find(name); + TQMap<TQString,bool>::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", "<br />" ); content = content.replace( "**INSTRUCTIONS**", HTMLIfVisible("instructions",instr_html) ); //=======================SERVINGS======================// - QString yield_html = QString( "<b>%1: </b>%2" ).arg( i18n( "Yield" ) ).arg( recipe.yield.toString() ); + TQString yield_html = TQString( "<b>%1: </b>%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( "<b>%1: </b>%2" ).arg( i18n( "Preparation Time" ) ).arg( recipe.prepTime.toString( "h:mm" ) ); + preptime_html = TQString( "<b>%1: </b>%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( "<b>%1: </b>" ).arg( i18n( "Authors" ) ) ); + authors_html.prepend( TQString( "<b>%1: </b>" ).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( "<b>%1: </b>" ).arg( i18n( "Categories" ) ) ); + categories_html.prepend( TQString( "<b>%1: </b>" ).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<QString,int>::const_iterator cols_it = m_columnsMap.find("ingredients"); + TQMap<TQString,int>::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 += "<ul>"; } - 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( "<li>%1</li>" ).arg( tmp_format ); + ingredients_html += TQString( "<li>%1</li>" ).arg( tmp_format ); - for ( QValueList<IngredientData>::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<IngredientData>::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( "<li>%1</li>" ).arg( tmp_format ); + ingredients_html += TQString( "<li>%1</li>" ).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( "<li>%1: <nobr>%2 %3</nobr></li>" ) - .arg( QStyleSheet::escape( (*prop_it).name ) ) + properties_html += TQString( "<li>%1: <nobr>%2 %3</nobr></li>" ) + .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("<b>%1:</b>").arg(i18n("Ratings")); + ratings_html += TQString("<b>%1:</b>").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 += "<table>"; 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 += "<tr><td>"+(*rc_it).name+":</td><td><img src=\""+image_url+"\" /></td></tr>"; - 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("<b>%1:</b>").arg(i18n("Overall Rating")); - QString image_url = fi.baseName() + "_photos/" + QString::number(average) + "-stars.png"; + overall_html += TQString("<b>%1:</b>").arg(i18n("Overall Rating")); + TQString image_url = fi.baseName() + "_photos/" + TQString::number(average) + "-stars.png"; image_url = KURL::encode_string( image_url ); overall_html += "<img src=\""+image_url+"\" />"; - 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<int> id; + TQValueList<int> id; id << recipe_id; removeHTMLFiles( filename, id ); } -void HTMLExporter::removeHTMLFiles( const QString &filename, const QValueList<int> &recipe_ids ) +void HTMLExporter::removeHTMLFiles( const TQString &filename, const TQValueList<int> &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<int>::const_iterator it = recipe_ids.begin(); it != recipe_ids.end(); ++it ) { - QFile photo( filename + "_photos/" + QString::number(*it) + ".png" ); + for ( TQValueList<int>::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 <qdom.h> -#include <qmap.h> +#include <ntqdom.h> +#include <ntqmap.h> #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<int> &recipe_ids ); + static void removeHTMLFiles( const TQString &filename, int recipe_id ); + static void removeHTMLFiles( const TQString &filename, const TQValueList<int> &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<QString,bool> m_visibilityMap; - QMap<QString,int> 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<TQString,bool> m_visibilityMap; + TQMap<TQString,int> 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 <qfile.h> -#include <qstylesheet.h> -#include <qbuffer.h> -#include <qimage.h> +#include <ntqfile.h> +#include <ntqstylesheet.h> +#include <ntqbuffer.h> +#include <ntqimage.h> #include <kdebug.h> #include <klocale.h> @@ -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 += "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; xml += "<krecipes version=\"" + krecipes_version() + "\" lang=\"" + ( KGlobal::locale() )->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 "</krecipes>\n"; } -QString KreExporter::generateIngredient( const IngredientData &ing ) +TQString KreExporter::generateIngredient( const IngredientData &ing ) { - QString xml; + TQString xml; - xml += "<name>" + QStyleSheet::escape( ( ing ).name ) + "</name>\n"; + xml += "<name>" + TQStyleSheet::escape( ( ing ).name ) + "</name>\n"; xml += "<amount>"; if ( ing.amount_offset < 1e-10 ) { - xml += QString::number( ing.amount ); + xml += TQString::number( ing.amount ); } else { - xml += "<min>"+QString::number( ing.amount )+"</min>"; - xml += "<max>"+QString::number( ing.amount + ing.amount_offset )+"</max>"; + xml += "<min>"+TQString::number( ing.amount )+"</min>"; + xml += "<max>"+TQString::number( ing.amount + ing.amount_offset )+"</max>"; } xml += "</amount>\n"; - QString unit_str = ( ing.amount+ing.amount_offset > 1 ) ? ing.units.plural : ing.units.name; - xml += "<unit>" + QStyleSheet::escape( unit_str ) + "</unit>\n"; + TQString unit_str = ( ing.amount+ing.amount_offset > 1 ) ? ing.units.plural : ing.units.name; + xml += "<unit>" + TQStyleSheet::escape( unit_str ) + "</unit>\n"; if ( ing.prepMethodList.count() > 0 ) - xml += "<prep>" + QStyleSheet::escape( ing.prepMethodList.join(",") ) + "</prep>\n"; + xml += "<prep>" + TQStyleSheet::escape( ing.prepMethodList.join(",") ) + "</prep>\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 += "<krecipes-recipe>\n"; xml += "<krecipes-description>\n"; - xml += "<title>" + QStyleSheet::escape( ( *recipe_it ).title ) + "</title>\n"; + xml += "<title>" + TQStyleSheet::escape( ( *recipe_it ).title ) + "</title>\n"; for ( ElementList::const_iterator author_it = ( *recipe_it ).authorList.begin(); author_it != ( *recipe_it ).authorList.end(); ++author_it ) - xml += "<author>" + QStyleSheet::escape( ( *author_it ).name ) + "</author>\n"; + xml += "<author>" + TQStyleSheet::escape( ( *author_it ).name ) + "</author>\n"; xml += "<pictures>\n"; if ( !( *recipe_it ).photo.isNull() ) { xml += "<pic format=\"JPEG\" id=\"1\"><![CDATA["; //fixed id until we implement multiple photos ability - QByteArray data; - QBuffer buffer( data ); + TQByteArray data; + TQBuffer buffer( data ); buffer.open( IO_WriteOnly ); - QImageIO iio( &buffer, "JPEG" ); + TQImageIO iio( &buffer, "JPEG" ); iio.setImage( ( *recipe_it ).photo.convertToImage() ); iio.write(); - //( *recipe_it ).photo.save( &buffer, "JPEG" ); don't need QImageIO in QT 3.2 + //( *recipe_it ).photo.save( &buffer, "JPEG" ); don't need TQImageIO in QT 3.2 xml += KCodecs::base64Encode( data, true ); @@ -123,17 +123,17 @@ QString KreExporter::createContent( const RecipeList& recipes ) xml += "<category>\n"; for ( ElementList::const_iterator cat_it = ( *recipe_it ).categoryList.begin(); cat_it != ( *recipe_it ).categoryList.end(); ++cat_it ) - xml += "<cat>" + QStyleSheet::escape( ( *cat_it ).name ) + "</cat>\n"; + xml += "<cat>" + TQStyleSheet::escape( ( *cat_it ).name ) + "</cat>\n"; xml += "</category>\n"; xml += "<yield>"; xml += "<amount>"; if ( ( *recipe_it ).yield.amount_offset < 1e-10 ) { - xml += QString::number( ( *recipe_it ).yield.amount ); + xml += TQString::number( ( *recipe_it ).yield.amount ); } else { - xml += "<min>"+QString::number( ( *recipe_it ).yield.amount )+"</min>"; - xml += "<max>"+QString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset )+"</max>"; + xml += "<min>"+TQString::number( ( *recipe_it ).yield.amount )+"</min>"; + xml += "<max>"+TQString::number( ( *recipe_it ).yield.amount + ( *recipe_it ).yield.amount_offset )+"</max>"; } xml += "</amount>"; xml += "<type>"+( *recipe_it ).yield.type+"</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 += "<ingredient-group name=\"" + QStyleSheet::escape(group) + "\">\n"; + xml += "<ingredient-group name=\"" + TQStyleSheet::escape(group) + "\">\n"; for ( IngredientList::const_iterator ing_it = group_list.begin(); ing_it != group_list.end(); ++ing_it ) { xml += "<ingredient>\n"; @@ -157,7 +157,7 @@ QString KreExporter::createContent( const RecipeList& recipes ) if ( (*ing_it).substitutes.count() > 0 ) { xml += "<substitutes>\n"; - for ( QValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { xml += "<ingredient>\n"; xml += generateIngredient(*sub_it); xml += "</ingredient>\n"; @@ -176,21 +176,21 @@ QString KreExporter::createContent( const RecipeList& recipes ) xml += "</krecipes-ingredients>\n"; xml += "<krecipes-instructions>\n"; - xml += QStyleSheet::escape( ( *recipe_it ).instructions ); + xml += TQStyleSheet::escape( ( *recipe_it ).instructions ); xml += "</krecipes-instructions>\n"; //ratings xml += "<krecipes-ratings>"; for ( RatingList::const_iterator rating_it = (*recipe_it).ratingList.begin(); rating_it != (*recipe_it).ratingList.end(); ++rating_it ) { xml += "<rating>"; - xml += "<comment>"+QStyleSheet::escape( ( *rating_it ).comment )+"</comment>"; - xml += "<rater>"+QStyleSheet::escape( ( *rating_it ).rater )+"</rater>"; + xml += "<comment>"+TQStyleSheet::escape( ( *rating_it ).comment )+"</comment>"; + xml += "<rater>"+TQStyleSheet::escape( ( *rating_it ).rater )+"</rater>"; xml += "<criterion>"; for ( RatingCriteriaList::const_iterator rc_it = (*rating_it).ratingCriteriaList.begin(); rc_it != (*rating_it).ratingCriteriaList.end(); ++rc_it ) { xml += "<criteria>"; xml += "<name>"+(*rc_it).name+"</name>"; - xml += "<stars>"+QString::number((*rc_it).stars)+"</stars>"; + xml += "<stars>"+TQString::number((*rc_it).stars)+"</stars>"; xml += "</criteria>"; } xml += "</criterion>"; @@ -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<int> categoriesUsed; + TQValueList<int> 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<int> &cat_ids, CategoryTree *parent, bool parent_should_show ) +bool KreExporter::removeIfUnused( const TQValueList<int> &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<int> &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=\"" + QStyleSheet::escape( categoryTree->category.name ).replace("\"",""") + "\">\n"; + xml += "<category name=\"" + TQStyleSheet::escape( categoryTree->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<int> &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<int> &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 <qregexp.h> +#include <ntqregexp.h> #include <kconfig.h> #include <kdebug.h> @@ -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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList<IngredientData>::const_iterator save_it = sub_it; + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList<IngredientData>::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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList<IngredientData>::const_iterator save_it = sub_it; + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList<IngredientData>::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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + for ( TQValueList<IngredientData>::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 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; + TQString xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; xml += "<!DOCTYPE recipeml PUBLIC \"-//FormatData//DTD RecipeML 0.5//EN\" \ \"http://www.formatdata.com/recipeml/recipeml.dtd\">"; xml += "<recipeml version=\"0.5\" generator=\"Krecipes v"+krecipes_version()+"\">\n"; return xml; } -QString RecipeMLExporter::createFooter() +TQString RecipeMLExporter::createFooter() { return "</recipeml>"; } -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 <menu> if exists or else <recipeml> - 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<IngredientData>::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<IngredientData>::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 <qdom.h> +#include <ntqdom.h> 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 <qregexp.h> +#include <ntqregexp.h> #include <kconfig.h> #include <kdebug.h> @@ -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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList<IngredientData>::const_iterator save_it = sub_it; + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList<IngredientData>::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<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { - QValueList<IngredientData>::const_iterator save_it = sub_it; + for ( TQValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ) { + TQValueList<IngredientData>::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 <kprogress.h> #include <kmessagebox.h> -#include <qvaluevector.h> +#include <ntqvaluevector.h> #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<IngredientData>::iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it ) { + for ( TQValueList<IngredientData>::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 ) { //<!doc> ensures it is detected as RichText - m_master_error += QString( i18n( "<!doc>Import of recipes from the file <b>\"%1\"</b> <b>failed</b> due to the following error(s):" ) ).arg( file ); + m_master_error += TQString( i18n( "<!doc>Import of recipes from the file <b>\"%1\"</b> <b>failed</b> due to the following error(s):" ) ).arg( file ); m_master_error += "<ul><li>" + m_error_msgs.join( "</li><li>" ) + "</li></ul>"; m_error_msgs.clear(); } else if ( m_warning_msgs.count() > 0 ) { - m_master_warning += QString( i18n( "The file <b>%1</b> generated the following warning(s):" ) ).arg( file ); + m_master_warning += TQString( i18n( "The file <b>%1</b> generated the following warning(s):" ) ).arg( file ); m_master_warning += "<ul><li>" + m_warning_msgs.join( "</li><li>" ) + "</li></ul>"; 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 <klocale.h> -#include <qstring.h> -#include <qstringlist.h> +#include <ntqstring.h> +#include <ntqstringlist.h> #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 <qstring.h> +#include <ntqstring.h> #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 <klocale.h> #include <kdebug.h> -#include <qfile.h> -#include <qstringlist.h> +#include <ntqfile.h> +#include <ntqstringlist.h> #include <kstandarddirs.h> #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 <ktar.h> #include <ktempfile.h> -#include <qfile.h> -#include <qstringlist.h> -#include <qdom.h> +#include <ntqfile.h> +#include <ntqstringlist.h> +#include <ntqdom.h> #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 <klocale.h> #include <kdebug.h> -#include <qfile.h> -#include <qregexp.h> -#include <qtextstream.h> -#include <qstringlist.h> +#include <ntqfile.h> +#include <ntqregexp.h> +#include <ntqtextstream.h> +#include <ntqstringlist.h> #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 <b>%1</b> " + addWarningMsg( TQString( i18n( "While loading recipe <b>%1</b> " "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: "<<string.stripWhiteSpace().mid(1,string.length())<<endl; ( *list.at( list.count() - 1 ) ).name += " " + string.stripWhiteSpace().mid( 1, string.length() ); - QString name = ( *list.at( list.count() - 1 ) ).name; + TQString name = ( *list.at( list.count() - 1 ) ).name; if ( name.endsWith(", or") ) { ( *list.at( list.count() - 1 ) ).name = name.left(name.length()-4); @@ -198,7 +198,7 @@ bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &lis //unit if ( !string.mid( 8, 2 ).stripWhiteSpace().isEmpty() ) { bool is_unit = false; - QString unit( string.mid( 8, 2 ).stripWhiteSpace() ); + TQString unit( string.mid( 8, 2 ).stripWhiteSpace() ); for ( int i = 0; unit_info[ i ].short_form; i++ ) { if ( unit_info[ i ].short_form == unit ) { is_unit = true; @@ -211,7 +211,7 @@ bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &lis } } if ( !is_unit ) { /*This gives too many false warnings... - addWarningMsg( QString(i18n("Unit \"%1\" not recognized. " + addWarningMsg( TQString(i18n("Unit \"%1\" not recognized. " "Used in the context of \"%2\". If this shouldn't be an ingredient line (i.e. is part of the instructions), " "then you can safely ignore this warning, and the recipe will be correctly imported.")).arg(unit).arg(string.stripWhiteSpace()) );*/ return false; @@ -230,7 +230,7 @@ bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &lis //name and preparation method new_ingredient.name = string.mid( 11, 41 ).stripWhiteSpace(); - //put in the header... it there is no header, current_header will be QString::null + //put in the header... it there is no header, current_header will be TQString::null new_ingredient.group = current_header; bool last_is_sub = is_sub; @@ -250,18 +250,18 @@ bool MMFImporter::loadIngredientLine( const QString &string, IngredientList &lis return true; } -bool MMFImporter::loadIngredientHeader( const QString &string ) +bool MMFImporter::loadIngredientHeader( const TQString &string ) { if ( ( string.startsWith( "-----" ) || string.startsWith( "MMMMM" ) ) && string.length() >= 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 <qstring.h> +#include <ntqstring.h> #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 <klocale.h> #include <kdebug.h> -#include <qfile.h> -#include <qstringlist.h> -#include <qtextstream.h> -#include <qdatetime.h> +#include <ntqfile.h> +#include <ntqstringlist.h> +#include <ntqtextstream.h> +#include <ntqdatetime.h> #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( "<?xml" ) ) all_data.remove( 0, all_data.find( "?>" ) + 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 <qdom.h> +#include <ntqdom.h> 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 <qfile.h> -#include <qtextstream.h> -#include <qstringlist.h> -#include <qdatetime.h> +#include <ntqfile.h> +#include <ntqtextstream.h> +#include <ntqstringlist.h> +#include <ntqdatetime.h> #include <kapplication.h> #include <klocale.h> @@ -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 *"<<endl; - QString current; + TQString current; // title stream.skipWhiteSpace(); @@ -83,7 +83,7 @@ void MXPImporter::importMXP( QTextStream &stream ) //kdDebug()<<"Found author: "<<new_author.name<<endl; } else { - addWarningMsg( QString( i18n( "While loading recipe \"%1\" " + addWarningMsg( TQString( i18n( "While loading recipe \"%1\" " "the field \"Recipe By:\" is either missing or could not be detected." ) ).arg( recipe.title ) ); } @@ -103,18 +103,18 @@ void MXPImporter::importMXP( QTextStream &stream ) //kdDebug()<<"Found serving size: "<<recipe.yield.amount<<endl; } else { - addWarningMsg( QString( i18n( "While loading recipe \"%1\" " + addWarningMsg( TQString( i18n( "While loading recipe \"%1\" " "the field \"Serving Size:\" is either missing or could not be detected." ) ).arg( recipe.title ) ); } if ( current.contains( "preparation time", FALSE ) ) { - QString prep_time = current.mid( current.find( ":", current.find( "preparation time", 0, FALSE ) ) + 1, + TQString prep_time = current.mid( current.find( ":", current.find( "preparation time", 0, FALSE ) ) + 1, current.length() ).stripWhiteSpace(); - recipe.prepTime = QTime( prep_time.section( ':', 0, 0 ).toInt(), prep_time.section( ':', 1, 1 ).toInt() ); + recipe.prepTime = TQTime( prep_time.section( ':', 0, 0 ).toInt(), prep_time.section( ':', 1, 1 ).toInt() ); kdDebug() << "Found preparation time: " << prep_time << endl; } else { - addWarningMsg( QString( i18n( "While loading recipe \"%1\" " + addWarningMsg( TQString( i18n( "While loading recipe \"%1\" " "the field \"Preparation Time:\" is either missing or could not be detected." ) ).arg( recipe.title ) ); } @@ -132,18 +132,18 @@ void MXPImporter::importMXP( QTextStream &stream ) } } -void MXPImporter::loadCategories( QTextStream &stream, Recipe &recipe ) +void MXPImporter::loadCategories( TQTextStream &stream, Recipe &recipe ) { //====================categories====================// stream.skipWhiteSpace(); - QString current = stream.readLine().stripWhiteSpace(); + TQString current = stream.readLine().stripWhiteSpace(); if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "categories" ) { - QString tmp_str = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString tmp_str = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); while ( current.stripWhiteSpace() != "Amount Measure Ingredient -- Preparation Method" && !stream.atEnd() ) { if ( !tmp_str.isEmpty() ) { - QStringList categories = QStringList::split( " ", tmp_str ); - for ( QStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { + TQStringList categories = TQStringList::split( " ", tmp_str ); + for ( TQStringList::const_iterator it = categories.begin(); it != categories.end(); ++it ) { Element new_cat( ( *it ).stripWhiteSpace() ); recipe.categoryList.append( new_cat ); @@ -158,7 +158,7 @@ void MXPImporter::loadCategories( QTextStream &stream, Recipe &recipe ) // kdDebug()<<"No categories found."<<endl; } else { - addWarningMsg( QString( i18n( "While loading recipe \"%1\" " + addWarningMsg( TQString( i18n( "While loading recipe \"%1\" " "the field \"Categories:\" is either missing or could not be detected." ) ).arg( recipe.title ) ); //the ingredient loaded will expect the last thing to have been read to be this header line @@ -167,25 +167,25 @@ void MXPImporter::loadCategories( QTextStream &stream, Recipe &recipe ) } } -void MXPImporter::loadIngredients( QTextStream &stream, Recipe &recipe ) +void MXPImporter::loadIngredients( TQTextStream &stream, Recipe &recipe ) { //============ingredients=================// stream.skipWhiteSpace(); ( void ) stream.readLine(); - QString current = stream.readLine(); + TQString current = stream.readLine(); if ( !current.contains( "NONE" ) && !current.isEmpty() ) { while ( !current.isEmpty() && !stream.atEnd() ) { Ingredient new_ingredient; //amount - QString amount_str = current.mid( 0, 9 ).simplifyWhiteSpace(); + TQString amount_str = current.mid( 0, 9 ).simplifyWhiteSpace(); if ( !amount_str.isEmpty() ) // case of amount_str.isEmpty() correctly handled by class default { bool ok; MixedNumber amount( MixedNumber::fromString( amount_str, &ok ) ); if ( !ok ) { - addWarningMsg( QString( i18n( "While loading recipe \"%1\" Invalid amount \"%2\" in the line \"%3\"" ) ).arg( recipe.title ).arg( amount_str ).arg( current.stripWhiteSpace() ) ); + addWarningMsg( TQString( i18n( "While loading recipe \"%1\" Invalid amount \"%2\" in the line \"%3\"" ) ).arg( recipe.title ).arg( amount_str ).arg( current.stripWhiteSpace() ) ); current = stream.readLine(); continue; } @@ -193,7 +193,7 @@ void MXPImporter::loadIngredients( QTextStream &stream, Recipe &recipe ) } //units - QString units( current.mid( 9, 13 ) ); + TQString units( current.mid( 9, 13 ) ); new_ingredient.units = Unit( units.simplifyWhiteSpace(), new_ingredient.amount ); //name @@ -205,7 +205,7 @@ void MXPImporter::loadIngredients( QTextStream &stream, Recipe &recipe ) else length = dash_index - 22; - QString ingredient_name( current.mid( 22, length ) ); + TQString ingredient_name( current.mid( 22, length ) ); new_ingredient.name = ingredient_name.stripWhiteSpace(); //prep method @@ -225,11 +225,11 @@ void MXPImporter::loadIngredients( QTextStream &stream, Recipe &recipe ) // kdDebug()<<"No ingredients found."<<endl; } -void MXPImporter::loadInstructions( QTextStream &stream, Recipe &recipe ) +void MXPImporter::loadInstructions( TQTextStream &stream, Recipe &recipe ) { //==========================instructions ( along with other optional fields... mxp format doesn't define end of ingredients and start of other fields )==============// stream.skipWhiteSpace(); - QString current = stream.readLine().stripWhiteSpace(); + TQString current = stream.readLine().stripWhiteSpace(); while ( !current.contains( "- - - -" ) && !stream.atEnd() ) { if ( current.stripWhiteSpace() == "Source:" ) { Element new_author( getNextQuotedString( stream ) ); @@ -237,12 +237,12 @@ void MXPImporter::loadInstructions( QTextStream &stream, Recipe &recipe ) //kdDebug()<<"Found source: "<<new_author.name<<" (adding as author)"<<endl; } else if ( current.stripWhiteSpace() == "Description:" ) { - QString description = getNextQuotedString( stream ); + TQString description = getNextQuotedString( stream ); //kdDebug()<<"Found description: "<<m_description<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nDescription: " + description; } else if ( current.stripWhiteSpace() == "S(Internet Address):" ) { - QString internet = getNextQuotedString( stream ); + TQString internet = getNextQuotedString( stream ); //kdDebug()<<"Found internet address: "<<m_internet<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nInternet address: " + internet; } @@ -269,51 +269,51 @@ void MXPImporter::loadInstructions( QTextStream &stream, Recipe &recipe ) //kdDebug()<<"Found instructions: "<<m_instructions<<endl; } -void MXPImporter::loadOptionalFields( QTextStream &stream, Recipe &recipe ) +void MXPImporter::loadOptionalFields( TQTextStream &stream, Recipe &recipe ) { //=================after here, fields are optional=========================// stream.skipWhiteSpace(); - QString current = stream.readLine().stripWhiteSpace(); + TQString current = stream.readLine().stripWhiteSpace(); - QString notes; + TQString notes; //Note: we simplifyWhiteSpace() because some versions of MasterCook have "Exported from MasterCook" and others have "Exported from MasterCook". // This also could work around a typo or such. while ( !current.simplifyWhiteSpace().contains( "Exported from MasterCook" ) && !stream.atEnd() ) { //suggested wine if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "suggested wine" ) { - QString wine = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString wine = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found suggested wine: "<<m_wine<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nSuggested wine: " + wine; } //Nutr. Assoc. if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "nutr. assoc." ) { - QString nutr_assoc = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString nutr_assoc = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found nutrient association: "<<nutr_assoc<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nNutrient Association: " + nutr_assoc; } else if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "per serving (excluding unknown items)" ) { //per serving... maybe we can do something with this info later - QString per_serving_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString per_serving_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found per serving (excluding unknown items): "<<per_serving_info<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nPer Serving (excluding unknown items): " + per_serving_info; } else if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "per serving" ) { //per serving... maybe we can do something with this info later - QString per_serving_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString per_serving_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found per serving: "<<per_serving_info<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nPer Serving: " + per_serving_info; } else if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "food exchanges" ) { //food exchanges... maybe we can do something with this info later - QString food_exchange_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString food_exchange_info = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found food exchanges: "<<food_exchange_info<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nFood Exchanges: " + food_exchange_info; } else if ( current.mid( 0, current.find( ":" ) ).simplifyWhiteSpace().lower() == "serving ideas" ) { //serving ideas - QString serving_ideas = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); + TQString serving_ideas = current.mid( current.find( ":" ) + 1, current.length() ).stripWhiteSpace(); //kdDebug()<<"Found serving ideas: "<<m_serving_ideas<<" (adding to end of instructions)"<<endl; recipe.instructions += "\n\nServing ideas: " + serving_ideas; @@ -342,28 +342,28 @@ void MXPImporter::loadOptionalFields( QTextStream &stream, Recipe &recipe ) */ if ( !notes.isNull() ) { - //kdDebug()<<QString("Found notes: %s (adding to end of instructions)").arg(m_notes)<<endl; + //kdDebug()<<TQString("Found notes: %s (adding to end of instructions)").arg(m_notes)<<endl; recipe.instructions += "\n\nNotes: " + notes.stripWhiteSpace(); } } -void MXPImporter::importGeneric( QTextStream & /*stream*/ ) +void MXPImporter::importGeneric( TQTextStream & /*stream*/ ) { setErrorMsg( i18n( "MasterCook's Generic Export format is currently not supported. Please write to [email protected] to request support for this format." ) ); //not even sure it this is worth writing... its rather obsolete } -void MXPImporter::importMac( QTextStream & /*stream*/ ) +void MXPImporter::importMac( TQTextStream & /*stream*/ ) { setErrorMsg( i18n( "MasterCook Mac's Export format is currently not supported. Please write to [email protected] to request support for this format." ) ); //not even sure it this is worth writing... its rather obsolete } -QString MXPImporter::getNextQuotedString( QTextStream &stream ) +TQString MXPImporter::getNextQuotedString( TQTextStream &stream ) { stream.skipWhiteSpace(); - QString current = stream.readLine().stripWhiteSpace(); - QString return_str; + TQString current = stream.readLine().stripWhiteSpace(); + TQString return_str; if ( current.left( 1 ) == "\"" ) return_str = current.mid( 1, current.length() - 1 ); diff --git a/krecipes/src/importers/mxpimporter.h b/krecipes/src/importers/mxpimporter.h index d45a091..b5d37bd 100644 --- a/krecipes/src/importers/mxpimporter.h +++ b/krecipes/src/importers/mxpimporter.h @@ -11,7 +11,7 @@ #ifndef MXPIMPORTER_H #define MXPIMPORTER_H -#include <qstring.h> +#include <ntqstring.h> #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 <klocale.h> #include <kdebug.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qstringlist.h> -#include <qregexp.h> +#include <ntqfile.h> +#include <ntqtextstream.h> +#include <ntqstringlist.h> +#include <ntqregexp.h> #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 <qstring.h> -#include <qdatetime.h> +#include <ntqstring.h> +#include <ntqdatetime.h> #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 <qfile.h> -#include <qdatetime.h> +#include <ntqfile.h> +#include <ntqdatetime.h> #include <klocale.h> #include <kdebug.h> @@ -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 <directions>: " << 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 <preptime>: " << 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 <qdom.h> +#include <ntqdom.h> /** 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 <klocale.h> #include <kdebug.h> -#include <qfile.h> -#include <qregexp.h> -#include <qtextstream.h> +#include <ntqfile.h> +#include <ntqregexp.h> +#include <ntqtextstream.h> #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 <qstringlist.h> +#include <ntqstringlist.h> #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 <kdebug.h> -#include <qdom.h> -#include <qfile.h> -#include <qstringlist.h> +#include <ntqdom.h> +#include <ntqfile.h> +#include <ntqstringlist.h> 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 <qdom.h> -#include <qfont.h> +#include <ntqdom.h> +#include <ntqfont.h> #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 <qdragobject.h> +#include <ntqdragobject.h> #include <kprinter.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qmessagebox.h> +#include <ntqpainter.h> +#include <ntqpaintdevicemetrics.h> +#include <ntqmessagebox.h> #include <kprogress.h> #include <kmessagebox.h> @@ -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.<br><br>" ) ) + 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.<br><br>" ) ) + 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("<b>Restoring this file will erase ALL data currently in the database!</b><br /><br />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.<br /><br />Are you sure you want to proceed?"),QString::null,KStdGuiItem::cont(),"RestoreWarning") ) { + switch ( KMessageBox::warningContinueCancel(this,i18n("<b>Restoring this file will erase ALL data currently in the database!</b><br /><br />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.<br /><br />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<int> ids = dlg.matches(); - QString name = dlg.element(); + if ( dlg.exec() == TQDialog::Accepted ) { + TQValueList<int> 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<int>::const_iterator it = ids.begin(); it != ids.end(); ++it ) { + for ( TQValueList<int>::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<int> ids = dlg.matches(); - QString name = dlg.element(); + if ( dlg.exec() == TQDialog::Accepted ) { + TQValueList<int> 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<int>::const_iterator it = ids.begin(); it != ids.end(); ++it ) { + for ( TQValueList<int>::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<KAction*> recipe_actions; + TQValueList<KAction*> 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 <dcopobject.h> #include <dcopref.h> -#include <qvaluelist.h> +#include <ntqvaluelist.h> 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<int> &ids ) = 0; + virtual void exportRecipes( const TQValueList<int> &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 <cstdlib> -#include <qlayout.h> -#include <qimage.h> -#include <qpainter.h> -#include <qpalette.h> +#include <ntqlayout.h> +#include <ntqimage.h> +#include <ntqpainter.h> +#include <ntqpalette.h> #include <kapplication.h> #include <kconfig.h> @@ -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<KreMenuButton>(); + buttonsList = new TQPtrList<KreMenuButton>(); 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>&, int ) ), this, SLOT( actionRecipes( const QValueList<int>&, int ) ) ); + connect ( selectPanel, SIGNAL( recipesSelected( const TQValueList<int>&, int ) ), this, SLOT( actionRecipes( const TQValueList<int>&, 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<int> ids = viewPanel->currentRecipes(); + TQValueList<int> ids = viewPanel->currentRecipes(); RecipeActionsHandler::recipesToClipboard( ids, database ); } else if ( vis_panel == selectPanel ) { @@ -436,7 +436,7 @@ void KrecipesView::exportToClipboard() } } -void KrecipesView::exportRecipes( const QValueList<int> &ids ) +void KrecipesView::exportRecipes( const TQValueList<int> &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<int> &ids, int action ) +void KrecipesView::actionRecipes( const TQValueList<int> &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<int> ids; + TQValueList<int> ids; ids << recipeID; showRecipes( ids ); } -void KrecipesView::showRecipes( const QValueList<int> &recipeIDs ) +void KrecipesView::showRecipes( const TQValueList<int> &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 <qbitmap.h> -#include <qbuttongroup.h> -#include <qevent.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qtooltip.h> -#include <qhbox.h> -#include <qvaluelist.h> -#include <qvbox.h> -#include <qwidget.h> -#include <qwidgetstack.h> +#include <ntqbitmap.h> +#include <ntqbuttongroup.h> +#include <ntqevent.h> +#include <ntqlabel.h> +#include <ntqpushbutton.h> +#include <ntqtooltip.h> +#include <ntqhbox.h> +#include <ntqvaluelist.h> +#include <ntqvbox.h> +#include <ntqwidget.h> +#include <ntqwidgetstack.h> #include <kiconloader.h> #include <kpixmap.h> @@ -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 <Menu>::Iterator MenuId; +typedef TQValueList <Menu>::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<int> &ids ); + void exportRecipes( const TQValueList<int> &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<KreMenuButton> *buttonsList; + TQPtrList<KreMenuButton> *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<QWidget*, KrePanel> panelMap; + TQMap<TQWidget*, KrePanel> panelMap; // i18n void translate(); @@ -196,18 +196,18 @@ public slots: private slots: void actionRecipe( int recipeID, int action ); - void actionRecipes( const QValueList<int> &ids, int action ); - void addRecipeButton( QWidget *w, const QString &title ); + void actionRecipes( const TQValueList<int> &ids, int action ); + void addRecipeButton( TQWidget *w, const TQString &title ); void closeRecipe( void ); void showRecipe( int recipeID ); - void showRecipes( const QValueList<int> &recipeIDs ); - void slotSetTitle( const QString& title ); + void showRecipes( const TQValueList<int> &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 <kdebug.h> #include <kglobal.h> -#include <qdom.h> +#include <ntqdom.h> #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 <qstringlist.h> +#include <ntqstringlist.h> -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 <kconfig.h> #include <kglobal.h> -#include <qcursor.h> +#include <ntqcursor.h> -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 <qwidget.h> +#include <ntqwidget.h> #include <kapplication.h> #include <kstandarddirs.h> @@ -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 <qlayout.h> -#include <qlabel.h> -#include <qhbox.h> -#include <qbuttongroup.h> -#include <qcheckbox.h> -#include <qradiobutton.h> -#include <qpushbutton.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qframe.h> -#include <qcombobox.h> +#include <ntqlayout.h> +#include <ntqlabel.h> +#include <ntqhbox.h> +#include <ntqbuttongroup.h> +#include <ntqcheckbox.h> +#include <ntqradiobutton.h> +#include <ntqpushbutton.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqframe.h> +#include <ntqcombobox.h> #include <kapplication.h> #include <kconfig.h> @@ -41,41 +41,41 @@ #include <kurlrequester.h> #include <kdebug.h> -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<br>" + ( void ) new TQLabel( i18n( "%n: Name<br>" "%p: Preparation method<br>" "%a: Amount<br>" "%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 <b>allow Krecipes to better perform when the database is loaded with many thousands of recipes</b>."), 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 <b>allow Krecipes to better perform when the database is loaded with many thousands of recipes</b>."), 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 <kdialogbase.h> -#include <qmap.h> +#include <ntqmap.h> 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<int,QString> m_helpMap; + TQMap<int,TQString> 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 <qdatetime.h> + #include <ntqdatetime.h> #include <kdebug.h> - static QTime dbg_timer; + static TQTime dbg_timer; #define START_TIMER(MSG) \ dbg_timer.start(); kdDebug()<<MSG<<endl; diff --git a/krecipes/src/propertycalculator.cpp b/krecipes/src/propertycalculator.cpp index 3b4285e..8310b14 100644 --- a/krecipes/src/propertycalculator.cpp +++ b/krecipes/src/propertycalculator.cpp @@ -64,7 +64,7 @@ void calculateProperties( Recipe& recipe, RecipeDB* database ) void addPropertyToList( RecipeDB *database, IngredientPropertyList *recipePropertyList, IngredientPropertyList &ingPropertyList, const Ingredient &ing, int ingredientNo ) { - QMap<int,double> ratioCache; //unit->ratio + TQMap<int,double> 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<int,double>::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); + TQMap<int,double>::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<int,double>::const_iterator cache_it = ratioCache.find((*prop_it).perUnit.id); + TQMap<int,double>::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 <qwidget.h> -#include <qclipboard.h> +#include <ntqwidget.h> +#include <ntqclipboard.h> #include <kapplication.h> #include <kfiledialog.h> @@ -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<int> RecipeActionsHandler::recipeIDs( const QPtrList<QListViewItem> &items ) const +TQValueList<int> RecipeActionsHandler::recipeIDs( const TQPtrList<TQListViewItem> &items ) const { - QValueList<int> ids; + TQValueList<int> ids; - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> it(items); + TQListViewItem *item; while ( (item = it.current()) != 0 ) { if ( item->rtti() == 1000 ) { //RecipeListItem RecipeListItem * recipe_it = ( RecipeListItem* ) item; @@ -139,9 +139,9 @@ QValueList<int> RecipeActionsHandler::recipeIDs( const QPtrList<QListViewItem> & void RecipeActionsHandler::open() { - QPtrList<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList<int> ids = recipeIDs(items); + TQValueList<int> 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<int> ids; + TQValueList<int> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> 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<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList<int> ids = recipeIDs( items ); + TQValueList<int> 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<int> ids = getAllVisibleItems(); + TQValueList<int> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> 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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QPtrListIterator<QListViewItem> it(items); - QListViewItem *item; + TQPtrListIterator<TQListViewItem> 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<int> ids; + TQValueList<int> ids; ids.append( id ); exportRecipes( ids, caption, selection, db ); } -void RecipeActionsHandler::exportRecipes( const QValueList<int> &ids, const QString & caption, const QString &selection, RecipeDB *database ) +void RecipeActionsHandler::exportRecipes( const TQValueList<int> &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<int> &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<int> &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<int> &ids, const QStr delete fd; } -void RecipeActionsHandler::recipesToClipboard( const QValueList<int> &ids, RecipeDB *db ) +void RecipeActionsHandler::recipesToClipboard( const TQValueList<int> &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<QListViewItem> items = parentListView->selectedItems(); + TQPtrList<TQListViewItem> items = parentListView->selectedItems(); if ( items.count() > 0 ) { - QValueList<int> ids = recipeIDs( items ); + TQValueList<int> ids = recipeIDs( items ); recipesToClipboard(ids,database); } } -QValueList<int> RecipeActionsHandler::getAllVisibleItems() +TQValueList<int> RecipeActionsHandler::getAllVisibleItems() { - QValueList<int> ids; + TQValueList<int> 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 <qobject.h> -#include <qvaluelist.h> -#include <qptrlist.h> +#include <ntqobject.h> +#include <ntqvaluelist.h> +#include <ntqptrlist.h> -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<int> &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<int> &ids, RecipeDB *db ); + static void exportRecipes( const TQValueList<int> &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<int> &ids, RecipeDB *db ); signals: void recipeSelected( int id, int action ); - void recipesSelected( const QValueList<int> &ids, int action ); + void recipesSelected( const TQValueList<int> &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<int> getAllVisibleItems(); - QValueList<int> recipeIDs( const QPtrList<QListViewItem> &items ) const; + TQValueList<int> getAllVisibleItems(); + TQValueList<int> recipeIDs( const TQPtrList<TQListViewItem> &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 <qobject.h> +#include <ntqobject.h> 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 <unistd.h> #include <pwd.h> -#include <qhbox.h> -#include <qvgroupbox.h> -#include <qlayout.h> -#include <qpixmap.h> -#include <qpushbutton.h> -#include <qtooltip.h> +#include <ntqhbox.h> +#include <ntqvgroupbox.h> +#include <ntqlayout.h> +#include <ntqpixmap.h> +#include <ntqpushbutton.h> +#include <ntqtooltip.h> #include <kconfig.h> #include <kdebug.h> @@ -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( "<b><font size=\"+1\">Thank you very much for choosing Krecipes.</font></b><br>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.<br><br>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.<br><br><b><font size=\"+1\">Most users that use Krecipes and MySQL for the first time can just leave the default parameters and press \'Next\'.</font></b> <br><br>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.<br><br>[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 <i>your_password</i>]" ) ); - 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 <b>PostgreSQL superuser</b> or have the ability to both <b>create new PostgreSQL users and databases</b>.<br><br>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 <b>must</b> 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.<br><br><b>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.</b>" ) ); - 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. <br><br>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.<br><br>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.<br><br>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 <qvbuttongroup.h> -#include <qcheckbox.h> -#include <qradiobutton.h> -#include <qlabel.h> +#include <ntqvbuttongroup.h> +#include <ntqcheckbox.h> +#include <ntqradiobutton.h> +#include <ntqlabel.h> #include <kwizard.h> #include <klineedit.h> #include <ktextedit.h> @@ -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 <cmath> #include <iostream> -#include <qstring.h> -#include <qpixmap.h> -#include <qimage.h> +#include <ntqstring.h> +#include <ntqpixmap.h> +#include <ntqimage.h> #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<IngredientData>::const_iterator base_sub_it = (*base_ing_it).substitutes.begin(); - for ( QValueList<IngredientData>::const_iterator sub_it = (*ing_it).substitutes.begin(); sub_it != (*ing_it).substitutes.end(); ++sub_it, ++base_sub_it ) { + TQValueList<IngredientData>::const_iterator base_sub_it = (*base_ing_it).substitutes.begin(); + for ( TQValueList<IngredientData>::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 <cmath> #include <iostream> -#include <qstring.h> -#include <qfile.h> -#include <qtextstream.h> +#include <ntqstring.h> +#include <ntqfile.h> +#include <ntqtextstream.h> #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 <cmath> #include <iostream> -#include <qstring.h> +#include <ntqstring.h> #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 <kapplication.h> -#include <qstring.h> -#include <qfile.h> +#include <ntqstring.h> +#include <ntqfile.h> #include <iostream> @@ -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]]>< <unit>tsp.</unit> </ingredient> </ingredient-group> -<ingredient-group name="Fat & Liquids"> +<ingredient-group name="Fat & Litquids"> <ingredient> <name>shortening</name> <amount>1</amount> @@ -336,7 +336,7 @@ iT/nkv50f2xJ/wA8l/Oiijkj2C7F/th/+eS/nR/a7n/lkv50UUKEewXZmtJudjtHJooorexkf//Z]]>< <unit>tsp.</unit> </ingredient> </ingredient-group> -<ingredient-group name="Fat & Liquids"> +<ingredient-group name="Fat & Litquids"> <ingredient> <name>shortening</name> <amount>1</amount> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 @@ </ing> </ing-div> <ing-div> - <title>Fat & Liquids</title> + <title>Fat & Litquids</title> <ing> <amt> <qty>1</qty> @@ -186,7 +186,7 @@ </ing> </ing-div> <ing-div> - <title>Fat & Liquids</title> + <title>Fat & Litquids</title> <ing> <amt> <qty>1</qty> 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 <kapplication.h> -#include <qstring.h> +#include <ntqstring.h> #include <iostream> 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 <qheader.h> -#include <qlistview.h> +#include <ntqheader.h> +#include <ntqlistview.h> #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 <qhbox.h> +#include <ntqhbox.h> #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<Element>::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<Element>::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<Element> selections() const{ return m_selections; } + TQValueList<Element> 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<Element> m_selections; + TQValueList<Element> 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 <qlistbox.h> +#include <ntqlistbox.h> #include <klocale.h> #include <kconfig.h> @@ -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<int, int> new_map; - for ( QMap<int, int>::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + for ( TQMap<int, int>::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<int, int> new_map; - for ( QMap<int, int>::iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::const_iterator it = categoryComboRows.begin(); it != categoryComboRows.end(); ++it ) { + for ( TQMap<int, int>::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 <kcombobox.h> -#include <qmap.h> +#include <ntqmap.h> #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<int, int> categoryComboRows; // Contains the category id for every given row in the category combobox + TQMap<int, int> 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<CategoryItemInfo*>(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<int,QListViewItem*>::iterator item_it = items_map.find(id); + TQMap<int,TQListViewItem*>::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<int,QListViewItem*>::iterator parent_item_it = items_map.find(parent_id); + TQMap<int,TQListViewItem*>::iterator parent_item_it = items_map.find(parent_id); if ( parent_item_it != items_map.end() && dynamic_cast<CategoryItemInfo*>(*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<CategoryItemInfo*>(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<Element>::const_iterator it = m_selections.begin(); it != m_selections.end(); ++it ) { - QCheckListItem * item = ( QCheckListItem* ) findItem( QString::number( (*it).id ), 1 ); + for ( TQValueList<Element>::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 <qmap.h> -#include <qpixmap.h> +#include <ntqmap.h> +#include <ntqpixmap.h> #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<int, QListViewItem*> items_map; + TQMap<int, TQListViewItem*> 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 <qtooltip.h> +#include <ntqtooltip.h> #include <kglobal.h> #include <klocale.h> -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<QTableItem> tmpContents; + TQPtrVector<TQTableItem> tmpContents; tmpContents.resize( numCols() ); - QPtrVector<QWidget> tmpWidgets; + TQPtrVector<TQWidget> 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<QTableItem> tmpContents; + TQPtrVector<TQTableItem> tmpContents; tmpContents.resize( numRows() ); - QPtrVector<QWidget> tmpWidgets; + TQPtrVector<TQWidget> 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 <qstring.h> -#include <qtable.h> -#include <qobject.h> +#include <ntqstring.h> +#include <ntqtable.h> +#include <ntqobject.h> #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<QTableItem> items; - QIntDict<QWidget> widgets; + TQIntDict<TQTableItem> items; + TQIntDict<TQWidget> 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 <qlistbox.h> +#include <ntqlistbox.h> #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 <qmap.h> +#include <ntqmap.h> #include <kcombobox.h> @@ -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<QListViewItem*,QListViewItem*>::iterator map_it = lastElementMap.find(it->parent()); + TQListViewItem *lastElement; + TQMap<TQListViewItem*,TQListViewItem*>::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 <qobject.h> -#include <qmap.h> +#include <ntqobject.h> +#include <ntqmap.h> #include <klistview.h> @@ -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<QListViewItem*,QListViewItem*> lastElementMap; - QListViewItem *delete_me_later; + TQMap<TQListViewItem*,TQListViewItem*> 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 <qtimer.h> +#include <ntqtimer.h> #include <kglobalsettings.h> #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 <qlistbox.h> +#include <ntqlistbox.h> #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 "<<m_ing.name<<endl; - return QString("%1 ").arg(i18n("OR"))+m_ing.name; + return TQString("%1 ").arg(i18n("OR"))+m_ing.name; //return m_ing.name; } else @@ -34,11 +34,11 @@ QString IngSubListViewItem::text( int column ) const } -void IngSubListViewItem::setText( int column, const QString &text ) +void IngSubListViewItem::setText( int column, const TQString &text ) { switch ( column ) { case 0: { - QString compare = QString("%1 ").arg(i18n("OR")); + TQString compare = TQString("%1 ").arg(i18n("OR")); if ( text.left(compare.length()) == compare ) m_ing.name = text.right(text.length()-compare.length()); else @@ -57,17 +57,17 @@ int IngSubListViewItem::rtti() const } -IngListViewItem::IngListViewItem( QListView* qlv, const Ingredient &i ) : QListViewItem( qlv ) +IngListViewItem::IngListViewItem( TQListView* qlv, const Ingredient &i ) : TQListViewItem( qlv ) { init( i ); } -IngListViewItem::IngListViewItem( QListView* qlv, QListViewItem *after, const Ingredient &i ) : QListViewItem( qlv, after ) +IngListViewItem::IngListViewItem( TQListView* qlv, TQListViewItem *after, const Ingredient &i ) : TQListViewItem( qlv, after ) { init( i ); } -IngListViewItem::IngListViewItem( QListViewItem* qli, QListViewItem *after, const Ingredient &i ) : QListViewItem( qli, after ) +IngListViewItem::IngListViewItem( TQListViewItem* qli, TQListViewItem *after, const Ingredient &i ) : TQListViewItem( qli, after ) { init( i ); } @@ -84,7 +84,7 @@ Ingredient IngListViewItem::ingredient() const void IngListViewItem::setAmount( double amount, double amount_offset ) { - amount_str = QString::null; + amount_str = TQString::null; if ( amount > 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 <qlistbox.h> -#include <qtimer.h> +#include <ntqlistbox.h> +#include <ntqtimer.h> #include <kdebug.h> #include <kapplication.h> @@ -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<int, int> new_map; - for ( QMap<int, int>::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + for ( TQMap<int, int>::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<int, int> new_map; - for ( QMap<int, int>::iterator it = ingredientComboRows.begin(); it != ingredientComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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 <kcombobox.h> -#include <qmap.h> +#include <ntqmap.h> #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<int, int> ingredientComboRows; // Contains the category id for every given row in the category combobox + TQMap<int, int> 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 <qlabel.h> -#include <qwidgetstack.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qgroupbox.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qcheckbox.h> +#include <ntqlabel.h> +#include <ntqwidgetstack.h> +#include <ntqhbox.h> +#include <ntqvbox.h> +#include <ntqgroupbox.h> +#include <ntqbuttongroup.h> +#include <ntqradiobutton.h> +#include <ntqcheckbox.h> #include <kcombobox.h> #include <klocale.h> @@ -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<IngredientInput*>::iterator curr = m_ingInputs.find(input); + TQValueList<IngredientInput*>::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<IngredientInput*>::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { + for ( TQValueList<IngredientInput*>::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { if ( !(*it)->isInputValid() ) return; } - QValueList<IngredientData> list; - for ( QValueList<IngredientInput*>::const_iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) { + TQValueList<IngredientData> list; + for ( TQValueList<IngredientInput*>::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<int> prepIDs = createNewPrepIfNecessary( ing.prepMethodList,database ); - QValueList<int>::const_iterator id_it = prepIDs.begin(); + TQValueList<int> prepIDs = createNewPrepIfNecessary( ing.prepMethodList,database ); + TQValueList<int>::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<int> IngredientInputWidget::createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *database ) +TQValueList<int> IngredientInputWidget::createNewPrepIfNecessary( const ElementList &prepMethods, RecipeDB *database ) { - QValueList<int> ids; + TQValueList<int> ids; if ( prepMethods.isEmpty() ) //no prep methods return ids; @@ -516,7 +516,7 @@ QValueList<int> 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<IngredientInput*>::iterator it = m_ingInputs.begin(); it != m_ingInputs.end(); ++it ) + for ( TQValueList<IngredientInput*>::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 <qvbox.h> +#include <ntqvbox.h> #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<int> 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<int> 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<IngredientInput*> m_ingInputs; + TQValueList<IngredientInput*> 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<Element>::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<Element>::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<Element> selections() const{ return m_selections; } + TQValueList<Element> 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<Element> m_selections; + TQValueList<Element> 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 <qapplication.h> -#include <qlineedit.h> -#include <qlistbox.h> -#include <qvalidator.h> +#include <ntqapplication.h> +#include <ntqlineedit.h> +#include <ntqlistbox.h> +#include <ntqvalidator.h> //#include <kcalendarsystem.h> #include <kglobal.h> @@ -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 <qcombobox.h> -#include <qdatetime.h> -#include <qmap.h> +#include <ntqcombobox.h> +#include <ntqdatetime.h> +#include <ntqmap.h> #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 <[email protected]> @author Tobias Koenig <[email protected]> */ -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<QString, int> mKeywordMap; + TQMap<TQString, int> 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 <qdatetime.h> -#include <qpopupmenu.h> +#include <ntqdatetime.h> +#include <ntqpopupmenu.h> #include <klocale.h> #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 <qdatetime.h> -#include <qpopupmenu.h> +#include <ntqdatetime.h> +#include <ntqpopupmenu.h> #include <kdatepicker.h> /** @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 <[email protected]> */ -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 <qlabel.h> -#include <qvbox.h> +#include <ntqlabel.h> +#include <ntqvbox.h> #include <klistview.h> #include <klineedit.h> @@ -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 <qbitmap.h> -#include <qcursor.h> -#include <qfont.h> -#include <qimage.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qsignalmapper.h> +#include <ntqbitmap.h> +#include <ntqcursor.h> +#include <ntqfont.h> +#include <ntqimage.h> +#include <ntqobjectlist.h> +#include <ntqpainter.h> +#include <ntqpixmap.h> +#include <ntqsignalmapper.h> #include <kapplication.h> #include <kcursor.h> @@ -30,11 +30,11 @@ #include <kpixmap.h> #include <kpixmapeffect.h> -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 <int, KreMenuButton*> &destMap, const QMap <int, KreMenuButton*> &origMap ) +void Menu::copyMap( TQMap <int, KreMenuButton*> &destMap, const TQMap <int, KreMenuButton*> &origMap ) { - QMap<int, KreMenuButton*>::ConstIterator it; + TQMap<int, KreMenuButton*>::ConstIterator it; destMap.clear(); for ( it = origMap.begin(); it != origMap.end(); ++it ) { destMap[ it.key() ] = it.data(); } } -void Menu::copyMap( QMap <KreMenuButton*, int> &destMap, const QMap <KreMenuButton*, int> &origMap ) +void Menu::copyMap( TQMap <KreMenuButton*, int> &destMap, const TQMap <KreMenuButton*, int> &origMap ) { - QMap<KreMenuButton*, int>::ConstIterator it; + TQMap<KreMenuButton*, int>::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 <qbuttongroup.h> -#include <qevent.h> -#include <qiconset.h> -#include <qmap.h> -#include <qpushbutton.h> -#include <qstring.h> +#include <ntqbuttongroup.h> +#include <ntqevent.h> +#include <ntqiconset.h> +#include <ntqmap.h> +#include <ntqpushbutton.h> +#include <ntqstring.h> #include "krecipesview.h" //for KrePanel enum @@ -30,7 +30,7 @@ class Menu; class KreMenu; class KreMenuButton; -typedef QValueList <Menu>::Iterator MenuId; +typedef TQValueList <Menu>::Iterator MenuId; class Menu @@ -46,26 +46,26 @@ public: // Variables - QMap <KreMenuButton*, int> positionList; // Stores the indexes for the widgets - QMap <int, KreMenuButton*> widgetList; // Stores the widgets for each position (just the inverse mapping) + TQMap <KreMenuButton*, int> positionList; // Stores the indexes for the widgets + TQMap <int, KreMenuButton*> 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 <int, KreMenuButton*> &destMap, const QMap <int, KreMenuButton*> &origMap ); - void copyMap( QMap <KreMenuButton*, int> &destMap, const QMap <KreMenuButton*, int> &origMap ); + void copyMap( TQMap <int, KreMenuButton*> &destMap, const TQMap <int, KreMenuButton*> &origMap ); + void copyMap( TQMap <KreMenuButton*, int> &destMap, const TQMap <KreMenuButton*, int> &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 <Menu> menus; + TQValueList <Menu> 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 <kglobalsettings.h> #include <kdebug.h> #include <kiconloader.h> -#include <qcursor.h> -#include <qpainter.h> -#include <qpopupmenu.h> -#include <qtooltip.h> +#include <ntqcursor.h> +#include <ntqpainter.h> +#include <ntqpopupmenu.h> +#include <ntqtooltip.h> #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<KoUnit::Unit>( 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 <qframe.h> -#include <qpixmap.h> +#include <ntqframe.h> +#include <ntqpixmap.h> #include <kdemacros.h> @@ -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<KoTabulator> KoTabulatorList; +typedef TQValueList<KoTabulator> 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<unsigned int>(qRound(m_zoom*value)); + return static_cast<unsigned int>(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<unsigned int>(qRound(value*m_1_zoom)); + return static_cast<unsigned int>(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 <qtextstream.h> +#include <ntqtextstream.h> #include <kaccel.h> #include <kdebug.h> -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 <kdebug.h> #include <kglobalsettings.h> -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 "<<index<<endl; return; } /* if(index == selected()) @@ -195,14 +195,14 @@ void KWidgetListbox::showItems(show_callback func, void* data) updateColors(); } -void KWidgetListbox::showEvent(QShowEvent*) +void KWidgetListbox::showEvent(TQShowEvent*) { //kdDebug() << k_funcinfo << endl; repaintContents(false); } -void KWidgetListbox::paintCell(QPainter*, int, int, const QRect&, - bool, const QColorGroup&) +void KWidgetListbox::paintCell(TQPainter*, int, int, const TQRect&, + bool, const TQColorGroup&) { //kdDebug() << k_funcinfo << endl; } diff --git a/krecipes/src/widgets/kwidgetlistbox.h b/krecipes/src/widgets/kwidgetlistbox.h index d97f0bf..b20a008 100644 --- a/krecipes/src/widgets/kwidgetlistbox.h +++ b/krecipes/src/widgets/kwidgetlistbox.h @@ -23,43 +23,43 @@ #ifndef KWIDGETLISTBOX_H #define KWIDGETLISTBOX_H -#include <qtable.h> +#include <ntqtable.h> /** @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 <qpainter.h> -#include <qpoint.h> -#include <qrect.h> +#include <ntqpainter.h> +#include <ntqpoint.h> +#include <ntqrect.h> #include <kiconloader.h> #include <kpixmap.h> @@ -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 <qevent.h> -#include <qiconset.h> -#include <qstring.h> -#include <qhbox.h> -#include <qpixmap.h> -#include <qvbox.h> -#include <qwidget.h> -#include <qwidgetstack.h> +#include <ntqevent.h> +#include <ntqiconset.h> +#include <ntqstring.h> +#include <ntqhbox.h> +#include <ntqpixmap.h> +#include <ntqvbox.h> +#include <ntqwidget.h> +#include <ntqwidgetstack.h> /** @@ -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 <qlistbox.h> +#include <ntqlistbox.h> #include <kdebug.h> @@ -26,11 +26,11 @@ public: PrepMethodCompletion() : KCompletion() {} - virtual QString makeCompletion( const QString &string ) { + virtual TQString makeCompletion( const TQString &string ) { kdDebug()<<"original makeCompletion( "<<string<<" )"<<endl; int comma_index = string.findRev(","); - QString completion_txt = string; + TQString completion_txt = string; if ( comma_index != -1 ) completion_txt = completion_txt.right( completion_txt.length() - comma_index - 1 ).stripWhiteSpace(); if ( completion_txt.isEmpty() ) @@ -51,7 +51,7 @@ public: } }; -PrepMethodComboBox::PrepMethodComboBox( bool b, QWidget *parent, RecipeDB *db, const QString &specialItem ) : +PrepMethodComboBox::PrepMethodComboBox( bool b, TQWidget *parent, RecipeDB *db, const TQString &specialItem ) : KComboBox( b, parent ), database( db ), m_specialItem(specialItem) { @@ -61,7 +61,7 @@ PrepMethodComboBox::PrepMethodComboBox( bool b, QWidget *parent, RecipeDB *db, c void PrepMethodComboBox::reload() { - QString remember_text; + TQString remember_text; if ( editable() ) remember_text = lineEdit()->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<int, int> new_map; - for ( QMap<int, int>::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + for ( TQMap<int, int>::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<int, int> new_map; - for ( QMap<int, int>::iterator it = prepMethodComboRows.begin(); it != prepMethodComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::const_iterator it; + TQMap<int, int>::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 <kcombobox.h> -#include <qmap.h> +#include <ntqmap.h> #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<int, int> prepMethodComboRows; // Contains the prep method id for every given row in the combobox - QString m_specialItem; + TQMap<int, int> 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 @@ <!DOCTYPE UI><UI version="3.1" stdsetdef="1"> <class>RatingDisplayWidget</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>RatingDisplayWidget</cstring> </property> @@ -23,7 +23,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>layout4</cstring> </property> @@ -48,7 +48,7 @@ </size> </property> </spacer> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>icon</cstring> </property> @@ -84,7 +84,7 @@ </spacer> </vbox> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>layout5</cstring> </property> @@ -92,7 +92,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>raterName</cstring> </property> @@ -151,7 +151,7 @@ <enum>NoSelection</enum> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>comment</cstring> </property> @@ -170,7 +170,7 @@ <set>WordBreak|AlignTop</set> </property> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>layout4</cstring> </property> 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 <kiconloader.h> #include <kdebug.h> -#include <qintdict.h> -#include <qlayout.h> +#include <ntqintdict.h> +#include <ntqlayout.h> namespace { static const int RATING_WIDGET_MAX_STAR_SIZE = 24; } -const QPixmap& RatingWidget::pixmap(const QString& value_) { - static QIntDict<QPixmap> pixmaps; +const TQPixmap& RatingWidget::pixmap(const TQString& value_) { + static TQIntDict<TQPixmap> 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<QBoxLayout*>(layout()); + TQBoxLayout* l = dynamic_cast<TQBoxLayout*>(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<QLabel*>(child)); + idx = m_widgets.findRef(static_cast<TQLabel*>(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 <qhbox.h> -#include <qptrlist.h> -#include <qlabel.h> -#include <qpixmap.h> -#include <qstringlist.h> +#include <ntqhbox.h> +#include <ntqptrlist.h> +#include <ntqlabel.h> +#include <ntqpixmap.h> +#include <ntqstringlist.h> /** * @author Robby Stephenson */ -class RatingWidget : public QHBox { +class RatingWidget : public TQHBox { Q_OBJECT -typedef QPtrList<QLabel> LabelList; +typedef TQPtrList<TQLabel> 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 <qintdict.h> -#include <qdatastream.h> -#include <qtooltip.h> +#include <ntqintdict.h> +#include <ntqdatastream.h> +#include <ntqtooltip.h> #include <kapplication.h> #include <kdebug.h> @@ -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<RecipeListItem*>( 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("<center><b>%7</b></center><center>__________</center>%1 %2<br />%3 %4<br />%5 %6") + return TQString("<center><b>%7</b></center><center>__________</center>%1 %2<br />%3 %4<br />%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("<b>%1</b><hr />%2: %3") + return TQString("<b>%1</b><hr />%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<CategoryItemInfo*>(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<CategoryItemInfo*>(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 <qdragobject.h> +#include <ntqdragobject.h> #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 <qlistbox.h> +#include <ntqlistbox.h> #include <klocale.h> #include <kconfig.h> @@ -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<int, int>::const_iterator it; + TQMap<int, int>::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<int, int> new_map; - for ( QMap<int, int>::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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<int, int>::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + for ( TQMap<int, int>::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<int, int> new_map; - for ( QMap<int, int>::iterator it = unitComboRows.begin(); it != unitComboRows.end(); ++it ) { + TQMap<int, int> new_map; + for ( TQMap<int, int>::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 <kcombobox.h> -#include <qmap.h> +#include <ntqmap.h> #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<int, int> unitComboRows; // Contains the unit id for every given row in the unit combobox + TQMap<int, int> 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 <qcombobox.h> -#include <qheader.h> +#include <ntqcombobox.h> +#include <ntqheader.h> #include <kmessagebox.h> #include <kconfig.h> @@ -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<ListInfo> lists; + TQValueList<ListInfo> 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 & ); |