1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
4 | SPDX-FileCopyrightText: 2000-2009 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef KIO_MIMETYPEJOB_H |
10 | #define KIO_MIMETYPEJOB_H |
11 | |
12 | #include "transferjob.h" |
13 | #include <kio/global.h> // filesize_t |
14 | |
15 | namespace KIO |
16 | { |
17 | class MimetypeJobPrivate; |
18 | /** |
19 | * @class KIO::MimetypeJob mimetypejob.h <KIO/MimetypeJob> |
20 | * |
21 | * A MimetypeJob is a TransferJob that allows you to get |
22 | * the MIME type of a URL. Don't create directly, |
23 | * but use KIO::mimetype() instead. |
24 | * @see KIO::mimetype() |
25 | */ |
26 | class KIOCORE_EXPORT MimetypeJob : public TransferJob |
27 | { |
28 | Q_OBJECT |
29 | |
30 | public: |
31 | ~MimetypeJob() override; |
32 | |
33 | protected Q_SLOTS: |
34 | void slotFinished() override; |
35 | |
36 | protected: |
37 | KIOCORE_NO_EXPORT explicit MimetypeJob(MimetypeJobPrivate &dd); |
38 | |
39 | private: |
40 | Q_DECLARE_PRIVATE(MimetypeJob) |
41 | }; |
42 | |
43 | /** |
44 | * Find MIME type for one file or directory. |
45 | * |
46 | * If you are going to download the file right after determining its MIME type, |
47 | * then don't use this, prefer using a KIO::get() job instead. See the note |
48 | * about putting the job on hold once the MIME type is determined. |
49 | * |
50 | * @param url the URL of the file |
51 | * @param flags Can be HideProgressInfo here |
52 | * @return the job handling the operation. |
53 | */ |
54 | KIOCORE_EXPORT MimetypeJob *mimetype(const QUrl &url, JobFlags flags = DefaultFlags); |
55 | |
56 | } |
57 | |
58 | #endif |
59 | |