Conversion of 'gui' library module.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 4 years ago
parent 8f1d08da58
commit 98b37ff3b1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -97,15 +97,21 @@ install(
includes/PolkitTQt/TemporaryAuthorization includes/PolkitTQt/TemporaryAuthorization
includes/PolkitTQt/ActionDescription includes/PolkitTQt/ActionDescription
DESTINATION DESTINATION
${INCLUDE_INSTALL_DIR}/PolkitTQt ) ${INCLUDE_INSTALL_DIR}/PolkitTQt
)
install(
FILES
includes/PolkitTQt/Gui/Action
includes/PolkitTQt/Gui/ActionButton
includes/PolkitTQt/Gui/ActionButtons
DESTINATION
${INCLUDE_INSTALL_DIR}/PolkitTQt/Gui
)
install( install(
FILES FILES
polkit-tqt-export.h polkit-tqt-export.h
## gui/polkittqt1-gui-action.h
## gui/polkittqt1-gui-actionbutton.h
## gui/polkittqt1-gui-actionbuttons.h
##
## agent/polkittqt1-agent-listener.h ## agent/polkittqt1-agent-listener.h
## agent/polkittqt1-agent-session.h ## agent/polkittqt1-agent-session.h
## ##
@ -146,9 +152,6 @@ install(
## 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-actionbutton.h
## gui/polkittqt1-gui-actionbuttons.h
## ##
## agent/polkittqt1-agent-listener.h ## agent/polkittqt1-agent-listener.h
## agent/polkittqt1-agent-session.h ## agent/polkittqt1-agent-session.h
@ -160,17 +163,10 @@ install(
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1 ) ## ${INCLUDE_INSTALL_DIR}/polkit-qt-1 )
## ##
## install(FILES ## install(FILES
## includes/PolkitTQt1/Gui/Action ## includes/PolkitTQt/Agent/Listener
## includes/PolkitTQt1/Gui/ActionButton ## includes/PolkitTQt/Agent/Session
## includes/PolkitTQt1/Gui/ActionButtons
## DESTINATION
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui )
##
## install(FILES
## includes/PolkitTQt1/Agent/Listener
## includes/PolkitTQt1/Agent/Session
## DESTINATION ## DESTINATION
## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Agent ) ## ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt/Agent )
## ##
## # 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)

@ -62,7 +62,7 @@ UI file, \c kickPB . As you can see, you can set custom properties on your butto
on the action status/result. The code is mostly self-explainatory on the action status/result. The code is mostly self-explainatory
\code \code
bt = new ActionButtons(TQList<TQAbstractButton*>() << listenPB << listenCB, bt = new ActionButtons(TQList<TQButton*>() << listenPB << listenCB,
"org.tqt.policykit.examples.listen", this); "org.tqt.policykit.examples.listen", this);
bt->setIcon(TQPixmap(":/Icons/action-locked.png")); bt->setIcon(TQPixmap(":/Icons/action-locked.png"));
bt->setIcon(TQPixmap(":/Icons/action-unlocked.png"), Action::Yes); bt->setIcon(TQPixmap(":/Icons/action-unlocked.png"), Action::Yes);
@ -75,7 +75,7 @@ are kept in sync with the action.
\code \code
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton*,bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton*,bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
\endcode \endcode

@ -4,7 +4,7 @@ Polkit-tqt
What is Polkit-tqt? What is Polkit-tqt?
------------------ ------------------
Polkit-tqt is a library that lets developers use the PolicyKit API through a nice 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 TQAbstractButton that TQt-styled API. It is mainly a wrapper around TQAction and TQButton that
lets you integrate those two component easily with PolicyKit lets you integrate those two component easily with PolicyKit
This directory contains the sources of the library. This directory contains the sources of the library.

@ -3,9 +3,9 @@ debian/tmp/usr/include/polkit-tqt/PolkitTQt/ActionDescription
#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Session #debian/tmp/usr/include/polkit-tqt/PolkitTQt/Agent/Session
debian/tmp/usr/include/polkit-tqt/PolkitTQt/Authority debian/tmp/usr/include/polkit-tqt/PolkitTQt/Authority
debian/tmp/usr/include/polkit-tqt/PolkitTQt/Details 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/Action
#debian/tmp/usr/include/polkit-tqt/PolkitTQt/Gui/ActionButton 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/Gui/ActionButtons
debian/tmp/usr/include/polkit-tqt/PolkitTQt/Identity debian/tmp/usr/include/polkit-tqt/PolkitTQt/Identity
debian/tmp/usr/include/polkit-tqt/PolkitTQt/Subject debian/tmp/usr/include/polkit-tqt/PolkitTQt/Subject
debian/tmp/usr/include/polkit-tqt/PolkitTQt/TemporaryAuthorization debian/tmp/usr/include/polkit-tqt/PolkitTQt/TemporaryAuthorization
@ -15,9 +15,9 @@ debian/tmp/usr/include/polkit-tqt/polkit-tqt-actiondescription.h
debian/tmp/usr/include/polkit-tqt/polkit-tqt-authority.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-details.h
debian/tmp/usr/include/polkit-tqt/polkit-tqt-export.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-action.h
#debian/tmp/usr/include/polkit-tqt/polkit-tqt-gui-actionbutton.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-gui-actionbuttons.h
debian/tmp/usr/include/polkit-tqt/polkit-tqt-identity.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-subject.h
debian/tmp/usr/include/polkit-tqt/polkit-tqt-temporaryauthorization.h debian/tmp/usr/include/polkit-tqt/polkit-tqt-temporaryauthorization.h

@ -40,7 +40,7 @@ PkExample::PkExample(TQMainWindow *parent)
ActionButton *bt; ActionButton *bt;
// Here we create an ActionButton that is a subclass of Action // Here we create an ActionButton that is a subclass of Action
// always pass a TQAbstractButton pointer and action id // always pass a TQButton pointer and action id
// You can change the action id later if you want // You can change the action id later if you want
bt = new ActionButton(kickPB, "org.qt.policykit.examples.kick", this); bt = new ActionButton(kickPB, "org.qt.policykit.examples.kick", this);
// Here we are setting the text and icon to all four states // Here we are setting the text and icon to all four states
@ -56,10 +56,10 @@ PkExample::PkExample(TQMainWindow *parent)
// this signal is emitted when the user click on the action, // this signal is emitted when the user click on the action,
// it will only happen if it was inserted in a TQMenu or a TQToolBar // it will only happen if it was inserted in a TQMenu or a TQToolBar
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
// This signal was propagated from the TQAbstractButton just for // This signal was propagated from the TQButton just for
// convenience in this case we don't have any benefit but the code // convenience in this case we don't have any benefit but the code
// look cleaner // look cleaner
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
// this is the Action activated signal, it is always emmited whenever // this is the Action activated signal, it is always emmited whenever
// someone click and get authorized to do the action // someone click and get authorized to do the action
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
@ -70,7 +70,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
bt = new ActionButton(bleedPB, "org.qt.policykit.examples.bleed", this); bt = new ActionButton(bleedPB, "org.qt.policykit.examples.bleed", this);
@ -79,7 +79,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
// This action is more customized // This action is more customized
@ -103,7 +103,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
bt = new ActionButton(deletePB, "org.qt.policykit.examples.delete", this); bt = new ActionButton(deletePB, "org.qt.policykit.examples.delete", this);
@ -114,7 +114,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
bt = new ActionButton(listenPB, "org.qt.policykit.examples.listen", this); bt = new ActionButton(listenPB, "org.qt.policykit.examples.listen", this);
@ -125,7 +125,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
bt = new ActionButton(setPB, "org.qt.policykit.examples.set", this); bt = new ActionButton(setPB, "org.qt.policykit.examples.set", this);
@ -136,7 +136,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
bt = new ActionButton(shoutPB, "org.qt.policykit.examples.shout", this); bt = new ActionButton(shoutPB, "org.qt.policykit.examples.shout", this);
@ -149,7 +149,7 @@ PkExample::PkExample(TQMainWindow *parent)
menuActions->addAction(qobject_cast<Action *>(bt)); menuActions->addAction(qobject_cast<Action *>(bt));
toolBar->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt));
connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(clicked(TQButton *, bool)), bt, SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated()));
// test configChanged // test configChanged

