add macro wrap for QXmlStream related code
To fix a compile error when QXmlStream is removed by defining macro, but it is still used in some files. Change-Id: I776c799732212b7401767440448248fc7b5dc480 Reviewed-by: David Faure <faure@kde.org>bb10
parent
0f409aca96
commit
32cfff864e
|
|
@ -529,6 +529,10 @@ QList<QMimeType> QMimeBinaryProvider::allMimeTypes()
|
|||
|
||||
void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
||||
{
|
||||
#ifdef QT_NO_XMLSTREAMREADER
|
||||
qWarning() << "Cannot load mime type since QXmlStreamReader is not available.";
|
||||
return;
|
||||
#else
|
||||
if (data.loaded)
|
||||
return;
|
||||
data.loaded = true;
|
||||
|
|
@ -618,6 +622,7 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
|||
// But is this really worth the effort?
|
||||
}
|
||||
#endif
|
||||
#endif //QT_NO_XMLSTREAMREADER
|
||||
}
|
||||
|
||||
// Binary search in the icons or generic-icons list
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ static bool parseNumber(const QString &n, int *target, QString *errorMessage)
|
|||
// Evaluate a magic match rule like
|
||||
// <match value="must be converted with BinHex" type="string" offset="11"/>
|
||||
// <match value="0x9501" type="big16" offset="0:64"/>
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
static bool createMagicMatchRule(const QXmlStreamAttributes &atts,
|
||||
QString *errorMessage, QMimeMagicRule *&rule)
|
||||
{
|
||||
|
|
@ -202,9 +203,15 @@ static bool createMagicMatchRule(const QXmlStreamAttributes &atts,
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString *errorMessage)
|
||||
{
|
||||
#ifdef QT_NO_XMLSTREAMREADER
|
||||
if (errorMessage)
|
||||
*errorMessage = QString::fromLatin1("QXmlStreamReader is not available, cannot parse.");
|
||||
return false;
|
||||
#else
|
||||
QMimeTypePrivate data;
|
||||
int priority = 50;
|
||||
QStack<QMimeMagicRule *> currentRules; // stack for the nesting of rules
|
||||
|
|
@ -338,6 +345,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
|||
}
|
||||
|
||||
return true;
|
||||
#endif //QT_NO_XMLSTREAMREADER
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue