/* SPDX-FileCopyrightText: 2008 Nicola Gigante SPDX-FileCopyrightText: 2009-2010 Dario Freddi SPDX-License-Identifier: LGPL-2.1-or-later */ #include #include #include #include const char header[] = "" "\n" "\n" "\n"; const char policy_tag[] = "" " \n" " %1\n" " %2\n" " \n"; const char dent[] = " "; void output(const QList &actions, const QMap &domain) { QTextStream out(stdout); out << header; if (domain.contains(QLatin1String("vendor"))) { out << "" << domain[QStringLiteral("vendor")].toHtmlEscaped() << "\n"; } if (domain.contains(QLatin1String("vendorurl"))) { out << "" << domain[QStringLiteral("vendorurl")] << "\n"; } if (domain.contains(QLatin1String("icon"))) { out << "" << domain[QStringLiteral("icon")] << "\n"; } for (const Action &action : actions) { out << dent << "\n"; // Not a typo, messages and descriptions are actually inverted for (auto i = action.messages.cbegin(); i != action.messages.cend(); ++i) { out << dent << dent << "' << i.value().toHtmlEscaped() << "\n"; } for (auto i = action.descriptions.cbegin(); i != action.descriptions.cend(); ++i) { out << dent << dent << "' << i.value().toHtmlEscaped() << "\n"; } QString policy = action.policy; QString policyInactive = action.policyInactive.isEmpty() ? QLatin1String("no") : action.policyInactive; if (!action.persistence.isEmpty() && policy != QLatin1String("yes") && policy != QLatin1String("no")) { policy += QLatin1String("_keep"); } if (!action.persistence.isEmpty() && policyInactive != QLatin1String("yes") && policyInactive != QLatin1String("no")) { policyInactive += QLatin1String("_keep"); } out << QString(QLatin1String(policy_tag)).arg(policyInactive, policy); out << dent << "\n"; } out << "\n"; }