[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/base/polkit-kde-1/kcmodules
From: Dario Freddi <drf () kde ! org>
Date: 2010-02-22 21:35:48
Message-ID: 1266874548.396580.14008.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1094513 by dafre:
Basically working. Marshalling is missing, but I won't do it now as I will port the \
whole thing to KAuth soon (where possible), and hence will do the marshalling with \
QDataStream
Signed-off-by: Dario Freddi <drf@kde.org>
M +4 -0 helper/org.kde.polkitkde1.helper.xml
M +20 -0 polkitactions/ActionWidget.cpp
M +5 -0 polkitactions/ActionWidget.h
M +22 -1 polkitactions/PolkitActionsKCM.cpp
--- trunk/extragear/base/polkit-kde-1/kcmodules/helper/org.kde.polkitkde1.helper.xml \
#1094512:1094513 @@ -11,6 +11,10 @@
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" \
value="QVariantList"/> <arg direction="out" type="av" />
</method>
+ <method name="writePolicy" >
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In0" \
value="QVariantList"/> + <arg direction="in" type="av" />
+ </method>
</interface>
</node>
\ No newline at end of file
--- trunk/extragear/base/polkit-kde-1/kcmodules/polkitactions/ActionWidget.cpp \
#1094512:1094513 @@ -47,6 +47,7 @@
setAction(action);
m_ui->localAuthListWidget->setItemDelegate(new PKLAItemDelegate);
+
connect(m_ui->localAuthListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this, SLOT(editExplicitPKLAEntry(QListWidgetItem*)));
connect(m_ui->localAuthListWidget, \
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), @@ -59,6 +60,12 @@
this, SLOT(movePKLADown()));
connect(m_ui->moveUpButton, SIGNAL(clicked(bool)),
this, SLOT(movePKLAUp()));
+ connect(m_ui->anyComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SIGNAL(changed()));
+ connect(m_ui->inactiveComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SIGNAL(changed()));
+ connect(m_ui->activeComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SIGNAL(changed()));
}
ActionWidget::~ActionWidget()
@@ -304,6 +311,8 @@
m_entries.append(toInsert);
kDebug() << "Inserting entry named " << toInsert.title << " for " << \
toInsert.action;
+ emit changed();
+
// And reload the policies
computeActionPolicies();
}
@@ -325,6 +334,8 @@
}
}
+ emit changed();
+
// Reload
computeActionPolicies();
}
@@ -367,6 +378,8 @@
}
}
+ emit changed();
+
// Reload
computeActionPolicies();
}
@@ -393,8 +406,15 @@
}
}
+ emit changed();
+
// Reload
computeActionPolicies();
}
+PKLAEntryList ActionWidget::entries() const
+{
+ return m_entries;
}
+
+}
--- trunk/extragear/base/polkit-kde-1/kcmodules/polkitactions/ActionWidget.h \
#1094512:1094513 @@ -33,6 +33,8 @@
static int comboBoxIndexFor(PolkitQt1::ActionDescription::ImplicitAuthorization \
auth);
static PolkitQt1::ActionDescription::ImplicitAuthorization \
implicitAuthorizationFor(int comboBoxIndex);
+ PKLAEntryList entries() const;
+
public Q_SLOTS:
void setAction(PolkitQt1::ActionDescription *action);
void computeActionPolicies();
@@ -46,6 +48,9 @@
void explicitSelectionChanged(QListWidgetItem *current,QListWidgetItem*);
void removePKLAEntry();
+ Q_SIGNALS:
+ void changed();
+
private:
void setImplicitAuthorization(PolkitQt1::ActionDescription::ImplicitAuthorization \
auth, QComboBox *box); void addNewPKLAEntry(const PKLAEntry &entry);
--- trunk/extragear/base/polkit-kde-1/kcmodules/polkitactions/PolkitActionsKCM.cpp \
#1094512:1094513 @@ -21,6 +21,9 @@
#include <QLayout>
#include "ActionWidget.h"
#include "PolicyItem.h"
+#include <QDBusMessage>
+#include <QDBusConnection>
+#include <qdbuspendingcall.h>
K_PLUGIN_FACTORY(KCMPolkitActionsFactory,
registerPlugin<PolkitActionsKCM>();
@@ -76,7 +79,24 @@
void PolkitActionsKCM::save()
{
- KCModule::save();
+ if (m_actionWidget.isNull()) {
+ return;
+ }
+
+ QDBusMessage message = \
QDBusMessage::createMethodCall("org.kde.polkitkde1.helper", + \
"/Helper", + \
"org.kde.polkitkde1.helper", + \
QLatin1String("writePolicy")); + QList<QVariant> argumentList;
+ QVariantList policies;
+ foreach (const PKLAEntry &entry, m_actionWidget.data()->entries()) {
+ policies << QVariant::fromValue(entry);
+ }
+ argumentList << policies;
+
+ message.setArguments(argumentList);
+
+ QDBusPendingCall reply = QDBusConnection::systemBus().asyncCall(message);
}
void PolkitActionsKCM::defaults()
@@ -101,6 +121,7 @@
layout()->takeAt(1)->widget()->deleteLater();
}
m_actionWidget = new PolkitKde::ActionWidget(action);
+ connect(m_actionWidget, SIGNAL(changed()), this, SLOT(changed()));
layout()->addWidget(m_actionWidget.data());
} else {
m_actionWidget.data()->setAction(action);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic