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