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 #include <kpimtextedit/kpimtextedit-texttospeech.h>
16 
17 namespace KPIMTextEdit
18 {
19 class SlideContainer;
20 class TextToSpeechWidget;
21 class TextToSpeechInterface;
22 }
23 
24 namespace MessageViewer
25 {
26 class FindBarSourceView;
27 
28 /**
29  * A tiny little class to use for displaying raw messages, textual
30  * attachments etc.
31  *
32  * Auto-deletes itself when closed.
33  *
34  * @author Carsten Pfeiffer <[email protected]>
35  */
36 class MailSourceViewTextBrowser;
37 
38 class MailSourceViewTextBrowserWidget : public QWidget
39 {
40  Q_OBJECT
41 public:
42  explicit MailSourceViewTextBrowserWidget(const QString &syntax, QWidget *parent = nullptr);
43 
44  void setText(const QString &text);
45  void setPlainText(const QString &text);
46  void setFixedFont();
47  Q_REQUIRED_RESULT MessageViewer::MailSourceViewTextBrowser *textBrowser() const;
48 
49 private:
50  void slotFind();
52  MailSourceViewTextBrowser *mTextBrowser = nullptr;
53  FindBarSourceView *mFindBar = nullptr;
54  KPIMTextEdit::SlideContainer *const mSliderContainer;
55 #if KPIMTEXTEDIT_TEXT_TO_SPEECH
56  KPIMTextEdit::TextToSpeechWidget *const mTextToSpeechWidget;
57 #endif
58 };
59 
60 class MailSourceViewTextBrowser : public QPlainTextEdit
61 {
62  Q_OBJECT
63 public:
64 #if KPIMTEXTEDIT_TEXT_TO_SPEECH
65  explicit MailSourceViewTextBrowser(KPIMTextEdit::TextToSpeechInterface *textToSpeechInterface, QWidget *parent = nullptr);
66 #endif
67  explicit MailSourceViewTextBrowser(QWidget *parent);
68 
69 protected:
70  void contextMenuEvent(QContextMenuEvent *event) override;
71 Q_SIGNALS:
72  void findText();
73 
74 private:
75  void slotSpeakText();
76  void slotSaveAs();
77 #if KPIMTEXTEDIT_TEXT_TO_SPEECH
78  KPIMTextEdit::TextToSpeechInterface *mTextToSpeechInterface = nullptr;
79 #endif
80 };
81 }
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 03:53:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.