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(QLatin1Char(
'&'), QLatin1String(
"&"));
 
   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";
 
   73             out << 
dent << 
dent << 
"<description";
 
   74             if (i.key() != QLatin1String(
"en")) {
 
   75                 out << 
" xml:lang=\"" << i.key() << 
'"';
 
   79             QString description = i.value();
 
   80             for (blI = blacklist.constBegin(); blI != blacklist.constEnd(); ++blI) {
 
   81                 description.replace(blI.key(), blI.value());
 
   84             out << '>
' << description << "</description>\n"; 
   87             QHash< QString, QString >::const_iterator i; 
   88         for (QHash< QString, QString >::const_iterator i = action.descriptions.constBegin(); 
   89              i != action.descriptions.constEnd(); 
   91             out << dent << dent << "<message"; 
   92             if (i.key() != QLatin1String("en")) { 
   93                 out << " xml:lang=\"" << i.key() << '"'; 
   96             QHash< QChar, QString >::const_iterator blI; 
   97             QString message = i.value(); 
   98             for (blI = blacklist.constBegin(); blI != blacklist.constEnd(); ++blI) { 
   99                 message.replace(blI.key(), blI.value()); 
  102             out << '>' << message << "</
message>\n
"; 
  105         QString policy = action.policy; 
  106         QString policyInactive = action.policyInactive.isEmpty() ? QLatin1String("no
") : action.policyInactive; 
  107         if (!action.persistence.isEmpty() && policy != QLatin1String("yes
") && policy != 
  108                 QLatin1String("no
")) { 
  109             policy += QLatin1String("_keep
"); 
  111         if (!action.persistence.isEmpty() && policyInactive != QLatin1String("yes
") && policyInactive != 
  112                 QLatin1String("no
")) { 
  113             policyInactive += QLatin1String("_keep
"); 
  116         out << QString(QLatin1String(policy_tag)).arg(policyInactive).arg(policy); 
  118         out << dent << "</action>\n
"; 
  121     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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:07 by
doxygen 1.8.7 written
by 
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.