KAuth
8 #include <policy-gen/policy-gen.h>
11 #include <QTextStream>
17 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
18 "<!DOCTYPE policyconfig PUBLIC\n"
19 "\"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN\"\n"
20 "\"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd\">\n"
23 const char policy_tag[] =
26 " <allow_inactive>%1</allow_inactive>\n"
27 " <allow_active>%2</allow_active>\n"
30 const char dent[] =
" ";
35 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
36 out.setCodec(
"UTF-8");
42 out <<
"<vendor>" << domain[QStringLiteral(
"vendor")].toHtmlEscaped() <<
"</vendor>\n";
45 out <<
"<vendor_url>" << domain[QStringLiteral(
"vendorurl")] <<
"</vendor_url>\n";
48 out <<
"<icon_name>" << domain[QStringLiteral(
"icon")] <<
"</icon_name>\n";
51 for (
const Action &action : actions) {
52 out << dent <<
"<action id=\"" << action.name <<
"\" >\n";
55 for (
auto i = action.messages.cbegin(); i != action.messages.cend(); ++i) {
56 out << dent << dent <<
"<description";
58 out <<
" xml:lang=\"" << i.key() <<
'"';
61 out << '>
' << i.value().toHtmlEscaped() << "</description>\n";
64 for (auto i = action.descriptions.cbegin(); i != action.descriptions.cend(); ++i) {
65 out << dent << dent << "<message";
66 if (i.key() != QLatin1String("en")) {
67 out << " xml:lang=\"" << i.key() << '"';
70 out << '>' << i.value().toHtmlEscaped() << "</
message>\n
";
73 QString policy = action.policy;
74 QString policyInactive = action.policyInactive.isEmpty() ? QLatin1String("no") : action.policyInactive;
75 if (!action.persistence.isEmpty() && policy != QLatin1String("yes") && policy != QLatin1String("no")) {
76 policy += QLatin1String("_keep
");
78 if (!action.persistence.isEmpty() && policyInactive != QLatin1String("yes") && policyInactive != QLatin1String("no")) {
79 policyInactive += QLatin1String("_keep
");
82 out << QString(QLatin1String(policy_tag)).arg(policyInactive, policy);
84 out << dent << "</action>\n
";
87 out << "</policyconfig>\n
";
bool contains(const Key &key) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Feb 5 2023 04:14:58 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.