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/>.
26 #include <QSharedPointer>
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.
44 typedef QSharedPointer
<Tag
> Ptr
;
47 BackgroundColor
= 1 << 1,
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
);
68 QColor backgroundColor
;
71 QUrl nepomukResourceUri
;
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
79 Q_DECLARE_OPERATORS_FOR_FLAGS(Tag::SaveFlags
)