Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
Konqueror
Commits
87bca4c4
Commit
87bca4c4
authored
Mar 13, 2021
by
Anthony Fieroni
Committed by
Stefano Crocco
Apr 05, 2021
Browse files
Restore adblock filter
Signed-off-by:
Anthony Fieroni
<
bvbfan@abv.bg
>
parent
779c1f43
Changes
5
Hide whitespace changes
Inline
Side-by-side
webenginepart/src/CMakeLists.txt
View file @
87bca4c4
...
...
@@ -30,6 +30,7 @@ set(kwebenginepartlib_LIB_SRCS
webenginecustomizecacheablefieldsdlg.cpp
webfieldsdataview.cpp
ui/credentialsdetailswidget.cpp
webengineurlrequestinterceptor.cpp
)
ki18n_wrap_ui
(
kwebenginepartlib_LIB_SRCS webenginecustomizecacheablefieldsdlg.ui ui/credentialsdetailswidget.ui
)
...
...
webenginepart/src/settings/webenginesettings.cpp
View file @
87bca4c4
...
...
@@ -387,7 +387,7 @@ void WebEngineSettings::init( KConfig * config, bool reset )
if
(
filterEnabled
&&
url
.
isValid
())
{
/** determine where to cache HTMLFilterList file */
QString
localFile
=
cgFilter
.
readEntry
(
QStringLiteral
(
"HTMLFilterListLocalFilename-"
).
append
(
QString
::
number
(
id
)));
localFile
=
QStandardPaths
::
locate
(
QStandardPaths
::
ConfigLocation
,
"khtml/"
+
localFile
)
;
localFile
=
QStandardPaths
::
locate
(
QStandardPaths
::
ConfigLocation
,
"khtml/"
,
QStandardPaths
::
LocateDirectory
)
+
localFile
;
/** determine existence and age of cache file */
QFileInfo
fileInfo
(
localFile
);
...
...
webenginepart/src/webenginepart.cpp
View file @
87bca4c4
...
...
@@ -41,6 +41,7 @@
#include "webenginewallet.h"
#include "webengineparterrorschemehandler.h"
#include "webenginepartcookiejar.h"
#include "webengineurlrequestinterceptor.h"
#include "ui/searchbar.h"
#include "ui/passwordbar.h"
...
...
@@ -133,6 +134,7 @@ WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
prof
->
installUrlSchemeHandler
(
"help"
,
new
WebEnginePartKIOHandler
(
prof
));
prof
->
installUrlSchemeHandler
(
"tar"
,
new
WebEnginePartKIOHandler
(
prof
));
}
prof
->
setUrlRequestInterceptor
(
new
WebEngineUrlRequestInterceptor
(
this
));
static
WebEnginePartCookieJar
s_cookieJar
(
prof
,
nullptr
);
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData
(
metaData
);
...
...
webenginepart/src/webengineurlrequestinterceptor.cpp
0 → 100644
View file @
87bca4c4
/*
* This file is part of the KDE project.
*
* Copyright (C) 2021 Anthony Fieroni <bvbfan@abv.bg>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* This library 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "settings/webenginesettings.h"
#include "webengineurlrequestinterceptor.h"
WebEngineUrlRequestInterceptor
::
WebEngineUrlRequestInterceptor
(
QObject
*
parent
)
:
QWebEngineUrlRequestInterceptor
(
parent
)
{
}
void
WebEngineUrlRequestInterceptor
::
interceptRequest
(
QWebEngineUrlRequestInfo
&
info
)
{
if
(
info
.
resourceType
()
==
QWebEngineUrlRequestInfo
::
ResourceTypeImage
)
{
info
.
block
(
WebEngineSettings
::
self
()
->
isAdFiltered
(
info
.
requestUrl
().
url
()));
}
}
webenginepart/src/webengineurlrequestinterceptor.h
0 → 100644
View file @
87bca4c4
/*
* This file is part of the KDE project.
*
* Copyright (C) 2021 Anthony Fieroni <bvbfan@abv.bg>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* This library 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef WEBENGINEURLREQUESTINTERCEPTOR
#define WEBENGINEURLREQUESTINTERCEPTOR
#include <QWebEngineUrlRequestInfo>
#include <QWebEngineUrlRequestInterceptor>
class
WebEngineUrlRequestInterceptor
:
public
QWebEngineUrlRequestInterceptor
{
public:
WebEngineUrlRequestInterceptor
(
QObject
*
parent
=
nullptr
);
void
interceptRequest
(
QWebEngineUrlRequestInfo
&
info
)
override
;
};
#endif // WEBENGINEURLREQUESTINTERCEPTOR
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment