Propagate color of selected messages too
[trojita.git] / src / Gui / OneEnvelopeAddress.h
blob3fab287d6648e87f8f646e47b691abc54ed2c008
1 /* Copyright (C) 2006 - 2015 Jan Kundrát <jkt@kde.org>
2 Copyright (C) 2013 - 2015 Pali Rohár <pali.rohar@gmail.com>
4 This file is part of the Trojita Qt IMAP e-mail client,
5 http://trojita.flaska.net/
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of
10 the License or (at your option) version 3 or any later version
11 accepted by the membership of KDE e.V. (or its successor approved
12 by the membership of KDE e.V.), which shall act as a proxy
13 defined in Section 14 of version 3 of the license.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef GUI_ONEENVELOPEADDRESS_H
24 #define GUI_ONEENVELOPEADDRESS_H
26 #include <QModelIndex>
27 #include <QLabel>
28 #include "Imap/Parser/MailAddress.h"
30 namespace Plugins {
31 class PluginManager;
34 namespace Gui {
36 class MessageView;
38 /** @short Widget displaying the message envelope */
39 class OneEnvelopeAddress : public QLabel
41 Q_OBJECT
42 public:
43 /** @short Is this the last item in a list? */
44 enum class Position {
45 Middle, /**< We are not the last item in a row */
46 Last, /**< This is the last item */
49 OneEnvelopeAddress(QWidget *parent, const Imap::Message::MailAddress &address, MessageView *messageView, const Position lastOneInRow);
51 virtual void contextMenuEvent(QContextMenuEvent *e) override;
53 private slots:
54 void onLinkHovered(const QString &target);
55 void finishOnLinkHovered(const QStringList &matchingDisplayNames);
56 void processAddress();
57 void finishProcessAddress(const QStringList &matchingDisplayNames);
59 private:
60 QString contactKnownUrl, contactUnknownUrl;
61 Imap::Message::MailAddress m_address;
62 Position m_lastOneInRow;
63 Plugins::PluginManager *m_pluginManager;
64 QString m_link;
66 OneEnvelopeAddress(const OneEnvelopeAddress &); // don't implement
67 OneEnvelopeAddress &operator=(const OneEnvelopeAddress &); // don't implement
72 #endif