diff options
author | Katja Marttila <katja.marttila@qt.io> | 2022-10-24 14:20:31 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2022-11-04 10:45:40 +0200 |
commit | 32f16fc0cfb64a2623570ff0447b1aa9e3b2385a (patch) | |
tree | 9f37eead434a42369539f78a34579cdee4784b00 /src/libs/kdtools | |
parent | cb0b27ef66ceb2de84f46c3de1307765366f3182 (diff) |
Add possibility to post load install scripts
This change adds attribute, postLoad, to existing <Script> -element.
Using <Script postLoad="True"> will call the script loading and
evaluation only to those components which are selected for install or
update right before the components installation start.
Task-number: QTIFW-2820
Change-Id: Ic1967d329cbb5de6a0216ff3f76cc2ede178db80
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r-- | src/libs/kdtools/updatesinfo.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libs/kdtools/updatesinfo.cpp b/src/libs/kdtools/updatesinfo.cpp index 545931a55..43f75e8a7 100644 --- a/src/libs/kdtools/updatesinfo.cpp +++ b/src/libs/kdtools/updatesinfo.cpp @@ -115,6 +115,7 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) UpdateInfo info; QMap<QString, QString> localizedDescriptions; + QHash<QString, QVariant> scriptHash; for (int i = 0; i < updateE.childNodes().count(); i++) { QDomElement childE = updateE.childNodes().at(i).toElement(); if (childE.isNull()) @@ -162,10 +163,18 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) const QDomNodeList operationNodes = childE.childNodes(); QVariant operationListVariant = parseOperations(childE.childNodes()); info.data.insert(QLatin1String("Operations"), operationListVariant); + } else if (childE.tagName() == QLatin1String("Script")) { + const bool postLoad = QVariant(childE.attribute(QLatin1String("postLoad"))).toBool(); + if (postLoad) + scriptHash.insert(QLatin1String("postLoadScript"), childE.text()); + else + scriptHash.insert(QLatin1String("installScript"), childE.text()); } else { info.data[childE.tagName()] = childE.text(); } } + if (!scriptHash.isEmpty()) + info.data.insert(QLatin1String("Script"), scriptHash); QStringList candidates; foreach (const QString &lang, QLocale().uiLanguages()) |