mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-24 02:42:51 +00:00
polkit-kde-kcmmodules-1: adjust to Katie changes
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
3c298dd37a
commit
9afa3f9dea
11 changed files with 37 additions and 18 deletions
|
@ -5,6 +5,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||||
find_package(KDE4 REQUIRED)
|
find_package(KDE4 REQUIRED)
|
||||||
include(KDE4Defaults)
|
include(KDE4Defaults)
|
||||||
|
|
||||||
|
include_directories(${KDE4_INCLUDES})
|
||||||
|
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
|
|
||||||
function(dbus_add_activation_system_service _sources)
|
function(dbus_add_activation_system_service _sources)
|
||||||
pkg_search_module( DBUS dbus-1 )
|
pkg_search_module( DBUS dbus-1 )
|
||||||
foreach (_i ${_sources})
|
foreach (_i ${_sources})
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include <kdemacros.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IdentityWidget;
|
class IdentityWidget;
|
||||||
}
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class KDE_EXPORT IdentityWidget : public QWidget
|
class KDE_EXPORT IdentityWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QTextCodec>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -41,7 +42,11 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings ini(argv[1], QSettings::IniFormat);
|
QSettings ini(argv[1], QSettings::IniFormat);
|
||||||
|
#ifndef QT_KATIE // Katie uses C-strings codec which is UTF-8
|
||||||
ini.setIniCodec("UTF-8");
|
ini.setIniCodec("UTF-8");
|
||||||
|
#else
|
||||||
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
#endif
|
||||||
if (ini.status()) {
|
if (ini.status()) {
|
||||||
qCritical("Error loading file: %s", argv[1]);
|
qCritical("Error loading file: %s", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -12,14 +12,15 @@
|
||||||
|
|
||||||
#include "helperadaptor.h"
|
#include "helperadaptor.h"
|
||||||
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtXml/QDomDocument>
|
#include <QtXml/QDomDocument>
|
||||||
|
|
||||||
#include <QtDBus/QDBusConnection>
|
#include <QtDBus/QDBusConnection>
|
||||||
|
|
||||||
#include <PolkitQt1/Authority>
|
#include <PolkitQt1/Authority>
|
||||||
#include <QDir>
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
bool orderByPriorityLessThan(const PKLAEntry &e1, const PKLAEntry &e2)
|
bool orderByPriorityLessThan(const PKLAEntry &e1, const PKLAEntry &e2)
|
||||||
|
@ -75,10 +76,9 @@ void PolkitKde1Helper::saveGlobalConfiguration(const QString& adminIdentities, i
|
||||||
|
|
||||||
// Ok, let's see what we have to save here.
|
// Ok, let's see what we have to save here.
|
||||||
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
||||||
kdesettings.beginGroup("General");
|
|
||||||
|
|
||||||
kdesettings.setValue("ConfigPriority", systemPriority);
|
kdesettings.setValue("General/ConfigPriority", systemPriority);
|
||||||
kdesettings.setValue("PoliciesPriority", policiesPriority);
|
kdesettings.setValue("General/PoliciesPriority", policiesPriority);
|
||||||
|
|
||||||
QString contents = QString("[Configuration]\nAdminIdentities=%1\n").arg(adminIdentities);
|
QString contents = QString("[Configuration]\nAdminIdentities=%1\n").arg(adminIdentities);
|
||||||
|
|
||||||
|
@ -316,10 +316,9 @@ void PolkitKde1Helper::writePolicy(const QList<PKLAEntry>& policy)
|
||||||
qSort(entries.begin(), entries.end(), orderByPriorityLessThan);
|
qSort(entries.begin(), entries.end(), orderByPriorityLessThan);
|
||||||
|
|
||||||
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
QSettings kdesettings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
||||||
kdesettings.beginGroup("General");
|
|
||||||
|
|
||||||
QString pathName = QString("/var/lib/polkit-1/localauthority/%1-polkitkde.d/")
|
QString pathName = QString("/var/lib/polkit-1/localauthority/%1-polkitkde.d/")
|
||||||
.arg(kdesettings.value("PoliciesPriority",75).toInt());
|
.arg(kdesettings.value("General/PoliciesPriority",75).toInt());
|
||||||
|
|
||||||
foreach(const PKLAEntry &entry, entries) {
|
foreach(const PKLAEntry &entry, entries) {
|
||||||
QString fullPath;
|
QString fullPath;
|
||||||
|
|
|
@ -339,8 +339,7 @@ void ActionWidget::addNewPKLAEntry(const PKLAEntry& entry)
|
||||||
PKLAEntry toInsert(entry);
|
PKLAEntry toInsert(entry);
|
||||||
// Match it to the current config value
|
// Match it to the current config value
|
||||||
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
||||||
settings.beginGroup("General");
|
toInsert.filePriority = settings.value("General/PoliciesPriority", 75).toInt();
|
||||||
toInsert.filePriority = settings.value("PoliciesPriority", 75).toInt();
|
|
||||||
|
|
||||||
// If there's no file order, append it to the end of the current entries
|
// If there's no file order, append it to the end of the current entries
|
||||||
if (toInsert.fileOrder < 0) {
|
if (toInsert.fileOrder < 0) {
|
||||||
|
|
|
@ -12,14 +12,18 @@
|
||||||
#define ACTIONWIDGET_H
|
#define ACTIONWIDGET_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include "PKLAEntry.h"
|
#include <QtGui/QListWidgetItem>
|
||||||
#include <PolkitQt1/ActionDescription>
|
#include <PolkitQt1/ActionDescription>
|
||||||
|
|
||||||
|
#include "PKLAEntry.h"
|
||||||
|
|
||||||
class KComboBox;
|
class KComboBox;
|
||||||
#include <QListWidgetItem>
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ActionWidget;
|
class ActionWidget;
|
||||||
}
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace PolkitKde {
|
namespace PolkitKde {
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ void PoliciesModel::insertOrUpdate(const QStringList &actionPath, const PolkitQt
|
||||||
QString path = actionPath.join(".");
|
QString path = actionPath.join(".");
|
||||||
PolicyItem *action = 0;
|
PolicyItem *action = 0;
|
||||||
for (int i = 0; i < parent->childCount(); i++) {
|
for (int i = 0; i < parent->childCount(); i++) {
|
||||||
if (!parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole)) {
|
if (!parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole).toString()) {
|
||||||
action = parent->child(i);
|
action = parent->child(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ void PoliciesModel::insertOrUpdate(const QStringList &actionPath, const PolkitQt
|
||||||
QString path = actionPath.at(level);
|
QString path = actionPath.at(level);
|
||||||
PolicyItem *group = 0;
|
PolicyItem *group = 0;
|
||||||
for (int i = 0; i < parent->childCount(); i++) {
|
for (int i = 0; i < parent->childCount(); i++) {
|
||||||
if (parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole)) {
|
if (parent->child(i)->isGroup() && path == parent->child(i)->data(PathRole).toString()) {
|
||||||
group = parent->child(i);
|
group = parent->child(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,19 @@
|
||||||
#include <kcmodule.h>
|
#include <kcmodule.h>
|
||||||
#include <PolkitQt1/Authority>
|
#include <PolkitQt1/Authority>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
#include <QtCore/QModelIndex>
|
||||||
|
|
||||||
#include <QModelIndex>
|
|
||||||
namespace PolkitKde {
|
namespace PolkitKde {
|
||||||
class PoliciesModel;
|
class PoliciesModel;
|
||||||
class AuthorizationsFilterModel;
|
class AuthorizationsFilterModel;
|
||||||
class ActionWidget;
|
class ActionWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PolkitActionsMainView;
|
class PolkitActionsMainView;
|
||||||
}
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class PolkitActionsKCM : public KCModule
|
class PolkitActionsKCM : public KCModule
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,13 +11,16 @@
|
||||||
#ifndef EXPLICITAUTHORIZATIONDIALOG_H
|
#ifndef EXPLICITAUTHORIZATIONDIALOG_H
|
||||||
#define EXPLICITAUTHORIZATIONDIALOG_H
|
#define EXPLICITAUTHORIZATIONDIALOG_H
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <KDialog>
|
#include <KDialog>
|
||||||
|
|
||||||
#include "PKLAEntry.h"
|
#include "PKLAEntry.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ExplicitAuthorizationWidget;
|
class ExplicitAuthorizationWidget;
|
||||||
}
|
}
|
||||||
#include <QVBoxLayout>
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace PolkitKde {
|
namespace PolkitKde {
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,8 @@ void KCMPolkitConfig::load()
|
||||||
{
|
{
|
||||||
// Load the first tab
|
// Load the first tab
|
||||||
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
QSettings settings("/etc/polkit-1/polkit-kde-1.conf", QSettings::IniFormat);
|
||||||
settings.beginGroup("General");
|
|
||||||
|
|
||||||
int priority = settings.value("ConfigPriority", 75).toInt();
|
int priority = settings.value("General/ConfigPriority", 75).toInt();
|
||||||
int highestPriority = -1;
|
int highestPriority = -1;
|
||||||
QString highestFilename;
|
QString highestFilename;
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ void KCMPolkitConfig::load()
|
||||||
|
|
||||||
// Set up the other tab
|
// Set up the other tab
|
||||||
m_ui->configPrioritySpin->setValue(priority);
|
m_ui->configPrioritySpin->setValue(priority);
|
||||||
m_ui->policyPrioritySpin->setValue(settings.value("PoliciesPriority", 75).toInt());
|
m_ui->policyPrioritySpin->setValue(settings.value("General/PoliciesPriority", 75).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void KCMPolkitConfig::save()
|
void KCMPolkitConfig::save()
|
||||||
|
|
|
@ -14,9 +14,12 @@
|
||||||
#include <kcmodule.h>
|
#include <kcmodule.h>
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PolkitConfig;
|
class PolkitConfig;
|
||||||
}
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class KCMPolkitConfig : public KCModule
|
class KCMPolkitConfig : public KCModule
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue