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 <kprotocolinfo.h>
11 #include <QUrl>
12 
13 namespace KAuthorized
14 {
15 
16 KCONFIGCORE_EXPORT extern bool authorizeUrlActionInternal(const QString &action, const QUrl &_baseURL, const QUrl &_destURL, const QString &baseClass, const QString &destClass);
17 
18 KCONFIGCORE_EXPORT extern void allowUrlActionInternal(const QString &action, const QUrl &_baseURL, const QUrl &_destURL);
19 
20 }
21 
22 namespace KUrlAuthorized
23 {
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 ...
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.
QString scheme() const const
bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
Returns whether a certain URL related action is authorized.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 23:01:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.