2 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef KDEPIM_ATTACHMENTPART_H
21 #define KDEPIM_ATTACHMENTPART_H
23 #include "messagecore_export.h"
25 #include <boost/shared_ptr.hpp>
27 #include <QtCore/QList>
28 #include <QtCore/QMetaType>
30 #include <kmime/kmime_headers.h>
34 class MESSAGECORE_EXPORT AttachmentPart
37 //typedef QList<AttachmentPart*> List;
38 typedef boost::shared_ptr
<AttachmentPart
> Ptr
;
39 typedef QList
<Ptr
> List
;
42 virtual ~AttachmentPart();
44 /// the name= in Content-Type
46 void setName( const QString
&name
);
47 /// the filename= in Content-Disposition
48 QString
fileName() const;
49 void setFileName( const QString
&name
);
50 QString
description() const;
51 void setDescription( const QString
&description
);
52 // otherwise "attachment"
53 bool isInline() const; // Perhaps rename to autoDisplay, since the users of
54 // this class aren't supposed to know MIME?
55 void setInline( bool inl
);
57 bool isAutoEncoding() const;
58 void setAutoEncoding( bool enabled
);
59 // only if isAutoEncoding false
60 KMime::Headers::contentEncoding
encoding() const;
61 void setEncoding( KMime::Headers::contentEncoding encoding
);
62 QByteArray
charset() const;
63 void setCharset( const QByteArray
&charset
);
64 QByteArray
mimeType() const;
65 void setMimeType( const QByteArray
&mimeType
);
66 bool isCompressed() const;
67 void setCompressed( bool compressed
);
68 bool isEncrypted() const;
69 void setEncrypted( bool encrypted
);
70 bool isSigned() const;
71 void setSigned( bool sign
);
72 QByteArray
data() const;
73 void setData( const QByteArray
&data
);
76 // TODO outlook-compatible names...
83 // FIXME I don't understand why this doesn't work if I put it outside namespace KPIM.
84 MESSAGECORE_EXPORT uint
qHash( const boost::shared_ptr
<KPIM::AttachmentPart
> &ptr
);
88 Q_DECLARE_METATYPE( KPIM::AttachmentPart::Ptr
)