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

List:       kde-commits
Subject:    branches/work/polkit-qt-1
From:       Radek Novacek <rnovacek () redhat ! com>
Date:       2009-10-07 9:40:56
Message-ID: 1254908456.448454.6904.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1032205 by rnovacek:

Added constructors for creating objects from Polkit* object and added some missing \
documentation

 M  +1 -1      authority.cpp  
 M  +1 -1      details.cpp  
 M  +10 -2     details.h  
 M  +10 -0     identity.cpp  
 M  +95 -0     identity.h  
 M  +5 -0      listener.cpp  
 M  +1 -0      listener.h  
 M  +9 -1      session.cpp  
 M  +11 -2     session.h  
 M  +20 -0     subject.cpp  
 M  +50 -0     subject.h  
 M  +6 -6      temporaryauthorization.cpp  
 M  +8 -1      temporaryauthorization.h  


--- branches/work/polkit-qt-1/authority.cpp #1032204:1032205
@@ -310,7 +310,7 @@
 void Authority::Private::checkAuthorizationCallback(GObject *object, GAsyncResult \
*result, gpointer user_data)  {
     Authority *authority = (Authority *) user_data;
-    //GAsyncResult *res;
+
     GError *error = NULL;
     PolkitAuthorizationResult *pkResult = \
polkit_authority_check_authorization_finish((PolkitAuthority *) object, result, \
&error);  if (error != NULL)
--- branches/work/polkit-qt-1/details.cpp #1032204:1032205
@@ -31,7 +31,7 @@
     m_polkitDetails = polkit_details_new();
 }
 
