File indexing completed on 2024-11-24 04:53:13
0001 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net> 0002 0003 This file is part of the Trojita Qt IMAP e-mail client, 0004 http://trojita.flaska.net/ 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License as 0008 published by the Free Software Foundation; either version 2 of 0009 the License or (at your option) version 3 or any later version 0010 accepted by the membership of KDE e.V. (or its successor approved 0011 by the membership of KDE e.V.), which shall act as a proxy 0012 defined in Section 14 of version 3 of the license. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #include <QSet> 0024 0025 #include "SpecialFlagNames.h" 0026 0027 namespace Imap 0028 { 0029 namespace Mailbox 0030 { 0031 0032 // Make sure to update the first-character check inside Model::normalizeFlags() when adding new flags here 0033 const QString FlagNames::answered = QStringLiteral("\\Answered"); 0034 const QString FlagNames::seen = QStringLiteral("\\Seen"); 0035 const QString FlagNames::deleted = QStringLiteral("\\Deleted"); 0036 const QString FlagNames::forwarded = QStringLiteral("$Forwarded"); 0037 const QString FlagNames::recent = QStringLiteral("\\Recent"); 0038 const QString FlagNames::flagged = QStringLiteral("\\Flagged"); 0039 const QString FlagNames::junk = QStringLiteral("$Junk"); 0040 const QString FlagNames::notjunk = QStringLiteral("$NotJunk"); 0041 const QString FlagNames::mdnsent = QStringLiteral("$MDNSent"); 0042 const QString FlagNames::submitted = QStringLiteral("$Submitted"); 0043 const QString FlagNames::submitpending = QStringLiteral("$SubmitPending"); 0044 0045 QHash<QString,QString> toCanonicalInit() 0046 { 0047 QSet<QString> flagNames = QSet<QString>(); 0048 flagNames << FlagNames::answered 0049 << FlagNames::seen 0050 << FlagNames::deleted 0051 << FlagNames::forwarded 0052 << FlagNames::recent 0053 << FlagNames::flagged 0054 << FlagNames::junk 0055 << FlagNames::notjunk 0056 << FlagNames::mdnsent 0057 << FlagNames::submitted 0058 << FlagNames::submitpending; 0059 QHash<QString,QString> flagNamesCanonical = QHash<QString,QString>(); 0060 Q_FOREACH(const QString &flagName, flagNames) { 0061 flagNamesCanonical[flagName.toLower()] = flagName; 0062 } 0063 return flagNamesCanonical; 0064 } 0065 const QHash<QString,QString> FlagNames::toCanonical = toCanonicalInit(); 0066 0067 } 0068 }