Messagelib

htmlstatusbar.h
1/* -*- c++ -*-
2 htmlstatusbar.h
3
4 This file is part of KMail, the KDE mail client.
5 SPDX-FileCopyrightText: 2002 Ingo Kloecker <kloecker@kde.org>
6 SPDX-FileCopyrightText: 2003 Marc Mutz <mutz@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10#pragma once
11
12#include "messageviewer/messageviewerutil.h"
13#include <MimeTreeParser/Util>
14#include <QLabel>
15class QMouseEvent;
16
17namespace MessageViewer
18{
19/**
20 * @short The HTML statusbar widget for use with the reader.
21 *
22 * The HTML status bar is a small widget that acts as an indicator
23 * for the message content. It can be in one of four modes:
24 *
25 * <dl>
26 * <dt><code>Normal</code></dt>
27 * <dd>Default. No HTML.</dd>
28 * <dt><code>Html</code></dt>
29 * <dd>HTML content is being shown. Since HTML mails can mimic all sorts
30 * of KMail markup in the reader, this provides out-of-band information
31 * about the presence of (rendered) HTML.</dd>
32 * <dt><code>MultipartPlain</code></dt>
33 * <dd>Viewed as plain text with HTML part also available.</dd>
34 * <dt><code>MultipartHtml</code></dt>
35 * <dd>Viewed as Html with plain text part also available.</dd>
36 * </dl>
37 *
38 * @author Ingo Kloecker <kloecker@kde.org>, Marc Mutz <mutz@kde.org>
39 **/
40class HtmlStatusBar : public QLabel
41{
43public:
44 enum UpdateMode {
45 NoUpdate,
46 Update,
47 };
48
49 explicit HtmlStatusBar(QWidget *parent = nullptr);
50 ~HtmlStatusBar() override;
51
52 /** @return current mode. */
54 [[nodiscard]] bool isHtml() const;
55 [[nodiscard]] bool isNormal() const;
56
57 // Update the status bar, for example when the color scheme changed.
58 void update();
59
60 void setAvailableModes(const QList<MimeTreeParser::Util::HtmlMode> &availableModes);
61 [[nodiscard]] const QList<MimeTreeParser::Util::HtmlMode> &availableModes();
62
63public Q_SLOTS:
64 void setHtmlMode();
65 /** Switch to "normal mode". */
66 void setNormalMode();
67 /** Switch to mode @p m */
68 void setMode(MimeTreeParser::Util::HtmlMode m, MessageViewer::HtmlStatusBar::UpdateMode mode = Update);
69
71 /** The user has clicked the status bar. */
72 void clicked();
73
74protected:
75 void mousePressEvent(QMouseEvent *event) override;
76
77private:
78 QString message() const;
79 QString toolTip() const;
80 QColor bgColor() const;
81 QColor fgColor() const;
82
85};
86}
The HTML statusbar widget for use with the reader.
void setMode(MimeTreeParser::Util::HtmlMode m, MessageViewer::HtmlStatusBar::UpdateMode mode=Update)
Switch to mode m.
void setNormalMode()
Switch to "normal mode".
void clicked()
The user has clicked the status bar.
MimeTreeParser::Util::HtmlMode mode() const
HtmlMode
Describes the type of the displayed message.
virtual bool event(QEvent *e) override
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.