File indexing completed on 2025-01-26 04:45:36

0001 /*
0002     This file is part of Akonadi.
0003     SPDX-FileCopyrightText: 2003 Andreas Gungl <a.gungl@gmx.de>
0004     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0005     SPDX-FileCopyrightText: 2010 Leo Franchi <lfranchi@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #include "messagestatus.h"
0011 
0012 #include "messageflags.h"
0013 
0014 #include <QString>
0015 
0016 /** The message status format. These can be or'd together.
0017     Note, that the StatusIgnored implies the
0018     status to be Read.
0019     This is done in isRead() and related getters.
0020     So we can preserve the state when switching a
0021     thread to Ignored and back. */
0022 enum Status {
0023     StatusUnknown = 0x00000000,
0024     StatusUnread = 0x00000002, // deprecated
0025     StatusRead = 0x00000004,
0026     StatusDeleted = 0x00000010,
0027     StatusReplied = 0x00000020,
0028     StatusForwarded = 0x00000040,
0029     StatusQueued = 0x00000080,
0030     StatusSent = 0x00000100,
0031     StatusFlag = 0x00000200, // flag means important
0032     StatusWatched = 0x00000400,
0033     StatusIgnored = 0x00000800, // forces isRead()
0034     StatusToAct = 0x00001000,
0035     StatusSpam = 0x00002000,
0036     StatusHam = 0x00004000,
0037     StatusHasAttachment = 0x00008000,
0038     StatusHasInvitation = 0x00010000,
0039     StatusSigned = 0x00020000,
0040     StatusEncrypted = 0x00040000,
0041     StatusHasError = 0x00080000
0042 };
0043 
0044 Akonadi::MessageStatus::MessageStatus()
0045 {
0046     mStatus = StatusUnknown;
0047 }
0048 
0049 bool Akonadi::MessageStatus::operator==(Akonadi::MessageStatus other) const
0050 {
0051     return mStatus == other.mStatus;
0052 }
0053 
0054 bool Akonadi::MessageStatus::operator!=(Akonadi::MessageStatus other) const
0055 {
0056     return mStatus != other.mStatus;
0057 }
0058 
0059 bool Akonadi::MessageStatus::operator&(Akonadi::MessageStatus other) const
0060 {
0061     if (mStatus == StatusUnread) {
0062         return !(other.mStatus & StatusRead);
0063     }
0064 
0065     if (other.mStatus == StatusUnread) {
0066         return !(mStatus & StatusRead);
0067     }
0068 
0069     return mStatus & other.mStatus;
0070 }
0071 
0072 void Akonadi::MessageStatus::clear()
0073 {
0074     mStatus = StatusUnknown;
0075 }
0076 
0077 void Akonadi::MessageStatus::set(Akonadi::MessageStatus other)
0078 {
0079     Q_ASSERT(!(other.mStatus & StatusUnread));
0080 
0081     // Those stati are exclusive, but we have to lock at the
0082     // internal representation because Ignored can manipulate
0083     // the result of the getter methods.
0084     if (other.mStatus & StatusRead) {
0085         setRead();
0086     }
0087     if (other.isDeleted()) {
0088         setDeleted();
0089     }
0090     if (other.isReplied()) {
0091         setReplied();
0092     }
0093     if (other.isForwarded()) {
0094         setForwarded();
0095     }
0096     if (other.isQueued()) {
0097         setQueued();
0098     }
0099     if (other.isSent()) {
0100         setSent();
0101     }
0102     if (other.isImportant()) {
0103         setImportant();
0104     }
0105 
0106     if (other.isWatched()) {
0107         setWatched();
0108     }
0109     if (other.isIgnored()) {
0110         setIgnored();
0111     }
0112     if (other.isToAct()) {
0113         setToAct();
0114     }
0115     if (other.isSpam()) {
0116         setSpam();
0117     }
0118     if (other.isHam()) {
0119         setHam();
0120     }
0121     if (other.hasAttachment()) {
0122         setHasAttachment();
0123     }
0124     if (other.hasInvitation()) {
0125         setHasInvitation();
0126     }
0127     if (other.isSigned()) {
0128         setSigned();
0129     }
0130     if (other.isEncrypted()) {
0131         setEncrypted();
0132     }
0133     if (other.hasError()) {
0134         setHasError();
0135     }
0136 }
0137 
0138 void Akonadi::MessageStatus::toggle(Akonadi::MessageStatus other)
0139 {
0140     Q_ASSERT(!(other.mStatus & StatusUnread));
0141 
0142     if (other.isDeleted()) {
0143         setDeleted(!(mStatus & StatusDeleted));
0144     }
0145     if (other.isReplied()) {
0146         setReplied(!(mStatus & StatusReplied));
0147     }
0148     if (other.isForwarded()) {
0149         setForwarded(!(mStatus & StatusForwarded));
0150     }
0151     if (other.isQueued()) {
0152         setQueued(!(mStatus & StatusQueued));
0153     }
0154     if (other.isSent()) {
0155         setSent(!(mStatus & StatusSent));
0156     }
0157     if (other.isImportant()) {
0158         setImportant(!(mStatus & StatusFlag));
0159     }
0160 
0161     if (other.isWatched()) {
0162         setWatched(!(mStatus & StatusWatched));
0163     }
0164     if (other.isIgnored()) {
0165         setIgnored(!(mStatus & StatusIgnored));
0166     }
0167     if (other.isToAct()) {
0168         setToAct(!(mStatus & StatusToAct));
0169     }
0170     if (other.isSpam()) {
0171         setSpam(!(mStatus & StatusSpam));
0172     }
0173     if (other.isHam()) {
0174         setHam(!(mStatus & StatusHam));
0175     }
0176     if (other.hasAttachment()) {
0177         setHasAttachment(!(mStatus & StatusHasAttachment));
0178     }
0179     if (other.hasInvitation()) {
0180         setHasInvitation(!(mStatus & StatusHasInvitation));
0181     }
0182     if (other.isSigned()) {
0183         setSigned(!(mStatus & StatusSigned));
0184     }
0185     if (other.isEncrypted()) {
0186         setEncrypted(!(mStatus & StatusEncrypted));
0187     }
0188     if (other.hasError()) {
0189         setHasError(!(mStatus & StatusHasError));
0190     }
0191 }
0192 
0193 bool Akonadi::MessageStatus::isOfUnknownStatus() const
0194 {
0195     return mStatus == StatusUnknown;
0196 }
0197 
0198 bool Akonadi::MessageStatus::isRead() const
0199 {
0200     return (mStatus & StatusRead) || (mStatus & StatusIgnored);
0201 }
0202 
0203 bool Akonadi::MessageStatus::isDeleted() const
0204 {
0205     return mStatus & StatusDeleted;
0206 }
0207 
0208 bool Akonadi::MessageStatus::isReplied() const
0209 {
0210     return mStatus & StatusReplied;
0211 }
0212 
0213 bool Akonadi::MessageStatus::isForwarded() const
0214 {
0215     return mStatus & StatusForwarded;
0216 }
0217 
0218 bool Akonadi::MessageStatus::isQueued() const
0219 {
0220     return mStatus & StatusQueued;
0221 }
0222 
0223 bool Akonadi::MessageStatus::isSent() const
0224 {
0225     return mStatus & StatusSent;
0226 }
0227 
0228 bool Akonadi::MessageStatus::isImportant() const
0229 {
0230     return mStatus & StatusFlag;
0231 }
0232 
0233 bool Akonadi::MessageStatus::isWatched() const
0234 {
0235     return mStatus & StatusWatched;
0236 }
0237 
0238 bool Akonadi::MessageStatus::isIgnored() const
0239 {
0240     return mStatus & StatusIgnored;
0241 }
0242 
0243 bool Akonadi::MessageStatus::isToAct() const
0244 {
0245     return mStatus & StatusToAct;
0246 }
0247 
0248 bool Akonadi::MessageStatus::isSpam() const
0249 {
0250     return mStatus & StatusSpam;
0251 }
0252 
0253 bool Akonadi::MessageStatus::isHam() const
0254 {
0255     return mStatus & StatusHam;
0256 }
0257 
0258 bool Akonadi::MessageStatus::hasAttachment() const
0259 {
0260     return mStatus & StatusHasAttachment;
0261 }
0262 
0263 bool Akonadi::MessageStatus::hasInvitation() const
0264 {
0265     return mStatus & StatusHasInvitation;
0266 }
0267 
0268 bool Akonadi::MessageStatus::isSigned() const
0269 {
0270     return mStatus & StatusSigned;
0271 }
0272 
0273 bool Akonadi::MessageStatus::isEncrypted() const
0274 {
0275     return mStatus & StatusEncrypted;
0276 }
0277 
0278 bool Akonadi::MessageStatus::hasError() const
0279 {
0280     return mStatus & StatusHasError;
0281 }
0282 
0283 void Akonadi::MessageStatus::setRead(bool read)
0284 {
0285     if (read) {
0286         mStatus |= StatusRead;
0287     } else {
0288         mStatus &= ~StatusRead;
0289     }
0290 }
0291 
0292 void Akonadi::MessageStatus::setDeleted(bool deleted)
0293 {
0294     if (deleted) {
0295         mStatus |= StatusDeleted;
0296     } else {
0297         mStatus &= ~StatusDeleted;
0298     }
0299 }
0300 
0301 void Akonadi::MessageStatus::setReplied(bool replied)
0302 {
0303     if (replied) {
0304         mStatus |= StatusReplied;
0305     } else {
0306         mStatus &= ~StatusReplied;
0307     }
0308 }
0309 
0310 void Akonadi::MessageStatus::setForwarded(bool forwarded)
0311 {
0312     if (forwarded) {
0313         mStatus |= StatusForwarded;
0314     } else {
0315         mStatus &= ~StatusForwarded;
0316     }
0317 }
0318 
0319 void Akonadi::MessageStatus::setQueued(bool queued)
0320 {
0321     if (queued) {
0322         mStatus |= StatusQueued;
0323     } else {
0324         mStatus &= ~StatusQueued;
0325     }
0326 }
0327 
0328 void Akonadi::MessageStatus::setSent(bool sent)
0329 {
0330     if (sent) {
0331         mStatus &= ~StatusQueued;
0332         mStatus |= StatusSent;
0333     } else {
0334         mStatus &= ~StatusSent;
0335     }
0336 }
0337 
0338 void Akonadi::MessageStatus::setImportant(bool important)
0339 {
0340     if (important) {
0341         mStatus |= StatusFlag;
0342     } else {
0343         mStatus &= ~StatusFlag;
0344     }
0345 }
0346 
0347 // Watched and ignored are mutually exclusive
0348 void Akonadi::MessageStatus::setWatched(bool watched)
0349 {
0350     if (watched) {
0351         mStatus &= ~StatusIgnored;
0352         mStatus |= StatusWatched;
0353     } else {
0354         mStatus &= ~StatusWatched;
0355     }
0356 }
0357 
0358 void Akonadi::MessageStatus::setIgnored(bool ignored)
0359 {
0360     if (ignored) {
0361         mStatus &= ~StatusWatched;
0362         mStatus |= StatusIgnored;
0363     } else {
0364         mStatus &= ~StatusIgnored;
0365     }
0366 }
0367 
0368 void Akonadi::MessageStatus::setToAct(bool toAct)
0369 {
0370     if (toAct) {
0371         mStatus |= StatusToAct;
0372     } else {
0373         mStatus &= ~StatusToAct;
0374     }
0375 }
0376 
0377 // Ham and Spam are mutually exclusive
0378 void Akonadi::MessageStatus::setSpam(bool spam)
0379 {
0380     if (spam) {
0381         mStatus &= ~StatusHam;
0382         mStatus |= StatusSpam;
0383     } else {
0384         mStatus &= ~StatusSpam;
0385     }
0386 }
0387 
0388 void Akonadi::MessageStatus::setHam(bool ham)
0389 {
0390     if (ham) {
0391         mStatus &= ~StatusSpam;
0392         mStatus |= StatusHam;
0393     } else {
0394         mStatus &= ~StatusHam;
0395     }
0396 }
0397 
0398 void Akonadi::MessageStatus::setHasAttachment(bool withAttachment)
0399 {
0400     if (withAttachment) {
0401         mStatus |= StatusHasAttachment;
0402     } else {
0403         mStatus &= ~StatusHasAttachment;
0404     }
0405 }
0406 
0407 void Akonadi::MessageStatus::setHasInvitation(bool withInvitation)
0408 {
0409     if (withInvitation) {
0410         mStatus |= StatusHasInvitation;
0411     } else {
0412         mStatus &= ~StatusHasInvitation;
0413     }
0414 }
0415 
0416 void Akonadi::MessageStatus::setSigned(bool value)
0417 {
0418     if (value) {
0419         mStatus |= StatusSigned;
0420     } else {
0421         mStatus &= ~StatusSigned;
0422     }
0423 }
0424 
0425 void Akonadi::MessageStatus::setEncrypted(bool value)
0426 {
0427     if (value) {
0428         mStatus |= StatusEncrypted;
0429     } else {
0430         mStatus &= ~StatusEncrypted;
0431     }
0432 }
0433 
0434 void Akonadi::MessageStatus::setHasError(bool hasError)
0435 {
0436     if (hasError) {
0437         mStatus |= StatusHasError;
0438     } else {
0439         mStatus &= ~StatusHasError;
0440     }
0441 }
0442 
0443 qint32 Akonadi::MessageStatus::toQInt32() const
0444 {
0445     return mStatus;
0446 }
0447 
0448 void Akonadi::MessageStatus::fromQInt32(qint32 status)
0449 {
0450     mStatus = status;
0451 }
0452 
0453 QString Akonadi::MessageStatus::statusStr() const
0454 {
0455     QByteArray sstr;
0456     if (mStatus & StatusRead) {
0457         sstr += 'R';
0458     } else {
0459         sstr += 'U';
0460     }
0461     if (mStatus & StatusDeleted) {
0462         sstr += 'D';
0463     }
0464     if (mStatus & StatusReplied) {
0465         sstr += 'A';
0466     }
0467     if (mStatus & StatusForwarded) {
0468         sstr += 'F';
0469     }
0470     if (mStatus & StatusQueued) {
0471         sstr += 'Q';
0472     }
0473     if (mStatus & StatusToAct) {
0474         sstr += 'K';
0475     }
0476     if (mStatus & StatusSent) {
0477         sstr += 'S';
0478     }
0479     if (mStatus & StatusFlag) {
0480         sstr += 'G';
0481     }
0482     if (mStatus & StatusWatched) {
0483         sstr += 'W';
0484     }
0485     if (mStatus & StatusIgnored) {
0486         sstr += 'I';
0487     }
0488     if (mStatus & StatusSpam) {
0489         sstr += 'P';
0490     }
0491     if (mStatus & StatusHam) {
0492         sstr += 'H';
0493     }
0494     if (mStatus & StatusHasAttachment) {
0495         sstr += 'T';
0496     }
0497 
0498     return QLatin1StringView(sstr);
0499 }
0500 
0501 void Akonadi::MessageStatus::setStatusFromStr(const QString &aStr)
0502 {
0503     mStatus = StatusUnknown;
0504 
0505     if (aStr.contains(QLatin1Char('U'))) {
0506         setRead(false);
0507     }
0508     if (aStr.contains(QLatin1Char('R'))) {
0509         setRead();
0510     }
0511     if (aStr.contains(QLatin1Char('D'))) {
0512         setDeleted();
0513     }
0514     if (aStr.contains(QLatin1Char('A'))) {
0515         setReplied();
0516     }
0517     if (aStr.contains(QLatin1Char('F'))) {
0518         setForwarded();
0519     }
0520     if (aStr.contains(QLatin1Char('Q'))) {
0521         setQueued();
0522     }
0523     if (aStr.contains(QLatin1Char('K'))) {
0524         setToAct();
0525     }
0526     if (aStr.contains(QLatin1Char('S'))) {
0527         setSent();
0528     }
0529     if (aStr.contains(QLatin1Char('G'))) {
0530         setImportant();
0531     }
0532     if (aStr.contains(QLatin1Char('W'))) {
0533         setWatched();
0534     }
0535     if (aStr.contains(QLatin1Char('I'))) {
0536         setIgnored();
0537     }
0538     if (aStr.contains(QLatin1Char('P'))) {
0539         setSpam();
0540     }
0541     if (aStr.contains(QLatin1Char('H'))) {
0542         setHam();
0543     }
0544     if (aStr.contains(QLatin1Char('T'))) {
0545         setHasAttachment();
0546     }
0547     if (aStr.contains(QLatin1Char('C'))) {
0548         setHasAttachment(false);
0549     }
0550 }
0551 
0552 QSet<QByteArray> Akonadi::MessageStatus::statusFlags() const
0553 {
0554     QSet<QByteArray> flags;
0555 
0556     if (mStatus & StatusDeleted) {
0557         flags += Akonadi::MessageFlags::Deleted;
0558     } else {
0559         if (mStatus & StatusRead) {
0560             flags += Akonadi::MessageFlags::Seen;
0561         }
0562         if (mStatus & StatusReplied) {
0563             flags += Akonadi::MessageFlags::Answered;
0564         }
0565         if (mStatus & StatusFlag) {
0566             flags += Akonadi::MessageFlags::Flagged;
0567         }
0568 
0569         // non standard flags
0570         if (mStatus & StatusSent) {
0571             flags += Akonadi::MessageFlags::Sent;
0572         }
0573         if (mStatus & StatusQueued) {
0574             flags += Akonadi::MessageFlags::Queued;
0575         }
0576         if (mStatus & StatusReplied) {
0577             flags += Akonadi::MessageFlags::Replied;
0578         }
0579         if (mStatus & StatusForwarded) {
0580             flags += Akonadi::MessageFlags::Forwarded;
0581         }
0582         if (mStatus & StatusToAct) {
0583             flags += Akonadi::MessageFlags::ToAct;
0584         }
0585         if (mStatus & StatusWatched) {
0586             flags += Akonadi::MessageFlags::Watched;
0587         }
0588         if (mStatus & StatusIgnored) {
0589             flags += Akonadi::MessageFlags::Ignored;
0590         }
0591         if (mStatus & StatusHasAttachment) {
0592             flags += Akonadi::MessageFlags::HasAttachment;
0593         }
0594         if (mStatus & StatusHasInvitation) {
0595             flags += Akonadi::MessageFlags::HasInvitation;
0596         }
0597         if (mStatus & StatusSigned) {
0598             flags += Akonadi::MessageFlags::Signed;
0599         }
0600         if (mStatus & StatusEncrypted) {
0601             flags += Akonadi::MessageFlags::Encrypted;
0602         }
0603         if (mStatus & StatusSpam) {
0604             flags += Akonadi::MessageFlags::Spam;
0605         }
0606         if (mStatus & StatusHam) {
0607             flags += Akonadi::MessageFlags::Ham;
0608         }
0609         if (mStatus & StatusHasError) {
0610             flags += Akonadi::MessageFlags::HasError;
0611         }
0612     }
0613 
0614     return flags;
0615 }
0616 
0617 void Akonadi::MessageStatus::setStatusFromFlags(const QSet<QByteArray> &flags)
0618 {
0619     mStatus = StatusUnknown;
0620 
0621     for (const QByteArray &flag : flags) {
0622         const QByteArray &upperedFlag = flag.toUpper();
0623         if (upperedFlag == Akonadi::MessageFlags::Deleted) {
0624             setDeleted();
0625         } else if (upperedFlag == Akonadi::MessageFlags::Seen) {
0626             setRead();
0627         } else if (upperedFlag == Akonadi::MessageFlags::Answered) {
0628             setReplied();
0629         } else if (upperedFlag == Akonadi::MessageFlags::Flagged) {
0630             setImportant();
0631 
0632             // non standard flags
0633         } else if (upperedFlag == Akonadi::MessageFlags::Sent) {
0634             setSent();
0635         } else if (upperedFlag == Akonadi::MessageFlags::Queued) {
0636             setQueued();
0637         } else if (upperedFlag == Akonadi::MessageFlags::Replied) {
0638             setReplied();
0639         } else if (upperedFlag == Akonadi::MessageFlags::Forwarded) {
0640             setForwarded();
0641         } else if (upperedFlag == Akonadi::MessageFlags::ToAct) {
0642             setToAct();
0643         } else if (upperedFlag == Akonadi::MessageFlags::Watched) {
0644             setWatched();
0645         } else if (upperedFlag == Akonadi::MessageFlags::Ignored) {
0646             setIgnored();
0647         } else if (upperedFlag == Akonadi::MessageFlags::HasAttachment) {
0648             setHasAttachment();
0649         } else if (upperedFlag == Akonadi::MessageFlags::HasInvitation) {
0650             setHasInvitation();
0651         } else if (upperedFlag == Akonadi::MessageFlags::Signed) {
0652             setSigned();
0653         } else if (upperedFlag == Akonadi::MessageFlags::Encrypted) {
0654             setEncrypted();
0655         } else if (upperedFlag == Akonadi::MessageFlags::Spam) {
0656             setSpam();
0657         } else if (upperedFlag == Akonadi::MessageFlags::Ham) {
0658             setHam();
0659         } else if (upperedFlag == Akonadi::MessageFlags::HasError) {
0660             setHasError();
0661         }
0662     }
0663 }
0664 
0665 const Akonadi::MessageStatus Akonadi::MessageStatus::statusUnread()
0666 {
0667     Akonadi::MessageStatus st;
0668     st.mStatus = StatusUnread;
0669     return st;
0670 }
0671 
0672 const Akonadi::MessageStatus Akonadi::MessageStatus::statusRead()
0673 {
0674     Akonadi::MessageStatus st;
0675     st.setRead();
0676     return st;
0677 }
0678 
0679 const Akonadi::MessageStatus Akonadi::MessageStatus::statusDeleted()
0680 {
0681     Akonadi::MessageStatus st;
0682     st.setDeleted();
0683     return st;
0684 }
0685 
0686 const Akonadi::MessageStatus Akonadi::MessageStatus::statusReplied()
0687 {
0688     Akonadi::MessageStatus st;
0689     st.setReplied();
0690     return st;
0691 }
0692 
0693 const Akonadi::MessageStatus Akonadi::MessageStatus::statusForwarded()
0694 {
0695     Akonadi::MessageStatus st;
0696     st.setForwarded();
0697     return st;
0698 }
0699 
0700 const Akonadi::MessageStatus Akonadi::MessageStatus::statusQueued()
0701 {
0702     Akonadi::MessageStatus st;
0703     st.setQueued();
0704     return st;
0705 }
0706 
0707 const Akonadi::MessageStatus Akonadi::MessageStatus::statusSent()
0708 {
0709     Akonadi::MessageStatus st;
0710     st.setSent();
0711     return st;
0712 }
0713 
0714 const Akonadi::MessageStatus Akonadi::MessageStatus::statusImportant()
0715 {
0716     Akonadi::MessageStatus st;
0717     st.setImportant();
0718     return st;
0719 }
0720 
0721 const Akonadi::MessageStatus Akonadi::MessageStatus::statusWatched()
0722 {
0723     Akonadi::MessageStatus st;
0724     st.setWatched();
0725     return st;
0726 }
0727 
0728 const Akonadi::MessageStatus Akonadi::MessageStatus::statusIgnored()
0729 {
0730     Akonadi::MessageStatus st;
0731     st.setIgnored();
0732     return st;
0733 }
0734 
0735 const Akonadi::MessageStatus Akonadi::MessageStatus::statusToAct()
0736 {
0737     Akonadi::MessageStatus st;
0738     st.setToAct();
0739     return st;
0740 }
0741 
0742 const Akonadi::MessageStatus Akonadi::MessageStatus::statusSpam()
0743 {
0744     Akonadi::MessageStatus st;
0745     st.setSpam();
0746     return st;
0747 }
0748 
0749 const Akonadi::MessageStatus Akonadi::MessageStatus::statusHam()
0750 {
0751     Akonadi::MessageStatus st;
0752     st.setHam();
0753     return st;
0754 }
0755 
0756 const Akonadi::MessageStatus Akonadi::MessageStatus::statusHasAttachment()
0757 {
0758     Akonadi::MessageStatus st;
0759     st.setHasAttachment();
0760     return st;
0761 }
0762 
0763 const Akonadi::MessageStatus Akonadi::MessageStatus::statusHasInvitation()
0764 {
0765     MessageStatus st;
0766     st.setHasInvitation();
0767     return st;
0768 }
0769 
0770 const Akonadi::MessageStatus Akonadi::MessageStatus::statusSigned()
0771 {
0772     MessageStatus st;
0773     st.setSigned();
0774     return st;
0775 }
0776 
0777 const Akonadi::MessageStatus Akonadi::MessageStatus::statusEncrypted()
0778 {
0779     MessageStatus st;
0780     st.setEncrypted();
0781     return st;
0782 }
0783 
0784 const Akonadi::MessageStatus Akonadi::MessageStatus::statusHasError()
0785 {
0786     MessageStatus st;
0787     st.setHasError();
0788     return st;
0789 }
0790 
0791 QDebug operator<<(QDebug d, const Akonadi::MessageStatus &t)
0792 {
0793     d << "status " << t.statusStr();
0794     return d;
0795 }
0796 
0797 #include "moc_messagestatus.cpp"