Commit 1ec58e09 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Add support for viewing retrieved HTML data without web engine or kit

BUG:440779
FIXED-IN:8.1.1
parent 8e5c7db8
Pipeline #74274 passed with stage
in 37 minutes and 31 seconds
......@@ -10,6 +10,7 @@ option(BUILD_QT4 "Build for Qt4" OFF)
option(BUILD_DOXYGEN_DOCS "Build api docs" ON)
option(BUILD_APPLETS "Build plasma applets" ON)
option(BUILD_TOOLS "Build tools" ON)
option(BUILD_WITH_WEBKIT "Build with Qt Web Kit library" ON)
if(WIN32)
set(ENABLE_FINANCEQUOTE_DEFAULT 0)
......@@ -37,15 +38,21 @@ include(FeatureSummary)
# check for PkgConfig, Qt and MPIR/GMP
find_package(PkgConfig)
if(BUILD_QT4)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtTest QtWebKit QtDeclarative)
set(QT_USE_LIBSPREFIX Qt4::Qt)
set(ALKIMIA_LIB_SUFFIX "")
set(ALKIMIA_INCLUDE_SUFFIX "Qt4")
set(ALKIMIA_PATH_SUFFIX)
set(PC_TARGET_QTPREFIX Qt)
set(PC_TARGET_SUFFIX)
set(QT_BROWSER_LIB ${QT_USE_LIBSPREFIX}WebKit)
add_definitions(-DBUILD_WITH_WEBKIT)
if(BUILD_WITH_WEBKIT)
add_definitions(-DBUILD_WITH_WEBKIT)
set(QT_BROWSER_LIB QtWebKit)
feature_notes(TRUE TRUE TRUE TRUE)
else()
feature_notes(FALSE TRUE FALSE FALSE)
endif()
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtTest ${QT_BROWSER_LIB} QtDeclarative)
set(_kde4_uninstall_rule_created 1)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
......@@ -79,7 +86,6 @@ if(BUILD_QT4)
if(NOT SHARE_INSTALL_DIR)
set(SHARE_INSTALL_DIR ${DATA_INSTALL_DIR})
endif()
feature_notes(TRUE TRUE TRUE TRUE)
else()
set(QT_USE_LIBSPREFIX Qt5::)
set(ALKIMIA_LIB_SUFFIX "5")
......@@ -88,7 +94,6 @@ else()
set(PC_TARGET_QTPREFIX Qt5)
set(PC_TARGET_SUFFIX 5)
option(BUILD_WITH_WEBKIT "Build with Qt Web Kit library" ON)
option(BUILD_WITH_WEBENGINE "Build with Qt Web Engine instead of WebKit (experimental)" OFF)
if (BUILD_WITH_WEBENGINE)
add_definitions(-DBUILD_WITH_WEBENGINE)
......@@ -100,7 +105,7 @@ else()
feature_notes(TRUE TRUE TRUE TRUE)
else()
set(QT_BROWSER_COMPONENT Widgets)
feature_notes(FALSE FALSE FALSE FALSE)
feature_notes(FALSE TRUE FALSE FALSE)
endif()
set(QT_BROWSER_LIB ${QT_USE_LIBSPREFIX}${QT_BROWSER_COMPONENT})
......
......@@ -209,9 +209,11 @@ public:
};
AlkWebPage::AlkWebPage(QWidget *parent)
: QWidget(parent)
: QTextBrowser(parent)
, d(new Private)
{
setOpenExternalLinks(false);
setOpenLinks(false);
}
AlkWebPage::~AlkWebPage()
......@@ -237,12 +239,7 @@ void AlkWebPage::setUrl(const QUrl &url)
void AlkWebPage::setContent(const QString &s)
{
Q_UNUSED(s)
}
QString AlkWebPage::toHtml()
{
return QString();
setHtml(s);
}
QString AlkWebPage::getFirstElement(const QString &symbol)
......
......@@ -58,7 +58,7 @@ private:
/**
* The AlkWebPage class provides an interface
* to a browser component with javascript support
* to a browser component
* It is used for fetching and showing web pages.
*
* @author Ralf Habacker <ralf.habacker@freenet.de>
......@@ -83,7 +83,7 @@ private:
#else
#include <QWidget>
#include <QTextBrowser>
/**
* The AlkWebPage class provides an interface
......@@ -92,7 +92,7 @@ private:
*
* @author Ralf Habacker <ralf.habacker@freenet.de>
*/
class ALK_EXPORT AlkWebPage : public QWidget
class ALK_EXPORT AlkWebPage : public QTextBrowser
{
Q_OBJECT
public:
......@@ -103,7 +103,6 @@ public:
void load(const QUrl &url, const QString &acceptLanguage);
void setUrl(const QUrl &url);
void setContent(const QString &s);
QString toHtml();
QString getFirstElement(const QString &symbol);
void setWebInspectorEnabled(bool enable);
bool webInspectorEnabled();
......
......@@ -50,7 +50,11 @@ public:
void MainWindow::slotUrlChanged(const QUrl &url)
{
#if defined(BUILD_WITH_WEBKIT) || defined(BUILD_WITH_WEBENGINE)
d->urlLine->setText(url.toString());
#else
Q_UNUSED(url)
#endif
}
void MainWindow::slotEditingFinished()
......@@ -116,15 +120,14 @@ MainWindow::MainWindow(QWidget *parent)
connect(&AlkOnlineQuotesProfileManager::instance(), SIGNAL(updateAvailable(const QString &, const QString &)),
this, SLOT(slotUpdateAvailable(const QString &, const QString &)));
#if defined(BUILD_WITH_WEBKIT) || defined(BUILD_WITH_WEBENGINE)
manager.setWebPageEnabled(true);
QDockWidget *browserWidget = new QDockWidget(i18n("Browser"), this);
browserWidget->setObjectName("browserDockWidget");
AlkWebPage *webPage = manager.webPage();
connect(webPage, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));
// setup url line
QHBoxLayout *hLayout = new QHBoxLayout;
#if defined(BUILD_WITH_WEBKIT) || defined(BUILD_WITH_WEBENGINE)
// setup url line
d->urlLine = new QLineEdit;
connect(d->urlLine, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
hLayout->addWidget(d->urlLine);
......@@ -146,6 +149,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(box, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotLanguageChanged(QString)));
hLayout->addWidget(box);
webPage->setWebInspectorEnabled(true);
connect(webPage, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));
#endif
// setup browser window
QVBoxLayout *layout = new QVBoxLayout;
layout->addLayout(hLayout);
......@@ -154,8 +160,6 @@ MainWindow::MainWindow(QWidget *parent)
group->setLayout(layout);
browserWidget->setWidget(group);
addDockWidget(Qt::RightDockWidgetArea, browserWidget);
webPage->setWebInspectorEnabled(true);
#endif
setCentralWidget(nullptr);
......
Supports Markdown
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