KIO

kurlauthorized.cpp
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1997 Matthias Kalle Dalheimer <[email protected]>
4  SPDX-FileCopyrightText: 1998, 1999, 2000 Waldo Bastian <[email protected]>
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 
14 namespace KAuthorized
15 {
16 KCONFIGCORE_EXPORT extern bool
17 authorizeUrlActionInternal(const QString &action, const QUrl &_baseURL, const QUrl &_destURL, const QString &baseClass, const QString &destClass);
18 
19 KCONFIGCORE_EXPORT extern void allowUrlActionInternal(const QString &action, const QUrl &_baseURL, const QUrl &_destURL);
20 
21 }
22 
23 namespace KUrlAuthorized
24 {
25 bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
26 {
27  const QString baseClass = baseURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(baseURL.scheme());
28  const QString destClass = destURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(destURL.scheme());
29  return KAuthorized::authorizeUrlActionInternal(action, baseURL, destURL, baseClass, destClass);
30 }
31 
32 void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL)
33 {
34  if (authorizeUrlAction(action, _baseURL, _destURL)) {
35  return;
36  }
37 
38  KAuthorized::allowUrlActionInternal(action, _baseURL, _destURL);
39 }
40 
41 } // namespace
The functions in this namespace allow actions to be restricted based on the URL they operate on (see ...
QString scheme() const const
bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
Returns whether a certain URL related action is authorized.
bool isEmpty() const const
void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL)
Override Kiosk restrictions to allow a given URL action.
static QString protocolClass(const QString &protocol)
Returns the protocol class for the specified protocol.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:00:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.