diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /libkmime/tests | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkmime/tests')
-rw-r--r-- | libkmime/tests/test_charfreq.cpp | 6 | ||||
-rw-r--r-- | libkmime/tests/test_dates.cpp | 18 | ||||
-rw-r--r-- | libkmime/tests/test_kmime_codec.cpp | 78 | ||||
-rw-r--r-- | libkmime/tests/test_kmime_header_parsing.cpp | 64 | ||||
-rw-r--r-- | libkmime/tests/test_mdn.cpp | 24 |
5 files changed, 95 insertions, 95 deletions
diff --git a/libkmime/tests/test_charfreq.cpp b/libkmime/tests/test_charfreq.cpp index c5b708819..50f2809d8 100644 --- a/libkmime/tests/test_charfreq.cpp +++ b/libkmime/tests/test_charfreq.cpp @@ -6,7 +6,7 @@ #include <iostream> -#include <qfile.h> +#include <tqfile.h> using namespace std; using namespace KMime; @@ -28,12 +28,12 @@ static const char * typeToString( int type ) { int main( int argc, char **argv ) { for ( int i = 1 /*not program*/ ; i < argc ; i++ ) { - QFile in( argv[i] ); + TQFile in( argv[i] ); if ( !in.open( IO_ReadOnly ) ) { cerr << argv[i] << ": does not exist!" << endl; continue; } - QByteArray ba = in.readAll(); + TQByteArray ba = in.readAll(); CharFreq cf( ba ); cout << argv[i] << ": " << typeToString(cf.type()) << endl; } diff --git a/libkmime/tests/test_dates.cpp b/libkmime/tests/test_dates.cpp index f70269282..7087a01a6 100644 --- a/libkmime/tests/test_dates.cpp +++ b/libkmime/tests/test_dates.cpp @@ -21,9 +21,9 @@ main() t.setFormat(DateFormatter::Iso); kdDebug()<<"\tIso : \t"<<t.dateString(ntime)<<endl; kdDebug()<<"\trfc2822 : \t"<<t.rfc2822(ntime)<<endl; - QString rfcd = t.rfc2822(ntime); + TQString rfcd = t.rfc2822(ntime); Types::DateTime dt; - QDateTime qdt; + TQDateTime qdt; const char *str = rfcd.latin1(); if ( HeaderParsing::parseDateTime( str, str + rfcd.length(), dt ) ) { kdDebug()<<"@@@ ntime = "<<(ntime)<<", dt = "<<(dt.time)<<endl; @@ -31,7 +31,7 @@ main() kdDebug()<<"@@@ qq = "<< qdt.toString("ddd, dd MMM yyyy hh:mm:ss") <<endl; kdDebug()<<"@@@ rfc2822 : "<<t.rfc2822(dt.time)<<endl; } - QString ddd = "Mon, 05 Aug 2002 01:57:51 -0700"; + TQString ddd = "Mon, 05 Aug 2002 01:57:51 -0700"; str = ddd.latin1(); if ( HeaderParsing::parseDateTime( str, str + ddd.length(), dt ) ) { kdDebug()<<"dt = "<<(dt.time)<<endl; @@ -79,15 +79,15 @@ main() kdDebug()<<"\tCustom : \t"<< DateFormatter::formatDate( DateFormatter::Custom, ntime, "Z MMMM dddd yyyy") <<endl; t.setFormat(DateFormatter::Fancy); - kdDebug()<<"QDateTime taking: (dates as in first test)"<<endl; - kdDebug()<<"\tFancy : \t"<<t.dateString((QDateTime::currentDateTime()))<<endl; + kdDebug()<<"TQDateTime taking: (dates as in first test)"<<endl; + kdDebug()<<"\tFancy : \t"<<t.dateString((TQDateTime::currentDateTime()))<<endl; t.setFormat(DateFormatter::Localized); - kdDebug()<<"\tLocalized : \t"<<t.dateString(QDateTime::currentDateTime())<<endl; + kdDebug()<<"\tLocalized : \t"<<t.dateString(TQDateTime::currentDateTime())<<endl; t.setFormat(DateFormatter::CTime); - kdDebug()<<"\tCTime : \t"<<t.dateString(QDateTime::currentDateTime())<<endl; + kdDebug()<<"\tCTime : \t"<<t.dateString(TQDateTime::currentDateTime())<<endl; t.setFormat(DateFormatter::Iso); - kdDebug()<<"\tIso : \t"<<t.dateString(QDateTime::currentDateTime())<<endl; + kdDebug()<<"\tIso : \t"<<t.dateString(TQDateTime::currentDateTime())<<endl; t.setCustomFormat("MMMM d dddd yyyy Z"); - kdDebug()<<"\tCustom : \t"<<t.dateString(QDateTime::currentDateTime())<<endl; + kdDebug()<<"\tCustom : \t"<<t.dateString(TQDateTime::currentDateTime())<<endl; } diff --git a/libkmime/tests/test_kmime_codec.cpp b/libkmime/tests/test_kmime_codec.cpp index f13b2b434..e30a89ac9 100644 --- a/libkmime/tests/test_kmime_codec.cpp +++ b/libkmime/tests/test_kmime_codec.cpp @@ -24,8 +24,8 @@ #include <getopt.h> #include <cassert> -#include <qfile.h> -#include <qcstring.h> // QByteArray +#include <tqfile.h> +#include <tqcstring.h> // QByteArray using namespace KMime; using namespace std; @@ -81,19 +81,19 @@ static bool withCRLF = false; static bool withFinish = true; static bool verbose = false; -void encode_decode_kio( bool, const Codec *, const QByteArray &, QFile & ); +void encode_decode_kio( bool, const Codec *, const TQByteArray &, TQFile & ); void encode_decode_chunkwise( bool, const Codec *, - const QByteArray &, QFile & ); -void encode_decode_convenience_qba( bool, const Codec *, const QByteArray &, - QFile & ); + const TQByteArray &, TQFile & ); +void encode_decode_convenience_qba( bool, const Codec *, const TQByteArray &, + TQFile & ); int main( int argc, char * argv[] ) { int iterations = 1; bool encode = false; bool decode = false; - QCString outfilename, infilename; - QCString encodingName; + TQCString outfilename, infilename; + TQCString encodingName; // options parsing: while( 1 ) { @@ -104,12 +104,12 @@ int main( int argc, char * argv[] ) { case 0: // encode if ( !optarg || !*optarg ) missingParameterTo( "--encode." ); encode = true; - encodingName = QCString(optarg); + encodingName = TQCString(optarg); break; case 1: // decode if ( !optarg || !*optarg ) missingParameterTo( "--decode" ); decode = true; - encodingName = QCString(optarg); + encodingName = TQCString(optarg); break; case 2: // output-buffer-size if ( !optarg || (outbufsize = atoi( optarg )) < 1 ) @@ -121,7 +121,7 @@ int main( int argc, char * argv[] ) { break; case 4: // outfile if ( !optarg || !*optarg ) missingParameterTo( "--outfile" ); - outfilename = QCString(optarg); + outfilename = TQCString(optarg); writing = true; break; case 5: // with-crlf @@ -167,7 +167,7 @@ int main( int argc, char * argv[] ) { if ( optind != argc - 1 ) usage(); - QFile infile( argv[ optind ] ); + TQFile infile( argv[ optind ] ); if (!infile.exists()) { kdDebug() << "infile \"" << infile.name() << "\" does not exist!" << endl; return INFILE_READ_ERR; @@ -178,7 +178,7 @@ int main( int argc, char * argv[] ) { return INFILE_READ_ERR; } - QFile outfile( outfilename ); + TQFile outfile( outfilename ); if ( !outfilename.isEmpty() ) { if (!outfile.open( IO_WriteOnly|IO_Truncate )) { kdDebug() << "cannot open " << outfile.name() << " for writing!" @@ -206,7 +206,7 @@ int main( int argc, char * argv[] ) { return UNKNOWN_CODEC; } - QByteArray infile_buffer = infile.readAll(); + TQByteArray infile_buffer = infile.readAll(); for ( int i = 0 ; i < iterations ; ++i ) { kdDebug( verbose ) << "starting iteration " << i+1 @@ -230,10 +230,10 @@ int main( int argc, char * argv[] ) { } void encode_decode_convenience_qba( bool encode, const Codec * codec, - const QByteArray & infile_buffer, - QFile & outfile ) + const TQByteArray & infile_buffer, + TQFile & outfile ) { - QByteArray out; + TQByteArray out; if ( encode ) out = codec->encode( infile_buffer, withCRLF ); else @@ -244,13 +244,13 @@ void encode_decode_convenience_qba( bool encode, const Codec * codec, } } -void encode_kio_internal( Encoder * enc, QByteArray::ConstIterator & iit, - QByteArray::ConstIterator & iend, - QByteArray & out ) +void encode_kio_internal( Encoder * enc, TQByteArray::ConstIterator & iit, + TQByteArray::ConstIterator & iend, + TQByteArray & out ) { out.resize( outbufsize ); - QByteArray::Iterator oit = out.begin(); - QByteArray::ConstIterator oend = out.end(); + TQByteArray::Iterator oit = out.begin(); + TQByteArray::ConstIterator oend = out.end(); while ( !enc->encode( iit, iend, oit, oend ) ) if ( oit == oend ) return; @@ -261,12 +261,12 @@ void encode_kio_internal( Encoder * enc, QByteArray::ConstIterator & iit, out.truncate( oit - out.begin() ); } -void decode_kio_internal( Decoder * dec, QByteArray::ConstIterator & iit, - QByteArray::ConstIterator & iend, - QByteArray & out ) { +void decode_kio_internal( Decoder * dec, TQByteArray::ConstIterator & iit, + TQByteArray::ConstIterator & iend, + TQByteArray & out ) { out.resize( outbufsize ); - QByteArray::Iterator oit = out.begin(); - QByteArray::ConstIterator oend = out.end(); + TQByteArray::Iterator oit = out.begin(); + TQByteArray::ConstIterator oend = out.end(); while ( !dec->decode( iit, iend, oit, oend ) ) if ( oit == oend ) return; @@ -278,7 +278,7 @@ void decode_kio_internal( Decoder * dec, QByteArray::ConstIterator & iit, } void encode_decode_kio( bool encode, const Codec * codec, - const QByteArray & infile_buffer, QFile & outfile ) + const TQByteArray & infile_buffer, TQFile & outfile ) { Encoder * enc = 0; @@ -293,12 +293,12 @@ void encode_decode_kio( bool encode, const Codec * codec, assert( dec ); } - QByteArray::ConstIterator iit = infile_buffer.begin(); - QByteArray::ConstIterator iend = infile_buffer.end(); + TQByteArray::ConstIterator iit = infile_buffer.begin(); + TQByteArray::ConstIterator iend = infile_buffer.end(); - QByteArray out; + TQByteArray out; do { - out = QByteArray(); + out = TQByteArray(); if ( encode ) encode_kio_internal( enc, iit, iend, out ); else @@ -316,14 +316,14 @@ void encode_decode_kio( bool encode, const Codec * codec, } void encode_decode_chunkwise( bool encode, const Codec * codec, - const QByteArray & infile_buffer, QFile & outfile ) + const TQByteArray & infile_buffer, TQFile & outfile ) { Encoder * enc = 0; Decoder * dec = 0; - QByteArray indata( inbufsize ); - QByteArray outdata( outbufsize ); + TQByteArray indata( inbufsize ); + TQByteArray outdata( outbufsize ); // we're going to need this below: #define write_full_outdata_then_reset do { \ @@ -354,8 +354,8 @@ void encode_decode_chunkwise( bool encode, const Codec * codec, // Initialize the output iterators: - QByteArray::Iterator oit = outdata.begin(); - QByteArray::Iterator oend = outdata.end(); + TQByteArray::Iterator oit = outdata.begin(); + TQByteArray::Iterator oend = outdata.end(); // Get an encoder. This one you have to delete! if ( encode ) { @@ -379,8 +379,8 @@ void encode_decode_chunkwise( bool encode, const Codec * codec, << indata.size() << ") from input." << endl; // setup input iterators: - QByteArray::ConstIterator iit = indata.begin(); - QByteArray::ConstIterator iend = indata.begin() + reallyRead; + TQByteArray::ConstIterator iit = indata.begin(); + TQByteArray::ConstIterator iend = indata.begin() + reallyRead; if ( encode ) { // diff --git a/libkmime/tests/test_kmime_header_parsing.cpp b/libkmime/tests/test_kmime_header_parsing.cpp index 3839bff7e..93c447ebd 100644 --- a/libkmime/tests/test_kmime_header_parsing.cpp +++ b/libkmime/tests/test_kmime_header_parsing.cpp @@ -4,9 +4,9 @@ #include <kinstance.h> -#include <qfile.h> -#include <qcstring.h> -//#include <qstring.h> +#include <tqfile.h> +#include <tqcstring.h> +//#include <tqstring.h> //#include <stdio.h> #include <iostream> @@ -65,7 +65,7 @@ void usage( const char * msg=0 ) { exit(1); } -ostream & operator<<( ostream & stream, const QString & str ) { +ostream & operator<<( ostream & stream, const TQString & str ) { return stream << str.utf8().data(); } @@ -122,18 +122,18 @@ int main( int argc, char * argv[] ) { KInstance instance( "test_kmime_header_parsing" ); - QFile stdIn; + TQFile stdIn; stdIn.open( IO_ReadOnly, stdin ); - const QByteArray indata = stdIn.readAll(); + const TQByteArray indata = stdIn.readAll(); stdIn.close(); - QByteArray::ConstIterator iit = indata.begin(); - const QByteArray::ConstIterator iend = indata.end(); + TQByteArray::ConstIterator iit = indata.begin(); + const TQByteArray::ConstIterator iend = indata.end(); switch ( index ) { case 0: { // encoded-word - QString result; - QCString language; + TQString result; + TQCString language; // must have checked for initial '=' already: bool ok = indata.size() >= 1 && *iit++ == '=' && parseEncodedWord( iit, iend, result, language ); @@ -145,7 +145,7 @@ int main( int argc, char * argv[] ) { break; case 1: { // atom - QString result = "with 8bit: "; + TQString result = "with 8bit: "; bool ok = parseAtom( iit, iend, result, true ); cout << ( ok ? "OK" : "BAD" ) << endl @@ -165,7 +165,7 @@ int main( int argc, char * argv[] ) { break; case 2: { // token - QString result = "with 8bit: "; + TQString result = "with 8bit: "; bool ok = parseToken( iit, iend, result, true ); cout << ( ok ? "OK" : "BAD" ) << endl @@ -185,7 +185,7 @@ int main( int argc, char * argv[] ) { break; case 3: { // quoted-string - QString result; + TQString result; // must have checked for initial '"' already: bool ok = *iit++ == '"' && parseGenericQuotedString( iit, iend, result, withCRLF, '"', '"' ); @@ -196,7 +196,7 @@ int main( int argc, char * argv[] ) { break; case 4: { // domain-literal - QString result; + TQString result; // must have checked for initial '[' already: bool ok = *iit++ == '[' && parseGenericQuotedString( iit, iend, result, withCRLF, '[', ']' ); @@ -207,7 +207,7 @@ int main( int argc, char * argv[] ) { break; case 5: { // comment - QString result; + TQString result; // must have checked for initial '(' already: bool ok = *iit++ == '(' && parseComment( iit, iend, result, withCRLF, true ); @@ -218,7 +218,7 @@ int main( int argc, char * argv[] ) { break; case 6: { // phrase - QString result; + TQString result; bool ok = parsePhrase( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl @@ -227,7 +227,7 @@ int main( int argc, char * argv[] ) { break; case 7: { // dot-atom - QString result; + TQString result; bool ok = parseDotAtom( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl @@ -236,7 +236,7 @@ int main( int argc, char * argv[] ) { break; case 8: { // domain - QString result; + TQString result; bool ok = parseDomain( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl @@ -245,12 +245,12 @@ int main( int argc, char * argv[] ) { break; case 9: { // obs-route - QStringList result; + TQStringList result; bool ok = parseObsRoute( iit, iend, result, withCRLF, true /*save*/ ); cout << ( ok ? "OK" : "BAD" ) << endl << "result: " << result.count() << " domains:" << endl; - for ( QStringList::ConstIterator it = result.begin() ; + for ( TQStringList::ConstIterator it = result.begin() ; it != result.end() ; ++it ) cout << (*it) << endl; } @@ -294,7 +294,7 @@ int main( int argc, char * argv[] ) { cout << ( ok ? "OK" : "BAD" ) << endl << "result.displayName:\n" << result.displayName << endl; int i = 0; - for ( QValueList<KMime::Types::Mailbox>::ConstIterator + for ( TQValueList<KMime::Types::Mailbox>::ConstIterator it = result.mailboxList.begin(); it != result.mailboxList.end() ; ++it, ++i ) cout << "result.mailboxList[" << i << "].displayName:\n" @@ -313,7 +313,7 @@ int main( int argc, char * argv[] ) { cout << ( ok ? "OK" : "BAD" ) << endl << "result.displayName:\n" << endl; int i = 0; - for ( QValueList<KMime::Types::Mailbox>::ConstIterator + for ( TQValueList<KMime::Types::Mailbox>::ConstIterator it = result.mailboxList.begin(); it != result.mailboxList.end() ; ++it, ++i ) cout << "result.mailboxList[" << i << "].displayName:\n" @@ -326,17 +326,17 @@ int main( int argc, char * argv[] ) { break; case 15: { // address-list - QValueList<KMime::Types::Address> result; + TQValueList<KMime::Types::Address> result; bool ok = parseAddressList( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl; int j = 0; - for ( QValueList<KMime::Types::Address>::ConstIterator + for ( TQValueList<KMime::Types::Address>::ConstIterator jt = result.begin() ; jt != result.end() ; ++jt, ++j ) { cout << "result[" << j << "].displayName:\n" << (*jt).displayName << endl; int i = 0; - for ( QValueList<KMime::Types::Mailbox>::ConstIterator + for ( TQValueList<KMime::Types::Mailbox>::ConstIterator it = (*jt).mailboxList.begin(); it != (*jt).mailboxList.end() ; ++it, ++i ) cout << "result[" << j << "].mailboxList[" << i << "].displayName:\n" @@ -350,45 +350,45 @@ int main( int argc, char * argv[] ) { break; case 16: { // parameter - QPair<QString,KMime::Types::QStringOrQPair> result; + QPair<TQString,KMime::Types::QStringOrQPair> result; bool ok = parseParameter( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl << "result.first (attribute):\n" << result.first << endl << "result.second.qstring (value):\n" << result.second.qstring << endl << "result.second.qpair (value):\n" - << QCString( result.second.qpair.first, + << TQCString( result.second.qpair.first, result.second.qpair.second+1 ).data() << endl; } break; case 17: { // raw-parameter-list - QMap<QString,KMime::Types::QStringOrQPair> result; + TQMap<TQString,KMime::Types::QStringOrQPair> result; bool ok = parseRawParameterList( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl << "result: " << result.count() << " raw parameters:" << endl; int i = 0; - for ( QMap<QString,KMime::Types::QStringOrQPair>::ConstIterator + for ( TQMap<TQString,KMime::Types::QStringOrQPair>::ConstIterator it = result.begin() ; it != result.end() ; ++it, ++i ) cout << "result[" << i << "].key() (attribute):\n" << it.key() << endl << "result[" << i << "].data().qstring (value):\n" << it.data().qstring << endl << "result[" << i << "].data().qpair (value):\n" - << QCString( it.data().qpair.first, + << TQCString( it.data().qpair.first, it.data().qpair.second+1 ).data() << endl; } break; case 18: { // parameter-list - QMap<QString,QString> result; + TQMap<TQString,TQString> result; bool ok = parseParameterList( iit, iend, result, withCRLF ); cout << ( ok ? "OK" : "BAD" ) << endl << "result: " << result.count() << " parameters:" << endl; int i = 0; - for ( QMap<QString,QString>::Iterator it = result.begin() ; + for ( TQMap<TQString,TQString>::Iterator it = result.begin() ; it != result.end() ; ++it, ++i ) cout << "result[" << i << "].key() (attribute):\n" << it.key() << endl diff --git a/libkmime/tests/test_mdn.cpp b/libkmime/tests/test_mdn.cpp index 1bb387f1d..fa9290f20 100644 --- a/libkmime/tests/test_mdn.cpp +++ b/libkmime/tests/test_mdn.cpp @@ -1,9 +1,9 @@ #include <kmime_mdn.h> using namespace KMime::MDN; -#include <qcstring.h> -#include <qstring.h> -#include <qvaluelist.h> +#include <tqcstring.h> +#include <tqstring.h> +#include <tqvaluelist.h> #include <iostream> using std::cout; @@ -26,14 +26,14 @@ void usage( const char * msg=0 ) { int main( int argc, char * argv[] ) { - QString finalRecipient; - QString originalRecipient; - QCString originalMessageId; + TQString finalRecipient; + TQString originalRecipient; + TQCString originalMessageId; ActionMode actionMode = ManualAction; SendingMode sendingMode = SentManually; DispositionType dispositionType = Displayed; - QValueList<DispositionModifier> dispositionModifiers; - QString special; + TQValueList<DispositionModifier> dispositionModifiers; + TQString special; while ( true ) { int option_index = 0; @@ -84,7 +84,7 @@ int main( int argc, char * argv[] ) { case 'f': // --final-recipient if ( optarg && *optarg ) - finalRecipient = QString::fromUtf8( optarg ); + finalRecipient = TQString::fromUtf8( optarg ); else usage( "--final-recipient is missing a value" ); break; @@ -113,7 +113,7 @@ int main( int argc, char * argv[] ) { case 'o': // --original-recipient if ( optarg && *optarg ) - originalRecipient = QString::fromUtf8( optarg ); + originalRecipient = TQString::fromUtf8( optarg ); else usage( "--original-recipient is missing a value" ); break; @@ -133,11 +133,11 @@ int main( int argc, char * argv[] ) { } if ( optind < argc ) - special = QString::fromUtf8( argv[optind++] ); + special = TQString::fromUtf8( argv[optind++] ); if ( optind < argc ) usage( "too many arguments!" ); - QCString result = dispositionNotificationBodyContent( finalRecipient, + TQCString result = dispositionNotificationBodyContent( finalRecipient, originalRecipient.latin1(), originalMessageId, dispositionType, |