File indexing completed on 2024-05-12 05:48:10
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org> 0003 0004 #include "busobject.h" 0005 0006 #include <KJob> 0007 0008 #include "auth.h" 0009 0010 BusObject::BusObject(const QString &remoteService, const QDBusObjectPath &objectPath, QObject *parent) 0011 : QObject(parent) 0012 , m_remoteService(remoteService) 0013 , m_objectPath(objectPath) 0014 { 0015 } 0016 0017 bool BusObject::isAuthorized() 0018 { 0019 return ::isAuthorized(this); 0020 } 0021 0022 void BusObject::setParent(KJob *parent) 0023 { 0024 QObject::setParent(parent); 0025 m_job = parent; 0026 } 0027 0028 void BusObject::doKill() 0029 { 0030 if (!isAuthorized()) { 0031 sendErrorReply(QDBusError::AccessDenied); 0032 return; 0033 } 0034 0035 if (m_job) { 0036 m_job->kill(); 0037 } 0038 }