summaryrefslogtreecommitdiffstats
path: root/ktnef/lib/ktnefparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ktnef/lib/ktnefparser.cpp')
-rw-r--r--ktnef/lib/ktnefparser.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/ktnef/lib/ktnefparser.cpp b/ktnef/lib/ktnefparser.cpp
index 0c9881400..e97ec8128 100644
--- a/ktnef/lib/ktnefparser.cpp
+++ b/ktnef/lib/ktnefparser.cpp
@@ -24,10 +24,10 @@
#include "ktnef/ktnefproperty.h"
#include "ktnef/ktnefmessage.h"
-#include <qdatetime.h>
-#include <qdatastream.h>
-#include <qfile.h>
-#include <qvariant.h>
+#include <tqdatetime.h>
+#include <tqdatastream.h>
+#include <tqfile.h>
+#include <tqvariant.h>
#include <kdebug.h>
#include <kmimetype.h>
#include <ksavefile.h>
@@ -42,23 +42,23 @@
typedef struct {
Q_UINT16 type;
Q_UINT16 tag;
- QVariant value;
+ TQVariant value;
struct {
Q_UINT32 type;
- QVariant value;
+ TQVariant value;
} name;
} MAPI_value;
void clearMAPIName( MAPI_value& mapi );
void clearMAPIValue(MAPI_value& mapi, bool clearName = true);
-QString readMAPIString( QDataStream& stream, bool isUnicode = false, bool align = true, int len = -1 );
-Q_UINT16 readMAPIValue(QDataStream& stream, MAPI_value& mapi);
-QDateTime readTNEFDate( QDataStream& stream );
-QString readTNEFAddress( QDataStream& stream );
-QByteArray readTNEFData( QDataStream& stream, Q_UINT32 len );
-QVariant readTNEFAttribute( QDataStream& stream, Q_UINT16 type, Q_UINT32 len );
-QDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB );
-QString formatRecipient( const QMap<int,KTNEFProperty*>& props );
+TQString readMAPIString( TQDataStream& stream, bool isUnicode = false, bool align = true, int len = -1 );
+Q_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 );
+TQString formatRecipient( const TQMap<int,KTNEFProperty*>& props );
//------------------------------------------------------------------------------------
@@ -78,10 +78,10 @@ public:
delete message_;
}
- QDataStream stream_;
- QIODevice *device_;
+ TQDataStream stream_;
+ TQIODevice *device_;
bool deleteDevice_;
- QString defaultdir_;
+ TQString defaultdir_;
KTNEFAttach *current_;
KTNEFMessage *message_;
};
@@ -114,7 +114,7 @@ bool KTNEFParser::decodeMessage()
{
Q_UINT32 i1, i2, off;
Q_UINT16 u, tag, type;
- QVariant value;
+ TQVariant value;
// read (type+name)
d->stream_ >> i1;
@@ -162,7 +162,7 @@ bool KTNEFParser::decodeMessage()
readMAPIProperties( d->message_->properties(), 0 );
d->device_->at( i2 );
kdDebug() << "Properties: " << d->message_->properties().count() << endl;
- value = QString( "< %1 properties >" ).arg( d->message_->properties().count() - nProps );
+ value = TQString( "< %1 properties >" ).arg( d->message_->properties().count() - nProps );
}
break;
case attTNEFVERSION:
@@ -203,11 +203,11 @@ bool KTNEFParser::decodeMessage()
case attRECIPTABLE:
{
Q_UINT32 rows;
- QValueList<QVariant> recipTable;
+ TQValueList<TQVariant> recipTable;
d->stream_ >> rows;
for ( uint i=0; i<rows; i++ )
{
- QMap<int,KTNEFProperty*> props;
+ TQMap<int,KTNEFProperty*> props;
readMAPIProperties( props, 0 );
recipTable << formatRecipient( props );
}
@@ -256,8 +256,8 @@ bool KTNEFParser::decodeAttachment()
{
Q_UINT32 i;
Q_UINT16 tag, type, u;
- QVariant value;
- QString str;
+ TQVariant value;
+ TQString str;
d->stream_ >> i; // i <- attribute type & name
tag = ( i & 0x0000FFFF );
@@ -275,7 +275,7 @@ bool KTNEFParser::decodeAttachment()
d->current_->setSize( i );
d->current_->setOffset( d->device_->at() );
d->device_->at( d->device_->at() + i );
- value = QString( "< size=%1 >" ).arg( i );
+ value = TQString( "< size=%1 >" ).arg( i );
kdDebug() << "Attachment Data: size=" << i << endl;
break;
case attATTACHMENT: // try to get attachment info
@@ -292,7 +292,7 @@ bool KTNEFParser::decodeAttachment()
if ( !str.isEmpty() )
d->current_->setMimeTag( str );
d->current_->setExtension( d->current_->property( MAPI_TAG_EXTENSION ).toString() );
- value = QString( "< %1 properties >" ).arg( d->current_->properties().count() );
+ value = TQString( "< %1 properties >" ).arg( d->current_->properties().count() );
break;
case attATTACHMODDATE:
value = readTNEFDate( d->stream_ );
@@ -304,7 +304,7 @@ bool KTNEFParser::decodeAttachment()
break;
case attATTACHMETAFILE:
kdDebug() << "Attachment Metafile: size=" << i << endl;
- //value = QString( "< size=%1 >" ).arg( i );
+ //value = TQString( "< size=%1 >" ).arg( i );
//d->device_->at( d->device_->at()+i );
value = readTNEFData( d->stream_, i );
break;
@@ -321,7 +321,7 @@ bool KTNEFParser::decodeAttachment()
return true;
}
-void KTNEFParser::setDefaultExtractDir(const QString& dirname)
+void KTNEFParser::setDefaultExtractDir(const TQString& dirname)
{
d->defaultdir_ = dirname;
}
@@ -345,7 +345,7 @@ bool KTNEFParser::parseDevice()
}
d->stream_.setDevice( d->device_ );
- d->stream_.setByteOrder( QDataStream::LittleEndian );
+ d->stream_.setByteOrder( TQDataStream::LittleEndian );
d->stream_ >> i;
if (i == TNEF_SIGNATURE)
{
@@ -386,14 +386,14 @@ end: d->device_->close();
}
}
-bool KTNEFParser::extractFile(const QString& filename)
+bool KTNEFParser::extractFile(const TQString& filename)
{
KTNEFAttach *att = d->message_->attachment(filename);
if (!att) return false;
return extractAttachmentTo(att, d->defaultdir_);
}
-bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const QString& dirname)
+bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const TQString& dirname)
{
QString filename = dirname + "/" + att->name();
if (!d->device_->isOpen())
@@ -401,7 +401,7 @@ bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const QString& dirname)
if (!d->device_->at(att->offset()))
return false;
KSaveFile saveFile( filename );
- QFile *outfile = saveFile.file();
+ TQFile *outfile = saveFile.file();
if ( !outfile )
return false;
@@ -428,13 +428,13 @@ bool KTNEFParser::extractAttachmentTo(KTNEFAttach *att, const QString& dirname)
bool KTNEFParser::extractAll()
{
- QPtrListIterator<KTNEFAttach> it(d->message_->attachmentList());
+ TQPtrListIterator<KTNEFAttach> it(d->message_->attachmentList());
for (;it.current();++it)
if (!extractAttachmentTo(it.current(),d->defaultdir_)) return false;
return true;
}
-bool KTNEFParser::extractFileTo(const QString& filename, const QString& dirname)
+bool KTNEFParser::extractFileTo(const TQString& filename, const TQString& dirname)
{
kdDebug() << "Extracting attachment: filename=" << filename << ", dir=" << dirname << endl;
KTNEFAttach *att = d->message_->attachment(filename);
@@ -442,17 +442,17 @@ bool KTNEFParser::extractFileTo(const QString& filename, const QString& dirname)
return extractAttachmentTo(att, dirname);
}
-bool KTNEFParser::openFile(const QString& filename)
+bool KTNEFParser::openFile(const TQString& filename)
{
deleteDevice();
delete d->message_;
d->message_ = new KTNEFMessage();
- d->device_ = new QFile( filename );
+ d->device_ = new TQFile( filename );
d->deleteDevice_ = true;
return parseDevice();
}
-bool KTNEFParser::openDevice( QIODevice *device )
+bool KTNEFParser::openDevice( TQIODevice *device )
{
deleteDevice();
d->device_ = device;
@@ -483,7 +483,7 @@ void KTNEFParser::checkCurrent( int key )
if ( mimetype->name() == "application/octet-stream" && d->current_->size() > 0 )
{
int oldOffset = d->device_->at();
- QByteArray buffer( QMIN( 32, d->current_->size() ) );
+ TQByteArray buffer( QMIN( 32, d->current_->size() ) );
d->device_->at( d->current_->offset() );
d->device_->readBlock( buffer.data(), buffer.size() );
mimetype = KMimeType::findByContent( buffer );
@@ -521,9 +521,9 @@ void clearMAPIValue(MAPI_value& mapi, bool clearName)
clearMAPIName( mapi );
}
-QDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB )
+TQDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB )
{
- QDateTime dt;
+ TQDateTime dt;
#if ( SIZEOF_UINT64_T == 8 )
uint64_t u64;
#elif ( SIZEOF_UNSIGNED_LONG_LONG == 8 )
@@ -550,10 +550,10 @@ QDateTime formatTime( Q_UINT32 lowB, Q_UINT32 highB )
return dt;
}
-QString formatRecipient( const QMap<int,KTNEFProperty*>& props )
+TQString formatRecipient( const TQMap<int,KTNEFProperty*>& props )
{
- QString s, dn, addr, t;
- QMap<int,KTNEFProperty*>::ConstIterator it;
+ TQString s, dn, addr, t;
+ TQMap<int,KTNEFProperty*>::ConstIterator it;
if ( ( it = props.find( 0x3001 ) ) != props.end() )
dn = ( *it )->valueString();
if ( ( it = props.find( 0x3003 ) ) != props.end() )
@@ -577,18 +577,18 @@ QString formatRecipient( const QMap<int,KTNEFProperty*>& props )
return s.stripWhiteSpace();
}
-QDateTime readTNEFDate( QDataStream& stream )
+TQDateTime readTNEFDate( TQDataStream& stream )
{
// 14-bytes long
Q_UINT16 y, m, d, hh, mm, ss, dm;
stream >> y >> m >> d >> hh >> mm >> ss >> dm;
- return QDateTime( QDate( y, m, d ), QTime( hh, mm, ss ) );
+ return TQDateTime( TQDate( y, m, d ), TQTime( hh, mm, ss ) );
}
-QString readTNEFAddress( QDataStream& stream )
+TQString readTNEFAddress( TQDataStream& stream )
{
Q_UINT16 totalLen, strLen, addrLen;
- QString s;
+ TQString s;
stream >> totalLen >> totalLen >> strLen >> addrLen;
s.append( readMAPIString( stream, false, false, strLen ) );
s.append( " <" );
@@ -600,15 +600,15 @@ QString readTNEFAddress( QDataStream& stream )
return s;
}
-QByteArray readTNEFData( QDataStream& stream, Q_UINT32 len )
+TQByteArray readTNEFData( TQDataStream& stream, Q_UINT32 len )
{
- QByteArray array( len );
+ TQByteArray array( len );
if ( len > 0 )
stream.readRawBytes( array.data(), len );
return array;
}
-QVariant readTNEFAttribute( QDataStream& stream, Q_UINT16 type, Q_UINT32 len )
+TQVariant readTNEFAttribute( TQDataStream& stream, Q_UINT16 type, Q_UINT32 len )
{
switch ( type )
{
@@ -622,7 +622,7 @@ QVariant readTNEFAttribute( QDataStream& stream, Q_UINT16 type, Q_UINT32 len )
}
}
-QString readMAPIString( QDataStream& stream, bool isUnicode, bool align, int len_ )
+TQString readMAPIString( TQDataStream& stream, bool isUnicode, bool align, int len_ )
{
Q_UINT32 len;
char *buf = 0;
@@ -638,16 +638,16 @@ QString readMAPIString( QDataStream& stream, bool isUnicode, bool align, int len
Q_UINT8 c;
for ( uint i=len; i<fullLen; i++ )
stream >> c;
- QString res;
+ TQString res;
if ( isUnicode )
- res = QString::fromUcs2( ( const unsigned short* )buf );
+ res = TQString::fromUcs2( ( const unsigned short* )buf );
else
- res = QString::fromLocal8Bit( buf );
+ res = TQString::fromLocal8Bit( buf );
delete [] buf;
return res;
}
-Q_UINT16 readMAPIValue(QDataStream& stream, MAPI_value& mapi)
+Q_UINT16 readMAPIValue(TQDataStream& stream, MAPI_value& mapi)
{
Q_UINT32 d;
@@ -669,11 +669,11 @@ Q_UINT16 readMAPIValue(QDataStream& stream, MAPI_value& mapi)
}
int n = 1;
- QVariant value;
+ TQVariant value;
if ( ISVECTOR( mapi ) )
{
stream >> n;
- mapi.value = QValueList<QVariant>();
+ mapi.value = TQValueList<TQVariant>();
}
for ( int i=0; i<n; i++ )
{
@@ -728,7 +728,7 @@ Q_UINT16 readMAPIValue(QDataStream& stream, MAPI_value& mapi)
value.clear();
Q_UINT32 len;
stream >> len;
- value = QByteArray( len );
+ value = TQByteArray( len );
if (len > 0)
{
int fullLen = len;
@@ -752,12 +752,12 @@ Q_UINT16 readMAPIValue(QDataStream& stream, MAPI_value& mapi)
return mapi.tag;
}
-bool KTNEFParser::readMAPIProperties( QMap<int,KTNEFProperty*>& props, KTNEFAttach *attach )
+bool KTNEFParser::readMAPIProperties( TQMap<int,KTNEFProperty*>& props, KTNEFAttach *attach )
{
Q_UINT32 n;
MAPI_value mapi;
KTNEFProperty *p;
- QMap<int,KTNEFProperty*>::ConstIterator it;
+ TQMap<int,KTNEFProperty*>::ConstIterator it;
bool foundAttachment = false;
// some initializations
@@ -788,7 +788,7 @@ bool KTNEFParser::readMAPIProperties( QMap<int,KTNEFProperty*>& props, KTNEFAtta
{
if ( mapi.type == MAPI_TYPE_OBJECT && attach )
{
- QByteArray data = mapi.value.toByteArray();
+ TQByteArray data = mapi.value.toByteArray();
int len = data.size();
ALIGN( len, 4 );
d->device_->at( d->device_->at()-len );
@@ -814,20 +814,20 @@ bool KTNEFParser::readMAPIProperties( QMap<int,KTNEFProperty*>& props, KTNEFAtta
ALIGN( len, 4 )
attach->setSize( len );
attach->setOffset( d->device_->at() - len );
- attach->addAttribute( attATTACHDATA, atpBYTE, QString( "< size=%1 >" ).arg( len ), false );
+ attach->addAttribute( attATTACHDATA, atpBYTE, TQString( "< size=%1 >" ).arg( len ), false );
}
}
kdDebug().form( "MAPI data: size=%d\n", mapi.value.toByteArray().size() );
break;
default:
{
- QString mapiname = "";
+ TQString mapiname = "";
if ( mapi.tag >= 0x8000 && mapi.tag <= 0xFFFE )
{
if ( mapi.name.type == 0 )
- mapiname = QString().sprintf( " [name = 0x%04x]", mapi.name.value.toUInt() );
+ mapiname = TQString().sprintf( " [name = 0x%04x]", mapi.name.value.toUInt() );
else
- mapiname = QString( " [name = %1]" ).arg( mapi.name.value.toString() );
+ mapiname = TQString( " [name = %1]" ).arg( mapi.name.value.toString() );
}
switch ( mapi.type & 0x0FFF )
{
@@ -867,7 +867,7 @@ bool KTNEFParser::readMAPIProperties( QMap<int,KTNEFProperty*>& props, KTNEFAtta
{
attach->setIndex( attach->property( MAPI_TAG_INDEX ).toUInt() );
attach->setDisplaySize( attach->property( MAPI_TAG_SIZE ).toUInt() );
- QString str = attach->property( MAPI_TAG_DISPLAYNAME ).toString();
+ TQString str = attach->property( MAPI_TAG_DISPLAYNAME ).toString();
if ( !str.isEmpty() )
attach->setDisplayName( str );
attach->setFileName( attach->property( MAPI_TAG_FILENAME ).toString() );