/*************************************************************************** * Copyright (C) 2003 by * * Jason Kivlighn (jkivlighn@gmail.com) * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "mxpimporter.h" #include #include #include #include #include #include #include #include "datablocks/mixednumber.h" #include "datablocks/recipe.h" MXPImporter::MXPImporter() : BaseImporter() {} void MXPImporter::parseFile( const TQString &file ) { TQFile input( file ); if ( input.open( IO_ReadOnly ) ) { TQTextStream stream( &input ); stream.skipWhiteSpace(); TQString line; while ( !stream.atEnd() ) { line = stream.readLine().stripWhiteSpace(); if ( line.simplifyWhiteSpace().contains( "Exported from MasterCook" ) ) { importMXP( stream ); } else if ( line == "{ Exported from MasterCook Mac }" ) { importMac( stream ); } else if ( line == "@@@@@" ) { importGeneric( stream ); } stream.skipWhiteSpace(); } if ( fileRecipeCount() == 0 ) addWarningMsg( i18n( "No recipes found in this file." ) ); } else setErrorMsg( i18n( "Unable to open file." ) ); } MXPImporter::~MXPImporter() {} 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 *"<