-Details::Details(PolkitDetails *pkDetails) : QObject(NULL)
+Details::Details(PolkitDetails *pkDetails, QObject *parent) : QObject(parent)
 {
     g_type_init();
     m_polkitDetails = pkDetails;
--- branches/work/polkit-qt-1/details.h #1032204:1032205
@@ -48,9 +48,17 @@
     /**
      * Creates a new Details object
      */
-    Details(QObject *parent = NULL);
-    Details(PolkitDetails *pkDetails);
+    Details(QObject *parent = 0);
 
+    /**
+     * Creates Details object from PolkitDetails
+     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkDetails PolkitDetails object
+     */
+    Details(PolkitDetails *pkDetails, QObject *parent = 0);
+
     ~Details();
 
     /**
--- branches/work/polkit-qt-1/identity.cpp #1032204:1032205
@@ -73,6 +73,11 @@
     m_identity = polkit_unix_user_new(uid);
 }
 
+UnixUser::UnixUser(PolkitUnixUser *pkUnixUser, QObject *parent) : \
Identity((PolkitIdentity *)pkUnixUser, parent) +{
+
+}
+
 uid_t UnixUser::uid() const
 {
     return polkit_unix_user_get_uid((PolkitUnixUser *) m_identity);
@@ -96,6 +101,11 @@
     m_identity = polkit_unix_group_new(gid);
 }
 
+UnixGroup::UnixGroup(PolkitUnixGroup *pkUnixGroup, QObject *parent) : \
Identity((PolkitIdentity *) pkUnixGroup, parent) +{
+
+}
+
 gid_t UnixGroup::gid() const
 {
     return polkit_unix_group_get_gid((PolkitUnixGroup *) m_identity);
--- branches/work/polkit-qt-1/identity.h #1032204:1032205
@@ -43,6 +43,8 @@
  * \class Identity identity.h Identity
  * \author Lukas Tinkl <ltinkl@redhat.com>
  *
+ * Identity is an abstract class for representing identities
+ *
  * This class encapsulates the PolkitIdentity interface.
  *
  * \see UnixGroup
@@ -52,10 +54,39 @@
 {
     Q_OBJECT
 public:
+    /**
+     * Creates Identity object from PolkitIdentity
+     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param polkitIdentity PolkitIdentity object
+     */
     Identity( PolkitIdentity * polkitIdentity, QObject *parent = 0 );
     ~Identity();
+
+    /**
+     * Serialization of object to the string
+     *
+     * \return Serialized Identity object
+     */
     QString toString() const;
+
+    /**
+     * Creates the Identity object from string reprezentation
+     *
+     * \param String reprezentation of the object
+     *
+     * \return Pointer to new Identity instance
+     */
     static Identity * fromString(const QString & string);
+
+    /**
+     * Gets PolkitIdentity object.
+     *
+     * \warning It shouldn't be used directly unless you are completely aware of \
what are you doing +     *
+     * \return Pointer to PolkitIdentity instance
+     */
     PolkitIdentity * identity();
 protected:
     PolkitIdentity * m_identity;
@@ -69,9 +100,41 @@
 {
     Q_OBJECT
 public:
+    /**
+     * Creates UnixUser object by UID of the user
+     *
+     * \param uid user id
+     */
     UnixUser(uid_t uid, QObject *parent = 0);
+
+    /**
+     * Creates UnixUser object by unix name of the user
+     *
+     * \param name Unix name
+     */
     UnixUser(const QString & name, QObject *parent = 0);
+
+    /**
+     * Creates UnixUser object from PolkitUnixUser object
+     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkUnixUser The PolkitUnixUser object
+     */
+    UnixUser(PolkitUnixUser *pkUnixUser, QObject *parent = 0);
+
+    /**
+     * Gets an user id
+     *
+     * \return user id
+     */
     uid_t uid() const;
+
+    /**
+     * Sets the id of user
+     *
+     * \param uid user id
+     */
     void setUid(uid_t uid);
 };
 
@@ -82,9 +145,41 @@
 {
     Q_OBJECT
 public:
+    /**
+     * Creates UnixGroup object by GID of the group
+     *
+     * \param uid group id
+     */
     UnixGroup(gid_t uid, QObject *parent = 0);
+
+    /**
+     * Creates UnixGroup object by unix name of the group
+     *
+     * \param name group name
+     */
     UnixGroup(const QString & name, QObject *parent = 0);
+
+    /**
+     * Creates UnixGroup object from PolkitUnixGroup object
+     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkUnixGroup The PolkitUnixGroup object
+     */
+    UnixGroup(PolkitUnixGroup *pkUnixGroup, QObject *parent = 0);
+
+    /**
+     * Gets a group id
+     *
+     * \return group id
+     */
     gid_t gid() const;
+
+    /**
+     * Sets the id of group
+     *
+     * \param uid group id
+     */
     void setGid(gid_t gid);
 };
 
--- branches/work/polkit-qt-1/listener.cpp #1032204:1032205
@@ -38,6 +38,11 @@
     ListenerAdapter::instance()->addListener(this);
 }
 
