Commit 08fbcb4c authored by Laurent Montel's avatar Laurent Montel 😁

We depend against qt5.7 now

parent f8cffc87
...@@ -93,12 +93,10 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p ...@@ -93,12 +93,10 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p
mWebShortcutMenuManager = new KIO::KUriFilterSearchProviderActions(this); mWebShortcutMenuManager = new KIO::KUriFilterSearchProviderActions(this);
mShareServiceManager = new PimCommon::ShareServiceUrlManager(this); mShareServiceManager = new PimCommon::ShareServiceUrlManager(this);
connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this, &ArticleViewerWebEngine::slotServiceUrlSelected); connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this, &ArticleViewerWebEngine::slotServiceUrlSelected);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
connect(page(), &QWebEnginePage::audioMutedChanged, connect(page(), &QWebEnginePage::audioMutedChanged,
this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged); this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged);
connect(page(), &QWebEnginePage::recentlyAudibleChanged, connect(page(), &QWebEnginePage::recentlyAudibleChanged,
this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged); this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged);
#endif
connect(WebEngineViewer::LocalDataBaseManager::self(), &WebEngineViewer::LocalDataBaseManager::checkUrlFinished, this, &ArticleViewerWebEngine::slotCheckedUrlFinished); connect(WebEngineViewer::LocalDataBaseManager::self(), &WebEngineViewer::LocalDataBaseManager::checkUrlFinished, this, &ArticleViewerWebEngine::slotCheckedUrlFinished);
...@@ -111,9 +109,7 @@ ArticleViewerWebEngine::~ArticleViewerWebEngine() ...@@ -111,9 +109,7 @@ ArticleViewerWebEngine::~ArticleViewerWebEngine()
void ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged() void ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
Q_EMIT webPageMutedOrAudibleChanged(page()->isAudioMuted(), page()->recentlyAudible()); Q_EMIT webPageMutedOrAudibleChanged(page()->isAudioMuted(), page()->recentlyAudible());
#endif
} }
QVariantHash ArticleViewerWebEngine::introductionData() const QVariantHash ArticleViewerWebEngine::introductionData() const
...@@ -175,11 +171,7 @@ void ArticleViewerWebEngine::slotCopyImageLocationInFrame() ...@@ -175,11 +171,7 @@ void ArticleViewerWebEngine::slotCopyImageLocationInFrame()
void ArticleViewerWebEngine::slotMute(bool mute) void ArticleViewerWebEngine::slotMute(bool mute)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
page()->setAudioMuted(mute); page()->setAudioMuted(mute);
#else
Q_UNUSED(mute);
#endif
} }
void ArticleViewerWebEngine::slotCopyLinkAddress() void ArticleViewerWebEngine::slotCopyLinkAddress()
...@@ -257,14 +249,12 @@ void ArticleViewerWebEngine::slotWebHitFinished(const WebEngineViewer::WebHitTes ...@@ -257,14 +249,12 @@ void ArticleViewerWebEngine::slotWebHitFinished(const WebEngineViewer::WebHitTes
popup.addSeparator(); popup.addSeparator();
popup.addActions(viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedSelection)); popup.addActions(viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedSelection));
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
popup.addSeparator(); popup.addSeparator();
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_print"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_print")));
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_printpreview"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_printpreview")));
popup.addSeparator(); popup.addSeparator();
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_mute"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_mute")));
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_unmute"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_unmute")));
#endif
popup.addSeparator(); popup.addSeparator();
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("find_in_messages"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("find_in_messages")));
if (KPIMTextEdit::TextToSpeech::self()->isReady()) { if (KPIMTextEdit::TextToSpeech::self()->isReady()) {
...@@ -351,9 +341,7 @@ void ArticleViewerWebEngine::setArticleAction(ArticleViewerWebEngine::ArticleAct ...@@ -351,9 +341,7 @@ void ArticleViewerWebEngine::setArticleAction(ArticleViewerWebEngine::ArticleAct
void ArticleViewerWebEngine::restoreCurrentPosition() void ArticleViewerWebEngine::restoreCurrentPosition()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
mPageEngine->runJavaScript(WebEngineViewer::WebEngineScript::scrollToRelativePosition(relativePosition())); mPageEngine->runJavaScript(WebEngineViewer::WebEngineScript::scrollToRelativePosition(relativePosition()));
#endif
} }
void ArticleViewerWebEngine::forwardMouseReleaseEvent(QMouseEvent *event) void ArticleViewerWebEngine::forwardMouseReleaseEvent(QMouseEvent *event)
......
...@@ -25,11 +25,7 @@ using namespace Akregator; ...@@ -25,11 +25,7 @@ using namespace Akregator;
ArticleViewerWebEnginePage::ArticleViewerWebEnginePage(QWebEngineProfile *profile, QObject *parent) ArticleViewerWebEnginePage::ArticleViewerWebEnginePage(QWebEngineProfile *profile, QObject *parent)
: WebEngineViewer::WebEnginePage(profile, parent) : WebEngineViewer::WebEnginePage(profile, parent)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false); settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
#else
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
#endif
settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false); settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true); settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true);
settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
...@@ -40,12 +36,10 @@ ArticleViewerWebEnginePage::ArticleViewerWebEnginePage(QWebEngineProfile *profil ...@@ -40,12 +36,10 @@ ArticleViewerWebEnginePage::ArticleViewerWebEnginePage(QWebEngineProfile *profil
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false);
settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false); settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false); settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false);
settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false);
#endif
connect(this, &QWebEnginePage::featurePermissionRequested, connect(this, &QWebEnginePage::featurePermissionRequested,
this, &ArticleViewerWebEnginePage::slotFeaturePermissionRequested); this, &ArticleViewerWebEnginePage::slotFeaturePermissionRequested);
......
...@@ -55,9 +55,7 @@ AkrWebEngineViewer::AkrWebEngineViewer(KActionCollection *ac, QWidget *parent) ...@@ -55,9 +55,7 @@ AkrWebEngineViewer::AkrWebEngineViewer(KActionCollection *ac, QWidget *parent)
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false);
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
#endif
} }
AkrWebEngineViewer::~AkrWebEngineViewer() AkrWebEngineViewer::~AkrWebEngineViewer()
...@@ -125,13 +123,11 @@ void AkrWebEngineViewer::slotWebHitFinished(const WebEngineViewer::WebHitTestRes ...@@ -125,13 +123,11 @@ void AkrWebEngineViewer::slotWebHitFinished(const WebEngineViewer::WebHitTestRes
popup.addSeparator(); popup.addSeparator();
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_print"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_print")));
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_printpreview"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("viewer_printpreview")));
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
popup.addSeparator(); popup.addSeparator();
popup.addAction(pageAction(QWebEnginePage::SavePage)); popup.addAction(pageAction(QWebEnginePage::SavePage));
popup.addSeparator(); popup.addSeparator();
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_mute"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_mute")));
popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_unmute"))); popup.addAction(ActionManager::getInstance()->action(QStringLiteral("tab_unmute")));
#endif
const QList<QAction *> interceptorUrlActions = mNetworkAccessManager->interceptorUrlActions(result); const QList<QAction *> interceptorUrlActions = mNetworkAccessManager->interceptorUrlActions(result);
if (!interceptorUrlActions.isEmpty()) { if (!interceptorUrlActions.isEmpty()) {
popup.addSeparator(); popup.addSeparator();
...@@ -154,25 +150,6 @@ void AkrWebEngineViewer::displayContextMenu(const QPoint &pos) ...@@ -154,25 +150,6 @@ void AkrWebEngineViewer::displayContextMenu(const QPoint &pos)
QWebEngineView *AkrWebEngineViewer::createWindow(QWebEnginePage::WebWindowType type) QWebEngineView *AkrWebEngineViewer::createWindow(QWebEnginePage::WebWindowType type)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 1) Q_UNUSED(type);
return this; return this;
#else
switch (type) {
//For the moment create external windows.
case QWebEnginePage::WebDialog:
//TODO add in tab
case QWebEnginePage::WebBrowserTab:
case QWebEnginePage::WebBrowserWindow: {
if (!Settings::newWindowInTab()) {
WebEngineViewer::WebEngineView *view = new WebEngineViewer::WebEngineView();
view->setAttribute(Qt::WA_DeleteOnClose);
view->show();
return view;
}
}
default:
break;
}
return QWebEngineView::createWindow(type);
#endif
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment