More conversion polkitqt1 -> polkit-tqt.

Started conversion of 'core' library module.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 3 years ago
parent 58baf01dab
commit eb2210c944
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -86,23 +86,33 @@ add_subdirectory(gui)
add_subdirectory(agent) 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(Qt4 REQUIRED)
## find_package(Polkit REQUIRED)
## find_package(GObject REQUIRED) ## find_package(GObject REQUIRED)
## find_package(GIO REQUIRED) ## find_package(GIO REQUIRED)
## ##
## add_definitions(-DTQT_NO_KEYWORDS) ## add_definitions(-DTQT_NO_KEYWORDS)
## ##
## include (${TQT_USE_FILE}) ## include (${TQT_USE_FILE})
## include (InstallSettings) ## include (InstallSettings)
## include (MacroWriteBasicCMakeVersionFile) ## include (MacroWriteBasicCMakeVersionFile)
## include (CheckFunctionExists) ## include (CheckFunctionExists)
## ##
## include_directories( ## include_directories(
## ${CMAKE_CURRENT_BINARY_DIR} ## ${CMAKE_CURRENT_BINARY_DIR}
## ${POLKIT_INCLUDE_DIR}
## ${POLKIT_AGENT_INCLUDE_DIR} ## ${POLKIT_AGENT_INCLUDE_DIR}
## ${GLIB2_INCLUDE_DIR} ## ${GLIB2_INCLUDE_DIR}
## ${GOBJECT_INCLUDE_DIR} ## ${GOBJECT_INCLUDE_DIR}
@ -112,73 +122,63 @@ add_subdirectory(agent)
## ${CMAKE_CURRENT_SOURCE_DIR}/includes ## ${CMAKE_CURRENT_SOURCE_DIR}/includes
## ${TQT_TQTXML_INCLUDE_DIR} ## ${TQT_TQTXML_INCLUDE_DIR}
## ) ## )
## ##
## # Check for older polkit ## # Check for older polkit
## set(CMAKE_REQUIRED_INCLUDES ${POLKIT_INCLUDE_DIR} ${POLKIT_AGENT_INCLUDE_DIR}) ## set(CMAKE_REQUIRED_INCLUDES ${POLKIT_INCLUDE_DIR} ${POLKIT_AGENT_INCLUDE_DIR})
## set(CMAKE_REQUIRED_LIBRARIES ${POLKIT_LIBRARIES} ${POLKIT_AGENT_LIBRARY}) ## 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_agent_listener_register HAVE_POLKIT_AGENT_LISTENER_REGISTER)
## check_function_exists(polkit_authority_get_sync HAVE_POLKIT_AUTHORITY_GET_SYNC) ## 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) ## 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") ## 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) ## add_definitions(-DPOLKIT_TQT_1_COMPATIBILITY_MODE)
## endif (NOT HAVE_POLKIT_AGENT_LISTENER_REGISTER OR NOT HAVE_POLKIT_AUTHORITY_GET_SYNC) ## 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) ## 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 <package>Config.cmake files to lib/cmake/<package> instead of lib/<package>/cmake" TRUE) ## option(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR "Prefer to install the <package>Config.cmake files to lib/cmake/<package> instead of lib/<package>/cmake" TRUE)
## endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2) ## endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2)
## ##
## # The SONUMBER of the polkit-qt-1 libraries ## # The SONUMBER of the polkit-qt-1 libraries
## set(POLKIT-TQT_ABI_VERSION 1) ## set(POLKIT-TQT_ABI_VERSION 1)
## # The version number of the polkit-qt-1 libraries ## # 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}") ## 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) ## configure_file(polkittqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h)
## ##
## install(FILES ## install(FILES
## gui/polkittqt1-gui-action.h ## gui/polkittqt1-gui-action.h
## gui/polkittqt1-gui-actionbutton.h ## gui/polkittqt1-gui-actionbutton.h
## gui/polkittqt1-gui-actionbuttons.h ## gui/polkittqt1-gui-actionbuttons.h
## ##
## core/polkittqt1-authority.h ## core/polkittqt1-authority.h
## core/polkittqt1-details.h ## core/polkittqt1-details.h
## core/polkittqt1-identity.h ## core/polkittqt1-identity.h
## core/polkittqt1-subject.h ## core/polkittqt1-subject.h
## core/polkittqt1-temporaryauthorization.h ## core/polkittqt1-temporaryauthorization.h
## core/polkittqt1-actiondescription.h ## core/polkittqt1-actiondescription.h
## ##
## agent/polkittqt1-agent-listener.h ## agent/polkittqt1-agent-listener.h
## agent/polkittqt1-agent-session.h ## agent/polkittqt1-agent-session.h
## ##
## ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h ## ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h
## polkittqt1-export.h ## polkit-tqt-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
## DESTINATION ## DESTINATION
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1 COMPONENT Devel) ## ${INCLUDE_INSTALL_DIR}/polkit-qt-1 )
## ##
## install(FILES ## install(FILES
## includes/PolkitTQt1/Gui/Action ## includes/PolkitTQt1/Gui/Action
## includes/PolkitTQt1/Gui/ActionButton ## includes/PolkitTQt1/Gui/ActionButton
## includes/PolkitTQt1/Gui/ActionButtons ## includes/PolkitTQt1/Gui/ActionButtons
## DESTINATION ## DESTINATION
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui COMPONENT Devel) ## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui )
## ##
## install(FILES ## install(FILES
## includes/PolkitTQt1/Agent/Listener ## includes/PolkitTQt1/Agent/Listener
## includes/PolkitTQt1/Agent/Session ## includes/PolkitTQt1/Agent/Session
## DESTINATION ## DESTINATION
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Agent COMPONENT Devel) ## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Agent )
## ##
## if(NOT WIN32) ## if(NOT WIN32)
## # Pkgconfig ## # Pkgconfig
## configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc @ONLY) ## 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) ## @ONLY)
## install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) ## install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
## endif(NOT WIN32) ## endif(NOT WIN32)
## ##
## # CMake Config files ## # CMake Config files
## configure_file(PolkitTQt-1Config.cmake.in "${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake" @ONLY) ## 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. ## # 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 ## macro_write_basic_cmake_version_file(${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake
## ${POLKIT-TQT_VERSION_MAJOR} ${POLKIT-TQT_VERSION_MINOR} ${POLKIT-TQT_VERSION_PATCH}) ## ${POLKIT-TQT_VERSION_MAJOR} ${POLKIT-TQT_VERSION_MINOR} ${POLKIT-TQT_VERSION_PATCH})
## ##
## if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) ## if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/PolkitTQt-1) ## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/PolkitTQt-1)
## else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) ## else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/PolkitTQt-1/cmake) ## set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/PolkitTQt-1/cmake)
## endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) ## endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
## ##
## install(FILES ${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake ## install(FILES ${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake
## ${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake ## ${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake
## DESTINATION ${_PolkitTQt-1Config_INSTALL_DIR} ) ## DESTINATION ${_PolkitTQt-1Config_INSTALL_DIR} )
## ##
## option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF) ## option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF)
## if (BUILD_EXAMPLES) ## if (BUILD_EXAMPLES)
## add_subdirectory(examples) ## add_subdirectory(examples)
## endif (BUILD_EXAMPLES) ## endif (BUILD_EXAMPLES)
## ##
## add_subdirectory(cmake) ## add_subdirectory(cmake)
## ##
## option(BUILD_TEST "Builds unit tests for polkit-qt-1" OFF) ## option(BUILD_TEST "Builds unit tests for polkit-qt-1" OFF)
## if (BUILD_TEST) ## if (BUILD_TEST)
## add_subdirectory(test) ## add_subdirectory(test)
## endif (BUILD_TEST) ## endif (BUILD_TEST)
## ##
## ##
## # Always last! ## # Always last!
## include (PolkitTQt-1Dist) ## include (PolkitTQt-1Dist)

