File indexing completed on 2025-02-16 13:03:42
0001 /* 0002 This file is part of KFileMetaData 0003 SPDX-FileCopyrightText: 2019 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef KFILEMETADATA_MIMEUTILS 0009 #define KFILEMETADATA_MIMEUTILS 0010 0011 #include <QMimeDatabase> 0012 #include "kfilemetadata_export.h" 0013 0014 namespace KFileMetaData 0015 { 0016 namespace MimeUtils 0017 { 0018 0019 /** 0020 * Returns the mimetype for a file 0021 * 0022 * The function uses both content and filename to determine the 0023 * \c QMimeType. In case the extension mimetype is more specific 0024 * than the content mimetype, and the first inherits the latter, 0025 * the extension mimetype is preferred. 0026 * If the extension does not match the content, the content has 0027 * higher priority. 0028 * The file must exist and be readable. 0029 * 0030 * @since 5.57 0031 * 0032 * \sa QMimeDatabase::mimeTypesForFileName 0033 * \sa QMimeType::inherits 0034 */ 0035 KFILEMETADATA_EXPORT 0036 QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db); 0037 0038 0039 } // namespace MimeUtils 0040 } // namespace KFileMetaData 0041 0042 #endif // KFILEMETADATA_MIMEUTILS