Changeset View
Changeset View
Standalone View
Standalone View
src/alternativesmodel.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | 46 | | |||
47 | static bool defaultMatch(const QString& constraint, const QJsonValue& value) | 47 | static bool defaultMatch(const QString& constraint, const QJsonValue& value) | ||
48 | { | 48 | { | ||
49 | return value == QJsonValue(constraint); | 49 | return value == QJsonValue(constraint); | ||
50 | } | 50 | } | ||
51 | 51 | | |||
52 | static bool mimeTypeMatch(const QString& constraint, const QJsonValue& value) | 52 | static bool mimeTypeMatch(const QString& constraint, const QJsonValue& value) | ||
53 | { | 53 | { | ||
54 | if (constraint.contains(QStringLiteral(";"))) { | ||||
55 | for (const QString& singleConstraint: constraint.split(QStringLiteral(";"))) { | ||||
56 | if (mimeTypeMatch(singleConstraint, value)) { | ||||
57 | return true; | ||||
58 | } | ||||
59 | } | ||||
60 | } | ||||
61 | | ||||
54 | if(value.isArray()) { | 62 | if(value.isArray()) { | ||
55 | foreach(const QJsonValue& val, value.toArray()) { | 63 | foreach(const QJsonValue& val, value.toArray()) { | ||
56 | if (mimeTypeMatch(constraint, val)) | 64 | if (mimeTypeMatch(constraint, val)) | ||
57 | return true; | 65 | return true; | ||
58 | } | 66 | } | ||
59 | return false; | 67 | return false; | ||
60 | } else if(value.isObject()) { | 68 | } else if(value.isObject()) { | ||
61 | for(const QJsonValue& val : value.toObject()) { | 69 | for(const QJsonValue& val : value.toObject()) { | ||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |