polkit-kde-kcmodules-1: remove it

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-03-19 12:48:49 +02:00
parent 7ae87e89f7
commit 348e7e0408
46 changed files with 0 additions and 5204 deletions

View file

@ -1,39 +0,0 @@
project(polkit-kde-kcmodules-1)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include_directories(${KDE4_INCLUDES})
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
function(dbus_add_activation_system_service _sources)
pkg_search_module( DBUS dbus-1 )
foreach (_i ${_sources})
get_filename_component(_service_file ${_i} ABSOLUTE)
string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
configure_file(${_service_file} ${_target})
install(FILES ${_target} DESTINATION ${KDE4_DBUS_SYSTEM_SERVICES_INSTALL_DIR} )
endforeach (_i ${ARGN})
endfunction(dbus_add_activation_system_service _sources)
set(POLKITQT-1_MIN_VERSION "0.103.0")
find_package(PolkitQt-1 REQUIRED)
include(FindPkgConfig)
include_directories(${KDE4_INCLUDES}
${POLKITQT-1_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/common)
add_subdirectory(common)
add_subdirectory(polkitactions)
add_subdirectory(polkitconfig)
add_subdirectory(helper)
install(
FILES settings-system-policies.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)

View file

@ -1,26 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
set(polkitkdekcmodulesprivate_SRCS
PKLAEntry.cpp
identitywidget.cpp
)
add_library(polkitkdekcmodulesprivate SHARED ${polkitkdekcmodulesprivate_SRCS})
set_target_properties(polkitkdekcmodulesprivate PROPERTIES
VERSION 0.1.0
SOVERSION 0
)
target_link_libraries(polkitkdekcmodulesprivate
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBRARY}
)
install(
TARGETS polkitkdekcmodulesprivate
DESTINATION ${KDE4_LIB_INSTALL_DIR}
)

View file

@ -1,71 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "PKLAEntry.h"
#include <QtDBus/qdbusargument.h>
QDBusArgument& operator<<(QDBusArgument& argument, const PKLAEntry& entry)
{
argument.beginStructure();
argument << entry.title << entry.identity << entry.action << entry.resultAny << entry.resultInactive << entry.resultActive << entry.filePath
<< entry.filePriority << entry.fileOrder;
argument.endStructure();
return argument;
}
const QDBusArgument& operator>>(const QDBusArgument& argument, PKLAEntry& entry)
{
argument.beginStructure();
argument >> entry.title >> entry.identity >> entry.action >> entry.resultAny >> entry.resultInactive >> entry.resultActive >> entry.filePath
>> entry.filePriority >> entry.fileOrder;
argument.endStructure();
return argument;
}
PolkitQt1::ActionDescription::ImplicitAuthorization PKLAEntry::implFromText(const QString& text)
{
if (text == "yes") {
return PolkitQt1::ActionDescription::Authorized;
} else if (text == "no") {
return PolkitQt1::ActionDescription::NotAuthorized;
} else if (text == "auth_admin") {
return PolkitQt1::ActionDescription::AdministratorAuthenticationRequired;
} else if (text == "auth_admin_keep") {
return PolkitQt1::ActionDescription::AdministratorAuthenticationRequiredRetained;
} else if (text == "auth_self") {
return PolkitQt1::ActionDescription::AuthenticationRequired;
} else if (text == "auth_self_keep") {
return PolkitQt1::ActionDescription::AuthenticationRequiredRetained;
} else {
return PolkitQt1::ActionDescription::Unknown;
}
}
QString PKLAEntry::textFromImpl(PolkitQt1::ActionDescription::ImplicitAuthorization implicit)
{
switch (implicit) {
case PolkitQt1::ActionDescription::Authorized:
return "yes";
case PolkitQt1::ActionDescription::NotAuthorized:
return "no";
case PolkitQt1::ActionDescription::AdministratorAuthenticationRequired:
return "auth_admin";
case PolkitQt1::ActionDescription::AdministratorAuthenticationRequiredRetained:
return "auth_admin_keep";
case PolkitQt1::ActionDescription::AuthenticationRequired:
return "auth_self";
case PolkitQt1::ActionDescription::AuthenticationRequiredRetained:
return "auth_self_keep";
default:
return QString();
}
}

View file

@ -1,46 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef PKLAENTRY_H
#define PKLAENTRY_H
#include <QMetaType>
#include <PolkitQt1/ActionDescription>
#include <kdemacros.h>
#include <QDBusArgument>
class KDE_EXPORT PKLAEntry {
public:
QString title;
QString identity;
QString action;
QString resultAny;
QString resultInactive;
QString resultActive;
QString filePath;
int filePriority;
int fileOrder;
// Static utils for PKLA
static PolkitQt1::ActionDescription::ImplicitAuthorization implFromText(const QString& text);
static QString textFromImpl(PolkitQt1::ActionDescription::ImplicitAuthorization implicit);
};
Q_DECLARE_METATYPE(PKLAEntry)
Q_DECLARE_METATYPE(QList<PKLAEntry>);
typedef QList<PKLAEntry> PKLAEntryList;
KDE_EXPORT QDBusArgument& operator<<(QDBusArgument& argument, const PKLAEntry& entry);
KDE_EXPORT const QDBusArgument& operator>>(const QDBusArgument& argument, PKLAEntry& entry);
#endif // PKLAENTRY_H

View file

@ -1,111 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "identitywidget.h"
#include "ui_identitywidget.h"
#include <KUser>
#include <KDebug>
IdentityWidget::IdentityWidget(IdentityWidget::IdentityType type, const QString& name, QWidget* parent)
: QWidget(parent)
{
init(type);
setIdentityName(name);
}
IdentityWidget::IdentityWidget(QWidget* parent)
: QWidget(parent)
{
init(UserIdentity);
}
IdentityWidget::~IdentityWidget()
{
delete m_ui;
}
void IdentityWidget::init(IdentityType type)
{
m_ui = new Ui::IdentityWidget;
m_ui->setupUi(this);
m_ui->removeButton->setIcon(KIcon("list-remove"));
m_ui->identityTypeBox->setItemIcon(0, KIcon("user-identity"));
m_ui->identityTypeBox->setItemIcon(1, KIcon("system-users"));
m_ui->identityTypeBox->setCurrentIndex((int)type);
populateIdentityNameBox();
connect(m_ui->identityTypeBox, SIGNAL(currentIndexChanged(int)),
this, SIGNAL(changed()));
connect(m_ui->identityTypeBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(populateIdentityNameBox()));
connect(m_ui->identityNameBox, SIGNAL(currentIndexChanged(int)),
this, SIGNAL(changed()));
connect(m_ui->removeButton, SIGNAL(clicked(bool)),
this, SIGNAL(changed()));
connect(m_ui->removeButton, SIGNAL(clicked(bool)),
this, SLOT(deleteLater()));
}
QString IdentityWidget::identityName() const
{
return m_ui->identityNameBox->itemData(m_ui->identityNameBox->currentIndex()).toString();
}
IdentityWidget::IdentityType IdentityWidget::identityType() const
{
return (IdentityType)(m_ui->identityTypeBox->currentIndex());
}
void IdentityWidget::setIdentityName(const QString& name)
{
m_ui->identityNameBox->setCurrentIndex(m_ui->identityNameBox->findData(name));
}
void IdentityWidget::setIdentityType(IdentityWidget::IdentityType type)
{
m_ui->identityTypeBox->setCurrentIndex((int)type);
}
void IdentityWidget::populateIdentityNameBox()
{
m_ui->identityNameBox->clear();
if (m_ui->identityTypeBox->currentIndex() == (int)UserIdentity) {
QList<KUser> users = KUser::allUsers();
foreach (const KUser &user, users) {
QIcon icon;
QString displayName;
QString fullname = user.property(KUser::FullName).toString();
if (!user.faceIconPath().isEmpty()) {
icon.addPixmap(QPixmap(user.faceIconPath()));
} else {
icon = KIcon("user-identity");
}
if (fullname.isEmpty()) {
displayName = user.loginName();
} else {
displayName = QString("%1 (%2)").arg(fullname).arg(user.loginName());
}
m_ui->identityNameBox->addItem(icon, displayName, user.loginName());
}
} else {
QList<KUserGroup> groups = KUserGroup::allGroups();
foreach (const KUserGroup &group, groups) {
m_ui->identityNameBox->addItem(KIcon("system-users"), group.name(), group.name());
}
}
}
#include "moc_identitywidget.cpp"

View file

@ -1,54 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef IDENTITYWIDGET_H
#define IDENTITYWIDGET_H
#include <QtGui/QWidget>
#include <kdemacros.h>
QT_BEGIN_NAMESPACE
namespace Ui {
class IdentityWidget;
}
QT_END_NAMESPACE
class KDE_EXPORT IdentityWidget : public QWidget
{
Q_OBJECT
public:
enum IdentityType {
UserIdentity = 0,
GroupIdentity = 1
};
IdentityWidget(IdentityType type, const QString &name, QWidget* parent = 0);
IdentityWidget(QWidget* parent = 0);
~IdentityWidget();
void setIdentityType(IdentityType type);
void setIdentityName(const QString &name);
IdentityType identityType() const;
QString identityName() const;
Q_SIGNALS:
void changed();
private Q_SLOTS:
void populateIdentityNameBox();
private:
void init(IdentityType type);
Ui::IdentityWidget *m_ui;
};
#endif // IDENTITYWIDGET_H

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IdentityWidget</class>
<widget class="QWidget" name="IdentityWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>426</width>
<height>42</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KComboBox" name="identityTypeBox">
<item>
<property name="text">
<string>User</string>
</property>
</item>
<item>
<property name="text">
<string>Group</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="KComboBox" name="identityNameBox"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>192</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,69 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
# I know, sucks extremely hard, but it's the only way.
set(policy_gen_SRCS
policy-gen/policy-gen.cpp
policy-gen/kauth-policy-gen-polkit1.cpp )
add_executable(polkit-kde-helper-policy-gen ${policy_gen_SRCS})
target_link_libraries(polkit-kde-helper-policy-gen ${QT_QTCORE_LIBRARY})
## Execute it
set(_output ${CMAKE_CURRENT_BINARY_DIR}/org.kde.polkitkde1.policy)
get_filename_component(_input polkitkde1.actions ABSOLUTE)
add_custom_command(OUTPUT ${_output}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/polkit-kde-helper-policy-gen ${_input} > ${_output}
MAIN_DEPENDENCY ${_input}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating org.kde.polkitkde1.policy"
DEPENDS polkit-kde-helper-policy-gen)
add_custom_target(genpolicy ALL DEPENDS ${_output})
# FIXME: hardcoded path
install(
FILES ${_output}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions/
)
#########
set(polkitkde1helper_SRCS
main.cpp
polkitkde1helper.cpp
)
qt4_add_dbus_adaptor(polkitkde1helper_SRCS
org.kde.polkitkde1.helper.xml
polkitkde1helper.h
PolkitKde1Helper
)
add_executable(polkitkde1helper ${polkitkde1helper_SRCS})
target_link_libraries(polkitkde1helper
${KDE4_KDECORE_LIBS}
${QT_QTCORE_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTDBUS_LIBRARY}
${POLKITQT-1_CORE_LIBRARY}
polkitkdekcmodulesprivate
)
install(
TARGETS polkitkde1helper
DESTINATION ${KDE4_LIBEXEC_INSTALL_DIR}
)
dbus_add_activation_system_service(org.kde.polkitkde1.helper.service.in)
install(
FILES org.kde.polkitkde1.helper.conf
DESTINATION ${KDE4_SYSCONF_INSTALL_DIR}/dbus-1/system.d
)

View file

@ -1,4 +0,0 @@
#! /bin/sh
$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/kcm_polkitactions.pot
rm -f rc.cpp

View file

@ -1,19 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "polkitkde1helper.h"
#include <QtCore/QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
PolkitKde1Helper helper;
return app.exec();
}

View file

@ -1,19 +0,0 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- This configuration file specifies the required security policies
for polkit-kde to work. -->
<!-- Only user root can own the polkitkde1.helper service -->
<policy user="root">
<allow own="org.kde.polkitkde1.helper"/>
</policy>
<!-- Allow anyone to call into the service - we'll reject callers using polkit -->
<policy context="default">
<allow send_destination="org.kde.polkitkde1.helper"/>
</policy>
</busconfig>

View file

@ -1,4 +0,0 @@
[D-BUS Service]
Name=org.kde.polkitkde1.helper
Exec=@KDE4_LIBEXEC_INSTALL_DIR@/polkitkde1helper
User=root

View file

@ -1,24 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.polkitkde1.helper">
<method name="saveGlobalConfiguration" >
<arg direction="in" type="s" name="adminIdentities" />
<arg direction="in" type="i" name="systemPriority" />
<arg direction="in" type="i" name="policiesPriority" />
</method>
<method name="retrievePolicies" >
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantList"/>
<arg direction="out" type="av" />
</method>
<method name="writePolicy" >
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QList&lt;PKLAEntry&gt;"/>
<arg direction="in" type="a(sssssssii)" />
</method>
<method name="writeImplicitPolicy" >
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QList&lt;PKLAEntry&gt;"/>
<arg direction="in" type="a(sssssssii)" />
</method>
</interface>
</node>

View file

@ -1,94 +0,0 @@
/*
* Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com>
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .
*/
#include "policy-gen.h"
#include <cstdio>
#include <QDebug>
#include <QTextStream>
const char header[] = ""
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!DOCTYPE policyconfig PUBLIC\n"
"\"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN\"\n"
"\"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd\">\n"
"<policyconfig>\n";
const char policy_tag[] = ""
" <defaults>\n"
" <allow_inactive>no</allow_inactive>\n"
" <allow_active>%1</allow_active>\n"
" </defaults>\n";
const char dent[] = " ";
void output(QList<Action> actions, QHash<QString, QString> domain)
{
QTextStream out(stdout);
out.setCodec("UTF-8");
out << header;
if (domain.contains("vendor")) {
out << "<vendor>" << domain["vendor"] << "</vendor>\n";
}
if (domain.contains("vendorurl")) {
out << "<vendor_url>" << domain["vendorurl"] << "</vendor_url>\n";
}
if (domain.contains("icon")) {
out << "<icon_name>" << domain["icon"] << "</icon_name>\n";
}
foreach (const Action &action, actions) {
out << dent << "<action id=\"" << action.name << "\" >\n";
QHash<QString, QString>::const_iterator descriptionIter = action.descriptions.constBegin();
while (descriptionIter != action.descriptions.constEnd()) {
QString lang = descriptionIter.key();
out << dent << dent << "<description";
if (lang != "en")
out << " xml:lang=\"" << lang << '"';
out << '>' << action.messages.value(lang) << "</description>\n";
++descriptionIter;
}
QHash<QString, QString>::const_iterator messageIter = action.messages.constBegin();
while (messageIter != action.messages.constEnd()) {
QString lang = messageIter.key();
out << dent << dent << "<message";
if (lang != "en") {
out << " xml:lang=\"" << lang << '"';
}
out << '>' << action.descriptions.value(lang) << "</message>\n";
++messageIter;
}
QString policy = action.policy;
if (!action.persistence.isEmpty() && policy != "yes" && policy != "no") {
policy += "_keep";
}
out << QString(policy_tag).arg(policy);
out << dent << "</action>\n";
}
out << "</policyconfig>\n";
}

View file

@ -1,171 +0,0 @@
/*
* Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com>
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .
*/
#include "policy-gen.h"
#include <QCoreApplication>
#include <QSettings>
#include <QTextCodec>
#include <QRegExp>
#include <QStringList>
#include <QDebug>
using namespace std;
QList<Action> parse(QSettings &ini);
QHash<QString, QString> parseDomain(QSettings &ini);
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
if (argc < 2) {
qCritical("Too few arguments");
return 1;
}
QSettings ini(argv[1], QSettings::IniFormat);
#ifndef QT_KATIE // Katie uses C-strings codec which is UTF-8
ini.setIniCodec("UTF-8");
#else
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#endif
if (ini.status()) {
qCritical("Error loading file: %s", argv[1]);
return 1;
}
output(parse(ini), parseDomain(ini));
}
QList<Action> parse(QSettings &ini)
{
QList<Action> actions;
QRegExp actionExp("[0-9a-z]+(\\.[0-9a-z]+)*");
QRegExp descriptionExp("description(?:\\[(\\w+)\\])?");
QRegExp nameExp("name(?:\\[(\\w+)\\])?");
QRegExp policyExp("yes|no|auth_self|auth_admin");
descriptionExp.setCaseSensitivity(Qt::CaseInsensitive);
nameExp.setCaseSensitivity(Qt::CaseInsensitive);
#ifndef QT_KATIE
foreach(const QString &name, ini.childGroups()) {
#else
QStringList seennames;
foreach(QString name, ini.keys()) {
if (name.contains("/")) {
name = name.split("/").first();
}
if (seennames.contains(name)) {
continue;
}
seennames.append(name);
#endif
Action action;
if (name == "Domain") {
continue;
}
if (!actionExp.exactMatch(name)) {
qCritical("Wrong action syntax: %s\n", name.toAscii().data());
exit(1);
}
action.name = name;
ini.beginGroup(name);
#ifndef QT_KATIE
foreach(const QString &key, ini.childKeys()) {
#else
foreach(const QString &key, ini.groupKeys()) {
#endif
if (descriptionExp.exactMatch(key)) {
QString lang = descriptionExp.capturedTexts().at(1);
if (lang.isEmpty())
lang = "en";
action.descriptions.insert(lang, ini.value(key).toString());
} else if (nameExp.exactMatch(key)) {
QString lang = nameExp.capturedTexts().at(1);
if (lang.isEmpty())
lang = "en";
action.messages.insert(lang, ini.value(key).toString());
} else if (key.toLower() == "policy") {
QString policy = ini.value(key).toString();
if (!policyExp.exactMatch(policy)) {
qCritical("Wrong policy: %s", policy.toAscii().data());
exit(1);
}
action.policy = policy;
} else if (key.toLower() == "persistence") {
QString persistence = ini.value(key).toString();
if (persistence != "session" && persistence != "always") {
qCritical("Wrong persistence: %s", persistence.toAscii().data());
exit(1);
}
action.persistence = persistence;
}
}
if (action.policy.isEmpty() || action.messages.isEmpty() || action.descriptions.isEmpty()) {
qCritical("Missing option in action: %s", name.toAscii().data());
exit(1);
}
ini.endGroup();
actions.append(action);
}
return actions;
}
QHash<QString, QString> parseDomain(QSettings& ini)
{
QHash<QString, QString> rethash;
#ifndef QT_KATIE
if (ini.childGroups().contains("Domain")) {
#endif
if (ini.contains("Domain/Name")) {
rethash["vendor"] = ini.value("Domain/Name").toString();
}
if (ini.contains("Domain/URL")) {
rethash["vendorurl"] = ini.value("Domain/URL").toString();
}
if (ini.contains("Domain/Icon")) {
rethash["icon"] = ini.value("Domain/Icon").toString();
}
#ifndef QT_KATIE
}
#endif
return rethash;
}

View file

@ -1,41 +0,0 @@
/*
* Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com>
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .
*/
#ifndef POLICY_GEN_H
#define POLICY_GEN_H
#include <QtCore/QString>
#include <QtCore/QMap>
#include <QtCore/QHash>
struct Action {
QString name;
QHash<QString, QString> descriptions;
QHash<QString, QString> messages;
QString policy;
QString persistence;
};
extern void output(QList<Action> actions, QHash<QString, QString> domain);
#endif

View file

@ -1,429 +0,0 @@
[Domain]
Name=System policy settings
Name[ar]=إعدادات سياسة النظام
Name[bs]=Postavke sistemskih pravila
Name[ca]=Arranjament de la política del sistema
Name[ca@valencia]=Arranjament de la política del sistema
Name[cs]=Nastavení pravidel systému
Name[da]=Indstillinger for systempolitik
Name[de]=Systemberechtigungseinstellungen
Name[el]=Ρυθμίσεις πολιτικής συστήματος
Name[en_GB]=System policy settings
Name[es]=Preferencias de políticas del sistema
Name[et]=Süsteemi reeglite seadistused
Name[fi]=Järjestelmäkäytännön asetukset
Name[fr]=Paramètres de stratégie système
Name[ga]=Polasaithe an chórais
Name[gl]=Configuración da política do sistema
Name[hr]=Postavke pravila sustava
Name[hu]=Rendszerházirend beállításai
Name[it]=Impostazioni delle politiche di sistema
Name[kk]=Жүйелік саясат параметрлері
Name[km]=ការ​កំណត់​គោល​នយោបាយ​ប្រព័ន្ធ​​
Name[ko]=시스템 정책 설정
Name[lt]=Sistemos taisyklių nustatymai
Name[lv]=Sistēmas politikas iestatījumi
Name[mr]=प्रणाली धोरण संयोजना
Name[nb]=Praksisinnstillinger for systemet
Name[nds]=Systeemregeln instellen
Name[nl]=Instellingen voor systeembeleid
Name[pa]=ਸਿਸਟਮ ਪਾਲਸੀ ਸੈਟਿੰਗ
Name[pl]=Ustawienia polityki systemu
Name[pt]=Configuração da política do sistema
Name[pt_BR]=Configurações das políticas do sistema
Name[ro]=Configurări politică de sistem
Name[ru]=Настройка политики безопасности системы
Name[sk]=Nastavenie systémových politík
Name[sl]=Nastavitve sistemskih pravilnikov
Name[sr]=Поставке системских смерница
Name[sr@ijekavian]=Поставке системских смјерница
Name[sr@ijekavianlatin]=Postavke sistemskih smjernica
Name[sr@latin]=Postavke sistemskih smernica
Name[sv]=Inställningar av systempolicy
Name[th]=ตั้งค่านโยบายของระบบ
Name[tr]=Sistem politikası ayarları
Name[ug]=سىستېما سىياسىتى‏ تەڭشەكلىرى
Name[uk]=Параметри системних правил доступу
Name[vi]=Thiết lập chính sách hệ thống
Name[x-test]=xxSystem policy settingsxx
Name[zh_CN]=系统策略设置
Name[zh_TW]=系統政策設定
Icon=security-high
[org.kde.polkitkde1.readauthorizations]
Name=Read system authorizations
Name[ar]=قراءة أذون النظام
Name[bs]=Čitaj sistemske autorizacije
Name[ca]=Llegeix les autoritzacions del sistema
Name[ca@valencia]=Llig les autoritzacions del sistema
Name[cs]=Načíst systémová oprávnění
Name[da]=Læs systemgodkendelser
Name[de]=Systemberechtigungen einlesen
Name[el]=Ανάγνωση εξουσιοδοτήσεων συστήματος
Name[en_GB]=Read system authorisations
Name[es]=Leer autorizaciones del sistema
Name[et]=Süsteemi autentimiste lugemine
Name[fi]=Lue järjestelmän käyttövaltuudet
Name[fr]=Lecture des autorisations système
Name[gl]=Ler as autorizacións do sistema
Name[hr]=Čitanje autorizacije u sustavu
Name[hu]=Rendszerhitelesítések olvasása
Name[it]=Leggi autorizzazioni di sistema
Name[kk]=Жүйелік авторизацияларын оқу
Name[km]=អាន​សេចក្ដី​អនុញ្ញាត​ប្រព័ន្ធ​
Name[ko]=시스템 인증 읽기
Name[lt]=Skaityti sistemos įgaliojimus
Name[lv]=Nolasīt sistēmas pilnvaras
Name[nb]=Les systemets autoriseringer
Name[nds]=Systeemverlööfnissen lesen
Name[nl]=Systeemautorisaties lezen
Name[pa]=ਸਿਸਟਮ ਪਰਮਾਣਕਿਤਾ ਪੜ੍ਹੋ
Name[pl]=Odczytaj uwierzytelnienia systemowe
Name[pt]=Ler as autorizações do sistema
Name[pt_BR]=Ler as autorizações do sistema
Name[ro]=Citește autorizările de sistem
Name[ru]=Чтение системных разрешений
Name[sk]=Čítať systémové autorizácie
Name[sl]=Branje sistemskih pooblastil
Name[sr]=Читај системска овлашћења
Name[sr@ijekavian]=Читај системска овлашћења
Name[sr@ijekavianlatin]=Čitaj sistemska ovlašćenja
Name[sr@latin]=Čitaj sistemska ovlašćenja
Name[sv]=Läs systembehörigheter
Name[th]=อ่านการอนุญาตสิทธิ์ต่าง ๆ ของระบบ
Name[tr]=Sistem yetkilendirmelerini oku
Name[uk]=Читання системних уповноважень
Name[vi]=Đọc cấp phép hệ thống
Name[x-test]=xxRead system authorizationsxx
Name[zh_CN]=读取系统验证配置
Name[zh_TW]=讀取系統授權
Description=Authorization is required to read system authorizations
Description[ar]=يتطلب أذن لقراءة أذون النظام
Description[bs]=Zahtijeva se autorizacija za čitanje sistemske autorizacije
Description[ca]=Es requereix autorització per llegir les autoritzacions del sistema
Description[ca@valencia]=Es requereix autorització per llegir les autoritzacions del sistema
Description[cs]=Pro čtení systémových oprávnění je třeba patřičná oprávnění
Description[da]=Godkendelse kræves for at læse systemgodkendelser
Description[de]=Berechtigung ist für das Einlesen von Systemberechtigungen erforderlich
Description[el]=Απαιτείται εξουσιοδότηση για την ανάγνωση των εξουσιοδοτήσεων του συστήματος
Description[en_GB]=Authorisation is required to read system authorisations
Description[es]=Es necesaria una autorización para leer las autorizaciones del sistema
Description[et]=Süsteemi autentimiste lugemiseks on vajalik autentimine
Description[fi]=Järjestelmän käyttövaltuuksien lukemiseksi tarvitsee tarkistaa käyttöoikeudet
Description[fr]=Une autorisation est nécessaire pour lire les autorisations système
Description[gl]=Requírese autorización para ler as autoricacións do sistema.
Description[hr]=Potrebno je autorizirati se kako bi se pročitale autorizacije u sustavu
Description[hu]=A rendszerhitelesítések olvasásához hitelesítés szükséges
Description[it]=È richiesta l'autorizzazione per leggere le autorizzazioni di sistema
Description[kk]=Жүйелік авторизацияларын оқу үшін авторизациядан өту керек
Description[km]=សេចក្ដី​អនុញ្ញាត​ត្រូវ​បាន​ទាមទារ​ ដើម្បី​អាន​សេចក្ដីអនុញ្ញាត​ប្រព័ន្ធ​
Description[ko]=시스템 인증을 읽으려면 인증이 필요함
Description[lt]=Leidimas reikalingas, kad nuskaityti sistemos įgaliojimus
Description[lv]=Lai nolasītu sistēmas pilnvaras, ir nepieciešama autorizācija
Description[nb]=Autorisering kreves for å lese systemautoriseringer
Description[nds]=För't Lesen vun Systeemverlööfnissen deit Verlööf noot.
Description[nl]=Autorisatie is vereist om systeemautorisaties te lezen
Description[pa]=ਸਿਸਟਮ ਪਰਮਾਣਕਿਤਾ ਪੜ੍ਹਨ ਲਈ ਪਰਮਾਣਿਤ ਹੋਣ ਦੀ ਲੋੜ ਹੈ
Description[pl]=Uwierzytelnienie jest wymagane do odczytu uwierzytelnień systemowych
Description[pt]=É necessária a autorização para ler as autorizações do sistema
Description[pt_BR]=É necessário autorização para ler as políticas do sistema
Description[ro]=Pentru a citi autorizările sistemului este nevoie de autorizare
Description[ru]=Для чтения системных разрешений требуется авторизация
Description[sk]=Na čítanie systémových overení je potrebné overenie
Description[sl]=Za branje sistemskih pooblastil je zahtevana pooblastitev
Description[sr]=Потребно је овлашћење за читање системских овлашћења
Description[sr@ijekavian]=Потребно је овлашћење за читање системских овлашћења
Description[sr@ijekavianlatin]=Potrebno je ovlašćenje za čitanje sistemskih ovlašćenja
Description[sr@latin]=Potrebno je ovlašćenje za čitanje sistemskih ovlašćenja
Description[sv]=Behörighet krävs för att läsa systembehörigheter
Description[th]=การอนุญาตสิทธิ์จำเป็นต้องทำการอ่านค่าการอนุญาตสิทธิ์ต่าง ๆ ของระบบ
Description[tr]=Sistem yetkilendirmelerini okumak için yetkilendirme gerekiyor
Description[uk]=Для читання системних уповноважень потрібно пройти уповноваження
Description[vi]=Cần được cấp phép để đọc các cấp phép hệ thống
Description[x-test]=xxAuthorization is required to read system authorizationsxx
Description[zh_CN]=需要进行验证才能读取系统验证配置
Description[zh_TW]=您需要授權才能讀取系統授權
Policy=auth_admin
Persistence=session
[org.kde.polkitkde1.changeimplicitauthorizations]
Name=Change implicit authorizations for an action
Name[ar]=تغيير الأذون الضمنية لإجراء
Name[bs]=Promijeni implicitne autorizacije za radnju
Name[ca]=Canvia les autoritzacions implícites per una acció
Name[ca@valencia]=Canvia les autoritzacions implícites per una acció
Name[cs]=Změnit implicitní oprávnění pro činnost
Name[da]=Ændr implicitte godkendelser for en handling
Name[de]=Implizite Berechtigungen für eine Aktion ändern
Name[el]=Αλλαγή έμμεσων εξουσιοδοτήσεων για μία ενέργεια
Name[en_GB]=Change implicit authorisations for an action
Name[es]=Cambiar autorizaciones implícitas para una acción
Name[et]=Toimingu kaudsete autentimiste muutmine
Name[fi]=Muuta toiminnon implisiittisiä käyttövaltuuksia
Name[fr]=Modification des autorisations système pour une action
Name[gl]=Modificar as autorizacións implícitas para unha acción
Name[hr]=Promjena implicitnih autorizacija za radnju
Name[hu]=Implicit hitelesítések megváltoztatása egy művelethez
Name[it]=Modifica l'autorizzazione implicita di un'azione
Name[kk]=Әрекет үшін жанама авторизацияларын өзгерту
Name[km]=ប្ដូរ​សេចក្ដី​អនុញ្ញាត​ទាំង​ស្រុង​ សម្រាប់​សកម្មភាព​
Name[ko]=동작에 대한 암시적 인증 설정
Name[lt]=Keisti veiksmo numanomus įgaliojimus
Name[lv]=Mainīt darbības pastarpinātās pilnvaras
Name[nb]=Endre implisitte autoriseringer for en handling
Name[nds]=Inslaten Verlööfnissen för en Akschoon ännern
Name[nl]=Impliciete autorisaties voor een actie wijzigen
Name[pl]=Zmień bezwarunkowe uwierzytelnienia dla działania
Name[pt]=Modificar as autorizações implícitas para uma acção
Name[pt_BR]=Alterar autorizações implícitas para uma ação
Name[ro]=Schimbă autorizările implicite pentru o acțiune
Name[ru]=Изменение неявных разрешений для действия
Name[sk]=Zmeniť implicitné overenia pre akciu
Name[sl]=Spremeni implicitna pravila za dejanje
Name[sr]=Измени последична овлашћења за радњу
Name[sr@ijekavian]=Измени последична овлашћења за радњу
Name[sr@ijekavianlatin]=Izmeni posledična ovlašćenja za radnju
Name[sr@latin]=Izmeni posledična ovlašćenja za radnju
Name[sv]=Ändra implicit behörighet för en åtgärd
Name[th]=เปลี่ยนการอนุญาตสิทธิ์ต่าง ๆ ที่จะคงอยู่ของการกระทำ
Name[tr]=Bir eylem için gizli yetkilendirmeleri değiştir
Name[uk]=Змінити неявні уповноваження на дію
Name[vi]=Thay đổi cấp phép ngầm định cho một hành động
Name[x-test]=xxChange implicit authorizations for an actionxx
Name[zh_CN]=修改动作的隐式验证
Name[zh_TW]=變更動作的內部授權
Description=Authorization is required to change implicit authorizations
Description[ar]=يتطلب إذناً لتغير الأذون الضمنية
Description[bs]=Zahtijeva se autorizacija za promjene implicitne autorizacije
Description[ca]=Es requereix autorització per canviar les autoritzacions implícites
Description[ca@valencia]=Es requereix autorització per canviar les autoritzacions implícites
Description[cs]=Pro změnu implicitních oprávnění je třeba mít patřičná práva
Description[da]=Godkendelse kræves for at ændre implicitte godkendelser
Description[de]=Berechtigung ist für das Ändern von impliziten Berechtigungen erforderlich
Description[el]=Απαιτείται εξουσιοδότηση για την αλλαγή των έμμεσων εξουσιοδοτήσεων
Description[en_GB]=Authorisation is required to change implicit authorisations
Description[es]=Es necesaria una autorización para modificar las autorizaciones implícitas
Description[et]=Kaudsete autentimiste muutmiseks on vajalik autentimine
Description[fi]=Implisiittisten käyttövaltuuksien muuttamiseksi tarvitsee tarkistaa käyttöoikeudet
Description[fr]=Une autorisation est nécessaire pour modifier les autorisations implicites système
Description[gl]=Requírese autorización para modificar as autorizacións implícitas.
Description[hr]=Potrebna je autorizacija za promjenu implicitnih autorizacija
Description[hu]=Az implicit hitelesítések megváltoztatásához hitelesítés szükséges
Description[it]=È richiesta l'autorizzazione per modificare le autorizzazioni implicite
Description[kk]=Жанама авторизацияларын өзгерту үшін авторизациядан өту керек
Description[km]=សេចក្ដី​អនុញ្ញាត​ត្រូវ​បាន​ទាមទារ​ ដើម្បី​ប្ដូរ​សេចក្ដីអនុញ្ញាត​​ទាំងស្រុង​
Description[ko]=암시적 인증을 변경하려면 인증이 필요함
Description[lt]=Leidimas reikalingas, kad pakeisti numanomus įgaliojimus
Description[lv]=Lai mainītu pastarpinātās pilnvaras, ir nepieciešama autorizācija
Description[nb]=Autorisering kreves for å endre implisitte autoriseringer
Description[nds]=För't Ännern vun inslaten Verlööfnissen deit Verlööf noot.
Description[nl]=Autorisatie is vereist om impliciete autorisaties te wijzigen
Description[pl]=Uwierzytelnienie jest wymagane do zmiany bezwarunkowych uwierzytelnień
Description[pt]=É necessária a autorização para modificar as autorizações implícitas
Description[pt_BR]=É necessário autorização para alterar as autorizações implícitas
Description[ro]=Pentru a schimba autorizările implicite este nevoie de autorizare
Description[ru]=Для изменения неявных разрешений требуется авторизация
Description[sk]=Na zmenu implicitných overení je potrebné overenie
Description[sl]=Za spremembo implicitnih pravil je zahtevana pooblastitev
Description[sr]=Потребно је овлашћење за измену последичних овлашћења
Description[sr@ijekavian]=Потребно је овлашћење за измену последичних овлашћења
Description[sr@ijekavianlatin]=Potrebno je ovlašćenje za izmenu posledičnih ovlašćenja
Description[sr@latin]=Potrebno je ovlašćenje za izmenu posledičnih ovlašćenja
Description[sv]=Behörighet krävs för att ändra implicita behörigheter
Description[th]=การอนุญาตสิทธิ์จำเป็นต้องทำการแก้ไขค่าการอนุญาตสิทธิ์ต่าง ๆ ที่จะคงอยู่
Description[tr]=Gizli yetkilendirmeleri değiştirmek için yetkilendirme gerekiyor
Description[uk]=Для зміни неявних уповноважень потрібно пройти уповноваження
Description[vi]=Cần được cấp phép để thay đổi các cấp phép ngầm
Description[x-test]=xxAuthorization is required to change implicit authorizationsxx
Description[zh_CN]=需要验证才能修改隐式验证
Description[zh_TW]=您需要授權才能變更動作的內部授權
Policy=auth_admin
[org.kde.polkitkde1.changeexplicitauthorizations]
Name=Change explicit authorizations for an action
Name[ar]=تغيير الأذون الصريحة لإجراء
Name[bs]=Promijeni eksplicitnu autorizaciju za radnju
Name[ca]=Canvia les autoritzacions explícites per una acció
Name[ca@valencia]=Canvia les autoritzacions explícites per una acció
Name[cs]=Změnit explicitní oprávnění pro činnost
Name[da]=Ændr eksplicitte godkendelser for en handling
Name[de]=Explizite Berechtigungen für eine Aktion ändern
Name[el]=Αλλαγή άμεσων εξουσιοδοτήσεων για μία ενέργεια
Name[en_GB]=Change explicit authorisations for an action
Name[es]=Cambiar autorizaciones explícitas para una acción
Name[et]=Toimingu otseste autentimiste muutmine
Name[fi]=Muuta toiminnon eksplisiittisiä käyttövaltuuksia
Name[fr]=Modification des autorisations explicites pour une action
Name[gl]=Modificar as autorizacións explícitas para unha acción
Name[hr]=Promjena eksplicitnih autorizacija za radnju
Name[hu]=Explicit hitelesítések megváltoztatása egy művelethez
Name[it]=Modifica le autorizzazioni esplicite di un'azione
Name[kk]=Әрекет үшін айқын авторизацияларын өзгерту
Name[km]=ប្ដូរ​សេចក្ដី​អនុញ្ញាត​មិន​មិន​ទាំង​ស្រុង​​​ សម្រាប់​សកម្មភាព​
Name[ko]=동작에 대한 명시적 인증 설정
Name[lt]=Keisti veiksmo aiškius įgaliojimus
Name[lv]=Mainīt darbības tiešās pilnvaras
Name[nb]=Endre uttrykkelige autoriseringer for en handling
Name[nds]=Utspraken Verlööfnissen för en Akschoon ännern
Name[nl]=Expliciete autorisaties voor een actie wijzigen
Name[pl]=Zmień warunkowe uwierzytelnienia dla działania
Name[pt]=Modificar as autorizações explícitas para uma acção
Name[pt_BR]=Alterar autorizações explícitas para uma ação
Name[ro]=Schimbă autorizările explicite pentru o acțiune
Name[ru]=Изменение явных разрешений для действия
Name[sk]=Zmeniť explicitné overenia pre akciu
Name[sl]=Spremeni eksplicitna pravila za dejanje
Name[sr]=Измени изричита овлашћења за радњу
Name[sr@ijekavian]=Измени изричита овлашћења за радњу
Name[sr@ijekavianlatin]=Izmeni izričita ovlašćenja za radnju
Name[sr@latin]=Izmeni izričita ovlašćenja za radnju
Name[sv]=Ändra explicit behörighet för en åtgärd
Name[th]=แก้ไขการอนุญาตสิทธิ์ต่าง ๆ ที่ชัดเจนของการกระทำ
Name[tr]=Bir eylem için açık yetkilendirmeleri değiştir
Name[uk]=Змінити явні уповноваження на дію
Name[vi]=Thay đổi cấp phép chi tiết cho một hành động
Name[x-test]=xxChange explicit authorizations for an actionxx
Name[zh_CN]=修改动作的显示验证
Name[zh_TW]=變更動作的外部授權
Description=Authorization is required to change explicit authorizations
Description[ar]=يتطلب إذن لتغيير الأذون الصريحة
Description[bs]=Zahtijeva se autorizacija za promjene eksplicitne autorizacije
Description[ca]=Es requereix autorització per canviar les autoritzacions explícites
Description[ca@valencia]=Es requereix autorització per canviar les autoritzacions explícites
Description[cs]=Pro změnu explicitních oprávnění je třeba mít patřičná práva
Description[da]=Godkendelse kræves for at ændre eksplicitte godkendelser
Description[de]=Berechtigung ist für das Ändern von expliziten Berechtigungen erforderlich
Description[el]=Απαιτείται εξουσιοδότηση για την αλλαγή των άμεσων εξουσιοδοτήσεων
Description[en_GB]=Authorisation is required to change explicit authorisations
Description[es]=Es necesaria una autorización para modificar las autorizaciones explícitas
Description[et]=Otseste autentimiste muutmiseks on vajalik autentimine
Description[fi]=Eksplisiittisten käyttövaltuuksien muuttamiseksi tarvitsee tarkistaa käyttöoikeudet
Description[fr]=Une autorisation est nécessaire pour modifier les autorisations explicites
Description[gl]=Requírese autorización para modificar as autorizacións explícitas.
Description[hr]=Potrebna je autorizacija za promjenu eksplicitnih autorizacija
Description[hu]=Az explicit hitelesítések megváltoztatásához hitelesítés szükséges
Description[it]=È richiesta l'autorizzazione per modificare le autorizzazioni esplicite
Description[kk]=Айқын авторизацияларын өзгерту үшін авторизациядан өту керек
Description[km]=សេចក្ដី​អនុញ្ញាត​ត្រូវ​បាន​ទាមទារ​ ដើម្បី​ប្ដូរ​សេចក្ដី​អនុញ្ញាត​មិន​ទាំងស្រុង​
Description[ko]=명시적 인증을 변경하려면 인증이 필요함
Description[lt]=Leidimas reikalingas, kad pakeisti aiškius įgaliojimus
Description[lv]=Lai mainītu tiešās pilnvaras, ir nepieciešama autorizācija
Description[nb]=Autorisering kreves for å endre uttrykkelige autoriseringer
Description[nds]=För't Ännern vun utspraken Verlööfnissen deit Verlööf noot.
Description[nl]=Autorisatie is vereist om expliciete autorisaties te wijzigen
Description[pl]=Uwierzytelnienie jest wymagane do zmiany warunkowych uwierzytelnień
Description[pt]=É necessária a autorização para modificar as autorizações explícitas
Description[pt_BR]=É necessário autorização para alterar as autorizações explícitas
Description[ro]=Pentru a schimba autorizările explicite este nevoie de autorizare
Description[ru]=Для изменения явных разрешений требуется авторизация
Description[sk]=Na zmenu explicitných overení je potrebné overenie
Description[sl]=Za spremembo eksplicitnih pravil je zahtevana pooblastitev
Description[sr]=Потребно је овлашћење за измену изричитих овлашћења
Description[sr@ijekavian]=Потребно је овлашћење за измјену изричитих овлашћења
Description[sr@ijekavianlatin]=Potrebno je ovlašćenje za izmjenu izričitih ovlašćenja
Description[sr@latin]=Potrebno je ovlašćenje za izmenu izričitih ovlašćenja
Description[sv]=Behörighet krävs för att ändra explicita behörigheter
Description[th]=การอนุญาตสิทธิ์จำเป็นต้องทำการแก้ไขค่าการอนุญาตสิทธิ์ต่าง ๆ ที่ชัดเจน
Description[tr]=Açık yetkilendirmeleri değiştirmek için yetkilendirme gerekiyor
Description[uk]=Для зміни явних уповноважень потрібно пройти уповноваження
Description[vi]=Cần xác thực để thay đổi các cấp phép chi tiết
Description[x-test]=xxAuthorization is required to change explicit authorizationsxx
Description[zh_CN]=需要验证才能修改显示验证
Description[zh_TW]=您需要授權才能變更動作的外部授權
Policy=auth_admin
Persistence=session
[org.kde.polkitkde1.changesystemconfiguration]
Name=Change global configuration for system policies
Name[ar]=تغيير الإعدادات العامة لسياسات النظام
Name[bs]=Promijeni globalnu postavku za sistemska pravila
Name[ca]=Canvia la configuració global de les polítiques del sistema
Name[ca@valencia]=Canvia la configuració global de les polítiques del sistema
Name[cs]=Změnit globální nastavení pro pravidla systému
Name[da]=Ændr global konfiguration af systempolitikker
Name[de]=Allgemeine Einstellung für Systemberechtigungen ändern
Name[el]=Αλλαγή καθολικής διαμόρφωσης στις πολιτικές του συστήματος
Name[en_GB]=Change global configuration for system policies
Name[es]=Cambiar la configuración global de las políticas del sistema
Name[et]=Süsteemi reeglite globaalse seadistuse muutmine
Name[fi]=Muuta järjestelmäkäytäntöjen yleisasetuksia
Name[fr]=Modifier la configuration globale des stratégies système
Name[gl]=Modificar a configuración global das normas do sistema
Name[hr]=Promjena globalne konfiguracije za pravila sustava
Name[hu]=Globális beállítások megváltoztatása a rendszerházirendekre
Name[it]=Modifica la configurazione globale delle politiche di sistema
Name[kk]=Жүйелік саясаттар үшін жалпы жүйелік баптауды өзгерту
Name[km]=ប្ដូរ​ការកំណត់​រចនាសម្ព័ន្ធ​សកល​​​ សម្រាប់​គោល​​នយោបាយ​ប្រព័ន្ធ​
Name[ko]=시스템 정책 전역 설정 변경
Name[lt]=Keisti sistemos taisyklių globalius nustatymus
Name[lv]=Mainīt sistēmas politiku globālo konfigurāciju
Name[nb]=Endre globalt oppsett for systempraksis
Name[nds]=Globaal Instellen för Systeemregeln ännern
Name[nl]=Globale configuratie voor systeembeleid wijzigen
Name[pa]=ਸਿਸਟਮ ਪਾਲਸੀ ਲਈ ਗਲੋਬਲ ਸੰਰਚਨਾ ਬਦਲੋ
Name[pl]=Zmień globalną konfigurację dla polityki systemu
Name[pt]=Modificar a configuração global das políticas do sistema
Name[pt_BR]=Alterar a configuração global para as políticas do sistema
Name[ro]=Schimbă configurarea globală pentru politici de sistem
Name[ru]=Изменение общих параметров политики системы
Name[sk]=Zmeniť globálnu konfiguráciu pre systémové politiky
Name[sl]=Spremeni splošno nastavitev za sistemske pravilnike
Name[sr]=Измени глобалну поставу системских смерница
Name[sr@ijekavian]=Измени глобалну поставу системских смјерница
Name[sr@ijekavianlatin]=Izmeni globalnu postavu sistemskih smjernica
Name[sr@latin]=Izmeni globalnu postavu sistemskih smernica
Name[sv]=Ändra global inställning av systempolicy
Name[th]=แก้ไขการปรับแต่งค่าทั่วไปของนโยบายต่าง ๆ ของระบบ
Name[tr]=Sistem politikaları için genel yapılandırmayı değiştir
Name[uk]=Змінити загальні налаштування системних правил доступу
Name[vi]=Thay đổi cấu hình toàn hệ thống chính sách
Name[x-test]=xxChange global configuration for system policiesxx
Name[zh_CN]=修改系统策略的全局配置
Name[zh_TW]=變更系統政策的全域設定
Description=Authorization is required to change global configuration for system policies
Description[ar]=يتطلب أذن لتغيير الإعدادات العامة لسياسات النظام
Description[bs]=Zahtjeva se autorizacija za promjenu globalne postavke za sistemska pravila
Description[ca]=Es requereix autorització per canviar la configuració global de les polítiques del sistema
Description[ca@valencia]=Es requereix autorització per canviar la configuració global de les polítiques del sistema
Description[cs]=Pro změnu globálního nastavení pravidel systému je třeba oprávnění
Description[da]=Godkendelse kræves for at ændre global konfiguration af systempolitikker
Description[de]=Die Berechtigung ist für das Ändern der allgemeinen Einstellungen für Systemberechtigungen erforderlich
Description[el]=Απαιτείται εξουσιοδότηση για την αλλαγή τής καθολικής διαμόρφωσης στις πολιτικές του συστήματος
Description[en_GB]=Authorisation is required to change global configuration for system policies
Description[es]=Es necesaria una autorización para modificar la configuración global de las políticas del sistema
Description[et]=Süsteemi reeglite globaalse seadistuse muutmiseks on vajalik autentimine
Description[fi]=Järjestelmäkäytäntöjen yleisasetusten muuttamiseksi tarvitsee tarkistaa käyttöoikeudet
Description[fr]=Une autorisation est nécessaire pour modifier la configuration globale des stratégies système
Description[gl]=Requírese autorización para modificar a configuración global das normas do sistema.
Description[hr]=Potrebna je autorizacija za promjenu globalne konfiguracije za pravila sustava
Description[hu]=Hitelesítés szükséges a rendszerházirendek globális beállításainak megváltoztatásához
Description[it]=È richiesta l'autorizzazione per modificare le configurazione globale delle politiche di sistema
Description[kk]=Жүйелік саясаттар жалпы жүйелік баптауын өзгерту үшін авторизация керек
Description[km]=សេចក្ដី​អនុញ្ញាត​ត្រូវ​បាន​ទាមទារ​ ​ដើម្បី​កំណត់​រចនាសម្ព័ន្ធ​សកល​ សម្រាប់​​គោល​នយោបាយ​ប្រព័ន្ធ​
Description[ko]=시스템 정책 전역 설정을 변경하려면 인증이 필요함
Description[lt]=Leidimas reikalingas, kad sistemos taisyklių globaliuosius nustatymus
Description[lv]=Lai mainītu sistēmas politiku globālo konfigurāciju, ir nepieciešama autorizācija
Description[nb]=Autorisering kreves for å endre globalt oppsett for systempraksis
Description[nds]=För't Ännern vun globaal Instellen för Systeemregeln deit Verlööf noot.
Description[nl]=Autorisatie is vereist om de globale configuratie voor systeembeleid te wijzigen
Description[pa]=ਸਿਸਟਮ ਪਾਲਸੀ ਲਈ ਗਲੋਬਲ ਸੰਰਚਨਾ ਬਦਲਣ ਵਾਸਤੇ ਪਰਮਾਣਿਤ ਹੋਣ ਦੀ ਲੋੜ ਹੈ
Description[pl]=Uwierzytelnienie jest wymagane do zmiany globalnej konfiguracji dla polityki systemu
Description[pt]=É necessária a autorização para modificar a configuração global das políticas do sistema
Description[pt_BR]=É necessário autorização para alterar a configuração global para as políticas do sistema
Description[ro]=Pentru a schimba configurarea globală pentru politici de sistem este nevoie de autorizare
Description[ru]=Для изменения общих параметров политики безопасности системы требуется авторизация
Description[sk]=Na zmenu globálneho nastavenia pre systémové politiky je potrebné overenie
Description[sl]=Za spremembo splošnih nastavitev za sistemske pravilnike je zahtevana pooblastitev
Description[sr]=Потребно је овлашћење за измену глобалне поставе системских смерница
Description[sr@ijekavian]=Потребно је овлашћење за измену глобалне поставе системских смјерница
Description[sr@ijekavianlatin]=Potrebno je ovlašćenje za izmenu globalne postave sistemskih smjernica
Description[sr@latin]=Potrebno je ovlašćenje za izmenu globalne postave sistemskih smernica
Description[sv]=Behörighet krävs för att ändra global inställning av systempolicy
Description[th]=การอนุญาตสิทธิ์จำเป็นต้องทำการแก้ไขการปรับแต่งค่าทั่วไปของนโยบายต่าง ๆ ของระบบ
Description[tr]=Sistem politikaları için genel yapılandırmayı değiştirmek için yetkilendirme gerekiyor
Description[uk]=Для зміни загального налаштування системних прав доступу потрібно пройти уповноваження
Description[vi]=Cần cấp phép để thay đổi cấu hình toàn hệ thống chính sách
Description[x-test]=xxAuthorization is required to change global configuration for system policiesxx
Description[zh_CN]=需要验证才能修改系统策略的全局配置
Description[zh_TW]=您需要授權才能變更系統政策的全域設定
Policy=auth_admin

View file

@ -1,411 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "polkitkde1helper.h"
#include "helperadaptor.h"
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QTimer>
#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
#include <QtXml/QDomDocument>
#include <QtDBus/QDBusConnection>
#include <PolkitQt1/Authority>
#include <KLocalizedString>
bool orderByPriorityLessThan(const PKLAEntry &e1, const PKLAEntry &e2)
{
return e1.fileOrder < e2.fileOrder;
}
PolkitKde1Helper::PolkitKde1Helper(QObject* parent)
: QObject(parent)
{
qDBusRegisterMetaType<PKLAEntry>();
qDBusRegisterMetaType<QList<PKLAEntry> >();
(void) new HelperAdaptor(this);
// Register the DBus service
if (!QDBusConnection::systemBus().registerService("org.kde.polkitkde1.helper")) {
qDebug() << QDBusConnection::systemBus().lastError().message();;
QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
return;
}
if (!QDBusConnection::systemBus().registerObject("/Helper", this)) {
qDebug() << "unable to register service interface to dbus";
QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
return;
}
}
PolkitKde1Helper::~PolkitKde1Helper()
{
}
void PolkitKde1Helper::saveGlobalConfiguration(const QString& adminIdentities, int systemPriority, int policiesPriority)
{
qDebug() << "Request to save the global configuration by " << message().service();
PolkitQt1::Authority::Result result;
PolkitQt1::SystemBusNameSubject subject(message().service());
result = PolkitQt1::Authority::instance()->checkAuthorizationSync("org.kde.polkitkde1.changesystemconfiguration",
subject, PolkitQt1::Authority::AllowUserInteraction);
switch (result)
{
case PolkitQt1::Authority::Yes:
qDebug() << "Authorized successfully";
break;
case PolkitQt1::Authority::No:
sendErrorReply(QDBusError::AccessDenied, i18n("Changing global configurations is unauthorized"));
return;
default:
sendErrorReply(QDBusError::AccessDenied, i18n("Unknown reply from QPolkit-1\nError: %1", PolkitQt1::Authority::instance()->errorDetails()));
return;
}
// Ok, let's see what we have to save here.
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
kdesettings.setValue("General/ConfigPriority", systemPriority);
kdesettings.setValue("General/PoliciesPriority", policiesPriority);
QString contents = QString("[Configuration]\nAdminIdentities=%1\n").arg(adminIdentities);
qDebug() << contents << "will be wrote to the local authority file";
QFile wfile(QString("/etc/polkit-1/localauthority.conf.d/%1-polkitkde.conf").arg(systemPriority));
if (!wfile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
sendErrorReply(QDBusError::Failed, i18n("Error opening the global configuration file: %1\nError code: %2.", wfile.fileName(), wfile.error()));
return;
}
if (wfile.write(contents.toUtf8()) < 0) {
sendErrorReply(QDBusError::Failed, i18n("Error occurred while writing settings to file: %1.", wfile.fileName()));
return;
}
if (!wfile.flush()) {
sendErrorReply(QDBusError::Failed, i18n("Error occurred while flushing settings to file: %1.", wfile.fileName()));
return;
}
wfile.close();
// TODO: Move files around if the priority was changed
}
QVariantList PolkitKde1Helper::retrievePolicies()
{
qDebug() << "Request to retrieve the action authorizations by " << message().service();
PolkitQt1::Authority::Result result;
PolkitQt1::SystemBusNameSubject subject(message().service());
result = PolkitQt1::Authority::instance()->checkAuthorizationSync("org.kde.polkitkde1.readauthorizations",
subject, PolkitQt1::Authority::AllowUserInteraction);
switch (result)
{
case PolkitQt1::Authority::Yes:
qDebug() << "Authorized successfully";
break;
case PolkitQt1::Authority::No:
sendErrorReply(QDBusError::AccessDenied, i18n("Reading policy settings is unauthorized"));
return QVariantList();
default:
sendErrorReply(QDBusError::AccessDenied, i18n("Unknown reply from QPolkit-1\nError: %1",PolkitQt1::Authority::instance()->errorDetails()));
return QVariantList();
}
return reloadFileList();
}
QVariantList PolkitKde1Helper::entriesFromFile(int filePriority, const QString& filePath)
{
QList< QVariant > retlist;
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Failed to open " << filePath;
sendErrorReply(QDBusError::Failed, i18n("Error opening the file: %1\nError code: %2.", file.fileName(), file.error()));
return QVariantList();
}
int priority = 0;
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
if (line.startsWith('[')) {
// Ok, that's a key entry
PKLAEntry entry;
entry.filePath = filePath;
entry.title = line.split('[').last().split(']').first();
entry.filePriority = filePriority;
entry.fileOrder = priority;
// Now parse over all the rest
while (!in.atEnd()) {
QString line = in.readLine();
if (line.startsWith(QLatin1String("Identity="))) {
entry.identity = line.split("Identity=").last();
} else if (line.startsWith(QLatin1String("Action="))) {
entry.action = line.split("Action=").last();
} else if (line.startsWith(QLatin1String("ResultAny="))) {
entry.resultAny = line.split("ResultAny=").last();
} else if (line.startsWith(QLatin1String("ResultInactive="))) {
entry.resultInactive = line.split("ResultInactive=").last();
} else if (line.startsWith(QLatin1String("ResultActive="))) {
entry.resultActive = line.split("ResultActive=").last();
} else if (line.startsWith('[')) {
// Ouch!!
qWarning() << "The file appears malformed!! " << filePath;
return QVariantList();
}
// Did we parse it all?
if (!entry.identity.isEmpty() && !entry.action.isEmpty() && !entry.resultActive.isEmpty() &&
!entry.resultAny.isEmpty() && !entry.resultInactive.isEmpty() && !entry.filePath.isEmpty()) {
// Awesome, add and wave goodbye. And also increase the priority
++priority;
qDebug() << "PKLA Parsed:" << entry.title << entry.action << entry.identity << entry.resultAny
<< entry.resultInactive << entry.resultActive << entry.fileOrder;
retlist.append(QVariant::fromValue(entry));
break;
}
}
}
}
return retlist;
}
void PolkitKde1Helper::writeImplicitPolicy(const QList<PKLAEntry>& policy)
{
QList<PKLAEntry> entries = policy;
if (entries.empty()) {
return;
}
PolkitQt1::Authority::Result result;
PolkitQt1::SystemBusNameSubject subject(message().service());
result = PolkitQt1::Authority::instance()->checkAuthorizationSync("org.kde.polkitkde1.changeimplicitauthorizations",
subject, PolkitQt1::Authority::AllowUserInteraction);
switch (result)
{
case PolkitQt1::Authority::Yes:
qDebug() << "Authorized successfully";
break;
case PolkitQt1::Authority::No:
sendErrorReply(QDBusError::AccessDenied, i18n("Saving implicit policy settings is unauthorized"));
return;
default:
sendErrorReply(QDBusError::AccessDenied, i18n("Unknown reply from QPolkit-1\nError: %1", PolkitQt1::Authority::instance()->errorDetails()));
return;
}
foreach(const PKLAEntry &entry, entries) {
QDomDocument doc = QDomDocument("policy");
QStringList actionNameSplitted = entry.action.split('.');
QString newName;
QFile *pfile = new QFile("/usr/share/polkit-1/actions/org.freedesktop.kit.policy");
// Search for a valid file
foreach(const QString &nameSplitted , actionNameSplitted) {
newName.append(nameSplitted);
pfile = new QFile("/usr/share/polkit-1/actions/" + newName + ".policy");
if (!pfile->open(QIODevice::ReadOnly)) {
newName.append(".");
delete pfile;
pfile = NULL;
continue;
}
if (!pfile->exists()) {
newName.append(".");
pfile->close();
delete pfile;
pfile = NULL;
continue;
}
// We should now have found a valid file.
break;
}
// Check if the file is valid
if (pfile == NULL) {
sendErrorReply(QDBusError::Failed, i18n("Did not find a valid policy file for the implicit action: %1.", entry.action));
return;
}
// Create XML doc.
QString domDocumentError;
if (!doc.setContent(pfile, &domDocumentError)) {
pfile->close();
sendErrorReply(QDBusError::Failed, i18n("Error occurred while parsing file: %1\nError message: %2", pfile->fileName(), domDocumentError));
return;
}
pfile->close();
QDomElement el = doc.firstChildElement("policyconfig").firstChildElement("action");
while (!el.isNull() && el.attribute("id", QString()) != entry.action) {
el = el.nextSiblingElement("action");
}
el = el.firstChildElement("defaults");
// Delete all its childrens, :P
QDomNodeList nodelist = el.childNodes();
while (nodelist.length() > 0) {
el.removeChild(nodelist.item(0));
}
// Add new elements
QDomElement inactiveElem = el.appendChild(doc.createElement("allow_inactive")).toElement();
QDomElement activeElem = el.appendChild(doc.createElement("allow_active")).toElement();
QDomElement anyElem = el.appendChild(doc.createElement("allow_any")).toElement();
inactiveElem.appendChild(doc.createTextNode(entry.resultInactive));
activeElem.appendChild(doc.createTextNode(entry.resultActive));
anyElem.appendChild(doc.createTextNode(entry.resultAny));
// Write the settings to the XML
if (!pfile->open(QIODevice::WriteOnly)) {
// Failed to write to the file?
qDebug() << "Failed writing to file: " << pfile->fileName();
sendErrorReply(QDBusError::Failed, i18n("Error opening the file: %1\nError code: %2.", pfile->fileName(), pfile->error()));
return;
}
QTextStream stream(pfile);
doc.save(stream, 2);
pfile->close();
delete pfile;
}
}
void PolkitKde1Helper::writePolicy(const QList<PKLAEntry>& policy)
{
QList<PKLAEntry> entries = policy;
PolkitQt1::Authority::Result result;
PolkitQt1::SystemBusNameSubject subject(message().service());
result = PolkitQt1::Authority::instance()->checkAuthorizationSync("org.kde.polkitkde1.changeexplicitauthorizations",
subject, PolkitQt1::Authority::AllowUserInteraction);
switch (result)
{
case PolkitQt1::Authority::Yes:
qDebug() << "Authorized successfully";
break;
case PolkitQt1::Authority::No:
sendErrorReply(QDBusError::AccessDenied, "Saving explicit policy settings is unauthorized");
return;
default:
sendErrorReply(QDBusError::AccessDenied, i18n("Unknown reply from QPolkit-1\nError: %1", PolkitQt1::Authority::instance()->errorDetails()));
return;
}
// First delete all the old files, we do not need them anymore
foreach(const QFileInfo &nestedInfo, oldNestedList) {
QFile::remove(nestedInfo.absoluteFilePath());
}
qSort(entries.begin(), entries.end(), orderByPriorityLessThan);
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
QString pathName = QString("/var/lib/polkit-1/localauthority/%1-polkitkde.d/")
.arg(kdesettings.value("General/PoliciesPriority",75).toInt());
foreach(const PKLAEntry &entry, entries) {
QString fullPath;
// First check if it already has a filePath,
// else generate fullPath from the policy action name
if (!entry.filePath.isEmpty()) {
fullPath = entry.filePath;
} else {
QStringList dotSplittedFileName = entry.action.split('.');
// Skip the action name
dotSplittedFileName.removeLast();
dotSplittedFileName << "pkla";
// Check if the polkitkde.d dir exists. If not, create it.
QDir path(pathName);
if (!path.exists()) {
if (!path.mkpath(path.absolutePath())) {
sendErrorReply(QDBusError::Failed, i18n("Error creating the directory: %1.", path.absolutePath()));
return;
}
}
fullPath = pathName + dotSplittedFileName.join(".");
}
QString contents;
contents.append(formatPKLAEntry(entry));
contents.append('\n');
QFile wfile(fullPath);
if (!wfile.open(QIODevice::Append | QIODevice::Truncate | QIODevice::Text)) {
sendErrorReply(QDBusError::Failed, i18n("Error opening the explicit setting file: %1\nError code: %2.", wfile.fileName(), wfile.error()));
return;
}
if (wfile.write(contents.toUtf8()) < 0) {
sendErrorReply(QDBusError::Failed, i18n("Error occurred while writing explicit settings to file: %1.", wfile.fileName()));
return;
}
if (!wfile.flush()) {
sendErrorReply(QDBusError::Failed, i18n("Error occurred while flushing explicit settings to file: %1.", wfile.fileName()));
return;
}
}
// Reload fileList;
reloadFileList();
}
QString PolkitKde1Helper::formatPKLAEntry(const PKLAEntry& entry)
{
QString retstring;
retstring.append(QString("[%1]\n").arg(entry.title));
retstring.append(QString("Identity=%1\n").arg(entry.identity));
retstring.append(QString("Action=%1\n").arg(entry.action));
retstring.append(QString("ResultAny=%1\n").arg(entry.resultAny));
retstring.append(QString("ResultInactive=%1\n").arg(entry.resultInactive));
retstring.append(QString("ResultActive=%1\n").arg(entry.resultActive));
return retstring;
}
QVariantList PolkitKde1Helper::reloadFileList()
{
QVariantList retlist;
oldNestedList.clear();
// Iterate over the directory and find out everything
QDir baseDir("/var/lib/polkit-1/localauthority/");
QFileInfoList baseList = baseDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QFileInfo &info, baseList) {
int filePriority = info.baseName().split('-').first().toInt();
qDebug() << "Iterating over the directory " << info.absoluteFilePath() << ", which has a priority of " << filePriority;
QDir nestedDir(info.absoluteFilePath());
QFileInfoList nestedList = nestedDir.entryInfoList(QDir::Files);
foreach (const QFileInfo &nestedInfo, nestedList) {
qDebug() << "Parsing file " << nestedInfo.absoluteFilePath();
retlist.append(entriesFromFile(filePriority, nestedInfo.absoluteFilePath()));
}
// Save all the fileinfo's, for a later delete if we choose to save
oldNestedList << nestedList;
}
return retlist;
}

