[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/PolicyKit-kde/authorization
From: Daniel Nicoletti <dantti85-kde () yahoo ! com ! br>
Date: 2008-11-30 20:13:42
Message-ID: 1228076022.845372.25596.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 890990 by dantti:
Reverted code to construction, and added first bits to string selection of item
M +24 -20 PkKAuthorization.cpp
M +14 -17 PkKAuthorizationDialog.cpp
--- trunk/playground/base/PolicyKit-kde/authorization/PkKAuthorization.cpp \
#890989:890990 @@ -30,14 +30,14 @@
#include <KDebug>
-namespace PolkitKde
-{
+namespace PolkitKde {
class PkKAuthorizationHelper
{
-public:
+ public:
PkKAuthorizationHelper() : q(0) {}
- ~PkKAuthorizationHelper() { delete q; }
+ // TODO this is causing a crash
+ ~PkKAuthorizationHelper() { /*delete q; */}
PkKAuthorization *q;
};
@@ -53,7 +53,7 @@
}
PkKAuthorization::PkKAuthorization(QWidget *parent)
- : QWidget(parent), m_displayingAction(false)
+: QWidget(parent), m_displayingAction(false)
{
Q_ASSERT(!s_globalAuthorizations->q);
s_globalAuthorizations->q = this;
@@ -71,8 +71,8 @@
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
treeView->setModel(m_proxyModel);
treeView->setItemDelegate(new PkItemDelegate(this));
- connect(treeView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, \
const QModelIndex &)),
- this, SLOT(actionClicked(const QModelIndex &)));
+ connect(treeView->selectionModel(), SIGNAL( currentChanged(const QModelIndex \
&,const QModelIndex &) ), + this, SLOT( actionClicked(const QModelIndex &) ) \
);
connect(searchLine, SIGNAL(textChanged(const QString&)), m_proxyModel, \
SLOT(setFilterRegExp(const QString&)));
@@ -90,7 +90,7 @@
void PkKAuthorization::actionClicked(const QModelIndex &index)
{
- if (m_model->entryType(index) == AuthorizationsModel::ActionEntry) {
+ if ( m_model->entryType(index) == AuthorizationsModel::ActionEntry) {
PolKitPolicyFileEntry *pfe = m_model->polkitFileEntry(index);
kDebug() << "PFE: " << pfe;
if (pfe) {
@@ -103,7 +103,8 @@
m_displayingAction = true;
}
}
- } else {
+ }
+ else {
m_displayingAction = false;
m_pkKAction->hide();
widget->layout()->addWidget(label);
@@ -113,7 +114,10 @@
void PkKAuthorization::newAction(QString action)
{
- qDebug() << action;
+ kDebug() << "action: " << action << " modelIndex: " << \
m_model->indexFromId(action); + QItemSelectionModel *selectionModel = \
treeView->selectionModel(); + \
selectionModel->setCurrentIndex(m_model->indexFromId(action), \
QItemSelectionModel::Select); + treeView->setSelectionModel(selectionModel);
}
polkit_bool_t
@@ -144,7 +148,7 @@
// kDebug() << "watchActivated" << fd;
- polkit_context_io_func(m_pkContext, fd);
+ polkit_context_io_func (m_pkContext, fd);
}
void PkKAuthorization::UpdateActionTree()
@@ -157,27 +161,27 @@
m_model->addEntries(pkPFileEntry);
//Re selects the current index so the action view is updated
- actionClicked(treeView->selectionModel()->currentIndex());
+ actionClicked( treeView->selectionModel()->currentIndex() );
}
void PkKAuthorization::PkKSetContext()
{
- m_pkContext = polkit_context_new();
+ m_pkContext = polkit_context_new ();
// needed to know about config changes
- polkit_context_set_io_watch_functions(m_pkContext, add_context_io_watch, \
remove_context_io_watch); + polkit_context_set_io_watch_functions (m_pkContext, \
add_context_io_watch, remove_context_io_watch); // needed to know about any change \
so we can update the ui
- polkit_context_set_config_changed(m_pkContext, polkit_config_changed, this);
+ polkit_context_set_config_changed (m_pkContext, polkit_config_changed, this);
PolKitError *pk_error = NULL;
if (!polkit_context_init(m_pkContext, &pk_error)) {
- qDebug() << "Failed to initialize PolicyKit context: " << \
polkit_error_get_error_message(pk_error); + qDebug() << "Failed to \
initialize PolicyKit context: " << polkit_error_get_error_message (pk_error); // \
TODO Add a KMessageBox // if (error != NULL) {
// *error = g_error_new_literal (POLKIT_GNOME_CONTEXT_ERROR,
// \
POLKIT_GNOME_CONTEXT_ERROR_FAILED, // \
polkit_error_get_error_message (pk_error)); // }
- polkit_error_free(pk_error);
+ polkit_error_free (pk_error);
}
}
@@ -196,14 +200,14 @@
void PkKAuthorization::remove_context_io_watch(PolKitContext* context, int id)
{
- assert(id > 0);
+ assert( id > 0 );
kDebug() << "remove_watch" << context << id;
- if (!PkKAuthorization::instance()->m_watches.contains(id))
+ if( !PkKAuthorization::instance()->m_watches.contains(id) )
return; // policykit likes to do this more than once
QSocketNotifier* notify = PkKAuthorization::instance()->m_watches.take(id);
notify->deleteLater();
- notify->setEnabled(false);
+ notify->setEnabled( false );
}
--- trunk/playground/base/PolicyKit-kde/authorization/PkKAuthorizationDialog.cpp \
#890989:890990 @@ -32,24 +32,7 @@
PkKAuthorizationDialog::PkKAuthorizationDialog()
: KUniqueApplication()
- , dialog(0)
{
-}
-
-PkKAuthorizationDialog::~PkKAuthorizationDialog()
-{
- if (dialog) {
- KConfig config;
- KConfigGroup dialogSettingsGroup(&config, "DialogSettings");
- dialog->saveDialogSize(dialogSettingsGroup);
- PkKAuthorization::instance()->setParent(0);
- }
-}
-
-int PkKAuthorizationDialog::newInstance()
-{
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-
dialog = new KDialog;
dialog->setWindowIcon(KIcon("object-locked"));
dialog->setButtons(KDialog::Close);
@@ -63,7 +46,21 @@
KConfigGroup dialogSettingsGroup(&config, "DialogSettings");
dialog->restoreDialogSize(dialogSettingsGroup);
dialog->show();
+}
+PkKAuthorizationDialog::~PkKAuthorizationDialog()
+{
+ KConfig config;
+ KConfigGroup dialogSettingsGroup(&config, "DialogSettings");
+ dialog->saveDialogSize(dialogSettingsGroup);
+ PkKAuthorization::instance()->setParent(0);
+ delete dialog;
+}
+
+int PkKAuthorizationDialog::newInstance()
+{
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
if (args->count()) {
// we only suport one item
emit newAction(args->arg(0));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic