|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 #ifndef QMESSAGECONTENTCONTAINER_P_H |
|
42 #define QMESSAGECONTENTCONTAINER_P_H |
|
43 |
|
44 #include "qmessagecontentcontainer.h" |
|
45 #include "qmessage.h" |
|
46 |
|
47 #include <QList> |
|
48 #include <QMultiMap> |
|
49 |
|
50 QTM_BEGIN_NAMESPACE |
|
51 class QMessageContentContainerPrivate |
|
52 { |
|
53 Q_DECLARE_PUBLIC(QMessageContentContainer) |
|
54 |
|
55 public: |
|
56 |
|
57 |
|
58 QMessageContentContainer *q_ptr; |
|
59 QMessage *_message; |
|
60 |
|
61 bool _available; |
|
62 int _size; |
|
63 QByteArray _type; |
|
64 QByteArray _subType; |
|
65 QByteArray _charset; |
|
66 QByteArray _name; |
|
67 QByteArray _content; |
|
68 QString _textContent; |
|
69 QByteArray _filename; |
|
70 QMessageId _messageId; |
|
71 QMessageContentContainerId _id; |
|
72 QList<QMessageContentContainer> _attachments; |
|
73 QMultiMap<QByteArray, QString> _header; |
|
74 |
|
75 QString _containingMessageId; |
|
76 QString _attachmentId; |
|
77 |
|
78 QMessageContentContainerPrivate(QMessageContentContainer *contentContainer) |
|
79 : |
|
80 q_ptr(contentContainer), _message(0), _available(false), _size(0) |
|
81 |
|
82 { |
|
83 } |
|
84 |
|
85 QMessageContentContainerPrivate(const QMessageContentContainerPrivate& other) |
|
86 : |
|
87 q_ptr(other.q_ptr), _message(other._message), _available(other._available), |
|
88 _size(other._size), _type(other._type), _subType(other._subType), |
|
89 _charset(other._charset), _name(other._name), _content(other._content), |
|
90 _textContent(other._textContent), _filename(other._filename), _messageId(other._messageId), |
|
91 _id(other._id), _attachments(other._attachments), _header(other._header), |
|
92 _containingMessageId(other._containingMessageId), _attachmentId(other._attachmentId) |
|
93 { |
|
94 } |
|
95 |
|
96 QMessageContentContainerPrivate& operator=(const QMessageContentContainerPrivate &other); |
|
97 |
|
98 bool isMessage() const; |
|
99 |
|
100 void setDerivedMessage(QMessage *derived); |
|
101 |
|
102 void clearContents(); |
|
103 |
|
104 QMessageContentContainer* attachment(const QMessageContentContainerId &id); |
|
105 |
|
106 const QMessageContentContainer* attachment(const QMessageContentContainerId &id) const; |
|
107 |
|
108 void setContentType(const QByteArray &type, const QByteArray &subType, const QByteArray &charset); |
|
109 |
|
110 void setContent(const QString &content, const QByteArray &type, const QByteArray &subType, const QByteArray &charset); |
|
111 |
|
112 void setContent(const QByteArray &content, const QByteArray &type, const QByteArray &subType, const QByteArray &charset); |
|
113 |
|
114 void setHeaderField(const QByteArray &name, const QByteArray &value); |
|
115 |
|
116 bool createAttachment(const QString& attachmentPath); |
|
117 |
|
118 QMessageContentContainerId appendContent(QMessageContentContainer& container); |
|
119 |
|
120 QMessageContentContainerId prependContent(QMessageContentContainer& container); |
|
121 |
|
122 static QMessageContentContainerId bodyContentId(); |
|
123 |
|
124 static QByteArray attachmentFilename(const QMessageContentContainer& container); |
|
125 |
|
126 static QMessageContentContainer from(QString &messageId, QString &attachmentId, QByteArray &name, |
|
127 QByteArray &mimeType, QByteArray &mimeSubType, int size); |
|
128 |
|
129 static QMessageContentContainerPrivate* implementation(const QMessageContentContainer &container); |
|
130 }; |
|
131 |
|
132 QTM_END_NAMESPACE |
|
133 |
|
134 #endif |