Akonadi Mime

messagestatus.h
1 /* -*- mode: C++ -*-
2  This file is part of Akonadi.
3  SPDX-FileCopyrightText: 2005 Andreas Gungl <[email protected]>
4  SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
5  SPDX-FileCopyrightText: 2010 Leo Franchi <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 #ifndef AKONADI_KMIME_MESSAGESTATUS_H
10 #define AKONADI_KMIME_MESSAGESTATUS_H
11 
12 #include <QSet>
13 
14 #include "akonadi-mime_export.h"
15 
16 class QString;
17 
18 namespace Akonadi {
19 //---------------------------------------------------------------------------
37 class AKONADI_MIME_EXPORT MessageStatus
38 {
39 public:
41  MessageStatus();
42 
47  bool operator==(MessageStatus other) const;
48 
53  bool operator!=(MessageStatus other) const;
54 
60  bool operator&(MessageStatus other) const;
61 
63  void clear();
64 
72  void set(MessageStatus other);
73 
79  void toggle(MessageStatus other);
80 
81  /* ----- getters ----------------------------------------------------- */
82 
86  Q_REQUIRED_RESULT bool isOfUnknownStatus() const;
87 
91  Q_REQUIRED_RESULT bool isRead() const;
92 
96  Q_REQUIRED_RESULT bool isDeleted() const;
97 
101  Q_REQUIRED_RESULT bool isReplied() const;
102 
106  Q_REQUIRED_RESULT bool isForwarded() const;
107 
111  Q_REQUIRED_RESULT bool isQueued() const;
112 
116  Q_REQUIRED_RESULT bool isSent() const;
117 
121  Q_REQUIRED_RESULT bool isImportant() const;
122 
126  Q_REQUIRED_RESULT bool isWatched() const;
127 
131  Q_REQUIRED_RESULT bool isIgnored() const;
132 
136  Q_REQUIRED_RESULT bool isToAct() const;
137 
141  Q_REQUIRED_RESULT bool isSpam() const;
142 
146  Q_REQUIRED_RESULT bool isHam() const;
147 
151  Q_REQUIRED_RESULT bool hasAttachment() const;
152 
156  Q_REQUIRED_RESULT bool hasInvitation() const;
157 
161  Q_REQUIRED_RESULT bool isSigned() const;
162 
166  Q_REQUIRED_RESULT bool isEncrypted() const;
167 
171  Q_REQUIRED_RESULT bool hasError() const;
172 
173  /* ----- setters ----------------------------------------------------- */
174 
179  void setRead(bool read = true);
180 
184  void setDeleted(bool deleted = true);
185 
189  void setReplied(bool replied = true);
190 
194  void setForwarded(bool forwarded = true);
195 
199  void setQueued(bool queued = true);
200 
204  void setSent(bool sent = true);
205 
209  void setImportant(bool important = true);
210 
214  void setWatched(bool watched = true);
215 
219  void setIgnored(bool ignored = true);
220 
224  void setToAct(bool toAct = true);
225 
229  void setSpam(bool spam = true);
230 
234  void setHam(bool ham = true);
235 
239  void setHasAttachment(bool hasAttachment = true);
240 
244  void setHasInvitation(bool hasInvitation = true);
245 
249  void setSigned(bool value = true);
250 
254  void setEncrypted(bool value = true);
255 
259  void setHasError(bool value = true);
260 
261  /* ----- state representation --------------------------------------- */
262 
268  Q_REQUIRED_RESULT qint32 toQInt32() const;
269 
275  void fromQInt32(qint32 status);
276 
283  Q_REQUIRED_RESULT QString statusStr() const;
284 
292  void setStatusFromStr(const QString &aStr);
293 
297  Q_REQUIRED_RESULT QSet<QByteArray> statusFlags() const;
298 
302  void setStatusFromFlags(const QSet<QByteArray> &flags);
303 
304  /* ----- static accessors to simple states --------------------------- */
305 
309  static const MessageStatus statusUnread();
310 
315  static const MessageStatus statusRead();
316 
321  static const MessageStatus statusDeleted();
322 
327  static const MessageStatus statusReplied();
328 
333  static const MessageStatus statusForwarded();
334 
339  static const MessageStatus statusQueued();
340 
345  static const MessageStatus statusSent();
346 
351  static const MessageStatus statusImportant();
352 
357  static const MessageStatus statusWatched();
358 
363  static const MessageStatus statusIgnored();
364 
369  static const MessageStatus statusToAct();
370 
375  static const MessageStatus statusSpam();
376 
381  static const MessageStatus statusHam();
382 
387  static const MessageStatus statusHasAttachment();
388 
393  static const MessageStatus statusHasInvitation();
394 
399  static const MessageStatus statusSigned();
400 
405  static const MessageStatus statusEncrypted();
406 
411  static const MessageStatus statusHasError();
412 
413 private:
414  quint32 mStatus;
415 };
416 } // namespace Akonadi
417 
418 #endif
Akonadi KMime Message Status.
Definition: messagestatus.h:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:14:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.