/usr/include/KF5/akonadi/kmime/messagestatus.h is in libkf5akonadimime-dev 4:15.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | /* -*- mode: C++ -*-
This file is part of Akonadi.
Copyright (c) 2005 Andreas Gungl <a.gungl@gmx.de>
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef AKONADI_KMIME_MESSAGESTATUS_H
#define AKONADI_KMIME_MESSAGESTATUS_H
#include <QtCore/QSet>
#include "akonadi-mime_export.h"
class QString;
namespace Akonadi
{
//---------------------------------------------------------------------------
/**
@short Akonadi KMime Message Status.
@author Andreas Gungl <a.gungl@gmx.de>
The class encapsulates the handling of the different flags
which describe the status of a message.
The flags themselves are not intended to be used outside this class.
In the status pairs Watched/Ignored and Spam/Ham, there both
values can't be set at the same time, however they can
be unset at the same time.
Note that this class does not sync with the Akonadi storage. It is
used as an in-memory helper when manipulating Akonadi items.
@since 4.6.
*/
class AKONADI_MIME_EXPORT MessageStatus
{
public:
/** Constructor - sets status initially to unknown. */
MessageStatus();
/** Compare the status with that from another instance.
@return true if the stati are equal, false if different.
@param other message status to compare with current object
*/
bool operator==(const MessageStatus &other) const;
/** Compare the status with that from another instance.
@return true if the stati are equal, false if different.
@param other message status to compare with current object
*/
bool operator!=(const MessageStatus &other) const;
/** Check, if some of the flags in the status match
with those flags from another instance.
@return true if at least one flag is set in both stati.
@param other message status to compare objects' flags
*/
bool operator&(const MessageStatus &other) const;
/** Clear all status flags, this resets to unknown. */
void clear();
/** Set / add stati described by another MessageStatus object.
This can be used to merge in multiple stati at once without
using the single setter methods.
However, internally the setters are used anyway to ensure the
integrity of the resulting status.
@param other message status to set
*/
void set(const MessageStatus &other);
/** Toggle one or more stati described by another MessageStatus object.
Internally the setters are used to ensure the integrity of the
resulting status.
@param other message status to toggle
*/
void toggle(const MessageStatus &other);
/* ----- getters ----------------------------------------------------- */
/** Check for Unknown status.
@return true if status is unknown.
*/
bool isOfUnknownStatus() const;
/** Check for Read status. Note that ignored messages are read.
@return true if status is read.
*/
bool isRead() const;
/** Check for Deleted status.
@return true if status is deleted.
*/
bool isDeleted() const;
/** Check for Replied status.
@return true if status is replied.
*/
bool isReplied() const;
/** Check for Forwarded status.
@return true if status is forwarded.
*/
bool isForwarded() const;
/** Check for Queued status.
@return true if status is queued.
*/
bool isQueued() const;
/** Check for Sent status.
@return true if status is sent.
*/
bool isSent() const;
/** Check for Important status.
@return true if status is important.
*/
bool isImportant() const;
/** Check for Watched status.
@return true if status is watched.
*/
bool isWatched() const;
/** Check for Ignored status.
@return true if status is ignored.
*/
bool isIgnored() const;
/** Check for ToAct status.
@return true if status is action item.
*/
bool isToAct() const;
/** Check for Spam status.
@return true if status is spam.
*/
bool isSpam() const;
/** Check for Ham status.
@return true if status is not spam.
*/
bool isHam() const;
/** Check for Attachment status.
@return true if status indicates an attachment.
*/
bool hasAttachment() const;
/** Check for Invitation status.
@return true if status indicates an invitation.
*/
bool hasInvitation() const;
/** Check for Signed status.
@return true if status is signed.
*/
bool isSigned() const;
/** Check for Encrypted status.
@return true if status is encrypted.
*/
bool isEncrypted() const;
/** Check for error status.
@return true if status indicates an error.
*/
bool hasError() const;
/* ----- setters ----------------------------------------------------- */
/**
* Set the status to read
* @param read new read status
*/
void setRead(bool read = true);
/** Set the status for deleted.
@param deleted Set (true) or unset (false) this status flag.
*/
void setDeleted(bool deleted = true);
/** Set the status for replied.
@param replied Set (true) or unset (false) this status flag.
*/
void setReplied(bool replied = true);
/** Set the status for forwarded.
@param forwarded Set (true) or unset (false) this status flag.
*/
void setForwarded(bool forwarded = true);
/** Set the status for queued.
@param queued Set (true) or unset (false) this status flag.
*/
void setQueued(bool queued = true);
/** Set the status for sent.
@param sent Set (true) or unset (false) this status flag.
*/
void setSent(bool sent = true);
/** Set the status for important.
@param important Set (true) or unset (false) this status flag.
*/
void setImportant(bool important = true);
/** Set the status to watched.
@param watched Set (true) or unset (false) this status flag.
*/
void setWatched(bool watched = true);
/** Set the status to ignored.
@param ignored Set (true) or unset (false) this status flag.
*/
void setIgnored(bool ignored = true);
/** Set the status to action item.
@param toAct Set (true) or unset (false) this status flag.
*/
void setToAct(bool toAct = true);
/** Set the status to spam.
@param spam Set (true) or unset (false) this status flag.
*/
void setSpam(bool spam = true);
/** Set the status to not spam.
@param ham Set (true) or unset (false) this status flag.
*/
void setHam(bool ham = true);
/** Set the status for an attachment.
@param hasAttachment Set (true) or unset (false) this status flag.
*/
void setHasAttachment(bool hasAttachment = true);
/** Set the status for an invitation.
@param hasInvitation Set (true) or unset (false) this status flag.
*/
void setHasInvitation(bool hasInvitation = true);
/** Set the status to signed.
@param value Set (true) or unset (false) this status flag.
*/
void setSigned(bool value = true);
/** Set the status to encrypted.
@param value Set (true) or unset (false) this status flag.
*/
void setEncrypted(bool value = true);
/** Set the status to error.
@param value Set (true) or unset (false) this status flag.
*/
void setHasError(bool value = true);
/* ----- state representation --------------------------------------- */
/** Get the status as a whole e.g. for storage in an index.
D on't manipulte the *index via this value, this bypasses
all integrity checks in the setter methods.
@return The status encoded in bits.
*/
qint32 toQInt32() const;
/** Set the status as a whole e.g. for reading from an index.
Don't manipulte the index via this value, this bypasses
all integrity checks in the setter methods.
@param status The status encoded in bits to be set in this instance.
*/
void fromQInt32(qint32 status);
/** Convert the status to a string representation.
@return A string containing coded uppercase letters
which describe the status.
@note This code is legacy for the KMail1 indexes
*/
QString statusStr() const;
/** Set the status based on a string representation.
@param aStr The status string to be analyzed.
Normally it is a string obtained using
getStatusStr().
@note This code is legacy for the KMail1 indexes
*/
void setStatusFromStr(const QString &aStr);
/** Get the status as a whole e.g. for storage as IMAP flags.
@return The status encoded in flags.
*/
QSet<QByteArray> statusFlags() const;
/** Set the status as a whole e.g. for reading from IMAP flags.
@param flags set of flags for status as a whole
*/
void setStatusFromFlags(const QSet<QByteArray> &flags);
/* ----- static accessors to simple states --------------------------- */
/** Return a special status that expresses Unread.
This status can only be used for comparison with other states.
*/
static const MessageStatus statusUnread();
/** Return a predefined status initialized as Read as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Read.
*/
static const MessageStatus statusRead();
/** Return a predefined status initialized as Deleted as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Deleted.
*/
static const MessageStatus statusDeleted();
/** Return a predefined status initialized as Replied as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Replied.
*/
static const MessageStatus statusReplied();
/** Return a predefined status initialized as Forwarded as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Forwarded.
*/
static const MessageStatus statusForwarded();
/** Return a predefined status initialized as Queued as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Queued.
*/
static const MessageStatus statusQueued();
/** Return a predefined status initialized as Sent as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Sent.
*/
static const MessageStatus statusSent();
/** Return a predefined status initialized as Important as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Important.
*/
static const MessageStatus statusImportant();
/** Return a predefined status initialized as Watched as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Watched.
*/
static const MessageStatus statusWatched();
/** Return a predefined status initialized as Ignored as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Ignored.
*/
static const MessageStatus statusIgnored();
/** Return a predefined status initialized as Action Item as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as ToAct.
*/
static const MessageStatus statusToAct();
/** Return a predefined status initialized as Spam as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Spam.
*/
static const MessageStatus statusSpam();
/** Return a predefined status initialized as Ham as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Ham.
*/
static const MessageStatus statusHam();
/** Return a predefined status initialized as Attachment as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Attachment.
*/
static const MessageStatus statusHasAttachment();
/** Return a predefined status initialized as Invitation as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Invitation.
*/
static const MessageStatus statusHasInvitation();
/** Return a predefined status initialized as Signed as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Signed.
*/
static const MessageStatus statusSigned();
/** Return a predefined status initialized as Encrypted as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Encrypted.
*/
static const MessageStatus statusEncrypted();
/** Return a predefined status initialized as Error as is useful
e.g. when providing a state for comparison.
@return A reference to a status instance initialized as Error.
*/
static const MessageStatus statusHasError();
private:
quint32 mStatus;
};
} // namespace Akonadi
#endif
|