summaryrefslogtreecommitdiffstats
path: root/krecipes/src/exporters/kreexporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krecipes/src/exporters/kreexporter.cpp')
-rw-r--r--krecipes/src/exporters/kreexporter.cpp84
1 files changed, 42 insertions, 42 deletions
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("\"","&quot;") + "\">\n";
+ xml += "<category name=\"" + TQStyleSheet::escape( categoryTree->category.name ).replace("\"","&quot;") + "\">\n";
for ( CategoryTree * child_it = categoryTree->firstChild(); child_it; child_it = child_it->nextSibling() ) {
writeCategoryStructure( xml, child_it );