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 "delcommand.h" 0005 0006 #include <KIO/DeleteJob> 0007 0008 DelCommand::DelCommand(const QUrl &url, const QString &remoteService, const QDBusObjectPath &objectPath, QObject *parent) 0009 : BusObject(remoteService, objectPath, parent) 0010 , m_url(url) 0011 { 0012 } 0013 0014 void DelCommand::start() 0015 { 0016 if (!isAuthorized()) { 0017 sendErrorReply(QDBusError::AccessDenied); 0018 return; 0019 } 0020 0021 auto job = KIO::del(m_url); 0022 setParent(job); 0023 connect(job, &KIO::DeleteJob::result, this, [this, job](KJob *) { 0024 sendSignal(&DelCommand::result, job->error(), job->errorString()); 0025 }); 0026 }