1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 1997 Matthias Kalle Dalheimer <kalle@kde.org>
4 SPDX-FileCopyrightText: 1998, 1999, 2000 Waldo Bastian <bastian@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "kurlauthorized.h"
10#include <KConfig>
11#include <QUrl>
12#include <kprotocolinfo.h>
13
14namespace KAuthorizedInternal
15{
16KCONFIGCORE_EXPORT extern bool
17authorizeUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL, const QString &baseClass, const QString &destClass);
18
19KCONFIGCORE_EXPORT extern void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL);
20}
21
22namespace KUrlAuthorized
23{
24bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
25{
26 const QString baseClass = baseURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(protocol: baseURL.scheme());
27 const QString destClass = destURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(protocol: destURL.scheme());
28 return KAuthorizedInternal::authorizeUrlAction(action, baseURL: baseURL, destURL: destURL, baseClass, destClass);
29}
30
31void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL)
32{
33 if (authorizeUrlAction(action, baseURL: _baseURL, destURL: _destURL)) {
34 return;
35 }
36
37 KAuthorizedInternal::allowUrlAction(action, _baseURL, _destURL);
38}
39
40} // namespace
41

source code of kio/src/core/kurlauthorized.cpp