File indexing completed on 2024-04-21 03:55:13

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
0004     SPDX-FileCopyrightText: 2000-2013 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KIO_SPECIALJOB_H
0010 #define KIO_SPECIALJOB_H
0011 
0012 #include "transferjob.h"
0013 
0014 namespace KIO
0015 {
0016 class SpecialJobPrivate;
0017 
0018 /**
0019  * @class KIO::SpecialJob specialjob.h <KIO/SpecialJob>
0020  *
0021  * A class that sends a special command to a KIO worker.
0022  * This allows you to send a binary blob to a worker and handle
0023  * its responses. The worker will receive the binary data as an
0024  * argument to the "special" function (inherited from WorkerBase::special()).
0025  *
0026  * Use this only on KIO workers that belong to your application. Sending
0027  * special commands to other workers may cause unexpected behaviour.
0028  *
0029  * @see KIO::special
0030  */
0031 class KIOCORE_EXPORT SpecialJob : public TransferJob
0032 {
0033     Q_OBJECT
0034 public:
0035     /**
0036      * Creates a KIO::SpecialJob.
0037      *
0038      * @param url the URL to be passed to the worker
0039      * @param data the data to be sent to the WorkerBase::special() function.
0040      */
0041     explicit SpecialJob(const QUrl &url, const QByteArray &data = QByteArray());
0042 
0043     /**
0044      * Sets the QByteArray that is passed to WorkerBase::special() on
0045      * the worker.
0046      */
0047     void setArguments(const QByteArray &data);
0048 
0049     /**
0050      * Returns the QByteArray data that will be sent (or has been sent) to the
0051      * worker.
0052      */
0053     QByteArray arguments() const;
0054 
0055 public:
0056     ~SpecialJob() override;
0057 
0058 private:
0059     Q_DECLARE_PRIVATE(SpecialJob)
0060 };
0061 
0062 }
0063 
0064 #endif