summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/kfilemetadata/APKBUILD16
-rw-r--r--user/kfilemetadata/add-formatting-fn.patch479
-rw-r--r--user/kfilemetadata/add-mimeutils.patch186
-rw-r--r--user/kfilemetadata/test-mimetype.patch13
4 files changed, 20 insertions, 674 deletions
diff --git a/user/kfilemetadata/APKBUILD b/user/kfilemetadata/APKBUILD
index b3437d091..f717f3b5f 100644
--- a/user/kfilemetadata/APKBUILD
+++ b/user/kfilemetadata/APKBUILD
@@ -1,8 +1,8 @@
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=kfilemetadata
-pkgver=5.54.0
-pkgrel=3
+pkgver=5.65.0
+pkgrel=0
pkgdesc="File metadata extraction framework"
url="https://www.kde.org/"
arch="all"
@@ -11,11 +11,10 @@ depends="catdoc"
depends_dev="qt5-qtbase-dev"
makedepends="$depends_dev cmake extra-cmake-modules python3 doxygen graphviz
qt5-qtmultimedia-dev qt5-qttools-dev exiv2-dev karchive-dev ki18n-dev
- poppler-qt5-dev taglib-dev kcoreaddons-dev ffmpeg-dev"
+ poppler-dev poppler-qt5-dev taglib-dev kcoreaddons-dev ffmpeg-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kfilemetadata-$pkgver.tar.xz
- add-formatting-fn.patch
- add-mimeutils.patch
+ test-mimetype.patch
"
build() {
@@ -30,7 +29,7 @@ build() {
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DBUILD_QCH:BOOL=ON \
- ${CMAKE_CROSSOPTS}
+ ${CMAKE_CROSSOPTS} .
make
}
@@ -42,6 +41,5 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="bfa8287e5c8df363908a441419d377d33ea2cd93a4fc69fc47c69da80ad0e3a80e60f26b4856c3d3e04128e6ac59b214ee0613e37dda29f2537f502789bd4801 kfilemetadata-5.54.0.tar.xz
-f6d8b9fe9353fdf380d073b8a7dfa4dd8c822a64c1a978dbe8ce13d0f8327d3af5d314be41f9cecc32afb19896711452289b78e09b6fffb010d8c89843ebc4e0 add-formatting-fn.patch
-c94c57b7dacfdf35c19db10f6a4b2724673fc542adac3dde57ac34cb4f09d063fd37404343d265075a88a397d3543da038b6b5832f481de3b05640279ef19a8c add-mimeutils.patch"
+sha512sums="1160630c6117337f7aab3e7b74e56678b093abd72bf891f14ed75a63a36783f18e597d8a076a588fd471ff81c30cc68c0a32efe154882c6d24591380807e5571 kfilemetadata-5.65.0.tar.xz
+17aad7d1e223c5668d7b61b125843d89d7f2598e94173d451e731f96d6322d93ab7b967a9f04dd83020e77cd2f84471c46d81b595b2ea484d2b423af6d1c332b test-mimetype.patch"
diff --git a/user/kfilemetadata/add-formatting-fn.patch b/user/kfilemetadata/add-formatting-fn.patch
deleted file mode 100644
index 5c3a1db91..000000000
--- a/user/kfilemetadata/add-formatting-fn.patch
+++ /dev/null
@@ -1,479 +0,0 @@
-From 4bedfd6609c6efe5dc327d305feac8985d4658e3 Mon Sep 17 00:00:00 2001
-From: Alexander Stippich <a.stippich@gmx.net>
-Date: Sat, 9 Feb 2019 17:41:46 +0100
-Subject: Add string formatting function to property info
-
-Summary:
-Adds the ability to format the metadata value
-for displaying purposes individually for each
-property. Currently, users of KFileMetaData
-must implement their own custom formatting
-functions.
-All custom formatting functions from
-Baloo-Widgets and Dolphin are copied into
-KFileMetaData. This can be extended later.
-
-This adds a dependency on KCoreAddons to
-KFileMetaData.
-
-FEATURE: 398581
-
-Test Plan: tests pass
-
-Reviewers: broulik, bruns, mgallien, #frameworks
-
-Reviewed By: bruns
-
-Subscribers: ngraham, kde-frameworks-devel, #baloo
-
-Tags: #frameworks, #baloo
-
-Differential Revision: https://phabricator.kde.org/D17245
----
- CMakeLists.txt | 5 +++
- autotests/propertyinfotest.cpp | 29 ++++++++++++++
- autotests/propertyinfotest.h | 1 +
- src/CMakeLists.txt | 2 +
- src/formatstrings.cpp | 86 ++++++++++++++++++++++++++++++++++++++++++
- src/formatstrings_p.h | 50 ++++++++++++++++++++++++
- src/propertyinfo.cpp | 27 +++++++++++++
- src/propertyinfo.h | 7 ++++
- 8 files changed, 207 insertions(+)
- create mode 100644 src/formatstrings.cpp
- create mode 100644 src/formatstrings_p.h
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index fa481a9..7ef0a40 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -40,6 +40,11 @@ set_package_properties(KF5Archive PROPERTIES DESCRIPTION "KDE Frameworks 5: Arch
- URL "https://download.kde.org/stable/frameworks/" TYPE OPTIONAL
- PURPOSE "Archive is needed to build ODF and OOXML 2007 extractors")
-
-+find_package(KF5 ${KF5_DEP_VERSION} COMPONENTS CoreAddons)
-+set_package_properties(KF5CoreAddons PROPERTIES DESCRIPTION "KDE Frameworks 5: Core Addons Framework"
-+ URL "https://download.kde.org/stable/frameworks/" TYPE REQUIRED
-+ PURPOSE "Needed for the formatting of properties for display purposes")
-+
- find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS I18n)
-
- find_package(Poppler 0.12.1 COMPONENTS Qt5)
-diff --git a/autotests/propertyinfotest.cpp b/autotests/propertyinfotest.cpp
-index ae8b1b8..e203dcd 100644
---- a/autotests/propertyinfotest.cpp
-+++ b/autotests/propertyinfotest.cpp
-@@ -45,4 +45,33 @@ void PropertyInfoTest::testNameIdMapping()
- }
- }
-
-+void PropertyInfoTest::testFormatAsDisplayString()
-+{
-+ auto emptyProperty = PropertyInfo::fromName(QStringLiteral("no valid property name"));
-+ QCOMPARE(emptyProperty.formatAsDisplayString(QVariant("empty")), QStringLiteral("empty"));
-+
-+ PropertyInfo year(Property::DiscNumber);
-+ QCOMPARE(year.formatAsDisplayString(QVariant(2018)), QStringLiteral("2018"));
-+
-+ QStringList artistList = {"Artist1", "Artist2"};
-+ PropertyInfo artist(Property::Artist);
-+ QCOMPARE(artist.formatAsDisplayString(QVariant(artistList)), QStringLiteral("Artist1, Artist2"));
-+
-+ QStringList authorList = {"Author1"};
-+ PropertyInfo author(Property::Author);
-+ QCOMPARE(artist.formatAsDisplayString(QVariant(authorList)), QStringLiteral("Author1"));
-+
-+ PropertyInfo duration(Property::Duration);
-+ QCOMPARE(duration.formatAsDisplayString(QVariant(1800)), QStringLiteral("0:30:00"));
-+
-+ PropertyInfo sampleRate(Property::SampleRate);
-+ QCOMPARE(sampleRate.formatAsDisplayString(QVariant(44100)), QString(QLocale().toString(44.1) + QStringLiteral(" kHz")));
-+
-+ PropertyInfo bitRate(Property::BitRate);
-+ QCOMPARE(bitRate.formatAsDisplayString(QVariant(128000)), QStringLiteral("128 kB/s"));
-+
-+ PropertyInfo orientation(Property::ImageOrientation);
-+ QCOMPARE(orientation.formatAsDisplayString(QVariant(5)), QStringLiteral("Transposed"));
-+}
-+
- QTEST_GUILESS_MAIN(PropertyInfoTest)
-diff --git a/autotests/propertyinfotest.h b/autotests/propertyinfotest.h
-index 677ade1..15e6a10 100644
---- a/autotests/propertyinfotest.h
-+++ b/autotests/propertyinfotest.h
-@@ -30,6 +30,7 @@ class PropertyInfoTest : public QObject
- Q_OBJECT
- private Q_SLOTS:
- void testNameIdMapping();
-+ void testFormatAsDisplayString();
- };
-
- }
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 52fa8e5..c3cbe8c 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -13,6 +13,7 @@ set(KF5FileMetaData_SRCS
- writerplugin.cpp
- writercollection.cpp
- externalwriter.cpp
-+ formatstrings.cpp
- )
- ecm_qt_declare_logging_category(KF5FileMetaData_SRCS HEADER kfilemetadata_debug.h IDENTIFIER KFILEMETADATA_LOG CATEGORY_NAME kf5.kfilemetadata)
-
-@@ -34,6 +35,7 @@ target_link_libraries(KF5FileMetaData
- Qt5::Core
- PRIVATE
- KF5::I18n
-+ KF5::CoreAddons
- )
-
- if(TAGLIB_FOUND)
-diff --git a/src/formatstrings.cpp b/src/formatstrings.cpp
-new file mode 100644
-index 0000000..b0bfdf8
---- /dev/null
-+++ b/src/formatstrings.cpp
-@@ -0,0 +1,86 @@
-+/*
-+ * Copyright (C) 2018 Alexander Stippich <a.stippich@gmx.net>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ */
-+
-+#include "formatstrings_p.h"
-+
-+#include <QDateTime>
-+#include <KLocalizedString>
-+
-+using namespace KFileMetaData;
-+
-+QString FormatStrings::toStringFunction(const QVariant& value)
-+{
-+ return value.toString();
-+}
-+
-+QString FormatStrings::joinStringListFunction(const QVariant& value)
-+{
-+ return value.toStringList().join(i18nc("Separation between multiple entries in a list", ", "));
-+}
-+
-+QString FormatStrings::formatDate(const QVariant& value)
-+{
-+ KFormat form;
-+ QDateTime dt;
-+ if (value.type() == QVariant::DateTime) {
-+ dt = value.toDateTime();
-+ } else {
-+ dt = QDateTime::fromString(value.toString(), Qt::ISODate);
-+ }
-+ if (dt.isValid()) {
-+ return form.formatRelativeDateTime(dt, QLocale::LongFormat);
-+ }
-+ return QString();
-+}
-+
-+QString FormatStrings::formatDuration(const QVariant& value)
-+{
-+ KFormat form;
-+ return form.formatDuration(value.toInt() * 1000);
-+}
-+
-+QString FormatStrings::formatBitRate(const QVariant& value)
-+{
-+ KFormat form;
-+ return i18nc("@label bitrate (per second)", "%1/s", form.formatByteSize(value.toInt(), 0, KFormat::MetricBinaryDialect));
-+}
-+
-+QString FormatStrings::formatSampleRate(const QVariant& value)
-+{
-+ return i18nc("@label samplerate in kilohertz", "%1 kHz", QLocale().toString(value.toDouble() / 1000));
-+}
-+
-+QString FormatStrings::formatOrientationValue(const QVariant& value)
-+{
-+ QString string;
-+ switch (value.toInt()) {
-+ case 1: string = i18nc("Description of image orientation", "Unchanged"); break;
-+ case 2: string = i18nc("Description of image orientation", "Horizontally flipped"); break;
-+ case 3: string = i18nc("Description of image orientation", "180° rotated"); break;
-+ case 4: string = i18nc("Description of image orientation", "Vertically flipped"); break;
-+ case 5: string = i18nc("Description of image orientation", "Transposed"); break;
-+ case 6: string = i18nc("Description of image orientation, counter clock-wise rotated", "90° rotated CCW "); break;
-+ case 7: string = i18nc("Description of image orientation", "Transversed"); break;
-+ case 8: string = i18nc("Description of image orientation, counter clock-wise rotated", "270° rotated CCW"); break;
-+ default:
-+ break;
-+ }
-+ return string;
-+}
-+
-diff --git a/src/formatstrings_p.h b/src/formatstrings_p.h
-new file mode 100644
-index 0000000..125c31e
---- /dev/null
-+++ b/src/formatstrings_p.h
-@@ -0,0 +1,50 @@
-+/*
-+ * Copyright (C) 2018 Alexander Stippich <a.stippich@gmx.net>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ */
-+
-+#ifndef KFILEMETADATA_FORMATSTRINGS_P_H
-+#define KFILEMETADATA_FORMATSTRINGS_P_H
-+
-+#include <QString>
-+#include <QVariant>
-+#include <KFormat>
-+
-+namespace KFileMetaData {
-+
-+class Q_DECL_HIDDEN FormatStrings
-+{
-+public:
-+ static QString toStringFunction(const QVariant& value);
-+
-+ static QString joinStringListFunction(const QVariant& value);
-+
-+ static QString formatDate(const QVariant& value);
-+
-+ static QString formatDuration(const QVariant& value);
-+
-+ static QString formatBitRate(const QVariant& value);
-+
-+ static QString formatSampleRate(const QVariant& value);
-+
-+ static QString formatOrientationValue(const QVariant& value);
-+
-+};
-+
-+}
-+
-+#endif
-diff --git a/src/propertyinfo.cpp b/src/propertyinfo.cpp
-index 5439a58..56fc596 100644
---- a/src/propertyinfo.cpp
-+++ b/src/propertyinfo.cpp
-@@ -24,6 +24,8 @@
-
- #include <KLocalizedString>
-
-+#include "formatstrings_p.h"
-+
- using namespace KFileMetaData;
-
- class Q_DECL_HIDDEN PropertyInfo::Private
-@@ -34,6 +36,7 @@ public:
- QString displayName;
- QVariant::Type valueType;
- bool shouldBeIndexed;
-+ QString (*formatAsString)(const QVariant& value) = nullptr;
- };
-
- PropertyInfo::PropertyInfo(Property::Property property)
-@@ -41,6 +44,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- {
- d->prop = property;
- d->shouldBeIndexed = true;
-+ d->formatAsString = &FormatStrings::toStringFunction;
-
- switch (property) {
- case Property::Album:
-@@ -53,12 +57,14 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("albumArtist");
- d->displayName = i18nc("@label", "Album Artist");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::Artist:
- d->name = QStringLiteral("artist");
- d->displayName = i18nc("@label", "Artist");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::AspectRatio:
-@@ -71,12 +77,14 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("author");
- d->displayName = i18nc("@label", "Author");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::BitRate:
- d->name = QStringLiteral("bitRate");
- d->displayName = i18nc("@label", "Bitrate");
- d->valueType = QVariant::Int;
-+ d->formatAsString = &FormatStrings::formatBitRate;
- break;
-
- case Property::Channels:
-@@ -117,12 +125,14 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("creationDate");
- d->displayName = i18nc("@label", "Creation Date");
- d->valueType = QVariant::String;
-+ d->formatAsString = &FormatStrings::formatDate;
- break;
-
- case Property::Duration:
- d->name = QStringLiteral("duration");
- d->displayName = i18nc("@label", "Duration");
- d->valueType = QVariant::Int;
-+ d->formatAsString = &FormatStrings::formatDuration;
- break;
-
- case Property::Empty:
-@@ -147,6 +157,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("genre");
- d->displayName = i18nc("@label music genre", "Genre");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- d->shouldBeIndexed = false;
- break;
-
-@@ -160,6 +171,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("imageDateTime");
- d->displayName = i18nc("@label EXIF", "Image Date Time");
- d->valueType = QVariant::DateTime;
-+ d->formatAsString = &FormatStrings::formatDate;
- break;
-
- case Property::ImageMake:
-@@ -180,12 +192,14 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("imageOrientation");
- d->displayName = i18nc("@label EXIF", "Image Orientation");
- d->valueType = QVariant::Int;
-+ d->formatAsString = &FormatStrings::formatOrientationValue;
- break;
-
- case Property::Keywords:
- d->name = QStringLiteral("keywords");
- d->displayName = i18nc("@label", "Keywords");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- d->shouldBeIndexed = false;
- break;
-
-@@ -206,6 +220,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("lyricist");
- d->displayName = i18nc("@label", "Lyricist");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- d->shouldBeIndexed = false;
- break;
-
-@@ -225,6 +240,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("photoDateTimeOriginal");
- d->displayName = i18nc("@label EXIF", "Photo Original Date Time");
- d->valueType = QVariant::DateTime;
-+ d->formatAsString = &FormatStrings::formatDate;
- break;
-
- case Property::PhotoExposureBiasValue:
-@@ -345,6 +361,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("sampleRate");
- d->displayName = i18nc("@label", "Sample Rate");
- d->valueType = QVariant::Int;
-+ d->formatAsString = &FormatStrings::formatSampleRate;
- break;
-
- case Property::Subject:
-@@ -382,6 +399,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("performer");
- d->displayName = i18nc("@label", "Performer");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::Ensemble:
-@@ -394,12 +412,14 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->name = QStringLiteral("arranger");
- d->displayName = i18nc("@label", "Arranger");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::Conductor:
- d->name = QStringLiteral("conductor");
- d->displayName = i18nc("@label", "Conductor");
- d->valueType = QVariant::StringList;
-+ d->formatAsString = &FormatStrings::joinStringListFunction;
- break;
-
- case Property::Compilation:
-@@ -503,6 +523,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->displayName = i18nc("@label translations last update", "Last Update");
- d->valueType = QVariant::String;
- d->shouldBeIndexed = false;
-+ d->formatAsString = &FormatStrings::formatDate;
- break;
-
- case Property::TranslationTemplateDate:
-@@ -510,6 +531,7 @@ PropertyInfo::PropertyInfo(Property::Property property)
- d->displayName = i18nc("@label date of template creation8", "Template Creation");
- d->valueType = QVariant::String;
- d->shouldBeIndexed = false;
-+ d->formatAsString = &FormatStrings::formatDate;
- break;
-
- case Property::OriginUrl:
-@@ -600,6 +622,11 @@ bool PropertyInfo::shouldBeIndexed() const
- return d->shouldBeIndexed;
- }
-
-+QString PropertyInfo::formatAsDisplayString(const QVariant &value) const
-+{
-+ return (d->formatAsString)(value);
-+}
-+
- PropertyInfo PropertyInfo::fromName(const QString& name)
- {
- static QHash<QString, Property::Property> propertyHash = {
-diff --git a/src/propertyinfo.h b/src/propertyinfo.h
-index c1767c4..3c426e8 100644
---- a/src/propertyinfo.h
-+++ b/src/propertyinfo.h
-@@ -85,6 +85,13 @@ public:
- */
- static PropertyInfo fromName(const QString& name);
-
-+ /**
-+ * Returns the value of the property as a QString with added formatting,
-+ * added units if needed, and translated enums.
-+ * @since 5.56
-+ */
-+ QString formatAsDisplayString(const QVariant& value) const;
-+
- private:
- class Private;
- Private* d;
---
-cgit v1.1
-
diff --git a/user/kfilemetadata/add-mimeutils.patch b/user/kfilemetadata/add-mimeutils.patch
deleted file mode 100644
index 5ea2cef37..000000000
--- a/user/kfilemetadata/add-mimeutils.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From 69c25514cf6a08ceaaacbc4092cc02ff40853228 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
-Date: Mon, 25 Mar 2019 17:40:41 +0100
-Subject: Add helper function to determine mime type based on content and
- extension
-
-Summary:
-The QMimeDatabase::MatchDefault only falls back to content matching
-if the extension is not known. This fails for e.g. Matroska files, where
-the content allows to distinguish between audio and video files.
-
-CCBUG: 403902
-
-Reviewers: #baloo, #frameworks, astippich, ngraham, poboiko
-
-Reviewed By: #baloo, astippich, ngraham
-
-Subscribers: kde-frameworks-devel
-
-Tags: #frameworks, #baloo
-
-Differential Revision: https://phabricator.kde.org/D20045
----
- src/CMakeLists.txt | 1 +
- src/mimeutils.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
- src/mimeutils.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 106 insertions(+)
- create mode 100644 src/mimeutils.cpp
- create mode 100644 src/mimeutils.h
-
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index c3cbe8c..fc4ce19 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -14,6 +14,7 @@ set(KF5FileMetaData_SRCS
- writercollection.cpp
- externalwriter.cpp
- formatstrings.cpp
-+ mimeutils.cpp
- )
- ecm_qt_declare_logging_category(KF5FileMetaData_SRCS HEADER kfilemetadata_debug.h IDENTIFIER KFILEMETADATA_LOG CATEGORY_NAME kf5.kfilemetadata)
-
-diff --git a/src/mimeutils.cpp b/src/mimeutils.cpp
-new file mode 100644
-index 0000000..7ea4dc8
---- /dev/null
-+++ b/src/mimeutils.cpp
-@@ -0,0 +1,50 @@
-+/*
-+ * This file is part of KFileMetaData
-+ * Copyright (C) 2019 Stefan Brüns <stefan.bruens@rwth-aachen.de>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ */
-+
-+#include "mimeutils.h"
-+
-+namespace KFileMetaData {
-+namespace MimeUtils {
-+
-+QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db)
-+{
-+ auto extensionMimes = db.mimeTypesForFileName(filePath);
-+ auto contentMime = db.mimeTypeForFile(filePath, QMimeDatabase::MatchContent);
-+
-+ if (extensionMimes.contains(contentMime)) {
-+ // content based mime type is one of the types for the file extension, e.g.:
-+ // *.ogg -> [ audio/ogg, audio/x-vorbis+ogg, ...]
-+ // content -> audio/x-vorbis+ogg
-+ return contentMime;
-+ }
-+
-+ for (auto mime : extensionMimes) {
-+ // check if the content is generic and the extension is more specific, e.g.:
-+ // *.mkv -> [ video/matroska ]
-+ // content -> application/matroska
-+ if (mime.inherits(contentMime.name())) {
-+ return mime;
-+ }
-+ }
-+ // content mime type does not match the extension, trust the content
-+ return contentMime;
-+}
-+
-+}} // namespace KFileMetaData::MimeUtils
-diff --git a/src/mimeutils.h b/src/mimeutils.h
-new file mode 100644
-index 0000000..f33e100
---- /dev/null
-+++ b/src/mimeutils.h
-@@ -0,0 +1,55 @@
-+/*
-+ * This file is part of KFileMetaData
-+ * Copyright (C) 2019 Stefan Brüns <stefan.bruens@rwth-aachen.de>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ */
-+
-+#ifndef KFILEMETADATA_MIMEUTILS
-+#define KFILEMETADATA_MIMEUTILS
-+
-+#include <QMimeDatabase>
-+#include "kfilemetadata_export.h"
-+
-+namespace KFileMetaData
-+{
-+namespace MimeUtils
-+{
-+
-+/**
-+ * Returns the mimetype for a file
-+ *
-+ * The function uses both content and filename to determine the
-+ * \c QMimeType. In case the extension mimetype is more specific
-+ * than the content mimetype, and the first inherits the latter,
-+ * the extension mimetype is preferred.
-+ * If the extension does not match the content, the content has
-+ * higher priority.
-+ * The file must exist and be readable.
-+ *
-+ * @since 5.57
-+ *
-+ * \sa QMimeDatabase::mimeTypesForFileName
-+ * \sa QMimeType::inherits
-+ */
-+KFILEMETADATA_EXPORT
-+QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db);
-+
-+
-+} // namespace MimeUtils
-+} // namespace KFileMetaData
-+
-+#endif // KFILEMETADATA_MIMEUTILS
---
-cgit v1.1
-
-From b56d0cb5b90baeef2ada6ba0cbaea91506df1270 Mon Sep 17 00:00:00 2001
-From: Alexander Stippich <a.stippich@gmx.net>
-Date: Wed, 27 Mar 2019 20:41:49 +0100
-Subject: Generate header for new MimeUtils
-
----
- src/CMakeLists.txt | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index fc4ce19..73bf7d0 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -75,6 +75,7 @@ ecm_generate_headers(KF5FileMetaData_CamelCase_HEADERS
- WriterPlugin
- WriterCollection
- EmbeddedImageData
-+ MimeUtils
-
- PREFIX kfilemetadata
- REQUIRED_HEADERS KF5FileMetaData_HEADERS
---
-cgit v1.1
-
diff --git a/user/kfilemetadata/test-mimetype.patch b/user/kfilemetadata/test-mimetype.patch
new file mode 100644
index 000000000..87b994920
--- /dev/null
+++ b/user/kfilemetadata/test-mimetype.patch
@@ -0,0 +1,13 @@
+Our version of shared-mime-info differs for the AppImage MIME type.
+
+--- kfilemetadata-5.65.0/autotests/extractorcoveragetest.cpp.old 2019-12-12 22:37:05.000000000 +0000
++++ kfilemetadata-5.65.0/autotests/extractorcoveragetest.cpp 2019-12-29 15:56:30.981925832 +0000
+@@ -48,7 +48,7 @@
+ m_knownFiles = {
+ { "test.aif", "audio/x-aifc"},
+ { "test.ape", "audio/x-ape"},
+- { "test.AppImage", "application/vnd.appimage"},
++ { "test.AppImage", "application/x-iso9660-appimage"},
+ { "test_apple_systemprofiler.spx", "application/xml"},
+ { "test.dot", "text/vnd.graphviz"},
+ { "test.eps", "image/x-eps"},