Messagelib

mailsourceviewtextbrowserwidget.h
1 /*
2  *
3  * This file is part of KMail, the KDE mail client.
4  *
5  * SPDX-FileCopyrightText: 2002-2003 Carsten Pfeiffer <[email protected]>
6  * SPDX-FileCopyrightText: 2003 Zack Rusin <[email protected]>
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>
15 namespace KPIMTextEdit
16 {
17 class SlideContainer;
18 }
19 
20 #ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
21 namespace TextEditTextToSpeech
22 {
23 class TextToSpeechContainerWidget;
24 }
25 #endif
26 
27 namespace MessageViewer
28 {
29 class 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 <[email protected]>
38  */
39 class MailSourceViewTextBrowser;
40 
41 class MailSourceViewTextBrowserWidget : public QWidget
42 {
43  Q_OBJECT
44 public:
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  Q_REQUIRED_RESULT MessageViewer::MailSourceViewTextBrowser *textBrowser() const;
51 
52 private:
53  void slotFind();
55  MailSourceViewTextBrowser *mTextBrowser = nullptr;
56  FindBarSourceView *mFindBar = nullptr;
57  KPIMTextEdit::SlideContainer *const mSliderContainer;
58 #ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
59  TextEditTextToSpeech::TextToSpeechContainerWidget *const mTextToSpeechContainerWidget;
60 #endif
61 };
62 
63 class MailSourceViewTextBrowser : public QPlainTextEdit
64 {
65  Q_OBJECT
66 public:
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 
72 protected:
73  void contextMenuEvent(QContextMenuEvent *event) override;
74 Q_SIGNALS:
75  void findText();
76 
77 private:
78  void slotSpeakText();
79  void slotSaveAs();
80 #ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
81  TextEditTextToSpeech::TextToSpeechContainerWidget *mTextToSpeechContainerWidget = nullptr;
82 #endif
83 };
84 }
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:01:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.