You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
polkit-tqt/core/polkittqt1-temporaryauthori...

125 lines
3.5 KiB

/*
* This file is part of the PolKit1-qt project
* 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 POLKITTQT1_TEMPORARYAUTHORIZATION_H
#define POLKITTQT1_TEMPORARYAUTHORIZATION_H
#include "polkittqt1-subject.h"
#include <TQtCore/TQObject>
#include <TQtCore/TQDateTime>
#include <TQtCore/TQMetaType>
#include <TQtCore/TQSharedData>
typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization;
/**
* \namespace PolkitTQt1 PolkitTQt
*
* \brief Namespace wrapping PolicyKit-TQt classes
*
* This namespace wraps all PolicyKit-TQt classes.
*/
namespace PolkitTQt1
{
/**
* \class TemporaryAuthorization polkittqt1-temporaryauthorization.h TemporaryAuthorization
* \author Radek Novacek <rnovacek@redhat.com>
*
* \brief This class represents PolicyKit temporary authorization
*
* This class encapsulates the PolkitTemporaryAuthorization interface.
*/
class POLKITTQT1_EXPORT TemporaryAuthorization
{
public:
typedef TQList< TemporaryAuthorization > List;
TemporaryAuthorization();
/**
* Creates TemporaryAuthorization object from PolkitTemporaryAuthorization
*
* \warning It shouldn't be used directly unless you are completely aware of what are you doing
*
* \param pkTemporaryAuthorization PolkitTemporaryAuthorization object
* \param parent
*/
explicit TemporaryAuthorization(PolkitTemporaryAuthorization *pkTemporaryAuthorization);
TemporaryAuthorization(const TemporaryAuthorization &other);
~TemporaryAuthorization();
TemporaryAuthorization &operator=(const TemporaryAuthorization &other);
/**
* \brief Gets the identifier for the authorization.
*
* This identifier can be user by the revokeTemporaryAuthorization function
*
* \return Unique identifier for the authorization
*/
TQString id() const;
/**
* \brief Gets the identifier of the action that authorization is for
*
* \return String that identifies the action
*/
TQString actionId() const;
/**
* \brief Gets the subject that authorization is for
*
* \return A Subject.
*/
Subject subject() const;
/**
* \brief Gets the time when authorization was obtained
*
* \return Time of obtaining the authorization
*/
TQDateTime obtainedAt() const;
/**
* \brief Gets the time when authorizaton will expire
*
* \return Time of expiration
*/
TQDateTime expirationTime() const;
/**
* \brief Revoke temporary authorization
*
* \return \c true Authorization has been revoked
* \c false Revoking authorization failed
*/
bool revoke();
private:
class Data;
TQSharedDataPointer< Data > d;
};
}
TQ_DECLARE_METATYPE(PolkitTQt1::TemporaryAuthorization::List)
#endif // TEMPORARYAUTHORIZATION_H