From eb2210c94488f6c57159fede9a98891e4f3a1a52 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 5 Nov 2021 18:54:42 +0900 Subject: [PATCH] More conversion polkitqt1 -> polkit-tqt. Started conversion of 'core' library module. Signed-off-by: Michele Calgaro --- CMakeLists.txt | 82 +++--- ConfigureChecks.cmake | 7 + agent/polkitqt1-agent-listener.h | 2 +- cmake/modules/InstallSettings.cmake | 9 +- core/CMakeLists.txt | 53 ++-- core/dummy-core.h | 56 ---- core/polkit-tqt-subject.cpp | 242 ++++++++++++++++++ ...kittqt1-subject.h => polkit-tqt-subject.h} | 77 +++--- core/polkittqt1-actiondescription.cpp | 6 +- core/polkittqt1-actiondescription.h | 8 +- core/polkittqt1-authority.cpp | 6 +- core/polkittqt1-authority.h | 20 +- core/polkittqt1-details.cpp | 4 +- core/polkittqt1-details.h | 10 +- core/polkittqt1-identity.cpp | 6 +- core/polkittqt1-identity.h | 14 +- core/polkittqt1-subject.cpp | 205 --------------- core/polkittqt1-temporaryauthorization.cpp | 6 +- core/polkittqt1-temporaryauthorization.h | 8 +- debian/copyright | 2 +- debian/libpolkit-tqt-dev.install | 48 ++-- gui/polkittqt1-gui-action.cpp | 6 +- gui/polkittqt1-gui-action.h | 6 +- gui/polkittqt1-gui-actionbutton.h | 2 +- .../ActionDescription | 0 .../{PolkitTQt1 => PolkitTQt}/Agent/Listener | 0 .../{PolkitTQt1 => PolkitTQt}/Agent/Session | 0 includes/{PolkitTQt1 => PolkitTQt}/Authority | 0 includes/{PolkitTQt1 => PolkitTQt}/Details | 0 includes/{PolkitTQt1 => PolkitTQt}/Gui/Action | 0 .../Gui/ActionButton | 0 .../Gui/ActionButtons | 0 includes/{PolkitTQt1 => PolkitTQt}/Identity | 0 includes/PolkitTQt/Subject | 1 + .../TemporaryAuthorization | 0 includes/PolkitTQt1/Subject | 1 - core/dummy-core.cpp => polkit-tqt-export.h | 19 +- polkittqt1-export.h | 44 ---- polkittqt1-version.h.cmake | 2 +- test/test.cpp | 2 +- 40 files changed, 442 insertions(+), 512 deletions(-) delete mode 100644 core/dummy-core.h create mode 100644 core/polkit-tqt-subject.cpp rename core/{polkittqt1-subject.h => polkit-tqt-subject.h} (80%) delete mode 100644 core/polkittqt1-subject.cpp rename includes/{PolkitTQt1 => PolkitTQt}/ActionDescription (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Agent/Listener (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Agent/Session (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Authority (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Details (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Gui/Action (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Gui/ActionButton (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Gui/ActionButtons (100%) rename includes/{PolkitTQt1 => PolkitTQt}/Identity (100%) create mode 100644 includes/PolkitTQt/Subject rename includes/{PolkitTQt1 => PolkitTQt}/TemporaryAuthorization (100%) delete mode 100644 includes/PolkitTQt1/Subject rename core/dummy-core.cpp => polkit-tqt-export.h (73%) delete mode 100644 polkittqt1-export.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e5c4a058..09783c880 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,23 +86,33 @@ add_subdirectory(gui) add_subdirectory(agent) +##### install files #### ######################## + +install( + FILES +## includes/PolkitTQt/Authority +## includes/PolkitTQt/Details +## includes/PolkitTQt/Identity + includes/PolkitTQt/Subject +## includes/PolkitTQt/TemporaryAuthorization +## includes/PolkitTQt/ActionDescription + DESTINATION + ${INCLUDE_INSTALL_DIR}/PolkitTQt ) ## find_package(Qt4 REQUIRED) -## find_package(Polkit REQUIRED) ## find_package(GObject REQUIRED) ## find_package(GIO REQUIRED) -## +## ## add_definitions(-DTQT_NO_KEYWORDS) -## +## ## include (${TQT_USE_FILE}) ## include (InstallSettings) ## include (MacroWriteBasicCMakeVersionFile) ## include (CheckFunctionExists) -## +## ## include_directories( ## ${CMAKE_CURRENT_BINARY_DIR} -## ${POLKIT_INCLUDE_DIR} ## ${POLKIT_AGENT_INCLUDE_DIR} ## ${GLIB2_INCLUDE_DIR} ## ${GOBJECT_INCLUDE_DIR} @@ -112,73 +122,63 @@ add_subdirectory(agent) ## ${CMAKE_CURRENT_SOURCE_DIR}/includes ## ${TQT_TQTXML_INCLUDE_DIR} ## ) -## +## ## # Check for older polkit ## set(CMAKE_REQUIRED_INCLUDES ${POLKIT_INCLUDE_DIR} ${POLKIT_AGENT_INCLUDE_DIR}) ## set(CMAKE_REQUIRED_LIBRARIES ${POLKIT_LIBRARIES} ${POLKIT_AGENT_LIBRARY}) ## check_function_exists(polkit_agent_listener_register HAVE_POLKIT_AGENT_LISTENER_REGISTER) ## check_function_exists(polkit_authority_get_sync HAVE_POLKIT_AUTHORITY_GET_SYNC) -## +## ## if (NOT HAVE_POLKIT_AGENT_LISTENER_REGISTER OR NOT HAVE_POLKIT_AUTHORITY_GET_SYNC) ## message(STATUS "You have an older polkit-1 version: Polkit-TQt-1 will be built in compatibility mode") ## add_definitions(-DPOLKIT_TQT_1_COMPATIBILITY_MODE) ## endif (NOT HAVE_POLKIT_AGENT_LISTENER_REGISTER OR NOT HAVE_POLKIT_AUTHORITY_GET_SYNC) -## +## ## if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2) ## option(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR "Prefer to install the Config.cmake files to lib/cmake/ instead of lib//cmake" TRUE) ## endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2) -## +## ## # The SONUMBER of the polkit-qt-1 libraries ## set(POLKIT-TQT_ABI_VERSION 1) ## # The version number of the polkit-qt-1 libraries ## set(POLKIT-TQT_LIBRARY_VERSION "${POLKIT-TQT_ABI_VERSION}.${POLKIT-TQT_VERSION_MINOR}.${POLKIT-TQT_VERSION_PATCH}") -## +## ## configure_file(polkittqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h) -## +## ## install(FILES ## gui/polkittqt1-gui-action.h ## gui/polkittqt1-gui-actionbutton.h ## gui/polkittqt1-gui-actionbuttons.h -## +## ## core/polkittqt1-authority.h ## core/polkittqt1-details.h ## core/polkittqt1-identity.h ## core/polkittqt1-subject.h ## core/polkittqt1-temporaryauthorization.h ## core/polkittqt1-actiondescription.h -## +## ## agent/polkittqt1-agent-listener.h ## agent/polkittqt1-agent-session.h -## +## ## ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h -## polkittqt1-export.h -## -## DESTINATION -## ${INCLUDE_INSTALL_DIR}/polkit-qt-1 COMPONENT Devel) -## -## install(FILES -## includes/PolkitTQt1/Authority -## includes/PolkitTQt1/Details -## includes/PolkitTQt1/Identity -## includes/PolkitTQt1/Subject -## includes/PolkitTQt1/TemporaryAuthorization -## includes/PolkitTQt1/ActionDescription +## polkit-tqt-export.h +## ## DESTINATION -## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1 COMPONENT Devel) -## +## ${INCLUDE_INSTALL_DIR}/polkit-qt-1 ) +## ## install(FILES ## includes/PolkitTQt1/Gui/Action ## includes/PolkitTQt1/Gui/ActionButton ## includes/PolkitTQt1/Gui/ActionButtons ## DESTINATION -## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui COMPONENT Devel) -## +## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui ) +## ## install(FILES ## includes/PolkitTQt1/Agent/Listener ## includes/PolkitTQt1/Agent/Session ## DESTINATION -## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Agent COMPONENT Devel) -## +## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Agent ) +## ## if(NOT WIN32) ## # Pkgconfig ## configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc @ONLY) @@ -192,36 +192,36 @@ add_subdirectory(agent) ## @ONLY) ## install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) ## endif(NOT WIN32) -## +## ## # CMake Config files ## configure_file(PolkitTQt-1Config.cmake.in "${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake" @ONLY) -## +## ## # this file is used by to check if the installed version can be used. ## macro_write_basic_cmake_version_file(${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake ## ${POLKIT-TQT_VERSION_MAJOR} ${POLKIT-TQT_VERSION_MINOR} ${POLKIT-TQT_VERSION_PATCH}) -## +## ## if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) ## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/PolkitTQt-1) ## else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) ## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/PolkitTQt-1/cmake) ## endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) -## +## ## install(FILES ${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake ## ${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake ## DESTINATION ${_PolkitTQt-1Config_INSTALL_DIR} ) -## +## ## option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF) ## if (BUILD_EXAMPLES) ## add_subdirectory(examples) ## endif (BUILD_EXAMPLES) -## +## ## add_subdirectory(cmake) -## +## ## option(BUILD_TEST "Builds unit tests for polkit-qt-1" OFF) ## if (BUILD_TEST) ## add_subdirectory(test) ## endif (BUILD_TEST) -## -## +## +## ## # Always last! ## include (PolkitTQt-1Dist) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index fef675949..49045b496 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -22,6 +22,13 @@ tde_setup_largefiles( ) # tqt find_package( TQt ) +# polkit +pkg_search_module( POLKIT polkit-gobject-1 ) +if( NOT POLKIT_FOUND ) + tde_message_fatal( "polkit is required, but was not found on your system" ) +endif( ) + + # gcc visibility if( WITH_GCC_VISIBILITY ) tde_setup_gcc_visibility( ) diff --git a/agent/polkitqt1-agent-listener.h b/agent/polkitqt1-agent-listener.h index a5f2a0d40..964cc84a2 100644 --- a/agent/polkitqt1-agent-listener.h +++ b/agent/polkitqt1-agent-listener.h @@ -21,7 +21,7 @@ #ifndef POLKITTQT1_AGENT_LISTENER_H #define POLKITTQT1_AGENT_LISTENER_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include diff --git a/cmake/modules/InstallSettings.cmake b/cmake/modules/InstallSettings.cmake index 8c7431718..4c0605a72 100644 --- a/cmake/modules/InstallSettings.cmake +++ b/cmake/modules/InstallSettings.cmake @@ -121,16 +121,9 @@ endif (WIN32) # This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go # into bin/. # Later on it will be possible to extend this for installing OSX frameworks -# The COMPONENT Devel argument has the effect that static libraries belong to the -# "Devel" install component. If we use this also for all install() commands -# for header files, it will be possible to install -# -everything: make install OR cmake -P cmake_install.cmake -# -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake -# -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake -# This can then also be used for packaging with cpack. set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) + ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" ) 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.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 - * Copyright (C) 2009 Dario Freddi - * Copyright (C) 2009 Jaroslav Reznik - * Copyright (C) 2009 Radek Novacek - * - * 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 + * + * 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 +#include + +#include + + +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 similarity index 80% rename from core/polkittqt1-subject.h rename to 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 -#include +#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 * * \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 * * \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 * * \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 * * \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 -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 #include @@ -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 -namespace PolkitTQt1 +namespace PolkitTQt { class AuthorityHelper @@ -140,8 +140,8 @@ Authority::Authority(PolkitAuthority *authority, TQObject *parent) : TQObject(parent) , d(new Private(this)) { - qRegisterMetaType (); - qRegisterMetaType(); + qRegisterMetaType (); + qRegisterMetaType(); 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 -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 #include @@ -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 -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 @@ -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 - * - * 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 -#include - -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 -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 diff --git a/debian/copyright b/debian/copyright index a915b05f7..aee563e1f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -21,7 +21,7 @@ Copyright: Copyright (C) 2009 Radek Novacek Copyright (C) 2009 Lukas Tinkl -Copyright for polkittqt1-export.h file: +Copyright for polkit-tqt-export.h file: Copyright (C) 2009 Dario Freddi Copyright (C) 2007 David Faure diff --git a/debian/libpolkit-tqt-dev.install b/debian/libpolkit-tqt-dev.install index 8ad85164b..4eeddc244 100644 --- a/debian/libpolkit-tqt-dev.install +++ b/debian/libpolkit-tqt-dev.install @@ -1,27 +1,27 @@ -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/ActionDescription -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Agent/Listener -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Agent/Session -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Authority -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Details -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/Action -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/ActionButton -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/ActionButtons -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Identity -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Subject -#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/TemporaryAuthorization -#debian/tmp/usr/include/polkit-tqt/polkittqt1-actiondescription.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-agent-listener.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-agent-session.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-authority.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-details.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-export.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-action.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-actionbutton.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-actionbuttons.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-identity.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-subject.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-temporaryauthorization.h -#debian/tmp/usr/include/polkit-tqt/polkittqt1-version.h +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/ActionDescription +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Listener +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Session +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Authority +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Details +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/Action +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/ActionButton +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/ActionButtons +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Identity +debian/tmp/usr/include/polkit-tqt/PolkitTQt/Subject +#debian/tmp/usr/include/polkit-tqt/PolkitTQt/TemporaryAuthorization +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-actiondescription.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-agent-listener.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-agent-session.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-authority.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-details.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-export.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-action.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-actionbutton.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-actionbuttons.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-identity.h +debian/tmp/usr/include/polkit-tqt/polkit-tqt-subject.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-temporaryauthorization.h +#debian/tmp/usr/include/polkit-tqt/polkit-tqt-version.h #debian/tmp/usr/lib/cmake/PolkitTQt-1/PolkitTQt-1Config.cmake #debian/tmp/usr/lib/cmake/PolkitTQt-1/PolkitTQt-1ConfigVersion.cmake debian/tmp/usr/lib/libpolkit-tqt-agent.so diff --git a/gui/polkittqt1-gui-action.cpp b/gui/polkittqt1-gui-action.cpp index 31f01cfb7..2b50570d7 100644 --- a/gui/polkittqt1-gui-action.cpp +++ b/gui/polkittqt1-gui-action.cpp @@ -44,7 +44,7 @@ public: TQString actionId; Authority::Result pkResult; - tqint64 targetPID; + TQ_LONG targetPID; void updateAction(); bool computePkResult(); @@ -232,7 +232,7 @@ bool Action::Private::computePkResult() return old_result != pkResult; } -tqint64 Action::targetPID() const +TQ_LONG Action::targetPID() const { if (d->targetPID != 0) { return d->targetPID; @@ -241,7 +241,7 @@ tqint64 Action::targetPID() const } } -void Action::setTargetPID(tqint64 pid) +void Action::setTargetPID(TQ_LONG pid) { d->targetPID = pid; diff --git a/gui/polkittqt1-gui-action.h b/gui/polkittqt1-gui-action.h index 6ee42179c..9e0fb255a 100644 --- a/gui/polkittqt1-gui-action.h +++ b/gui/polkittqt1-gui-action.h @@ -22,7 +22,7 @@ #ifndef POLKITTQT1_GUI_ACTION_H #define POLKITTQT1_GUI_ACTION_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include @@ -207,7 +207,7 @@ public: * * \param pid The target process id; 0 if it is the current process */ - void setTargetPID(tqint64 pid); + void setTargetPID(TQ_LONG pid); /** * Gets the text of the action when it is in the specified state @@ -265,7 +265,7 @@ public: /** * \see setTargetPID */ - tqint64 targetPID() const; + TQ_LONG targetPID() const; /** * This method can be used to check the if the current action diff --git a/gui/polkittqt1-gui-actionbutton.h b/gui/polkittqt1-gui-actionbutton.h index c47a9bcc0..d0fcfaa94 100644 --- a/gui/polkittqt1-gui-actionbutton.h +++ b/gui/polkittqt1-gui-actionbutton.h @@ -22,7 +22,7 @@ #ifndef POLKITTQT1_GUI_ACTIONBUTTON_H #define POLKITTQT1_GUI_ACTIONBUTTON_H -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" #include "polkittqt1-gui-action.h" class TQAbstractButton; diff --git a/includes/PolkitTQt1/ActionDescription b/includes/PolkitTQt/ActionDescription similarity index 100% rename from includes/PolkitTQt1/ActionDescription rename to includes/PolkitTQt/ActionDescription diff --git a/includes/PolkitTQt1/Agent/Listener b/includes/PolkitTQt/Agent/Listener similarity index 100% rename from includes/PolkitTQt1/Agent/Listener rename to includes/PolkitTQt/Agent/Listener diff --git a/includes/PolkitTQt1/Agent/Session b/includes/PolkitTQt/Agent/Session similarity index 100% rename from includes/PolkitTQt1/Agent/Session rename to includes/PolkitTQt/Agent/Session diff --git a/includes/PolkitTQt1/Authority b/includes/PolkitTQt/Authority similarity index 100% rename from includes/PolkitTQt1/Authority rename to includes/PolkitTQt/Authority diff --git a/includes/PolkitTQt1/Details b/includes/PolkitTQt/Details similarity index 100% rename from includes/PolkitTQt1/Details rename to includes/PolkitTQt/Details diff --git a/includes/PolkitTQt1/Gui/Action b/includes/PolkitTQt/Gui/Action similarity index 100% rename from includes/PolkitTQt1/Gui/Action rename to includes/PolkitTQt/Gui/Action diff --git a/includes/PolkitTQt1/Gui/ActionButton b/includes/PolkitTQt/Gui/ActionButton similarity index 100% rename from includes/PolkitTQt1/Gui/ActionButton rename to includes/PolkitTQt/Gui/ActionButton diff --git a/includes/PolkitTQt1/Gui/ActionButtons b/includes/PolkitTQt/Gui/ActionButtons similarity index 100% rename from includes/PolkitTQt1/Gui/ActionButtons rename to includes/PolkitTQt/Gui/ActionButtons diff --git a/includes/PolkitTQt1/Identity b/includes/PolkitTQt/Identity similarity index 100% rename from includes/PolkitTQt1/Identity rename to includes/PolkitTQt/Identity diff --git a/includes/PolkitTQt/Subject b/includes/PolkitTQt/Subject new file mode 100644 index 000000000..edca12e86 --- /dev/null +++ b/includes/PolkitTQt/Subject @@ -0,0 +1 @@ +#include "../polkit-tqt-subject.h" diff --git a/includes/PolkitTQt1/TemporaryAuthorization b/includes/PolkitTQt/TemporaryAuthorization similarity index 100% rename from includes/PolkitTQt1/TemporaryAuthorization rename to includes/PolkitTQt/TemporaryAuthorization diff --git a/includes/PolkitTQt1/Subject b/includes/PolkitTQt1/Subject deleted file mode 100644 index 701a04727..000000000 --- a/includes/PolkitTQt1/Subject +++ /dev/null @@ -1 +0,0 @@ -#include "../polkittqt1-subject.h" diff --git a/core/dummy-core.cpp b/polkit-tqt-export.h similarity index 73% rename from core/dummy-core.cpp rename to polkit-tqt-export.h index a06506b44..45acaabd5 100644 --- a/core/dummy-core.cpp +++ b/polkit-tqt-export.h @@ -1,9 +1,7 @@ /* * This file is part of the Polkit-tqt project - * Copyright (C) 2009 Daniel Nicoletti * Copyright (C) 2009 Dario Freddi - * Copyright (C) 2009 Jaroslav Reznik - * Copyright (C) 2009 Radek Novacek + * Copyright (C) 2007 David Faure * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,17 +19,10 @@ * Boston, MA 02110-1301, USA. */ -#include "dummy-core.h" +#ifndef POLKIT_TQT_EXPORT_H +#define POLKIT_TQT_EXPORT_H -namespace PolkitTQt -{ +#define POLKIT_TQT_EXPORT TQ_EXPORT +#endif -DummyCore* DummyCore::instance() -{ - return 0; -} - -} - -#include "dummy-core.moc" diff --git a/polkittqt1-export.h b/polkittqt1-export.h deleted file mode 100644 index 0161cc66c..000000000 --- a/polkittqt1-export.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of the Polkit-tqt project - * Copyright (C) 2009 Dario Freddi - * Copyright (C) 2007 David Faure - * - * 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 POLKITTQT1_EXPORT_H -#define POLKITTQT1_EXPORT_H - -/** \file polkittqt1-export.h - \brief Contains Macros for exporting symbols - - This file contains macros needed for exporting/importing symbols -*/ - -#include - -#ifndef POLKITTQT1_EXPORT -# if defined(MAKE_POLKITTQT1_LIB) -/* We are building this library */ -# define POLKITTQT1_EXPORT Q_DECL_EXPORT -# else -/* We are using this library */ -# define POLKITTQT1_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif /*POLKITTQT1_EXPORT_H*/ - diff --git a/polkittqt1-version.h.cmake b/polkittqt1-version.h.cmake index 3fd1bb6cb..3d93c8846 100644 --- a/polkittqt1-version.h.cmake +++ b/polkittqt1-version.h.cmake @@ -21,7 +21,7 @@ #ifndef _POLKITTQT1_VERSION_H_ #define _POLKITTQT1_VERSION_H_ -#include "polkittqt1-export.h" +#include "polkit-tqt-export.h" /// @brief PolkitTQt-1 version as string at compile time. #define POLKITTQT1_VERSION_STRING "${POLKITTQT-1_VERSION_STRING}" diff --git a/test/test.cpp b/test/test.cpp index e2358f4e6..4ff5794c0 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -176,7 +176,7 @@ void TestAuth::test_Authority() void TestAuth::test_Subject() { // Get pid of this appication - tqint64 pid = TQCoreApplication::applicationPid(); + TQ_LONG pid = TQCoreApplication::applicationPid(); // Create unix process for it UnixProcessSubject *process = new UnixProcessSubject(pid); // Test if pid doesn't differ