blob: 27f98606e654c3ccbd57f72015bc0907a9cb810d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*
ktnefmessage.cpp
Copyright (C) 2002 Michael Goffioul <[email protected]>
This file is part of KTNEF, the KDE TNEF support library/program.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ktnef/ktnefmessage.h"
#include "ktnef/ktnefattach.h"
#include "lzfu.h"
#include <tqbuffer.h>
class KTNEFMessage::MessagePrivate
{
public:
MessagePrivate()
{
attachments_.setAutoDelete( true );
}
TQPtrList<KTNEFAttach> attachments_;
};
KTNEFMessage::KTNEFMessage()
{
d = new MessagePrivate;
}
KTNEFMessage::~KTNEFMessage()
{
delete d;
}
const TQPtrList<KTNEFAttach>& KTNEFMessage::attachmentList() const
{
return d->attachments_;
}
KTNEFAttach* KTNEFMessage::attachment( const TQString& filename ) const
{
TQPtrListIterator<KTNEFAttach> it( d->attachments_ );
for ( ; it.current(); ++it )
if ( it.current()->name() == filename )
return it.current();
return 0;
}
void KTNEFMessage::addAttachment( KTNEFAttach *attach )
{
d->attachments_.append( attach );
}
void KTNEFMessage::clearAttachments()
{
d->attachments_.clear();
}
TQString KTNEFMessage::rtfString()
{
TQVariant prop = property( 0x1009 );
if ( prop.isNull() || prop.type() != TQVariant::ByteArray)
return TQString();
else
{
TQByteArray rtf;
TQBuffer input( prop.asByteArray() ), output( rtf );
if ( input.open( IO_ReadOnly ) && output.open( IO_WriteOnly ) )
lzfu_decompress( &TQT_TQIODEVICE_OBJECT(input), &TQT_TQIODEVICE_OBJECT(output) );
return TQString( rtf );
}
}
|