1 | /* |
2 | * This file is part of KFileMetaData |
3 | * Copyright (C) 2019 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | * |
19 | */ |
20 | |
21 | #ifndef KFILEMETADATA_MIMEUTILS |
22 | #define KFILEMETADATA_MIMEUTILS |
23 | |
24 | #include <QMimeDatabase> |
25 | #include "kfilemetadata_export.h" |
26 | |
27 | namespace KFileMetaData |
28 | { |
29 | namespace MimeUtils |
30 | { |
31 | |
32 | /** |
33 | * Returns the mimetype for a file |
34 | * |
35 | * The function uses both content and filename to determine the |
36 | * \c QMimeType. In case the extension mimetype is more specific |
37 | * than the content mimetype, and the first inherits the latter, |
38 | * the extension mimetype is preferred. |
39 | * If the extension does not match the content, the content has |
40 | * higher priority. |
41 | * The file must exist and be readable. |
42 | * |
43 | * @since 5.57 |
44 | * |
45 | * \sa QMimeDatabase::mimeTypesForFileName |
46 | * \sa QMimeType::inherits |
47 | */ |
48 | KFILEMETADATA_EXPORT |
49 | QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db); |
50 | |
51 | |
52 | } // namespace MimeUtils |
53 | } // namespace KFileMetaData |
54 | |
55 | #endif // KFILEMETADATA_MIMEUTILS |
56 | |