22 #include "attachment.h"
29 mSize = attachment.mSize;
30 mMimeType = attachment.mMimeType;
31 mUri = attachment.mUri;
32 mData = tqstrdup( attachment.mData );
33 mLabel = attachment.mLabel;
34 mBinary = attachment.mBinary;
35 mLocal = attachment.mLocal;
36 mShowInline = attachment.mShowInline;
54 mData = tqstrdup( base64 );
60 Attachment::~Attachment()
65 bool Attachment::isUri()
const
70 TQString Attachment::uri()
const
79 void Attachment::setUri(
const TQString &uri )
85 bool Attachment::isBinary()
const
90 char *Attachment::data()
const
99 TQByteArray &Attachment::decodedData()
101 if ( mDataCache.isNull() && mData ) {
105 encoded.duplicate( mData, strlen( mData ) );
107 KCodecs::base64Decode( encoded, decoded );
108 mDataCache = decoded;
114 void Attachment::setDecodedData(
const TQByteArray &data )
117 KCodecs::base64Encode( data, encoded );
119 encoded.resize( encoded.count() + 1 );
120 encoded[encoded.count()-1] =
'\0';
122 setData( encoded.data() );
124 mSize = mDataCache.size();
127 void Attachment::setData(
const char *base64 )
130 mData = tqstrdup( base64 );
132 mDataCache = TQByteArray();
136 uint Attachment::size()
142 mSize = decodedData().size();
148 TQString Attachment::mimeType()
const
153 void Attachment::setMimeType(
const TQString& mime)
158 bool Attachment::showInline()
const
163 void Attachment::setShowInline(
bool showinline )
165 mShowInline = showinline;
168 TQString Attachment::label()
const
173 void Attachment::setLabel(
const TQString& label )