Akonadi Notes

noteutils.h
1 /* This file is part of the KDE project
2  SPDX-FileCopyrightText: 2011 Christian Mollekopf <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef NOTEUTILS_H
8 #define NOTEUTILS_H
9 
10 #include "akonadi-notes_export.h"
11 
12 #include <QUrl>
13 #include <QMap>
14 class QDateTime;
15 class QString;
16 
17 template <typename T> class QSharedPointer;
18 
19 namespace KMime
20 {
21 class Message;
22 typedef QSharedPointer<Message> MessagePtr;
23 }
24 namespace Akonadi
25 {
26 namespace NoteUtils
27 {
28 
33 AKONADI_NOTES_EXPORT QString noteMimeType();
34 
39 AKONADI_NOTES_EXPORT QString noteIconName();
40 
45 class AKONADI_NOTES_EXPORT Attachment
46 {
47 public:
51  Attachment();
52  Attachment(const QUrl &url, const QString &mimetype);
56  Attachment(const QByteArray &data, const QString &mimetype);
57  Attachment(const Attachment &other);
58  ~Attachment();
59 
60  bool operator==(const Attachment &a) const;
61  void operator=(const Attachment &a);
62 
66  QUrl url() const;
67 
71  QByteArray data() const;
72 
80  void setContentID(const QString &contentID);
81 
87  QString contentID() const;
88 
95  void setDataBase64Encoded(bool encoded);
96 
102  bool dataBase64Encoded() const;
103 
107  QString mimetype() const;
108 
112  void setLabel(const QString &label);
113 
117  QString label() const;
118 private:
119  //@cond PRIVATE
120  class AttachmentPrivate;
121  AttachmentPrivate *const d_ptr;
122  Q_DECLARE_PRIVATE(Attachment)
123  //@endcond
124 };
125 
164 class AKONADI_NOTES_EXPORT NoteMessageWrapper
165 {
166 public:
168  explicit NoteMessageWrapper(const KMime::MessagePtr &msg);
170 
175  void setUid(const QString &uid);
176 
180  QString uid() const;
181 
182  enum Classification {
183  Public,
184  Private,
185  Confidential
186  };
187 
191  void setClassification(Classification);
192 
196  Classification classification() const;
197 
201  void setTitle(const QString &title);
202 
206  QString title() const;
207 
213  void setText(const QString &text, Qt::TextFormat format = Qt::PlainText);
214 
218  QString text() const;
219 
223  Qt::TextFormat textFormat() const;
224 
228  QString toPlainText() const;
229 
233  void setCreationDate(const QDateTime &creationDate);
234 
238  QDateTime creationDate() const;
239 
243  void setLastModifiedDate(const QDateTime &lastModifiedDate);
244 
248  QDateTime lastModifiedDate() const;
249 
255  void setFrom(const QString &from);
256 
260  QString from() const;
261 
265  QVector<Attachment> &attachments();
266 
271  QMap<QString, QString> &custom();
272 
278  KMime::MessagePtr message() const;
279 
280 private:
281  //@cond PRIVATE
282  Q_DISABLE_COPY(NoteMessageWrapper)
283  class NoteMessageWrapperPrivate;
284  NoteMessageWrapperPrivate *const d_ptr;
285  Q_DECLARE_PRIVATE(NoteMessageWrapper)
286  //@endcond
287 };
288 
289 }
290 }
291 
292 Q_DECLARE_TYPEINFO(Akonadi::NoteUtils::Attachment, Q_MOVABLE_TYPE);
293 #endif
TextFormat
A convenience wrapper around KMime::MessagePtr for notes.
Definition: noteutils.h:164
An attachment for a note.
Definition: noteutils.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 23:10:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.