View file

@ -1,42 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef POLKITKDE1HELPER_H
#define POLKITKDE1HELPER_H
#include <QtCore/QDir>
#include <QtCore/QObject>
#include <QtDBus/QDBusContext>
#include <QtDBus/qdbusargument.h>
#include "PKLAEntry.h"
class PolkitKde1Helper : public QObject, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.polkitkde1.helper")
public:
PolkitKde1Helper(QObject* parent = 0);
virtual ~PolkitKde1Helper();
public Q_SLOTS:
void saveGlobalConfiguration(const QString &adminIdentities, int systemPriority, int policiesPriority);
QVariantList retrievePolicies();
void writePolicy(const QList<PKLAEntry> &policy);
void writeImplicitPolicy(const QList<PKLAEntry> &policy);
private:
QVariantList entriesFromFile(int filePriority, const QString &fileContents);
QString formatPKLAEntry(const PKLAEntry &entry);
QVariantList reloadFileList();
QFileInfoList oldNestedList;
};
#endif // POLKITKDE1HELPER_H

View file

@ -1,549 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009-2010 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "ActionWidget.h"
#include "ui_actionwidget.h"
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusConnection>
#include <qdbuspendingcall.h>
#include <QtDBus/qdbusmetatype.h>
#include <PolkitQt1/ActionDescription>
#include <KDebug>
#include <KMessageBox>
#include <KLocale>
#include "pkitemdelegate.h"
#include "explicitauthorizationdialog.h"
#include <QSettings>
namespace PolkitKde {
bool orderByPriorityLessThan(const PKLAEntry &e1, const PKLAEntry &e2)
{
return e1.fileOrder < e2.fileOrder;
}
ActionWidget::ActionWidget(QWidget* parent)
: QWidget(parent)
, m_PKLALoaded(false)
, m_ui(new Ui::ActionWidget)
{
m_ui->setupUi(this);
// Icons 'n stuff
m_ui->removeButton->setIcon(KIcon("list-remove"));
m_ui->addLocalButton->setIcon(KIcon("list-add"));
m_ui->moveDownButton->setIcon(KIcon("go-down"));
m_ui->moveUpButton->setIcon(KIcon("go-up"));
m_ui->localAuthListWidget->setItemDelegate(new PKLAItemDelegate);
m_ui->removeButton->setEnabled(false);
m_ui->moveDownButton->setEnabled(false);
m_ui->moveUpButton->setEnabled(false);
connect(m_ui->localAuthListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this, SLOT(editExplicitPKLAEntry(QListWidgetItem*)));
connect(m_ui->localAuthListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(explicitSelectionChanged(QListWidgetItem*,QListWidgetItem*)));
connect(m_ui->addLocalButton, SIGNAL(clicked(bool)),
this, SLOT(addExplicitPKLAEntry()));
connect(m_ui->removeButton, SIGNAL(clicked(bool)),
this, SLOT(removePKLAEntry()));
connect(m_ui->moveDownButton, SIGNAL(clicked(bool)),
this, SLOT(movePKLADown()));
connect(m_ui->moveUpButton, SIGNAL(clicked(bool)),
this, SLOT(movePKLAUp()));
connect(m_ui->anyComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(anyImplicitSettingChanged()));
connect(m_ui->inactiveComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(inactiveImplicitSettingChanged()));
connect(m_ui->activeComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(activeImplicitSettingChanged()));
}
ActionWidget::~ActionWidget()
{
delete m_ui;
}
bool ActionWidget::reloadPKLAs()
{
m_entries.clear();
m_implicit_entries.clear();
m_explicitIsChanged = false;
m_implicitIsChanged = false;
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.polkitkde1.helper",
"/Helper",
"org.kde.polkitkde1.helper",
QLatin1String("retrievePolicies"));
QDBusPendingCall reply = QDBusConnection::systemBus().asyncCall(message);
reply.waitForFinished();
if (reply.isError()) {
const QDBusError dbusError = reply.error();
// from PolkitKde1Helper::retrievePolicies()
const QString requiredAuth("org.kde.polkit1.readauthorizations");
KMessageBox::detailedError(this,
i18n("<qt>Could not retrieve PolicyKit policies.<br>Either the authorization failed, or there is a system configuration problem."),
i18n("<qt>Bus: system<br>Call: %1 %2 %3.%4<br>Error: %5 \"%6\"<br>Action: %7",
message.service(), message.path(), message.interface(), message.member(),
dbusError.name(), dbusError.message(),
requiredAuth));
return (false);
}
const QDBusMessage r = reply.reply();
if (r.arguments().count() >= 1) {
QVariantList vlist;
r.arguments().first().value<QDBusArgument>() >> vlist;
foreach (const QVariant &variant, vlist) {
PKLAEntry entry;
variant.value<QDBusArgument>() >> entry;
qDebug() << entry.title;
m_entries.append(entry);
}
}
if (!m_current_policy.action.isEmpty()) {
computeActionPolicies();
}
return (true);
}
void ActionWidget::computeActionPolicies()
{
kDebug();
m_ui->localAuthListWidget->clear();
qSort(m_entries.begin(), m_entries.end(), orderByPriorityLessThan);
foreach (const PKLAEntry &entry, m_entries) {
QStringList realActions = entry.action.split(';');
kDebug() << entry.action << m_current_policy.action;
if (realActions.contains(m_current_policy.action)) {
// Match! Is it, actually, an implicit override?
/* if (entry.title == "PolkitKdeOverrideImplicit") {
// It is!
kDebug() << "Found implicit override";
setImplicitAuthorization(PKLAEntry::implFromText(entry.resultActive), m_ui->activeComboBox);
setImplicitAuthorization(PKLAEntry::implFromText(entry.resultInactive), m_ui->inactiveComboBox);
setImplicitAuthorization(PKLAEntry::implFromText(entry.resultAny), m_ui->anyComboBox);
} else { */
// TODO: Add it to the local auths
//LocalAuthorization *auth = new LocalAuthorization(entry);
kDebug() << "Found PKLA override";
QListWidgetItem *item = new QListWidgetItem(entry.title);
item->setData(Qt::UserRole, formatPKLAEntry(entry));
m_ui->localAuthListWidget->addItem(item);
// }
}
}
// Trigger the selection
if (!m_ui->localAuthListWidget->selectedItems().isEmpty()) {
explicitSelectionChanged(m_ui->localAuthListWidget->selectedItems().first(), 0);
} else {
explicitSelectionChanged(0, 0);
}
}
QString ActionWidget::formatPKLAEntry(const PKLAEntry& entry)
{
QString authorizationText;
if (entry.resultActive != m_current_policy.resultActive) {
authorizationText.append(i18n("'%1' on active console", entry.resultActive));
authorizationText.append(", ");
}
if (entry.resultInactive != m_current_policy.resultInactive) {
authorizationText.append(i18n("'%1' on inactive console", entry.resultActive));
authorizationText.append(", ");
}
if (entry.resultAny != m_current_policy.resultAny) {
authorizationText.append(i18n("'%1' on any console", entry.resultActive));
authorizationText.append(", ");
}
if (authorizationText.endsWith(QLatin1String(", "))) {
authorizationText.remove(-1, 2);
}
return i18np("%2 has the following policy: %3", "%2 have the following policy: %3",
entry.identity.split(';').count(), formatIdentities(entry.identity), authorizationText);
}
QString ActionWidget::formatIdentities(const QString& identities)
{
QString rettext;
QStringList realIdentities = identities.split(';');
foreach (const QString &identity, realIdentities) {
if (identity.startsWith(QLatin1String("unix-user:"))) {
rettext.append(identity.split("unix-user:").last());
rettext.append(", ");
}
if (identity.startsWith(QLatin1String("unix-group:"))) {
rettext.append(i18n("%1 group", identity.split("unix-group:").last()));
rettext.append(", ");
}
}
if (rettext.endsWith(QLatin1String(", "))) {
rettext = rettext.remove(rettext.length() - 2, 2);
}
return rettext;
}
void ActionWidget::setImplicitAuthorization(PolkitQt1::ActionDescription::ImplicitAuthorization auth, KComboBox* box)
{
box->setCurrentIndex(comboBoxIndexFor(auth));
}
int ActionWidget::comboBoxIndexFor(PolkitQt1::ActionDescription::ImplicitAuthorization auth)
{
switch (auth) {
case PolkitQt1::ActionDescription::Authorized:
return 0;
case PolkitQt1::ActionDescription::NotAuthorized:
return 1;
case PolkitQt1::ActionDescription::AuthenticationRequired:
return 4;
case PolkitQt1::ActionDescription::AuthenticationRequiredRetained:
return 5;
case PolkitQt1::ActionDescription::AdministratorAuthenticationRequired:
return 2;
case PolkitQt1::ActionDescription::AdministratorAuthenticationRequiredRetained:
return 3;
default:
break;
}
return 1;
}
PolkitQt1::ActionDescription::ImplicitAuthorization ActionWidget::implicitAuthorizationFor(int comboBoxIndex)
{
switch (comboBoxIndex) {
case 0:
return PolkitQt1::ActionDescription::Authorized;
case 1:
return PolkitQt1::ActionDescription::NotAuthorized;
case 4:
return PolkitQt1::ActionDescription::AuthenticationRequired;
case 5:
return PolkitQt1::ActionDescription::AuthenticationRequiredRetained;
case 2:
return PolkitQt1::ActionDescription::AdministratorAuthenticationRequired;
case 3:
return PolkitQt1::ActionDescription::AdministratorAuthenticationRequiredRetained;
default:
break;
}
return PolkitQt1::ActionDescription::Unknown;
}
void ActionWidget::setAction(const PolkitQt1::ActionDescription& action)
{
bool implicit_override = false;
// Check if PKLA's are loaded
if (!m_PKLALoaded) {
if (!reloadPKLAs()) {
setEnabled(false);
return;
}
m_PKLALoaded = true;
}
// Check for implicit override
foreach (const PKLAEntry &entry, m_implicit_entries) {
if (entry.action == action.actionId()) {
kDebug() << "Found implicit override!";
m_current_policy = entry;
implicit_override = true;
break;
}
}
// No implicit override found. Lets use the action
if (!implicit_override) {
m_current_policy.action = action.actionId();
m_current_policy.resultActive = PKLAEntry::textFromImpl(action.implicitActive());
m_current_policy.resultInactive = PKLAEntry::textFromImpl(action.implicitInactive());
m_current_policy.resultAny = PKLAEntry::textFromImpl(action.implicitAny());
}
setImplicitAuthorization(PKLAEntry::implFromText(m_current_policy.resultActive), m_ui->activeComboBox);
setImplicitAuthorization(PKLAEntry::implFromText(m_current_policy.resultInactive), m_ui->inactiveComboBox);
setImplicitAuthorization(PKLAEntry::implFromText(m_current_policy.resultAny), m_ui->anyComboBox);
m_ui->descriptionLabel->setText(action.description());
m_ui->vendorLabel->setText(action.vendorName());
m_ui->vendorLabel->setUrl(action.vendorUrl());
m_ui->pixmapLabel->setPixmap(KIcon(action.iconName()).pixmap(64));
computeActionPolicies();
this->setEnabled(true);
}
void ActionWidget::editExplicitPKLAEntry(QListWidgetItem* item)
{
foreach (const PKLAEntry &entry, m_entries) {
if (entry.title == item->text()) {
QWeakPointer<ExplicitAuthorizationDialog> dialog = new ExplicitAuthorizationDialog(entry, this);
if (dialog.data()->exec() == KDialog::Accepted) {
dialog.data()->commitChangesToPKLA();
PKLAEntry result = dialog.data()->pkla();
// Register the entry. But first remove the previous one to avoid duplicates
for (PKLAEntryList::iterator it = m_entries.begin(); it != m_entries.end(); ++it) {
if ((*it).title == result.title) {
// Erase the old one
m_entries.erase(it);
break;
}
}
addNewPKLAEntry(result);
}
if (dialog) {
dialog.data()->deleteLater();
}
}
}
}
void ActionWidget::addExplicitPKLAEntry()
{
QWeakPointer<ExplicitAuthorizationDialog> dialog = new ExplicitAuthorizationDialog(m_current_policy.action, this);
if (dialog.data()->exec() == KDialog::Accepted) {
dialog.data()->commitChangesToPKLA();
PKLAEntry result = dialog.data()->pkla();
// Register the entry.
addNewPKLAEntry(result);
}
if (dialog) {
dialog.data()->deleteLater();
}
}
void ActionWidget::addNewPKLAEntry(const PKLAEntry& entry)
{
PKLAEntry toInsert(entry);
// Match it to the current config value
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
toInsert.filePriority = settings.value("General/PoliciesPriority", 75).toInt();
// If there's no file order, append it to the end of the current entries
if (toInsert.fileOrder < 0) {
int max = 0;
foreach (const PKLAEntry &entry, m_entries) {
if (entry.fileOrder > max) {
max = entry.fileOrder;
}
}
++max;
toInsert.fileOrder = max;
}
// Ok, now append it to the list
kDebug() << "Explicit settings changed";
m_explicitIsChanged = true;
m_entries.append(toInsert);
kDebug() << "Inserting entry named " << toInsert.title << " for " << toInsert.action;
emit changed();
// And reload the policies
computeActionPolicies();
}
void ActionWidget::removePKLAEntry()
{
if (m_ui->localAuthListWidget->selectedItems().isEmpty()) {
return;
}
QListWidgetItem *item = m_ui->localAuthListWidget->selectedItems().first();
// Find and erase the PKLA
for (PKLAEntryList::iterator it = m_entries.begin(); it != m_entries.end(); ++it) {
if ((*it).title == item->text()) {
// Remove it
it = m_entries.erase(it);
break;
}
}
kDebug() << "Explicit settings changed";
m_explicitIsChanged = true;
emit changed();
// Reload
computeActionPolicies();
}
void ActionWidget::explicitSelectionChanged(QListWidgetItem* current, QListWidgetItem* )
{
if (current) {
m_ui->removeButton->setEnabled(true);
// Can we move up?
m_ui->moveUpButton->setEnabled(m_ui->localAuthListWidget->currentRow() > 0);
// Can we move down?
m_ui->moveDownButton->setEnabled(m_ui->localAuthListWidget->currentRow() < (m_ui->localAuthListWidget->count() - 1));
} else {
m_ui->removeButton->setEnabled(false);
m_ui->moveDownButton->setEnabled(false);
m_ui->moveUpButton->setEnabled(false);
}
}
void ActionWidget::movePKLADown()
{
if (m_ui->localAuthListWidget->selectedItems().isEmpty()) {
return;
}
QListWidgetItem *item = m_ui->localAuthListWidget->selectedItems().first();
// Find the PKLA and change it
PKLAEntry entry;
for (PKLAEntryList::iterator it = m_entries.begin(); it != m_entries.end(); ++it) {
if ((*it).title == item->text()) {
// Decrease the priority
++(*it).fileOrder;
kDebug() << (*it).title << " is now " << (*it).fileOrder;
// Increase the priority of the next one
++it;
--(*it).fileOrder;
break;
}
}
kDebug() << "Explicit settings changed";
m_explicitIsChanged = true;
emit changed();
// Reload
computeActionPolicies();
}
void ActionWidget::movePKLAUp()
{
if (m_ui->localAuthListWidget->selectedItems().isEmpty()) {
return;
}
QListWidgetItem *item = m_ui->localAuthListWidget->selectedItems().first();
// Find the PKLA and change it
PKLAEntry entry;
for (PKLAEntryList::iterator it = m_entries.begin(); it != m_entries.end(); ++it) {
if ((*it).title == item->text()) {
// Increase the priority
--(*it).fileOrder;
kDebug() << (*it).title << " is now " << (*it).fileOrder;
// Decrease the priority of the previous one
--it;
++(*it).fileOrder;
break;
}
}
kDebug() << "Explicit settings changed";
m_explicitIsChanged = true;
emit changed();
// Reload
computeActionPolicies();
}
PKLAEntryList ActionWidget::entries() const
{
return m_entries;
}
PKLAEntryList ActionWidget::implicitEntries() const
{
return m_implicit_entries;
}
void ActionWidget::anyImplicitSettingChanged()
{
implicitSettingChanged(PKLAEntry::implFromText(m_current_policy.resultAny), m_ui->anyComboBox);
}
void ActionWidget::activeImplicitSettingChanged()
{
implicitSettingChanged(PKLAEntry::implFromText(m_current_policy.resultActive), m_ui->activeComboBox);
}
void ActionWidget::inactiveImplicitSettingChanged()
{
implicitSettingChanged(PKLAEntry::implFromText(m_current_policy.resultInactive), m_ui->inactiveComboBox);
}
void ActionWidget::implicitSettingChanged(PolkitQt1::ActionDescription::ImplicitAuthorization auth, KComboBox *box)
{
// Check if the setting has been changed or if it is just an action change
if (auth != implicitAuthorizationFor(box->currentIndex())) {
// The setting has been changed. Now add the new setting to the implicitlist
addImplicitSetting();
// Settings changed. Enable apply button.
emit changed();
}
}
void ActionWidget::addImplicitSetting()
{
PKLAEntry entry;
entry.resultAny = PKLAEntry::textFromImpl(implicitAuthorizationFor(m_ui->anyComboBox->currentIndex()));
entry.resultActive = PKLAEntry::textFromImpl(implicitAuthorizationFor(m_ui->activeComboBox->currentIndex()));
entry.resultInactive = PKLAEntry::textFromImpl(implicitAuthorizationFor(m_ui->inactiveComboBox->currentIndex()));
entry.action = m_current_policy.action;
// Before adding the new setting, delete all former settings on our list
for (PKLAEntryList::iterator it = m_implicit_entries.begin(); it != m_implicit_entries.end(); ++it) {
// Match! Delete old entry
if ((*it).action == m_current_policy.action) {
m_implicit_entries.erase(it);
break;
}
}
kDebug() << "Implicit settings changed";
m_implicitIsChanged = true;
m_implicit_entries.push_back(entry);
// Update the old settings container
m_current_policy.resultActive = entry.resultActive;
m_current_policy.resultAny = entry.resultAny;
m_current_policy.resultInactive = entry.resultInactive;
}
void ActionWidget::implicitSettingsSaved() {
m_implicitIsChanged = false;
}
void ActionWidget::explicitSettingsSaved() {
m_explicitIsChanged = false;
}
bool ActionWidget::isExplicitSettingsChanged() const
{
return m_explicitIsChanged;
}
bool ActionWidget::isImplicitSettingsChanged() const
{
return m_implicitIsChanged;
}
}

