summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-04-20 21:01:11 +0200
committerMontel Laurent <[email protected]>2016-04-20 21:01:34 +0200
commit021f44e7b04477220345482d60cacb4fc6ae5907 (patch)
treee84c80be422e45d9c3ed6e84073a07b37c6867c7
parenta9f0fc4c3c7de95e5aac5772219bce755b96cbca (diff)
Use QtWebengine
-rw-r--r--CMakeLists.txt11
-rw-r--r--src/config-libksieve.h.cmake1
-rw-r--r--src/ksieveui/CMakeLists.txt15
-rw-r--r--src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp11
-rw-r--r--src/ksieveui/editor/sieveeditorhelphtmlwidget.h8
-rw-r--r--src/ksieveui/editor/sieveeditorwebview.cpp77
-rw-r--r--src/ksieveui/editor/sieveeditorwebview.h37
7 files changed, 6 insertions, 154 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 084a326..d22b117 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ include(ECMAddTests)
set(KF5_VERSION "5.19.0")
set(LIBKSIEVE_LIB_VERSION "5.2.40")
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
-set(QT_REQUIRED_VERSION "5.4.0")
+set(QT_REQUIRED_VERSION "5.6.0")
set(KMIME_LIB_VERSION "5.2.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.2.40")
set(KMAILTRANSPORT_LIB_VERSION "5.2.40")
@@ -53,14 +53,7 @@ set_package_properties(Sasl2 PROPERTIES
)
-option(QTWEBENGINE_SUPPORT_OPTION "Enable support for QtWebEngine. False by default." FALSE)
-
-if (QTWEBENGINE_SUPPORT_OPTION)
- set(QT_REQUIRED_MINIMUM_WEBENGINE_VERSION "5.6")
- find_package(Qt5 ${QT_REQUIRED_MINIMUM_WEBENGINE_VERSION} CONFIG REQUIRED WebEngine WebEngineWidgets)
-else()
- find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED WebKitWidgets)
-endif()
+find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED WebEngine WebEngineWidgets)
ecm_setup_version(${LIBKSIEVE_LIB_VERSION} VARIABLE_PREFIX LIBKSIEVE
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/libksieve_version.h"
diff --git a/src/config-libksieve.h.cmake b/src/config-libksieve.h.cmake
index 4715949..d7b8e56 100644
--- a/src/config-libksieve.h.cmake
+++ b/src/config-libksieve.h.cmake
@@ -1,4 +1,3 @@
/* The size of a `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG ${SIZEOF_UNSIGNED_LONG}
-#cmakedefine QTWEBENGINE_SUPPORT_OPTION 1
diff --git a/src/ksieveui/CMakeLists.txt b/src/ksieveui/CMakeLists.txt
index 3fdd168..891d2bf 100644
--- a/src/ksieveui/CMakeLists.txt
+++ b/src/ksieveui/CMakeLists.txt
@@ -39,17 +39,10 @@ set(ksieveui_vacation_LIB_SRCS
vacation/legacy/vacationutils.cpp
vacation/legacy/vacationscriptextractor.cpp
)
-if (QTWEBENGINE_SUPPORT_OPTION)
- set(ksieveui_webpageeditor_LIB_SRCS
- editor/sieveeditorwebengineview.cpp
- )
- set(ksieveui_web_LIB Qt5::WebEngineWidgets)
-else()
- set(ksieveui_webpageeditor_LIB_SRCS
- editor/sieveeditorwebview.cpp
- )
- set(ksieveui_web_LIB Qt5::WebKitWidgets)
-endif()
+set(ksieveui_webpageeditor_LIB_SRCS
+ editor/sieveeditorwebengineview.cpp
+ )
+set(ksieveui_web_LIB Qt5::WebEngineWidgets)
set(ksieveui_editor_LIB_SRCS
${ksieveui_webpageeditor_LIB_SRCS}
diff --git a/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp b/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
index d8c8af7..feceedb 100644
--- a/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
+++ b/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
@@ -18,11 +18,7 @@
#include "sieveeditorhelphtmlwidget.h"
#include "sieveeditorloadprogressindicator.h"
-#ifdef QTWEBENGINE_SUPPORT_OPTION
#include "sieveeditorwebengineview.h"
-#else
-#include "sieveeditorwebview.h"
-#endif
#include <QVBoxLayout>
@@ -41,17 +37,10 @@ SieveEditorHelpHtmlWidget::SieveEditorHelpHtmlWidget(QWidget *parent)
mProgressIndicator = new SieveEditorLoadProgressIndicator(this);
connect(mProgressIndicator, &SieveEditorLoadProgressIndicator::pixmapChanged, this, &SieveEditorHelpHtmlWidget::slotPixmapChanged);
connect(mProgressIndicator, &SieveEditorLoadProgressIndicator::loadFinished, this, &SieveEditorHelpHtmlWidget::slotLoadFinished);
-#ifdef QTWEBENGINE_SUPPORT_OPTION
mWebView = new SieveEditorWebEngineView;
connect(mWebView, &SieveEditorWebEngineView::titleChanged, this, &SieveEditorHelpHtmlWidget::slotTitleChanged);
connect(mWebView, &SieveEditorWebEngineView::loadStarted, this, &SieveEditorHelpHtmlWidget::slotLoadStarted);
connect(mWebView, &SieveEditorWebEngineView::loadFinished, this, &SieveEditorHelpHtmlWidget::slotFinished);
-#else
- mWebView = new SieveEditorWebView;
- connect(mWebView, &SieveEditorWebView::titleChanged, this, &SieveEditorHelpHtmlWidget::slotTitleChanged);
- connect(mWebView, &SieveEditorWebView::loadStarted, this, &SieveEditorHelpHtmlWidget::slotLoadStarted);
- connect(mWebView, &SieveEditorWebView::loadFinished, this, &SieveEditorHelpHtmlWidget::slotFinished);
-#endif
QVBoxLayout *lay = new QVBoxLayout;
lay->addWidget(mWebView);
setLayout(lay);
diff --git a/src/ksieveui/editor/sieveeditorhelphtmlwidget.h b/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
index 84e0053..0806257 100644
--- a/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
+++ b/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
@@ -24,11 +24,7 @@
namespace KSieveUi
{
-#ifdef QTWEBENGINE_SUPPORT_OPTION
class SieveEditorWebEngineView;
-#else
-class SieveEditorWebView;
-#endif
class SieveEditorLoadProgressIndicator;
class SieveEditorHelpHtmlWidget : public QWidget
{
@@ -59,11 +55,7 @@ private Q_SLOTS:
void slotLoadFinished(bool success);
private:
QString mTitle;
-#ifdef QTWEBENGINE_SUPPORT_OPTION
SieveEditorWebEngineView *mWebView;
-#else
- SieveEditorWebView *mWebView;
-#endif
SieveEditorLoadProgressIndicator *mProgressIndicator;
qreal mZoomFactor;
};
diff --git a/src/ksieveui/editor/sieveeditorwebview.cpp b/src/ksieveui/editor/sieveeditorwebview.cpp
deleted file mode 100644
index 22b0cac..0000000
--- a/src/ksieveui/editor/sieveeditorwebview.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- Copyright (c) 2014-2016 Montel Laurent <[email protected]>
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License, version 2, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "sieveeditorwebview.h"
-#include <QMenu>
-#include <QWebPage>
-#include <QContextMenuEvent>
-
-using namespace KSieveUi;
-
-SieveEditorWebView::SieveEditorWebView(QWidget *parent)
- : QWebView(parent)
-{
-}
-
-SieveEditorWebView::~SieveEditorWebView()
-{
-}
-
-void SieveEditorWebView::contextMenuEvent(QContextMenuEvent *ev)
-{
- QMenu menu;
- QAction *act = pageAction(QWebPage::Back);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
- act = pageAction(QWebPage::Forward);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
-
- if (!menu.actions().isEmpty()) {
- QAction *separator = new QAction(&menu);
- separator->setSeparator(true);
- menu.addAction(separator);
- }
-
- act = pageAction(QWebPage::Copy);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
-
- if (!menu.actions().isEmpty()) {
- QAction *separator = new QAction(&menu);
- separator->setSeparator(true);
- menu.addAction(separator);
- }
- act = pageAction(QWebPage::Reload);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
-
- act = pageAction(QWebPage::SelectAll);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
- act = pageAction(QWebPage::CopyLinkToClipboard);
- if (act->isEnabled()) {
- menu.addAction(act);
- }
- menu.exec(ev->globalPos());
-}
-
diff --git a/src/ksieveui/editor/sieveeditorwebview.h b/src/ksieveui/editor/sieveeditorwebview.h
deleted file mode 100644
index 391a6d9..0000000
--- a/src/ksieveui/editor/sieveeditorwebview.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Copyright (c) 2014-2016 Montel Laurent <[email protected]>
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License, version 2, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef SIEVEEDITORWEBVIEW_H
-#define SIEVEEDITORWEBVIEW_H
-
-#include <QWebView>
-
-namespace KSieveUi
-{
-class SieveEditorWebView : public QWebView
-{
- Q_OBJECT
-public:
- explicit SieveEditorWebView(QWidget *parent = Q_NULLPTR);
- ~SieveEditorWebView();
-
-protected:
- void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
-};
-}
-
-#endif // SIEVEEDITORWEBVIEW_H