@ -22,6 +22,13 @@ tde_setup_largefiles( )
# tqt # tqt
find_package( 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 # gcc visibility
if( WITH_GCC_VISIBILITY ) if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( ) tde_setup_gcc_visibility( )

@ -21,7 +21,7 @@
#ifndef POLKITTQT1_AGENT_LISTENER_H #ifndef POLKITTQT1_AGENT_LISTENER_H
#define POLKITTQT1_AGENT_LISTENER_H #define POLKITTQT1_AGENT_LISTENER_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <TQtCore/TQObject> #include <TQtCore/TQObject>

@ -121,16 +121,9 @@ endif (WIN32)
# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go # This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go
# into bin/. # into bin/.
# Later on it will be possible to extend this for installing OSX frameworks # 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}" set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" )

@ -10,9 +10,11 @@
################################################# #################################################
include_directories( include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${POLKIT_INCLUDE_DIRS}
) )
link_directories( link_directories(
@ -23,7 +25,7 @@ link_directories(
##### install headers ########################### ##### install headers ###########################
install( FILES install( FILES
dummy-core.h polkit-tqt-subject.h
DESTINATION ${INCLUDE_INSTALL_DIR} ) DESTINATION ${INCLUDE_INSTALL_DIR} )
@ -31,34 +33,31 @@ install( FILES
tde_add_library( polkit-tqt-core SHARED AUTOMOC tde_add_library( polkit-tqt-core SHARED AUTOMOC
SOURCES ${polkit_tqt_MOCS} SOURCES ${polkit_tqt_MOCS}
dummy-core.cpp polkit-tqt-subject.cpp
VERSION 0.0.0 VERSION 0.0.0
LINK ${TQT_LIBRARIES} LINK ${TQT_LIBRARIES} ${POLKIT_LIBRARIES}
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
) )
## set(polkit_tqt_core_SRCS ## set(polkit_tqt_core_SRCS
## polkittqt1-authority.cpp ## polkittqt1-authority.cpp
## polkittqt1-identity.cpp ## polkittqt1-identity.cpp
## polkittqt1-subject.cpp ## polkittqt1-temporaryauthorization.cpp
## polkittqt1-temporaryauthorization.cpp ## polkittqt1-details.cpp
## polkittqt1-details.cpp ## polkittqt1-actiondescription.cpp
## polkittqt1-actiondescription.cpp ## )
## ) ##
## ## target_link_libraries(polkit-tqt-core-1
## target_link_libraries(polkit-tqt-core-1 ## ${TQT_TQTDBUS_LIBRARY}
## ${TQT_TQTCORE_LIBRARY} ## ${TQT_TQTXML_LIBRARY}
## ${TQT_TQTDBUS_LIBRARY} ## ${GLIB2_LIBRARIES}
## ${TQT_TQTXML_LIBRARY} ## ${GOBJECT_LIBRARIES}
## ${POLKIT_LIBRARIES} ## ${GIO_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)
## set_target_properties(polkit-tqt-core-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION} ##
## SOVERSION ${POLKITTQT-1_ABI_VERSION} ## install(TARGETS polkit-tqt-core-1 ${INSTALL_TARGETS_DEFAULT_ARGS})
## DEFINE_SYMBOL MAKE_POLKITTQT1_LIB)
##
## install(TARGETS polkit-tqt-core-1 ${INSTALL_TARGETS_DEFAULT_ARGS})

@ -1,56 +0,0 @@
/*
* This file is part of the Polkit-tqt project
* Copyright (C) 2009 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
* Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
* Copyright (C) 2009 Radek Novacek <rnovacek@redhat.com>
*
* 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

@ -0,0 +1,242 @@
/*
* This file is part of the Polkit-tqt project
* Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
*
* 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());
}
}

@ -18,30 +18,30 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef POLKITTQT1_SUBJECT_H #ifndef POLKIT_TQT_SUBJECT_H
#define POLKITTQT1_SUBJECT_H #define POLKIT_TQT_SUBJECT_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <TQtCore/TQObject>
#include <TQtCore/TQSharedData>
typedef struct _PolkitSubject PolkitSubject; typedef struct _PolkitSubject PolkitSubject;
typedef struct _PolkitUnixProcess PolkitUnixProcess; typedef struct _PolkitUnixProcess PolkitUnixProcess;
typedef struct _PolkitSystemBusName PolkitSystemBusName; typedef struct _PolkitSystemBusName PolkitSystemBusName;
class TQString;
/** /**
* \namespace PolkitTQt1 PolkitTQt * \namespace PolkitTQt PolkitTQt
* *
* \brief Namespace wrapping PolicyKit-TQt classes * \brief Namespace wrapping PolicyKit-TQt classes
* *
* This namespace wraps all 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 <jreznik@redhat.com> * \author Jaroslav Reznik <jreznik@redhat.com>
* *
* \brief This class represents PolicyKit subjects * \brief This class represents PolicyKit subjects
@ -52,15 +52,20 @@ namespace PolkitTQt1
* \see SystemBusName * \see SystemBusName
* \see UnixSession * \see UnixSession
*/ */
class POLKITTQT1_EXPORT Subject class POLKIT_TQT_EXPORT Subject
{ {
public: public:
Subject(); Subject();
Subject(const Subject &other); Subject(const Subject &other);
~Subject(); ~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; bool isValid() const;
/** /**
@ -71,11 +76,11 @@ public:
TQString toString() const; 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); static Subject fromString(const TQString &string);
@ -86,20 +91,20 @@ public:
* *
* \return Pointer to PolkitSubject instance * \return Pointer to PolkitSubject instance
*/ */
PolkitSubject *subject() const; PolkitSubject* subject() const;
protected: protected:
Subject(PolkitSubject *subject); Subject(PolkitSubject *subject);
void setSubject(PolkitSubject *subject); void setSubject(PolkitSubject *subject);
private: private:
class Data; class Data;
TQExplicitlySharedDataPointer< Data > d; Data *d;
}; };
/** /**
* \class UnixProcessSubject polkittqt1-subject.h Subject * \class UnixProcessSubject polkit-tqt-subject.h Subject
* \author Jaroslav Reznik <jreznik@redhat.com> * \author Jaroslav Reznik <jreznik@redhat.com>
* *
* \brief A class for representing a UNIX process. * \brief A class for representing a UNIX process.
@ -111,16 +116,16 @@ private:
* *
* \sa Subject * \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 * Subject constructor, takes one parameter - PID. The start time
* of process will be looked automatically. * of process will be looked automatically.
* *
* \param pid An Unix process PID. * \param pid An Unix process PID.
*/ */
explicit UnixProcessSubject(tqint64 pid); explicit UnixProcessSubject(TQ_LONG pid);
/** /**
* Subject constructor, takes two parameters - PID and start time. * Subject constructor, takes two parameters - PID and start time.
@ -128,7 +133,7 @@ public:
* \param pid An Unix process PID. * \param pid An Unix process PID.
* \param startTime An Unix process start time. * \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 * Subject constructor, it creates UnixProcess object from PolkitUnixProcess object
@ -144,34 +149,34 @@ public:
* *
* \return A PID of associated Unix process. * \return A PID of associated Unix process.
*/ */
tqint64 pid() const; TQ_LONG pid() const;
/** /**
* Returns Unix process start time. * Returns Unix process start time.
* *
* \return A start time of associated Unix process. * \return A start time of associated Unix process.
*/ */
tqint64 startTime() const; TQ_LONG startTime() const;
/** /**
* Sets Unix process PID. * Sets Unix process PID.
* *
* \param pid An 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 <jreznik@redhat.com> * \author Jaroslav Reznik <jreznik@redhat.com>
* *
* \brief A class for representing a process owning a unique name on the system bus. * \brief A class for representing a process owning a unique name on the system bus.
* *
* \sa Subject * \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. * 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 <jreznik@redhat.com> * \author Jaroslav Reznik <jreznik@redhat.com>
* *
* \brief A class for representing unix session. * \brief A class for representing unix session.
* *
* The session id is an opaque string obtained from
* ConsoleKit.
*
* \sa Subject * \sa Subject
*/ */
class POLKITTQT1_EXPORT UnixSessionSubject : public Subject class POLKIT_TQT_EXPORT UnixSessionSubject : public Subject
{ {
public: public:
/** /**
* Subject constructor, takes one parameter - session id. * Subject constructor, takes one parameter - session id.
* *
@ -231,7 +233,7 @@ public:
* *
* \param pid The session's process pid. * \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 * Subject constructor, it creates UnixSession object from PolkitUnixSession object
@ -260,3 +262,4 @@ public:
} }
#endif #endif

@ -25,7 +25,7 @@
#include <polkit/polkit.h> #include <polkit/polkit.h>
namespace PolkitTQt1 namespace PolkitTQt
{ {
class ActionDescription::Data : public TQSharedData class ActionDescription::Data : public TQSharedData
@ -85,12 +85,12 @@ ActionDescription::ActionDescription(PolkitActionDescription *polkitActionDescri
polkitActionDescription)); polkitActionDescription));
} }
ActionDescription::ActionDescription(const PolkitTQt1::ActionDescription& other) ActionDescription::ActionDescription(const PolkitTQt::ActionDescription& other)
: d(other.d) : d(other.d)
{ {
} }
ActionDescription& ActionDescription::operator=(const PolkitTQt1::ActionDescription& other) ActionDescription& ActionDescription::operator=(const PolkitTQt::ActionDescription& other)
{ {
d = other.d; d = other.d;
return *this; return *this;

@ -22,7 +22,7 @@
#ifndef POLKITTQT1_ACTION_DESCRIPTION_H #ifndef POLKITTQT1_ACTION_DESCRIPTION_H
#define POLKITTQT1_ACTION_DESCRIPTION_H #define POLKITTQT1_ACTION_DESCRIPTION_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <TQtCore/TQList> #include <TQtCore/TQList>
#include <TQtCore/TQMetaType> #include <TQtCore/TQMetaType>
@ -30,7 +30,7 @@
typedef struct _PolkitActionDescription PolkitActionDescription; typedef struct _PolkitActionDescription PolkitActionDescription;
namespace PolkitTQt1 namespace PolkitTQt
{ {
/** /**
* \class ActionDescription polkittqt1-actiondescription.h ActionDescription * \class ActionDescription polkittqt1-actiondescription.h ActionDescription
@ -39,7 +39,7 @@ namespace PolkitTQt1
* *
* \brief Class used to encapsulate a registered action. * \brief Class used to encapsulate a registered action.
*/ */
class POLKITTQT1_EXPORT ActionDescription class POLKIT_TQT_EXPORT ActionDescription
{ {
public: public:
enum ImplicitAuthorization { 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 #endif //POLKIT_TQT_ACTION_DESCRIPTION_H

@ -28,7 +28,7 @@
#include <polkit/polkit.h> #include <polkit/polkit.h>
namespace PolkitTQt1 namespace PolkitTQt
{ {
class AuthorityHelper class AuthorityHelper
@ -140,8 +140,8 @@ Authority::Authority(PolkitAuthority *authority, TQObject *parent)
: TQObject(parent) : TQObject(parent)
, d(new Private(this)) , d(new Private(this))
{ {
qRegisterMetaType<PolkitTQt1::Authority::Result> (); qRegisterMetaType<PolkitTQt::Authority::Result> ();
qRegisterMetaType<PolkitTQt1::ActionDescription::List>(); qRegisterMetaType<PolkitTQt::ActionDescription::List>();
Q_ASSERT(!s_globalAuthority()->q); Q_ASSERT(!s_globalAuthority()->q);
s_globalAuthority()->q = this; s_globalAuthority()->q = this;

@ -24,7 +24,7 @@
#ifndef POLKITTQT1_AUTHORITY_H #ifndef POLKITTQT1_AUTHORITY_H
#define POLKITTQT1_AUTHORITY_H #define POLKITTQT1_AUTHORITY_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include "polkittqt1-identity.h" #include "polkittqt1-identity.h"
#include "polkittqt1-subject.h" #include "polkittqt1-subject.h"
#include "polkittqt1-temporaryauthorization.h" #include "polkittqt1-temporaryauthorization.h"
@ -37,13 +37,13 @@ typedef struct _PolkitAuthority PolkitAuthority;
class TQStringList; class TQStringList;
/** /**
* \namespace PolkitTQt1 PolkitTQt * \namespace PolkitTQt PolkitTQt
* *
* \brief Namespace wrapping Polkit-TQt classes * \brief Namespace wrapping Polkit-TQt classes
* *
* This namespace wraps all 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. * Call Authority::instance() to get an instance of the Authority object.
* Do not delete Authority::instance(), cleanup will be done automatically. * 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 Q_OBJECT
TQ_DISABLE_COPY(Authority) TQ_DISABLE_COPY(Authority)
@ -343,7 +343,7 @@ public:
* \return \c true if authority acknowledged the call, \c false if error is set. * \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. * This method can be used to cancel the authenticationAgentResponseAsync method.
@ -465,14 +465,14 @@ Q_SIGNALS:
* *
* The argument is the result of authorization. * 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. * This signal is emitted when asynchronous method enumerateActions finishes.
* *
* The argument is the list of all Action IDs. * 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. * This signal is emitted when asynchronous method registerAuthenticationAgent finishes.
@ -504,7 +504,7 @@ Q_SIGNALS:
* *
* \note Free all TemporaryAuthorization objects using \p delete operator. * \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. * This signal is emmited when asynchronous method revokeTemporaryAuthorizations finishes.
@ -533,7 +533,7 @@ private:
} }
Q_DECLARE_OPERATORS_FOR_FLAGS(PolkitTQt1::Authority::AuthorizationFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(PolkitTQt::Authority::AuthorizationFlags)
Q_DECLARE_METATYPE(PolkitTQt1::Authority::Result) Q_DECLARE_METATYPE(PolkitTQt::Authority::Result)
#endif #endif

@ -24,7 +24,7 @@
#include <polkit/polkit.h> #include <polkit/polkit.h>
namespace PolkitTQt1 namespace PolkitTQt
{ {
class Details::Data : public TQSharedData 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; d = other.d;
return *this; return *this;

@ -21,7 +21,7 @@
#ifndef POLKITTQT1_DETAILS_H #ifndef POLKITTQT1_DETAILS_H
#define POLKITTQT1_DETAILS_H #define POLKITTQT1_DETAILS_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <TQtCore/TQObject> #include <TQtCore/TQObject>
#include <TQtCore/TQSharedData> #include <TQtCore/TQSharedData>
@ -29,13 +29,13 @@
typedef struct _PolkitDetails PolkitDetails; typedef struct _PolkitDetails PolkitDetails;
/** /**
* \namespace PolkitTQt1 PolkitTQt * \namespace PolkitTQt PolkitTQt
* *
* \brief Namespace wrapping Polkit-TQt classes * \brief Namespace wrapping Polkit-TQt classes
* *
* This namespace wraps all 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. * \brief Class used for passing details around.
*/ */
class POLKITTQT1_EXPORT Details class POLKIT_TQT_EXPORT Details
{ {
public: public:
/** /**
@ -89,7 +89,7 @@ public:
TQStringList keys() const; TQStringList keys() const;
private: private:
class Data; class Data;
TQExplicitlySharedDataPointer< Data > d; Data *d;
}; };
} }

@ -24,7 +24,7 @@
#include <TQtCore/TQDebug> #include <TQtCore/TQDebug>
namespace PolkitTQt1 namespace PolkitTQt
{ {
class Identity::Data : public TQSharedData 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) : 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; d = other.d;
return *this; return *this;

@ -21,7 +21,7 @@
#ifndef POLKITTQT1_IDENTITY_H #ifndef POLKITTQT1_IDENTITY_H
#define POLKITTQT1_IDENTITY_H #define POLKITTQT1_IDENTITY_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <unistd.h> #include <unistd.h>
@ -33,13 +33,13 @@ typedef struct _PolkitUnixUser PolkitUnixUser;
typedef struct _PolkitUnixGroup PolkitUnixGroup; typedef struct _PolkitUnixGroup PolkitUnixGroup;
/** /**
* \namespace PolkitTQt1 PolkitTQt * \namespace PolkitTQt PolkitTQt
* *
* \brief Namespace wrapping Polkit-TQt classes * \brief Namespace wrapping Polkit-TQt classes
* *
* This namespace wraps all Polkit-TQt classes. * This namespace wraps all Polkit-TQt classes.
*/ */
namespace PolkitTQt1 namespace PolkitTQt
{ {
class UnixUserIdentity; class UnixUserIdentity;
@ -56,7 +56,7 @@ class UnixGroupIdentity;
* \see UnixGroup * \see UnixGroup
* \see UnixUser * \see UnixUser
*/ */
class POLKITTQT1_EXPORT Identity class POLKIT_TQT_EXPORT Identity
{ {
public: public:
typedef TQList< Identity > List; typedef TQList< Identity > List;
@ -103,7 +103,7 @@ protected:
private: private:
class Data; class Data;
TQExplicitlySharedDataPointer< Data > d; Data *d;
}; };
/** /**
@ -114,7 +114,7 @@ private:
* \brief UNIX user identity * \brief UNIX user identity
* \sa Identity * \sa Identity
*/ */
class POLKITTQT1_EXPORT UnixUserIdentity : public Identity class POLKIT_TQT_EXPORT UnixUserIdentity : public Identity
{ {
public: public:
UnixUserIdentity(); UnixUserIdentity();
@ -164,7 +164,7 @@ public:
* \brief UNIX group identity * \brief UNIX group identity
* \sa Identity * \sa Identity
*/ */
class POLKITTQT1_EXPORT UnixGroupIdentity : public Identity class POLKIT_TQT_EXPORT UnixGroupIdentity : public Identity
{ {
public: public:
UnixGroupIdentity(); UnixGroupIdentity();

@ -1,205 +0,0 @@
/*
* This file is part of the Polkit-tqt project
* Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
*
* 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());
}
}

@ -23,7 +23,7 @@
#include <polkit/polkit.h> #include <polkit/polkit.h>
namespace PolkitTQt1 namespace PolkitTQt
{ {
class TemporaryAuthorization::Data : public TQSharedData class TemporaryAuthorization::Data : public TQSharedData
@ -60,7 +60,7 @@ TemporaryAuthorization::TemporaryAuthorization(PolkitTemporaryAuthorization *pkT
g_object_unref(pkTemporaryAuthorization); g_object_unref(pkTemporaryAuthorization);
} }
TemporaryAuthorization::TemporaryAuthorization(const PolkitTQt1::TemporaryAuthorization& other) TemporaryAuthorization::TemporaryAuthorization(const PolkitTQt::TemporaryAuthorization& other)
: d(other.d) : 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; d = other.d;
return *this; return *this;

@ -31,13 +31,13 @@
typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization; typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization;
/** /**
* \namespace PolkitTQt1 PolkitTQt * \namespace PolkitTQt PolkitTQt
* *
* \brief Namespace wrapping PolicyKit-TQt classes * \brief Namespace wrapping PolicyKit-TQt classes
* *
* This namespace wraps all 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. * This class encapsulates the PolkitTemporaryAuthorization interface.
*/ */
class POLKITTQT1_EXPORT TemporaryAuthorization class POLKIT_TQT_EXPORT TemporaryAuthorization
{ {
public: public:
typedef TQList< TemporaryAuthorization > List; typedef TQList< TemporaryAuthorization > List;
@ -119,6 +119,6 @@ private:
}; };
} }
TQ_DECLARE_METATYPE(PolkitTQt1::TemporaryAuthorization::List) TQ_DECLARE_METATYPE(PolkitTQt::TemporaryAuthorization::List)
#endif // TEMPORARYAUTHORIZATION_H #endif // TEMPORARYAUTHORIZATION_H

2
debian/copyright vendored

@ -21,7 +21,7 @@ Copyright:
Copyright (C) 2009 Radek Novacek Copyright (C) 2009 Radek Novacek
Copyright (C) 2009 Lukas Tinkl Copyright (C) 2009 Lukas Tinkl
Copyright for polkittqt1-export.h file: Copyright for polkit-tqt-export.h file:
Copyright (C) 2009 Dario Freddi <drf@kde.org> Copyright (C) 2009 Dario Freddi <drf@kde.org>
Copyright (C) 2007 David Faure <faure@kde.org> Copyright (C) 2007 David Faure <faure@kde.org>

@ -1,27 +1,27 @@
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/ActionDescription #debian/tmp/usr/include/polkit-tqt/PolkitTQt/ActionDescription
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Agent/Listener #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Listener
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Agent/Session #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Session
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Authority #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Authority
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Details #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Details
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/Action #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/Action
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/ActionButton #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/ActionButton
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Gui/ActionButtons #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/ActionButtons
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Identity #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Identity
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/Subject debian/tmp/usr/include/polkit-tqt/PolkitTQt/Subject
#debian/tmp/usr/include/polkit-tqt/PolkitTQt1/TemporaryAuthorization #debian/tmp/usr/include/polkit-tqt/PolkitTQt/TemporaryAuthorization
#debian/tmp/usr/include/polkit-tqt/polkittqt1-actiondescription.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-actiondescription.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-agent-listener.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-agent-listener.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-agent-session.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-agent-session.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-authority.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-authority.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-details.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-details.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-export.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-export.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-action.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-action.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-actionbutton.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-actionbutton.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-gui-actionbuttons.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-actionbuttons.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-identity.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-identity.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-subject.h debian/tmp/usr/include/polkit-tqt/polkit-tqt-subject.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-temporaryauthorization.h #debian/tmp/usr/include/polkit-tqt/polkit-tqt-temporaryauthorization.h
#debian/tmp/usr/include/polkit-tqt/polkittqt1-version.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-1Config.cmake
#debian/tmp/usr/lib/cmake/PolkitTQt-1/PolkitTQt-1ConfigVersion.cmake #debian/tmp/usr/lib/cmake/PolkitTQt-1/PolkitTQt-1ConfigVersion.cmake
debian/tmp/usr/lib/libpolkit-tqt-agent.so debian/tmp/usr/lib/libpolkit-tqt-agent.so

@ -44,7 +44,7 @@ public:
TQString actionId; TQString actionId;
Authority::Result pkResult; Authority::Result pkResult;
tqint64 targetPID; TQ_LONG targetPID;
void updateAction(); void updateAction();
bool computePkResult(); bool computePkResult();
@ -232,7 +232,7 @@ bool Action::Private::computePkResult()
return old_result != pkResult; return old_result != pkResult;
} }
tqint64 Action::targetPID() const TQ_LONG Action::targetPID() const
{ {
if (d->targetPID != 0) { if (d->targetPID != 0) {
return d->targetPID; 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; d->targetPID = pid;

@ -22,7 +22,7 @@
#ifndef POLKITTQT1_GUI_ACTION_H #ifndef POLKITTQT1_GUI_ACTION_H
#define POLKITTQT1_GUI_ACTION_H #define POLKITTQT1_GUI_ACTION_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include <TQtGui/TQAction> #include <TQtGui/TQAction>
@ -207,7 +207,7 @@ public:
* *
* \param pid The target process id; 0 if it is the current process * \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 * Gets the text of the action when it is in the specified state
@ -265,7 +265,7 @@ public:
/** /**
* \see setTargetPID * \see setTargetPID
*/ */
tqint64 targetPID() const; TQ_LONG targetPID() const;
/** /**
* This method can be used to check the if the current action * This method can be used to check the if the current action

@ -22,7 +22,7 @@
#ifndef POLKITTQT1_GUI_ACTIONBUTTON_H #ifndef POLKITTQT1_GUI_ACTIONBUTTON_H
#define POLKITTQT1_GUI_ACTIONBUTTON_H #define POLKITTQT1_GUI_ACTIONBUTTON_H
#include "polkittqt1-export.h" #include "polkit-tqt-export.h"
#include "polkittqt1-gui-action.h" #include "polkittqt1-gui-action.h"
class TQAbstractButton; class TQAbstractButton;

@ -0,0 +1 @@
#include "../polkit-tqt-subject.h"

@ -1 +0,0 @@
#include "../polkittqt1-subject.h"

@ -1,9 +1,7 @@
/* /*
* This file is part of the Polkit-tqt project * This file is part of the Polkit-tqt project
* Copyright (C) 2009 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
* Copyright (C) 2009 Dario Freddi <drf@kde.org> * Copyright (C) 2009 Dario Freddi <drf@kde.org>
* Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com> * Copyright (C) 2007 David Faure <faure@kde.org>
* Copyright (C) 2009 Radek Novacek <rnovacek@redhat.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -21,17 +19,10 @@
* Boston, MA 02110-1301, USA. * 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"

@ -1,44 +0,0 @@
/*
* This file is part of the Polkit-tqt project
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
* Copyright (C) 2007 David Faure <faure@kde.org>
*
* 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 <TQtCore/TQtGlobal>
#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*/

@ -21,7 +21,7 @@
#ifndef _POLKITTQT1_VERSION_H_ #ifndef _POLKITTQT1_VERSION_H_
#define _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. /// @brief PolkitTQt-1 version as string at compile time.
#define POLKITTQT1_VERSION_STRING "${POLKITTQT-1_VERSION_STRING}" #define POLKITTQT1_VERSION_STRING "${POLKITTQT-1_VERSION_STRING}"

@ -176,7 +176,7 @@ void TestAuth::test_Authority()
void TestAuth::test_Subject() void TestAuth::test_Subject()
{ {
// Get pid of this appication // Get pid of this appication
tqint64 pid = TQCoreApplication::applicationPid(); TQ_LONG pid = TQCoreApplication::applicationPid();
// Create unix process for it // Create unix process for it
UnixProcessSubject *process = new UnixProcessSubject(pid); UnixProcessSubject *process = new UnixProcessSubject(pid);
// Test if pid doesn't differ // Test if pid doesn't differ

Loading…
Cancel
Save