[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/base/PolicyKit-kde/manager
From:       Daniel Nicoletti <dantti85-kde () yahoo ! com ! br>
Date:       2009-03-08 23:54:51
Message-ID: 1236556491.998397.20021.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 937104 by dantti:

Removed duplicated code that we already have in the lib, improved user's face

 M  +2 -0      AuthDialog.cpp  
 M  +4 -1      CMakeLists.txt  
 M  +9 -57     policykitkde.cpp  
 M  +0 -5      policykitkde.h  


--- trunk/extragear/base/PolicyKit-kde/manager/AuthDialog.cpp #937103:937104
@@ -263,6 +263,8 @@
             // load user icon face
             if (!user.faceIconPath().isEmpty()) {
                 item->setIcon(KIcon(user.faceIconPath()));
+            } else {
+                item->setIcon(KIcon("user-identity"));
             }
             // appends the user item
             m_userModelSIM->appendRow(item);
--- trunk/extragear/base/PolicyKit-kde/manager/CMakeLists.txt #937103:937104
@@ -13,6 +13,9 @@
 kde4_add_executable(polkit-kde-manager ${policykit_SRCS})
 
 target_link_libraries(polkit-kde-manager ${KDE4_KDEUI_LIBS}
-${POLKITDBUS_LIBRARIES} ${POLKITGRANT_LIBRARIES} ${POLKIT_LIBRARIES})
+                                         ${POLKITDBUS_LIBRARIES}
+                                         ${POLKITGRANT_LIBRARIES}
+                                         ${POLKIT_LIBRARIES}
+                                         ${POLKITQT_CORE_LIBRARY})
 
 install(TARGETS polkit-kde-manager DESTINATION ${LIBEXEC_INSTALL_DIR})
--- trunk/extragear/base/PolicyKit-kde/manager/policykitkde.cpp #937103:937104
@@ -35,14 +35,17 @@
 #include <QSocketNotifier>
 
 //policykit header
-#include <polkit-dbus/polkit-dbus.h>
-#include <polkit-grant/polkit-grant.h>
+// #include <polkit-dbus/polkit-dbus.h>
 
+#include <Context>
+
 #include "AuthDialog.h"
 #include "processwatcher.h"
 
 #define THIRTY_SECONDS 30000
 
+using namespace PolkitQt;
+
 KCONFIGGROUP_DECLARE_ENUM_QOBJECT(PolicyKitKDE,KeepPassword)
 
 PolicyKitKDE *PolicyKitKDE::m_self;
@@ -73,25 +76,10 @@
     }
 
     m_context = polkit_context_new();
-    if (m_context == NULL) {
-        kDebug() << "Could not get a new PolKitContext.";
-        QTimer::singleShot(0, this, SLOT(quit()));
-        return;
-    }
-
     polkit_context_set_load_descriptions(m_context);
+    Context::instance(m_context);
 
-    polkit_context_set_config_changed(m_context, polkit_config_changed, this);
-    polkit_context_set_io_watch_functions(m_context, pk_io_add_watch, \
                pk_io_remove_watch);
-
-    PolKitError* error = NULL;
-    if (!polkit_context_init(m_context, &error)) {
-        QString msg("Could not initialize PolKitContext");
-        if (polkit_error_is_set(error)) {
-            kError() << msg <<  ": " << polkit_error_get_error_message(error);
-            polkit_error_free(error);
-        } else
-            kError() << msg;
+    if (Context::instance()->hasError()) {
         QTimer::singleShot(0, this, SLOT(quit()));
         return;
     }
@@ -341,8 +329,9 @@
     /* if we've already selected the admin user.. then reuse the same one (this
      * is mainly when the user entered the wrong password)
      */
-    if (!(currentAdminUser = self->dialog->adminUserSelected()).isEmpty())
+    if (!(currentAdminUser = self->dialog->adminUserSelected()).isEmpty()) {
         return strdup(currentAdminUser.toLocal8Bit());
+    }
 
     QStringList adminUsers;
     for (int i = 0; admin_users[i] != NULL; i++) {
@@ -595,35 +584,6 @@
 
 //----------------------------------------------------------------------------
 
-int PolicyKitKDE::pk_io_add_watch(PolKitContext* context, int fd)
-{
-    kDebug() << "add_watch" << context << fd;
-
-    QSocketNotifier *notify = new QSocketNotifier(fd, QSocketNotifier::Read, \
                m_self);
-    m_self->m_watches[fd] = notify;
-
-    notify->connect(notify, SIGNAL(activated(int)), m_self, \
                SLOT(watchActivatedContext(int)));
-
-    return fd; // use simply the fd as the unique id for the watch
-}
-
-
-//----------------------------------------------------------------------------
-
-void PolicyKitKDE::pk_io_remove_watch(PolKitContext* context, int id)
-{
-//     assert(id > 0);
-    kDebug() << "remove_watch" << context << id;
-    if (!m_self->m_watches.contains(id))
-        return; // policykit likes to do this more than once
-
-    QSocketNotifier* notify = m_self->m_watches.take(id);
-    notify->deleteLater();
-    notify->setEnabled(false);
-}
-
-//----------------------------------------------------------------------------
-
 int PolicyKitKDE::add_child_watch(PolKitGrant*, pid_t pid)
 {
     ProcessWatch *watch = new ProcessWatch(pid);
@@ -658,11 +618,3 @@
         remove_child_watch(grant, id);
     }
 }
-
-//----------------------------------------------------------------------------
-void PolicyKitKDE::polkit_config_changed(PolKitContext *context, void *user_data)
-{
-    Q_UNUSED(context);
-    Q_UNUSED(user_data);
-    kDebug() << "PolicyKit reports that the config have changed";
-}
--- trunk/extragear/base/PolicyKit-kde/manager/policykitkde.h #937103:937104
@@ -31,7 +31,6 @@
 #include <QtDBus/QDBusMessage>
 #include <QtGui/QWidget>
 
-#include <polkit/polkit.h>
 #include <polkit-grant/polkit-grant.h>
 
 class AuthDialog;
@@ -96,9 +95,6 @@
     static int add_io_watch(PolKitGrant *grant, int fd);
     static void remove_grant_io_watch(PolKitGrant *grant, int fd);
 
-    static int pk_io_add_watch(PolKitContext *context, int fd);
-    static void pk_io_remove_watch(PolKitContext *context, int fd);
-
     static int add_child_watch(PolKitGrant* grant, pid_t pid);
     static void remove_child_watch(PolKitGrant* grant, int id);
 
@@ -116,7 +112,6 @@
 
     static PolKitResult conversation_override_grant_type(PolKitGrant *grant, \
                PolKitResult type, void *user_data);
     static void conversation_done(PolKitGrant *grant, polkit_bool_t \
                obtainedPrivilege, polkit_bool_t invalidData, void *user_data);
-    static void polkit_config_changed(PolKitContext *ontext, void *user_data);
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic