Messagelib

messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "loadexternalreferencesurlinterceptor.h"
8#include "remote-content/remotecontentmanager.h"
9
10using namespace MessageViewer;
11
12LoadExternalReferencesUrlInterceptor::LoadExternalReferencesUrlInterceptor(QObject *parent)
13 : WebEngineViewer::LoadExternalReferencesUrlInterceptor(parent)
14{
15}
16
17LoadExternalReferencesUrlInterceptor::~LoadExternalReferencesUrlInterceptor() = default;
18bool LoadExternalReferencesUrlInterceptor::urlIsBlocked(const QUrl &requestedUrl)
19{
21 bool contains = false;
22 if (MessageViewer::RemoteContentManager::self()->isBlocked(url, contains)) {
23 return true;
24 }
25 return false;
26}
27
28bool LoadExternalReferencesUrlInterceptor::urlIsAuthorized(const QUrl &requestedUrl)
29{
31 bool contains = false;
32 if (MessageViewer::RemoteContentManager::self()->isAutorized(url, contains)) {
33 return false;
34 }
35 if (!contains) {
36 Q_EMIT urlBlocked(requestedUrl);
37 }
38 return true;
39}
40
41#include "moc_loadexternalreferencesurlinterceptor.cpp"
Q_EMITQ_EMIT
QUrl adjusted(FormattingOptions options) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:08:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.