View file

@ -1,85 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef ACTIONWIDGET_H
#define ACTIONWIDGET_H
#include <QtGui/QWidget>
#include <QtGui/QListWidgetItem>
#include <PolkitQt1/ActionDescription>
#include "PKLAEntry.h"
class KComboBox;
QT_BEGIN_NAMESPACE
namespace Ui {
class ActionWidget;
}
QT_END_NAMESPACE
namespace PolkitKde {
class ActionWidget : public QWidget
{
Q_OBJECT
public:
explicit ActionWidget(QWidget* parent = 0);
virtual ~ActionWidget();
static int comboBoxIndexFor(PolkitQt1::ActionDescription::ImplicitAuthorization auth);
static PolkitQt1::ActionDescription::ImplicitAuthorization implicitAuthorizationFor(int comboBoxIndex);
PKLAEntryList entries() const;
PKLAEntryList implicitEntries() const;
bool isExplicitSettingsChanged() const;
bool isImplicitSettingsChanged() const;
public Q_SLOTS:
void setAction(const PolkitQt1::ActionDescription &action);
void computeActionPolicies();
void editExplicitPKLAEntry(QListWidgetItem *item);
void addExplicitPKLAEntry();
void implicitSettingsSaved();
void explicitSettingsSaved();
private Q_SLOTS:
void movePKLADown();
void movePKLAUp();
void explicitSelectionChanged(QListWidgetItem *current,QListWidgetItem*);
void removePKLAEntry();
void anyImplicitSettingChanged();
void activeImplicitSettingChanged();
void inactiveImplicitSettingChanged();
Q_SIGNALS:
void changed();
private:
void implicitSettingChanged(PolkitQt1::ActionDescription::ImplicitAuthorization auth, KComboBox *box);
void setImplicitAuthorization(PolkitQt1::ActionDescription::ImplicitAuthorization auth, KComboBox *box);
void addImplicitSetting();
void addNewPKLAEntry(const PKLAEntry &entry);
QString formatPKLAEntry(const PKLAEntry &entry);
QString formatIdentities(const QString &identities);
bool reloadPKLAs();
bool m_explicitIsChanged;
bool m_implicitIsChanged;
bool m_PKLALoaded;
Ui::ActionWidget *m_ui;
PKLAEntry m_current_policy;
PKLAEntryList m_entries;
PKLAEntryList m_implicit_entries;
};
}
#endif // ACTIONWIDGET_H

