Warning: That file was not part of the compilation database. It may have many parsing errors.

1/*
2 This file is part of the kcal library.
3
4 Copyright (c) 2002 Michael Brade <brade@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21/**
22 @file
23 This file is part of the API for handling calendar data and
24 defines the Attachment class.
25
26 @author Michael Brade \<brade@kde.org\>
27*/
28
29#ifndef KCAL_ATTACHMENT_H
30#define KCAL_ATTACHMENT_H
31
32#include "listbase.h"
33#include "kcal_export.h"
34
35#include <QtCore/QString>
36
37namespace KCal {
38
39/**
40 @brief
41 Represents information related to an attachment for a Calendar Incidence.
42
43 This is not an email message attachment.
44
45 Calendar Incidence attachments consist of:
46 - A <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Identifier">
47 Uniform Resource Identifier (URI)</a>
48 or a
49 <a href="http://en.wikipedia.org/wiki/Base64#MIME">base64 encoded</a>
50 binary blob.
51 - A <a href="http://en.wikipedia.org/wiki/MIME">
52 Multipurpose Internet Mail Extensions (MIME)</a> type.
53
54 This class is used to associate files (local or remote) or other resources
55 with a Calendar Incidence.
56*/
57class KCAL_DEPRECATED_EXPORT Attachment
58{
59 public:
60 /**
61 List of attachments.
62 */
63 typedef ListBase<Attachment> List;
64
65 /**
66 Constructs an attachment consisting of a @p uri and a @p mime type.
67
68 @param uri is the @acronym URI referred to by this attachment.
69 @param mime is the (optional) @acronym MIME type of the @p uri
70 */
71 explicit Attachment( const QString &uri, const QString &mime = QString() );
72
73 /**
74 Constructs an attachment consisting of a binary blob of data
75 and a @p mime type.
76
77 @param base64 is the binary data in base64 format for the attachment.
78 @param mime is the (optional) @acronym MIME type of the attachment
79 */
80 explicit Attachment( const char *base64, const QString &mime = QString() );
81
82 /**
83 Constructs an attachment by copying another attachment.
84
85 @param attachment is the attachment to be copied.
86 */
87 Attachment( const Attachment &attachment );
88
89 /**
90 Destroys the attachment.
91 */
92 ~Attachment();
93
94 /**
95 Sets the @acronym URI for this attachment to @p uri.
96
97 @param uri is the @acronym URI to use for the attachment.
98
99 @see uri(), isUri()
100 */
101 void setUri( const QString &uri );
102
103 /**
104 Returns the @acronym URI of the attachment.
105
106 @see setUri(), isUri()
107 */
108 QString uri() const;
109
110 /**
111 Returns true if the attachment has a @acronym URI; false otherwise.
112
113 @see uri(), setUri(I), isBinary()
114 */
115 bool isUri() const;
116
117 /**
118 Returns true if the attachment has a binary blob; false otherwise.
119
120 @see isUri()
121 */
122 bool isBinary() const;
123
124 /**
125 Sets the base64 encoded binary blob data of the attachment.
126
127 @param base64 is a character string containing base64 encoded binary data.
128
129 @see data(), decodedData()
130 */
131 void setData( const char *base64 );
132
133 /**
134 Returns a pointer to a character string containing the base64 encoded
135 binary data of the attachment.
136
137 @see setData(), setDecodedData()
138 */
139 char *data() const;
140
141 /**
142 Sets the decoded attachment data.
143
144 @param data is the decoded base64 binary data.
145
146 @see decodedData(), data()
147 */
148 void setDecodedData( const QByteArray &data );
149
150 /**
151 Returns a QByteArray containing the decoded base64 binary data of the
152 attachment.
153
154 @see setDecodedData(), setData()
155 */
156 QByteArray &decodedData() const;
157
158 /**
159 Returns the size of the attachment, in bytes.
160 If the attachment is binary (i.e, there is no @acronym URI associated
161 with the attachment) then a value of 0 is returned.
162 */
163 uint size() const;
164
165 /**
166 Sets the @acronym MIME-type of the attachment to @p mime.
167
168 @param mime is the string to use for the attachment @acronym MIME-type.
169
170 @see mimeType()
171 */
172 void setMimeType( const QString &mime );
173
174 /**
175 Returns the @acronym MIME-type of the attachment.
176
177 @see setMimeType()
178 */
179 QString mimeType() const;
180
181 /**
182 Sets the attachment "show in-line" option, which is derived from
183 the Calendar Incidence @b X-CONTENT-DISPOSITION parameter.
184
185 @param showinline is the flag to set (true) or unset (false)
186 for the attachment "show in-line" option.
187
188 @see showInline()
189 */
190 void setShowInline( bool showinline );
191
192 /**
193 Returns the attachment "show in-line" flag.
194
195 @see setShowInline()
196 */
197 bool showInline() const;
198
199 /**
200 Sets the attachment label to @p label, which is derived from
201 the Calendar Incidence @b X-LABEL parameter.
202
203 @param label is the string to use for the attachment label.
204
205 @see label()
206 */
207 void setLabel( const QString &label );
208
209 /**
210 Returns the attachment label string.
211 */
212 QString label() const;
213
214 /**
215 Sets the attachment "local" option, which is derived from the
216 Calendar Incidence @b X-KONTACT-TYPE parameter.
217
218 @param local is the flag to set (true) or unset (false) for the
219 attachment "local" option.
220
221 @see local()
222 */
223 void setLocal( bool local );
224
225 /**
226 Returns the attachment "local" flag.
227 */
228 bool isLocal() const;
229
230 /**
231 Returns true if two attachments are equal
232 @since 4.3
233 */
234 bool operator==( const Attachment &a2 ) const;
235
236 /**
237 Returns true if two attachments aren't equal
238 @since 4.3
239 */
240 bool operator!=( const Attachment &a2 ) const;
241
242 private:
243 //@cond PRIVATE
244 class Private;
245 Private *const d;
246 //@endcond
247};
248
249}
250
251#endif
252

Warning: That file was not part of the compilation database. It may have many parsing errors.