Updated documentation and clean up.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 2 years ago
parent 855818127b
commit 416bed9bc1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -128,39 +128,7 @@ install(
)
install(
FILES
polkit-tqt-export.h
## ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h
DESTINATION
${INCLUDE_INSTALL_DIR} )
##
## 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)
## 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)
##
## # 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} )
##
FILES polkit-tqt-export.h
DESTINATION ${INCLUDE_INSTALL_DIR}
)

@ -1,26 +1,12 @@
Polkit-tqt's build system uses cmake.
Basic Installation
==================
So to compile Polkit-tqt first create a build dir
Polkit-tqt relies on cmake to build.
mkdir build
cd build
Here are suggested default options:
then run cmake:
cmake ..
(a typical cmake option that is often used is: -DCMAKE_INSTALL_PREFIX=<prefix>)
cmake then presents a configuration summary. At this point you may
want to install missing dependancies (if you do, remove the CMakeCache.txt)
and run cmake again.
Finally build Polkit-tqt:
make
And install it (in most cases root privileges are required):
make install
That's all :)
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE="ON" \
-DCMAKE_SKIP_RPATH="OFF" \
-DBUILD_ALL="ON" \
-DWITH_ALL_OPTIONS="ON"

@ -4,7 +4,7 @@
\section polkit-tqt_overview Overview
polkit-tqt aims to make it easy for TQt developers to take advantage of
polkit API. It is a convenience wrapper around QAction and QAbstractButton
polkit API. It is a convenience wrapper around TQAction and TQButton
that lets you integrate those two components easily with polkit.
polkit-tqt is split in three libraries: polkit-tqt-core, polkit-tqt-gui and polkit-tqt-agent
@ -14,76 +14,75 @@ simple functions. It also lets you retrieve and control useful informations on t
authority. You will be mostly interested in the \c Authority class.
\b polkit-tqt-gui lets you easily associate GUI items with polkit actions. Through some simple
wrapper classes you are able to associate QAction and QAbstractButton to a polkit action,
wrapper classes you are able to associate TQAction and TQButton to a polkit action,
and get their properties changed accordingly to polkit's result. It includes the classes
Action, ActionButton and ActionButtons
\b polkit-tqt-agent lets you write your own polkit authentication agents in a very simple way.
\li A sample usage of polkit-tqt can be found in \ref polkittqt1_example
\li <a href="classes.html">Alphabetical Class List</a>
\li <a href="hierarchy.html">Class Hierarchy</a>
\b A sample usage of polkit-tqt can be found in \ref polkit-tqt_example
\page polkittqt1_example Polkit-tqt usage example
\page polkit-tqt-example Polkit-tqt usage example
You can find an example usage of Polkit-tqt in the examples/ dir. You can
build it by passing \c -DBUILD_EXAMPLES=TRUE to your cmake line. The structure
consists of a .ui file and a main class, to demonstrate how easy it is to integrate
polkit support in an existing application. Let's see some details about it:
build it by passing \c -DBUILD_EXAMPLES=TRUE to your cmake line. It demonstrates
how easy it is to integrate polkit support in an existing application.
Let's see some details about it:
\code
// Previously defined TQPushButton
kickPB = new TQPushButton(privateLayoutWidget, "kickPB");
...
// Setup polkit tqt action
ActionButton *bt;
bt = new ActionButton(kickPB, "org.tqt.policykit.examples.kick", this);
bt->setText("Kick... (long)");
// here we set the behavior of PolKitResul = No
bt->setText("Kick!");
// here we set the behavior of PolKitResult = No
bt->setText("Can't kick", Action::No);
bt->setVisible(true, Action::No);
bt->setEnabled(true, Action::No);
bt->setText("Kick (long)", Action::No);
bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No);
bt->setIconSet(TQPixmap("./icons/custom-no.png"), Action::No);
bt->setToolTip("If your admin wasn't annoying, you could do this", Action::No);
// here we set the behavior of PolKitResul = Auth
// here we set the behavior of PolKitResult = Auth
bt->setVisible(true, Action::Auth);
bt->setEnabled(true, Action::Auth);
bt->setText("Kick... (long)", Action::Auth);
bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth);
bt->setText("Kick?", Action::Auth);
bt->setIcon(TQPixmap("./icons/action-locked-default.png"), Action::Auth);
bt->setToolTip("Only card carrying tweakers can do this!", Action::Auth);
// here we set the behavior of PolKitResul = Yes
// here we set the behavior of PolKitResult = Yes
bt->setVisible(true, Action::Yes);
bt->setEnabled(true, Action::Yes);
bt->setText("Kick! (long)", Action::Yes);
bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes);
bt->setText("Kick!", Action::Yes);
bt->setIcon(TQPixmap("./icons/custom-yes.png"), Action::Yes);
bt->setToolTip("Go ahead, kick kick kick!", Action::Yes);
\endcode
This small paragraph sets up an action button using an existing button defined in the
UI file, \c kickPB . As you can see, you can set custom properties on your button depending
on the action status/result. The code is mostly self-explainatory
This small paragraph sets up an action button using an existing button already
defined, \c kickPB. As you can see, you can set custom properties on your button depending
on the action status/result. The code is mostly self-explainatory.
\code
bt = new ActionButtons(TQList<TQButton*>() << listenPB << listenCB,
"org.tqt.policykit.examples.listen", this);
bt->setIcon(TQPixmap(":/Icons/action-locked.png"));
bt->setIcon(TQPixmap(":/Icons/action-unlocked.png"), Action::Yes);
bt = new ActionButtons(TQValueList<TQButton*>() << listenPB << listenCB,
"org.tqt.policykit.examples.listen", this);
bt->setIcon(TQPixmap("./icons/action-locked.png"));
bt->setIcon(TQPixmap("./icons/action-unlocked.png"), Action::Yes);
bt->setText("Click to make changes...");
\endcode
This demonstrates the use of ActionButtons, that lets you associate multiple buttons with a
single action with extreme ease. \c listenPB and \c listenCB, both defined in the ui file,
are kept in sync with the action.
single action with extreme ease. \c listenPB and \c listenCB are kept in sync with the action.
\code
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*,bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(activated()), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
\endcode
Those three signals are all you need to control the action and the activation. Action::triggered()
Those three signals are all you need to control the action and the activation. Action::activated()
lets you start the activation/revoke when needed, ActionButton::clicked() lets you do the same thing
with even more ease, just by manually connecting the signal to ActionButton::activate() (see the docs
to understand why this connection doesn't happen automatically), and Action::authorized() signal notifies
you when polkit has authorized you to perform the action.
with even more ease, just by manually connecting the signal to ActionButton::activate(), and
Action::authorized() signal notifies you when polkit has authorized you to perform the action.
As you can see, usage of polkit-tqt is extremely simple. Have a look at the complete example
and to the API Docs for more details.

@ -1,41 +0,0 @@
# PolkitTQt-1Config.cmake is generated by CMake from PolkitTQt-1Config.cmake.in.
# Any changed value in this file will be overwritten by CMake.
# set the PolkitTQt-1 version number
set(POLKITTQT-1_VERSION_MAJOR @POLKITTQT-1_VERSION_MAJOR@)
set(POLKITTQT-1_VERSION_MINOR @POLKITTQT-1_VERSION_MINOR@)
set(POLKITTQT-1_VERSION_PATCH @POLKITTQT-1_VERSION_PATCH@)
set(POLKITTQT-1_VERSION @POLKITTQT-1_VERSION_STRING@)
set(POLKITTQT-1_VERSION_STRING "@POLKITTQT-1_VERSION_STRING@")
# set the directories
if(NOT POLKITTQT-1_INSTALL_DIR)
set(POLKITTQT-1_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")
endif(NOT POLKITTQT-1_INSTALL_DIR)
set(POLKITTQT-1_INCLUDE_DIR "@INCLUDE_INSTALL_DIR@/polkit-tqt-1")
set(POLKITTQT-1_LIB_DIR "@LIB_INSTALL_DIR@")
set(POLKITTQT-1_POLICY_FILES_INSTALL_DIR "${POLKITTQT-1_INSTALL_DIR}/share/polkit-1/actions")
# Compatibility
if(WIN32)
if(MINGW)
set(POLKITTQT-1_CORE_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-core-1.dll.a")
set(POLKITTQT-1_AGENT_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-agent-1.dll.a")
set(POLKITTQT-1_GUI_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-gui-1.dll.a")
else(MINGW)
set(POLKITTQT-1_CORE_LIBRARY "${POLKITTQT-1_LIB_DIR}/polkit-tqt-core-1.lib")
set(POLKITTQT-1_AGENT_LIBRARY "${POLKITTQT-1_LIB_DIR}/polkit-tqt-agent-1.lib")
set(POLKITTQT-1_GUI_LIBRARY "${POLKITTQT-1_LIB_DIR}/polkit-tqt-gui-1.lib")
endif(MINGW)
elseif(APPLE)
set(POLKITTQT-1_CORE_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-core-1.dylib")
set(POLKITTQT-1_AGENT_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-agent-1.dylib")
set(POLKITTQT-1_GUI_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-gui-1.dylib")
else()
set(POLKITTQT-1_CORE_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-core-1.so")
set(POLKITTQT-1_AGENT_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-agent-1.so")
set(POLKITTQT-1_GUI_LIBRARY "${POLKITTQT-1_LIB_DIR}/libpolkit-tqt-gui-1.so")
endif()
set(POLKITTQT-1_LIBRARIES ${POLKITTQT-1_GUI_LIBRARY} ${POLKITTQT-1_CORE_LIBRARY} ${POLKITTQT-1_AGENT_LIBRARY})

@ -5,19 +5,6 @@ What is Polkit-tqt?
------------------
Polkit-tqt is a library that lets developers use the PolicyKit API through a nice
TQt-styled API. It is mainly a wrapper around TQAction and TQButton that
lets you integrate those two component easily with PolicyKit
This directory contains the sources of the library.
Structure
----------
* cmake/
Contains the cmake checks that are needed to build the library,
and a FindPolkitTQt.cmake module.
* .
Contains the sources of the library
lets you integrate those two component easily with PolicyKit.
See INSTALL for installation instructions.

@ -49,10 +49,3 @@ tde_add_library( polkit-tqt-agent SHARED AUTOMOC
DESTINATION ${LIB_INSTALL_DIR}
)
##
## set_target_properties(polkit-tqt-agent-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION}
## SOVERSION ${POLKITTQT-1_ABI_VERSION}
## DEFINE_SYMBOL MAKE_POLKIT_TQT_LIB)
##

@ -51,8 +51,3 @@ tde_add_library( polkit-tqt-core SHARED AUTOMOC
DESTINATION ${LIB_INSTALL_DIR}
)
##
## set_target_properties(polkit-tqt-core-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION}
## SOVERSION ${POLKITTQT-1_ABI_VERSION}
## DEFINE_SYMBOL MAKE_POLKIT_TQT_LIB)

7
debian/copyright vendored

@ -1,4 +1,9 @@
This work was packaged for Debian by:
This code was ported to TQt3 and packaged for Debian by:
Michele Calgaro <michele.calgaro@yahoo.it>
and is based on the code downloaded from Debian Snapshot Archive at:
https://snapshot.debian.org/package/polkit-qt-1/0.103.0-1/
Original polkit-qt-1 code was packaged for Debian by:
Fathi Boudra <fabo@debian.org> on Fri, 15 Jan 2010 12:50:13 +0100

@ -21,9 +21,6 @@ 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
debian/tmp/usr/lib/libpolkit-tqt-core.so
debian/tmp/usr/lib/libpolkit-tqt-gui.so

@ -177,15 +177,15 @@ PkExample::PkExample() : TQMainWindow(0, "Polkit tqt example application", WDest
bt->setText("Play!");
bt->setVisible(true, (Action::States)(Action::No | Action::Auth | Action::Yes));
bt->setEnabled(true, (Action::States)(Action::No | Action::Auth | Action::Yes));
// here we set the behavior of PolKitResul = No
// here we set the behavior of PolKitResult = No
bt->setText("Can't play!", Action::No);
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-no.png"), Action::No);
bt->setToolTip("If your admin wasn't annoying, you could do this", Action::No);
// here we set the behavior of PolKitResul = Auth
// here we set the behavior of PolKitResult = Auth
bt->setText("Play?", Action::Auth);
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/action-locked-default.png"), Action::Auth);
bt->setToolTip("Only card carrying tweakers can do this!", Action::Auth);
// here we set the behavior of PolKitResul = Yes
// here we set the behavior of PolKitResult = Yes
bt->setText("Play!", Action::Yes);
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes);
bt->setToolTip("Go ahead, play!", Action::Yes);

@ -21,7 +21,6 @@
#include "PkExampleHelper.h"
int main(int argc, char *argv[])
{
PkExampleHelper example(argc, argv);

@ -3,8 +3,8 @@
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>KDE</vendor>
<vendor_url>http://www.kde.org</vendor_url>
<vendor>TDE</vendor>
<vendor_url>https://www.trinitydesktop.org</vendor_url>
<action id="org.tqt.policykit.examples.kick">
<description>Kick</description>

@ -46,8 +46,3 @@ tde_add_library( polkit-tqt-gui SHARED AUTOMOC
DESTINATION ${LIB_INSTALL_DIR}
)
## set_target_properties(polkit-tqt-gui-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION}
## SOVERSION ${POLKITTQT-1_ABI_VERSION}
## DEFINE_SYMBOL MAKE_POLKIT_TQT_LIB)
##

@ -1,106 +0,0 @@
/*
* Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
* Copyright (C) 2009 Dario Freddi <drf@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* 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 _POLKIT_TQT_VERSION_H_
#define _POLKIT_TQT_VERSION_H_
#include "polkit-tqt-export.h"
/// @brief PolkitTQt-1 version as string at compile time.
#define POLKIT_TQT_VERSION_STRING "${POLKITTQT-1_VERSION_STRING}"
/// @brief The major PolkitTQt-1 version number at compile time
#define POLKIT_TQT_VERSION_MAJOR ${POLKITTQT-1_VERSION_MAJOR}
/// @brief The minor PolkitTQt-1 version number at compile time
#define POLKIT_TQT_VERSION_MINOR ${POLKITTQT-1_VERSION_MINOR}
/// @brief The PolkitTQt-1 patch version number at compile time
#define POLKIT_TQT_VERSION_PATCH ${POLKITTQT-1_VERSION_PATCH}
/**
* \brief Create a unique number from the major, minor and release number of a %PolkitTQt-1 version
*
* This function can be used for preprocessing. For version information at runtime
* use the version methods in the PolkitTQt-1 namespace.
*/
#define POLKIT_TQT_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
/**
* \brief %PolkitTQt-1 Version as a unique number at compile time
*
* This macro calculates the %PolkitTQt-1 version into a number. It is mainly used
* through POLKIT_TQT_IS_VERSION in preprocessing. For version information at runtime
* use the version methods in the PolkitTQt-1 namespace.
*/
#define POLKIT_TQT_VERSION \
POLKIT_TQT_MAKE_VERSION(POLKIT_TQT_VERSION_MAJOR,POLKIT_TQT_VERSION_MINOR,POLKIT_TQT_VERSION_PATCH)
/**
* \brief Check if the %PolkitTQt-1 version matches a certain version or is higher
*
* This macro is typically used to compile conditionally a part of code:
* \code
* #if POLKIT_TQT_IS_VERSION(2,1)
* // Code for PolkitTQt-1 2.1
* #else
* // Code for PolkitTQt-1 2.0
* #endif
* \endcode
*
* For version information at runtime
* use the version methods in the PolkitTQt-1 namespace.
*/
#define POLKIT_TQT_IS_VERSION(a,b,c) ( POLKIT_TQT_VERSION >= POLKIT_TQT_MAKE_VERSION(a,b,c) )
namespace PolkitTQt {
/**
* @brief Returns the major number of PolkitTQt-1's version, e.g.
* 1 for %PolkitTQt-1 1.0.2.
* @return the major version number at runtime.
*/
POLKIT_TQT_EXPORT unsigned int versionMajor();
/**
* @brief Returns the minor number of PolkitTQt-1's version, e.g.
* 0 for %PolkitTQt-1 1.0.2.
* @return the minor version number at runtime.
*/
POLKIT_TQT_EXPORT unsigned int versionMinor();
/**
* @brief Returns the patch number of PolkitTQt-1's version, e.g.
* 2 for %PolkitTQt-1 1.0.2.
* @return the release number at runtime.
*/
POLKIT_TQT_EXPORT unsigned int versionPatch();
/**
* @brief Returns the %PolkitTQt-1 version as string, e.g. "1.0.2".
*
* On contrary to the macro POLKIT_TQT_VERSION_STRING this function returns
* the version number of PolkitTQt-1 at runtime.
* @return the %PolkitTQt-1 version. You can keep the string forever
*/
POLKIT_TQT_EXPORT const char* versionString();
}
#endif
Loading…
Cancel
Save