@ -10,8 +10,10 @@
################################################# #################################################
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/core
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
) )
@ -22,38 +24,29 @@ link_directories(
##### install headers ########################### ##### install headers ###########################
install( FILES install(
dummy-gui.h FILES
DESTINATION ${INCLUDE_INSTALL_DIR} ) polkit-tqt-gui-action.h
polkit-tqt-gui-actionbutton.h
polkit-tqt-gui-actionbuttons.h
DESTINATION ${INCLUDE_INSTALL_DIR}
)
##### polkit-tqt-gui (shared) ######################### ##### polkit-tqt-gui (shared) #########################
tde_add_library( polkit-tqt-gui SHARED AUTOMOC tde_add_library( polkit-tqt-gui SHARED AUTOMOC
SOURCES ${polkit_tqt_MOCS} SOURCES ${polkit_tqt_gui_MOCS}
dummy-gui.cpp polkit-tqt-gui-action.cpp
polkit-tqt-gui-actionbutton.cpp
polkit-tqt-gui-actionbuttons.cpp
VERSION 0.0.0 VERSION 0.0.0
LINK ${TQT_LIBRARIES} LINK ${TQT_LIBRARIES} ${POLKIT_LIBRARIES} polkit-tqt-core-shared
DESTINATION ${LIB_INSTALL_DIR} DESTINATION ${LIB_INSTALL_DIR}
) )
## set(polkit_tqt_gui_SRCS
## polkittqt1-gui-action.cpp
## polkittqt1-gui-actionbutton.cpp
## polkittqt1-gui-actionbuttons.cpp
## )
##
## target_link_libraries(polkit-tqt-gui-1
## ${TQT_TQTCORE_LIBRARY}
## ${TQT_TQTGUI_LIBRARY}
## ${TQT_TQTDBUS_LIBRARY}
## ${POLKIT_LIBRARIES}
## polkit-tqt-core-1
## )
##
## set_target_properties(polkit-tqt-gui-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION} ## set_target_properties(polkit-tqt-gui-1 PROPERTIES VERSION ${POLKITTQT-1_LIBRARY_VERSION}
## SOVERSION ${POLKITTQT-1_ABI_VERSION} ## SOVERSION ${POLKITTQT-1_ABI_VERSION}
## DEFINE_SYMBOL MAKE_POLKITTQT1_LIB) ## DEFINE_SYMBOL MAKE_POLKIT_TQT_LIB)
## ##
## install(TARGETS polkit-tqt-gui-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_GUI_H
#define DUMMY_GUI_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 DummyGui
*
* \brief Convenience class for TQt/KDE applications
*
* This class is a dummy used for initial basic compiling.
*/
class POLKIT_TQT_EXPORT DummyGui
{
public:
static DummyGui* instance();
};
}
#endif

