videodownloader/network/permissionstatus.h

34 lines
1.2 KiB
C
Raw Normal View History

2015-04-22 19:32:04 +02:00
#ifndef PERMISSIONSTATUS
#define PERMISSIONSTATUS
namespace Network {
/*!
* \brief Specifies whether an action is allowed.
*/
2017-05-01 03:22:50 +02:00
enum class PermissionStatus {
2015-04-22 19:32:04 +02:00
Unknown, /**< The download will ask for the permission if required by emitting the corresponding signal. */
Asking, /**< The download is asking for the permission. The corresponding signal has been emitted. */
Allowed, /**< The download is allowed to perform the action once but the status will turn to Unknown when doing the action. */
Refused, /**< The download is not allowed to perform the action and the status will turn to Unknown when refusing the action. */
AlwaysAllowed, /**< The download is allowed to perform the action always. */
AlwaysRefused /**< The download is not allowed to perform the action. */
};
/*!
* \brief Sets the specified \a permission to PermissionStatus::Unknown if the permission is only to be used once an not always.
*/
inline void usePermission(PermissionStatus &permission)
{
2017-05-01 03:22:50 +02:00
switch (permission) {
2015-04-22 19:32:04 +02:00
case PermissionStatus::Allowed:
case PermissionStatus::Refused:
permission = PermissionStatus::Unknown;
break;
2017-05-01 03:22:50 +02:00
default:;
2015-04-22 19:32:04 +02:00
}
}
2019-07-20 20:20:58 +02:00
} // namespace Network
2015-04-22 19:32:04 +02:00
#endif // PERMISSIONSTATUS