summaryrefslogtreecommitdiffstats
path: root/krecipes/src/exporters/rezkonvexporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krecipes/src/exporters/rezkonvexporter.cpp')
-rw-r--r--krecipes/src/exporters/rezkonvexporter.cpp74
1 files changed, 37 insertions, 37 deletions
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
}