View file

@ -1,87 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf54321@gmail.com>
Copyright (C) 2009 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "AuthorizationsFilterModel.h"
#include "PoliciesModel.h"
#include <KDebug>
namespace PolkitKde
{
AuthorizationsFilterModel::AuthorizationsFilterModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
}
AuthorizationsFilterModel::~AuthorizationsFilterModel()
{
}
bool AuthorizationsFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
// if the filter is empty avoid checking since if the model isn't complete populated
// some items might be hidden
if (filterRegExp().isEmpty()) {
return true;
}
if (index.data(PolkitKde::PoliciesModel::IsGroupRole).toBool()) {
return groupHasMatchingItem(index);
}
return (index.data(PolkitKde::PoliciesModel::PathRole).toString().contains(filterRegExp()) ||
index.data(Qt::DisplayRole).toString().contains(filterRegExp()));
}
bool AuthorizationsFilterModel::groupHasMatchingItem(const QModelIndex &parent) const
{
// kDebug() << "group" << parent.data(Qt::DisplayRole);
for (int i = 0; i < sourceModel()->rowCount(parent); i++) {
QModelIndex index = sourceModel()->index(i, 0, parent);
// we check to see if the item is a group
// if so we call groupHasMatchingItem for that group
if (index.data(PolkitKde::PoliciesModel::IsGroupRole).toBool()) {
// we call to see if the subgroup has an matching item
if (groupHasMatchingItem(sourceModel()->index(i, 0, parent))) {
return true;
}
} else {
// kDebug() << "item" << index.data(Qt::DisplayRole);
// here we have an action let's see it this match
if (index.data(PolkitKde::PoliciesModel::PathRole).toString().contains(filterRegExp()) ||
index.data(Qt::DisplayRole).toString().contains(filterRegExp()))
{
return true;
}
}
}
// if we don't find any matching action return false
return false;
}
}
#include "AuthorizationsFilterModel.moc"

View file

@ -1,47 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Dario Freddi <drf54321@gmail.com>
Copyright (C) 2009 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef AUTHORIZATIONSFILTERMODEL_H
#define AUTHORIZATIONSFILTERMODEL_H
#include <QSortFilterProxyModel>
namespace PolkitKde
{
class AuthorizationsFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
AuthorizationsFilterModel(QObject *parent = 0);
~AuthorizationsFilterModel();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
private:
bool groupHasMatchingItem(const QModelIndex &parent) const;
};
}
#endif /* AUTHORIZATIONSFILTERMODEL_H */

View file

