• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • viewer
mailsourceviewer.h
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  *
3  * This file is part of KMail, the KDE mail client.
4  *
5  * Copyright (c) 2002-2003 Carsten Pfeiffer <pfeiffer@kde.org>
6  * Copyright (c) 2003 Zack Rusin <zack@kde.org>
7  *
8  * KMail is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License, version 2, as
10  * published by the Free Software Foundation.
11  *
12  * KMail is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  * In addition, as a special exception, the copyright holders give
22  * permission to link the code of this program with any edition of
23  * the Qt library by Trolltech AS, Norway (or with modified versions
24  * of Qt that use the same license as Qt), and distribute linked
25  * combinations including the two. You must obey the GNU General
26  * Public License in all respects for all of the code used other than
27  * Qt. If you modify this file, you may extend this exception to
28  * your version of the file, but you are not obligated to do so. If
29  * you do not wish to do so, delete this exception statement from
30  * your version.
31  */
32 #ifndef MAILSOURCEVIEWER_H
33 #define MAILSOURCEVIEWER_H
34 
35 #include <QSyntaxHighlighter>
36 #include <QPlainTextEdit>
37 #include <KDialog>
38 class KTabWidget;
39 
40 namespace MessageViewer {
41 class FindBarSourceView;
42 
51 class MailSourceViewTextBrowser;
52 class MailSourceHighlighter : public QSyntaxHighlighter
53 {
54 public:
55  explicit MailSourceHighlighter( QTextDocument * textdocument )
56  : QSyntaxHighlighter( textdocument )
57  {}
58 protected:
59  void highlightBlock ( const QString & text );
60 };
61 
62 class MailSourceViewTextBrowserWidget : public QWidget
63 {
64  Q_OBJECT
65 public:
66  explicit MailSourceViewTextBrowserWidget( QWidget *parent = 0 );
67 
68  void setText( const QString& text );
69  void setPlainText( const QString& text );
70  void setFixedFont();
71  MessageViewer::MailSourceViewTextBrowser *textBrowser() const;
72 private slots:
73  void slotFind();
74 private:
75  MailSourceViewTextBrowser *mTextBrowser;
76  FindBarSourceView *mFindBar;
77 };
78 
79 class MailSourceViewTextBrowser: public QPlainTextEdit
80 {
81  Q_OBJECT
82 public:
83  explicit MailSourceViewTextBrowser( QWidget *parent = 0 );
84 protected:
85  void contextMenuEvent( QContextMenuEvent *event );
86 private slots:
87  void slotSpeakText();
88  void slotSaveAs();
89 signals:
90  void findText();
91 };
92 
93 namespace HTMLPrettyFormatter
94 {
95 // Best to be really verbose about this one...
96 const QRegExp htmlTagRegExp( QLatin1String("<"
97  "(/)?" //Captures the / if this is an end tag.
98  "(\\w+)" //Captures TagName
99  "(?:" //Groups tag contents
100  "(?:\\s+" //Groups attributes
101  "(?:\\w+)" //Attribute name
102  "(?:" //groups =value portion.
103  "\\s*=\\s*" // =
104  "(?:" //Groups attribute "value" portion.
105  "\\\"(?:[^\\\"]*)\\\"" // attVal='double quoted'
106  "|'(?:[^']*)'" // attVal='single quoted'
107  "|(?:[^'"">\\s]+)" // attVal=urlnospaces
108  ")"
109  ")?" //end optional att value portion.
110  ")+\\s*" //One or more attribute pairs
111  "|\\s*" //Some white space.
112  ")"
113  "(/)?>" //Captures the "/" if this is a complete tag.
114  ));
115 
116 const QString reformat( const QString &src );
117 }
118 
119 class MailSourceViewer : public KDialog
120 {
121  Q_OBJECT
122 public:
123  explicit MailSourceViewer( QWidget *parent = 0 );
124  ~MailSourceViewer();
125 
126  void setRawSource( const QString &source );
127  void setDisplayedSource( const QString &source );
128  void setFixedFont();
129 private:
130  MailSourceViewTextBrowserWidget *mRawBrowser;
131  FindBarSourceView *mFindBar;
132 #ifndef NDEBUG
133  KTabWidget *mTabWidget;
134  MailSourceViewTextBrowserWidget *mHtmlBrowser;
135 #endif
136 };
137 
138 }
139 #endif // MAILSOURCEVIEWER_H
MessageViewer::MailSourceViewTextBrowser::MailSourceViewTextBrowser
MailSourceViewTextBrowser(QWidget *parent=0)
Definition: mailsourceviewer.cpp:106
MessageViewer::MailSourceViewTextBrowser
Definition: mailsourceviewer.h:79
QWidget
MessageViewer::MailSourceViewer::MailSourceViewer
MailSourceViewer(QWidget *parent=0)
Definition: mailsourceviewer.cpp:236
KDialog
MessageViewer::FindBarSourceView
Definition: findbarsourceview.h:29
MessageViewer::MailSourceViewTextBrowser::findText
void findText()
MessageViewer::MailSourceViewTextBrowserWidget::setFixedFont
void setFixedFont()
Definition: mailsourceviewer.cpp:96
MessageViewer::MailSourceViewTextBrowserWidget::setPlainText
void setPlainText(const QString &text)
Definition: mailsourceviewer.cpp:91
MessageViewer::HTMLPrettyFormatter::htmlTagRegExp
const QRegExp htmlTagRegExp(QLatin1String("<""(/)?""(\\w+)""(?:""(?:\\s+""(?:\\w+)""(?:""\\s*=\\s*""(?:""\\\"(?:[^\\\"]*)\\\"""|'(?:[^']*)'""|(?:[^'"">\\s]+)"")"")?"")+\\s*""|\\s*"")""(/)?>"))
MessageViewer::MailSourceHighlighter::highlightBlock
void highlightBlock(const QString &text)
Definition: mailsourceviewer.cpp:148
MessageViewer::MailSourceViewTextBrowserWidget::textBrowser
MessageViewer::MailSourceViewTextBrowser * textBrowser() const
Definition: mailsourceviewer.cpp:101
MessageViewer::MailSourceViewTextBrowserWidget::setText
void setText(const QString &text)
Definition: mailsourceviewer.cpp:86
MessageViewer::MailSourceHighlighter
Definition: mailsourceviewer.h:52
MessageViewer::MailSourceViewTextBrowserWidget
Definition: mailsourceviewer.h:62
QPlainTextEdit
MessageViewer::MailSourceViewer::setRawSource
void setRawSource(const QString &source)
Definition: mailsourceviewer.cpp:286
MessageViewer::MailSourceViewer
Definition: mailsourceviewer.h:119
QSyntaxHighlighter
MessageViewer::MailSourceHighlighter::MailSourceHighlighter
MailSourceHighlighter(QTextDocument *textdocument)
Definition: mailsourceviewer.h:55
MessageViewer::MailSourceViewer::~MailSourceViewer
~MailSourceViewer()
Definition: mailsourceviewer.cpp:282
MessageViewer::MailSourceViewTextBrowserWidget::MailSourceViewTextBrowserWidget
MailSourceViewTextBrowserWidget(QWidget *parent=0)
Definition: mailsourceviewer.cpp:60
MessageViewer::MailSourceViewTextBrowser::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event)
Definition: mailsourceviewer.cpp:111
MessageViewer::MailSourceViewer::setDisplayedSource
void setDisplayedSource(const QString &source)
Definition: mailsourceviewer.cpp:291
MessageViewer::HTMLPrettyFormatter::reformat
const QString reformat(const QString &src)
Definition: mailsourceviewer.cpp:180
MessageViewer::MailSourceViewer::setFixedFont
void setFixedFont()
Definition: mailsourceviewer.cpp:300
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal