Fix confusing checkbox text due to class reuse
[kdepim.git] / kmail / tag.h
blobfd875e915a74054d8463191170bb667ec30eeca8
1 /* Copyright 2010 Thomas McGuire <mcguire@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License as
5 published by the Free Software Foundation; either version 2 of
6 the License or (at your option) version 3 or any later version
7 accepted by the membership of KDE e.V. (or its successor approved
8 by the membership of KDE e.V.), which shall act as a proxy
9 defined in Section 14 of version 3 of the license.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef TAG_H
20 #define TAG_H
22 #include <KShortcut>
24 #include <QColor>
25 #include <QFont>
26 #include <QSharedPointer>
27 #include <QUrl>
29 namespace Nepomuk {
30 class Tag;
33 namespace KMail {
35 // Our own copy of the tag data normally attached to a Nepomuk::Tag.
36 // Useful in the config dialog, because the user might cancel his changes,
37 // in which case we don't write them back to the Nepomuk::Tag.
38 // Also used as a convenience class in the TagActionManager.
39 class Tag
41 Q_GADGET
42 public:
44 typedef QSharedPointer<Tag> Ptr;
45 enum SaveFlag {
46 TextColor = 1,
47 BackgroundColor = 1 << 1,
48 Font = 1 << 2
50 typedef QFlags<SaveFlag> SaveFlags;
52 // Returns true if two tags are equal
53 bool operator==( const Tag &other ) const;
55 bool operator!=( const Tag &other ) const;
57 // Load a tag from a Nepomuk tag
58 static Ptr fromNepomuk( const Nepomuk::Tag& nepomukTag );
60 // Save this tag to Nepomuk the corresponding Nepomuk tag
61 void saveToNepomuk( SaveFlags saveFlags ) const;
63 // Compare, based on priority
64 static bool compare( Ptr &tag1, Ptr &tag2 );
66 QString tagName;
67 QColor textColor;
68 QColor backgroundColor;
69 QFont textFont;
70 QString iconName;
71 QUrl nepomukResourceUri;
72 KShortcut shortcut;
73 bool inToolbar;
75 // Priority, i.e. sort order of the tag. Only used when loading the tag, when saving
76 // the priority is set to the position in the list widget
77 int priority;
79 Q_DECLARE_OPERATORS_FOR_FLAGS(Tag::SaveFlags)
83 #endif