+Listener::Listener(PolkitAgentListener *listener, QObject *parent) : \
m_listener(listener), QObject(parent) +{
+    g_type_init();
+}
+
 Listener::~Listener()
 {
     qDebug("Destroying listener");
--- branches/work/polkit-qt-1/listener.h #1032204:1032205
@@ -47,6 +47,7 @@
     Q_DISABLE_COPY(Listener)
 public:
     Listener(QObject *parent = 0);
+    Listener(PolkitAgentListener *listener, QObject *parent = 0);
     ~Listener();
     // subject when ported to PolkitQt
     bool registerListener(PolkitQt::Subject *subject, const QString &objectPath);
--- branches/work/polkit-qt-1/session.cpp #1032204:1032205
@@ -26,7 +26,7 @@
 
 using namespace PolkitQtAgent;
 
-Session::Session(PolkitQt::Identity *identity, const QString &cookie)
+Session::Session(PolkitQt::Identity *identity, const QString &cookie, QObject \
*parent) : QObject(parent)  {
     m_polkitAgentSession = polkit_agent_session_new(identity->identity(), \
                cookie.toUtf8().data());
     g_signal_connect(G_OBJECT(m_polkitAgentSession), "completed", \
G_CALLBACK(_completed), this); @@ -35,6 +35,14 @@
     g_signal_connect(G_OBJECT(m_polkitAgentSession), "show-info", \
G_CALLBACK(_showInfo), this);  }
 
+Session::Session(PolkitAgentSession *pkAgentSession, QObject *parent) : \
m_polkitAgentSession(pkAgentSession), QObject(parent) +{
+    g_signal_connect(G_OBJECT(m_polkitAgentSession), "completed", \
G_CALLBACK(_completed), this); +    g_signal_connect(G_OBJECT(m_polkitAgentSession), \
"request", G_CALLBACK(_request), this); +    \
g_signal_connect(G_OBJECT(m_polkitAgentSession), "show-error", \
G_CALLBACK(_showError), this); +    g_signal_connect(G_OBJECT(m_polkitAgentSession), \
"show-info", G_CALLBACK(_showInfo), this); +}
+
 Session::~Session()
 {
     g_object_unref(m_polkitAgentSession);
--- branches/work/polkit-qt-1/session.h #1032204:1032205
@@ -24,7 +24,7 @@
 
 #include <QtCore/QObject>
 #include "identity.h"
-#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
+#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE 1
 #include <polkitagent/polkitagent.h>
 
 /**
@@ -55,7 +55,16 @@
      * \param identity The identity to authenticate
      * \param cookie The cookie obtained from the PolicyKit daemon
      */
-    Session(PolkitQt::Identity *identity, const QString &cookie);
+    Session(PolkitQt::Identity *identity, const QString &cookie, QObject *parent = \
0); +
+    /**
+     * Create a new authentication session from PolkitAgentSession object
+     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkAgentSession PolkitAgentSession object
+     */
+    Session(PolkitAgentSession *pkAgentSession, QObject *parent = 0);
     
     /**
      * Destroy authentication session.
--- branches/work/polkit-qt-1/subject.cpp #1032204:1032205
@@ -30,6 +30,11 @@
     g_type_init();    
 }
 
+Subject::Subject(PolkitSubject *subject, QObject *parent) : m_subject(subject), \
QObject(parent) +{
+    g_type_init();
+}
+
 Subject::~Subject()
 {
     g_object_unref(m_subject);
@@ -71,6 +76,11 @@
     m_subject = polkit_unix_process_new_full(pid, startTime);
 }
 
+UnixProcess::UnixProcess(PolkitUnixProcess *pkUnixProcess, QObject *parent) : \
Subject((PolkitSubject *)pkUnixProcess, parent) +{
+
+}
+
 qint64 UnixProcess::pid() const
 {
     return polkit_unix_process_get_pid((PolkitUnixProcess *) m_subject);
@@ -92,6 +102,11 @@
     m_subject = polkit_system_bus_name_new(name.toUtf8().data());
 }
 
+SystemBusName::SystemBusName(PolkitSystemBusName *pkSystemBusName , QObject *parent) \
: Subject((PolkitSubject *) pkSystemBusName , parent) +{
+
+}
+
 QString SystemBusName::name() const
 {
     return QString::fromUtf8(polkit_system_bus_name_get_name((PolkitSystemBusName *) \
m_subject)); @@ -114,6 +129,11 @@
     m_subject = polkit_unix_session_new_for_process_sync(pid, NULL, NULL);
 }
 
+UnixSession::UnixSession(PolkitSystemBusName *pkUnixSession, QObject *parent) : \
Subject((PolkitSubject *) pkUnixSession, parent) +{
+
+}
+
 QString UnixSession::sessionId() const
 {
     return QString::fromUtf8(polkit_unix_session_get_session_id((PolkitUnixSession \
                *) m_subject));
--- branches/work/polkit-qt-1/subject.h #1032204:1032205
@@ -53,12 +53,35 @@
     Q_OBJECT
 public:
     ~Subject();
+
+    /**
+     * Serialization of object to the string
+     *
+     * \return Serialized Subject object
+     */
     QString toString() const;
+
+    /**
+     * Creates the Subject object from string reprezentation
+     *
+     * \param String reprezentation of the object
+     *
+     * \return Pointer to new Subject instance
+     */
     static Subject * fromString(const QString & string);
+
+    /**
+     * Gets PolkitSubject object.
+     *
+     * \warning It shouldn't be used directly unless you are completely aware of \
what are you doing +     *
+     * \return Pointer to PolkitSubject instance
+     */
     PolkitSubject * subject();
 protected:
     PolkitSubject * m_subject;
     explicit Subject(QObject *parent = 0);
+    Subject(PolkitSubject *subject, QObject *parent);
 };
 
 /**
@@ -92,6 +115,15 @@
     * \param startTime An Unix process start time.
     */    
     UnixProcess(qint64 pid, quint64 startTime, QObject *parent = 0);
+
+    /**
+     * Subject constructor, it creates UnixProcess object from PolkitUnixProcess \
object +     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkUnixProcess PolkitUnixProcess object
+     */
+    UnixProcess(PolkitUnixProcess *process, QObject *parent = 0);
     
     /**
     * Returns Unix process PID.
@@ -133,6 +165,15 @@
     SystemBusName(const QString &name, QObject *parent = 0);
 
     /**
+     * Subject constructor, it creates SystemBusName object from PolkitSystemBusName \
object +     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkSystemBusName PolkitSystemBusName object
+     */
+    SystemBusName(PolkitSystemBusName *pkSystemBusName, QObject *parent = 0);
+
+    /**
     * Returns system bus name.
     *
     * \return A unique system bus name.
@@ -179,6 +220,15 @@
     UnixSession(qint64 pid, QObject *parent = 0);
 
     /**
+     * Subject constructor, it creates UnixSession object from PolkitUnixSession \
object +     *
+     * \warning Use this only if you are completely aware of what are you doing!
+     *
+     * \param pkUnixSession PolkitUnixSession object
+     */
+    UnixSession(PolkitSystemBusName *pkUnixSession, QObject *parent = 0);
+
+    /**
     * Returns session id.
     *
     * \return A session id.
--- branches/work/polkit-qt-1/temporaryauthorization.cpp #1032204:1032205
@@ -23,14 +23,14 @@
 
 using namespace PolkitQt;
 
-TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization \
*tempAuth) : QObject(NULL) \
+TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization \
*pkTemporaryAuthorization, QObject *parent) : QObject(parent)  {
     g_type_init();
-    m_id = QString::fromUtf8(polkit_temporary_authorization_get_id(tempAuth));
-    m_actionId = QString::fromUtf8(polkit_temporary_authorization_get_action_id(tempAuth));
                
-    m_subject = Subject::fromString(polkit_subject_to_string(polkit_temporary_authorization_get_subject(tempAuth)));
                
-    m_timeObtained = \
                QDateTime::fromTime_t(polkit_temporary_authorization_get_time_obtained(tempAuth));
                
-    m_timeExpires = \
QDateTime::fromTime_t(polkit_temporary_authorization_get_time_expires(tempAuth)); +   \
m_id = QString::fromUtf8(polkit_temporary_authorization_get_id(pkTemporaryAuthorization));
 +    m_actionId = QString::fromUtf8(polkit_temporary_authorization_get_action_id(pkTemporaryAuthorization));
 +    m_subject = Subject::fromString(polkit_subject_to_string(polkit_temporary_authorization_get_subject(pkTemporaryAuthorization)));
 +    m_timeObtained = \
QDateTime::fromTime_t(polkit_temporary_authorization_get_time_obtained(pkTemporaryAuthorization));
 +    m_timeExpires = \
QDateTime::fromTime_t(polkit_temporary_authorization_get_time_expires(pkTemporaryAuthorization));
  }
 
 QString TemporaryAuthorization::id() const
--- branches/work/polkit-qt-1/temporaryauthorization.h #1032204:1032205
@@ -48,7 +48,14 @@
 {
     Q_OBJECT
 public:
-    TemporaryAuthorization(PolkitTemporaryAuthorization *tempAuth);
+    /**
+     * Creates TemporaryAuthorization object from PolkitTemporaryAuthorization
+     *
+     * \warning It shouldn't be used directly unless you are completely aware of \
what are you doing +     *
+     * \param pkTemporaryAuthorization PolkitTemporaryAuthorization object
+     */
+    TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization, \
QObject *parent = 0);  
     /**
      * \brief Gets the identifier for the authorization.


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

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