File indexing completed on 2024-03-24 03:58:00
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1997 Matthias Kalle Dalheimer <kalle@kde.org> 0004 SPDX-FileCopyrightText: 1998, 1999, 2000 Waldo Bastian <bastian@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "kurlauthorized.h" 0010 #include <KConfig> 0011 #include <QUrl> 0012 #include <kprotocolinfo.h> 0013 0014 namespace KAuthorizedInternal 0015 { 0016 KCONFIGCORE_EXPORT extern bool 0017 authorizeUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL, const QString &baseClass, const QString &destClass); 0018 0019 KCONFIGCORE_EXPORT extern void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL); 0020 } 0021 0022 namespace KUrlAuthorized 0023 { 0024 bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL) 0025 { 0026 const QString baseClass = baseURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(baseURL.scheme()); 0027 const QString destClass = destURL.isEmpty() ? QString() : KProtocolInfo::protocolClass(destURL.scheme()); 0028 return KAuthorizedInternal::authorizeUrlAction(action, baseURL, destURL, baseClass, destClass); 0029 } 0030 0031 void allowUrlAction(const QString &action, const QUrl &_baseURL, const QUrl &_destURL) 0032 { 0033 if (authorizeUrlAction(action, _baseURL, _destURL)) { 0034 return; 0035 } 0036 0037 KAuthorizedInternal::allowUrlAction(action, _baseURL, _destURL); 0038 } 0039 0040 } // namespace