KDECore
Go to the documentation of this file. 25 #include <QTextStream> 28 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 29 "<!DOCTYPE policyconfig PUBLIC\n" 30 "\"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN\"\n" 31 "\"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd\">\n" 36 " <allow_inactive>%1</allow_inactive>\n" 37 " <allow_active>%2</allow_active>\n" 44 QTextStream out(stdout);
45 out.setCodec(
"UTF-8");
51 blacklist.insert(QChar::fromLatin1(
'&'), QString::fromLatin1(
"&"));
53 if (domain.contains(QLatin1String(
"vendor"))) {
55 QString vendor = domain[QLatin1String(
"vendor")];
56 for (blI = blacklist.constBegin(); blI != blacklist.constEnd(); ++blI) {
57 vendor.replace(blI.key(), blI.value());
59 out <<
"<vendor>" << vendor <<
"</vendor>\n";
61 if (domain.contains(QLatin1String(
"vendorurl"))) {
62 out <<
"<vendor_url>" << domain[QLatin1String(
"vendorurl")] <<
"</vendor_url>\n";
64 if (domain.contains(QLatin1String(
"icon"))) {
65 out <<
"<icon_name>" << domain[QLatin1String(
"icon")] <<
"</icon_name>\n";
68 foreach (
const Action &action, actions) {
69 out <<
dent <<
"<action id=\"" << action.
name <<
"\" >\n";
72 out <<
dent <<
dent <<
"<description";
73 if (i.key() != QLatin1String(
"en")) {
74 out <<
" xml:lang=\"" << i.key() <<
'"';
78 QString description = i.value();
79 for (blI = blacklist.constBegin(); blI != blacklist.constEnd(); ++blI) {
80 description.replace(blI.key(), blI.value());
83 out << '>
' << description << "</description>\n"; 86 for (QHash< QString, QString>::const_iterator i = action.descriptions.constBegin(); 87 i != action.descriptions.constEnd(); 89 out << dent << dent << "<message"; 90 if (i.key() != QLatin1String("en")) { 91 out << " xml:lang=\"" << i.key() << '"'; 94 QHash< QChar, QString >::const_iterator blI; 95 QString message = i.value(); 96 for (blI = blacklist.constBegin(); blI != blacklist.constEnd(); ++blI) { 97 message.replace(blI.key(), blI.value()); 100 out << '>' << message << "</
message>\n
"; 103 QString policy = action.policy; 104 QString policyInactive = action.policyInactive.isEmpty() ? QLatin1String("no
") : action.policyInactive; 105 if (!action.persistence.isEmpty() && policy != QLatin1String("yes
") && policy != QLatin1String("no
")) { 106 policy += QLatin1String("_keep_
") + action.persistence; 108 if (!action.persistence.isEmpty() && policyInactive != QLatin1String("yes
") && 109 policyInactive != QLatin1String("no
")) { 110 policyInactive += QLatin1String("_keep_
") + action.persistence; 113 out << QString(QLatin1String(policy_tag)).arg(policyInactive).arg(policy); 115 out << dent << "</action>\n
"; 118 out << "</policyconfig>\n
"; void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
Display a long message of a certain type.
void output(QList< Action > actions, QHash< QString, QString > domain)
QHash< QString, QString > messages
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Thu Jun 15 2017 13:46:44 by
doxygen 1.8.13 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.