@ -0,0 +1,661 @@
/*
* 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>
*
* 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-gui-action.h"
#include "polkit-tqt-authority.h"
#include "polkit-tqt-subject.h"
#include <tqapplication.h>
namespace PolkitTQt
{
namespace Gui
{
//--------------------------------------
// Action::Private
//--------------------------------------
class Action::Private
{
public:
Private(Action *p);
void updateAction();
bool computePkResult();
Action *parent;
TQString actionId;
Authority::Result pkResult;
TQ_LONG targetPID;
bool initiallyChecked;
// states data
bool selfBlockedVisible;
bool selfBlockedEnabled;
TQString selfBlockedText;
TQString selfBlockedWhatsThis;
TQString selfBlockedToolTip;
TQIconSet selfBlockedIconSet;
bool noVisible;
bool noEnabled;
TQString noText;
TQString noWhatsThis;
TQString noToolTip;
TQIconSet noIconSet;
bool authVisible;
bool authEnabled;
TQString authText;
TQString authWhatsThis;
TQString authToolTip;
TQIconSet authIconSet;
bool yesVisible;
bool yesEnabled;
TQString yesText;
TQString yesWhatsThis;
TQString yesToolTip;
TQIconSet yesIconSet;
};
Action::Private::Private(Action *p) : parent(p), targetPID(getpid())
{
initiallyChecked = false;
// Set the default values
selfBlockedVisible = true;
selfBlockedEnabled = false;
noVisible = true;
noEnabled = false;
authVisible = true;
authEnabled = true;
yesVisible = true;
yesEnabled = true;
}
void Action::Private::updateAction()
{
if (Authority::instance()->hasError())
{
return;
}
switch (pkResult)
{
default:
case Authority::Unknown:
case Authority::No:
{
::tqt_cast<TQAction*>(parent)->setVisible(noVisible);
::tqt_cast<TQAction*>(parent)->setEnabled(noEnabled);
::tqt_cast<TQAction*>(parent)->setText(noText);
if (!noWhatsThis.isNull())
{
::tqt_cast<TQAction*>(parent)->setWhatsThis(noWhatsThis);
}
if (!noToolTip.isNull())
{
::tqt_cast<TQAction*>(parent)->setToolTip(noToolTip);
}
::tqt_cast<TQAction*>(parent)->setIconSet(noIconSet);
break;
}
case Authority::Challenge:
{
::tqt_cast<TQAction*>(parent)->setVisible(authVisible);
::tqt_cast<TQAction*>(parent)->setEnabled(authEnabled);
::tqt_cast<TQAction*>(parent)->setText(authText);
if (!authWhatsThis.isNull())
{
::tqt_cast<TQAction*>(parent)->setWhatsThis(authWhatsThis);
}
if (!authToolTip.isNull())
{
::tqt_cast<TQAction*>(parent)->setToolTip(authToolTip);
}
::tqt_cast<TQAction*>(parent)->setIconSet(authIconSet);
break;
}
case Authority::Yes:
{
::tqt_cast<TQAction*>(parent)->setVisible(yesVisible);
::tqt_cast<TQAction*>(parent)->setEnabled(yesEnabled);
::tqt_cast<TQAction*>(parent)->setText(yesText);
if (!yesWhatsThis.isNull())
{
::tqt_cast<TQAction*>(parent)->setWhatsThis(yesWhatsThis);
}
if (!yesToolTip.isNull())
{
::tqt_cast<TQAction*>(parent)->setToolTip(yesToolTip);
}
::tqt_cast<TQAction*>(parent)->setIconSet(yesIconSet);
if (parent->isOn())
{
::tqt_cast<TQAction*>(parent)->setOn(!initiallyChecked);
}
break;
}
}
emit parent->dataChanged();
}
bool Action::Private::computePkResult()
{
Authority::Result old_result;
UnixProcessSubject subject(parent->targetPID());
old_result = pkResult;
pkResult = Authority::instance()->checkAuthorizationSync(actionId, subject, Authority::None);
return old_result != pkResult;
}
//--------------------------------------
// Action
//--------------------------------------
Action::Action(const TQString &actionId, TQObject *parent) : TQAction(parent), d(new Private(this))
{
// this must be called AFTER the values initialization
setPolkitAction(actionId);
// track the config changes to update the action
connect(Authority::instance(), SIGNAL(configChanged()), this, SLOT(slotConfigChanged()));
}
Action::~Action()
{
delete d;
}
bool Action::activate()
{
switch (d->pkResult)
{
case Authority::Yes:
case Authority::Challenge:
{
emit authorized();
return true;
}
case Authority::No:
default:
{
if (d->noEnabled)
{
/* If PolicyKit says no... and we got here.. it means
* that the user set the property "no-enabled" to TRUE..
* Hence, they probably have a good reason for doing
* this so do let the 'activate' signal propagate..
*/
emit authorized();
return true;
}
break;
}
}
return false;
}
void Action::setChecked(bool checked)
{
// We store this as initiallyChecked
// to be able to undo changes in case the auth fails
d->initiallyChecked = checked;
TQAction::setOn(checked);
}
void Action::slotConfigChanged()
{
if (d->computePkResult())
{
d->updateAction();
}
}
TQ_LONG Action::targetPID() const
{
if (d->targetPID != 0)
{
return d->targetPID;
}
else
{
return getpid();
}
}
void Action::setTargetPID(TQ_LONG pid)
{
d->targetPID = pid;
d->computePkResult();
d->updateAction();
}
bool Action::isAllowed() const
{
return d->pkResult == Authority::Yes;
}
bool Action::is(const TQString &other) const
{
return d->actionId == other;
}
void Action::revoke()
{
/*TODO: implement it? no negative authorizations available, no authorization db*/
}
void Action::setText(const TQString &text, States states)
{
if (states & All)
{
d->selfBlockedText = text;
d->noText = text;
d->authText = text;
d->yesText = text;
}
else if (states & Auth)
{
d->authText = text;
}
else if (states & No)
{
d->noText = text;
}
else if (states & SelfBlocked)
{
d->selfBlockedText = text;
}
else if (states & Yes)
{
d->yesText = text;
}
d->updateAction();
}
TQString Action::text(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesText;
}
case No:
{
return d->noText;
}
case Auth:
{
return d->authText;
}
case SelfBlocked:
{
return d->selfBlockedText;
}
case None:
{
return TQAction::text();
}
default:
{
return TQString::null;
}
}
}
void Action::setToolTip(const TQString &toolTip, States states)
{
if (states & All)
{
d->selfBlockedToolTip = toolTip;
d->noToolTip = toolTip;
d->authToolTip = toolTip;
d->yesToolTip = toolTip;
}
else if (states & Auth)
{
d->authToolTip = toolTip;
}
else if (states & No)
{
d->noToolTip = toolTip;
}
else if (states & SelfBlocked)
{
d->selfBlockedToolTip = toolTip;
}
else if (states & Yes)
{
d->yesToolTip = toolTip;
}
d->updateAction();
}
TQString Action::toolTip(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesToolTip;
}
case No:
{
return d->noToolTip;
}
case Auth:
{
return d->authToolTip;
}
case SelfBlocked:
{
return d->selfBlockedToolTip;
}
case None:
{
return TQAction::toolTip();
}
default:
{
return TQString::null;
}
}
}
void Action::setWhatsThis(const TQString &whatsThis, States states)
{
if (states & All)
{
d->selfBlockedWhatsThis = whatsThis;
d->noWhatsThis = whatsThis;
d->authWhatsThis = whatsThis;
d->yesWhatsThis = whatsThis;
}
else if (states & Auth)
{
d->authWhatsThis = whatsThis;
}
else if (states & No)
{
d->noWhatsThis = whatsThis;
}
else if (states & SelfBlocked)
{
d->selfBlockedWhatsThis = whatsThis;
}
else if (states & Yes)
{
d->yesWhatsThis = whatsThis;
}
d->updateAction();
}
TQString Action::whatsThis(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesWhatsThis;
}
case No:
{
return d->noWhatsThis;
}
case Auth:
{
return d->authWhatsThis;
}
case SelfBlocked:
{
return d->selfBlockedWhatsThis;
}
case None:
{
return TQAction::whatsThis();
}
default:
{
return TQString::null;
}
}
}
void Action::setIconSet(const TQIconSet &iconset, States states)
{
if (states & All)
{
d->selfBlockedIconSet = iconset;
d->noIconSet = iconset;
d->authIconSet = iconset;
d->yesIconSet = iconset;
}
else if (states & Auth)
{
d->authIconSet = iconset;
}
else if (states & No)
{
d->noIconSet = iconset;
}
else if (states & SelfBlocked)
{
d->selfBlockedIconSet = iconset;
}
else if (states & Yes)
{
d->yesIconSet = iconset;
}
d->updateAction();
}
TQIconSet Action::iconSet(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesIconSet;
}
case No:
{
return d->noIconSet;
}
case Auth:
{
return d->authIconSet;
}
case SelfBlocked:
{
return d->selfBlockedIconSet;
}
case None:
{
return TQAction::iconSet();
}
default:
{
return TQIconSet();
}
}
}
void Action::setEnabled(bool enabled, States states)
{
if (states & All)
{
d->selfBlockedEnabled = enabled;
d->noEnabled = enabled;
d->authEnabled = enabled;
d->yesEnabled = enabled;
}
else if (states & Auth)
{
d->authEnabled = enabled;
}
else if (states & No)
{
d->noEnabled = enabled;
}
else if (states & SelfBlocked)
{
d->selfBlockedEnabled = enabled;
}
else if (states & Yes)
{
d->yesEnabled = enabled;
}
d->updateAction();
}
bool Action::isEnabled(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesEnabled;
}
case No:
{
return d->noEnabled;
}
case Auth:
{
return d->authEnabled;
}
case SelfBlocked:
{
return d->selfBlockedEnabled;
}
case None:
{
return TQAction::isEnabled();
}
default:
{
return false;
}
}
}
void Action::setVisible(bool visible, States states)
{
if (states & All)
{
d->selfBlockedVisible = visible;
d->noVisible = visible;
d->authVisible = visible;
d->yesVisible = visible;
}
else if (states & Auth)
{
d->authVisible = visible;
}
else if (states & No)
{
d->noVisible = visible;
}
else if (states & SelfBlocked)
{
d->selfBlockedVisible = visible;
}
else if (states & Yes)
{
d->yesVisible = visible;
}
d->updateAction();
}
bool Action::isVisible(Action::States state) const
{
switch (state)
{
case Yes:
{
return d->yesVisible;
}
case No:
{
return d->noVisible;
}
case Auth:
{
return d->authVisible;
}
case SelfBlocked:
{
return d->selfBlockedVisible;
}
case None:
{
return TQAction::isVisible();
}
default:
{
return false;
}
}
}
void Action::setPolkitAction(const TQString &actionId)
{
d->actionId = actionId;
d->computePkResult();
d->updateAction();
}
TQString Action::actionId() const
{
return d->actionId;
}
}
}
#include "polkit-tqt-gui-action.moc"

