1/*
2 ktnefattach.h
3
4 Copyright (C) 2002 Michael Goffioul <kdeprint@swing.be>
5
6 This file is part of KTNEF, the KDE TNEF support library/program.
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22 */
23/**
24 * @file
25 * This file is part of the API for handling TNEF data and
26 * defines the KTNEFAttach class.
27 *
28 * @author Michael Goffioul
29 */
30
31#ifndef KTNEFATTACH_H
32#define KTNEFATTACH_H
33
34#include <QtCore/QMap>
35#include <QtCore/QString>
36#include <QtCore/QVariant>
37
38#include "ktnefpropertyset.h"
39#include "ktnef_export.h"
40
41namespace KTnef {
42 class KTNEFProperty;
43}
44
45namespace KTnef {
46
47/**
48 * @brief
49 * Represents a @acronym TNEF attachment.
50 */
51class KTNEF_EXPORT KTNEFAttach : public KTNEFPropertySet
52{
53 public:
54 /**
55 * The different attachment parsed states.
56 */
57 enum ParseState {
58 Unparsed = 0x0000, /**< Unparsed */
59 TitleParsed = 0x0001, /**< The title is parsed */
60 DataParsed = 0x0002, /**< The data is parsed */
61 InfoParsed = 0x0004 /**< The info is parsed */
62 };
63
64 /**
65 * Constructs a @acronym TNEF attachment.
66 */
67 KTNEFAttach();
68
69 /**
70 * Destroys the @acronym TNEF attachment.
71 */
72 ~KTNEFAttach();
73
74 /**
75 * Sets the #TitleParsed flag for this attachment.
76 */
77 void setTitleParsed();
78
79 /**
80 * Sets the #DataParsed flag for this attachment.
81 */
82 void setDataParsed();
83
84 /**
85 * Unsets the #DataParsed flag for this attachment.
86 */
87 void unsetDataParser();
88
89 /**
90 * Sets the #InfoParsed flag for this attachment.
91 */
92 void setInfoParsed();
93
94 /**
95 * Returns true if the #TitleParsed flag is set; else returns false.
96 */
97 bool titleParsed() const;
98
99 /**
100 * Returns true if the ParseState::DataParsed flag is set; else returns false.
101 */
102 bool dataParsed() const;
103
104 /**
105 * Returns true if the #InfoParsed flag is set; else returns false.
106 */
107 bool infoParsed() const;
108
109 /**
110 * Sets/Unsets the attachment state according to the @p state flag
111 * must be a #ParseState type.
112 *
113 * @param state a #ParseState type.
114 * @return true if the state is turned-on; else returns false.
115 */
116 bool checkState( int state ) const;
117
118 /**
119 * Sets the offset value of this attachment to @p offset.
120 *
121 * @param offset is the attachment offset to set.
122 */
123 void setOffset( int offset );
124
125 /**
126 * Returns the offset value of the attachment.
127 */
128 int offset() const;
129
130 /**
131 * Sets the size of the attachment to @p size.
132 *
133 * @param size is the attachment size to set.
134 */
135 void setSize( int size );
136
137 /**
138 * Returns the size of the attachment.
139 */
140 int size() const;
141
142 /**
143 * Sets the display size of the attachment to @p size.
144 *
145 * @param size is the attachment display size to set.
146 */
147 void setDisplaySize( int size );
148
149 /**
150 * Returns the display size of the attachment.
151 */
152 int displaySize() const;
153
154 /**
155 * Sets the name of this attachment to @p str.
156 *
157 * @param str is attachment name to set.
158 */
159 void setName( const QString &str );
160
161 /**
162 * Returns the name of the attachment.
163 */
164 QString name() const;
165
166 /**
167 * Sets the index of this attachment to @p indx.
168 *
169 * @param indx is the attachment index to set.
170 */
171 void setIndex( int indx );
172
173 /**
174 * Returns the index of the attachment.
175 */
176 int index() const;
177
178 /**
179 * Sets the filename of this attachment to @p str.
180 *
181 * @param str is the attachment filename to set.
182 */
183 void setFileName( const QString &str );
184
185 /**
186 * Returns the filename of the attachment.
187 */
188 QString fileName() const;
189
190 /**
191 * Sets the display name of this attachment to @p str.
192 *
193 * @param str is the attachment display name to set.
194 */
195 void setDisplayName( const QString &str );
196
197 /**
198 * Returns the display name of the attachment.
199 */
200 QString displayName() const;
201
202 /**
203 * Sets the @acronym MIME tag of this attachment to @p str.
204 *
205 * @param str is the attachment @acronym MIME tag to set.
206 */
207 void setMimeTag( const QString &str );
208
209 /**
210 * Returns the @acronym MIME tag of the attachment.
211 */
212 QString mimeTag() const;
213
214 /**
215 * Sets the filename extension of this attachment to @p str.
216 *
217 * @param str is the attachment filename extension to set.
218 */
219 void setExtension( const QString &str );
220
221 /**
222 * Returns the filename extension of the attachment.
223 */
224 QString extension() const;
225
226 private:
227 //@cond PRIVATE
228 class AttachPrivate;
229 AttachPrivate *const d;
230 //@endcond
231
232 Q_DISABLE_COPY( KTNEFAttach )
233};
234
235}
236#endif
237