2 Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef ARTICLEVIEWERWEBENGINE_H
19 #define ARTICLEVIEWERWEBENGINE_H
21 #include <QWebEngineView>
22 #include <openurlrequest.h>
23 #include <shareserviceurlmanager.h>
25 class KActionCollection
;
26 namespace MessageViewer
28 class WebHitTestResult
;
32 class ShareServiceUrlManager
;
36 class KUriFilterSearchProviderActions
;
40 class AKREGATOR_EXPORT ArticleViewerWebEngine
: public QWebEngineView
51 OpenInExternalBrowser
,
55 explicit ArticleViewerWebEngine(KActionCollection
*ac
, QWidget
*parent
);
56 ~ArticleViewerWebEngine();
60 void disableIntroduction();
61 void setArticleAction(ArticleViewerWebEngine::ArticleAction type
, const QString
&articleId
, const QString
&feed
);
63 bool zoomTextOnlyInFrame() const;
67 KActionCollection
*mActionCollection
;
68 PimCommon::ShareServiceUrlManager
*mShareServiceManager
;
69 KIO::KUriFilterSearchProviderActions
*mWebShortcutMenuManager
;
72 enum MousePressedButtonType
{
78 void paintAboutScreen(const QString
&templateName
, const QVariantHash
&data
);
79 QVariantHash
introductionData() const;
82 void slotPrintPreview();
85 void slotZoomTextOnlyInFrame(bool textOnlyInFrame
);
86 void slotSaveLinkAs();
87 void slotCopyLinkAddress();
88 void slotSaveImageOnDiskInFrame();
89 void slotCopyImageLocationInFrame();
90 void slotBlockImage();
92 void signalOpenUrlRequest(Akregator::OpenUrlRequest
&);
93 void showStatusBarMessage(const QString
&link
);
94 void showContextMenu(const QPoint
&pos
);
95 void articleAction(Akregator::ArticleViewerWebEngine::ArticleAction type
, const QString
&articleId
, const QString
&feed
);
96 void findTextInHtml();
100 void keyReleaseEvent(QKeyEvent
*e
) Q_DECL_OVERRIDE
;
101 void keyPressEvent(QKeyEvent
*e
) Q_DECL_OVERRIDE
;
102 void wheelEvent(QWheelEvent
*e
) Q_DECL_OVERRIDE
;
103 void resizeEvent(QResizeEvent
*e
) Q_DECL_OVERRIDE
;
104 void mouseReleaseEvent(QMouseEvent
*event
) Q_DECL_OVERRIDE
;
106 virtual void displayContextMenu(const QPoint
&pos
);
109 void slotServiceUrlSelected(PimCommon::ShareServiceUrlManager::ServiceType type
);
110 void slotLinkHovered(const QString
&link
);
111 void slotLoadStarted();
112 void slotLoadFinished();
113 void slotLinkClicked(const QUrl
&url
);
114 void slotOpenLinkInForegroundTab();
115 void slotOpenLinkInBackgroundTab();
116 void slotOpenLinkInBrowser();
117 void slotShowContextMenu(const QPoint
&pos
);
119 MessageViewer::WebHitTestResult
*mContextMenuHitResult
;
121 bool adblockEnabled() const;
123 void contextMenuEvent(QContextMenuEvent
*e
) Q_DECL_OVERRIDE
;
125 QUrl
linkOrImageUrlAt(const QPoint
&global
) const;
126 MousePressedButtonType mLastButtonClicked
;
127 //MessageViewer::WebViewAccessKey *mWebViewAccessKey;
131 #endif // ARTICLEVIEWERWEBENGINE_H