KIO

kurlauthorized.cpp
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
23{
24bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
25{
26 const QString baseClass = baseURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(baseURL.scheme());
27 const QString destClass = destURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(destURL.scheme());
28 return KAuthorizedInternal::authorizeUrlAction(action, baseURL, destURL, baseClass, destClass);
29}
30
31void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL)
32{
33 if (authorizeUrlAction(action, _baseURL, _destURL)) {
34 return;
35 }
36
37 KAuthorizedInternal::allowUrlAction(action, _baseURL, _destURL);
38}
39
40} // namespace
static QString protocolClass(const QString &protocol)
Returns the protocol class for the specified protocol.
The functions in this namespace allow actions to be restricted based on the URL they operate on (see ...
void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL)
Override Kiosk restrictions to allow a given URL action.
bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
Returns whether a certain URL related action is authorized.
bool isEmpty() const const
QString scheme() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.