fix Messages.sh after yesterday change in extract-messages.sh
[kdepim.git] / messageviewer / mailwebview.h
blobe02944b5cf5e54d62fcb7ce83641cc059d2305e4
1 /* Copyright 2010 Thomas McGuire <mcguire@kde.org>
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.
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.
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/>.
20 #ifndef MESSAGEVIEWER_MAILWEBVIEW_H__
21 #define MESSAGEVIEWER_MAILWEBVIEW_H__
23 #include <qglobal.h> // make sure we have Q_OS_WINCE defined
25 #ifdef MESSAGEVIEWER_NO_WEBKIT
26 # include <QTextBrowser>
27 #else
28 # ifdef Q_OS_WINCE
29 # include <QWebView>
30 # else
31 # include <KWebView>
32 # endif
33 #endif
35 #include <boost/function.hpp>
37 namespace MessageViewer {
39 /// MailWebView extends KWebView so that it can emit the popupMenu() signal
40 #ifdef MESSAGEVIEWER_NO_WEBKIT
41 class MailWebView : public QTextBrowser
42 #else
43 # ifdef Q_OS_WINCE
44 class MailWebView : public QWebView
45 # else
46 class MailWebView : public KWebView
47 # endif
48 #endif
50 Q_OBJECT
51 public:
53 explicit MailWebView( QWidget *parent=0 );
54 ~MailWebView();
56 enum FindFlag {
57 FindWrapsAroundDocument,
58 FindBackward,
59 FindCaseSensitively,
60 HighlightAllOccurrences,
62 NumFindFlags
64 Q_DECLARE_FLAGS( FindFlags, FindFlag )
66 bool findText( const QString & test, FindFlags flags );
67 void clearFindSelection();
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 );
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 scrollToRelativePosition( double pos );
88 double relativePosition() const;
90 void setAllowExternalContent( bool allow );
92 QUrl linkOrImageUrlAt( const QPoint & global ) const;
94 Q_SIGNALS:
96 /// Emitted when the user right-clicks somewhere
97 /// @param url if an URL was under the cursor, this parameter contains it. Otherwise empty
98 /// @param point position where the click happened, in local coordinates
99 void popupMenu( const QString &url, const QPoint &point );
101 void linkHovered( const QString & link, const QString & title=QString(), const QString & textContent=QString() );
102 #ifdef MESSAGEVIEWER_NO_WEBKIT
103 void linkClicked( const QUrl & link );
104 #endif
106 protected:
107 #ifdef KDEPIM_MOBILE_UI
108 friend class MessageViewItem;
109 #endif
110 /// Reimplemented to catch context menu events and emit popupMenu()
111 virtual bool event( QEvent *event );
116 Q_DECLARE_OPERATORS_FOR_FLAGS( MessageViewer::MailWebView::FindFlags )
118 #endif /* MESSAGEVIEWER_MAILWEBVIEW_H__ */