! \internal */
| 620 | \internal |
| 621 | */ |
| 622 | void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader) |
| 623 | { |
| 624 | if (reader.name() != QLatin1String(PLUGIN)) { |
| 625 | reader.raiseError(QCoreApplication::translate("PluginSpec", "Expected element '%1' as top level element") |
| 626 | .arg(QLatin1String(PLUGIN))); |
| 627 | return; |
| 628 | } |
| 629 | name = reader.attributes().value(QLatin1String(PLUGIN_NAME)).toString(); |
| 630 | if (name.isEmpty()) { |
| 631 | reader.raiseError(msgAttributeMissing(PLUGIN, PLUGIN_NAME)); |
| 632 | return; |
| 633 | } |
| 634 | version = reader.attributes().value(QLatin1String(PLUGIN_VERSION)).toString(); |
| 635 | if (version.isEmpty()) { |
| 636 | reader.raiseError(msgAttributeMissing(PLUGIN, PLUGIN_VERSION)); |
| 637 | return; |
| 638 | } |
| 639 | if (!isValidVersion(version)) { |
| 640 | reader.raiseError(msgInvalidFormat(PLUGIN_VERSION)); |
| 641 | return; |
| 642 | } |
| 643 | compatVersion = reader.attributes().value(QLatin1String(PLUGIN_COMPATVERSION)).toString(); |
| 644 | if (!compatVersion.isEmpty() && !isValidVersion(compatVersion)) { |
| 645 | reader.raiseError(msgInvalidFormat(PLUGIN_COMPATVERSION)); |
| 646 | return; |
| 647 | } else if (compatVersion.isEmpty()) { |
| 648 | compatVersion = version; |
| 649 | } |
| 650 | disabledByDefault = readBooleanValue(reader, PLUGIN_DISABLED_BY_DEFAULT); |
| 651 | experimental = readBooleanValue(reader, PLUGIN_EXPERIMENTAL); |
| 652 | if (reader.hasError()) |
| 653 | return; |
| 654 | if (experimental) |
| 655 | disabledByDefault = true; |
| 656 | enabledInSettings = !disabledByDefault; |
| 657 | while (!reader.atEnd()) { |
| 658 | reader.readNext(); |
| 659 | switch (reader.tokenType()) { |
| 660 | case QXmlStreamReader::StartElement: { |
| 661 | const QStringRef element = reader.name(); |
| 662 | if (element == QLatin1String(VENDOR)) |
| 663 | vendor = reader.readElementText().trimmed(); |
| 664 | else if (element == QLatin1String(COPYRIGHT)) |
| 665 | copyright = reader.readElementText().trimmed(); |
| 666 | else if (element == QLatin1String(LICENSE)) |
| 667 | license = reader.readElementText().trimmed(); |
| 668 | else if (element == QLatin1String(DESCRIPTION)) |
| 669 | description = reader.readElementText().trimmed(); |
| 670 | else if (element == QLatin1String(URL)) |
| 671 | url = reader.readElementText().trimmed(); |
| 672 | else if (element == QLatin1String(CATEGORY)) |
| 673 | category = reader.readElementText().trimmed(); |
| 674 | else if (element == QLatin1String(PLATFORM)) { |
| 675 | const QString platformSpec = reader.readElementText().trimmed(); |
| 676 | if (!platformSpec.isEmpty()) { |
| 677 | platformSpecification.setPattern(platformSpec); |
| 678 | if (!platformSpecification.isValid()) |
| 679 | reader.raiseError(QLatin1String("Invalid platform specification \"") |
nothing calls this directly
no test coverage detected