summaryrefslogtreecommitdiffstats
path: root/core/polkittqt1-actiondescription.h
blob: 666f3be67edd11b12a77ae7ce07e80392de244da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * This file is part of the Polkit-tqt project
 * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
 * Copyright (C) 2010 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 POLKITTQT1_ACTION_DESCRIPTION_H
#define POLKITTQT1_ACTION_DESCRIPTION_H

#include "polkittqt1-export.h"

#include <TQtCore/TQList>
#include <TQtCore/TQMetaType>
#include <TQtCore/TQSharedData>

typedef struct _PolkitActionDescription PolkitActionDescription;

namespace PolkitTQt1
{
/**
 * \class ActionDescription polkittqt1-actiondescription.h ActionDescription
 * \author Jaroslav Reznik <jreznik@redhat.com>
 * \author Dario Freddi <drf@kde.org>
 *
 * \brief Class used to encapsulate a registered action.
 */
class POLKITTQT1_EXPORT ActionDescription
{
public:
    enum ImplicitAuthorization {
        /** Unknown whether the subject is authorized, never returned in any public API. **/
        Unknown = -1,
        /** Subject is not authorized. **/
        NotAuthorized = 0,
        /** Authentication is required. **/
        AuthenticationRequired = 1,
        /** Authentication as an administrator is required. **/
        AdministratorAuthenticationRequired = 2,
        /** Authentication is required. If the authorization is obtained, it is retained. **/
        AuthenticationRequiredRetained = 3,
        /** Authentication as an administrator is required. If the authorization is obtained, it is retained. **/
        AdministratorAuthenticationRequiredRetained = 4,
        /** The subject is authorized. **/
        Authorized = 5
    };

    typedef TQList< ActionDescription > List;

    ActionDescription();
    /**
     * \brief Constructor of ActionDescription object from PolkitActionDescription
     *
     * \warning Use this only if you are completely aware of what are you doing!
     *
     * \param actionDesciption PolkitActionDescription
     */
    explicit ActionDescription(PolkitActionDescription *actionDescription);
    ActionDescription(const ActionDescription &other);
    ~ActionDescription();

    ActionDescription &operator=(const ActionDescription &other);

    /**
     * \brief Gets the action id for ActionDescription
     *
     * \return id of the action
     */
    TQString actionId() const;

    /**
     * \brief Gets the description used of ActionDescription
     *
     * \return description of the action
     */
    TQString description() const;

    /**
     * \brief Gets the message user for ActionDescription
     *
     * \return action message
     */
    TQString message() const;

    /**
     * \brief Gets the vendor name for ActionDescription, if any
     *
     * \return vendor name
     */
    TQString vendorName() const;

    /**
     * \brief Gets the vendor URL for ActionDescription, if any
     *
     * \return vendor URL or empty TQString if there is no vendor URL
     */
    TQString vendorUrl() const;

    /**
     * \brief Gets the icon name for ActionDescription, if any
     *
     * \return icon name or empty TQString if there is no icon
     */
    TQString iconName() const;

    /**
     * \brief Gets the implicit authorization for ActionDescription used for any subject
     *
     * \return A value from ImplicitAuthorization enumeration
     */
    ActionDescription::ImplicitAuthorization implicitAny() const;

    /**
     * \brief Gets the implicit authorization for ActionDescription used for subjects in inactive session on a local console
     *
     * \return A value from ImplicitAuthorization enumeration
     */
    ActionDescription::ImplicitAuthorization implicitInactive() const;

    /**
     * \brief Gets the implicit authorization for ActionDescription used for subjects in active session on a local console
     *
     * \return A value from ImplicitAuthorization enumeration
     */
    ActionDescription::ImplicitAuthorization implicitActive() const;

private:
    class Data;
    TQSharedDataPointer< Data > d;
};
}

TQ_DECLARE_METATYPE(PolkitTQt1::ActionDescription::List)

#endif //POLKIT_TQT_ACTION_DESCRIPTION_H