Merge "persistent color scheme selection"
[trojita.git] / src / Gui / TagWidget.h
blob805b3323ad1276b34654fdcfbf0e65327c72d21a
1 /* Copyright (C) 2012 Mildred <mildred-pub@mildred.fr>
2 Copyright (C) 2015 Erik Quaeghebeur <trojita@equaeghe.nospammail.net>
3 Copyright (C) 2006 - 2015 Jan Kundrát <jkt@kde.org>
5 This file is part of the Trojita Qt IMAP e-mail client,
6 http://trojita.flaska.net/
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License or (at your option) version 3 or any later version
12 accepted by the membership of KDE e.V. (or its successor approved
13 by the membership of KDE e.V.), which shall act as a proxy
14 defined in Section 14 of version 3 of the license.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef GUI_TAGWIDGET_H
26 #define GUI_TAGWIDGET_H
28 #include <QLabel>
29 #include "Imap/Model/FavoriteTagsModel.h"
31 namespace Gui
34 class TagWidget : public QLabel
36 Q_OBJECT
37 Q_PROPERTY(QString tagName READ tagName USER true)
38 public:
39 static TagWidget *addingWidget();
40 static TagWidget *userKeyword(const QString &tagName, Imap::Mailbox::FavoriteTagsModel *m_favoriteTags);
41 static TagWidget *systemFlag(const QString &flagName);
43 QString tagName() const;
45 bool event(QEvent *e);
47 signals:
48 void removeClicked(QString);
49 void addingClicked();
51 private:
52 enum class Mode {
53 SystemFlag,
54 UserKeyword,
55 AddingWidget,
58 QString m_tagName;
59 const Mode m_mode;
60 QColor m_tint;
61 int m_splitPos;
63 TagWidget(const Mode mode, const QString &tagName, const QColor &backgroundColor);
66 } // namespace Gui
68 #endif // GUI_TAGWIDGET_H