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

messageviewer

  • sources
  • kde-4.14
  • kdepim
  • messageviewer
  • viewer
mailwebview.h
Go to the documentation of this file.
1 /* Copyright 2010 Thomas McGuire <mcguire@kde.org>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of
6  the License or (at your option) version 3 or any later version
7  accepted by the membership of KDE e.V. (or its successor approved
8  by the membership of KDE e.V.), which shall act as a proxy
9  defined in Section 14 of version 3 of the license.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef MESSAGEVIEWER_MAILWEBVIEW_H
21 #define MESSAGEVIEWER_MAILWEBVIEW_H
22 
23 #include "messageviewer/settings/globalsettings.h"
24 
25 #ifdef KDEPIM_NO_WEBKIT
26 # include <QTextBrowser>
27 #else
28 # include <KWebView>
29 #endif
30 
31 #ifndef Q_MOC_RUN
32 #include <boost/function.hpp>
33 #endif
34 
35 class QLabel;
36 class KActionCollection;
37 
38 namespace MessageViewer {
39 #ifndef KDEPIM_NO_WEBKIT
40 class ScamDetection;
41 #endif
42 
44 #ifdef KDEPIM_NO_WEBKIT
45 class MESSAGEVIEWER_EXPORT MailWebView : public QTextBrowser // krazy:exclude=qclasses
46 #else
47 class MESSAGEVIEWER_EXPORT MailWebView : public KWebView
48 #endif
49 {
50  Q_OBJECT
51 public:
52 
53  explicit MailWebView(KActionCollection *actionCollection = 0, QWidget *parent=0 );
54  ~MailWebView();
55 
56  enum FindFlag {
57  FindWrapsAroundDocument = 1,
58  FindBackward = 2,
59  FindCaseSensitively = 4,
60  HighlightAllOccurrences = 8,
61 
62  NumFindFlags
63  };
64  Q_DECLARE_FLAGS( FindFlags, FindFlag )
65 
66  bool findText( const QString & test, FindFlags flags );
67  void clearFindSelection();
68 
69  void scrollUp( int pixels );
70  void scrollDown( int pixels );
71  bool isScrolledToBottom() const;
72  bool hasVerticalScrollBar() const;
73  void scrollPageDown( int percent );
74  void scrollPageUp( int percent );
75  void scrollToAnchor( const QString & anchor );
76 
77  QString selectedText() const;
78  bool isAttachmentInjectionPoint( const QPoint & globalPos ) const;
79  void injectAttachments( const boost::function<QString()> & delayedHtml );
80  bool removeAttachmentMarking( const QString & id );
81  void markAttachment( const QString & id, const QString & style );
82  bool replaceInnerHtml( const QString & id, const boost::function<QString()> & delayedHtml );
83  void setElementByIdVisible( const QString & id, bool visible );
84  void setHtml( const QString & html, const QUrl & baseUrl );
85  QString htmlSource() const;
86  void selectAll();
87  void clearSelection();
88  void scrollToRelativePosition( double pos );
89  double relativePosition() const;
90 
91  void setAllowExternalContent( bool allow );
92 
93  QUrl linkOrImageUrlAt( const QPoint & global ) const;
94 
95  void setScrollBarPolicy( Qt::Orientation orientation, Qt::ScrollBarPolicy policy );
96  Qt::ScrollBarPolicy scrollBarPolicy( Qt::Orientation orientation ) const;
97 
98  bool isAShortUrl(const KUrl &url) const;
99  void expandUrl(const KUrl &url);
100 
101 #ifndef KDEPIM_NO_WEBKIT
102  void scamCheck();
103  void saveMainFrameScreenshotInFile(const QString &filename);
104  void openBlockableItemsDialog();
105 #endif
106 
107 public Q_SLOTS:
108  void slotShowDetails();
109 
110 Q_SIGNALS:
111 
115  void popupMenu( const QUrl &url, const QUrl&imageUrl, const QPoint &point );
116 
117  void linkHovered( const QString & link, const QString & title=QString(), const QString & textContent=QString() );
118 #ifdef KDEPIM_NO_WEBKIT
119  void linkClicked( const QUrl & link );
120 #endif
121  void messageMayBeAScam();
122 
123 protected:
124 #ifdef KDEPIM_MOBILE_UI
125  friend class MessageViewItem;
126 #endif
127  virtual bool event( QEvent *event );
130  virtual void keyReleaseEvent(QKeyEvent*);
131  virtual void keyPressEvent(QKeyEvent*);
132  virtual void wheelEvent (QWheelEvent* e);
133 
134 private Q_SLOTS:
135  void hideAccessKeys();
136 
137 private:
138 #ifndef KDEPIM_NO_WEBKIT
139  bool checkForAccessKey(QKeyEvent *event);
140  void showAccessKeys();
141  void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element);
142  enum AccessKeyState {
143  NotActivated,
144  PreActivated,
145  Activated
146  };
147  AccessKeyState mAccessKeyActivated;
148  QList<QLabel*> mAccessKeyLabels;
149  QHash<QChar, QWebElement> mAccessKeyNodes;
150  QHash<QString, QChar> mDuplicateLinkElements;
151 
152  ScamDetection *mScamDetection;
153 #endif
154  KActionCollection *mActionCollection;
155 };
156 
157 }
158 
159 Q_DECLARE_OPERATORS_FOR_FLAGS( MessageViewer::MailWebView::FindFlags )
160 
161 #endif /* MESSAGEVIEWER_MAILWEBVIEW_H */
QEvent
globalsettings.h
QWidget
QChar
QWheelEvent
QPoint
QHash< QChar, QWebElement >
MessageViewer::MailWebView
MailWebView extends KWebView so that it can emit the popupMenu() signal.
Definition: mailwebview.h:47
QWebElement
QString
QList< QLabel * >
QUrl
MESSAGEVIEWER_EXPORT
#define MESSAGEVIEWER_EXPORT
Definition: messageviewer_export.h:37
QKeyEvent
MessageViewer::MailWebView::FindFlag
FindFlag
Definition: mailwebview.h:56
QTextBrowser
KWebView
QLabel
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:45 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
  • pimprint

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