diff options
-rw-r--r-- | installerbuilder/libinstaller/qinstallerglobal.h | 1 | ||||
-rw-r--r-- | installerbuilder/libinstaller/settings.cpp | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/installerbuilder/libinstaller/qinstallerglobal.h b/installerbuilder/libinstaller/qinstallerglobal.h index 10f9184d6..c2f9eb45e 100644 --- a/installerbuilder/libinstaller/qinstallerglobal.h +++ b/installerbuilder/libinstaller/qinstallerglobal.h @@ -98,6 +98,7 @@ static const QLatin1String scSortingPriority("SortingPriority"); static const QLatin1String scIcon("Icon"); static const QLatin1String scLogo("Logo"); static const QLatin1String scTitle("Title"); +static const QLatin1String scPages("Pages"); static const QLatin1String scPrefix("Prefix"); static const QLatin1String scLogoSmall("LogoSmall"); static const QLatin1String scPublisher("Publisher"); diff --git a/installerbuilder/libinstaller/settings.cpp b/installerbuilder/libinstaller/settings.cpp index 41c022bc3..e75f67c86 100644 --- a/installerbuilder/libinstaller/settings.cpp +++ b/installerbuilder/libinstaller/settings.cpp @@ -86,6 +86,23 @@ static QList<Repository> readRemoteRepositories(QXmlStreamReader &reader) return set.toList(); } +static QHash<QString, QVariantHash> readPages(QXmlStreamReader &reader) +{ + QHash<QString, QVariantHash> hash; + while (reader.readNextStartElement()) { + if (reader.name() == QLatin1String("Page")) { + QVariantHash pageElements; + QString pageName = reader.attributes().value(QLatin1String("name")).toString(); + while (reader.readNextStartElement()) { + pageElements.insert(reader.name().toString(), reader + .readElementText(QXmlStreamReader::SkipChildElements)); + } + hash.insert(pageName, pageElements); + } + } + return hash; +} + // -- Settings::Private @@ -147,7 +164,7 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix) } QStringList blackList; - blackList << scPrivateKey << scPublicKey << scRemoteRepositories << scSigningCertificate; + blackList << scPrivateKey << scPublicKey << scRemoteRepositories << scSigningCertificate << scPages; Settings s; s.d->m_data.insert(scPrefix, prefix); @@ -165,6 +182,13 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix) foreach (const Repository &repository, repositories) s.d->m_data.insertMulti(scRepositories, QVariant().fromValue(repository)); } + + if (name == scPages) { + QHash<QString, QVariantHash> pages = readPages(reader); + const QStringList &keys = pages.keys(); + foreach (const QString &key, keys) + s.d->m_data.insert(key, pages.value(key)); + } } else { if (s.d->m_data.contains(name)) throw Error(QObject::tr("Multiple %1 elements found, but only one allowed.").arg(name)); |