1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
4 | SPDX-FileCopyrightText: 2000-2013 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef KIO_SPECIALJOB_H |
10 | #define KIO_SPECIALJOB_H |
11 | |
12 | #include "transferjob.h" |
13 | |
14 | namespace KIO |
15 | { |
16 | class SpecialJobPrivate; |
17 | |
18 | /** |
19 | * @class KIO::SpecialJob specialjob.h <KIO/SpecialJob> |
20 | * |
21 | * A class that sends a special command to a KIO worker. |
22 | * This allows you to send a binary blob to a worker and handle |
23 | * its responses. The worker will receive the binary data as an |
24 | * argument to the "special" function (inherited from WorkerBase::special()). |
25 | * |
26 | * Use this only on KIO workers that belong to your application. Sending |
27 | * special commands to other workers may cause unexpected behaviour. |
28 | * |
29 | * @see KIO::special |
30 | */ |
31 | class KIOCORE_EXPORT SpecialJob : public TransferJob |
32 | { |
33 | Q_OBJECT |
34 | public: |
35 | /** |
36 | * Creates a KIO::SpecialJob. |
37 | * |
38 | * @param url the URL to be passed to the worker |
39 | * @param data the data to be sent to the WorkerBase::special() function. |
40 | */ |
41 | explicit SpecialJob(const QUrl &url, const QByteArray &data = QByteArray()); |
42 | |
43 | /** |
44 | * Sets the QByteArray that is passed to WorkerBase::special() on |
45 | * the worker. |
46 | */ |
47 | void setArguments(const QByteArray &data); |
48 | |
49 | /** |
50 | * Returns the QByteArray data that will be sent (or has been sent) to the |
51 | * worker. |
52 | */ |
53 | QByteArray arguments() const; |
54 | |
55 | public: |
56 | ~SpecialJob() override; |
57 | |
58 | private: |
59 | Q_DECLARE_PRIVATE(SpecialJob) |
60 | }; |
61 | |
62 | } |
63 | |
64 | #endif |
65 | |