@ -1,35 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
set(kcm_polkitactions_SRCS
PolkitActionsKCM.cpp
AuthorizationsFilterModel.cpp
PoliciesModel.cpp
PolicyItem.cpp
ActionWidget.cpp
explicitauthorizationdialog.cpp
pkitemdelegate.cpp
)
kde4_add_plugin(kcm_polkitactions ${kcm_polkitactions_SRCS})
target_link_libraries(kcm_polkitactions
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBRARY}
${POLKITQT-1_CORE_LIBRARY}
polkitkdekcmodulesprivate
)
########### install files ###############
install(
TARGETS kcm_polkitactions
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
install(
FILES kcm_polkitactions.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)

View file

@ -1,4 +0,0 @@
#! /bin/sh
$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/kcm_polkitactions.pot
rm -f rc.cpp

View file

@ -1,291 +0,0 @@
/***************************************************************************
* Copyright (C) 2009 by Daniel Nicoletti *
* dantti85-pk@yahoo.com.br *
* Copyright (C) 2009 by Dario Freddi *
* drf@kde.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "PoliciesModel.h"
#include <QStringList>
#include <KDebug>
#include "PolicyItem.h"
using namespace PolkitKde;
PoliciesModel::PoliciesModel(QObject *parent)
: QAbstractItemModel(parent)
{
rootItem = new PolicyItem(true);
}
PoliciesModel::~PoliciesModel()
{
delete rootItem;
}
int PoliciesModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 1;
}
QVariant PoliciesModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
PolicyItem *item = static_cast<PolicyItem*>(index.internalPointer());
return item->data(role);
}
Qt::ItemFlags PoliciesModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
QModelIndex PoliciesModel::index(int row, int column, const QModelIndex &parent)
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
PolicyItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<PolicyItem*>(parent.internalPointer());
PolicyItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
QModelIndex PoliciesModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
PolicyItem *childItem = static_cast<PolicyItem*>(index.internalPointer());
PolicyItem *parentItem = childItem->parent();
if (parentItem == rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
int PoliciesModel::rowCount(const QModelIndex &parent) const
{
PolicyItem *parentItem;
if (parent.column() > 0)
return 0;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<PolicyItem*>(parent.internalPointer());
return parentItem->childCount();
}
void PoliciesModel::setCurrentEntries(const PolkitQt1::ActionDescription::List &entries)
{
// before inserting let's remove entries (policies)
// that don't exist anymore
QStringList stringEntries;
foreach (const PolkitQt1::ActionDescription &entry, entries) {
stringEntries.append(entry.actionId());
}
removeEntries(stringEntries, rootItem);
// now we insert or update all the items
foreach (const PolkitQt1::ActionDescription &entry, entries) {
QStringList actionPath;
actionPath = entry.actionId().split('.');
if (actionPath.size() > 2) {
// if we have an action id bigger than
// "org.kde"
QString rootString = actionPath.takeFirst();
rootString += '.' + actionPath.takeFirst();
actionPath.prepend(rootString);
insertOrUpdate(actionPath, entry, rootItem);
} else if (actionPath.size() > 1) {
// although pretty weird and probably
// bad behavior, here we check if the action
// id is bigger than "org"
insertOrUpdate(actionPath, entry, rootItem);
} else {
kWarning() << "Bad Policy file entry" << entry.actionId();
}
}
}
QModelIndex PoliciesModel::indexFromId(const QString &id) const
{
return indexFromId(id, rootItem);
}
QModelIndex PoliciesModel::indexFromId(const QString &id, PolicyItem *parent) const
{
for (int i = 0; i < parent->childCount(); i++) {
PolicyItem *item = parent->child(i);
// kDebug() << "ITEM" << item->data(PathRole).toString() << parent->childCount();
if (item->isGroup()) {
const QModelIndex index = indexFromId(id, item);
if (index != QModelIndex()) {
return index;
}
} else if (id == item->data(PathRole).toString()) {
if (parent == rootItem) {
// i doubt this would ever happen :D
return QModelIndex();
} else{
return createIndex(item->row(), 0, item);
}
}
}
return QModelIndex();
}
bool PoliciesModel::removeEntries(const QStringList &entries, PolicyItem *parent)
{
for (int i = 0; i < parent->childCount(); i++) {
PolicyItem *item = parent->child(i);
// kDebug() << "ITEM" << item->data(PathRole).toString() << parent->childCount();
if (item->isGroup()) {
if (!removeEntries(entries, item)) {
// removeEntries returns true if the action does
// not have any children
// if there are items let's continue to the next item
continue;
}
} else {
bool found = false;
// lets see if this action still exists in the new list
foreach (const QString &entry, entries) {
if (entry == item->data(PathRole).toString()) {
found = true;
break;
}
}
if (found) {
// if we found it let's go to the next item
continue;
}
}
// if we got here we can remove
QModelIndex index;
if (parent != rootItem) {
index = createIndex(parent->row(), 0, parent);
}
// kDebug() << "REMOVING" << item->data(PathRole).toString() << index;
beginRemoveRows(index, item->row(), item->row());
parent->removeChild(item);
endRemoveRows();
// we decrement the iterator as
// the item was removed ;)
i--;
}
return parent->childCount() == 0;
}
void PoliciesModel::insertOrUpdate(const QStringList &actionPath, const PolkitQt1::ActionDescription &entry,
PolicyItem *parent, int level)
{
// kDebug() << actionPath << actionPath.size() << entry << level << parent;
if (actionPath.size() - 1 == level) {
// if the actionPath size is equal as
// the leve we are about to insert the
// action itself
QString path = actionPath.join(".");
PolicyItem *action = 0;
for (int i = 0; i < parent->childCount(); i++) {
if (!parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole).toString()) {
action = parent->child(i);
break;
}
}
QModelIndex index;
if (parent != rootItem) {
index = createIndex(parent->row(), 0, parent);
}
if (action) {
// ok action found let's update it.
// kDebug() << "Updating action:" << path << index;
action->setPolkitEntry(entry);
emit dataChanged(index, index);
} else {
// action not found lets add one
// kDebug() << "Adding action:" << path << index;
beginInsertRows(index, parent->childCount(), parent->childCount());
parent->appendChild(action = new PolicyItem(false, parent));
action->setPolkitEntry(entry);
endInsertRows();
// Update the parent
emit dataChanged(index, index);
}
} else {
// here we are adding or finding a group
QString path = actionPath.at(level);
PolicyItem *group = 0;
for (int i = 0; i < parent->childCount(); i++) {
if (parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole).toString()) {
group = parent->child(i);
break;
}
}
if (group) {
// kDebug() << "Group Found" << path;
insertOrUpdate(actionPath, entry, group, level + 1);
} else {
// ok we didn't find the group
// let's add the group
QModelIndex index;
if (parent != rootItem) {
index = createIndex(parent->row(), 0, parent);
}
// kDebug() << "Group NOT Found, adding one: " << path << index;
beginInsertRows(index, parent->childCount(), parent->childCount());
parent->appendChild(group = new PolicyItem(true, parent));
group->setData(PathRole, path);
// if we are at the lowest level of a group
// we try to get the vendorName
if (actionPath.size() - 2 == level) {
const QString vendorName = entry.vendorName();
if (vendorName.isEmpty()) {
group->setData(Qt::DisplayRole, path);
} else {
group->setData(Qt::DisplayRole, vendorName);
}
} else {
group->setData(Qt::DisplayRole, path);
}
endInsertRows();
insertOrUpdate(actionPath, entry, group, level + 1);
}
}
}

View file

@ -1,74 +0,0 @@
/***************************************************************************
* Copyright (C) 2009 by Daniel Nicoletti *
* dantti85-pk@yahoo.com.br *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef POLICIES_MODEL_H
#define POLICIES_MODEL_H
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
#include <PolkitQt1/ActionDescription>
namespace PolkitKde
{
class PolicyItem;
class PoliciesModel : public QAbstractItemModel
{
Q_OBJECT
public:
enum DataRoles {
PathRole = 41,
IsGroupRole = 42,
PolkitEntryRole = 43
};
PoliciesModel(QObject *parent = 0);
~PoliciesModel();
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QModelIndex indexFromId(const QString &id) const;
public slots:
void setCurrentEntries(const PolkitQt1::ActionDescription::List &entries);
private:
void insertOrUpdate(const QStringList &actionPath, const PolkitQt1::ActionDescription &entry,
PolicyItem *parent, int level = 0);
bool removeEntries(const QStringList &entries, PolicyItem *parent);
QModelIndex indexFromId(const QString &id, PolicyItem *parent) const;
PolicyItem *rootItem;
};
}
#endif

View file

@ -1,110 +0,0 @@
/***************************************************************************
* Copyright (C) 2009 by Daniel Nicoletti *
* dantti85-pk@yahoo.com.br *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "PolicyItem.h"
#include <KIconLoader>
#include <KIcon>
#include "PoliciesModel.h"
using namespace PolkitKde;
PolicyItem::PolicyItem(bool isGroup, PolicyItem *parent)
: parentItem(parent)
{
if (isGroup) {
itemData[Qt::DecorationRole] = KIcon("folder-locked");
} else {
itemData[Qt::DecorationRole] = KIcon("preferences-desktop-cryptography");
}
itemData[PoliciesModel::IsGroupRole] = isGroup;
}
PolicyItem::~PolicyItem()
{
qDeleteAll(childItems);
}
void PolicyItem::setPolkitEntry(const PolkitQt1::ActionDescription &entry)
{
// yep, caching the icon DOES improve speed
QString iconName = entry.iconName();
if (KIconLoader::global()->iconPath(iconName, KIconLoader::NoGroup, true).isEmpty()) {
itemData[Qt::DecorationRole] = KIcon("preferences-desktop-cryptography");
} else {
itemData[Qt::DecorationRole] = KIcon(iconName);
}
itemData[Qt::DisplayRole] = entry.description();
itemData[PoliciesModel::PathRole] = entry.actionId();
itemData[PoliciesModel::PolkitEntryRole] = QVariant::fromValue(entry);
}
void PolicyItem::appendChild(PolicyItem *item)
{
childItems.append(item);
}
void PolicyItem::removeChild(PolicyItem *item)
{
delete childItems.takeAt(childItems.indexOf(item));
}
PolicyItem *PolicyItem::child(int row)
{
return childItems.value(row);
}
int PolicyItem::childCount() const
{
return childItems.count();
}
QVariant PolicyItem::data(int role) const
{
if (itemData.contains(role)) {
return itemData[role];
}
return QVariant();
}
void PolicyItem::setData(int role, const QVariant &data)
{
itemData[role] = data;
}
PolicyItem *PolicyItem::parent()
{
return parentItem;
}
int PolicyItem::row() const
{
if (parentItem)
return parentItem->childItems.indexOf(const_cast<PolicyItem*>(this));
return 0;
}
bool PolicyItem::isGroup() const
{
return itemData[PoliciesModel::IsGroupRole].toBool();
}

View file

@ -1,65 +0,0 @@
/***************************************************************************
* Copyright (C) 2009 by Daniel Nicoletti *
* dantti85-pk@yahoo.com.br *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef POLICY_ITEM_H
#define POLICY_ITEM_H
#include <QList>
#include <QHash>
#include <QVariant>
#include <QMetaType>
namespace PolkitQt1 {
class ActionDescription;
}
namespace PolkitKde
{
class PolicyItem
{
public:
explicit PolicyItem(bool isGroup, PolicyItem *parent = 0);
~PolicyItem();
void appendChild(PolicyItem *child);
void removeChild(PolicyItem *item);
PolicyItem *child(int row);
int childCount() const;
QVariant data(int role) const;
void setData(int role, const QVariant &data);
int row() const;
PolicyItem *parent();
bool isGroup() const;
void setPolkitEntry(const PolkitQt1::ActionDescription &entry);
private:
QList<PolicyItem*> childItems;
QHash<int, QVariant> itemData;
PolicyItem *parentItem;
};
}
Q_DECLARE_METATYPE(PolkitQt1::ActionDescription);
#endif

View file

@ -1,176 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "PolkitActionsKCM.h"
#include <KPluginFactory>
#include <KAboutData>
#include <KLocalizedString>
#include <KMessageBox>
#include <PolkitQt1/Authority>
#include "ui_mainview.h"
#include "PoliciesModel.h"
#include "AuthorizationsFilterModel.h"
#include "pkitemdelegate.h"
#include <QLayout>
#include "ActionWidget.h"
#include "PolicyItem.h"
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusMetaType>
#include <QDBusPendingCall>
K_PLUGIN_FACTORY(KCMPolkitActionsFactory,
registerPlugin<PolkitActionsKCM>();
)
K_EXPORT_PLUGIN(KCMPolkitActionsFactory("kcm_polkitactions"))
PolkitActionsKCM::PolkitActionsKCM(QWidget* parent, const QVariantList& args)
: KCModule(KCMPolkitActionsFactory::componentData(), parent, args)
, m_ui(new Ui::PolkitActionsMainView)
{
KAboutData *about =
new KAboutData("kcm_polkitactions", "kcm_polkitactions", ki18n("Global system policy settings"),
"1.0.0", ki18n("A configuration for polkit-1 system administrators and policy priorities"),
KAboutData::License_GPL, ki18n("(c), 2009 Dario Freddi"),
ki18n("From this module, you can configure system administrators and priorities "
"for the policies defined in the Actions module"));
about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org", "http://drfav.wordpress.com");
setAboutData(about);
qRegisterMetaType<PolkitQt1::ActionDescription>();
qRegisterMetaType<PKLAEntry>("PKLAEntry");
qDBusRegisterMetaType<PKLAEntry>();
qDBusRegisterMetaType<QList<PKLAEntry> >();
// Build the UI
m_ui->setupUi(this);
m_model = new PolkitKde::PoliciesModel(this);
m_proxyModel = new PolkitKde::AuthorizationsFilterModel(this);
m_proxyModel->setSourceModel(m_model);
m_ui->treeView->header()->hide();
m_ui->treeView->setModel(m_proxyModel);
m_ui->treeView->setItemDelegate(new PolkitKde::PkItemDelegate(this));
connect(m_ui->searchLine, SIGNAL(textChanged(QString)),
m_proxyModel, SLOT(setFilterRegExp(QString)));
connect(m_ui->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(slotCurrentChanged(QModelIndex,QModelIndex)));
// Initialize
connect(PolkitQt1::Authority::instance(), SIGNAL(checkAuthorizationFinished(PolkitQt1::Authority::Result)),
this, SLOT(slotCheckAuthorizationFinished(PolkitQt1::Authority::Result)));
connect(PolkitQt1::Authority::instance(), SIGNAL(enumerateActionsFinished(PolkitQt1::ActionDescription::List)),
m_model, SLOT(setCurrentEntries(PolkitQt1::ActionDescription::List)));
PolkitQt1::Authority::instance()->enumerateActions();
// Initialize ActionWidget
if (layout()->count() == 2) {
layout()->takeAt(1)->widget()->deleteLater();
}
m_actionWidget = new PolkitKde::ActionWidget(this);
connect(m_actionWidget, SIGNAL(changed()), this, SLOT(changed()));
connect(this, SIGNAL(implicitSaved()), m_actionWidget, SLOT(implicitSettingsSaved()));
connect(this, SIGNAL(explicitSaved()), m_actionWidget, SLOT(explicitSettingsSaved()));
layout()->addWidget(m_actionWidget);
}
PolkitActionsKCM::~PolkitActionsKCM()
{
delete m_ui;
}
void PolkitActionsKCM::load()
{
KCModule::load();
}
void PolkitActionsKCM::save()
{
// HACK: Check if we want to save the implicit settings. This will be changed
// in the future, where implicitEntries() will only contain the changed settings.
if (m_actionWidget->isImplicitSettingsChanged()) {
QDBusMessage messageImplicit = QDBusMessage::createMethodCall("org.kde.polkitkde1.helper",
"/Helper",
"org.kde.polkitkde1.helper",
QLatin1String("writeImplicitPolicy"));
QList<QVariant> implicitArgumentList;
implicitArgumentList << QVariant::fromValue(m_actionWidget->implicitEntries());
messageImplicit.setArguments(implicitArgumentList);
QDBusPendingCall replyImplicit = QDBusConnection::systemBus().asyncCall(messageImplicit);
replyImplicit.waitForFinished();
if (replyImplicit.isError()) {
KMessageBox::detailedError( this,
replyImplicit.error().name(),
replyImplicit.error().message()
);
changed();
}
else {
emit implicitSaved();
}
}
// HACK: Check if we want to save the explicit settings. This will be changed
// in the future, where entries() will only contain the changed settings.
if (m_actionWidget->isExplicitSettingsChanged()) {
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.polkitkde1.helper",
"/Helper",
"org.kde.polkitkde1.helper",
QLatin1String("writePolicy"));
QList<QVariant> argumentList;
QList<PKLAEntry> policies;
foreach (const PKLAEntry &entry, m_actionWidget->entries()) {
policies << entry;
}
argumentList << QVariant::fromValue(policies);
message.setArguments(argumentList);
QDBusPendingCall reply = QDBusConnection::systemBus().asyncCall(message);
if (reply.isError()) {
KMessageBox::detailedError( this,
reply.error().name(),
reply.error().message()
);
changed();
}
else {
emit explicitSaved();
}
}
}
void PolkitActionsKCM::defaults()
{
KCModule::defaults();
}
void PolkitActionsKCM::slotCheckAuthorizationFinished(PolkitQt1::Authority::Result result)
{
}
void PolkitActionsKCM::slotCurrentChanged(const QModelIndex& current, const QModelIndex& )
{
if (current.data(PolkitKde::PoliciesModel::IsGroupRole).toBool() == false) {
PolkitQt1::ActionDescription action;
action = current.data(PolkitKde::PoliciesModel::PolkitEntryRole).value<PolkitQt1::ActionDescription>();
m_actionWidget->setAction(action);
} else {
// TODO
}
}

View file

@ -1,57 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef POLKITACTIONSKCM_H
#define POLKITACTIONSKCM_H
#include <kcmodule.h>
#include <PolkitQt1/Authority>
#include <QtCore/QPointer>
#include <QtCore/QModelIndex>
namespace PolkitKde {
class PoliciesModel;
class AuthorizationsFilterModel;
class ActionWidget;
}
QT_BEGIN_NAMESPACE
namespace Ui {
class PolkitActionsMainView;
}
QT_END_NAMESPACE
class PolkitActionsKCM : public KCModule
{
Q_OBJECT
public:
explicit PolkitActionsKCM(QWidget* parent = 0, const QVariantList& args = QVariantList());
virtual ~PolkitActionsKCM();
virtual void load();
virtual void save();
virtual void defaults();
Q_SIGNALS:
void explicitSaved();
void implicitSaved();
public slots:
void slotCheckAuthorizationFinished(PolkitQt1::Authority::Result result);
void slotCurrentChanged(const QModelIndex &current, const QModelIndex&);
private:
Ui::PolkitActionsMainView *m_ui;
PolkitKde::PoliciesModel *m_model;
PolkitKde::AuthorizationsFilterModel *m_proxyModel;
PolkitKde::ActionWidget *m_actionWidget;
};
#endif // POLKITACTIONSKCM_H

View file

@ -1,345 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ActionWidget</class>
<widget class="QWidget" name="ActionWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>412</width>
<height>508</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="pixmapLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KUrlLabel" name="vendorLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Implicit authorizations</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Any</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="anyComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Inactive console</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="inactiveComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Active console</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KComboBox" name="activeComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Local authorizations</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="localAuthListWidget"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="moveUpButton">
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="moveDownButton">
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="KPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="addLocalButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KUrlLabel</class>
<extends>QLabel</extends>
<header>kurllabel.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,120 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "explicitauthorizationdialog.h"
#include "ui_explicitwidget.h"
#include "ActionWidget.h"
#include "identitywidget.h"
namespace PolkitKde {
ExplicitAuthorizationDialog::ExplicitAuthorizationDialog(const PKLAEntry& entry, QWidget* parent)
: KDialog(parent)
, m_entry(entry)
{
init();
m_ui->titleEdit->setEnabled(false);
reloadPKLA();
}
ExplicitAuthorizationDialog::ExplicitAuthorizationDialog(const QString &action, QWidget* parent)
: KDialog(parent)
{
m_entry.action = action;
m_entry.fileOrder = -1;
init();
}
ExplicitAuthorizationDialog::~ExplicitAuthorizationDialog()
{
delete m_ui;
}
void ExplicitAuthorizationDialog::init()
{
QWidget *widget = new QWidget;
m_ui = new Ui::ExplicitAuthorizationWidget;
m_ui->setupUi(widget);
setMainWidget(widget);
setModal(true);
m_ui->addButton->setIcon(KIcon("list-add"));
m_identitiesLayout = new QVBoxLayout;
m_identitiesLayout->addStretch();
m_ui->scrollAreaWidgetContents->setLayout(m_identitiesLayout);
connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addIdentity()));
}
void ExplicitAuthorizationDialog::addIdentity()
{
IdentityWidget *iw = new IdentityWidget();
m_identitiesLayout->insertWidget(m_identitiesLayout->count() - 1, iw);
}
void ExplicitAuthorizationDialog::reloadPKLA()
{
m_ui->titleEdit->setText(m_entry.title);
m_ui->anyComboBox->setCurrentIndex(ActionWidget::comboBoxIndexFor(PKLAEntry::implFromText(m_entry.resultAny)));
m_ui->inactiveComboBox->setCurrentIndex(ActionWidget::comboBoxIndexFor(PKLAEntry::implFromText(m_entry.resultInactive)));
m_ui->activeComboBox->setCurrentIndex(ActionWidget::comboBoxIndexFor(PKLAEntry::implFromText(m_entry.resultActive)));
foreach (const QString &identity, m_entry.identity.split(';')) {
IdentityWidget *idWidget = 0;
if (identity.startsWith(QLatin1String("unix-user:"))) {
idWidget = new IdentityWidget(IdentityWidget::UserIdentity, identity.split("unix-user:").last());
} else if (identity.startsWith(QLatin1String("unix-group:"))) {
idWidget = new IdentityWidget(IdentityWidget::GroupIdentity, identity.split("unix-group:").last());
}
if (idWidget) {
m_identitiesLayout->insertWidget(m_identitiesLayout->count() - 1, idWidget);
}
}
}
void ExplicitAuthorizationDialog::commitChangesToPKLA()
{
m_entry.title = m_ui->titleEdit->text();
m_entry.resultAny = PKLAEntry::textFromImpl(ActionWidget::implicitAuthorizationFor(m_ui->anyComboBox->currentIndex()));
m_entry.resultActive = PKLAEntry::textFromImpl(ActionWidget::implicitAuthorizationFor(m_ui->activeComboBox->currentIndex()));
m_entry.resultInactive =
PKLAEntry::textFromImpl(ActionWidget::implicitAuthorizationFor(m_ui->inactiveComboBox->currentIndex()));
QString identities;
for (int i = 0; i < m_identitiesLayout->count(); ++i) {
QLayoutItem *item = m_identitiesLayout->itemAt(i);
if (item != 0) {
QWidget *widget = item->widget();
if (widget != 0) {
IdentityWidget *identityWidget = qobject_cast< IdentityWidget* >(widget);
if (identityWidget != 0) {
// Whew, let's add it
if (identityWidget->identityType() == IdentityWidget::UserIdentity) {
identities.append("unix-user:");
} else {
identities.append("unix-group:");
}
identities.append(identityWidget->identityName());
identities.append(';');
}
}
}
}
m_entry.identity = identities;
}
PKLAEntry ExplicitAuthorizationDialog::pkla()
{
return m_entry;
}
}

View file

@ -1,53 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef EXPLICITAUTHORIZATIONDIALOG_H
#define EXPLICITAUTHORIZATIONDIALOG_H
#include <QVBoxLayout>
#include <KDialog>
#include "PKLAEntry.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class ExplicitAuthorizationWidget;
}
QT_END_NAMESPACE
namespace PolkitKde {
class ExplicitAuthorizationDialog : public KDialog
{
Q_OBJECT
public:
explicit ExplicitAuthorizationDialog(const PKLAEntry &entry, QWidget* parent = 0);
explicit ExplicitAuthorizationDialog(const QString &action, QWidget* parent = 0);
virtual ~ExplicitAuthorizationDialog();
void commitChangesToPKLA();
PKLAEntry pkla();
private slots:
void addIdentity();
private:
void init();
void reloadPKLA();
private:
PKLAEntry m_entry;
Ui::ExplicitAuthorizationWidget *m_ui;
QVBoxLayout *m_identitiesLayout;
};
}
#endif // EXPLICITAUTHORIZATIONDIALOG_H

View file

@ -1,226 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExplicitAuthorizationWidget</class>
<widget class="QWidget" name="ExplicitAuthorizationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>335</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Here you can set a higher priority policy restricted to some users or groups</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Any</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="anyComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Inactive console</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KComboBox" name="inactiveComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Active console</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KComboBox" name="activeComboBox">
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Administrator Authentication (retain)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (one shot)</string>
</property>
</item>
<item>
<property name="text">
<string>Authentication (retain)</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Title</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KLineEdit" name="titleEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>140</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="addButton">
<property name="text">
<string>Add...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,148 +0,0 @@
[Desktop Entry]
Exec=kcmshell4 kcm_polkitactions
Icon=system-lock-screen
Type=Service
X-KDE-ServiceTypes=KCModule
#X-DocPath=kcontrol/powerdevil/index.html
X-KDE-Library=kcm_polkitactions
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=system-administration
Name=Actions Policy
Name[ar]=سياسات الإجراءات
Name[bs]=Pravila o radnjama
Name[ca]=Política d'accions
Name[ca@valencia]=Política d'accions
Name[cs]=Pravidla činností
Name[da]=Politik for handlinger
Name[de]=Aktionsberechtigungen
Name[el]=Πολιτικές ενεργειών
Name[en_GB]=Actions Policy
Name[es]=Políticas de acciones
Name[et]=Toimingute reeglid
Name[fi]=Toimintojen käytäntö
Name[fr]=Stratégie pour les actions
Name[gl]=Política das accións
Name[hr]=Pravila radnji
Name[hu]=Műveleti házirend
Name[it]=Politiche delle azioni
Name[kk]=Әрекеттер саясаты
Name[km]=
Name[ko]=
Name[lt]=Veiksmų taisyklės
Name[mr]=ि
Name[nb]=Praksis for handlinger
Name[nds]=Akschonenregel
Name[nl]=Beleid voor acties
Name[pa]=
Name[pl]=Polityka działań
Name[pt]=Política das Acções
Name[pt_BR]=Política de ações
Name[ro]=Politică acțiuni
Name[ru]=Политика для действий
Name[sk]=Politika akcií
Name[sl]=Pravilniki dejanj
Name[sr]=Смернице радњи
Name[sr@ijekavian]=Смјернице радњи
Name[sr@ijekavianlatin]=Smjernice radnji
Name[sr@latin]=Smernice radnji
Name[sv]=Åtgärdspolicy
Name[tr]=Eylem Politikaları
Name[ug]=مەشغۇلات سىياسىتى
Name[uk]=Правила дій
Name[vi]=Chính sách hành đng
Name[x-test]=xxActions Policyxx
Name[zh_CN]=
Name[zh_TW]=
Comment=Configure policies for trusted actions in the system
Comment[ar]=ضبط السياسات للإجراءات المأمونة في النظام
Comment[bs]=Podesi pravila za za pouzdane akcije u sistemu
Comment[ca]=Configura les polítiques per accions fiables en el sistema
Comment[ca@valencia]=Configura les polítiques per accions fiables en el sistema
Comment[cs]=Nastavit pravidla pro důvěryhodné činnosti v systému
Comment[da]=Indstil politikker for betroede handlinger i systemet
Comment[de]=Berechtigungen für vertrauliche Aktionen im System einrichten
Comment[el]=Διαμόρφωση πολιτικών για έμπιστες ενέργειες στο σύστημα
Comment[en_GB]=Configure policies for trusted actions in the system
Comment[es]=Configurar políticas para acciones fiables en el sistema
Comment[et]=Süsteemi usaldusväärsete toimingute reeglite seadistamine
Comment[fi]=Järjestelmän luotettujen toimintojen käytäntöjen asetukset
Comment[fr]=Configure les stratégies pour les actions dignes de confiance dans le système
Comment[gl]=Configurar as políticas para as accións fiábeis no sistema.
Comment[hr]=Podesi pravila za pouzdane radnje u sustavu
Comment[hu]=Házirendek beállítása a rendszerben a megbízható műveletekhez
Comment[it]=Configura le politiche delle azioni fidate nel sistema
Comment[kk]=Жүйеде сенім артылған әрекеттер саясаттарын баптау
Comment[km]=
Comment[ko]=
Comment[lt]=Konfigūruoti taisykles patikimiems veiksmams sistemoje
Comment[lv]=Konfigurēt politikas uzticamajām darbībām sistēmā
Comment[nb]=Sett opp praksis for tiltrodde handlinger i systemet
Comment[nds]=Regeln för troot Akschonen op Dien Systeem fastleggen
Comment[nl]=Beleid voor vertrouwde acties in het systeem configureren
Comment[pa]=ਿ ਿ
Comment[pl]=Konfiguruj politykę dla zaufanych działań w systemie
Comment[pt]=Configurar as políticas para as acções fidedignas no sistema
Comment[pt_BR]=Configura as políticas para as ações confiáveis no sistema
Comment[ro]=Configurează politici pentru acțiunile de încredere în sistem
Comment[ru]=Настройка политики безопасности для доверенных действий в системе
Comment[sk]=Nastaviť politiky pre dôveryhodné akcie v systéme
Comment[sl]=Nastavi pravilnike za zaupanja vredna dejanja v sistemu
Comment[sr]=Подеси смернице за поуздане радње на систему
Comment[sr@ijekavian]=Подеси смјернице за поуздане радње на систему
Comment[sr@ijekavianlatin]=Podesi smjernice za pouzdane radnje na sistemu
Comment[sr@latin]=Podesi smernice za pouzdane radnje na sistemu
Comment[sv]=Anpassa policy för pålitliga åtgärder i systemet
Comment[th]=
Comment[tr]=Sistemin güvenilen eylem politikalarını yapılandır
Comment[uk]=Налаштування правил щодо виконання довірених дій у системі
Comment[vi]=Cu hình chính sách cho các hành đng tin cy trong h thng
Comment[x-test]=xxConfigure policies for trusted actions in the systemxx
Comment[zh_CN]=
Comment[zh_TW]=
X-KDE-Keywords=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[ar]=نظام,سياسة,سياسات,أمن, polkit, policykit,كلمة السر
X-KDE-Keywords[bs]=sistem,pravilo,pravila,sigurnost,polkit,lozinka
X-KDE-Keywords[ca]=sistema,política,polítiques,seguretat,polkit,policykit,contrasenya
X-KDE-Keywords[ca@valencia]=sistema,política,polítiques,seguretat,polkit,policykit,contrasenya
X-KDE-Keywords[cs]=systém,pravidlo,pravidla,bezpečnost,polkit,policykit,heslo
X-KDE-Keywords[da]=system,politik,politikker,sikkerhed,polkit,policykit,adgangskode
X-KDE-Keywords[de]=System,Berechtigung,Berechtigungen,Sicherheit,Polkit,Policykit,Passwort
X-KDE-Keywords[el]=σύστημα,πολιτική,πολιτικές,ασφάλεια,polkit,policykit,password
X-KDE-Keywords[en_GB]=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[es]=sistema,política,políticas,seguridad,polkit,policykit,contraseña
X-KDE-Keywords[et]=süsteem,reegel,reeglid,turvalisus,turve,polkit,policykit,parool
X-KDE-Keywords[fi]=järjestelmä,käytäntö,käytännöt,käytänne,käytänteet,menettelytapa,menettelytavat,turvallisuus,polkit,policykit,salasana,system,policy,policies,security,password
X-KDE-Keywords[fr]=système, stratégie, stratégies, sécurité, polkit, PolicyKit, mot de passe
X-KDE-Keywords[gl]=sistema,política,política,norma,normas,comportamento,seguranza,seguridade,polkit,policykit,contrasinal,contrasinais
X-KDE-Keywords[hu]=rendszer,házirend,házirendek,biztonság,polkit,policykit,jelszó
X-KDE-Keywords[it]=sistema,politica,politiche,sicurezza,polkit,policykit,password
X-KDE-Keywords[kk]=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[km]= polkit policykit
X-KDE-Keywords[ko]=system,policy,policies,security,polkit,policykit,password,,,
X-KDE-Keywords[lt]=system,policy,policies,security,polkit,policykit,password,sistema,taisyklės,saugumas,slaptažodžiai
X-KDE-Keywords[nb]=system,praksis,sikkerhet,polkit,praksis-sett,passord
X-KDE-Keywords[nds]=Systeem,Regel,Regeln,Sekerheit,Polkit,Policykit,Passwoort
X-KDE-Keywords[nl]=systeem,beleid,beleidsregels,beveiliging,polkit,policykit,wachtwoord
X-KDE-Keywords[pa]=system,policy,policies,security,polkit,policykit,password,,ਿ,ਿ,-ਿ,,ਿ,ਿ
X-KDE-Keywords[pl]=system,polityka,polityki,bezpieczeństwo,polkit,policykit,hasło
X-KDE-Keywords[pt]=sistema,política,políticas,segurança,polkit,policykit,senha
X-KDE-Keywords[pt_BR]=sistema,política,políticas,segurança,polkit,policykit,senha
X-KDE-Keywords[ru]=system,policy,policies,security,polkit,policykit,password,система,политика,безопасность,пароль
X-KDE-Keywords[sk]=systém,politika,politiky,bezpečnosť,polkit,policykit,heslo
X-KDE-Keywords[sl]=sistem,pravilnik,pravilniki,varnost,polkit,policykit,geslo
X-KDE-Keywords[sr]=system,policy,policies,security,polkit,policykit,password,систем,смернице,безбедност,Полисикит,лозинка
X-KDE-Keywords[sr@ijekavian]=system,policy,policies,security,polkit,policykit,password,систем,смернице,безбедност,Полисикит,лозинка
X-KDE-Keywords[sr@ijekavianlatin]=system,policy,policies,security,polkit,policykit,password,sistem,smernice,bezbednost,PolicyKit,lozinka
X-KDE-Keywords[sr@latin]=system,policy,policies,security,polkit,policykit,password,sistem,smernice,bezbednost,PolicyKit,lozinka
X-KDE-Keywords[sv]=system,policy,säkerhet,polkit,policykit,lösenord
X-KDE-Keywords[tr]=sistem,politika,politikalar,güvenlik,polkit,policykit,parola
X-KDE-Keywords[uk]=system,policy,policies,security,polkit,policykit,password,система,правило,правила,безпека,пароль,паролі
X-KDE-Keywords[vi]=system,policy,policies,security,polkit,policykit,password,h thng,mt khu,chính sách,bo mt,mt khu
X-KDE-Keywords[x-test]=xxsystemxx,xxpolicyxx,xxpoliciesxx,xxsecurityxx,xxpolkitxx,xxpolicykitxx,xxpasswordxx
X-KDE-Keywords[zh_CN]=system,policy,policies,security,polkit,policykit,password,,,,
X-KDE-Keywords[zh_TW]=system,policy,policies,security,polkit,policykit,password

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PolkitActionsMainView</class>
<widget class="QWidget" name="PolkitActionsMainView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<height>526</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KLineEdit" name="searchLine"/>
</item>
<item>
<widget class="QTreeView" name="treeView"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Pick an action on the right</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,228 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Alessandro Diaferia <alediaferia@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "pkitemdelegate.h"
#include "PoliciesModel.h"
#include <QStyleOptionViewItemV4>
#include <QPainter>
#include <QApplication>
#include <QFontMetrics>
#include <KIcon>
#include <KGlobalSettings>
#include <KDebug>
const int ITEM_ROW_HEIGHT = 32;
const int GROUP_ROW_HEIGHT = 22;
const int ICON_SIZE = 22;
const int MARGIN = 1;
namespace PolkitKde {
PkItemDelegate::PkItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
{}
PkItemDelegate::~PkItemDelegate()
{}
void PkItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QStyleOptionViewItemV4 opt(option);
const int gHeight = (opt.rect.height() > GROUP_ROW_HEIGHT) ? opt.rect.height() : GROUP_ROW_HEIGHT;
const int iHeight = (opt.rect.height() > ITEM_ROW_HEIGHT) ? opt.rect.height() : ITEM_ROW_HEIGHT;
const int ROW_HEIGHT = index.data(PolkitKde::PoliciesModel::IsGroupRole).toBool() ? gHeight : iHeight;
QStyle *style = QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
QPixmap pixmap(opt.rect.size());
pixmap.fill(Qt::transparent);
QPainter p(&pixmap);
p.translate(-opt.rect.topLeft());
QRect clipRect(opt.rect);
p.setClipRect(clipRect);
// here we draw the icon
KIcon icon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole)));
QIcon::Mode iconMode = QIcon::Normal;
if (opt.state & QStyle::State_MouseOver) {
iconMode = QIcon::Active;
}
QRect iconRect(opt.rect.topLeft(), QSize(ICON_SIZE, ICON_SIZE));
const QRect iconPlaceRect(opt.rect.topLeft(), QSize(ROW_HEIGHT, ROW_HEIGHT));
iconRect.moveCenter(iconPlaceRect.center());
icon.paint(&p, iconRect, Qt::AlignCenter, iconMode);
QColor foregroundColor = (opt.state.testFlag(QStyle::State_Selected)) ?
opt.palette.color(QPalette::HighlightedText) : opt.palette.color(QPalette::Text);
p.setPen(foregroundColor);
// here we draw the action description
clipRect.setSize(QSize(opt.rect.width() - ROW_HEIGHT - MARGIN, ROW_HEIGHT / 2));
clipRect.translate(ROW_HEIGHT + MARGIN, 0);
p.setClipRect(clipRect);
QFont descriptionFont = opt.font;
if (index.model()->hasChildren(index)) {
descriptionFont.setBold(true);
}
descriptionFont.setPointSize(descriptionFont.pointSize());
p.setFont(descriptionFont);
// let's differ groups from items
if (index.data(PolkitKde::PoliciesModel::IsGroupRole).toBool()) { // it is a group item
clipRect.setSize(QSize(clipRect.width(), GROUP_ROW_HEIGHT));
p.setClipRect(clipRect);
p.drawText(clipRect, Qt::AlignLeft | Qt::AlignVCenter, index.data(Qt::DisplayRole).toString());
} else { // it is a normal item
p.drawText(clipRect, Qt::AlignLeft | Qt::AlignBottom, index.data(Qt::DisplayRole).toString());
// here we draw the action raw name
clipRect.translate(0, qApp->fontMetrics().height());
p.setClipRect(clipRect);
QFont actionNameFont = KGlobalSettings::smallestReadableFont();
actionNameFont.setItalic(true);
p.setFont(actionNameFont);
p.drawText(clipRect, Qt::AlignLeft | Qt::AlignVCenter, index.data(PolkitKde::PoliciesModel::PathRole).toString());
}
p.end();
painter->drawPixmap(opt.rect.topLeft(), pixmap);
}
QSize PkItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QFont dFont = option.font;
const QFont rFont = KGlobalSettings::smallestReadableFont();
QFontMetrics d_fm(dFont); // description font
QFontMetrics r_fm(rFont); // raw string font
// PolkitKde::AuthorizationsModel::EntryType type = (PolkitKde::AuthorizationsModel::EntryType)index.data(PolkitKde::AuthorizationsModel::Entry48Role).toInt();
if (index.data(PolkitKde::PoliciesModel::IsGroupRole).toBool()) {
dFont.setBold(true);
d_fm = QFontMetrics(dFont);
return QSize(qMax(d_fm.width(index.data(Qt::DisplayRole).toString()),
d_fm.width(index.data(PolkitKde::PoliciesModel::PathRole).toString())),
qMax(GROUP_ROW_HEIGHT, d_fm.height()));
}
return QSize(qMax(d_fm.width(index.data(Qt::DisplayRole).toString()),
d_fm.width(index.data(PolkitKde::PoliciesModel::PathRole).toString())),
qMax(ITEM_ROW_HEIGHT, d_fm.height() + r_fm.height()));
}
/////////////////////////////
PKLAItemDelegate::PKLAItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
, m_passwordIcon("dialog-password")
{
}
PKLAItemDelegate::~PKLAItemDelegate()
{}
void PKLAItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QStyleOptionViewItemV4 opt(option);
QStyle *style = QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
QPixmap pixmap(opt.rect.size());
pixmap.fill(Qt::transparent);
QPainter p(&pixmap);
p.translate(-opt.rect.topLeft());
QRect clipRect(opt.rect);
p.setClipRect(clipRect);
QIcon::Mode iconMode = QIcon::Normal;
if (opt.state & QStyle::State_MouseOver) {
iconMode = QIcon::Active;
}
const int height = (opt.rect.height() > ITEM_ROW_HEIGHT) ? opt.rect.height() : ITEM_ROW_HEIGHT;
QRect iconRect(opt.rect.topLeft(), QSize(ICON_SIZE, ICON_SIZE));
const QRect iconPlaceRect(opt.rect.topLeft(), QSize(height, height));
iconRect.moveCenter(iconPlaceRect.center());
m_passwordIcon.paint(&p, iconRect, Qt::AlignCenter, iconMode);
QColor foregroundColor = (opt.state.testFlag(QStyle::State_Selected)) ?
opt.palette.color(QPalette::HighlightedText) : opt.palette.color(QPalette::Text);
p.setPen(foregroundColor);
// here we draw the action description
clipRect.setSize(QSize(opt.rect.width() - height - MARGIN, height / 2));
clipRect.translate(height + MARGIN, 0);
p.setClipRect(clipRect);
QFont descriptionFont = opt.font;
if (index.model()->hasChildren(index)) {
descriptionFont.setBold(true);
}
descriptionFont.setPointSize(descriptionFont.pointSize());
p.setFont(descriptionFont);
p.drawText(clipRect, Qt::AlignLeft | Qt::AlignBottom, index.data(Qt::DisplayRole).toString());
// here we draw the action raw name
clipRect.translate(0, qApp->fontMetrics().height());
p.setClipRect(clipRect);
QFont actionNameFont = KGlobalSettings::smallestReadableFont();
actionNameFont.setItalic(true);
p.setFont(actionNameFont);
p.drawText(clipRect, Qt::AlignLeft | Qt::AlignVCenter, index.data(Qt::UserRole).toString());
p.end();
painter->drawPixmap(opt.rect.topLeft(), pixmap);
}
QSize PKLAItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QFont dFont = option.font;
const QFont rFont = KGlobalSettings::smallestReadableFont();
QFontMetrics d_fm(dFont); // description font
QFontMetrics r_fm(rFont); // raw string font
return QSize(qMax(d_fm.width(index.data(Qt::DisplayRole).toString()),
d_fm.width(index.data(PolkitKde::PoliciesModel::PathRole).toString())),
qMax(ITEM_ROW_HEIGHT, d_fm.height() + r_fm.height()));
}
}

View file

@ -1,60 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Alessandro Diaferia <alediaferia@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PKITEMDELEGATE_H
#define PKITEMDELEGATE_H
#include <QStyledItemDelegate>
#include <KIcon>
#include <QStyleOptionViewItem>
namespace PolkitKde {
class PkItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PkItemDelegate(QObject *parent = 0);
~PkItemDelegate();
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
class PKLAItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PKLAItemDelegate(QObject *parent = 0);
~PKLAItemDelegate();
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
KIcon m_passwordIcon;
};
}
#endif

View file

@ -1,26 +0,0 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
set( kcm_polkitconfig_SRCS
kcmpolkitconfig.cpp
)
kde4_add_plugin(kcm_polkitconfig ${kcm_polkitconfig_SRCS})
target_link_libraries(kcm_polkitconfig
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBRARY}
polkitkdekcmodulesprivate
)
########### install files ###############
install(
TARGETS kcm_polkitconfig
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
install(
FILES kcm_polkitconfig.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)

View file

@ -1,4 +0,0 @@
#! /bin/sh
$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/kcm_polkitconfig.pot
rm -f rc.cpp

View file

@ -1,147 +0,0 @@
[Desktop Entry]
Exec=kcmshell4 kcm_polkitconfig
Icon=system-lock-screen
Type=Service
X-KDE-ServiceTypes=KCModule
#X-DocPath=kcontrol/powerdevil/index.html
X-KDE-Library=kcm_polkitconfig
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=system-administration
Name=Global Policy Configuration
Name[ar]=ضبط السياسة العامة
Name[bs]=Globalna postavka pravila
Name[ca]=Configuració de la política global
Name[ca@valencia]=Configuració de la política global
Name[cs]=Nastavení globálních pravidel
Name[da]=Konfiguration af global politik
Name[de]=Allgemeine Berechtigungseinstellung
Name[el]=Καθολική διαμόρφωση πολιτικών
Name[en_GB]=Global Policy Configuration
Name[es]=Configuración de políticas global
Name[et]=Reeglite globaalne seadistamine
Name[fi]=Yleiset käytäntöasetukset
Name[fr]=Configuration globale des stratégies
Name[gl]=Configuración da política global
Name[hr]=Konfiguracija globalnih pravila
Name[hu]=Globális házirend-beállítások
Name[it]=Configurazione delle politiche globali
Name[kk]=Жалпы жүйелік саясатын баптау
Name[km]=
Name[ko]=
Name[lt]=Globalių taisyklių konfigūracija
Name[mr]=ि
Name[nb]=Globalt praksisoppsett
Name[nds]=Globaal Regeln instellen
Name[nl]=Configuratie voor globaal beleid
Name[pa]=
Name[pl]=Konfiguracja polityki globalnej
Name[pt]=Configuração da Política Global
Name[pt_BR]=Configuração da política global
Name[ro]=Configurare de politică globală
Name[ru]=Настройка общей политики
Name[sk]=Globálne nastavenie politiky
Name[sl]=Nastavitev splošnih pravilnikov
Name[sr]=Подешавање глобалних смерница
Name[sr@ijekavian]=Подешавање глобалних смјерница
Name[sr@ijekavianlatin]=Podešavanje globalnih smjernica
Name[sr@latin]=Podešavanje globalnih smernica
Name[sv]=Inställning av global policy
Name[tr]=Genel Politika Yapılandırması
Name[uk]=Налаштування загальних правил доступу
Name[vi]=Cu hình chính sách toàn h thng
Name[x-test]=xxGlobal Policy Configurationxx
Name[zh_CN]=
Name[zh_TW]=
Comment=Configure global settings for system policies
Comment[ar]=ضبط الإعدادات العامة لسياسات النظام
Comment[bs]=Postavi globalne postavke za sistemska pravila
Comment[ca]=Configura l'arranjament global de les polítiques del sistema
Comment[ca@valencia]=Configura l'arranjament global de les polítiques del sistema
Comment[cs]=Nastavit globální nastavení pro pravidla systému
Comment[da]=Sæt globale indstillinger for systempolitikker
Comment[de]=Allgemeine Einstellungen für Systemberechtigungen festlegen
Comment[el]=Διαμόρφωση των καθολικών επιλογών στις πολιτικές του συστήματος
Comment[en_GB]=Configure global settings for system policies
Comment[es]=Configurar las preferencias globales de las políticas del sistema
Comment[et]=Süsteemi reeglite globaalne seadistamine
Comment[fi]=Järjestelmäkäytäntöjen yleisasetukset
Comment[fr]=Configure les paramètres globaux des stratégies système
Comment[gl]=Configurar as opcións globais das políticas do sistema.
Comment[hr]=Podesite globalne postavke za pravila sustava
Comment[hu]=A rendszerházirendek globális beállításainak megadása
Comment[it]=Configura le impostazione globali delle politiche di sistema
Comment[kk]=Жүйелік саясаттарының жалпы жүйелік параметрлерін баптау
Comment[km]=
Comment[ko]=
Comment[lt]=Keisti sistemos taisyklių globalius nustatymus
Comment[lv]=Konfigurēt sistēmas politiku globālos iestatījumus
Comment[nb]=Sett opp globale innstillinger for systempraksis
Comment[nds]=Globaal Instellen för Systeemregeln fastleggen
Comment[nl]=Globale instellingen voor systeembeleid configureren
Comment[pa]=ਿ ਿ
Comment[pl]=Konfiguruj globalne ustawienia dla polityki systemu
Comment[pt]=Configurar as opções globais das políticas do sistema
Comment[pt_BR]=Configura as opções globais para as políticas do sistema
Comment[ro]=Configurează parametrii globali pentru politici de sistem
Comment[ru]=Настройка общих параметров политики безопасности системы
Comment[sk]=Nastaviť globálne nastavenia pre systémové politiky
Comment[sl]=Splošne nastavitve za sistemske pravilnike
Comment[sr]=Подеси глобалне поставке системских смерница
Comment[sr@ijekavian]=Подеси глобалне поставке системских смјерница
Comment[sr@ijekavianlatin]=Podesi globalne postavke sistemskih smjernica
Comment[sr@latin]=Podesi globalne postavke sistemskih smernica
Comment[sv]=Anpassa globala inställningar av systempolicy
Comment[th]=
Comment[tr]=Sistem politikaları için genel ayarları yapılandır
Comment[uk]=Налаштування загальних параметрів системних правил доступу
Comment[vi]=Cu hình thiết lp toàn h thng chính sách
Comment[x-test]=xxConfigure global settings for system policiesxx
Comment[zh_CN]=
Comment[zh_TW]=
X-KDE-Keywords=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[ar]=نظام,سياسة,سياسات,أمن, polkit, policykit,كلمة السر
X-KDE-Keywords[bs]=sistem,pravilo,pravila,sigurnost,polkit,lozinka
X-KDE-Keywords[ca]=sistema,política,polítiques,seguretat,polkit,policykit,contrasenya
X-KDE-Keywords[ca@valencia]=sistema,política,polítiques,seguretat,polkit,policykit,contrasenya
X-KDE-Keywords[cs]=systém,pravidlo,pravidla,bezpečnost,polkit,policykit,heslo
X-KDE-Keywords[da]=system,politik,politikker,sikkerhed,polkit,policykit,adgangskode
X-KDE-Keywords[de]=System,Berechtigung,Berechtigungen,Sicherheit,Polkit,Policykit,Passwort
X-KDE-Keywords[el]=σύστημα,πολιτική,πολιτικές,ασφάλεια,polkit,policykit,password
X-KDE-Keywords[en_GB]=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[es]=sistema,política,políticas,seguridad,polkit,policykit,contraseña
X-KDE-Keywords[et]=süsteem,reegel,reeglid,turvalisus,turve,polkit,policykit,parool
X-KDE-Keywords[fi]=järjestelmä,käytäntö,käytännöt,käytänne,käytänteet,menettelytapa,menettelytavat,turvallisuus,polkit,policykit,salasana,system,policy,policies,security,password
X-KDE-Keywords[fr]=système, stratégie, stratégies, sécurité, polkit, PolicyKit, mot de passe
X-KDE-Keywords[gl]=sistema,política,política,norma,normas,comportamento,seguranza,seguridade,polkit,policykit,contrasinal,contrasinais
X-KDE-Keywords[hu]=rendszer,házirend,házirendek,biztonság,polkit,policykit,jelszó
X-KDE-Keywords[it]=sistema,politica,politiche,sicurezza,polkit,policykit,password
X-KDE-Keywords[kk]=system,policy,policies,security,polkit,policykit,password
X-KDE-Keywords[km]= polkit policykit
X-KDE-Keywords[ko]=system,policy,policies,security,polkit,policykit,password,,,
X-KDE-Keywords[lt]=system,policy,policies,security,polkit,policykit,password,sistema,taisyklės,saugumas,slaptažodžiai
X-KDE-Keywords[nb]=system,praksis,sikkerhet,polkit,praksis-sett,passord
X-KDE-Keywords[nds]=Systeem,Regel,Regeln,Sekerheit,Polkit,Policykit,Passwoort
X-KDE-Keywords[nl]=systeem,beleid,beleidsregels,beveiliging,polkit,policykit,wachtwoord
X-KDE-Keywords[pa]=system,policy,policies,security,polkit,policykit,password,,ਿ,ਿ,-ਿ,,ਿ,ਿ
X-KDE-Keywords[pl]=system,polityka,polityki,bezpieczeństwo,polkit,policykit,hasło
X-KDE-Keywords[pt]=sistema,política,políticas,segurança,polkit,policykit,senha
X-KDE-Keywords[pt_BR]=sistema,política,políticas,segurança,polkit,policykit,senha
X-KDE-Keywords[ru]=system,policy,policies,security,polkit,policykit,password,система,политика,безопасность,пароль
X-KDE-Keywords[sk]=systém,politika,politiky,bezpečnosť,polkit,policykit,heslo
X-KDE-Keywords[sl]=sistem,pravilnik,pravilniki,varnost,polkit,policykit,geslo
X-KDE-Keywords[sr]=system,policy,policies,security,polkit,policykit,password,систем,смернице,безбедност,Полисикит,лозинка
X-KDE-Keywords[sr@ijekavian]=system,policy,policies,security,polkit,policykit,password,систем,смернице,безбедност,Полисикит,лозинка
X-KDE-Keywords[sr@ijekavianlatin]=system,policy,policies,security,polkit,policykit,password,sistem,smernice,bezbednost,PolicyKit,lozinka
X-KDE-Keywords[sr@latin]=system,policy,policies,security,polkit,policykit,password,sistem,smernice,bezbednost,PolicyKit,lozinka
X-KDE-Keywords[sv]=system,policy,säkerhet,polkit,policykit,lösenord
X-KDE-Keywords[tr]=sistem,politika,politikalar,güvenlik,polkit,policykit,parola
X-KDE-Keywords[uk]=system,policy,policies,security,polkit,policykit,password,система,правило,правила,безпека,пароль,паролі
X-KDE-Keywords[vi]=system,policy,policies,security,polkit,policykit,password,h thng,mt khu,chính sách,bo mt,mt khu
X-KDE-Keywords[x-test]=xxsystemxx,xxpolicyxx,xxpoliciesxx,xxsecurityxx,xxpolkitxx,xxpolicykitxx,xxpasswordxx
X-KDE-Keywords[zh_CN]=system,policy,policies,security,polkit,policykit,password,,,,
X-KDE-Keywords[zh_TW]=system,policy,policies,security,polkit,policykit,password

View file

@ -1,189 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "kcmpolkitconfig.h"
#include "ui_polkitconfig.h"
#include <KPluginFactory>
#include <KAboutData>
#include <klocalizedstring.h>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusConnectionInterface>
#include <qsettings.h>
#include <qfileinfo.h>
#include <qdir.h>
#include <qlayoutitem.h>
#include "identitywidget.h"
#include <KDebug>
K_PLUGIN_FACTORY(KCMPolkitConfigFactory,
registerPlugin<KCMPolkitConfig>();
)
K_EXPORT_PLUGIN(KCMPolkitConfigFactory("kcm_polkitconfig"))
KCMPolkitConfig::KCMPolkitConfig(QWidget* parent, const QVariantList& args)
: KCModule(KCMPolkitConfigFactory::componentData(), parent, args)
{
KAboutData *about =
new KAboutData("kcm_polkitconfig", "kcm_polkitconfig", ki18n("Global system policy settings"),
"1.0.0", ki18n("A configuration for polkit-1 system administrators and policy priorities"),
KAboutData::License_GPL, ki18n("(c), 2009 Dario Freddi"),
ki18n("From this module, you can configure system administrators and priorities "
"for the policies defined in the Actions module"));
about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org",
"http://drfav.wordpress.com");
setAboutData(about);
m_ui = new Ui::PolkitConfig;
m_ui->setupUi(this);
m_ui->warningTextLabel->setVisible(false);
m_ui->warningPixmapLabel->setVisible(false);
m_ui->addIdentityButton->setIcon(KIcon("list-add"));
m_identitiesLayout = new QVBoxLayout;
m_identitiesLayout->addStretch();
m_ui->scrollAreaWidgetContents->setLayout(m_identitiesLayout);
connect(m_ui->addIdentityButton, SIGNAL(clicked(bool)),
this, SLOT(addNewIdentity()));
connect(m_ui->configPrioritySpin, SIGNAL(valueChanged(int)),
this, SLOT(changed()));
connect(m_ui->policyPrioritySpin, SIGNAL(valueChanged(int)),
this, SLOT(changed()));
}
KCMPolkitConfig::~KCMPolkitConfig()
{
delete m_ui;
}
void KCMPolkitConfig::defaults()
{
}
void KCMPolkitConfig::load()
{
// Load the first tab
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
int priority = settings.value("General/ConfigPriority", 75).toInt();
int highestPriority = -1;
QString highestFilename;
QDir dir("/etc/polkit-1/localauthority.conf.d/");
dir.setFilter(QDir::Files);
QFileInfoList infolist = dir.entryInfoList();
foreach (const QFileInfo &finfo, infolist) {
int fpriority = finfo.baseName().split('-').first().toInt();
kDebug() << "Considering " << finfo.absoluteFilePath() << " which should have priority "<< fpriority;
if (fpriority > highestPriority) {
kDebug() << "Setting it as highest priority";
highestPriority = fpriority;
highestFilename = finfo.absoluteFilePath();
}
}
if (highestPriority > priority) {
kDebug() << "Highest priority is " << highestPriority << ", polkit kde priority is " << priority;
m_ui->warningTextLabel->setText(i18n("The changes will have no effect, since another policy has an higher priority "
"(%1). Please change the priority of policies defined through this module to an "
"higher value.", highestPriority));
m_ui->warningTextLabel->setVisible(true);
m_ui->warningPixmapLabel->setPixmap(KIcon("dialog-warning").pixmap(48));
m_ui->warningPixmapLabel->setVisible(true);
}
kDebug() << "The highest filename is " << highestFilename;
QFile policyFile(highestFilename);
policyFile.open(QIODevice::ReadOnly | QIODevice::Text);
QString identities = QString(policyFile.readAll()).split("AdminIdentities=").last();
identities = identities.split('\n').first();
policyFile.close();
kDebug() << "our identities are " << identities;
foreach (const QString &identity, identities.split(';')) {
IdentityWidget::IdentityType type;
if (identity.split(':').first() == "unix-user") {
type = IdentityWidget::UserIdentity;
kDebug() << "It's an user";
} else {
type = IdentityWidget::GroupIdentity;
kDebug() << "It's a group";
}
QString name = identity.split(':').last();
IdentityWidget *iw = new IdentityWidget(type, name);
m_identitiesLayout->insertWidget(m_identitiesLayout->count() - 1, iw);
connect(iw, SIGNAL(changed()), this, SLOT(changed()));
}
// Set up the other tab
m_ui->configPrioritySpin->setValue(priority);
m_ui->policyPrioritySpin->setValue(settings.value("General/PoliciesPriority", 75).toInt());
}
void KCMPolkitConfig::save()
{
// Get back all the identities first
QString identities;
for (int i = 0; i < m_identitiesLayout->count(); ++i) {
QLayoutItem *item = m_identitiesLayout->itemAt(i);
if (item != 0) {
QWidget *widget = item->widget();
if (widget != 0) {
IdentityWidget *identityWidget = qobject_cast< IdentityWidget* >(widget);
if (identityWidget != 0) {
// Whew, let's add it
if (identityWidget->identityType() == IdentityWidget::UserIdentity) {
identities.append("unix-user:");
} else {
identities.append("unix-group:");
}
identities.append(identityWidget->identityName());
identities.append(';');
}
}
}
}
if (!identities.isEmpty()) {
identities.remove(identities.length() - 1, 1);
}
kDebug() << "Identities to save: " << identities;
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.polkitkde1.helper",
"/Helper",
"org.kde.polkitkde1.helper",
QLatin1String("saveGlobalConfiguration"));
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(identities);
argumentList << QVariant::fromValue(m_ui->configPrioritySpin->value());
argumentList << QVariant::fromValue(m_ui->policyPrioritySpin->value());
message.setArguments(argumentList);
QDBusPendingCall reply = QDBusConnection::systemBus().asyncCall(message);
}
void KCMPolkitConfig::addNewIdentity()
{
IdentityWidget *iw = new IdentityWidget();
m_identitiesLayout->insertWidget(m_identitiesLayout->count() - 1, iw);
connect(iw, SIGNAL(changed()), this, SLOT(changed()));
changed();
}

View file

@ -1,43 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2009 Dario Freddi <drf@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef KCMPOLKITCONFIG_H
#define KCMPOLKITCONFIG_H
#include <kcmodule.h>
#include <QVBoxLayout>
QT_BEGIN_NAMESPACE
namespace Ui {
class PolkitConfig;
}
QT_END_NAMESPACE
class KCMPolkitConfig : public KCModule
{
Q_OBJECT
public:
KCMPolkitConfig(QWidget* parent, const QVariantList& args);
virtual ~KCMPolkitConfig();
virtual void defaults();
virtual void load();
virtual void save();
private slots:
void addNewIdentity();
private:
Ui::PolkitConfig *m_ui;
QVBoxLayout *m_identitiesLayout;
};
#endif // KCMPOLKITCONFIG_H

View file

@ -1,184 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PolkitConfig</class>
<widget class="QWidget" name="PolkitConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>518</width>
<height>321</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KTabWidget" name="ktabwidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>System settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="warningPixmapLabel">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="warningTextLabel">
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>System administrators</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>144</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="addIdentityButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Configuration priority</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>System configuration priority</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="configPrioritySpin">
<property name="singleStep">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Policy setting priority</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KIntSpinBox" name="policyPrioritySpin">
<property name="singleStep">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;i&gt;Please note that 0 is the lowest priority, whereas 99 is the highest.&lt;/i&gt;</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KTabWidget</class>
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,57 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=SystemSettingsCategory
X-KDE-System-Settings-Category=system-policies
X-KDE-System-Settings-Parent-Category=system-administration
Icon=preferences-desktop-user-password
Name=System policies
Name[ar]=سياسات النظام
Name[ast]=Polítiques del sistema
Name[bs]=Sistemska pravila
Name[ca]=Polítiques del sistema
Name[ca@valencia]=Polítiques del sistema
Name[cs]=Pravidla systému
Name[da]=Systempolitikker
Name[de]=Systemberechtigungen
Name[el]=Πολιτικές συστήματος
Name[en_GB]=System policies
Name[es]=Políticas del sistema
Name[et]=Süsteemi reeglid
Name[fi]=Järjestelmäkäytännöt
Name[fr]=Stratégies système
Name[ga]=Polasaithe an chórais
Name[gl]=Políticas do sistema
Name[hr]=Pravila sustava
Name[hu]=Rendszerházirendek
Name[it]=Politiche di sistema
Name[kk]=Жүйелік саясаттары
Name[km]=
Name[ko]=
Name[lt]=Sistemos taisyklės
Name[lv]=Sistēmas politikas
Name[mr]=
Name[nb]=Systempraksis
Name[nds]=Systeemregeln
Name[nl]=Systeembeleid
Name[pa]=ਿ
Name[pl]=Polityka systemu
Name[pt]=Políticas do sistema
Name[pt_BR]=Políticas do sistema
Name[ro]=Politici de sistem
Name[ru]=Политика безопасности системы
Name[sk]=Systémové politiky
Name[sl]=Sistemski pravilniki
Name[sr]=Системске смернице
Name[sr@ijekavian]=Системске смјернице
Name[sr@ijekavianlatin]=Sistemske smjernice
Name[sr@latin]=Sistemske smernice
Name[sv]=Systempolicy
Name[th]=
Name[tr]=Sistem politikaları
Name[ug]=سىستېما سىياسىتى
Name[uk]=Системні правила доступу
Name[vi]=Chính sách h thng
Name[x-test]=xxSystem policiesxx
Name[zh_CN]=
Name[zh_TW]=