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 <MessageViewer/WebEngineView>
22 #include <openurlrequest.h>
23 #include <shareserviceurlmanager.h>
24 #include <MessageViewer/ViewerPluginInterface>
26 class KActionCollection
;
27 namespace MessageViewer
29 class WebHitTestResult
;
30 class ViewerPluginToolManager
;
31 class ViewerPluginInterface
;
32 class MailWebEngineAccessKey
;
33 class NetworkAccessManagerWebEngine
;
37 class ShareServiceUrlManager
;
41 class KUriFilterSearchProviderActions
;
45 class ArticleViewerWebEnginePage
;
46 class AKREGATOR_EXPORT ArticleViewerWebEngine
: public MessageViewer::WebEngineView
57 OpenInExternalBrowser
,
61 explicit ArticleViewerWebEngine(KActionCollection
*ac
, QWidget
*parent
);
62 ~ArticleViewerWebEngine();
66 void disableIntroduction();
67 void setArticleAction(ArticleViewerWebEngine::ArticleAction type
, const QString
&articleId
, const QString
&feed
);
69 void createViewerPluginToolManager(KActionCollection
*ac
, QWidget
*parent
);
73 KActionCollection
*mActionCollection
;
74 PimCommon::ShareServiceUrlManager
*mShareServiceManager
;
75 KIO::KUriFilterSearchProviderActions
*mWebShortcutMenuManager
;
78 enum MousePressedButtonType
{
84 void paintAboutScreen(const QString
&templateName
, const QVariantHash
&data
);
85 QVariantHash
introductionData() const;
88 void slotPrintPreview();
91 void slotSaveLinkAs();
92 void slotCopyLinkAddress();
93 void slotSaveImageOnDiskInFrame();
94 void slotCopyImageLocationInFrame();
95 void slotBlockImage();
98 void signalOpenUrlRequest(Akregator::OpenUrlRequest
&);
99 void showStatusBarMessage(const QString
&link
);
100 void showContextMenu(const QPoint
&pos
);
101 void articleAction(Akregator::ArticleViewerWebEngine::ArticleAction type
, const QString
&articleId
, const QString
&feed
);
102 void findTextInHtml();
106 void resizeEvent(QResizeEvent
*e
) Q_DECL_OVERRIDE
;
108 virtual void displayContextMenu(const QPoint
&pos
);
109 void forwardKeyReleaseEvent(QKeyEvent
*e
) Q_DECL_OVERRIDE
;
110 void forwardKeyPressEvent(QKeyEvent
*e
) Q_DECL_OVERRIDE
;
111 void forwardWheelEvent(QWheelEvent
*e
) Q_DECL_OVERRIDE
;
112 void forwardMouseReleaseEvent(QMouseEvent
*event
) Q_DECL_OVERRIDE
;
115 void slotServiceUrlSelected(PimCommon::ShareServiceUrlManager::ServiceType type
);
116 void slotLinkHovered(const QString
&link
);
117 void slotLoadStarted();
118 void slotLoadFinished();
119 void slotLinkClicked(const QUrl
&url
);
120 void slotOpenLinkInForegroundTab();
121 void slotOpenLinkInBackgroundTab();
122 void slotOpenLinkInBrowser();
123 void slotShowContextMenu(const QPoint
&pos
);
124 void slotWebHitFinished(const MessageViewer::WebHitTestResult
&result
);
125 void slotActivatePlugin(MessageViewer::ViewerPluginInterface
*interface
);
127 ArticleViewerWebEnginePage
*mPageEngine
;
129 bool adblockEnabled() const;
131 void contextMenuEvent(QContextMenuEvent
*e
) Q_DECL_OVERRIDE
;
132 QList
<QAction
*> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features
);
134 MousePressedButtonType mLastButtonClicked
;
135 MessageViewer::ViewerPluginToolManager
*mViewerPluginToolManager
;
136 MessageViewer::MailWebEngineAccessKey
*mWebEngineViewAccessKey
;
137 MessageViewer::NetworkAccessManagerWebEngine
*mNetworkAccessManager
;
141 #endif // ARTICLEVIEWERWEBENGINE_H