1 |
commit: 50c1efe4e4631026b9a04a726c36e10c7d99c729 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 9 20:29:31 2018 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 9 20:32:47 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50c1efe4 |
7 |
|
8 |
www-client/falkon: Enable webinspector, fix mouse navigation |
9 |
|
10 |
Disable finding PySide2 as long as it is not a thing in Gentoo. |
11 |
|
12 |
mouse navigation: |
13 |
KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=395828 |
14 |
|
15 |
webinspector: |
16 |
Reported-by: nekoexmachina in #gentoo-kde |
17 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
18 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
19 |
|
20 |
www-client/falkon/falkon-3.0.1-r1.ebuild | 79 +++++++++++++++ |
21 |
.../falkon/files/falkon-3.0.1-page-actions.patch | 53 +++++++++++ |
22 |
.../files/falkon-3.0.1-pyside2-release.patch | 26 +++++ |
23 |
.../files/falkon-3.0.1-qiodevice-main-thread.patch | 106 +++++++++++++++++++++ |
24 |
.../files/falkon-3.0.1-qtwebengine-version.patch | 72 ++++++++++++++ |
25 |
.../falkon/files/falkon-3.0.1-webinspector.patch | 102 ++++++++++++++++++++ |
26 |
6 files changed, 438 insertions(+) |
27 |
|
28 |
diff --git a/www-client/falkon/falkon-3.0.1-r1.ebuild b/www-client/falkon/falkon-3.0.1-r1.ebuild |
29 |
new file mode 100644 |
30 |
index 00000000000..71fb406ee4a |
31 |
--- /dev/null |
32 |
+++ b/www-client/falkon/falkon-3.0.1-r1.ebuild |
33 |
@@ -0,0 +1,79 @@ |
34 |
+# Copyright 1999-2018 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=6 |
38 |
+ |
39 |
+KDE_TEST="true" |
40 |
+VIRTUALX_REQUIRED="test" |
41 |
+inherit kde5 |
42 |
+ |
43 |
+DESCRIPTION="Cross-platform web browser using QtWebEngine" |
44 |
+HOMEPAGE="https://www.falkon.org/" |
45 |
+if [[ ${KDE_BUILD_TYPE} != live ]]; then |
46 |
+ SRC_URI="mirror://kde/stable/${PN}/${PV}/${P}.tar.xz" |
47 |
+fi |
48 |
+ |
49 |
+LICENSE="GPL-3" |
50 |
+SLOT="0" |
51 |
+KEYWORDS="~amd64 ~x86" |
52 |
+IUSE="dbus gnome-keyring kwallet libressl +X" |
53 |
+ |
54 |
+COMMON_DEPEND=" |
55 |
+ $(add_qt_dep qtdeclarative 'widgets') |
56 |
+ $(add_qt_dep qtgui) |
57 |
+ $(add_qt_dep qtnetwork 'ssl') |
58 |
+ $(add_qt_dep qtprintsupport) |
59 |
+ $(add_qt_dep qtsql 'sqlite') |
60 |
+ $(add_qt_dep qtwebchannel) |
61 |
+ $(add_qt_dep qtwebengine 'widgets') |
62 |
+ $(add_qt_dep qtwidgets) |
63 |
+ dbus? ( $(add_qt_dep qtdbus) ) |
64 |
+ gnome-keyring? ( gnome-base/gnome-keyring ) |
65 |
+ kwallet? ( $(add_frameworks_dep kwallet) ) |
66 |
+ libressl? ( dev-libs/libressl:= ) |
67 |
+ !libressl? ( dev-libs/openssl:0= ) |
68 |
+ X? ( |
69 |
+ $(add_qt_dep qtx11extras) |
70 |
+ x11-libs/libxcb:= |
71 |
+ x11-libs/xcb-util |
72 |
+ ) |
73 |
+" |
74 |
+DEPEND="${COMMON_DEPEND} |
75 |
+ $(add_qt_dep linguist-tools) |
76 |
+ $(add_qt_dep qtconcurrent) |
77 |
+ gnome-keyring? ( virtual/pkgconfig ) |
78 |
+" |
79 |
+if [[ ${KDE_BUILD_TYPE} != live ]]; then |
80 |
+ DEPEND+=" $(add_frameworks_dep ki18n)" |
81 |
+fi |
82 |
+RDEPEND="${COMMON_DEPEND} |
83 |
+ !www-client/qupzilla |
84 |
+ $(add_qt_dep qtsvg) |
85 |
+" |
86 |
+ |
87 |
+PATCHES=( |
88 |
+ "${FILESDIR}/${P}-pyside2-release.patch" |
89 |
+ "${FILESDIR}/${P}-qiodevice-main-thread.patch" |
90 |
+ "${FILESDIR}/${P}-page-actions.patch" |
91 |
+ "${FILESDIR}/${P}-qtwebengine-version.patch" |
92 |
+ "${FILESDIR}/${P}-webinspector.patch" |
93 |
+) |
94 |
+ |
95 |
+src_configure() { |
96 |
+ local mycmakeargs=( |
97 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_PySide2=ON |
98 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_Shiboken2=ON |
99 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=ON |
100 |
+ -DDISABLE_DBUS=$(usex !dbus) |
101 |
+ -DBUILD_KEYRING=$(usex gnome-keyring) |
102 |
+ $(cmake-utils_use_find_package kwallet KF5Wallet) |
103 |
+ -DNO_X11=$(usex !X) |
104 |
+ ) |
105 |
+ kde5_src_configure |
106 |
+} |
107 |
+ |
108 |
+pkg_postinst() { |
109 |
+ kde5_pkg_postinst |
110 |
+ elog "If you were previously using QupZilla, you can manually migrate your profiles" |
111 |
+ elog "by moving the config directory from ~/.config/qupzilla to ~/.config/falkon" |
112 |
+} |
113 |
|
114 |
diff --git a/www-client/falkon/files/falkon-3.0.1-page-actions.patch b/www-client/falkon/files/falkon-3.0.1-page-actions.patch |
115 |
new file mode 100644 |
116 |
index 00000000000..be48f000817 |
117 |
--- /dev/null |
118 |
+++ b/www-client/falkon/files/falkon-3.0.1-page-actions.patch |
119 |
@@ -0,0 +1,53 @@ |
120 |
+From 53e0a43762523185fb98bf705f85cf0dfa27247f Mon Sep 17 00:00:00 2001 |
121 |
+From: David Rosca <nowrep@×××××.com> |
122 |
+Date: Sun, 8 Jul 2018 20:34:58 +0200 |
123 |
+Subject: NavigationBar: Correctly reconnect to page actions |
124 |
+ |
125 |
+BUG: 395828 |
126 |
+FIXED-IN: 3.0.2 |
127 |
+--- |
128 |
+ src/lib/navigation/navigationbar.cpp | 27 ++++++++++++++++----------- |
129 |
+ 1 file changed, 16 insertions(+), 11 deletions(-) |
130 |
+ |
131 |
+diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp |
132 |
+index 0339b55..622622d 100644 |
133 |
+--- a/src/lib/navigation/navigationbar.cpp |
134 |
++++ b/src/lib/navigation/navigationbar.cpp |
135 |
+@@ -230,19 +230,24 @@ void NavigationBar::setCurrentView(TabbedWebView *view) |
136 |
+ return; |
137 |
+ } |
138 |
+ |
139 |
+- auto updateButton = [](ToolButton *button, QAction *action) { |
140 |
+- button->setEnabled(action->isEnabled()); |
141 |
++ auto connectPageActions = [this](QWebEnginePage *page) { |
142 |
++ auto updateButton = [](ToolButton *button, QAction *action) { |
143 |
++ button->setEnabled(action->isEnabled()); |
144 |
++ }; |
145 |
++ auto updateBackButton = std::bind(updateButton, m_buttonBack, page->action(QWebEnginePage::Back)); |
146 |
++ auto updateForwardButton = std::bind(updateButton, m_buttonForward, page->action(QWebEnginePage::Forward)); |
147 |
++ |
148 |
++ updateBackButton(); |
149 |
++ updateForwardButton(); |
150 |
++ |
151 |
++ disconnect(m_backConnection); |
152 |
++ disconnect(m_forwardConnection); |
153 |
++ m_backConnection = connect(page->action(QWebEnginePage::Back), &QAction::changed, this, updateBackButton); |
154 |
++ m_forwardConnection = connect(page->action(QWebEnginePage::Forward), &QAction::changed, this, updateForwardButton); |
155 |
+ }; |
156 |
+- auto updateBackButton = std::bind(updateButton, m_buttonBack, view->pageAction(QWebEnginePage::Back)); |
157 |
+- auto updateForwardButton = std::bind(updateButton, m_buttonForward, view->pageAction(QWebEnginePage::Forward)); |
158 |
+ |
159 |
+- updateBackButton(); |
160 |
+- updateForwardButton(); |
161 |
+- |
162 |
+- disconnect(m_backConnection); |
163 |
+- disconnect(m_forwardConnection); |
164 |
+- m_backConnection = connect(view->pageAction(QWebEnginePage::Back), &QAction::changed, this, updateBackButton); |
165 |
+- m_forwardConnection = connect(view->pageAction(QWebEnginePage::Forward), &QAction::changed, this, updateForwardButton); |
166 |
++ connectPageActions(view->page()); |
167 |
++ connect(view, &TabbedWebView::pageChanged, this, connectPageActions); |
168 |
+ } |
169 |
+ |
170 |
+ void NavigationBar::showReloadButton() |
171 |
+-- |
172 |
+cgit v1.1 |
173 |
|
174 |
diff --git a/www-client/falkon/files/falkon-3.0.1-pyside2-release.patch b/www-client/falkon/files/falkon-3.0.1-pyside2-release.patch |
175 |
new file mode 100644 |
176 |
index 00000000000..13ebb423af9 |
177 |
--- /dev/null |
178 |
+++ b/www-client/falkon/files/falkon-3.0.1-pyside2-release.patch |
179 |
@@ -0,0 +1,26 @@ |
180 |
+From 4c83ba3d6c609a704a31c419b5d89dd1947aa11a Mon Sep 17 00:00:00 2001 |
181 |
+From: David Rosca <nowrep@×××××.com> |
182 |
+Date: Mon, 18 Jun 2018 13:39:46 +0200 |
183 |
+Subject: PyFalkon: Fix build with PySide2 release |
184 |
+ |
185 |
+--- |
186 |
+ src/plugins/PyFalkon/pyfalkon_global.h | 4 ++++ |
187 |
+ 1 file changed, 4 insertions(+) |
188 |
+ |
189 |
+diff --git a/src/plugins/PyFalkon/pyfalkon_global.h b/src/plugins/PyFalkon/pyfalkon_global.h |
190 |
+index d41da24..0305b67 100644 |
191 |
+--- a/src/plugins/PyFalkon/pyfalkon_global.h |
192 |
++++ b/src/plugins/PyFalkon/pyfalkon_global.h |
193 |
+@@ -19,6 +19,10 @@ |
194 |
+ // Make "signals:", "slots:" visible as access specifiers |
195 |
+ #define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a))) |
196 |
+ |
197 |
++// PYSIDE-711 |
198 |
++#include <QHstsPolicy> |
199 |
++#include <QWebEngineContextMenuData> |
200 |
++ |
201 |
+ // 3rdparty |
202 |
+ #include "lineedit.h" |
203 |
+ #include "squeezelabelv1.h" |
204 |
+-- |
205 |
+cgit v1.1 |
206 |
|
207 |
diff --git a/www-client/falkon/files/falkon-3.0.1-qiodevice-main-thread.patch b/www-client/falkon/files/falkon-3.0.1-qiodevice-main-thread.patch |
208 |
new file mode 100644 |
209 |
index 00000000000..2606dc50885 |
210 |
--- /dev/null |
211 |
+++ b/www-client/falkon/files/falkon-3.0.1-qiodevice-main-thread.patch |
212 |
@@ -0,0 +1,106 @@ |
213 |
+From a7d2f8757919b4db63867ecbb4fb64c11d64f453 Mon Sep 17 00:00:00 2001 |
214 |
+From: David Rosca <nowrep@×××××.com> |
215 |
+Date: Sun, 22 Jul 2018 15:17:04 +0200 |
216 |
+Subject: FalkonSchemeHandler: Make sure to load data on main thread |
217 |
+ |
218 |
+QIODevice::read is called on WebEngine IO thread. |
219 |
+--- |
220 |
+ .../network/schemehandlers/falkonschemehandler.cpp | 41 +++++++++++----------- |
221 |
+ .../network/schemehandlers/falkonschemehandler.h | 2 ++ |
222 |
+ 2 files changed, 23 insertions(+), 20 deletions(-) |
223 |
+ |
224 |
+diff --git a/src/lib/network/schemehandlers/falkonschemehandler.cpp b/src/lib/network/schemehandlers/falkonschemehandler.cpp |
225 |
+index 5706c04..4e01897 100644 |
226 |
+--- a/src/lib/network/schemehandlers/falkonschemehandler.cpp |
227 |
++++ b/src/lib/network/schemehandlers/falkonschemehandler.cpp |
228 |
+@@ -89,8 +89,7 @@ FalkonSchemeReply::FalkonSchemeReply(QWebEngineUrlRequestJob *job, QObject *pare |
229 |
+ { |
230 |
+ m_pageName = m_job->requestUrl().path(); |
231 |
+ |
232 |
+- open(QIODevice::ReadOnly); |
233 |
+- m_buffer.open(QIODevice::ReadWrite); |
234 |
++ QTimer::singleShot(0, this, &FalkonSchemeReply::loadPage); |
235 |
+ } |
236 |
+ |
237 |
+ void FalkonSchemeReply::loadPage() |
238 |
+@@ -98,38 +97,40 @@ void FalkonSchemeReply::loadPage() |
239 |
+ if (m_loaded) |
240 |
+ return; |
241 |
+ |
242 |
+- QTextStream stream(&m_buffer); |
243 |
+- stream.setCodec("UTF-8"); |
244 |
++ QString contents; |
245 |
+ |
246 |
+ if (m_pageName == QLatin1String("about")) { |
247 |
+- stream << aboutPage(); |
248 |
+- } |
249 |
+- else if (m_pageName == QLatin1String("start")) { |
250 |
+- stream << startPage(); |
251 |
+- } |
252 |
+- else if (m_pageName == QLatin1String("speeddial")) { |
253 |
+- stream << speeddialPage(); |
254 |
+- } |
255 |
+- else if (m_pageName == QLatin1String("config")) { |
256 |
+- stream << configPage(); |
257 |
+- } |
258 |
+- else if (m_pageName == QLatin1String("restore")) { |
259 |
+- stream << restorePage(); |
260 |
++ contents = aboutPage(); |
261 |
++ } else if (m_pageName == QLatin1String("start")) { |
262 |
++ contents = startPage(); |
263 |
++ } else if (m_pageName == QLatin1String("speeddial")) { |
264 |
++ contents = speeddialPage(); |
265 |
++ } else if (m_pageName == QLatin1String("config")) { |
266 |
++ contents = configPage(); |
267 |
++ } else if (m_pageName == QLatin1String("restore")) { |
268 |
++ contents = restorePage(); |
269 |
+ } |
270 |
+ |
271 |
+- stream.flush(); |
272 |
+- m_buffer.reset(); |
273 |
++ QMutexLocker lock(&m_mutex); |
274 |
++ m_buffer.setData(contents.toUtf8()); |
275 |
++ m_buffer.open(QIODevice::ReadOnly); |
276 |
++ lock.unlock(); |
277 |
++ |
278 |
++ open(QIODevice::ReadOnly); |
279 |
++ emit readyRead(); |
280 |
++ |
281 |
+ m_loaded = true; |
282 |
+ } |
283 |
+ |
284 |
+ qint64 FalkonSchemeReply::bytesAvailable() const |
285 |
+ { |
286 |
++ QMutexLocker lock(&m_mutex); |
287 |
+ return m_buffer.bytesAvailable(); |
288 |
+ } |
289 |
+ |
290 |
+ qint64 FalkonSchemeReply::readData(char *data, qint64 maxSize) |
291 |
+ { |
292 |
+- loadPage(); |
293 |
++ QMutexLocker lock(&m_mutex); |
294 |
+ return m_buffer.read(data, maxSize); |
295 |
+ } |
296 |
+ |
297 |
+diff --git a/src/lib/network/schemehandlers/falkonschemehandler.h b/src/lib/network/schemehandlers/falkonschemehandler.h |
298 |
+index 2c071a7..b92969d 100644 |
299 |
+--- a/src/lib/network/schemehandlers/falkonschemehandler.h |
300 |
++++ b/src/lib/network/schemehandlers/falkonschemehandler.h |
301 |
+@@ -18,6 +18,7 @@ |
302 |
+ #ifndef FALKONSCHEMEHANDLER_H |
303 |
+ #define FALKONSCHEMEHANDLER_H |
304 |
+ |
305 |
++#include <QMutex> |
306 |
+ #include <QBuffer> |
307 |
+ #include <QIODevice> |
308 |
+ #include <QWebEngineUrlSchemeHandler> |
309 |
+@@ -60,6 +61,7 @@ private: |
310 |
+ QBuffer m_buffer; |
311 |
+ QString m_pageName; |
312 |
+ QWebEngineUrlRequestJob *m_job; |
313 |
++ mutable QMutex m_mutex; |
314 |
+ }; |
315 |
+ |
316 |
+ #endif // FALKONSCHEMEHANDLER_H |
317 |
+-- |
318 |
+cgit v1.1 |
319 |
|
320 |
diff --git a/www-client/falkon/files/falkon-3.0.1-qtwebengine-version.patch b/www-client/falkon/files/falkon-3.0.1-qtwebengine-version.patch |
321 |
new file mode 100644 |
322 |
index 00000000000..7634c30f616 |
323 |
--- /dev/null |
324 |
+++ b/www-client/falkon/files/falkon-3.0.1-qtwebengine-version.patch |
325 |
@@ -0,0 +1,72 @@ |
326 |
+Combined diffs: |
327 |
+ |
328 |
+From d06a0d60e0ff3e9e3d5dbaec17b3447fca665b92 Mon Sep 17 00:00:00 2001 |
329 |
+From: Kevin Kofler <kevin.kofler@××××××.at> |
330 |
+Date: Sat, 12 May 2018 03:15:56 +0200 |
331 |
+Subject: Fix the fix for #391300 to require only QtWebEngine 5.10, not Qt 5.10 |
332 |
+ |
333 |
+QtWebEngine can be newer than the rest of Qt (e.g., on Fedora 27). |
334 |
+ |
335 |
+From 9f0f688ee8ed7d454713db5418c9a86f80fd5850 Mon Sep 17 00:00:00 2001 |
336 |
+From: David Rosca <nowrep@×××××.com> |
337 |
+Date: Mon, 14 May 2018 13:53:05 +0200 |
338 |
+Subject: Use QTWEBENGINE_VERSION instead of QT_VERSION |
339 |
+ |
340 |
+Fixes build against separate QtWebEngine releases. |
341 |
+ |
342 |
+* asturm@g.o: Make #ifdef obsolete by requiring Qt 5.11.0. |
343 |
+ |
344 |
+--- b/CMakeLists.txt |
345 |
++++ b/CMakeLists.txt |
346 |
+@@ -45,7 +45,7 @@ |
347 |
+ |
348 |
+ # Mandatory: Qt5 |
349 |
+-set(QT_MIN_VERSION "5.9.0") |
350 |
++set(QT_MIN_VERSION "5.11.0") |
351 |
+-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel) |
352 |
++find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngine WebEngineWidgets WebChannel) |
353 |
+ if (BUILD_TESTING) |
354 |
+ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test) |
355 |
+ endif() |
356 |
+--- a/src/lib/CMakeLists.txt |
357 |
++++ b/src/lib/CMakeLists.txt |
358 |
+@@ -297,6 +297,9 @@ qt5_add_resources(SRCS |
359 |
+ |
360 |
+ add_library(FalkonPrivate SHARED ${SRCS}) |
361 |
+ |
362 |
++get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt5::WebEngine PROPERTY INTERFACE_INCLUDE_DIRECTORIES) |
363 |
++target_include_directories(FalkonPrivate SYSTEM PUBLIC ${QT_WEBENGINE_INCLUDE_DIRS}) |
364 |
++ |
365 |
+ target_link_libraries(FalkonPrivate |
366 |
+ Qt5::Widgets |
367 |
+ Qt5::WebEngineWidgets |
368 |
+--- a/src/lib/app/qzcommon.h |
369 |
++++ b/src/lib/app/qzcommon.h |
370 |
+@@ -20,6 +20,7 @@ |
371 |
+ |
372 |
+ #include <QDebug> |
373 |
+ #include <QFlags> |
374 |
++#include <QtWebEngineVersion> |
375 |
+ |
376 |
+ #ifdef FALKON_SHAREDLIBRARY |
377 |
+ #define FALKON_EXPORT Q_DECL_EXPORT |
378 |
+--- a/src/lib/webengine/webview.cpp 2018-12-09 17:12:29.659899904 +0100 |
379 |
++++ b/src/lib/webengine/webview.cpp 2018-12-09 17:21:26.083044301 +0100 |
380 |
+@@ -495,7 +495,6 @@ |
381 |
+ |
382 |
+ void WebView::savePageAs() |
383 |
+ { |
384 |
+-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
385 |
+ page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) { |
386 |
+ const QSet<QString> webPageTypes = { |
387 |
+ QSL("text/html"), |
388 |
+@@ -507,9 +506,6 @@ |
389 |
+ page()->download(url()); |
390 |
+ } |
391 |
+ }); |
392 |
+-#else |
393 |
+- triggerPageAction(QWebEnginePage::SavePage); |
394 |
+-#endif |
395 |
+ } |
396 |
+ |
397 |
+ void WebView::copyImageToClipboard() |
398 |
|
399 |
diff --git a/www-client/falkon/files/falkon-3.0.1-webinspector.patch b/www-client/falkon/files/falkon-3.0.1-webinspector.patch |
400 |
new file mode 100644 |
401 |
index 00000000000..9cfea7e42dc |
402 |
--- /dev/null |
403 |
+++ b/www-client/falkon/files/falkon-3.0.1-webinspector.patch |
404 |
@@ -0,0 +1,102 @@ |
405 |
+From 48ca42d645b155069a57eaede3e560874ed07bc7 Mon Sep 17 00:00:00 2001 |
406 |
+From: David Rosca <nowrep@×××××.com> |
407 |
+Date: Thu, 1 Mar 2018 15:14:15 +0100 |
408 |
+Subject: WebInspector: Don't require remote debugging with QtWebEngine 5.11 |
409 |
+ |
410 |
+--- |
411 |
+ src/lib/webengine/webinspector.cpp | 11 ++++++++++- |
412 |
+ src/lib/webengine/webinspector.h | 11 ++++------- |
413 |
+ 2 files changed, 14 insertions(+), 8 deletions(-) |
414 |
+ |
415 |
+* asturm@g.o: Make #ifdef obsolete by requiring Qt 5.11.0. |
416 |
+ |
417 |
+ diff -u b/src/lib/webengine/webinspector.cpp b/src/lib/webengine/webinspector.cpp |
418 |
+--- b/src/lib/webengine/webinspector.cpp |
419 |
++++ b/src/lib/webengine/webinspector.cpp |
420 |
+@@ -19,6 +19,8 @@ |
421 |
+ #include "mainapplication.h" |
422 |
+ #include "networkmanager.h" |
423 |
+ #include "settings.h" |
424 |
++#include "webview.h" |
425 |
++#include "webpage.h" |
426 |
+ |
427 |
+ #include <QJsonArray> |
428 |
+ #include <QJsonObject> |
429 |
+@@ -60,27 +62,13 @@ |
430 |
+ } |
431 |
+ } |
432 |
+ |
433 |
+-void WebInspector::setView(QWebEngineView *view) |
434 |
++void WebInspector::setView(WebView *view) |
435 |
+ { |
436 |
+ m_view = view; |
437 |
+ Q_ASSERT(isEnabled()); |
438 |
+ |
439 |
+- int port = qEnvironmentVariableIntValue("QTWEBENGINE_REMOTE_DEBUGGING"); |
440 |
+- QUrl inspectorUrl = QUrl(QSL("http://localhost:%1").arg(port)); |
441 |
+- int index = s_views.indexOf(m_view); |
442 |
+- |
443 |
+- QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(inspectorUrl.resolved(QUrl("json/list")))); |
444 |
+- connect(reply, &QNetworkReply::finished, this, [=]() { |
445 |
+- QJsonArray clients = QJsonDocument::fromJson(reply->readAll()).array(); |
446 |
+- QUrl pageUrl; |
447 |
+- if (clients.size() > index) { |
448 |
+- QJsonObject object = clients.at(index).toObject(); |
449 |
+- pageUrl = inspectorUrl.resolved(QUrl(object.value(QSL("devtoolsFrontendUrl")).toString())); |
450 |
+- } |
451 |
+- load(pageUrl); |
452 |
+- pushView(this); |
453 |
+- show(); |
454 |
+- }); |
455 |
++ page()->setInspectedPage(m_view->page()); |
456 |
++ connect(m_view, &WebView::pageChanged, this, &WebInspector::deleteLater); |
457 |
+ } |
458 |
+ |
459 |
+ void WebInspector::inspectElement() |
460 |
+@@ -90,9 +78,6 @@ |
461 |
+ |
462 |
+ bool WebInspector::isEnabled() |
463 |
+ { |
464 |
+- if (!qEnvironmentVariableIsSet("QTWEBENGINE_REMOTE_DEBUGGING")) { |
465 |
+- return false; |
466 |
+- } |
467 |
+ if (!mApp->webSettings()->testAttribute(QWebEngineSettings::JavascriptEnabled)) { |
468 |
+ return false; |
469 |
+ } |
470 |
+--- a/src/lib/webengine/webinspector.h |
471 |
++++ b/src/lib/webengine/webinspector.h |
472 |
+@@ -15,14 +15,13 @@ |
473 |
+ * You should have received a copy of the GNU General Public License |
474 |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. |
475 |
+ * ============================================================ */ |
476 |
+-#ifndef WEBINSPECTORDOCKWIDGET_H |
477 |
+-#define WEBINSPECTORDOCKWIDGET_H |
478 |
++#pragma once |
479 |
+ |
480 |
+ #include <QWebEngineView> |
481 |
+ |
482 |
+ #include "qzcommon.h" |
483 |
+ |
484 |
+-class ToolButton; |
485 |
++class WebView; |
486 |
+ |
487 |
+ class FALKON_EXPORT WebInspector : public QWebEngineView |
488 |
+ { |
489 |
+@@ -32,7 +31,7 @@ public: |
490 |
+ explicit WebInspector(QWidget *parent = Q_NULLPTR); |
491 |
+ ~WebInspector(); |
492 |
+ |
493 |
+- void setView(QWebEngineView *view); |
494 |
++ void setView(WebView *view); |
495 |
+ void inspectElement(); |
496 |
+ |
497 |
+ static bool isEnabled(); |
498 |
+@@ -53,7 +52,5 @@ private: |
499 |
+ int m_height; |
500 |
+ QSize m_windowSize; |
501 |
+ bool m_inspectElement = false; |
502 |
+- QWebEngineView *m_view; |
503 |
++ WebView *m_view; |
504 |
+ }; |
505 |
+- |
506 |
+-#endif // WEBINSPECTORDOCKWIDGET_H |