diff options
author | Michele Calgaro <[email protected]> | 2021-10-30 12:06:43 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-10-30 12:06:43 +0900 |
commit | 28de2ff84f59ac0b173670aa9c5331bc77c1e63f (patch) | |
tree | 43dcf0f461ee5552100b648e38979982c971597d /core/polkitqt1-temporaryauthorization.h | |
download | polkit-tqt-28de2ff84f59ac0b173670aa9c5331bc77c1e63f.tar.gz polkit-tqt-28de2ff84f59ac0b173670aa9c5331bc77c1e63f.zip |
Initial import from polkit-qt-1 debian snapshot archive.
https://snapshot.debian.org/package/polkit-qt-1/0.103.0-1/
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'core/polkitqt1-temporaryauthorization.h')
-rw-r--r-- | core/polkitqt1-temporaryauthorization.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/core/polkitqt1-temporaryauthorization.h b/core/polkitqt1-temporaryauthorization.h new file mode 100644 index 000000000..f8a13ea17 --- /dev/null +++ b/core/polkitqt1-temporaryauthorization.h @@ -0,0 +1,124 @@ +/* + * This file is part of the PolKit1-qt project + * Copyright (C) 2009 Radek Novacek <[email protected]> + * + * 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 POLKITQT1_TEMPORARYAUTHORIZATION_H +#define POLKITQT1_TEMPORARYAUTHORIZATION_H + +#include "polkitqt1-subject.h" + +#include <QtCore/QObject> +#include <QtCore/QDateTime> +#include <QtCore/QMetaType> +#include <QtCore/QSharedData> + +typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization; + +/** + * \namespace PolkitQt1 PolkitQt + * + * \brief Namespace wrapping PolicyKit-Qt classes + * + * This namespace wraps all PolicyKit-Qt classes. + */ +namespace PolkitQt1 +{ + +/** + * \class TemporaryAuthorization polkitqt1-temporaryauthorization.h TemporaryAuthorization + * \author Radek Novacek <[email protected]> + * + * \brief This class represents PolicyKit temporary authorization + * + * This class encapsulates the PolkitTemporaryAuthorization interface. + */ +class POLKITQT1_EXPORT TemporaryAuthorization +{ +public: + typedef QList< 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 + */ + QString id() const; + + /** + * \brief Gets the identifier of the action that authorization is for + * + * \return String that identifies the action + */ + QString 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 + */ + QDateTime obtainedAt() const; + + /** + * \brief Gets the time when authorizaton will expire + * + * \return Time of expiration + */ + QDateTime expirationTime() const; + + /** + * \brief Revoke temporary authorization + * + * \return \c true Authorization has been revoked + * \c false Revoking authorization failed + */ + bool revoke(); + +private: + class Data; + QSharedDataPointer< Data > d; +}; +} + +Q_DECLARE_METATYPE(PolkitQt1::TemporaryAuthorization::List) + +#endif // TEMPORARYAUTHORIZATION_H |