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 <[email protected]>
6  SPDX-FileCopyrightText: 2003 Marc Mutz <[email protected]>
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>
15 class QMouseEvent;
16 
17 namespace 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 <[email protected]>, Marc Mutz <[email protected]>
39  **/
40 class HtmlStatusBar : public QLabel
41 {
42  Q_OBJECT
43 public:
44  enum UpdateMode { NoUpdate, Update };
45 
46  explicit HtmlStatusBar(QWidget *parent = nullptr);
47  ~HtmlStatusBar() override;
48 
49  /** @return current mode. */
50  Q_REQUIRED_RESULT MimeTreeParser::Util::HtmlMode mode() const;
51  Q_REQUIRED_RESULT bool isHtml() const;
52  Q_REQUIRED_RESULT bool isNormal() const;
53 
54  // Update the status bar, for example when the color scheme changed.
55  void update();
56 
57  void setAvailableModes(const QList<MimeTreeParser::Util::HtmlMode> &availableModes);
58  Q_REQUIRED_RESULT const QList<MimeTreeParser::Util::HtmlMode> &availableModes();
59 
60 public Q_SLOTS:
61  void setHtmlMode();
62  /** Switch to "normal mode". */
63  void setNormalMode();
64  /** Switch to mode @p m */
65  void setMode(MimeTreeParser::Util::HtmlMode m, MessageViewer::HtmlStatusBar::UpdateMode mode = Update);
66 
67 Q_SIGNALS:
68  /** The user has clicked the status bar. */
69  void clicked();
70 
71 protected:
72  void mousePressEvent(QMouseEvent *event) override;
73 
74 private:
75  QString message() const;
76  QString toolTip() const;
77  QColor bgColor() const;
78  QColor fgColor() const;
79 
82 };
83 }
84 
HtmlMode
Describes the type of the displayed message.
void setNormalMode()
Switch to "normal mode".
Q_SIGNALSQ_SIGNALS
void setMode(MimeTreeParser::Util::HtmlMode m, MessageViewer::HtmlStatusBar::UpdateMode mode=Update)
Switch to mode m.
virtual bool event(QEvent *e) override
Q_OBJECTQ_OBJECT
MimeTreeParser::Util::HtmlMode mode() const
The HTML statusbar widget for use with the reader.
Definition: htmlstatusbar.h:40
void clicked()
The user has clicked the status bar.
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.