diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
commit | f4fae92b6768541e2952173c3d4b09040f95bf7e (patch) | |
tree | d8c5d93232235cd635f3310b4d95490df181ba2d /ktnef/lib | |
parent | 125c0a08265b75a133644d3b55f47e37c919f45d (diff) | |
download | tdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.tar.gz tdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.zip |
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktnef/lib')
-rw-r--r-- | ktnef/lib/ktnefparser.cpp | 74 | ||||
-rw-r--r-- | ktnef/lib/ktnefwriter.cpp | 122 |
2 files changed, 98 insertions, 98 deletions
diff --git a/ktnef/lib/ktnefparser.cpp b/ktnef/lib/ktnefparser.cpp index e97ec8128..a73a1d547 100644 --- a/ktnef/lib/ktnefparser.cpp +++ b/ktnef/lib/ktnefparser.cpp @@ -40,11 +40,11 @@ typedef struct { - Q_UINT16 type; - Q_UINT16 tag; + TQ_UINT16 type; + TQ_UINT16 tag; TQVariant value; struct { - Q_UINT32 type; + TQ_UINT32 type; TQVariant value; } name; } MAPI_value; @@ -52,12 +52,12 @@ typedef struct { void clearMAPIName( MAPI_value& mapi ); void clearMAPIValue(MAPI_value& mapi, bool clearName = true); TQString readMAPIString( TQDataStream& stream, bool isUnicode = false, bool align = true, int len = -1 ); -Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi); +TQ_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi); TQDateTime readTNEFDate( TQDataStream& stream ); TQString readTNEFAddress( TQDataStream& stream ); -TQByteArray readTNEFData( TQDataStream& stream, Q_UINT32 len ); -TQVariant readTNEFAttribute( TQDataStream& stream, Q_UINT16 type, Q_UINT32 len ); -TQDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB ); +TQByteArray readTNEFData( TQDataStream& stream, TQ_UINT32 len ); +TQVariant readTNEFAttribute( TQDataStream& stream, TQ_UINT16 type, TQ_UINT32 len ); +TQDateTime formatTime( TQ_UINT32 lowB, TQ_UINT32 highB ); TQString formatRecipient( const TQMap<int,KTNEFProperty*>& props ); //------------------------------------------------------------------------------------ @@ -112,8 +112,8 @@ void KTNEFParser::deleteDevice() bool KTNEFParser::decodeMessage() { - Q_UINT32 i1, i2, off; - Q_UINT16 u, tag, type; + TQ_UINT32 i1, i2, off; + TQ_UINT16 u, tag, type; TQVariant value; // read (type+name) @@ -187,8 +187,8 @@ bool KTNEFParser::decodeMessage() break; case attMSGSTATUS: { - Q_UINT8 c; - Q_UINT32 flag = 0; + TQ_UINT8 c; + TQ_UINT32 flag = 0; d->stream_ >> c; if ( c & fmsRead ) flag |= MSGFLAG_READ; if ( !( c & fmsModified ) ) flag |= MSGFLAG_UNMODIFIED; @@ -202,7 +202,7 @@ bool KTNEFParser::decodeMessage() break; case attRECIPTABLE: { - Q_UINT32 rows; + TQ_UINT32 rows; TQValueList<TQVariant> recipTable; d->stream_ >> rows; for ( uint i=0; i<rows; i++ ) @@ -254,8 +254,8 @@ bool KTNEFParser::decodeMessage() bool KTNEFParser::decodeAttachment() { - Q_UINT32 i; - Q_UINT16 tag, type, u; + TQ_UINT32 i; + TQ_UINT16 tag, type, u; TQVariant value; TQString str; @@ -328,9 +328,9 @@ void KTNEFParser::setDefaultExtractDir(const TQString& dirname) bool KTNEFParser::parseDevice() { - Q_UINT16 u; - Q_UINT32 i; - Q_UINT8 c; + TQ_UINT16 u; + TQ_UINT32 i; + TQ_UINT8 c; d->message_->clearAttachments(); if (d->current_) @@ -405,7 +405,7 @@ bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const TQString& dirname) if ( !outfile ) return false; - Q_UINT32 len = att->size(), sz(16384); + TQ_UINT32 len = att->size(), sz(16384); int n(0); char *buf = new char[sz]; bool ok(true); @@ -465,7 +465,7 @@ void KTNEFParser::checkCurrent( int key ) d->current_ = new KTNEFAttach(); else { - if ( d->current_->attributes().contains( key ) ) + if ( d->current_->attributes().tqcontains( key ) ) { if (d->current_->offset() >= 0 ) { @@ -478,7 +478,7 @@ void KTNEFParser::checkCurrent( int key ) // and/or content (using at most 32 bytes) KMimeType::Ptr mimetype; if ( !d->current_->fileName().isEmpty() ) - mimetype = KMimeType::findByPath( d->current_->fileName(), 0, true ); + mimetype = KMimeType::tqfindByPath( d->current_->fileName(), 0, true ); if (!mimetype) return; // FIXME if ( mimetype->name() == "application/octet-stream" && d->current_->size() > 0 ) { @@ -486,7 +486,7 @@ void KTNEFParser::checkCurrent( int key ) TQByteArray buffer( QMIN( 32, d->current_->size() ) ); d->device_->at( d->current_->offset() ); d->device_->readBlock( buffer.data(), buffer.size() ); - mimetype = KMimeType::findByContent( buffer ); + mimetype = KMimeType::tqfindByContent( buffer ); d->device_->at( oldOffset ); } d->current_->setMimeTag( mimetype->name() ); @@ -521,7 +521,7 @@ void clearMAPIValue(MAPI_value& mapi, bool clearName) clearMAPIName( mapi ); } -TQDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB ) +TQDateTime formatTime( TQ_UINT32 lowB, TQ_UINT32 highB ) { TQDateTime dt; #if ( SIZEOF_UINT64_T == 8 ) @@ -580,27 +580,27 @@ TQString formatRecipient( const TQMap<int,KTNEFProperty*>& props ) TQDateTime readTNEFDate( TQDataStream& stream ) { // 14-bytes long - Q_UINT16 y, m, d, hh, mm, ss, dm; + TQ_UINT16 y, m, d, hh, mm, ss, dm; stream >> y >> m >> d >> hh >> mm >> ss >> dm; return TQDateTime( TQDate( y, m, d ), TQTime( hh, mm, ss ) ); } TQString readTNEFAddress( TQDataStream& stream ) { - Q_UINT16 totalLen, strLen, addrLen; + TQ_UINT16 totalLen, strLen, addrLen; TQString s; stream >> totalLen >> totalLen >> strLen >> addrLen; s.append( readMAPIString( stream, false, false, strLen ) ); s.append( " <" ); s.append( readMAPIString( stream, false, false, addrLen ) ); s.append( ">" ); - Q_UINT8 c; + TQ_UINT8 c; for ( int i=8+strLen+addrLen; i<totalLen; i++ ) stream >> c; return s; } -TQByteArray readTNEFData( TQDataStream& stream, Q_UINT32 len ) +TQByteArray readTNEFData( TQDataStream& stream, TQ_UINT32 len ) { TQByteArray array( len ); if ( len > 0 ) @@ -608,7 +608,7 @@ TQByteArray readTNEFData( TQDataStream& stream, Q_UINT32 len ) return array; } -TQVariant readTNEFAttribute( TQDataStream& stream, Q_UINT16 type, Q_UINT32 len ) +TQVariant readTNEFAttribute( TQDataStream& stream, TQ_UINT16 type, TQ_UINT32 len ) { switch ( type ) { @@ -624,18 +624,18 @@ TQVariant readTNEFAttribute( TQDataStream& stream, Q_UINT16 type, Q_UINT32 len ) TQString readMAPIString( TQDataStream& stream, bool isUnicode, bool align, int len_ ) { - Q_UINT32 len; + TQ_UINT32 len; char *buf = 0; if ( len_ == -1 ) stream >> len; else len = len_; - Q_UINT32 fullLen = len; + TQ_UINT32 fullLen = len; if ( align ) ALIGN( fullLen, 4 ); buf = new char[ len ]; stream.readRawBytes( buf, len ); - Q_UINT8 c; + TQ_UINT8 c; for ( uint i=len; i<fullLen; i++ ) stream >> c; TQString res; @@ -647,9 +647,9 @@ TQString readMAPIString( TQDataStream& stream, bool isUnicode, bool align, int l return res; } -Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) +TQ_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) { - Q_UINT32 d; + TQ_UINT32 d; clearMAPIValue(mapi); stream >> d; @@ -696,7 +696,7 @@ Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) break; case MAPI_TYPE_TIME: { - Q_UINT32 lowB, highB; + TQ_UINT32 lowB, highB; stream >> lowB >> highB; value = formatTime( lowB, highB ); } @@ -726,7 +726,7 @@ Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) for (uint i=0;i<d;i++) { value.clear(); - Q_UINT32 len; + TQ_UINT32 len; stream >> len; value = TQByteArray( len ); if (len > 0) @@ -734,7 +734,7 @@ Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) int fullLen = len; ALIGN(fullLen, 4); stream.readRawBytes(value.asByteArray().data(), len); - Q_UINT8 c; + TQ_UINT8 c; for ( int i=len; i<fullLen; i++ ) stream >> c; } @@ -754,7 +754,7 @@ Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi) bool KTNEFParser::readMAPIProperties( TQMap<int,KTNEFProperty*>& props, KTNEFAttach *attach ) { - Q_UINT32 n; + TQ_UINT32 n; MAPI_value mapi; KTNEFProperty *p; TQMap<int,KTNEFProperty*>::ConstIterator it; @@ -792,7 +792,7 @@ bool KTNEFParser::readMAPIProperties( TQMap<int,KTNEFProperty*>& props, KTNEFAtt int len = data.size(); ALIGN( len, 4 ); d->device_->at( d->device_->at()-len ); - Q_UINT32 interface_ID; + TQ_UINT32 interface_ID; d->stream_ >> interface_ID; if ( interface_ID == MAPI_IID_IMessage ) { diff --git a/ktnef/lib/ktnefwriter.cpp b/ktnef/lib/ktnefwriter.cpp index 48734bebd..3da4dc1e0 100644 --- a/ktnef/lib/ktnefwriter.cpp +++ b/ktnef/lib/ktnefwriter.cpp @@ -34,10 +34,10 @@ class KTNEFWriter::PrivateData { public: - PrivateData() { mFirstAttachNum = TQDateTime::currentDateTime().toTime_t(); } + PrivateData() { mFirstAttachNum = TQDateTime::tqcurrentDateTime().toTime_t(); } KTNEFPropertySet properties; - Q_UINT16 mFirstAttachNum; + TQ_UINT16 mFirstAttachNum; }; @@ -50,8 +50,8 @@ KTNEFWriter::KTNEFWriter() { addProperty( attTNEFVERSION, atpDWORD, v ); // Now set the code page to something reasonable. TODO: Use the right one - TQVariant v1( (Q_UINT32)0x4e4 ); - TQVariant v2( (Q_UINT32)0x0 ); + TQVariant v1( (TQ_UINT32)0x4e4 ); + TQVariant v2( (TQ_UINT32)0x0 ); TQValueList<TQVariant> list; list << v1; list << v2; @@ -69,25 +69,25 @@ void KTNEFWriter::addProperty( int tag, int type, const TQVariant& value ) { } -void addToChecksum( Q_UINT32 i, Q_UINT16 &checksum ) { +void addToChecksum( TQ_UINT32 i, TQ_UINT16 &checksum ) { checksum += i & 0xff; checksum += (i >> 8) & 0xff; checksum += (i >> 16) & 0xff; checksum += (i >> 24) & 0xff; } -void addToChecksum( TQCString &cs, Q_UINT16 &checksum ) { +void addToChecksum( TQCString &cs, TQ_UINT16 &checksum ) { int len = cs.length(); for (int i=0; i<len; i++) - checksum += (Q_UINT8)cs[i]; + checksum += (TQ_UINT8)cs[i]; } void writeCString( TQDataStream &stream, TQCString &str ) { stream.writeRawBytes( str.data(), str.length() ); - stream << (Q_UINT8)0; + stream << (TQ_UINT8)0; } -Q_UINT32 mergeTagAndType( Q_UINT32 tag, Q_UINT32 type ) { +TQ_UINT32 mergeTagAndType( TQ_UINT32 tag, TQ_UINT32 type ) { return ( ( type & 0xffff ) << 16 ) | ( tag & 0xffff ); } @@ -107,8 +107,8 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { KTNEFProperty *property = *it; - Q_UINT32 i; - Q_UINT16 checksum = 0; + TQ_UINT32 i; + TQ_UINT16 checksum = 0; TQValueList<TQVariant> list; TQString s; TQCString cs, cs2; @@ -117,60 +117,60 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { TQTime time; switch( tag ) { case attMSGSTATUS: - // Q_UINT8 + // TQ_UINT8 i = property->value().toUInt() & 0xff; checksum = i; - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)1; - stream << (Q_UINT8)i; + stream << (TQ_UINT32)1; + stream << (TQ_UINT8)i; bytes += 10; break; case attMSGPRIORITY: case attREQUESTRES: - // Q_UINT16 + // TQ_UINT16 i = property->value().toUInt() & 0xffff; addToChecksum( i, checksum ); - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)2; - stream << (Q_UINT16)i; + stream << (TQ_UINT32)2; + stream << (TQ_UINT16)i; bytes += 11; break; case attTNEFVERSION: - // Q_UINT32 + // TQ_UINT32 i = property->value().toUInt(); addToChecksum( i, checksum ); - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)4; - stream << (Q_UINT32)i; + stream << (TQ_UINT32)4; + stream << (TQ_UINT32)i; bytes += 13; break; case attOEMCODEPAGE: - // 2 Q_UINT32 + // 2 TQ_UINT32 list = property->value().toList(); assert( list.count() == 2 ); - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)8; + stream << (TQ_UINT32)8; i = list[0].toInt(); addToChecksum( i, checksum ); - stream << (Q_UINT32)i; + stream << (TQ_UINT32)i; i = list[1].toInt(); addToChecksum( i, checksum ); - stream << (Q_UINT32)i; + stream << (TQ_UINT32)i; bytes += 17; break; @@ -183,9 +183,9 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { cs = property->value().toString().local8Bit(); addToChecksum( cs, checksum ); - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)cs.length()+1; + stream << (TQ_UINT32)cs.length()+1; writeCString( stream, cs ); bytes += 9 + cs.length()+1; @@ -200,18 +200,18 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { cs2 = (TQString("smtp:") + list[1].toString()).local8Bit(); // Email address i = 18 + cs.length() + cs2.length(); // 2 * sizof(TRP) + strings + 2x'\0' - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)i; + stream << (TQ_UINT32)i; // The stream has to be aligned to 4 bytes for the strings // TODO: Or does it? Looks like Outlook doesn't do this // bytes += 17; // Write the first TRP structure - stream << (Q_UINT16)4; // trpidOneOff - stream << (Q_UINT16)i; // totalsize - stream << (Q_UINT16)(cs.length()+1); // sizeof name - stream << (Q_UINT16)(cs2.length()+1); // sizeof address + stream << (TQ_UINT16)4; // trpidOneOff + stream << (TQ_UINT16)i; // totalsize + stream << (TQ_UINT16)(cs.length()+1); // sizeof name + stream << (TQ_UINT16)(cs2.length()+1); // sizeof address // if ( bytes % 4 != 0 ) // Align the buffer @@ -221,7 +221,7 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { writeCString( stream, cs2 ); // Write the empty padding TRP structure (just zeroes) - stream << (Q_UINT32)0 << (Q_UINT32)0; + stream << (TQ_UINT32)0 << (TQ_UINT32)0; addToChecksum( 4, checksum ); addToChecksum( i, checksum ); @@ -241,37 +241,37 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { time = dt.time(); date = dt.date(); - stream << (Q_UINT8)LVL_MESSAGE; + stream << (TQ_UINT8)LVL_MESSAGE; stream << mergeTagAndType( tag, property->type() ); - stream << (Q_UINT32)14; + stream << (TQ_UINT32)14; - i = (Q_UINT16)date.year(); + i = (TQ_UINT16)date.year(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)date.month(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)date.month(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)date.day(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)date.day(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)time.hour(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)time.hour(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)time.minute(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)time.minute(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)time.second(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)time.second(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; - i = (Q_UINT16)date.dayOfWeek(); + stream << (TQ_UINT16)i; + i = (TQ_UINT16)date.dayOfWeek(); addToChecksum( i, checksum ); - stream << (Q_UINT16)i; + stream << (TQ_UINT16)i; break; /* case attMSGSTATUS: { - Q_UINT8 c; - Q_UINT32 flag = 0; + TQ_UINT8 c; + TQ_UINT32 flag = 0; if ( c & fmsRead ) flag |= MSGFLAG_READ; if ( !( c & fmsModified ) ) flag |= MSGFLAG_UNMODIFIED; if ( c & fmsSubmitted ) flag |= MSGFLAG_SUBMIT; @@ -280,10 +280,10 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { d->stream_ >> c; i = property->value().toUInt(); - stream << (Q_UINT8)LVL_MESSAGE; - stream << (Q_UINT32)type; - stream << (Q_UINT32)2; - stream << (Q_UINT8)i; + stream << (TQ_UINT8)LVL_MESSAGE; + stream << (TQ_UINT32)type; + stream << (TQ_UINT32)2; + stream << (TQ_UINT8)i; addToChecksum( i, checksum ); // from reader: d->message_->addProperty( 0x0E07, MAPI_TYPE_ULONG, flag ); } @@ -296,7 +296,7 @@ bool KTNEFWriter::writeProperty( TQDataStream &stream, int &bytes, int tag) { return false; } - stream << (Q_UINT16)checksum; + stream << (TQ_UINT16)checksum; return true; } @@ -485,7 +485,7 @@ void KTNEFWriter::setSummary( const TQString &s ) { // TNEF encoding: Normal = 3, high = 2, low = 1 // MAPI encoding: Normal = -1, high = 0, low = 1 void KTNEFWriter::setPriority( Priority p ) { - TQVariant v( (Q_UINT32)p ); + TQVariant v( (TQ_UINT32)p ); addProperty( attMSGPRIORITY, atpSHORT, v ); } |