• 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
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 <qglobal.h> // make sure we have Q_OS_WINCE defined
24 #include "messageviewer/settings/globalsettings.h"
25 
26 #ifdef KDEPIM_NO_WEBKIT
27 # include <QTextBrowser>
28 #else
29 # ifdef Q_OS_WINCE
30 # include <QWebView>
31 # else
32 # include <KWebView>
33 # endif
34 #endif
35 
36 #include <boost/function.hpp>
37 
38 class QLabel;
39 class KActionCollection;
40 
41 namespace MessageViewer {
42 #ifndef KDEPIM_NO_WEBKIT
43 class ScamDetection;
44 #endif
45 
47 #ifdef KDEPIM_NO_WEBKIT
48 class MESSAGEVIEWER_EXPORT MailWebView : public QTextBrowser // krazy:exclude=qclasses
49 #else
50 # ifdef Q_OS_WINCE
51 class MESSAGEVIEWER_EXPORT MailWebView : public QWebView
52 # else
53 class MESSAGEVIEWER_EXPORT MailWebView : public KWebView
54 # endif
55 #endif
56 {
57  Q_OBJECT
58 public:
59 
60  explicit MailWebView(KActionCollection *actionCollection = 0, QWidget *parent=0 );
61  ~MailWebView();
62 
63  enum FindFlag {
64  FindWrapsAroundDocument = 1,
65  FindBackward = 2,
66  FindCaseSensitively = 4,
67  HighlightAllOccurrences = 8,
68 
69  NumFindFlags
70  };
71  Q_DECLARE_FLAGS( FindFlags, FindFlag )
72 
73  bool findText( const QString & test, FindFlags flags );
74  void clearFindSelection();
75 
76  void scrollUp( int pixels );
77  void scrollDown( int pixels );
78  bool isScrolledToBottom() const;
79  bool hasVerticalScrollBar() const;
80  void scrollPageDown( int percent );
81  void scrollPageUp( int percent );
82  void scrollToAnchor( const QString & anchor );
83 
84  QString selectedText() const;
85  bool isAttachmentInjectionPoint( const QPoint & globalPos ) const;
86  void injectAttachments( const boost::function<QString()> & delayedHtml );
87  bool removeAttachmentMarking( const QString & id );
88  void markAttachment( const QString & id, const QString & style );
89  bool replaceInnerHtml( const QString & id, const boost::function<QString()> & delayedHtml );
90  void setElementByIdVisible( const QString & id, bool visible );
91  void setHtml( const QString & html, const QUrl & baseUrl );
92  QString htmlSource() const;
93  void selectAll();
94  void clearSelection();
95  void scrollToRelativePosition( double pos );
96  double relativePosition() const;
97 
98  void setAllowExternalContent( bool allow );
99 
100  QUrl linkOrImageUrlAt( const QPoint & global ) const;
101 
102  void setScrollBarPolicy( Qt::Orientation orientation, Qt::ScrollBarPolicy policy );
103  Qt::ScrollBarPolicy scrollBarPolicy( Qt::Orientation orientation ) const;
104 
105  bool isAShortUrl(const KUrl &url) const;
106  void expandUrl(const KUrl &url);
107 
108 #ifndef KDEPIM_NO_WEBKIT
109  void scamCheck();
110  void saveMainFrameScreenshotInFile(const QString &filename);
111  void openBlockableItemsDialog();
112 #endif
113 
114 public Q_SLOTS:
115  void slotShowDetails();
116 
117 Q_SIGNALS:
118 
122  void popupMenu( const QUrl &url, const QUrl&imageUrl, const QPoint &point );
123 
124  void linkHovered( const QString & link, const QString & title=QString(), const QString & textContent=QString() );
125 #ifdef KDEPIM_NO_WEBKIT
126  void linkClicked( const QUrl & link );
127 #endif
128  void messageMayBeAScam();
129 
130 protected:
131 #ifdef KDEPIM_MOBILE_UI
132  friend class MessageViewItem;
133 #endif
134  virtual bool event( QEvent *event );
137  virtual void keyReleaseEvent(QKeyEvent*);
138  virtual void keyPressEvent(QKeyEvent*);
139  virtual void wheelEvent (QWheelEvent* e);
140 
141 private Q_SLOTS:
142  void hideAccessKeys();
143 
144 private:
145 #ifndef KDEPIM_NO_WEBKIT
146  bool checkForAccessKey(QKeyEvent *event);
147  void showAccessKeys();
148  void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element);
149  enum AccessKeyState {
150  NotActivated,
151  PreActivated,
152  Activated
153  };
154  AccessKeyState mAccessKeyActivated;
155  QList<QLabel*> mAccessKeyLabels;
156  QHash<QChar, QWebElement> mAccessKeyNodes;
157  QHash<QString, QChar> mDuplicateLinkElements;
158 
159  ScamDetection *mScamDetection;
160 #endif
161  KActionCollection *mActionCollection;
162 };
163 
164 }
165 
166 Q_DECLARE_OPERATORS_FOR_FLAGS( MessageViewer::MailWebView::FindFlags )
167 
168 #endif /* MESSAGEVIEWER_MAILWEBVIEW_H */
globalsettings.h
QWidget
MessageViewer::MailWebView
MailWebView extends KWebView so that it can emit the popupMenu() signal.
Definition: mailwebview.h:53
MESSAGEVIEWER_EXPORT
#define MESSAGEVIEWER_EXPORT
Definition: messageviewer_export.h:37
MessageViewer::MailWebView::FindFlag
FindFlag
Definition: mailwebview.h:63
QLabel
KWebView
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