File indexing completed on 2024-04-28 08:35:00
0001 /* 0002 This file is part of the Polkit-qt project 0003 SPDX-FileCopyrightText: 2009 Jaroslav Reznik <jreznik@redhat.com> 0004 SPDX-FileCopyrightText: 2010 Dario Freddi <drf@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef POLKITQT1_ACTION_DESCRIPTION_H 0010 #define POLKITQT1_ACTION_DESCRIPTION_H 0011 0012 #include "polkitqt1-core-export.h" 0013 0014 #include <QList> 0015 #include <QMetaType> 0016 #include <QSharedData> 0017 0018 typedef struct _PolkitActionDescription PolkitActionDescription; 0019 0020 namespace PolkitQt1 0021 { 0022 /** 0023 * \class ActionDescription polkitqt1-actiondescription.h ActionDescription 0024 * \author Jaroslav Reznik <jreznik@redhat.com> 0025 * \author Dario Freddi <drf@kde.org> 0026 * 0027 * \brief Class used to encapsulate a registered action. 0028 */ 0029 class POLKITQT1_CORE_EXPORT ActionDescription 0030 { 0031 public: 0032 enum ImplicitAuthorization { 0033 /** Unknown whether the subject is authorized, never returned in any public API. **/ 0034 Unknown = -1, 0035 /** Subject is not authorized. **/ 0036 NotAuthorized = 0, 0037 /** Authentication is required. **/ 0038 AuthenticationRequired = 1, 0039 /** Authentication as an administrator is required. **/ 0040 AdministratorAuthenticationRequired = 2, 0041 /** Authentication is required. If the authorization is obtained, it is retained. **/ 0042 AuthenticationRequiredRetained = 3, 0043 /** Authentication as an administrator is required. If the authorization is obtained, it is retained. **/ 0044 AdministratorAuthenticationRequiredRetained = 4, 0045 /** The subject is authorized. **/ 0046 Authorized = 5 0047 }; 0048 0049 typedef QList< ActionDescription > List; 0050 0051 ActionDescription(); 0052 /** 0053 * \brief Constructor of ActionDescription object from PolkitActionDescription 0054 * 0055 * \warning Use this only if you are completely aware of what are you doing! 0056 * 0057 * \param actionDesciption PolkitActionDescription 0058 */ 0059 explicit ActionDescription(PolkitActionDescription *actionDescription); 0060 ActionDescription(const ActionDescription &other); 0061 ~ActionDescription(); 0062 0063 ActionDescription &operator=(const ActionDescription &other); 0064 0065 /** 0066 * \brief Gets the action id for ActionDescription 0067 * 0068 * \return id of the action 0069 */ 0070 QString actionId() const; 0071 0072 /** 0073 * \brief Gets the description used for ActionDescription 0074 * 0075 * \return description of the action 0076 */ 0077 QString description() const; 0078 0079 /** 0080 * \brief Gets the message used for ActionDescription 0081 * 0082 * \return action message 0083 */ 0084 QString message() const; 0085 0086 /** 0087 * \brief Gets the vendor name for ActionDescription, if any 0088 * 0089 * \return vendor name 0090 */ 0091 QString vendorName() const; 0092 0093 /** 0094 * \brief Gets the vendor URL for ActionDescription, if any 0095 * 0096 * \return vendor URL or empty QString if there is no vendor URL 0097 */ 0098 QString vendorUrl() const; 0099 0100 /** 0101 * \brief Gets the icon name for ActionDescription, if any 0102 * 0103 * \return icon name or empty QString if there is no icon 0104 */ 0105 QString iconName() const; 0106 0107 /** 0108 * \brief Gets the implicit authorization for ActionDescription used for any subject 0109 * 0110 * \return A value from ImplicitAuthorization enumeration 0111 */ 0112 ActionDescription::ImplicitAuthorization implicitAny() const; 0113 0114 /** 0115 * \brief Gets the implicit authorization for ActionDescription used for subjects in inactive session on a local console 0116 * 0117 * \return A value from ImplicitAuthorization enumeration 0118 */ 0119 ActionDescription::ImplicitAuthorization implicitInactive() const; 0120 0121 /** 0122 * \brief Gets the implicit authorization for ActionDescription used for subjects in active session on a local console 0123 * 0124 * \return A value from ImplicitAuthorization enumeration 0125 */ 0126 ActionDescription::ImplicitAuthorization implicitActive() const; 0127 0128 private: 0129 class Data; 0130 QSharedDataPointer< Data > d; 0131 }; 0132 } 0133 0134 Q_DECLARE_METATYPE(PolkitQt1::ActionDescription::List) 0135 0136 #endif //POLKIT_QT_ACTION_DESCRIPTION_H