diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/CMakeLists.txt | 53 | ||||
-rw-r--r-- | core/dummy-core.cpp | 37 | ||||
-rw-r--r-- | core/dummy-core.h | 56 | ||||
-rw-r--r-- | core/polkit-tqt-subject.cpp | 242 | ||||
-rw-r--r-- | core/polkit-tqt-subject.h (renamed from core/polkittqt1-subject.h) | 77 | ||||
-rw-r--r-- | core/polkittqt1-actiondescription.cpp | 6 | ||||
-rw-r--r-- | core/polkittqt1-actiondescription.h | 8 | ||||
-rw-r--r-- | core/polkittqt1-authority.cpp | 6 | ||||
-rw-r--r-- | core/polkittqt1-authority.h | 20 | ||||
-rw-r--r-- | core/polkittqt1-details.cpp | 4 | ||||
-rw-r--r-- | core/polkittqt1-details.h | 10 | ||||
-rw-r--r-- | core/polkittqt1-identity.cpp | 6 | ||||
-rw-r--r-- | core/polkittqt1-identity.h | 14 | ||||
-rw-r--r-- | core/polkittqt1-subject.cpp | 205 | ||||
-rw-r--r-- | core/polkittqt1-temporaryauthorization.cpp | 6 | ||||
-rw-r--r-- | core/polkittqt1-temporaryauthorization.h | 8 |
16 files changed, 352 insertions, 406 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index ed7519be0..dc492af4d 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -10,9 +10,11 @@ ################################################# include_directories( + ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${TQT_INCLUDE_DIRS} + ${POLKIT_INCLUDE_DIRS} ) link_directories( @@ -23,7 +25,7 @@ link_directories( ##### install headers ########################### install( FILES - dummy-core.h + polkit-tqt-subject.h DESTINATION ${INCLUDE_INSTALL_DIR} ) @@ -31,34 +33,31 @@ install( FILES tde_add_library( polkit-tqt-core SHARED AUTOMOC SOURCES ${polkit_tqt_MOCS} - dummy-core.cpp + polkit-tqt-subject.cpp VERSION 0.0.0 - LINK ${TQT_LIBRARIES} + LINK ${TQT_LIBRARIES} ${POLKIT_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} ) -## set(polkit_tqt_core_SRCS -## polkittqt1-authority.cpp -## polkittqt1-identity.cpp -## polkittqt1-subject.cpp -## polkittqt1-temporaryauthorization.cpp -## polkittqt1-details.cpp -## polkittqt1-actiondescription.cpp -## ) -## -## target_link_libraries(polkit-tqt-core-1 -## ${TQT_TQTCORE_LIBRARY} -## ${TQT_TQTDBUS_LIBRARY} -## ${TQT_TQTXML_LIBRARY} -## ${POLKIT_LIBRARIES} -## ${GLIB2_LIBRARIES} -## ${GOBJECT_LIBRARIES} -## ${GIO_LIBRARIES} -## ) -## -## set_target_properties(polkit-tqt-core-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION} -## SOVERSION ${POLKITTQT-1_ABI_VERSION} -## DEFINE_SYMBOL MAKE_POLKITTQT1_LIB) -## -## install(TARGETS polkit-tqt-core-1 ${INSTALL_TARGETS_DEFAULT_ARGS}) +## set(polkit_tqt_core_SRCS +## polkittqt1-authority.cpp +## polkittqt1-identity.cpp +## polkittqt1-temporaryauthorization.cpp +## polkittqt1-details.cpp +## polkittqt1-actiondescription.cpp +## ) +## +## target_link_libraries(polkit-tqt-core-1 +## ${TQT_TQTDBUS_LIBRARY} +## ${TQT_TQTXML_LIBRARY} +## ${GLIB2_LIBRARIES} +## ${GOBJECT_LIBRARIES} +## ${GIO_LIBRARIES} +## ) +## +## set_target_properties(polkit-tqt-core-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION} +## SOVERSION ${POLKITTQT-1_ABI_VERSION} +## DEFINE_SYMBOL MAKE_POLKITTQT1_LIB) +## +## install(TARGETS polkit-tqt-core-1 ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/core/dummy-core.cpp b/core/dummy-core.cpp deleted file mode 100644 index a06506b44..000000000 --- a/core/dummy-core.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the Polkit-tqt project - * Copyright (C) 2009 Daniel Nicoletti <[email protected]> - * Copyright (C) 2009 Dario Freddi <[email protected]> - * Copyright (C) 2009 Jaroslav Reznik <[email protected]> - * Copyright (C) 2009 Radek Novacek <[email protected]> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "dummy-core.h" - -namespace PolkitTQt -{ - - -DummyCore* DummyCore::instance() -{ - return 0; -} - -} - -#include "dummy-core.moc" diff --git a/core/dummy-core.h b/core/dummy-core.h deleted file mode 100644 index 13b0fdcef..000000000 --- a/core/dummy-core.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of the Polkit-tqt project - * Copyright (C) 2009 Daniel Nicoletti <[email protected]> - * Copyright (C) 2009 Dario Freddi <[email protected]> - * Copyright (C) 2009 Jaroslav Reznik <[email protected]> - * Copyright (C) 2009 Radek Novacek <[email protected]> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef DUMMY_CORE_H -#define DUMMY_CORE_H - -#define POLKIT_TQT_EXPORT TQ_EXPORT - - -/** - * \namespace PolkitTQt1 PolkitTQt - * - * \brief Namespace wrapping Polkit-TQt classes - * - * This namespace wraps all Polkit-TQt classes. - */ -namespace PolkitTQt -{ - -/** - * \class DummyCore - * - * \brief Convenience class for TQt/KDE applications - * - * This class is a dummy used for initial basic compiling. - */ -class POLKIT_TQT_EXPORT DummyCore -{ -public: - - static DummyCore* instance(); -}; - -} - -#endif diff --git a/core/polkit-tqt-subject.cpp b/core/polkit-tqt-subject.cpp new file mode 100644 index 000000000..c243d7d5a --- /dev/null +++ b/core/polkit-tqt-subject.cpp @@ -0,0 +1,242 @@ +/* + * This file is part of the Polkit-tqt project + * Copyright (C) 2009 Jaroslav Reznik <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "polkit-tqt-subject.h" + +#include <tqglobal.h> +#include <tqshared.h> + +#include <polkit/polkit.h> + + +namespace PolkitTQt +{ + +//-------------------------------------- +// Subject::Data +//-------------------------------------- + +class Subject::Data : public TQShared +{ + public: + Data() : subject(NULL) + { + } + + Data(const Data &other) : subject(other.subject) + { + g_object_ref(subject); + } + + Data(PolkitSubject *_subject) : subject(_subject) + { + g_object_ref(subject); + } + + ~Data() + { + g_object_unref(subject); + } + + PolkitSubject *subject; +}; + +//-------------------------------------- +// Subject +//-------------------------------------- + +Subject::Subject() : d(new Data) +{ +} + +Subject::Subject(PolkitSubject *subject) : d(new Data(subject)) +{ +} + +Subject::Subject(const Subject &other) : d(other.d) +{ + d->ref(); +} + +Subject& Subject::operator=(const Subject &other) +{ + if (d != other.d) + { + if (d->deref()) + { + delete d; + } + d = other.d; + d->ref(); + } + return *this; +} + +Subject::~Subject() +{ + if (d->deref()) + { + delete d; + } +} + +bool Subject::isValid() const +{ + return (d->subject != NULL); +} + +PolkitSubject* Subject::subject() const +{ + return d->subject; +} + +void Subject::setSubject(PolkitSubject *subject) +{ + if (d->subject != subject) + { + g_object_unref(d->subject); + d->subject = subject; + g_object_ref(subject); + } +} + +TQString Subject::toString() const +{ + if (!d->subject) + { + return TQString::null; + } + return TQString::fromUtf8(polkit_subject_to_string(d->subject)); +} + +Subject Subject::fromString(const TQString &string) +{ + if (string.isEmpty()) + { + tqWarning(TQString("Cannot create valid Subject from empty string.")); + return Subject(); + } + + GError *error = NULL; + PolkitSubject *polsub = polkit_subject_from_string(string.utf8().data(), &error); + if (error != NULL) + { + tqWarning(TQString("Cannot create valid Subject from string: %1").arg(error->message)); + return Subject(); + } + + return Subject(polsub); +} + +//-------------------------------------- +// UnixProcessSubject +//-------------------------------------- + +UnixProcessSubject::UnixProcessSubject(TQ_LONG pid) : Subject() +{ + setSubject(polkit_unix_process_new_for_owner(pid, 0 , -1)); +} + +UnixProcessSubject::UnixProcessSubject(TQ_LONG pid, TQ_ULONG startTime) : Subject() +{ + setSubject(polkit_unix_process_new_for_owner(pid, startTime, -1)); +} + +UnixProcessSubject::UnixProcessSubject(PolkitUnixProcess *pkUnixProcess) + : Subject((PolkitSubject*)pkUnixProcess) +{ +} + +TQ_LONG UnixProcessSubject::pid() const +{ + return polkit_unix_process_get_pid((PolkitUnixProcess*)subject()); +} + +TQ_LONG UnixProcessSubject::startTime() const +{ + return polkit_unix_process_get_start_time((PolkitUnixProcess*)subject()); +} + +void UnixProcessSubject::setPid(TQ_LONG pid) +{ + polkit_unix_process_set_pid((PolkitUnixProcess*)subject(), pid); +} + +//-------------------------------------- +// SystemBusNameSubject +//-------------------------------------- + +SystemBusNameSubject::SystemBusNameSubject(const TQString &name) : Subject() +{ + setSubject(polkit_system_bus_name_new(name.utf8().data())); +} + +SystemBusNameSubject::SystemBusNameSubject(PolkitSystemBusName *pkSystemBusName) + : Subject((PolkitSubject*)pkSystemBusName) +{ +} + +TQString SystemBusNameSubject::name() const +{ + return TQString::fromUtf8(polkit_system_bus_name_get_name((PolkitSystemBusName*)subject())); +} + +void SystemBusNameSubject::setName(const TQString &name) +{ + polkit_system_bus_name_set_name((PolkitSystemBusName*)subject(), name.utf8().data()); +} + +//-------------------------------------- +// UnixSessionSubject +//-------------------------------------- + +UnixSessionSubject::UnixSessionSubject(const TQString &sessionId) : Subject() +{ + setSubject(polkit_unix_session_new(sessionId.utf8().data())); +} + +UnixSessionSubject::UnixSessionSubject(TQ_LONG pid) : Subject() +{ + GError *error = NULL; + setSubject(polkit_unix_session_new_for_process_sync(pid, NULL, &error)); + if (error != NULL) + { + tqWarning(TQString("Cannot create unix session subject from pid: %1").arg(error->message)); + setSubject(NULL); + } +} + +UnixSessionSubject::UnixSessionSubject(PolkitSystemBusName *pkUnixSession) + : Subject((PolkitSubject*)pkUnixSession) +{ +} + +TQString UnixSessionSubject::sessionId() const +{ + return TQString::fromUtf8(polkit_unix_session_get_session_id((PolkitUnixSession*)subject())); +} + +void UnixSessionSubject::setSessionId(const TQString &sessionId) +{ + polkit_unix_session_set_session_id((PolkitUnixSession*)subject(), sessionId.utf8().data()); +} + +} + diff --git a/core/polkittqt1-subject.h b/core/polkit-tqt-subject.h index 3f3b10279..5c92b7cff 100644 --- a/core/polkittqt1-subject.h +++ b/core/polkit-tqt-subject.h @@ -18,30 +18,30 @@ * Boston, MA 02110-1301, USA. */ -#ifndef POLKITTQT1_SUBJECT_H -#define POLKITTQT1_SUBJECT_H +#ifndef POLKIT_TQT_SUBJECT_H +#define POLKIT_TQT_SUBJECT_H -#include "polkittqt1-export.h" - -#include <TQtCore/TQObject> -#include <TQtCore/TQSharedData> +#include "polkit-tqt-export.h" typedef struct _PolkitSubject PolkitSubject; typedef struct _PolkitUnixProcess PolkitUnixProcess; typedef struct _PolkitSystemBusName PolkitSystemBusName; +class TQString; + + /** - * \namespace PolkitTQt1 PolkitTQt + * \namespace PolkitTQt PolkitTQt * * \brief Namespace wrapping PolicyKit-TQt classes * * This namespace wraps all PolicyKit-TQt classes. */ -namespace PolkitTQt1 +namespace PolkitTQt { /** - * \class Subject polkittqt1-subject.h Subject + * \class Subject polkit-tqt-subject.h Subject * \author Jaroslav Reznik <[email protected]> * * \brief This class represents PolicyKit subjects @@ -52,15 +52,20 @@ namespace PolkitTQt1 * \see SystemBusName * \see UnixSession */ -class POLKITTQT1_EXPORT Subject +class POLKIT_TQT_EXPORT Subject { -public: + public: Subject(); Subject(const Subject &other); ~Subject(); - Subject &operator=(const Subject &other); + Subject& operator=(const Subject &other); + /** + * Check whether a message is valid + * + * \return true is the subject is valid + */ bool isValid() const; /** @@ -71,11 +76,11 @@ public: TQString toString() const; /** - * Creates the Subject object from string reprezentation + * Creates the Subject object from string representation * - * \param string string reprezentation of the object + * \param string string representation of the object * - * \return Pointer to new Subject instance + * \return the new Subject instance */ static Subject fromString(const TQString &string); @@ -86,20 +91,20 @@ public: * * \return Pointer to PolkitSubject instance */ - PolkitSubject *subject() const; + PolkitSubject* subject() const; -protected: + protected: Subject(PolkitSubject *subject); void setSubject(PolkitSubject *subject); -private: + private: class Data; - TQExplicitlySharedDataPointer< Data > d; + Data *d; }; /** - * \class UnixProcessSubject polkittqt1-subject.h Subject + * \class UnixProcessSubject polkit-tqt-subject.h Subject * \author Jaroslav Reznik <[email protected]> * * \brief A class for representing a UNIX process. @@ -111,16 +116,16 @@ private: * * \sa Subject */ -class POLKITTQT1_EXPORT UnixProcessSubject : public Subject +class POLKIT_TQT_EXPORT UnixProcessSubject : public Subject { -public: + public: /** * Subject constructor, takes one parameter - PID. The start time * of process will be looked automatically. * * \param pid An Unix process PID. */ - explicit UnixProcessSubject(tqint64 pid); + explicit UnixProcessSubject(TQ_LONG pid); /** * Subject constructor, takes two parameters - PID and start time. @@ -128,7 +133,7 @@ public: * \param pid An Unix process PID. * \param startTime An Unix process start time. */ - UnixProcessSubject(tqint64 pid, tquint64 startTime); + UnixProcessSubject(TQ_LONG pid, TQ_ULONG startTime); /** * Subject constructor, it creates UnixProcess object from PolkitUnixProcess object @@ -144,34 +149,34 @@ public: * * \return A PID of associated Unix process. */ - tqint64 pid() const; + TQ_LONG pid() const; /** * Returns Unix process start time. * * \return A start time of associated Unix process. */ - tqint64 startTime() const; + TQ_LONG startTime() const; /** * Sets Unix process PID. * * \param pid An Unix process PID. */ - void setPid(tqint64 pid); + void setPid(TQ_LONG pid); }; /** - * \class SystemBusNameSubject polkittqt1-subject.h Subject + * \class SystemBusNameSubject polkit-tqt-subject.h Subject * \author Jaroslav Reznik <[email protected]> * * \brief A class for representing a process owning a unique name on the system bus. * * \sa Subject */ -class POLKITTQT1_EXPORT SystemBusNameSubject : public Subject +class POLKIT_TQT_EXPORT SystemBusNameSubject : public Subject { -public: + public: /** * Subject constructor, takes one parameter - system bus name. * @@ -204,19 +209,16 @@ public: }; /** - * \class UnixSessionSubject polkittqt1-subject.h Subject + * \class UnixSessionSubject polkit-tqt-subject.h Subject * \author Jaroslav Reznik <[email protected]> * * \brief A class for representing unix session. * - * The session id is an opaque string obtained from - * ConsoleKit. - * * \sa Subject */ -class POLKITTQT1_EXPORT UnixSessionSubject : public Subject +class POLKIT_TQT_EXPORT UnixSessionSubject : public Subject { -public: + public: /** * Subject constructor, takes one parameter - session id. * @@ -231,7 +233,7 @@ public: * * \param pid The session's process pid. */ - explicit UnixSessionSubject(tqint64 pid); + explicit UnixSessionSubject(TQ_LONG pid); /** * Subject constructor, it creates UnixSession object from PolkitUnixSession object @@ -260,3 +262,4 @@ public: } #endif + diff --git a/core/polkittqt1-actiondescription.cpp b/core/polkittqt1-actiondescription.cpp index 1cf9cf621..c9f57f64f 100644 --- a/core/polkittqt1-actiondescription.cpp +++ b/core/polkittqt1-actiondescription.cpp @@ -25,7 +25,7 @@ #include <polkit/polkit.h> -namespace PolkitTQt1 +namespace PolkitTQt { class ActionDescription::Data : public TQSharedData @@ -85,12 +85,12 @@ ActionDescription::ActionDescription(PolkitActionDescription *polkitActionDescri polkitActionDescription)); } -ActionDescription::ActionDescription(const PolkitTQt1::ActionDescription& other) +ActionDescription::ActionDescription(const PolkitTQt::ActionDescription& other) : d(other.d) { } -ActionDescription& ActionDescription::operator=(const PolkitTQt1::ActionDescription& other) +ActionDescription& ActionDescription::operator=(const PolkitTQt::ActionDescription& other) { d = other.d; return *this; diff --git a/core/polkittqt1-actiondescription.h b/core/polkittqt1-actiondescription.h index 666f3be67..3a6792654 100644 --- a/core/polkittqt1-actiondescription.h +++ b/core/polkittqt1-actiondescription.h @@ -22,7 +22,7 @@ #ifndef POLKITTQT1_ACTION_DESCRIPTION_H #define POLKITTQT1_ACTION_DESCRIPTION_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include <TQtCore/TQList> #include <TQtCore/TQMetaType> @@ -30,7 +30,7 @@ typedef struct _PolkitActionDescription PolkitActionDescription; -namespace PolkitTQt1 +namespace PolkitTQt { /** * \class ActionDescription polkittqt1-actiondescription.h ActionDescription @@ -39,7 +39,7 @@ namespace PolkitTQt1 * * \brief Class used to encapsulate a registered action. */ -class POLKITTQT1_EXPORT ActionDescription +class POLKIT_TQT_EXPORT ActionDescription { public: enum ImplicitAuthorization { @@ -144,6 +144,6 @@ private: }; } -TQ_DECLARE_METATYPE(PolkitTQt1::ActionDescription::List) +TQ_DECLARE_METATYPE(PolkitTQt::ActionDescription::List) #endif //POLKIT_TQT_ACTION_DESCRIPTION_H diff --git a/core/polkittqt1-authority.cpp b/core/polkittqt1-authority.cpp index 8ec922d2e..ecdfc17ac 100644 --- a/core/polkittqt1-authority.cpp +++ b/core/polkittqt1-authority.cpp @@ -28,7 +28,7 @@ #include <polkit/polkit.h> -namespace PolkitTQt1 +namespace PolkitTQt { class AuthorityHelper @@ -140,8 +140,8 @@ Authority::Authority(PolkitAuthority *authority, TQObject *parent) : TQObject(parent) , d(new Private(this)) { - qRegisterMetaType<PolkitTQt1::Authority::Result> (); - qRegisterMetaType<PolkitTQt1::ActionDescription::List>(); + qRegisterMetaType<PolkitTQt::Authority::Result> (); + qRegisterMetaType<PolkitTQt::ActionDescription::List>(); Q_ASSERT(!s_globalAuthority()->q); s_globalAuthority()->q = this; diff --git a/core/polkittqt1-authority.h b/core/polkittqt1-authority.h index 6ced45ad6..ae71a86b2 100644 --- a/core/polkittqt1-authority.h +++ b/core/polkittqt1-authority.h @@ -24,7 +24,7 @@ #ifndef POLKITTQT1_AUTHORITY_H #define POLKITTQT1_AUTHORITY_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include "polkittqt1-identity.h" #include "polkittqt1-subject.h" #include "polkittqt1-temporaryauthorization.h" @@ -37,13 +37,13 @@ typedef struct _PolkitAuthority PolkitAuthority; class TQStringList; /** - * \namespace PolkitTQt1 PolkitTQt + * \namespace PolkitTQt PolkitTQt * * \brief Namespace wrapping Polkit-TQt classes * * This namespace wraps all Polkit-TQt classes. */ -namespace PolkitTQt1 +namespace PolkitTQt { /** @@ -63,7 +63,7 @@ namespace PolkitTQt1 * Call Authority::instance() to get an instance of the Authority object. * Do not delete Authority::instance(), cleanup will be done automatically. */ -class POLKITTQT1_EXPORT Authority : public TQObject +class POLKIT_TQT_EXPORT Authority : public TQObject { Q_OBJECT TQ_DISABLE_COPY(Authority) @@ -343,7 +343,7 @@ public: * \return \c true if authority acknowledged the call, \c false if error is set. * */ - bool authenticationAgentResponseSync(const TQString& cookie, const PolkitTQt1::Identity& identity); + bool authenticationAgentResponseSync(const TQString& cookie, const PolkitTQt::Identity& identity); /** * This method can be used to cancel the authenticationAgentResponseAsync method. @@ -465,14 +465,14 @@ Q_SIGNALS: * * The argument is the result of authorization. */ - void checkAuthorizationFinished(PolkitTQt1::Authority::Result); + void checkAuthorizationFinished(PolkitTQt::Authority::Result); /** * This signal is emitted when asynchronous method enumerateActions finishes. * * The argument is the list of all Action IDs. */ - void enumerateActionsFinished(PolkitTQt1::ActionDescription::List); + void enumerateActionsFinished(PolkitTQt::ActionDescription::List); /** * This signal is emitted when asynchronous method registerAuthenticationAgent finishes. @@ -504,7 +504,7 @@ Q_SIGNALS: * * \note Free all TemporaryAuthorization objects using \p delete operator. */ - void enumerateTemporaryAuthorizationsFinished(PolkitTQt1::TemporaryAuthorization::List); + void enumerateTemporaryAuthorizationsFinished(PolkitTQt::TemporaryAuthorization::List); /** * This signal is emmited when asynchronous method revokeTemporaryAuthorizations finishes. @@ -533,7 +533,7 @@ private: } -Q_DECLARE_OPERATORS_FOR_FLAGS(PolkitTQt1::Authority::AuthorizationFlags) -Q_DECLARE_METATYPE(PolkitTQt1::Authority::Result) +Q_DECLARE_OPERATORS_FOR_FLAGS(PolkitTQt::Authority::AuthorizationFlags) +Q_DECLARE_METATYPE(PolkitTQt::Authority::Result) #endif diff --git a/core/polkittqt1-details.cpp b/core/polkittqt1-details.cpp index 3175926c8..033ef6c35 100644 --- a/core/polkittqt1-details.cpp +++ b/core/polkittqt1-details.cpp @@ -24,7 +24,7 @@ #include <polkit/polkit.h> -namespace PolkitTQt1 +namespace PolkitTQt { class Details::Data : public TQSharedData @@ -63,7 +63,7 @@ Details::~Details() { } -Details& Details::operator=(const PolkitTQt1::Details& other) +Details& Details::operator=(const PolkitTQt::Details& other) { d = other.d; return *this; diff --git a/core/polkittqt1-details.h b/core/polkittqt1-details.h index 89e4e5b80..9bd71618f 100644 --- a/core/polkittqt1-details.h +++ b/core/polkittqt1-details.h @@ -21,7 +21,7 @@ #ifndef POLKITTQT1_DETAILS_H #define POLKITTQT1_DETAILS_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include <TQtCore/TQObject> #include <TQtCore/TQSharedData> @@ -29,13 +29,13 @@ typedef struct _PolkitDetails PolkitDetails; /** - * \namespace PolkitTQt1 PolkitTQt + * \namespace PolkitTQt PolkitTQt * * \brief Namespace wrapping Polkit-TQt classes * * This namespace wraps all Polkit-TQt classes. */ -namespace PolkitTQt1 +namespace PolkitTQt { /** @@ -44,7 +44,7 @@ namespace PolkitTQt1 * * \brief Class used for passing details around. */ -class POLKITTQT1_EXPORT Details +class POLKIT_TQT_EXPORT Details { public: /** @@ -89,7 +89,7 @@ public: TQStringList keys() const; private: class Data; - TQExplicitlySharedDataPointer< Data > d; + Data *d; }; } diff --git a/core/polkittqt1-identity.cpp b/core/polkittqt1-identity.cpp index 8be2b55dc..b2fc5fa0b 100644 --- a/core/polkittqt1-identity.cpp +++ b/core/polkittqt1-identity.cpp @@ -24,7 +24,7 @@ #include <TQtCore/TQDebug> -namespace PolkitTQt1 +namespace PolkitTQt { class Identity::Data : public TQSharedData @@ -66,7 +66,7 @@ Identity::Identity(PolkitIdentity *polkitIdentity) } } -Identity::Identity(const PolkitTQt1::Identity& other) +Identity::Identity(const PolkitTQt::Identity& other) : d(other.d) { @@ -76,7 +76,7 @@ Identity::~Identity() { } -Identity& Identity::operator=(const PolkitTQt1::Identity& other) +Identity& Identity::operator=(const PolkitTQt::Identity& other) { d = other.d; return *this; diff --git a/core/polkittqt1-identity.h b/core/polkittqt1-identity.h index 600eba5e8..2ea984eee 100644 --- a/core/polkittqt1-identity.h +++ b/core/polkittqt1-identity.h @@ -21,7 +21,7 @@ #ifndef POLKITTQT1_IDENTITY_H #define POLKITTQT1_IDENTITY_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include <unistd.h> @@ -33,13 +33,13 @@ typedef struct _PolkitUnixUser PolkitUnixUser; typedef struct _PolkitUnixGroup PolkitUnixGroup; /** - * \namespace PolkitTQt1 PolkitTQt + * \namespace PolkitTQt PolkitTQt * * \brief Namespace wrapping Polkit-TQt classes * * This namespace wraps all Polkit-TQt classes. */ -namespace PolkitTQt1 +namespace PolkitTQt { class UnixUserIdentity; @@ -56,7 +56,7 @@ class UnixGroupIdentity; * \see UnixGroup * \see UnixUser */ -class POLKITTQT1_EXPORT Identity +class POLKIT_TQT_EXPORT Identity { public: typedef TQList< Identity > List; @@ -103,7 +103,7 @@ protected: private: class Data; - TQExplicitlySharedDataPointer< Data > d; + Data *d; }; /** @@ -114,7 +114,7 @@ private: * \brief UNIX user identity * \sa Identity */ -class POLKITTQT1_EXPORT UnixUserIdentity : public Identity +class POLKIT_TQT_EXPORT UnixUserIdentity : public Identity { public: UnixUserIdentity(); @@ -164,7 +164,7 @@ public: * \brief UNIX group identity * \sa Identity */ -class POLKITTQT1_EXPORT UnixGroupIdentity : public Identity +class POLKIT_TQT_EXPORT UnixGroupIdentity : public Identity { public: UnixGroupIdentity(); diff --git a/core/polkittqt1-subject.cpp b/core/polkittqt1-subject.cpp deleted file mode 100644 index bafeaee56..000000000 --- a/core/polkittqt1-subject.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * This file is part of the Polkit-tqt project - * Copyright (C) 2009 Jaroslav Reznik <[email protected]> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "polkittqt1-subject.h" - -#include <TQtCore/TQDebug> -#include <polkit/polkit.h> - -namespace PolkitTQt1 -{ - -class Subject::Data : public TQSharedData -{ -public: - Data() - : TQSharedData() - , subject(0) - {} - Data(const Data& other) - : TQSharedData(other) - , subject(other.subject) - { - g_object_ref(subject); - } - ~Data() - { - g_object_unref(subject); - } - - PolkitSubject *subject; -}; - -Subject::Subject() - : d(new Data) -{ - g_type_init(); -} - -Subject::Subject(PolkitSubject *subject) - : d(new Data) -{ - g_type_init(); - d->subject = subject; -} - -Subject::Subject(const PolkitTQt1::Subject& other) - : d(other.d) -{ - -} - -Subject& Subject::operator=(const PolkitTQt1::Subject& other) -{ - d = other.d; - return *this; -} - -Subject::~Subject() -{ -} - -bool Subject::isValid() const -{ - return d->subject != NULL; -} - -PolkitSubject *Subject::subject() const -{ - return d->subject; -} - -void Subject::setSubject(PolkitSubject *subject) -{ - d->subject = subject; -} - -TQString Subject::toString() const -{ - Q_ASSERT(d->subject); - return TQString::fromUtf8(polkit_subject_to_string(d->subject)); -} - -Subject Subject::fromString(const TQString &string) -{ - // should be in polkit library!!! but for strange reason it's necessary to have it here - g_type_init(); - - Subject subject; - GError *error = NULL; - subject.d->subject = polkit_subject_from_string(string.toUtf8().data(), &error); - if (error != NULL) { - tqWarning() << TQString("Cannot create Subject from string: %1").arg(error->message); - return NULL; - } - return subject; -} - -UnixProcessSubject::UnixProcessSubject(tqint64 pid) - : Subject() -{ - setSubject(polkit_unix_process_new(pid)); -} - -UnixProcessSubject::UnixProcessSubject(tqint64 pid, tquint64 startTime) - : Subject() -{ - setSubject(polkit_unix_process_new_full(pid, startTime)); -} - -UnixProcessSubject::UnixProcessSubject(PolkitUnixProcess *pkUnixProcess) - : Subject((PolkitSubject *) pkUnixProcess) -{ - -} - -tqint64 UnixProcessSubject::pid() const -{ - return polkit_unix_process_get_pid((PolkitUnixProcess *) subject()); -} - -tqint64 UnixProcessSubject::startTime() const -{ - return polkit_unix_process_get_start_time((PolkitUnixProcess *) subject()); -} - -void UnixProcessSubject::setPid(tqint64 pid) -{ - polkit_unix_process_set_pid((PolkitUnixProcess *) subject(), pid); -} - -// ----- SystemBusName -SystemBusNameSubject::SystemBusNameSubject(const TQString &name) - : Subject() -{ - setSubject(polkit_system_bus_name_new(name.toUtf8().data())); -} - -SystemBusNameSubject::SystemBusNameSubject(PolkitSystemBusName *pkSystemBusName) - : Subject((PolkitSubject *) pkSystemBusName) -{ - -} - -TQString SystemBusNameSubject::name() const -{ - return TQString::fromUtf8(polkit_system_bus_name_get_name((PolkitSystemBusName *) subject())); -} - -void SystemBusNameSubject::setName(const TQString &name) -{ - polkit_system_bus_name_set_name((PolkitSystemBusName *) subject(), name.toUtf8().data()); -} - -// ----- SystemSession -UnixSessionSubject::UnixSessionSubject(const TQString &sessionId) - : Subject() -{ - setSubject(polkit_unix_session_new(sessionId.toUtf8().data())); -} - -UnixSessionSubject::UnixSessionSubject(tqint64 pid) - : Subject() -{ - GError *error = NULL; - setSubject(polkit_unix_session_new_for_process_sync(pid, NULL, &error)); - if (error != NULL) { - tqWarning() << TQString("Cannot create unix session: %1").arg(error->message); - setSubject(NULL); - } -} - -UnixSessionSubject::UnixSessionSubject(PolkitSystemBusName *pkUnixSession) - : Subject((PolkitSubject *) pkUnixSession) -{ - -} - -TQString UnixSessionSubject::sessionId() const -{ - return TQString::fromUtf8(polkit_unix_session_get_session_id((PolkitUnixSession *) subject())); -} - -void UnixSessionSubject::setSessionId(const TQString &sessionId) -{ - polkit_unix_session_set_session_id((PolkitUnixSession *) subject(), sessionId.toUtf8().data()); -} - -} diff --git a/core/polkittqt1-temporaryauthorization.cpp b/core/polkittqt1-temporaryauthorization.cpp index e0aa01871..2665d793e 100644 --- a/core/polkittqt1-temporaryauthorization.cpp +++ b/core/polkittqt1-temporaryauthorization.cpp @@ -23,7 +23,7 @@ #include <polkit/polkit.h> -namespace PolkitTQt1 +namespace PolkitTQt { class TemporaryAuthorization::Data : public TQSharedData @@ -60,7 +60,7 @@ TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization *pkT g_object_unref(pkTemporaryAuthorization); } -TemporaryAuthorization::TemporaryAuthorization(const PolkitTQt1::TemporaryAuthorization& other) +TemporaryAuthorization::TemporaryAuthorization(const PolkitTQt::TemporaryAuthorization& other) : d(other.d) { @@ -72,7 +72,7 @@ TemporaryAuthorization::TemporaryAuthorization() } -TemporaryAuthorization& TemporaryAuthorization::operator=(const PolkitTQt1::TemporaryAuthorization& other) +TemporaryAuthorization& TemporaryAuthorization::operator=(const PolkitTQt::TemporaryAuthorization& other) { d = other.d; return *this; diff --git a/core/polkittqt1-temporaryauthorization.h b/core/polkittqt1-temporaryauthorization.h index 8fbbaaa94..cdcbda097 100644 --- a/core/polkittqt1-temporaryauthorization.h +++ b/core/polkittqt1-temporaryauthorization.h @@ -31,13 +31,13 @@ typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization; /** - * \namespace PolkitTQt1 PolkitTQt + * \namespace PolkitTQt PolkitTQt * * \brief Namespace wrapping PolicyKit-TQt classes * * This namespace wraps all PolicyKit-TQt classes. */ -namespace PolkitTQt1 +namespace PolkitTQt { /** @@ -48,7 +48,7 @@ namespace PolkitTQt1 * * This class encapsulates the PolkitTemporaryAuthorization interface. */ -class POLKITTQT1_EXPORT TemporaryAuthorization +class POLKIT_TQT_EXPORT TemporaryAuthorization { public: typedef TQList< TemporaryAuthorization > List; @@ -119,6 +119,6 @@ private: }; } -TQ_DECLARE_METATYPE(PolkitTQt1::TemporaryAuthorization::List) +TQ_DECLARE_METATYPE(PolkitTQt::TemporaryAuthorization::List) #endif // TEMPORARYAUTHORIZATION_H |