QMimeDatabase: pick up XML mimetypes from :/qt-project.org/mime/packages
[ChangeLog][QtCore][QMimeDatabase] QMimeDatabase can now pick up XML mimetype definitions from :/qt-project.org/mime/packages. GPL-compatible projects which provide self-contained binaries can use this to provide a copy of freedesktop.org.xml that will be used instead of the TIKA mimetypes. Change-Id: Id363317f920ae2cb1e054f32feb732e0e9168de3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b12542c964c15d074393a7594c97a96d5c2b047d)
This commit is contained in:
parent
2d2975bd9f
commit
ed2f80b75d
@ -71,7 +71,11 @@ bool QMimeDatabasePrivate::shouldCheck()
|
|||||||
|
|
||||||
static QStringList locateMimeDirectories()
|
static QStringList locateMimeDirectories()
|
||||||
{
|
{
|
||||||
return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("mime"), QStandardPaths::LocateDirectory);
|
QStringList dirs =
|
||||||
|
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("mime"),
|
||||||
|
QStandardPaths::LocateDirectory);
|
||||||
|
dirs.append(u":/qt-project.org/qmime"_s);
|
||||||
|
return dirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
|
||||||
|
@ -57,7 +57,7 @@ qt_internal_add_resource(tst_qmimedatabase-xml-fdoxml "testdata"
|
|||||||
|
|
||||||
qt_internal_add_resource(tst_qmimedatabase-xml-fdoxml "testdata-fdoxml"
|
qt_internal_add_resource(tst_qmimedatabase-xml-fdoxml "testdata-fdoxml"
|
||||||
PREFIX
|
PREFIX
|
||||||
"/tst_qmimedatabase/qmime"
|
"/qt-project.org/qmime/packages"
|
||||||
BASE
|
BASE
|
||||||
"../3rdparty"
|
"../3rdparty"
|
||||||
FILES
|
FILES
|
||||||
|
@ -139,7 +139,6 @@ void tst_QMimeDatabase::initTestCase()
|
|||||||
// Create a temporary "global" XDG data dir. It's used
|
// Create a temporary "global" XDG data dir. It's used
|
||||||
// 1) to install new global mimetypes later on
|
// 1) to install new global mimetypes later on
|
||||||
// 2) to run update-mime-database right away when testing the cache provider
|
// 2) to run update-mime-database right away when testing the cache provider
|
||||||
// 3) to host a copy of freedesktop.org.xml in tst_qmimedatabase-xml-fdoxml
|
|
||||||
QVERIFY2(m_temporaryDir.isValid(),
|
QVERIFY2(m_temporaryDir.isValid(),
|
||||||
("Could not create temporary subdir: " + m_temporaryDir.errorString()).toUtf8());
|
("Could not create temporary subdir: " + m_temporaryDir.errorString()).toUtf8());
|
||||||
const QDir here = QDir(m_temporaryDir.path());
|
const QDir here = QDir(m_temporaryDir.path());
|
||||||
@ -150,7 +149,7 @@ void tst_QMimeDatabase::initTestCase()
|
|||||||
qputenv("XDG_DATA_DIRS", QFile::encodeName(m_globalXdgDir));
|
qputenv("XDG_DATA_DIRS", QFile::encodeName(m_globalXdgDir));
|
||||||
qDebug() << "\nGlobal XDG_DATA_DIRS: " << m_globalXdgDir;
|
qDebug() << "\nGlobal XDG_DATA_DIRS: " << m_globalXdgDir;
|
||||||
|
|
||||||
if (m_isUsingCacheProvider || m_hasFreedesktopOrg) {
|
if (m_isUsingCacheProvider) {
|
||||||
const QString xmlFileName = m_hasFreedesktopOrg
|
const QString xmlFileName = m_hasFreedesktopOrg
|
||||||
? (s_additionalFilesResourcePrefix + "/freedesktop.org.xml"_L1)
|
? (s_additionalFilesResourcePrefix + "/freedesktop.org.xml"_L1)
|
||||||
: (s_resourcePrefix + "/tika/packages/tika-mimetypes.xml"_L1);
|
: (s_resourcePrefix + "/tika/packages/tika-mimetypes.xml"_L1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user