@ -24,7 +24,7 @@
#include "polkit-tqt-export.h" #include "polkit-tqt-export.h"
#include <TQtGui/TQAction> #include <tqaction.h>
namespace PolkitTQt namespace PolkitTQt
@ -45,19 +45,19 @@ namespace Gui
* given action. * given action.
* *
* Most of the times, you would want to use this class combined * Most of the times, you would want to use this class combined
* with a TQAbstractButton. In this case, you can use the more * with a TQButton. In this case, you can use the more
* comfortable ActionButton class that manages button's properties * comfortable ActionButton class that manages button's properties
* update for you. * update for you.
* *
* \see ActionButton * \see ActionButton
*/ */
class POLKITTQT1_EXPORT Action : public TQAction class POLKIT_TQT_EXPORT Action : public TQAction
{ {
Q_OBJECT Q_OBJECT
TQ_DISABLE_COPY(Action)
public:
enum State { public:
enum States
{
None = 0, None = 0,
SelfBlocked = 1, SelfBlocked = 1,
Yes = 2, Yes = 2,
@ -70,7 +70,6 @@ public:
// Future usage = 256, // Future usage = 256,
All = 512 All = 512
}; };
TQ_DECLARE_FLAGS(States, State)
/** /**
* Constructs a new Action item * Constructs a new Action item
@ -78,10 +77,11 @@ public:
* \param actionId the PolicyKit action Id (e.g.: org.freedesktop.policykit.read) * \param actionId the PolicyKit action Id (e.g.: org.freedesktop.policykit.read)
* \param parent the object parent * \param parent the object parent
*/ */
explicit Action(const TQString &actionId = TQString(), TQObject *parent = 0); explicit Action(const TQString& actionId = TQString::null, TQObject *parent = 0);
~Action(); ~Action();
Q_SIGNALS: signals:
/** /**
* Emitted when the PolicyKit result (PolKitResult) * Emitted when the PolicyKit result (PolKitResult)
* for the given action or the internal data changes * for the given action or the internal data changes
@ -92,20 +92,18 @@ Q_SIGNALS:
void dataChanged(); void dataChanged();
/** /**
* Emitted when using this class as a proxy * Emitted when using this class as a proxy for a given
* for a given action, It's only emitted if the * action, It's only emitted if the activate() slot is
* activate() slot is called and the auth permits * called and the auth permits the action
* the action
* *
* \see activate() * \see activate()
*/ */
void authorized(); void authorized();
public Q_SLOTS: public slots:
/** /**
* Use this slot if you want to activate * Use this slot if you want to activate the action.
* the action. authorized() will be emitted * authorized() will be emitted if the action gets authorized.
* if the action gets authorized.
* *
* \return \c true if the caller can do the action * \return \c true if the caller can do the action
* *
@ -173,15 +171,15 @@ public:
void setWhatsThis(const TQString &whatsThis, States states = All); void setWhatsThis(const TQString &whatsThis, States states = All);
/** /**
* Sets the icon for the current action. This will * Sets the iconset for the current action. This will
* be shown only in the states specified in the \c states parameter. * be shown only in the states specified in the \c states parameter.
* \note You need to pass a TQIcon here. You can easily * \note You need to pass a TQIconSet here. You can easily
* create one from a Pixmap, or pass a KIcon * create one from a Pixmap
* \param icon the new icon for the action * \param iconset the new icon for the action
* \param states the states of the Polkit action on which the setting * \param states the states of the Polkit action on which the setting
* will be applied * will be applied
*/ */
void setIcon(const TQIcon &icon, States states = All); void setIconSet(const TQIconSet &iconset, States states = All);
/** /**
* Sets whether the current action is visible or not. This will * Sets whether the current action is visible or not. This will
@ -217,7 +215,7 @@ public:
* \param state The state to be checked * \param state The state to be checked
* \returns The text shown when the action is in the specified state * \returns The text shown when the action is in the specified state
*/ */
TQString text(State state = None) const; TQString text(States state = None) const;
/** /**
* Gets the tooltip of the action when it is in the specified state * Gets the tooltip of the action when it is in the specified state
@ -226,7 +224,7 @@ public:
* \param state The state to be checked * \param state The state to be checked
* \returns The tooltip shown when the action is in the specified state * \returns The tooltip shown when the action is in the specified state
*/ */
TQString toolTip(State state = None) const; TQString toolTip(States state = None) const;
/** /**
* Gets the whatsThis of the action when it is in the specified state * Gets the whatsThis of the action when it is in the specified state
@ -234,16 +232,16 @@ public:
* \param state The state to be checked * \param state The state to be checked
* \returns The whatsThis shown when the action is in the specified state * \returns The whatsThis shown when the action is in the specified state
*/ */
TQString whatsThis(State state = None) const; TQString whatsThis(States state = None) const;
/** /**
* Gets the icon of the action when it is in the specified state * Gets the iconset of the action when it is in the specified state
* *
* \note Passing None will return the current value * \note Passing None will return the current value
* \param state The state to be checked * \param state The state to be checked
* \returns The icon shown when the action is in the specified state * \returns The iconset shown when the action is in the specified state
*/ */
TQIcon icon(State state = None) const; TQIconSet iconSet(States state = None) const;
/** /**
* Gets whether the action is visible or not when it is in the specified state * Gets whether the action is visible or not when it is in the specified state
@ -252,7 +250,7 @@ public:
* \param state The state to be checked * \param state The state to be checked
* \returns Whether the action is visible or not in the specified state * \returns Whether the action is visible or not in the specified state
*/ */
bool isVisible(State state = None) const; bool isVisible(States state = None) const;
/** /**
* Gets whether the action is enabled or not when it is in the specified state * Gets whether the action is enabled or not when it is in the specified state
@ -261,7 +259,7 @@ public:
* \param state The state to be checked * \param state The state to be checked
* \returns Whether the action is enabled or not in the specified state * \returns Whether the action is enabled or not in the specified state
*/ */
bool isEnabled(State state = None) const; bool isEnabled(States state = None) const;
/** /**
* \see setTargetPID * \see setTargetPID
@ -290,16 +288,20 @@ public:
bool is(const TQString &actionId) const; bool is(const TQString &actionId) const;
private: private:
// Disable copy
Action(const Action&);
Action& operator=(const Action&);
class Private; class Private;
Private *const d; Private *const d;
Q_PRIVATE_SLOT(d, void configChanged()) private slots:
void slotConfigChanged();
}; };
} }
} }
TQ_DECLARE_OPERATORS_FOR_FLAGS(PolkitTQt1::Gui::Action::States)
#endif #endif

@ -0,0 +1,173 @@
/*
* 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>
*
* 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-gui-actionbutton.h"
#include "polkit-tqt-gui-actionbutton_p.h"
#include <tqbutton.h>
#include <tqstring.h>
#include <tqvaluelist.h>
namespace PolkitTQt
{
namespace Gui
{
//--------------------------------------
// ActionButtonPrivate
//--------------------------------------
void ActionButtonPrivate::addButton(TQButton *button)
{
buttons.append(button);
TQObject::connect(button, SIGNAL(clicked(bool)), q, SLOT(streamClicked(bool)));
TQObject::connect(q, SIGNAL(toggled(bool)), button, SLOT(toggle()));
q->updateButton();
}
void ActionButtonPrivate::removeButton(TQButton *button)
{
if (buttons.contains(button))
{
TQObject::disconnect(button, SIGNAL(clicked(bool)), q, SLOT(streamClicked(bool)));
TQObject::disconnect(q, SIGNAL(toggled(bool)), button, SLOT(toggle()));
TQValueList<TQButton*>::iterator butIt = buttons.find(button);
if (butIt != buttons.end())
{
buttons.remove(butIt);
}
}
}
//--------------------------------------
// ActionButton
//--------------------------------------
ActionButton::ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent)
: Action(actionId, parent), d(&dd)
{
d->q = this;
connect(this, SIGNAL(dataChanged()), SLOT(updateButton()));
}
ActionButton::ActionButton(TQButton *button, const TQString &actionId, TQObject *parent)
: Action(actionId, parent), d(new ActionButtonPrivate())
{
d->q = this;
d->buttons.append(button);
setButton(button);
connect(this, SIGNAL(dataChanged()), SLOT(updateButton()));
}
ActionButton::~ActionButton()
{
delete d;
}
void ActionButton::streamClicked(bool c)
{
emit clicked(::tqt_cast<TQButton*>(this->sender()), c);
}
void ActionButton::updateButton()
{
TQValueList<TQButton*>::iterator butIt;
for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
{
TQButton *ent = *butIt;
if (isVisible())
{
ent->show();
}
else
{
ent->hide();
}
ent->setEnabled(isEnabled());
ent->setText(text());
//if (!toolTip().isNull())
//{
// ent->setToolTip(toolTip());
//}
//if (!whatsThis().isNull())
//{
// ent->setWhatsThis(whatsThis());
//}
ent->setPixmap(iconSet().pixmap());
// if the item cannot do the action anymore
// lets revert to the initial state
if (ent->isToggleButton())
{
ent->setDown(isOn());
}
}
}
bool ActionButton::activate()
{
bool tg = false;
TQValueList<TQButton*>::iterator butIt;
for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
{
TQButton *ent = *butIt;
if (ent->isToggleButton())
{
// we set the the current Action state
ent->setDown(isOn());
// toggle the action cause we are not directly connected there..
tg = true;
}
}
if (tg)
{
toggle();
}
return Action::activate();
}
void ActionButton::setButton(TQButton *button)
{
// First, let's clear the list
while (!d->buttons.isEmpty())
{
d->removeButton(d->buttons.first());
}
// And then add it
d->addButton(button);
}
TQButton* ActionButton::button() const
{
return d->buttons.first();
}
}
}
#include "polkit-tqt-gui-actionbutton.moc"

@ -25,7 +25,9 @@
#include "polkit-tqt-export.h" #include "polkit-tqt-export.h"
#include "polkit-tqt-gui-action.h" #include "polkit-tqt-gui-action.h"
class TQAbstractButton; class TQButton;
class TQString;
namespace PolkitTQt namespace PolkitTQt
{ {
@ -34,14 +36,15 @@ namespace Gui
{ {
class ActionButtonPrivate; class ActionButtonPrivate;
/** /**
* \class ActionButton polkit-tqt-gui-actionbutton.h ActionButton * \class ActionButton polkit-tqt-gui-actionbutton.h ActionButton
* \author Daniel Nicoletti <dantti85-pk@yahoo.com.br> * \author Daniel Nicoletti <dantti85-pk@yahoo.com.br>
* \author Dario Freddi <drf@kde.org> * \author Dario Freddi <drf@kde.org>
* *
* \brief Class used to hold and update a TQAbstractButton * \brief Class used to hold and update a TQButton
* *
* This class allows you to associate TQAbstractButtons * This class allows you to associate TQButtons
* (i.e. TQPushButton) to a PolicyKit Action. It will update the * (i.e. TQPushButton) to a PolicyKit Action. It will update the
* button properties according to the PolicyKit Action automatically. * button properties according to the PolicyKit Action automatically.
* *
@ -53,24 +56,23 @@ class ActionButtonPrivate;
class POLKIT_TQT_EXPORT ActionButton : public Action class POLKIT_TQT_EXPORT ActionButton : public Action
{ {
Q_OBJECT Q_OBJECT
TQ_DECLARE_PRIVATE(ActionButton)
TQ_DISABLE_COPY(ActionButton)
public: public:
/** /**
* Constructs a new ActionButton. You need to pass this * Constructs a new ActionButton. You need to pass this
* constructor an existing TQAbstractButton, whose properties * constructor an existing TQButton, whose properties
* will be modified according to the underlying Action * will be modified according to the underlying Action
* object. As ActionButton inherits from Action, you can * object. As ActionButton inherits from Action, you can
* define your button's behavior right through this wrapper. * define your button's behavior right through this wrapper.
* *
* \see Action * \see Action
* *
* \param button the TQAbstractButton to associate to this ActionButton * \param button the TQButton to associate to this ActionButton
* \param actionId the action Id to create the underlying Action * \param actionId the action Id to create the underlying Action
* \param parent the parent object * \param parent the parent object
*/ */
explicit ActionButton(TQAbstractButton *button, const TQString &actionId = TQString(), TQObject *parent = 0); explicit ActionButton(TQButton *button, const TQString &actionId = TQString::null,
TQObject *parent = 0);
virtual ~ActionButton(); virtual ~ActionButton();
/** /**
@ -87,16 +89,16 @@ public:
* *
* \param button the new button associated with the underlying action * \param button the new button associated with the underlying action
*/ */
void setButton(TQAbstractButton *button); void setButton(TQButton *button);
/** /**
* Returns the current button * Returns the current button
* *
* \return the button currently associated with the underlying action * \return the button currently associated with the underlying action
*/ */
TQAbstractButton *button() const; TQButton* button() const;
public Q_SLOTS: public slots:
/** /**
* Connect clicked() signals to this slot. This should be * Connect clicked() signals to this slot. This should be
* manually done, as in some cases we might want * manually done, as in some cases we might want
@ -113,7 +115,7 @@ public Q_SLOTS:
*/ */
bool activate(); bool activate();
Q_SIGNALS: signals:
/** /**
* Emitted when the abstract button clicked(bool) signal * Emitted when the abstract button clicked(bool) signal
* is emitted. This allows you to use qobject_cast<ActionButton*>(sender()) * is emitted. This allows you to use qobject_cast<ActionButton*>(sender())
@ -126,16 +128,23 @@ Q_SIGNALS:
* \param checked the checked state, if applicable. Otherwise \c false * \param checked the checked state, if applicable. Otherwise \c false
* *
*/ */
void clicked(TQAbstractButton *button, bool checked = false); void clicked(TQButton *button, bool checked = false);
protected: protected:
ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent = 0); ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent = 0);
ActionButtonPrivate * const d_ptr; ActionButtonPrivate *const d;
private: private:
Q_PRIVATE_SLOT(d_func(), void updateButton()) // Disable copy
Q_PRIVATE_SLOT(d_func(), void streamClicked(bool)) ActionButton(const ActionButton&);
ActionButton& operator=(const ActionButton&);
friend class ActionButtonPrivate;
private slots:
void updateButton();
void streamClicked(bool);
}; };
} }
@ -143,3 +152,4 @@ private:
} }
#endif #endif

