Hello community, here is the log from the commit of package polkit-qt-1 for openSUSE:Factory checked in at Sat Nov 20 12:30:42 CET 2010. -------- --- KDE/polkit-qt-1/polkit-qt-1.changes 2010-07-17 11:03:04.000000000 +0200 +++ /mounts/work_src_done/STABLE/polkit-qt-1/polkit-qt-1.changes 2010-10-26 18:54:34.000000000 +0200 @@ -1,0 +2,5 @@ +Tue Oct 26 16:54:19 UTC 2010 - tittiatcoke@gmail.com + +- update to 0.98.1 + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- polkit-qt-1-0.96.1.tar.bz2 r1150958.diff New: ---- polkit-qt-1-0.98.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ polkit-qt-1.spec ++++++ --- /var/tmp/diff_new_pack.YLOpaT/_old 2010-11-20 12:30:31.000000000 +0100 +++ /var/tmp/diff_new_pack.YLOpaT/_new 2010-11-20 12:30:31.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package polkit-qt-1 (Version 0.96.1) +# spec file for package polkit-qt-1 (Version 0.98.1) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -24,14 +24,13 @@ License: LGPLv2.1+ Group: Development/Libraries/KDE Summary: PolicyKit Library Qt Bindings -Version: 0.96.1 +Version: 0.98.1 Release: 1 Url: http://api.kde.org/kdesupport-api/kdesupport-apidocs/polkit-qt/html/ BuildRoot: %{_tmppath}/%{name}-%{version}-build # ftp://ftp.kde.org/pub/kde/stable/apps/KDE4.x/admin/ Source0: %{name}-%{version}.tar.bz2 Source99: baselibs.conf -Patch0: r1150958.diff %description Polkit-qt-1 aims to make it easy for Qt developers to take advantage of @@ -91,7 +90,6 @@ %prep %setup -%patch0 %build %cmake_kde4 -d build ++++++ polkit-qt-1-0.96.1.tar.bz2 -> polkit-qt-1-0.98.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/.gitignore new/polkit-qt-1-0.98.1/.gitignore --- old/polkit-qt-1-0.96.1/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/polkit-qt-1-0.98.1/.gitignore 2010-10-26 18:52:00.000000000 +0200 @@ -0,0 +1,22 @@ +.* +*~ +build/ +apidocs/ +Doxyfile +*.patch + +# CMake +CMakeCache.txt +CMakeFiles +cmake_install.cmake +CMakeLists.txt.user +CMakeLists.txt.user.* + +# QtCreator +qtcreator-build + +# Misc +*.moc +moc_* +ui_* +Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/CMakeLists.txt new/polkit-qt-1-0.98.1/CMakeLists.txt --- old/polkit-qt-1-0.96.1/CMakeLists.txt 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/CMakeLists.txt 2010-10-26 18:52:00.000000000 +0200 @@ -33,7 +33,7 @@ ) set(CMAKE_MAJOR_POLKITQT-1_VERSION 0 CACHE INT "PolkitQt-1's major version number" FORCE) - set(CMAKE_MINOR_POLKITQT-1_VERSION 96 CACHE INT "PolkitQt-1's minor version number" FORCE) + set(CMAKE_MINOR_POLKITQT-1_VERSION 98 CACHE INT "PolkitQt-1's minor version number" FORCE) set(CMAKE_RELEASE_POLKITQT-1_VERSION 1 CACHE INT "PolkitQt-1's release version number" FORCE) set(CMAKE_POLKITQT-1_VERSION_STRING "${CMAKE_MAJOR_POLKITQT-1_VERSION}.${CMAKE_MINOR_POLKITQT-1_VERSION}.${CMAKE_RELEASE_POLKITQT-1_VERSION}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/agent/listeneradapter.cpp new/polkit-qt-1-0.98.1/agent/listeneradapter.cpp --- old/polkit-qt-1-0.96.1/agent/listeneradapter.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/agent/listeneradapter.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -84,15 +84,13 @@ { qDebug() << "polkit_qt_listener_initiate_authentication callback for " << listener; - QList<PolkitQt1::Identity *> idents; - PolkitQt1::Details *dets; + PolkitQt1::Identity::List idents; + PolkitQt1::Details dets(details); Listener *list = findListener(listener); for (GList *identity = g_list_first(identities); identity != NULL; identity = g_list_next(identity)) - idents.append(new PolkitQt1::Identity((PolkitIdentity *)identity->data)); - - dets = new PolkitQt1::Details(details); + idents.append(PolkitQt1::Identity((PolkitIdentity *)identity->data)); list->initiateAuthentication(QString::fromUtf8(action_id), QString::fromUtf8(message), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.cpp new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-listener.cpp --- old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-listener.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -39,6 +39,7 @@ { public: PolkitAgentListener *listener; + void *registeredHandle; }; Listener::Listener(QObject *parent) @@ -66,23 +67,34 @@ qDebug("Destroying listener"); ListenerAdapter::instance()->removeListener(this); - g_object_unref(d->listener); + if (d->registeredHandle) + polkit_agent_listener_unregister(d->registeredHandle); + if (d->listener != NULL) + g_object_unref(d->listener); } -bool Listener::registerListener(PolkitQt1::Subject *subject, const QString &objectPath) +bool Listener::registerListener(const PolkitQt1::Subject &subject, const QString &objectPath) { GError *error = NULL; - bool r = polkit_agent_register_listener(d->listener, - subject->subject(), + d->registeredHandle = polkit_agent_listener_register(d->listener, + POLKIT_AGENT_REGISTER_FLAGS_NONE, + subject.subject(), objectPath.toAscii().data(), + NULL, &error); + if (error != NULL) { qWarning() << QString("Cannot register authentication agent: %1").arg(error->message); g_error_free(error); return false; } - return r; + if (d->registeredHandle == NULL) + { + qWarning() << QString("Cannot register authentication agent!"); + return false; + } + return true; } const PolkitAgentListener *Listener::listener() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.h new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-listener.h --- old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-listener.h 2010-10-26 18:52:00.000000000 +0200 @@ -93,7 +93,7 @@ * \param objectPath DBus object path * \return \c True if the polkitqt1-agent-listener.has been registered, \c False otherwise */ - bool registerListener(PolkitQt1::Subject *subject, const QString &objectPath); + bool registerListener(const PolkitQt1::Subject &subject, const QString &objectPath); /** * \brief Returns pointer to the PolkitAgentListener. @@ -126,9 +126,9 @@ virtual void initiateAuthentication(const QString &actionId, const QString &message, const QString &iconName, - PolkitQt1::Details *details, + const PolkitQt1::Details &details, const QString &cookie, - QList<PolkitQt1::Identity *> identities, + const PolkitQt1::Identity::List &identities, AsyncResult *result) = 0; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-session.cpp new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-session.cpp --- old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-session.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-session.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -49,12 +49,12 @@ g_object_unref(polkitAgentSession); } -Session::Session(PolkitQt1::Identity *identity, const QString &cookie, AsyncResult *result, QObject *parent) +Session::Session(const PolkitQt1::Identity &identity, const QString &cookie, AsyncResult *result, QObject *parent) : QObject(parent) , d(new Private) { d->result = result; - d->polkitAgentSession = polkit_agent_session_new(identity->identity(), cookie.toUtf8().data()); + d->polkitAgentSession = polkit_agent_session_new(identity.identity(), cookie.toUtf8().data()); g_signal_connect(G_OBJECT(d->polkitAgentSession), "completed", G_CALLBACK(Private::completed), this); g_signal_connect(G_OBJECT(d->polkitAgentSession), "request", G_CALLBACK(Private::request), this); g_signal_connect(G_OBJECT(d->polkitAgentSession), "show-error", G_CALLBACK(Private::showError), this); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-session.h new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-session.h --- old/polkit-qt-1-0.96.1/agent/polkitqt1-agent-session.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/agent/polkitqt1-agent-session.h 2010-10-26 18:52:00.000000000 +0200 @@ -90,7 +90,7 @@ * \param result Result of the authentication action. Must be finished using complete() method. * \param parent */ - Session(PolkitQt1::Identity *identity, const QString &cookie, AsyncResult *result = 0, QObject *parent = 0); + Session(const PolkitQt1::Identity& identity, const QString &cookie, AsyncResult *result = 0, QObject *parent = 0); /** * Create a new authentication session from PolkitAgentSession object diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-actiondescription.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-actiondescription.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-actiondescription.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-actiondescription.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -1,6 +1,7 @@ /* * This file is part of the Polkit-qt project * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com> + * Copyright (C) 2010 Dario Freddi <drf@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,10 +28,24 @@ namespace PolkitQt1 { -class ActionDescription::Private +class ActionDescription::Data : public QSharedData { public: - Private() {} + Data() {} + Data(const Data& other) + : QSharedData(other) + , actionId(other.actionId) + , description(other.description) + , message(other.message) + , vendorName(other.vendorName) + , vendorUrl(other.vendorUrl) + , iconName(other.iconName) + , implicitAny(other.implicitAny) + , implicitInactive(other.implicitInactive) + , implicitActive(other.implicitActive) + { + } + virtual ~Data() {} QString actionId; QString description; @@ -44,8 +59,14 @@ ActionDescription::ImplicitAuthorization implicitActive; }; +ActionDescription::ActionDescription() + : d(new Data) +{ + +} + ActionDescription::ActionDescription(PolkitActionDescription *polkitActionDescription) - : d(new Private) + : d(new Data) { g_type_init(); @@ -64,9 +85,19 @@ polkitActionDescription)); } +ActionDescription::ActionDescription(const PolkitQt1::ActionDescription& other) + : d(other.d) +{ +} + +ActionDescription& ActionDescription::operator=(const PolkitQt1::ActionDescription& other) +{ + d = other.d; + return *this; +} + ActionDescription::~ActionDescription() { - delete d; } QString ActionDescription::actionId() const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-actiondescription.h new/polkit-qt-1-0.98.1/core/polkitqt1-actiondescription.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-actiondescription.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-actiondescription.h 2010-10-26 18:52:00.000000000 +0200 @@ -1,6 +1,7 @@ /* * This file is part of the Polkit-qt project * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com> + * Copyright (C) 2010 Dario Freddi <drf@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -25,6 +26,7 @@ #include <QtCore/QList> #include <QtCore/QMetaType> +#include <QtCore/QSharedData> typedef struct _PolkitActionDescription PolkitActionDescription; @@ -33,6 +35,7 @@ /** * \class ActionDescription polkitqt1-actiondescription.h ActionDescription * \author Jaroslav Reznik <jreznik@redhat.com> + * \author Dario Freddi <drf@kde.org> * * \brief Class used to encapsulate a registered action. */ @@ -56,8 +59,9 @@ Authorized = 5 }; - typedef QList<ActionDescription *> List; + typedef QList< ActionDescription > List; + ActionDescription(); /** * \brief Constructor of ActionDescription object from PolkitActionDescription * @@ -65,9 +69,12 @@ * * \param actionDesciption PolkitActionDescription */ - ActionDescription(PolkitActionDescription *actionDescription); + explicit ActionDescription(PolkitActionDescription *actionDescription); + ActionDescription(const ActionDescription &other); ~ActionDescription(); + ActionDescription &operator=(const ActionDescription &other); + /** * \brief Gets the action id for ActionDescription * @@ -132,8 +139,8 @@ ActionDescription::ImplicitAuthorization implicitActive() const; private: - class Private; - Private * const d; + class Data; + QSharedDataPointer< Data > d; }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-authority.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-authority.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-authority.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-authority.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -67,7 +67,7 @@ ActionDescription::List result; for (GList *glist2 = glist; glist2; glist2 = g_list_next(glist2)) { gpointer i = glist2->data; - result.append(new ActionDescription(static_cast<PolkitActionDescription *>(i))); + result.append(ActionDescription(static_cast<PolkitActionDescription *>(i))); g_object_unref(i); } @@ -177,12 +177,17 @@ m_revokeTemporaryAuthorizationsCancellable = g_cancellable_new(); m_revokeTemporaryAuthorizationCancellable = g_cancellable_new(); + GError *gerror = NULL; if (pkAuthority == NULL) { - pkAuthority = polkit_authority_get(); + pkAuthority = polkit_authority_get_sync(NULL, &gerror); + if (gerror != NULL) { + setError(E_GetAuthority, gerror->message); + g_error_free(gerror); + return; + } } if (pkAuthority == NULL) { - (E_GetAuthority); return; } @@ -286,7 +291,7 @@ return d->pkAuthority; } -Authority::Result Authority::checkAuthorizationSync(const QString &actionId, Subject *subject, AuthorizationFlags flags) +Authority::Result Authority::checkAuthorizationSync(const QString &actionId, const Subject &subject, AuthorizationFlags flags) { PolkitAuthorizationResult *pk_result; GError *error = NULL; @@ -295,13 +300,13 @@ return Unknown; } - if (subject == NULL) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return Unknown; } pk_result = polkit_authority_check_authorization_sync(d->pkAuthority, - subject->subject(), + subject.subject(), actionId.toAscii().data(), NULL, (PolkitCheckAuthorizationFlags)(int)flags, @@ -324,19 +329,19 @@ } } -void Authority::checkAuthorization(const QString &actionId, Subject *subject, AuthorizationFlags flags) +void Authority::checkAuthorization(const QString &actionId, const Subject &subject, AuthorizationFlags flags) { if (Authority::instance()->hasError()) { return; } - if (subject == NULL) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return; } polkit_authority_check_authorization(d->pkAuthority, - subject->subject(), + subject.subject(), actionId.toAscii().data(), NULL, (PolkitCheckAuthorizationFlags)(int)flags, @@ -430,7 +435,7 @@ g_cancellable_cancel(d->m_enumerateActionsCancellable); } -bool Authority::registerAuthenticationAgentSync(Subject *subject, const QString &locale, const QString &objectPath) +bool Authority::registerAuthenticationAgentSync(const Subject &subject, const QString &locale, const QString &objectPath) { if (Authority::instance()->hasError()) { return false; @@ -439,13 +444,13 @@ gboolean result; GError *error = NULL; - if (!subject) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return false; } result = polkit_authority_register_authentication_agent_sync(d->pkAuthority, - subject->subject(), locale.toAscii().data(), + subject.subject(), locale.toAscii().data(), objectPath.toAscii().data(), NULL, &error); if (error) { @@ -457,19 +462,19 @@ return result; } -void Authority::registerAuthenticationAgent(Subject *subject, const QString &locale, const QString &objectPath) +void Authority::registerAuthenticationAgent(const Subject &subject, const QString &locale, const QString &objectPath) { if (Authority::instance()->hasError()) { return; } - if (!subject) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return; } polkit_authority_register_authentication_agent(d->pkAuthority, - subject->subject(), + subject.subject(), locale.toAscii().data(), objectPath.toAscii().data(), d->m_registerAuthenticationAgentCancellable, @@ -500,12 +505,12 @@ g_cancellable_cancel(d->m_registerAuthenticationAgentCancellable); } -bool Authority::unregisterAuthenticationAgentSync(Subject *subject, const QString &objectPath) +bool Authority::unregisterAuthenticationAgentSync(const Subject &subject, const QString &objectPath) { if (d->pkAuthority) return false; - if (!subject) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return false; } @@ -513,7 +518,7 @@ GError *error = NULL; bool result = polkit_authority_unregister_authentication_agent_sync(d->pkAuthority, - subject->subject(), + subject.subject(), objectPath.toUtf8().data(), NULL, &error); @@ -527,18 +532,18 @@ return result; } -void Authority::unregisterAuthenticationAgent(Subject *subject, const QString &objectPath) +void Authority::unregisterAuthenticationAgent(const Subject &subject, const QString &objectPath) { if (Authority::instance()->hasError()) return; - if (!subject) { + if (!subject.isValid()) { d->setError(E_WrongSubject); return; } polkit_authority_unregister_authentication_agent(d->pkAuthority, - subject->subject(), + subject.subject(), objectPath.toUtf8().data(), d->m_unregisterAuthenticationAgentCancellable, d->unregisterAuthenticationAgentCallback, @@ -568,12 +573,12 @@ g_cancellable_cancel(d->m_unregisterAuthenticationAgentCancellable); } -bool Authority::authenticationAgentResponseSync(const QString &cookie, Identity *identity) +bool Authority::authenticationAgentResponseSync(const QString &cookie, const Identity &identity) { if (Authority::instance()->hasError()) return false; - if (cookie.isEmpty() || !identity) { + if (cookie.isEmpty() || !identity.isValid()) { d->setError(E_CookieOrIdentityEmpty); return false; } @@ -582,7 +587,7 @@ bool result = polkit_authority_authentication_agent_response_sync(d->pkAuthority, cookie.toUtf8().data(), - identity->identity(), + identity.identity(), NULL, &error); if (error != NULL) { @@ -594,19 +599,19 @@ return result; } -void Authority::authenticationAgentResponse(const QString &cookie, Identity *identity) +void Authority::authenticationAgentResponse(const QString &cookie, const Identity &identity) { if (Authority::instance()->hasError()) return; - if (cookie.isEmpty() || !identity) { + if (cookie.isEmpty() || !identity.isValid()) { d->setError(E_CookieOrIdentityEmpty); return; } polkit_authority_authentication_agent_response(d->pkAuthority, cookie.toUtf8().data(), - identity->identity(), + identity.identity(), d->m_authenticationAgentResponseCancellable, d->authenticationAgentResponseCallback, this); @@ -635,13 +640,13 @@ g_cancellable_cancel(d->m_authenticationAgentResponseCancellable); } -QList<TemporaryAuthorization *> Authority::enumerateTemporaryAuthorizationsSync(Subject *subject) +TemporaryAuthorization::List Authority::enumerateTemporaryAuthorizationsSync(const Subject &subject) { - QList<TemporaryAuthorization *> result; + TemporaryAuthorization::List result; GError *error = NULL; GList *glist = polkit_authority_enumerate_temporary_authorizations_sync(d->pkAuthority, - subject->subject(), + subject.subject(), NULL, &error); if (error != NULL) { @@ -652,7 +657,7 @@ GList *glist2; for (glist2 = glist; glist2 != NULL; glist2 = g_list_next(glist2)) { - result.append(new TemporaryAuthorization((PolkitTemporaryAuthorization *) glist2->data)); + result.append(TemporaryAuthorization((PolkitTemporaryAuthorization *) glist2->data)); g_object_unref(glist2->data); } @@ -676,10 +681,10 @@ g_error_free(error); return; } - QList<TemporaryAuthorization *> res; + TemporaryAuthorization::List res; GList *glist2; for (glist2 = glist; glist2 != NULL; glist2 = g_list_next(glist2)) { - res.append(new TemporaryAuthorization((PolkitTemporaryAuthorization *) glist2->data)); + res.append(TemporaryAuthorization((PolkitTemporaryAuthorization *) glist2->data)); g_object_unref(glist2->data); } @@ -694,7 +699,7 @@ g_cancellable_cancel(d->m_enumerateTemporaryAuthorizationsCancellable); } -bool Authority::revokeTemporaryAuthorizationsSync(Subject *subject) +bool Authority::revokeTemporaryAuthorizationsSync(const Subject &subject) { bool result; if (Authority::instance()->hasError()) @@ -702,7 +707,7 @@ GError *error = NULL; result = polkit_authority_revoke_temporary_authorizations_sync(d->pkAuthority, - subject->subject(), + subject.subject(), NULL, &error); if (error != NULL) { @@ -713,13 +718,13 @@ return result; } -void Authority::revokeTemporaryAuthorizations(Subject *subject) +void Authority::revokeTemporaryAuthorizations(const Subject &subject) { if (Authority::instance()->hasError()) return; polkit_authority_revoke_temporary_authorizations(d->pkAuthority, - subject->subject(), + subject.subject(), d->m_revokeTemporaryAuthorizationsCancellable, d->revokeTemporaryAuthorizationsCallback, this); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-authority.h new/polkit-qt-1-0.98.1/core/polkitqt1-authority.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-authority.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-authority.h 2010-10-26 18:52:00.000000000 +0200 @@ -207,7 +207,7 @@ * or an error has occurred * */ - void checkAuthorization(const QString &actionId, Subject *subject, + void checkAuthorization(const QString &actionId, const Subject &subject, AuthorizationFlags flags); /** @@ -219,7 +219,7 @@ * * \see checkAuthorization Asynchronous version of this method. */ - Result checkAuthorizationSync(const QString &actionId, Subject *subject, + Result checkAuthorizationSync(const QString &actionId, const Subject &subject, AuthorizationFlags flags); /** @@ -264,7 +264,7 @@ * \param locale the locale of the authentication agent * \param objectPath the object path for the authentication agent */ - void registerAuthenticationAgent(Subject *subject, const QString &locale, + void registerAuthenticationAgent(const Subject &subject, const QString &locale, const QString &objectPath); /** @@ -279,7 +279,7 @@ * \return \c true if the Authentication agent has been successfully registered * \c false if the Authentication agent registration failed */ - bool registerAuthenticationAgentSync(Subject *subject, const QString &locale, + bool registerAuthenticationAgentSync(const Subject &subject, const QString &locale, const QString &objectPath); /** @@ -300,7 +300,7 @@ * \return \c true if the Authentication agent has been successfully unregistered * \c false if the Authentication agent unregistration failed */ - void unregisterAuthenticationAgent(Subject *subject, const QString &objectPath); + void unregisterAuthenticationAgent(const Subject &subject, const QString &objectPath); /** * Unregisters an Authentication agent. @@ -313,7 +313,7 @@ * \return \c true if the Authentication agent has been successfully unregistered * \c false if the Authentication agent unregistration failed */ - bool unregisterAuthenticationAgentSync(Subject *subject, const QString &objectPath); + bool unregisterAuthenticationAgentSync(const Subject &subject, const QString &objectPath); /** * This method can be used to cancel the unregistration of the authentication agent. @@ -330,7 +330,7 @@ * \param cookie The cookie passed to the authentication agent from the authority. * \param identity The identity that was authenticated. */ - void authenticationAgentResponse(const QString &cookie, Identity *identity); + void authenticationAgentResponse(const QString &cookie, const Identity &identity); /** * Provide response that \p identity successfully authenticated for the authentication request identified by \p cookie. @@ -343,7 +343,7 @@ * \return \c true if authority acknowledged the call, \c false if error is set. * */ - bool authenticationAgentResponseSync(const QString &cookie, Identity *identity); + bool authenticationAgentResponseSync(const QString& cookie, const PolkitQt1::Identity& identity); /** * This method can be used to cancel the authenticationAgentResponseAsync method. @@ -360,7 +360,7 @@ * \param subject the subject to get temporary authorizations for * */ - void enumerateTemporaryAuthorizations(Subject *subject); + void enumerateTemporaryAuthorizations(const Subject &subject); /** * Retrieves all temporary action that applies to \p subject @@ -373,7 +373,7 @@ * * \return List of all temporary authorizations */ - QList<TemporaryAuthorization *> enumerateTemporaryAuthorizationsSync(Subject *subject); + TemporaryAuthorization::List enumerateTemporaryAuthorizationsSync(const Subject &subject); /** * This method can be used to cancel the enumerateTemporaryAuthorizationsAsync method. @@ -389,7 +389,7 @@ * \param subject the subject to revoke temporary authorizations from */ - void revokeTemporaryAuthorizations(Subject *subject); + void revokeTemporaryAuthorizations(const Subject &subject); /** * Revokes all temporary authorizations that applies to \p subject @@ -401,7 +401,7 @@ * \return \c true if all temporary authorization were revoked * \c false if the revoking failed */ - bool revokeTemporaryAuthorizationsSync(Subject *subject); + bool revokeTemporaryAuthorizationsSync(const Subject &subject); /** * This method can be used to cancel the method revokeTemporaryAuthorizationsAsync. @@ -504,7 +504,7 @@ * * \note Free all TemporaryAuthorization objects using \p delete operator. */ - void enumerateTemporaryAuthorizationsFinished(QList<PolkitQt1::TemporaryAuthorization *>); + void enumerateTemporaryAuthorizationsFinished(PolkitQt1::TemporaryAuthorization::List); /** * This signal is emmited when asynchronous method revokeTemporaryAuthorizations finishes. @@ -534,6 +534,6 @@ } Q_DECLARE_OPERATORS_FOR_FLAGS(PolkitQt1::Authority::AuthorizationFlags) -Q_DECLARE_METATYPE(PolkitQt1::Authority::Result); +Q_DECLARE_METATYPE(PolkitQt1::Authority::Result) #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-details.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-details.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-details.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-details.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -27,25 +27,33 @@ namespace PolkitQt1 { -class Details::Private +class Details::Data : public QSharedData { public: - Private() {} + Data() {} + Data(const Data &other) + : QSharedData(other) + , polkitDetails(other.polkitDetails) + { + g_object_ref(polkitDetails); + } + ~Data() + { + g_object_unref(polkitDetails); + } PolkitDetails *polkitDetails; }; -Details::Details(QObject *parent) - : QObject(parent) - , d(new Private) +Details::Details() + : d(new Data) { g_type_init(); d->polkitDetails = polkit_details_new(); } -Details::Details(PolkitDetails *pkDetails, QObject *parent) - : QObject(parent) - , d(new Private) +Details::Details(PolkitDetails *pkDetails) + : d(new Data) { g_type_init(); d->polkitDetails = pkDetails; @@ -53,8 +61,12 @@ Details::~Details() { - g_object_unref(d->polkitDetails); - delete d; +} + +Details& Details::operator=(const PolkitQt1::Details& other) +{ + d = other.d; + return *this; } QString Details::lookup(const QString &key) const @@ -84,5 +96,3 @@ } } - -#include "polkitqt1-details.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-details.h new/polkit-qt-1-0.98.1/core/polkitqt1-details.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-details.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-details.h 2010-10-26 18:52:00.000000000 +0200 @@ -24,6 +24,7 @@ #include "polkitqt1-export.h" #include <QtCore/QObject> +#include <QtCore/QSharedData> typedef struct _PolkitDetails PolkitDetails; @@ -43,15 +44,13 @@ * * \brief Class used for passing details around. */ -class POLKITQT1_EXPORT Details : public QObject +class POLKITQT1_EXPORT Details { - Q_OBJECT public: /** * Creates a new Details object - * \param parent */ - Details(QObject *parent = 0); + Details(); /** * Creates Details object from PolkitDetails @@ -59,12 +58,13 @@ * \warning Use this only if you are completely aware of what are you doing! * * \param pkDetails PolkitDetails object - * \param parent */ - explicit Details(PolkitDetails *pkDetails, QObject *parent = 0); + explicit Details(PolkitDetails *pkDetails); ~Details(); + Details &operator=(const Details &other); + /** * Get the value for \p key * @@ -88,8 +88,8 @@ */ QStringList keys() const; private: - class Private; - Private * const d; + class Data; + QExplicitlySharedDataPointer< Data > d; }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-identity.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-identity.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-identity.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-identity.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -27,30 +27,56 @@ namespace PolkitQt1 { -class Identity::Private +class Identity::Data : public QSharedData { public: - Private(PolkitIdentity *i) : identity(i) {} + Data() : identity(0) {} + Data(const Data& other) + : QSharedData(other) + , identity(other.identity) + { + g_object_ref(identity); + } + ~Data() + { + g_object_unref(identity); + } PolkitIdentity *identity; }; Identity::Identity() - : d(new Private(0)) + : d(new Data) { g_type_init(); } Identity::Identity(PolkitIdentity *polkitIdentity) - : d(new Private(polkitIdentity)) + : d(new Data) { g_type_init(); + d->identity = polkitIdentity; +} + +Identity::Identity(const PolkitQt1::Identity& other) + : d(other.d) +{ + } Identity::~Identity() { - g_object_unref(d->identity); - delete d; +} + +Identity& Identity::operator=(const PolkitQt1::Identity& other) +{ + d = other.d; + return *this; +} + +bool Identity::isValid() const +{ + return d->identity != NULL; } PolkitIdentity *Identity::identity() const @@ -69,15 +95,35 @@ return QString::fromUtf8(polkit_identity_to_string(d->identity)); } -Identity *Identity::fromString(const QString &string) +Identity Identity::fromString(const QString &string) { GError *error = NULL; PolkitIdentity *pkIdentity = polkit_identity_from_string(string.toUtf8().data(), &error); if (error != NULL) { qWarning() << QString("Cannot create Identity from string: %1").arg(error->message); - return NULL; + return Identity(); + } + return Identity(pkIdentity); +} + +UnixGroupIdentity Identity::toUnixGroupIdentity() +{ + UnixGroupIdentity *ugid = static_cast< UnixGroupIdentity* >(this); + if (!ugid) { + return UnixGroupIdentity(); } - return new Identity(pkIdentity); + + return *ugid; +} + +UnixUserIdentity Identity::toUnixUserIdentity() +{ + UnixUserIdentity *uuid = static_cast< UnixUserIdentity* >(this); + if (!uuid) { + return UnixUserIdentity(); + } + + return *uuid; } UnixUserIdentity::UnixUserIdentity(const QString &name) @@ -103,6 +149,12 @@ } +UnixUserIdentity::UnixUserIdentity() + : Identity() +{ + +} + uid_t UnixUserIdentity::uid() const { return polkit_unix_user_get_uid((PolkitUnixUser *) identity()); @@ -135,6 +187,12 @@ { } + +UnixGroupIdentity::UnixGroupIdentity() + : Identity() +{ + +} gid_t UnixGroupIdentity::gid() const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-identity.h new/polkit-qt-1-0.98.1/core/polkitqt1-identity.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-identity.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-identity.h 2010-10-26 18:52:00.000000000 +0200 @@ -26,6 +26,7 @@ #include <unistd.h> #include <QtCore/QObject> +#include <QtCore/QSharedData> typedef struct _PolkitIdentity PolkitIdentity; typedef struct _PolkitUnixUser PolkitUnixUser; @@ -41,6 +42,9 @@ namespace PolkitQt1 { +class UnixUserIdentity; +class UnixGroupIdentity; + /** * \class Identity polkitqt1-identity.h Identity * \author Lukas Tinkl <ltinkl@redhat.com> @@ -55,16 +59,18 @@ class POLKITQT1_EXPORT Identity { public: - /** - * Creates Identity object from PolkitIdentity - * - * \warning Use this only if you are completely aware of what are you doing! - * - * \param polkitIdentity PolkitIdentity object - */ + typedef QList< Identity > List; + + Identity(); explicit Identity(PolkitIdentity *polkitIdentity); + Identity(const Identity &other); + ~Identity(); + Identity &operator=(const Identity &other); + + bool isValid() const; + /** * Serialization of object to the string * @@ -79,7 +85,10 @@ * * \return Pointer to new Identity instance */ - static Identity *fromString(const QString &string); + static Identity fromString(const QString &string); + + UnixUserIdentity toUnixUserIdentity(); + UnixGroupIdentity toUnixGroupIdentity(); /** * Gets PolkitIdentity object. @@ -90,13 +99,11 @@ */ PolkitIdentity *identity() const; protected: - Identity(); - void setIdentity(PolkitIdentity *identity); private: - class Private; - Private * const d; + class Data; + QExplicitlySharedDataPointer< Data > d; }; /** @@ -110,6 +117,7 @@ class POLKITQT1_EXPORT UnixUserIdentity : public Identity { public: + UnixUserIdentity(); /** * Creates UnixUser object by UID of the user * @@ -159,6 +167,7 @@ class POLKITQT1_EXPORT UnixGroupIdentity : public Identity { public: + UnixGroupIdentity(); /** * Creates UnixGroup object by GID of the group * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-subject.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-subject.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-subject.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-subject.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -26,30 +26,59 @@ namespace PolkitQt1 { -class Subject::Private +class Subject::Data : public QSharedData { public: - Private(PolkitSubject *s) : subject(s) {} + Data() + : QSharedData() + , subject(0) + {} + Data(const Data& other) + : QSharedData(other) + , subject(other.subject) + { + g_object_ref(subject); + } + ~Data() + { + g_object_unref(subject); + } PolkitSubject *subject; }; Subject::Subject() - : d(new Private(0)) + : d(new Data) { g_type_init(); } Subject::Subject(PolkitSubject *subject) - : d(new Private(subject)) + : d(new Data) { g_type_init(); + d->subject = subject; +} + +Subject::Subject(const PolkitQt1::Subject& other) + : d(other.d) +{ + +} + +Subject& Subject::operator=(const PolkitQt1::Subject& other) +{ + d = other.d; + return *this; } Subject::~Subject() { - g_object_unref(d->subject); - delete d; +} + +bool Subject::isValid() const +{ + return d->subject != NULL; } PolkitSubject *Subject::subject() const @@ -68,14 +97,14 @@ return QString::fromUtf8(polkit_subject_to_string(d->subject)); } -Subject *Subject::fromString(const QString &string) +Subject Subject::fromString(const QString &string) { // should be in polkit library!!! but for strange reason it's necessary to have it here g_type_init(); - Subject *subject = new Subject(); + Subject subject; GError *error = NULL; - subject->d->subject = polkit_subject_from_string(string.toUtf8().data(), &error); + subject.d->subject = polkit_subject_from_string(string.toUtf8().data(), &error); if (error != NULL) { qWarning() << QString("Cannot create Subject from string: %1").arg(error->message); return NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-subject.h new/polkit-qt-1-0.98.1/core/polkitqt1-subject.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-subject.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-subject.h 2010-10-26 18:52:00.000000000 +0200 @@ -24,6 +24,7 @@ #include "polkitqt1-export.h" #include <QtCore/QObject> +#include <QtCore/QSharedData> typedef struct _PolkitSubject PolkitSubject; typedef struct _PolkitUnixProcess PolkitUnixProcess; @@ -54,8 +55,14 @@ class POLKITQT1_EXPORT Subject { public: + Subject(); + Subject(const Subject &other); ~Subject(); + Subject &operator=(const Subject &other); + + bool isValid() const; + /** * Serialization of object to the string * @@ -70,7 +77,7 @@ * * \return Pointer to new Subject instance */ - static Subject *fromString(const QString &string); + static Subject fromString(const QString &string); /** * Gets PolkitSubject object. @@ -82,14 +89,13 @@ PolkitSubject *subject() const; protected: - Subject(); Subject(PolkitSubject *subject); void setSubject(PolkitSubject *subject); private: - class Private; - Private * const d; + class Data; + QExplicitlySharedDataPointer< Data > d; }; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-temporaryauthorization.cpp new/polkit-qt-1-0.98.1/core/polkitqt1-temporaryauthorization.cpp --- old/polkit-qt-1-0.96.1/core/polkitqt1-temporaryauthorization.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-temporaryauthorization.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -26,22 +26,30 @@ namespace PolkitQt1 { -class TemporaryAuthorization::Private +class TemporaryAuthorization::Data : public QSharedData { public: - Private() {} + Data() {} + Data(const Data& other) + : QSharedData(other) + , id(other.id) + , actionId(other.actionId) + , subject(other.subject) + , timeObtained(other.timeObtained) + , timeExpires(other.timeExpires) + { + } + ~Data() {} - PolkitTemporaryAuthorization *temporaryAuthorization; QString id; QString actionId; - Subject *subject; + Subject subject; QDateTime timeObtained; QDateTime timeExpires; }; -TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization, QObject *parent) - : QObject(parent) - , d(new Private) +TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization) + : d(new Data) { g_type_init(); d->id = QString::fromUtf8(polkit_temporary_authorization_get_id(pkTemporaryAuthorization)); @@ -52,10 +60,26 @@ g_object_unref(pkTemporaryAuthorization); } +TemporaryAuthorization::TemporaryAuthorization(const PolkitQt1::TemporaryAuthorization& other) + : d(other.d) +{ + +} + +TemporaryAuthorization::TemporaryAuthorization() + : d(new Data) +{ + +} + +TemporaryAuthorization& TemporaryAuthorization::operator=(const PolkitQt1::TemporaryAuthorization& other) +{ + d = other.d; + return *this; +} + TemporaryAuthorization::~TemporaryAuthorization() { - delete d->subject; - delete d; } QString TemporaryAuthorization::id() const @@ -68,7 +92,7 @@ return d->actionId; } -Subject *TemporaryAuthorization::subject() +Subject TemporaryAuthorization::subject() const { //qFatal(polkit_subject_to_string(polkit_temporary_authorization_get_subject(d->temporaryAuthorization))); return d->subject;//Subject::fromString(polkit_subject_to_string(d->subject)); @@ -91,5 +115,3 @@ } } - -#include "polkitqt1-temporaryauthorization.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/core/polkitqt1-temporaryauthorization.h new/polkit-qt-1-0.98.1/core/polkitqt1-temporaryauthorization.h --- old/polkit-qt-1-0.96.1/core/polkitqt1-temporaryauthorization.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/core/polkitqt1-temporaryauthorization.h 2010-10-26 18:52:00.000000000 +0200 @@ -25,6 +25,8 @@ #include <QtCore/QObject> #include <QtCore/QDateTime> +#include <QtCore/QMetaType> +#include <QtCore/QSharedData> typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization; @@ -46,10 +48,11 @@ * * This class encapsulates the PolkitTemporaryAuthorization interface. */ -class POLKITQT1_EXPORT TemporaryAuthorization : public QObject +class POLKITQT1_EXPORT TemporaryAuthorization { - Q_OBJECT public: + typedef QList< TemporaryAuthorization > List; + TemporaryAuthorization(); /** * Creates TemporaryAuthorization object from PolkitTemporaryAuthorization * @@ -58,10 +61,13 @@ * \param pkTemporaryAuthorization PolkitTemporaryAuthorization object * \param parent */ - explicit TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization, QObject *parent = 0); + explicit TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization); + TemporaryAuthorization(const TemporaryAuthorization &other); ~TemporaryAuthorization(); + TemporaryAuthorization &operator=(const TemporaryAuthorization &other); + /** * \brief Gets the identifier for the authorization. * @@ -83,7 +89,7 @@ * * \return A Subject. */ - Subject *subject(); + Subject subject() const; /** * \brief Gets the time when authorization was obtained @@ -108,9 +114,11 @@ bool revoke(); private: - class Private; - Private * const d; + class Data; + QSharedDataPointer< Data > d; }; } +Q_DECLARE_METATYPE(PolkitQt1::TemporaryAuthorization::List) + #endif // TEMPORARYAUTHORIZATION_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/examples/PkExample.cpp new/polkit-qt-1-0.98.1/examples/PkExample.cpp --- old/polkit-qt-1-0.96.1/examples/PkExample.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/examples/PkExample.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -222,9 +222,7 @@ qDebug() << "pretending to be the mechanism for action:" << action->actionId(); Authority::Result result; - UnixProcessSubject *subject; - - subject = new UnixProcessSubject(static_cast<uint>(QCoreApplication::applicationPid())); + UnixProcessSubject subject(static_cast<uint>(QCoreApplication::applicationPid())); result = Authority::instance()->checkAuthorizationSync(action->actionId(), subject, Authority::AllowUserInteraction); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/examples/PkExampleHelper.cpp new/polkit-qt-1-0.98.1/examples/PkExampleHelper.cpp --- old/polkit-qt-1-0.96.1/examples/PkExampleHelper.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/examples/PkExampleHelper.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -66,9 +66,7 @@ // message().service() is the service name of the caller // We can check if the caller is authorized to the following action Authority::Result result; - SystemBusNameSubject *subject; - - subject = new SystemBusNameSubject(message().service()); + SystemBusNameSubject subject(message().service()); result = Authority::instance()->checkAuthorizationSync("org.qt.policykit.examples.set", subject , Authority::AllowUserInteraction); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/examples/agent/klistener.cpp new/polkit-qt-1-0.98.1/examples/agent/klistener.cpp --- old/polkit-qt-1-0.96.1/examples/agent/klistener.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/examples/agent/klistener.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -37,18 +37,18 @@ void KListener::initiateAuthentication(const QString &actionId, const QString &message, const QString &iconName, - PolkitQt1::Details *details, + const PolkitQt1::Details &details, const QString &cookie, - QList<PolkitQt1::Identity *> identities, + const PolkitQt1::Identity::List &identities, AsyncResult *result) { qDebug() << "initiateAuthentication for " << actionId << " with message " << message; qDebug() << "iconName " << iconName; - qDebug() << details->keys(); + qDebug() << details.keys(); qDebug() << "cookie" << cookie; - Q_FOREACH (PolkitQt1::Identity *identity, identities) { - qDebug() << identity->toString(); + Q_FOREACH (const PolkitQt1::Identity &identity, identities) { + qDebug() << identity.toString(); Session *session; session = new Session(identity, cookie, result); connect(session, SIGNAL(request(QString, bool)), this, SLOT(request(QString, bool))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/examples/agent/klistener.h new/polkit-qt-1-0.98.1/examples/agent/klistener.h --- old/polkit-qt-1-0.96.1/examples/agent/klistener.h 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/examples/agent/klistener.h 2010-10-26 18:52:00.000000000 +0200 @@ -40,9 +40,9 @@ void initiateAuthentication(const QString &actionId, const QString &message, const QString &iconName, - PolkitQt1::Details *details, + const PolkitQt1::Details &details, const QString &cookie, - QList<PolkitQt1::Identity *> identities, + const PolkitQt1::Identity::List &identities, PolkitQt1::Agent::AsyncResult *result); bool initiateAuthenticationFinish(); void cancelAuthentication(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/examples/agent/pkagentexample.cpp new/polkit-qt-1-0.98.1/examples/agent/pkagentexample.cpp --- old/polkit-qt-1-0.96.1/examples/agent/pkagentexample.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/examples/agent/pkagentexample.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -11,8 +11,7 @@ { g_type_init(); - PolkitQt1::UnixSessionSubject *session; - session = new PolkitQt1::UnixSessionSubject(getpid()); + PolkitQt1::UnixSessionSubject session(getpid()); m_listener.registerListener(session, "/org/kde/PolicyKit1/AuthenticationAgent"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/gui/polkitqt1-gui-action.cpp new/polkit-qt-1-0.98.1/gui/polkitqt1-gui-action.cpp --- old/polkit-qt-1-0.96.1/gui/polkitqt1-gui-action.cpp 2010-07-03 12:17:13.000000000 +0200 +++ new/polkit-qt-1-0.98.1/gui/polkitqt1-gui-action.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -222,16 +222,13 @@ bool Action::Private::computePkResult() { Authority::Result old_result; - UnixProcessSubject *subject; - - subject = new UnixProcessSubject(parent->targetPID()); + UnixProcessSubject subject(parent->targetPID()); old_result = pkResult; pkResult = Authority::Unknown; pkResult = Authority::instance()->checkAuthorizationSync(actionId, subject, Authority::None); - delete subject; return old_result != pkResult; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/test/CMakeLists.txt new/polkit-qt-1-0.98.1/test/CMakeLists.txt --- old/polkit-qt-1-0.96.1/test/CMakeLists.txt 2010-07-03 12:17:12.000000000 +0200 +++ new/polkit-qt-1-0.98.1/test/CMakeLists.txt 2010-10-26 18:52:00.000000000 +0200 @@ -1,32 +1,20 @@ -#install(FILES org.qt.policykit.examples.policy DESTINATION ${SHARE_INSTALL_PREFIX}/polkit-1/actions/) - -FIND_PACKAGE(Qt4 REQUIRED) -include (${QT_USE_FILE}) +enable_testing() include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/agent - ${QT_QTTEST_INCLUDE_DIR} - ${POLKIT_INCLUDE_DIRS} ) -set(polkit_qt_test_SRCS +automoc4_add_executable(polkit-qt-test test.cpp ) -QT4_WRAP_CPP(polkit_qt_test_MOC_SRCS - test.h -) - -add_executable(polkit-qt-test - ${polkit_qt_test_SRCS} - ${polkit_qt_test_MOC_SRCS} -) - target_link_libraries(polkit-qt-test ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} polkit-qt-core-1 ) + +add_test(BaseTest ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-test) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/polkit-qt-1-0.96.1/test/test.cpp new/polkit-qt-1-0.98.1/test/test.cpp --- old/polkit-qt-1-0.96.1/test/test.cpp 2010-07-03 12:17:12.000000000 +0200 +++ new/polkit-qt-1-0.98.1/test/test.cpp 2010-10-26 18:52:00.000000000 +0200 @@ -23,7 +23,7 @@ void TestAuth::test_Auth_checkAuthorization() { // This needs the file org.qt.policykit.examples.policy from examples to be installed - UnixProcessSubject *process = new UnixProcessSubject(QCoreApplication::applicationPid()); + UnixProcessSubject process(QCoreApplication::applicationPid()); Authority::Result result; // Check if this method returns good authorization results Authority *authority = Authority::instance(); @@ -76,10 +76,10 @@ QVERIFY(!Authority::instance()->hasError()); // Check whether enumerateAction returns at least example actions int count = 0; - Q_FOREACH(ActionDescription *ad, list) { - if ((ad->actionId() == "org.qt.policykit.examples.kick") || - (ad->actionId() == "org.qt.policykit.examples.cry") || - (ad->actionId() == "org.qt.policykit.examples.bleed")) + Q_FOREACH(const ActionDescription &ad, list) { + if ((ad.actionId() == "org.qt.policykit.examples.kick") || + (ad.actionId() == "org.qt.policykit.examples.cry") || + (ad.actionId() == "org.qt.policykit.examples.bleed")) count++; } QCOMPARE(count, 3); @@ -94,10 +94,10 @@ QCOMPARE(spy.count(), 1); list = qVariantValue<PolkitQt1::ActionDescription::List> (spy.takeFirst()[0]); QVERIFY(!Authority::instance()->hasError()); - Q_FOREACH(ActionDescription *ad, list) { - if ((ad->actionId() == "org.qt.policykit.examples.kick") || - (ad->actionId() == "org.qt.policykit.examples.cry") || - (ad->actionId() == "org.qt.policykit.examples.bleed")) + Q_FOREACH(const ActionDescription &ad, list) { + if ((ad.actionId() == "org.qt.policykit.examples.kick") || + (ad.actionId() == "org.qt.policykit.examples.cry") || + (ad.actionId() == "org.qt.policykit.examples.bleed")) count++; } QCOMPARE(count, 3); @@ -124,23 +124,20 @@ QVERIFY(user.identity()); // Create generic Identity from UnixUser via string representation - Identity *id = Identity::fromString(user.toString()); + Identity id = Identity::fromString(user.toString()); // Compare obtained uid with real uid - QCOMPARE(((UnixUserIdentity *)id)->uid(), userId); - delete id; + QCOMPARE(id.toUnixUserIdentity().uid(), userId); // Create generic Identity from UnixGroup via string representation UnixGroupIdentity group(groupId); QVERIFY(group.identity()); id = Identity::fromString(group.toString()); - QCOMPARE(((UnixGroupIdentity *) id)->gid(), groupId); - delete id; + QCOMPARE(id.toUnixGroupIdentity().gid(), groupId); // Test setting gid to another value group.setGid(9999U); id = Identity::fromString(group.toString()); - QCOMPARE(((UnixGroupIdentity *) id)->gid(), 9999U); - delete id; + QCOMPARE(id.toUnixGroupIdentity().gid(), 9999U); } void TestAuth::test_Authority() ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org