Messagelib

mailsourceviewtextbrowserwidget.h
1/*
2 *
3 * This file is part of KMail, the KDE mail client.
4 *
5 * SPDX-FileCopyrightText: 2002-2003 Carsten Pfeiffer <pfeiffer@kde.org>
6 * SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org>
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10#pragma once
11
12#include <KSyntaxHighlighting/Repository>
13#include <QPlainTextEdit>
14#include <QSyntaxHighlighter>
15namespace TextAddonsWidgets
16{
17class SlideContainer;
18}
19
20#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
21namespace TextEditTextToSpeech
22{
23class TextToSpeechContainerWidget;
24}
25#endif
26
27namespace MessageViewer
28{
29class FindBarSourceView;
30
31/**
32 * A tiny little class to use for displaying raw messages, textual
33 * attachments etc.
34 *
35 * Auto-deletes itself when closed.
36 *
37 * @author Carsten Pfeiffer <pfeiffer@kde.org>
38 */
39class MailSourceViewTextBrowser;
40
41class MailSourceViewTextBrowserWidget : public QWidget
42{
44public:
45 explicit MailSourceViewTextBrowserWidget(const QString &syntax, QWidget *parent = nullptr);
46
47 void setText(const QString &text);
48 void setPlainText(const QString &text);
49 void setFixedFont();
50 [[nodiscard]] MessageViewer::MailSourceViewTextBrowser *textBrowser() const;
51
52private:
53 void slotFind();
55 MailSourceViewTextBrowser *mTextBrowser = nullptr;
56 FindBarSourceView *mFindBar = nullptr;
57 TextAddonsWidgets::SlideContainer *const mSliderContainer;
58#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
59 TextEditTextToSpeech::TextToSpeechContainerWidget *const mTextToSpeechContainerWidget;
60#endif
61};
62
63class MailSourceViewTextBrowser : public QPlainTextEdit
64{
66public:
67#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
68 explicit MailSourceViewTextBrowser(TextEditTextToSpeech::TextToSpeechContainerWidget *TextToSpeechContainerWidget, QWidget *parent = nullptr);
69#endif
70 explicit MailSourceViewTextBrowser(QWidget *parent);
71
72protected:
73 void contextMenuEvent(QContextMenuEvent *event) override;
75 void findText();
76
77private:
78 void slotSpeakText();
79 void slotSaveAs();
80#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
81 TextEditTextToSpeech::TextToSpeechContainerWidget *mTextToSpeechContainerWidget = nullptr;
82#endif
83};
84}
virtual bool event(QEvent *event) override
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
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 Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.