File indexing completed on 2024-04-14 03:53:00

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 KIO_MIMETYPEJOB_H
0010 #define KIO_MIMETYPEJOB_H
0011 
0012 #include "transferjob.h"
0013 #include <kio/global.h> // filesize_t
0014 
0015 namespace KIO
0016 {
0017 class MimetypeJobPrivate;
0018 /**
0019  * @class KIO::MimetypeJob mimetypejob.h <KIO/MimetypeJob>
0020  *
0021  * A MimetypeJob is a TransferJob that  allows you to get
0022  * the MIME type of a URL. Don't create directly,
0023  * but use KIO::mimetype() instead.
0024  * @see KIO::mimetype()
0025  */
0026 class KIOCORE_EXPORT MimetypeJob : public TransferJob
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     ~MimetypeJob() override;
0032 
0033 protected Q_SLOTS:
0034     void slotFinished() override;
0035 
0036 protected:
0037     KIOCORE_NO_EXPORT explicit MimetypeJob(MimetypeJobPrivate &dd);
0038 
0039 private:
0040     Q_DECLARE_PRIVATE(MimetypeJob)
0041 };
0042 
0043 /**
0044  * Find MIME type for one file or directory.
0045  *
0046  * If you are going to download the file right after determining its MIME type,
0047  * then don't use this, prefer using a KIO::get() job instead. See the note
0048  * about putting the job on hold once the MIME type is determined.
0049  *
0050  * @param url the URL of the file
0051  * @param flags Can be HideProgressInfo here
0052  * @return the job handling the operation.
0053  */
0054 KIOCORE_EXPORT MimetypeJob *mimetype(const QUrl &url, JobFlags flags = DefaultFlags);
0055 
0056 }
0057 
0058 #endif