File indexing completed on 2024-05-12 05:48:11

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 #pragma once
0005 
0006 #include <QEventLoop>
0007 #include <QUrl>
0008 
0009 #include <KIO/Job>
0010 
0011 #include "busobject.h"
0012 
0013 class PutCommand : public BusObject
0014 {
0015     Q_OBJECT
0016     Q_CLASSINFO("D-Bus Interface", "org.kde.kio.admin.PutCommand")
0017 public:
0018     explicit PutCommand(const QUrl &url,
0019                         int permissions,
0020                         KIO::JobFlags flags,
0021                         const QString &remoteService,
0022                         const QDBusObjectPath &objectPath,
0023                         QObject *parent = nullptr);
0024 
0025 public Q_SLOTS:
0026     void start();
0027     void kill();
0028     void data(const QByteArray &data);
0029 
0030 Q_SIGNALS:
0031     void dataRequest();
0032     void result(int error, const QString &errorString);
0033 
0034 private:
0035     QUrl m_url;
0036     const int m_permissions;
0037     const KIO::JobFlags m_flags;
0038 
0039     QByteArray m_newData;
0040     QEventLoop m_loop;
0041 };