@ -1,9 +1,6 @@
/* /*
* 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) 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 +18,43 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "dummy-gui.h" #ifndef POLKIT_TQT_GUI_ACTIONBUTTON_P_H
#define POLKIT_TQT_GUI_ACTIONBUTTON_P_H
#include <polkit-tqt-gui-actionbutton.h>
class TQButton;
template <typename> class TQValueList;
namespace PolkitTQt namespace PolkitTQt
{ {
namespace Gui
{
class ActionButtonPrivate
{
public:
ActionButtonPrivate()
{
}
DummyGui* DummyGui::instance() virtual ~ActionButtonPrivate()
{ {
return 0;
} }
void addButton(TQButton *button);
void removeButton(TQButton *button);
ActionButton *q;
TQValueList<TQButton*> buttons;
};
} }
#include "dummy-gui.moc" }
#endif

@ -19,17 +19,21 @@
*/ */
#include "polkit-tqt-gui-actionbuttons.h" #include "polkit-tqt-gui-actionbuttons.h"
#include "polkit-tqt-gui-actionbuttons_p.h" #include "polkit-tqt-gui-actionbuttons_p.h"
#include <tqbutton.h>
#include <tqstring.h>
#include <tqvaluelist.h>
namespace PolkitTQt namespace PolkitTQt
{ {
namespace Gui namespace Gui
{ {
ActionButtons::ActionButtons(const TQList<TQAbstractButton *> &buttons, const TQString &actionId, TQObject *parent) ActionButtons::ActionButtons(const TQValueList<TQButton*> &buttons, const TQString &actionId,
: ActionButton(*new ActionButtonsPrivate(buttons), actionId, parent) TQObject *parent) : ActionButton(*new ActionButtonPrivate(), actionId, parent)
{ {
setButtons(buttons); setButtons(buttons);
} }
@ -38,31 +42,28 @@ ActionButtons::~ActionButtons()
{ {
} }
void ActionButtons::setButtons(const TQList<TQAbstractButton *> &buttons) void ActionButtons::setButtons(const TQValueList<TQButton*> &buttons)
{
TQValueList<TQButton*>::iterator butIt;
for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
{ {
TQ_FOREACH(TQAbstractButton *ent, buttons) { TQButton *ent = *butIt;
addButton(ent); addButton(ent);
} }
} }
TQList<TQAbstractButton *> ActionButtons::buttons() const TQValueList<TQButton *> ActionButtons::buttons() const
{ {
TQ_D(const ActionButtons);
return d->buttons; return d->buttons;
} }
void ActionButtons::addButton(TQAbstractButton *button) void ActionButtons::addButton(TQButton *button)
{ {
TQ_D(ActionButtons);
d->addButton(button); d->addButton(button);
} }
void ActionButtons::removeButton(TQAbstractButton *button) void ActionButtons::removeButton(TQButton *button)
{ {
TQ_D(ActionButtons);
d->removeButton(button); d->removeButton(button);
} }
@ -71,3 +72,4 @@ void ActionButtons::removeButton(TQAbstractButton *button)
} }
#include "polkit-tqt-gui-actionbuttons.moc" #include "polkit-tqt-gui-actionbuttons.moc"

@ -23,6 +23,7 @@
#include "polkit-tqt-gui-actionbutton.h" #include "polkit-tqt-gui-actionbutton.h"
namespace PolkitTQt namespace PolkitTQt
{ {
@ -30,40 +31,39 @@ namespace Gui
{ {
class ActionButtonsPrivate; class ActionButtonsPrivate;
/** /**
* \class ActionButtons polkit-tqt-gui-actionbuttons.h ActionButtons * \class ActionButtons polkit-tqt-gui-actionbuttons.h ActionButtons
* \author Dario Freddi <drf@kde.org> * \author Dario Freddi <drf@kde.org>
* *
* \brief Class used to hold and update a list of TQAbstractButtons * \brief Class used to hold and update a list of TQButtons
* *
* This class is a convenience wrapper around ActionButton that lets * This class is a convenience wrapper around ActionButton that lets
* you associate an undefined number of TQAbstractButtons with a single * you associate an undefined number of TQButtons with a single action.
* action. Every button will be updated accordingly upon action's properties * Every button will be updated accordingly upon action's properties changes.
* changes.
* *
* \see ActionButton * \see ActionButton
*/ */
class ActionButtons : public ActionButton class ActionButtons : public ActionButton
{ {
Q_OBJECT Q_OBJECT
TQ_DECLARE_PRIVATE(ActionButtons)
TQ_DISABLE_COPY(ActionButtons)
public: public:
/** /**
* Constructs a new ActionButton. You need to pass this * Constructs a new ActionButtons. You need to pass this
* constructor an existing list of TQAbstractButtons, whose properties * constructor an existing list of TQButtons, whose properties
* will be modified according to the underlying Action * will be modified according to the underlying Action
* object. As ActionButtons inherits from Action, you can * object. As ActionButtons inherits from Action, you can
* define your buttons' behavior right through this wrapper. * define your buttons' behavior right through this wrapper.
* *
* \see Action * \see Action
* *
* \param buttons the TQAbstractButton to associate to this ActionButton * \param buttons the TQButton to associate to this ActionButtons
* \param actionId the action Id to create the underlying Action * \param actionId the action Id to create the underlying Action
* \param parent the parent object * \param parent the parent object
*/ */
explicit ActionButtons(const TQList<TQAbstractButton *> &buttons, const TQString &actionId = TQString(), TQObject *parent = 0); explicit ActionButtons(const TQValueList<TQButton*> &buttons,
const TQString &actionId = TQString::null, TQObject *parent = 0);
virtual ~ActionButtons(); virtual ~ActionButtons();
/** /**
@ -80,14 +80,14 @@ public:
* *
* \param buttons the new buttons associated with the underlying action * \param buttons the new buttons associated with the underlying action
*/ */
void setButtons(const TQList<TQAbstractButton *> &buttons); void setButtons(const TQValueList<TQButton*> &buttons);
/** /**
* Returns the current buttons list * Returns the current buttons list
* *
* \return the buttons currently associated with the underlying action * \return the buttons currently associated with the underlying action
*/ */
TQList<TQAbstractButton *> buttons() const; TQValueList<TQButton*> buttons() const;
/** /**
* Adds a button to the current button list. The button's properties * Adds a button to the current button list. The button's properties
@ -95,7 +95,7 @@ public:
* *
* \param button the button to add * \param button the button to add
*/ */
void addButton(TQAbstractButton *button); void addButton(TQButton *button);
/** /**
* Removes a button from the current list. Please note that Polkit-TQt * Removes a button from the current list. Please note that Polkit-TQt
@ -104,7 +104,12 @@ public:
* *
* \param button the button to remove * \param button the button to remove
*/ */
void removeButton(TQAbstractButton *button); void removeButton(TQButton *button);
private:
// Disable copy
ActionButtons(const ActionButtons&);
ActionButtons& operator=(const ActionButtons&);
}; };
} }

@ -23,14 +23,27 @@
#include "polkit-tqt-gui-actionbutton_p.h" #include "polkit-tqt-gui-actionbutton_p.h"
/** class TQButton;
* \internal template <typename> class TQValueList;
*/
class PolkitTQt::Gui::ActionButtonsPrivate : public ActionButtonPrivate
namespace PolkitTQt
{
namespace Gui
{
class ActionButtonsPrivate : public ActionButtonPrivate
{ {
public: public:
ActionButtonsPrivate(const TQList<TQAbstractButton *> &b) ActionButtonsPrivate() : ActionButtonPrivate()
: ActionButtonPrivate(b) {} {
}
}; };
#endif /* ACTIONBUTTONS_P_H */ }
}
#endif

@ -1,517 +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>
*
* 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-gui-action.h"
#include "polkit-tqt-authority.h"
#include "polkit-tqt-subject.h"
#include <TQtCore/TQCoreApplication>
namespace PolkitTQt
{
namespace Gui
{
/**
* \internal
*/
class Action::Private
{
public:
Private(Action *p);
Action *parent;
TQString actionId;
Authority::Result pkResult;
TQ_LONG targetPID;
void updateAction();
bool computePkResult();
void configChanged();
bool initiallyChecked;
// states data
bool selfBlockedVisible;
bool selfBlockedEnabled;
TQString selfBlockedText;
TQString selfBlockedWhatsThis;
TQString selfBlockedToolTip;
TQIcon selfBlockedIcon;
bool noVisible;
bool noEnabled;
TQString noText;
TQString noWhatsThis;
TQString noToolTip;
TQIcon noIcon;
bool authVisible;
bool authEnabled;
TQString authText;
TQString authWhatsThis;
TQString authToolTip;
TQIcon authIcon;
bool yesVisible;
bool yesEnabled;
TQString yesText;
TQString yesWhatsThis;
TQString yesToolTip;
TQIcon yesIcon;
};
Action::Private::Private(Action *p)
: parent(p)
, targetPID(getpid())
{
initiallyChecked = false;
// Set the default values
selfBlockedVisible = true;
selfBlockedEnabled = false;
noVisible = true;
noEnabled = false;
authVisible = true;
authEnabled = true;
yesVisible = true;
yesEnabled = true;
}
Action::Action(const TQString &actionId, TQObject *parent)
: TQAction(parent)
, d(new Private(this))
{
// this must be called AFTER the values initialization
setPolkitAction(actionId);
// track the config changes to update the action
connect(Authority::instance(), SIGNAL(configChanged()),
this, SLOT(configChanged()));
// for now we call config changed..
connect(Authority::instance(), SIGNAL(consoleKitDBChanged()),
this, SLOT(configChanged()));
}
Action::~Action()
{
delete d;
}
bool Action::activate()
{
switch (d->pkResult) {
case Authority::Yes:
case Authority::Challenge:
// just Q_EMIT the 'activated' signal
TQ_EMIT authorized();
return true;
break;
default:
case Authority::No:
if (d->noEnabled) {
/* If PolicyKit says no... and we got here.. it means
* that the user set the property "no-enabled" to
* TRUE..
*
* Hence, they probably have a good reason for doing
* this so do let the 'activate' signal propagate..
*/
TQ_EMIT authorized();
return true;
}
break;
}
return false;
}
void Action::setChecked(bool checked)
{
// We store this as initiallyChecked
// to be able to undo changes in case the auth fails
d->initiallyChecked = checked;
TQAction::setChecked(checked);
}
void Action::Private::updateAction()
{
if (Authority::instance()->hasError()) {
return;
}
switch (pkResult) {
default:
case Authority::Unknown:
case Authority::No:
qobject_cast<TQAction *>(parent)->setVisible(noVisible);
qobject_cast<TQAction *>(parent)->setEnabled(noEnabled);
qobject_cast<TQAction *>(parent)->setText(noText);
if (!noWhatsThis.isNull()) {
qobject_cast<TQAction *>(parent)->setWhatsThis(noWhatsThis);
}
if (!noToolTip.isNull()) {
qobject_cast<TQAction *>(parent)->setToolTip(noToolTip);
}
qobject_cast<TQAction *>(parent)->setIcon(noIcon);
break;
case Authority::Challenge:
qobject_cast<TQAction *>(parent)->setVisible(authVisible);
qobject_cast<TQAction *>(parent)->setEnabled(authEnabled);
qobject_cast<TQAction *>(parent)->setText(authText);
if (!authWhatsThis.isNull()) {
qobject_cast<TQAction *>(parent)->setWhatsThis(authWhatsThis);
}
if (!authToolTip.isNull()) {
qobject_cast<TQAction *>(parent)->setToolTip(authToolTip);
}
qobject_cast<TQAction *>(parent)->setIcon(authIcon);
break;
case Authority::Yes:
qobject_cast<TQAction *>(parent)->setVisible(yesVisible);
qobject_cast<TQAction *>(parent)->setEnabled(yesEnabled);
qobject_cast<TQAction *>(parent)->setText(yesText);
if (!yesWhatsThis.isNull()) {
qobject_cast<TQAction *>(parent)->setWhatsThis(yesWhatsThis);
}
if (!yesToolTip.isNull()) {
qobject_cast<TQAction *>(parent)->setToolTip(yesToolTip);
}
qobject_cast<TQAction *>(parent)->setIcon(yesIcon);
if (parent->isCheckable()) {
qobject_cast<TQAction *>(parent)->setChecked(!initiallyChecked);
}
break;
}
TQ_EMIT parent->dataChanged();
}
void Action::Private::configChanged()
{
bool result_changed;
result_changed = computePkResult();
if (result_changed) {
updateAction();
}
}
bool Action::Private::computePkResult()
{
Authority::Result old_result;
UnixProcessSubject subject(parent->targetPID());
old_result = pkResult;
pkResult = Authority::Unknown;
pkResult = Authority::instance()->checkAuthorizationSync(actionId, subject, Authority::None);
return old_result != pkResult;
}
TQ_LONG Action::targetPID() const
{
if (d->targetPID != 0) {
return d->targetPID;
} else {
return TQCoreApplication::applicationPid();
}
}
void Action::setTargetPID(TQ_LONG pid)
{
d->targetPID = pid;
d->computePkResult();
d->updateAction();
}
bool Action::isAllowed() const
{
return d->pkResult == Authority::Yes;
}
bool Action::is(const TQString &other) const
{
return d->actionId == other;
}
void Action::revoke()
{
/*TODO: implement it? no negative authorizations available, no authorization db*/
}
void Action::setText(const TQString &text, States states)
{
if (states & All) {
d->selfBlockedText = text;
d->noText = text;
d->authText = text;
d->yesText = text;
} else if (states & Auth) {
d->authText = text;
} else if (states & No) {
d->noText = text;
} else if (states & SelfBlocked) {
d->selfBlockedText = text;
} else if (states & Yes) {
d->yesText = text;
}
d->updateAction();
}
TQString Action::text(Action::State state) const
{
switch (state) {
case Yes:
return d->yesText;
case No:
return d->noText;
case Auth:
return d->authText;
case SelfBlocked:
return d->selfBlockedText;
case None:
return TQAction::text();
default:
return TQString();
}
}
void Action::setToolTip(const TQString &toolTip, States states)
{
if (states & All) {
d->selfBlockedToolTip = toolTip;
d->noToolTip = toolTip;
d->authToolTip = toolTip;
d->yesToolTip = toolTip;
} else if (states & Auth) {
d->authToolTip = toolTip;
} else if (states & No) {
d->noToolTip = toolTip;
} else if (states & SelfBlocked) {
d->selfBlockedToolTip = toolTip;
} else if (states & Yes) {
d->yesToolTip = toolTip;
}
d->updateAction();
}
TQString Action::toolTip(Action::State state) const
{
switch (state) {
case Yes:
return d->yesToolTip;
case No:
return d->noToolTip;
case Auth:
return d->authToolTip;
case SelfBlocked:
return d->selfBlockedToolTip;
case None:
return TQAction::toolTip();
default:
return TQString();
}
}
void Action::setWhatsThis(const TQString &whatsThis, States states)
{
if (states & All) {
d->selfBlockedWhatsThis = whatsThis;
d->noWhatsThis = whatsThis;
d->authWhatsThis = whatsThis;
d->yesWhatsThis = whatsThis;
} else if (states & Auth) {
d->authWhatsThis = whatsThis;
} else if (states & No) {
d->noWhatsThis = whatsThis;
} else if (states & SelfBlocked) {
d->selfBlockedWhatsThis = whatsThis;
} else if (states & Yes) {
d->yesWhatsThis = whatsThis;
}
d->updateAction();
}
TQString Action::whatsThis(Action::State state) const
{
switch (state) {
case Yes:
return d->yesWhatsThis;
case No:
return d->noWhatsThis;
case Auth:
return d->authWhatsThis;
case SelfBlocked:
return d->selfBlockedWhatsThis;
case None:
return TQAction::whatsThis();
default:
return TQString();
}
}
void Action::setIcon(const TQIcon &icon, States states)
{
if (states & All) {
d->selfBlockedIcon = icon;
d->noIcon = icon;
d->authIcon = icon;
d->yesIcon = icon;
} else if (states & Auth) {
d->authIcon = icon;
} else if (states & No) {
d->noIcon = icon;
} else if (states & SelfBlocked) {
d->selfBlockedIcon = icon;
} else if (states & Yes) {
d->yesIcon = icon;
}
d->updateAction();
}
TQIcon Action::icon(Action::State state) const
{
switch (state) {
case Yes:
return d->yesIcon;
case No:
return d->noIcon;
case Auth:
return d->authIcon;
case SelfBlocked:
return d->selfBlockedIcon;
case None:
return TQAction::icon();
default:
return TQIcon();
}
}
void Action::setEnabled(bool enabled, States states)
{
if (states & All) {
d->selfBlockedEnabled = enabled;
d->noEnabled = enabled;
d->authEnabled = enabled;
d->yesEnabled = enabled;
} else if (states & Auth) {
d->authEnabled = enabled;
} else if (states & No) {
d->noEnabled = enabled;
} else if (states & SelfBlocked) {
d->selfBlockedEnabled = enabled;
} else if (states & Yes) {
d->yesEnabled = enabled;
}
d->updateAction();
}
bool Action::isEnabled(Action::State state) const
{
switch (state) {
case Yes:
return d->yesEnabled;
case No:
return d->noEnabled;
case Auth:
return d->authEnabled;
case SelfBlocked:
return d->selfBlockedEnabled;
case None:
return TQAction::isEnabled();
default:
return false;
}
}
void Action::setVisible(bool visible, States states)
{
if (states & All) {
d->selfBlockedVisible = visible;
d->noVisible = visible;
d->authVisible = visible;
d->yesVisible = visible;
} else if (states & Auth) {
d->authVisible = visible;
} else if (states & No) {
d->noVisible = visible;
} else if (states & SelfBlocked) {
d->selfBlockedVisible = visible;
} else if (states & Yes) {
d->yesVisible = visible;
}
d->updateAction();
}
bool Action::isVisible(Action::State state) const
{
switch (state) {
case Yes:
return d->yesVisible;
case No:
return d->noVisible;
case Auth:
return d->authVisible;
case SelfBlocked:
return d->selfBlockedVisible;
case None:
return TQAction::isVisible();
default:
return false;
}
}
void Action::setPolkitAction(const TQString &actionId)
{
//TODO:
d->actionId = actionId;
d->computePkResult();
d->updateAction();
}
//--------------------------------------------------
TQString Action::actionId() const
{
return d->actionId;
}
}
}
#include "polkit-tqt-gui-action.moc"

@ -1,166 +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>
*
* 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-gui-actionbutton.h"
#include "polkit-tqt-gui-actionbutton_p.h"
namespace PolkitTQt
{
namespace Gui
{
ActionButton::ActionButton(TQAbstractButton *button, const TQString &actionId, TQObject *parent)
: Action(actionId, parent)
, d_ptr(new ActionButtonPrivate(TQList<TQAbstractButton *>() << button))
{
d_ptr->q_ptr = this;
setButton(button);
connect(this, SIGNAL(dataChanged()), SLOT(updateButton()));
}
ActionButton::ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent)
: Action(actionId, parent)
, d_ptr(&dd)
{
d_ptr->q_ptr = this;
connect(this, SIGNAL(dataChanged()), SLOT(updateButton()));
}
ActionButton::~ActionButton()
{
delete d_ptr;
}
void ActionButtonPrivate::updateButton()
{
TQ_Q(ActionButton);
TQ_FOREACH(TQAbstractButton *ent, buttons) {
ent->setVisible(q->isVisible());
ent->setEnabled(q->isEnabled());
ent->setText(q->text());
if (!q->toolTip().isNull()) {
ent->setToolTip(q->toolTip());
}
if (!q->whatsThis().isNull()) {
ent->setWhatsThis(q->whatsThis());
}
ent->setIcon(q->icon());
// if the item cannot do the action anymore
// lets revert to the initial state
if (ent->isCheckable()) {
ent->setChecked(q->isChecked());
}
}
}
bool ActionButton::activate()
{
TQ_D(ActionButton);
bool tg = false;
TQ_FOREACH(TQAbstractButton *ent, d->buttons) {
if (ent->isCheckable()) {
// we set the the current Action state
ent->setChecked(isChecked());
// toggle the action cause we are not directly connected there..
tg = true;
}
}
if (tg) {
toggle();
}
return Action::activate();
}
void ActionButton::setButton(TQAbstractButton *button)
{
TQ_D(ActionButton);
// First, let's clear the list
TQ_FOREACH(TQAbstractButton *ent, d->buttons) {
d->removeButton(ent);
}
// And then add it
d->addButton(button);
}
void ActionButtonPrivate::addButton(TQAbstractButton *button)
{
TQ_Q(ActionButton);
buttons.append(button);
TQObject::connect(button, SIGNAL(clicked(bool)), q, SLOT(streamClicked(bool)));
TQObject::connect(q, SIGNAL(toggled(bool)), button, SLOT(toggle()));
if (q->isCheckable()) {
// the button should follow our first buttons
button->setCheckable(true);
} else if (button->isCheckable()) {
// if we are not checkable BUT the button
// is (eg a TQCheckBox) we should set all buttons to
// checkable.
TQ_FOREACH(TQAbstractButton *ent, buttons) {
ent->setCheckable(true);
}
// set the checkable state of Action to store the initial state
q->setCheckable(true);
}
// call this after m_activateOnCheck receives the value
updateButton();
}
void ActionButtonPrivate::removeButton(TQAbstractButton *button)
{
TQ_Q(ActionButton);
if (buttons.contains(button)) {
TQObject::disconnect(button, SIGNAL(clicked(bool)), q, SLOT(streamClicked(bool)));
TQObject::disconnect(q, SIGNAL(toggled(bool)), button, SLOT(toggle()));
buttons.removeOne(button);
}
}
TQAbstractButton *ActionButton::button() const
{
TQ_D(const ActionButton);
return d->buttons.first();
}
void ActionButtonPrivate::streamClicked(bool c)
{
TQ_Q(ActionButton);
TQ_EMIT q->clicked(qobject_cast<TQAbstractButton *>(q->sender()), c);
}
}
}
#include "polkit-tqt-gui-actionbutton.moc"

@ -1,50 +0,0 @@
/*
* This file is part of the Polkit-tqt project
* 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_GUI_ACTIONBUTTON_P_H
#define POLKIT_TQT_GUI_ACTIONBUTTON_P_H
#include <polkit-tqt-gui-actionbutton.h>
#include <TQtCore/TQList>
#include <TQtGui/TQAbstractButton>
/**
* \internal
*/
class PolkitTQt::Gui::ActionButtonPrivate
{
public:
ActionButtonPrivate(const TQList<TQAbstractButton *> &b)
: buttons(b) {}
virtual ~ActionButtonPrivate() {}
void addButton(TQAbstractButton *button);
void removeButton(TQAbstractButton *button);
void updateButton();
void streamClicked(bool);
TQ_DECLARE_PUBLIC(ActionButton)
ActionButton *q_ptr;
TQList<TQAbstractButton *> buttons;
};
#endif /* ACTIONBUTTON_P_H */
Loading…
Cancel
Save