From 67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 13 Apr 2011 00:46:47 +0000 Subject: Initial conversion of kdepim to TQt This will probably require some tweaking before it will build under Qt4, however Qt3 builds are OK. Any alterations this commit makes to kdepim behaviour under Qt3 are unintentional and should be fixed. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ktnef/lib/ktnefmessage.cpp | 2 +- ktnef/lib/ktnefparser.cpp | 94 +++++++++++++++++++++--------------------- ktnef/lib/ktnefproperty.cpp | 4 +- ktnef/lib/ktnefpropertyset.cpp | 10 ++--- ktnef/lib/ktnefwriter.cpp | 10 ++--- ktnef/lib/mapi.cpp | 8 ++-- 6 files changed, 64 insertions(+), 64 deletions(-) (limited to 'ktnef/lib') diff --git a/ktnef/lib/ktnefmessage.cpp b/ktnef/lib/ktnefmessage.cpp index 8f2648c3..8a8bf065 100644 --- a/ktnef/lib/ktnefmessage.cpp +++ b/ktnef/lib/ktnefmessage.cpp @@ -70,7 +70,7 @@ TQString KTNEFMessage::rtfString() { TQVariant prop = property( 0x1009 ); if ( prop.isNull() || prop.type() != TQVariant::ByteArray) - return TQString::null; + return TQString(); else { TQByteArray rtf; diff --git a/ktnef/lib/ktnefparser.cpp b/ktnef/lib/ktnefparser.cpp index a73a1d54..cd006346 100644 --- a/ktnef/lib/ktnefparser.cpp +++ b/ktnef/lib/ktnefparser.cpp @@ -70,7 +70,7 @@ public: defaultdir_ = "/tmp/"; current_ = 0; deleteDevice_ = false; - device_ = 0; + tqdevice_ = 0; message_ = new KTNEFMessage; } ~ParserPrivate() @@ -79,7 +79,7 @@ public: } TQDataStream stream_; - TQIODevice *device_; + TQIODevice *tqdevice_; bool deleteDevice_; TQString defaultdir_; KTNEFAttach *current_; @@ -105,8 +105,8 @@ KTNEFMessage* KTNEFParser::message() const void KTNEFParser::deleteDevice() { if ( d->deleteDevice_ ) - delete d->device_; - d->device_ = 0; + delete d->tqdevice_; + d->tqdevice_ = 0; d->deleteDevice_ = false; } @@ -124,7 +124,7 @@ bool KTNEFParser::decodeMessage() // read data length d->stream_ >> i2; // offset after reading the value - off = d->device_->at() + i2; + off = d->tqdevice_->at() + i2; switch ( tag ) { case attAIDOWNER: @@ -158,9 +158,9 @@ bool KTNEFParser::decodeMessage() kdDebug() << "Message MAPI Properties" << " (length=" << i2 << ")" << endl; { int nProps = d->message_->properties().count(); - i2 += d->device_->at(); + i2 += d->tqdevice_->at(); readMAPIProperties( d->message_->properties(), 0 ); - d->device_->at( i2 ); + d->tqdevice_->at( i2 ); kdDebug() << "Properties: " << d->message_->properties().count() << endl; value = TQString( "< %1 properties >" ).arg( d->message_->properties().count() - nProps ); } @@ -171,7 +171,7 @@ bool KTNEFParser::decodeMessage() break; case attFROM: d->message_->addProperty( 0x0024, MAPI_TYPE_STRING8, readTNEFAddress( d->stream_ ) ); - d->device_->at( d->device_->at() - i2 ); + d->tqdevice_->at( d->tqdevice_->at() - i2 ); value = readTNEFData( d->stream_, i2 ); kdDebug() << "Message From" << " (length=" << i2 << ")" << endl; break; @@ -198,7 +198,7 @@ bool KTNEFParser::decodeMessage() d->message_->addProperty( 0x0E07, MAPI_TYPE_ULONG, flag ); value = c; } - kdDebug() << "Message Status" << " (length=" << i2 << ")" << endl; + kdDebug() << "Message tqStatus" << " (length=" << i2 << ")" << endl; break; case attRECIPTABLE: { @@ -212,7 +212,7 @@ bool KTNEFParser::decodeMessage() recipTable << formatRecipient( props ); } d->message_->addProperty( 0x0E12, MAPI_TYPE_STRING8, recipTable ); - d->device_->at( d->device_->at() - i2 ); + d->tqdevice_->at( d->tqdevice_->at() - i2 ); value = readTNEFData( d->stream_, i2 ); } kdDebug() << "Message Recipient Table" << " (length=" << i2 << ")" << endl; @@ -242,13 +242,13 @@ bool KTNEFParser::decodeMessage() break; } // skip data - if ( d->device_->at() != off && !d->device_->at( off ) ) + if ( d->tqdevice_->at() != off && !d->tqdevice_->at( off ) ) return false; // get checksum d->stream_ >> u; // add TNEF attribute d->message_->addAttribute( tag, type, value, true ); - //kdDebug() << "stream: " << d->device_->at() << endl; + //kdDebug() << "stream: " << d->tqdevice_->at() << endl; return true; } @@ -273,15 +273,15 @@ bool KTNEFParser::decodeAttachment() break; case attATTACHDATA: d->current_->setSize( i ); - d->current_->setOffset( d->device_->at() ); - d->device_->at( d->device_->at() + i ); + d->current_->setOffset( d->tqdevice_->at() ); + d->tqdevice_->at( d->tqdevice_->at() + i ); value = TQString( "< size=%1 >" ).arg( i ); kdDebug() << "Attachment Data: size=" << i << endl; break; case attATTACHMENT: // try to get attachment info - i += d->device_->at(); + i += d->tqdevice_->at(); readMAPIProperties( d->current_->properties(), d->current_ ); - d->device_->at( i ); + d->tqdevice_->at( i ); d->current_->setIndex( d->current_->property( MAPI_TAG_INDEX ).toUInt() ); d->current_->setDisplaySize( d->current_->property( MAPI_TAG_SIZE ).toUInt() ); str = d->current_->property( MAPI_TAG_DISPLAYNAME ).toString(); @@ -305,7 +305,7 @@ bool KTNEFParser::decodeAttachment() case attATTACHMETAFILE: kdDebug() << "Attachment Metafile: size=" << i << endl; //value = TQString( "< size=%1 >" ).arg( i ); - //d->device_->at( d->device_->at()+i ); + //d->tqdevice_->at( d->tqdevice_->at()+i ); value = readTNEFData( d->stream_, i ); break; default: @@ -316,7 +316,7 @@ bool KTNEFParser::decodeAttachment() d->stream_ >> u; // u <- checksum // add TNEF attribute d->current_->addAttribute( tag, type, value, true ); - //kdDebug() << "stream: " << d->device_->at() << endl; + //kdDebug() << "stream: " << d->tqdevice_->at() << endl; return true; } @@ -339,19 +339,19 @@ bool KTNEFParser::parseDevice() d->current_ = 0; } - if ( !d->device_->open( IO_ReadOnly ) ) { - kdDebug() << "Couldn't open device" << endl; + if ( !d->tqdevice_->open( IO_ReadOnly ) ) { + kdDebug() << "Couldn't open tqdevice" << endl; return false; } - d->stream_.setDevice( d->device_ ); + d->stream_.setDevice( d->tqdevice_ ); d->stream_.setByteOrder( TQDataStream::LittleEndian ); d->stream_ >> i; if (i == TNEF_SIGNATURE) { d->stream_ >> u; kdDebug().form( "Attachment cross reference key: 0x%04x\n",u ); - //kdDebug() << "stream: " << d->device_->at() << endl; + //kdDebug() << "stream: " << d->tqdevice_->at() << endl; while (!d->stream_.eof()) { d->stream_ >> c; @@ -364,7 +364,7 @@ bool KTNEFParser::parseDevice() if (!decodeAttachment()) goto end; break; default: - kdDebug() << "Unknown Level: " << c << ", at offset " << d->device_->at() << endl; + kdDebug() << "Unknown Level: " << c << ", at offset " << d->tqdevice_->at() << endl; goto end; } } @@ -381,7 +381,7 @@ bool KTNEFParser::parseDevice() else { kdDebug() << "This is not a TNEF file" << endl; -end: d->device_->close(); +end: d->tqdevice_->close(); return false; } } @@ -395,10 +395,10 @@ bool KTNEFParser::extractFile(const TQString& filename) bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const TQString& dirname) { - QString filename = dirname + "/" + att->name(); - if (!d->device_->isOpen()) + TQString filename = dirname + "/" + att->name(); + if (!d->tqdevice_->isOpen()) return false; - if (!d->device_->at(att->offset())) + if (!d->tqdevice_->at(att->offset())) return false; KSaveFile saveFile( filename ); TQFile *outfile = saveFile.file(); @@ -411,7 +411,7 @@ bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const TQString& dirname) bool ok(true); while (ok && len > 0) { - n = d->device_->readBlock(buf,QMIN(sz,len)); + n = d->tqdevice_->readBlock(buf,TQMIN(sz,len)); if (n < 0) ok = false; else @@ -447,15 +447,15 @@ bool KTNEFParser::openFile(const TQString& filename) deleteDevice(); delete d->message_; d->message_ = new KTNEFMessage(); - d->device_ = new TQFile( filename ); + d->tqdevice_ = new TQFile( filename ); d->deleteDevice_ = true; return parseDevice(); } -bool KTNEFParser::openDevice( TQIODevice *device ) +bool KTNEFParser::openDevice( TQIODevice *tqdevice ) { deleteDevice(); - d->device_ = device; + d->tqdevice_ = tqdevice; return parseDevice(); } @@ -478,16 +478,16 @@ void KTNEFParser::checkCurrent( int key ) // and/or content (using at most 32 bytes) KMimeType::Ptr mimetype; if ( !d->current_->fileName().isEmpty() ) - mimetype = KMimeType::tqfindByPath( d->current_->fileName(), 0, true ); + mimetype = KMimeType::findByPath( d->current_->fileName(), 0, true ); if (!mimetype) return; // FIXME if ( mimetype->name() == "application/octet-stream" && d->current_->size() > 0 ) { - int oldOffset = d->device_->at(); - TQByteArray buffer( QMIN( 32, d->current_->size() ) ); - d->device_->at( d->current_->offset() ); - d->device_->readBlock( buffer.data(), buffer.size() ); - mimetype = KMimeType::tqfindByContent( buffer ); - d->device_->at( oldOffset ); + int oldOffset = d->tqdevice_->at(); + TQByteArray buffer( TQMIN( 32, d->current_->size() ) ); + d->tqdevice_->at( d->current_->offset() ); + d->tqdevice_->readBlock( buffer.data(), buffer.size() ); + mimetype = KMimeType::findByContent( buffer ); + d->tqdevice_->at( oldOffset ); } d->current_->setMimeTag( mimetype->name() ); } @@ -554,11 +554,11 @@ TQString formatRecipient( const TQMap& props ) { TQString s, dn, addr, t; TQMap::ConstIterator it; - if ( ( it = props.find( 0x3001 ) ) != props.end() ) + if ( ( it = props.tqfind( 0x3001 ) ) != props.end() ) dn = ( *it )->valueString(); - if ( ( it = props.find( 0x3003 ) ) != props.end() ) + if ( ( it = props.tqfind( 0x3003 ) ) != props.end() ) addr = ( *it )->valueString(); - if ( ( it = props.find( 0x0C15 ) ) != props.end() ) + if ( ( it = props.tqfind( 0x0C15 ) ) != props.end() ) switch ( ( *it )->value().toInt() ) { case 0: t = "From:"; break; @@ -791,20 +791,20 @@ bool KTNEFParser::readMAPIProperties( TQMap& props, KTNEFAtt TQByteArray data = mapi.value.toByteArray(); int len = data.size(); ALIGN( len, 4 ); - d->device_->at( d->device_->at()-len ); + d->tqdevice_->at( d->tqdevice_->at()-len ); TQ_UINT32 interface_ID; d->stream_ >> interface_ID; if ( interface_ID == MAPI_IID_IMessage ) { // embedded TNEF file attach->unsetDataParser(); - attach->setOffset( d->device_->at()+12 ); + attach->setOffset( d->tqdevice_->at()+12 ); attach->setSize( data.size()-16 ); attach->setMimeTag( "application/ms-tnef" ); attach->setDisplayName( "Embedded Message" ); kdDebug() << "MAPI Embedded Message: size=" << data.size() << endl; } - d->device_->at( d->device_->at() + ( len-4 ) ); + d->tqdevice_->at( d->tqdevice_->at() + ( len-4 ) ); break; } else if ( mapi.type == MAPI_TYPE_BINARY && attach && attach->offset() < 0 ) @@ -813,7 +813,7 @@ bool KTNEFParser::readMAPIProperties( TQMap& props, KTNEFAtt int len = mapi.value.toByteArray().size(); ALIGN( len, 4 ) attach->setSize( len ); - attach->setOffset( d->device_->at() - len ); + attach->setOffset( d->tqdevice_->at() - len ); attach->addAttribute( attATTACHDATA, atpBYTE, TQString( "< size=%1 >" ).arg( len ), false ); } } @@ -855,12 +855,12 @@ bool KTNEFParser::readMAPIProperties( TQMap& props, KTNEFAtt break; } // do not remove potential existing similar entry - if ( ( it = props.find( key ) ) == props.end() ) + if ( ( it = props.tqfind( key ) ) == props.end() ) { p = new KTNEFProperty( key, ( mapi.type & 0x0FFF ), mapi.value, mapi.name.value ); props[ p->key() ] = p; } - //kdDebug() << "stream: " << d->device_->at() << endl; + //kdDebug() << "stream: " << d->tqdevice_->at() << endl; } if ( foundAttachment && attach ) diff --git a/ktnef/lib/ktnefproperty.cpp b/ktnef/lib/ktnefproperty.cpp index df04a388..ae43236f 100644 --- a/ktnef/lib/ktnefproperty.cpp +++ b/ktnef/lib/ktnefproperty.cpp @@ -55,13 +55,13 @@ TQString KTNEFProperty::formatValue( const TQVariant& value, bool beautify ) // printable characters TQByteArray arr = value.toByteArray(); bool printable = true; - for ( int i=QMIN( arr.size(), 8 )-1; i>=0 && printable; i-- ) + for ( int i=TQMIN( arr.size(), 8 )-1; i>=0 && printable; i-- ) printable = ( isprint( arr[ i ] ) != 0 ); if ( !printable ) { TQString s; uint i; - uint txtCount = beautify ? QMIN( arr.size(), 32 ) : arr.size(); + uint txtCount = beautify ? TQMIN( arr.size(), 32 ) : arr.size(); for ( i=0; i < txtCount; ++i ) { s.append( TQString().sprintf( "%02X", ( uchar )arr[ i ] ) ); diff --git a/ktnef/lib/ktnefpropertyset.cpp b/ktnef/lib/ktnefpropertyset.cpp index ec3ee2b5..b67c1ffb 100644 --- a/ktnef/lib/ktnefpropertyset.cpp +++ b/ktnef/lib/ktnefpropertyset.cpp @@ -30,7 +30,7 @@ KTNEFPropertySet::~KTNEFPropertySet() void KTNEFPropertySet::addProperty( int key, int type, const TQVariant& value, const TQVariant& name, bool overwrite ) { - TQMap::ConstIterator it = properties_.find( key ); + TQMap::ConstIterator it = properties_.tqfind( key ); if ( it != properties_.end() ) { if ( overwrite ) @@ -45,7 +45,7 @@ void KTNEFPropertySet::addProperty( int key, int type, const TQVariant& value, c TQString KTNEFPropertySet::findProp(int key, const TQString& fallback, bool upper) { - TQMap::Iterator it = properties_.find( key ); + TQMap::Iterator it = properties_.tqfind( key ); if( properties_.end() != it ) return upper ? KTNEFProperty::formatValue( (*it)->value(), false ).upper() : KTNEFProperty::formatValue( (*it)->value(), false ); @@ -100,7 +100,7 @@ const TQMap& KTNEFPropertySet::properties() const TQVariant KTNEFPropertySet::property( int key ) const { - TQMap::ConstIterator it = properties_.find( key ); + TQMap::ConstIterator it = properties_.tqfind( key ); if ( it == properties_.end() ) return TQVariant(); else @@ -122,7 +122,7 @@ void KTNEFPropertySet::clear( bool deleteAll ) void KTNEFPropertySet::addAttribute( int key, int type, const TQVariant& value, bool overwrite ) { - TQMap::ConstIterator it = attributes_.find( key ); + TQMap::ConstIterator it = attributes_.tqfind( key ); if ( it != attributes_.end() ) { if ( overwrite ) @@ -146,7 +146,7 @@ const TQMap& KTNEFPropertySet::attributes() const TQVariant KTNEFPropertySet::attribute( int key ) const { - TQMap::ConstIterator it = attributes_.find( key ); + TQMap::ConstIterator it = attributes_.tqfind( key ); if ( it == attributes_.end() ) return TQVariant(); else diff --git a/ktnef/lib/ktnefwriter.cpp b/ktnef/lib/ktnefwriter.cpp index 3da4dc1e..2264b15e 100644 --- a/ktnef/lib/ktnefwriter.cpp +++ b/ktnef/lib/ktnefwriter.cpp @@ -100,7 +100,7 @@ TQ_UINT32 mergeTagAndType( TQ_UINT32 tag, TQ_UINT32 type ) { */ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { TQMap& properties = mData->properties.properties(); - TQMap::Iterator it = properties.find( tag ); + TQMap::Iterator it = properties.tqfind( tag ); if ( it == properties.end() ) return false; @@ -179,7 +179,7 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { case attSUBJECT: case attBODY: case attMSGID: - // QCString + // TQCString cs = property->value().toString().local8Bit(); addToChecksum( cs, checksum ); @@ -236,7 +236,7 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { case attDATESENT: case attDATERECD: case attDATEMODIFIED: - // QDateTime + // TQDateTime dt = property->value().toDateTime(); time = dt.time(); date = dt.date(); @@ -287,7 +287,7 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { addToChecksum( i, checksum ); // from reader: d->message_->addProperty( 0x0E07, MAPI_TYPE_ULONG, flag ); } - kdDebug() << "Message Status" << " (length=" << i2 << ")" << endl; + kdDebug() << "Message tqStatus" << " (length=" << i2 << ")" << endl; break; */ @@ -417,7 +417,7 @@ void KTNEFWriter::addAttendee( const TQString& /*cn*/, Role /*r*/, PartStat /*p* // I assume this is the same as the sender? // U also assume that this is like "Name
" void KTNEFWriter::setOrganizer( const TQString& organizer ) { - int i = organizer.find( '<' ); + int i = organizer.tqfind( '<' ); if ( i == -1 ) return; diff --git a/ktnef/lib/mapi.cpp b/ktnef/lib/mapi.cpp index bf84f1fd..e4f6f85c 100644 --- a/ktnef/lib/mapi.cpp +++ b/ktnef/lib/mapi.cpp @@ -130,7 +130,7 @@ static struct { 0x8004, I18N_NOOP( "Subject" ) }, { 0x8005, I18N_NOOP( "Date Sent" ) }, { 0x8006, I18N_NOOP( "Date Received" ) }, - { 0x8007, I18N_NOOP( "Message Status" ) }, + { 0x8007, I18N_NOOP( "Message tqStatus" ) }, { 0x8008, I18N_NOOP( "Message Class" ) }, { 0x8009, I18N_NOOP( "Message ID" ) }, { 0x800A, I18N_NOOP( "Parent ID" ) }, @@ -176,7 +176,7 @@ MAPI_NamedTagStrings[] = { 0x820D, I18N_NOOP( "Appointment Start Date" ) }, { 0x820E, I18N_NOOP( "Appointment End Date" ) }, { 0x8213, I18N_NOOP( "Appointment Duration" ) }, - { 0x8218, I18N_NOOP( "Appointment Response Status" ) }, + { 0x8218, I18N_NOOP( "Appointment Response tqStatus" ) }, { 0x8223, I18N_NOOP( "Appointment Is Recurring" ) }, { 0x8231, I18N_NOOP( "Appointment Recurrence Type" ) }, { 0x8232, I18N_NOOP( "Appointment Recurrence Pattern" ) }, @@ -197,7 +197,7 @@ TQString mapiTagString( int key ) for ( int i=0; MAPI_TagStrings[ i ].str; i++ ) MAPI_TagMap[ MAPI_TagStrings[ i ].tag ] = i18n(MAPI_TagStrings[ i ].str); } - TQMap::ConstIterator it = MAPI_TagMap.find( key ); + TQMap::ConstIterator it = MAPI_TagMap.tqfind( key ); if ( it == MAPI_TagMap.end() ) return TQString().sprintf( "0x%04X", key ); else @@ -211,7 +211,7 @@ TQString mapiNamedTagString( int key, int tag ) for ( int i=0; MAPI_NamedTagStrings[ i ].str; i++ ) MAPI_NamedTagMap[ MAPI_NamedTagStrings[ i ].tag ] = i18n(MAPI_NamedTagStrings[ i ].str); } - TQMap::ConstIterator it = MAPI_NamedTagMap.find( key ); + TQMap::ConstIterator it = MAPI_NamedTagMap.tqfind( key ); if ( it == MAPI_NamedTagMap.end() ) if ( tag >= 0 ) return TQString().sprintf( "0x%04X [0x%04X]: ", tag, key ) + *it; -- cgit v1.2.3