File indexing completed on 2024-05-05 16:13:23

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
0004     SPDX-FileCopyrightText: 2000-2009 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef MULTIGETJOB_H
0010 #define MULTIGETJOB_H
0011 
0012 #include "kiocore_export.h"
0013 
0014 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 84)
0015 
0016 #include "transferjob.h"
0017 
0018 namespace KIO
0019 {
0020 class MultiGetJobPrivate;
0021 /**
0022  * @class KIO::MultiGetJob multigetjob.h <KIO/MultiGetJob>
0023  *
0024  * The MultiGetJob is a TransferJob that allows you to get
0025  * several files from a single server. Don't create directly,
0026  * but use KIO::multi_get() instead.
0027  * @see KIO::multi_get()
0028  */
0029 class KIOCORE_EXPORT MultiGetJob : public TransferJob
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     ~MultiGetJob() override;
0035 
0036     /**
0037      * Get an additional file.
0038      *
0039      * @param id the id of the file
0040      * @param url the url of the file to get
0041      * @param metaData the meta data for this request
0042      */
0043     void get(long id, const QUrl &url, const MetaData &metaData);
0044 
0045 Q_SIGNALS:
0046 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 79)
0047     /**
0048      * Data from the worker has arrived.
0049      *
0050      * @param id the id of the request
0051      * @param data data received from the worker.
0052      * End of data (EOD) has been reached if data.size() == 0
0053      *
0054      * @deprecated since 5.79, use KIO::MultiGetJob::dataReceived(long, const QByteArray &)
0055      */
0056     KIOCORE_DEPRECATED_VERSION(5, 79, "Use KIO::MultiGetJob::dataReceived(long, const QByteArray &)")
0057     void data(long id, const QByteArray &data); // clazy:exclude=overloaded-signal
0058 #endif
0059 
0060     /**
0061      * Data from the worker has arrived.
0062      *
0063      * @param id the id of the request
0064      * @param data data received from the worker.
0065      * End of data (EOD) has been reached if data.size() == 0
0066      *
0067      * @since 5.79
0068      */
0069     void dataReceived(long id, const QByteArray &data);
0070 
0071 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 78)
0072     /**
0073      * MIME type determined
0074      * @param id the id of the request
0075      * @param mimeType the MIME type
0076      * @deprecated Since 5.78, use mimeTypeFound(KIO::Job *, const QString &)
0077      */
0078     KIOCORE_DEPRECATED_VERSION(5, 78, "Use KIO::MultiGetJob::mimeTypeFound(long id, const QString &)")
0079     void mimetype(long id, const QString &mimeType); // clazy:exclude=overloaded-signal
0080 #endif
0081 
0082     /**
0083      * MIME type determined
0084      * @param id the id of the request
0085      * @param mimeType the MIME type
0086      * @since 5.78
0087      */
0088     void mimeTypeFound(long id, const QString &mimeType);
0089 
0090 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 79)
0091     /**
0092      * File transfer completed.
0093      *
0094      * When all files have been processed, result(KJob *) gets
0095      * emitted.
0096      * @param id the id of the request
0097      *
0098      * @deprecated since 5.79, use KIO::MultiGetJob::fileTransferred(long)
0099      */
0100     KIOCORE_DEPRECATED_VERSION(5, 79, "Use KIO::MultiGetJob::fileTransferred(long id)")
0101     void result(long id); // clazy:exclude=overloaded-signal
0102 #endif
0103 
0104     /**
0105      * File transfer completed.
0106      *
0107      * When all files have been processed, result(KJob *) gets emitted.
0108      *
0109      * @param id the id of the request
0110      *
0111      * @since 5.79
0112      */
0113     void fileTransferred(long id);
0114 
0115 protected Q_SLOTS:
0116     void slotRedirection(const QUrl &url) override;
0117     void slotFinished() override;
0118     void slotData(const QByteArray &data) override;
0119     void slotMimetype(const QString &mimetype) override;
0120 
0121 protected:
0122     MultiGetJob(MultiGetJobPrivate &dd);
0123 
0124 private:
0125     Q_DECLARE_PRIVATE(MultiGetJob)
0126 };
0127 
0128 /**
0129  * Creates a new multiple get job.
0130  *
0131  * @param id the id of the get operation
0132  * @param url the URL of the file
0133  * @param metaData the MetaData associated with the file
0134  *
0135  * @return the job handling the operation.
0136  * @see get()
0137  */
0138 KIOCORE_EXPORT MultiGetJob *multi_get(long id, const QUrl &url, const MetaData &metaData);
0139 
0140 }
0141 
0142 #endif // Deprecated since 5.84
0143 
0144 #endif // MULTIGETJOB_H