~ubuntu-branches/ubuntu/trusty/polkit-qt-1/trusty

« back to all changes in this revision

Viewing changes to core/actiondescription.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-12-13 09:08:07 UTC
  • Revision ID: james.westby@ubuntu.com-20091213090807-ibl3mdtee5964009
Tags: upstream-0.95.0~svn1057107
ImportĀ upstreamĀ versionĀ 0.95.0~svn1057107

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the Polkit-qt project
 
3
 * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public License
 
16
 * along with this library; see the file COPYING.LIB. If not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#include "actiondescription.h"
 
22
 
 
23
#include <QtCore/QString>
 
24
 
 
25
#include <polkit/polkit.h>
 
26
 
 
27
using namespace PolkitQt;
 
28
 
 
29
class ActionDescription::Private
 
30
{
 
31
    public:
 
32
        Private() {}
 
33
 
 
34
        QString actionId;
 
35
        QString description;
 
36
        QString message;
 
37
        QString vendorName;
 
38
        QString vendorUrl;
 
39
        QString iconName;
 
40
    
 
41
        ActionDescription::ImplicitAuthorization implicitAny;
 
42
        ActionDescription::ImplicitAuthorization implicitInactive;
 
43
        ActionDescription::ImplicitAuthorization implicitActive;
 
44
};
 
45
 
 
46
ActionDescription::ActionDescription(PolkitActionDescription *polkitActionDescription)
 
47
        : d(new Private)
 
48
{
 
49
    g_type_init();
 
50
    
 
51
    d->actionId = QString::fromUtf8(polkit_action_description_get_action_id(polkitActionDescription));
 
52
    d->description = QString::fromUtf8(polkit_action_description_get_description(polkitActionDescription));
 
53
    d->message = QString::fromUtf8(polkit_action_description_get_message(polkitActionDescription));
 
54
    d->vendorName = QString::fromUtf8(polkit_action_description_get_vendor_name(polkitActionDescription));
 
55
    d->vendorUrl = QString::fromUtf8(polkit_action_description_get_vendor_url(polkitActionDescription));
 
56
    d->iconName = QString::fromUtf8(polkit_action_description_get_icon_name(polkitActionDescription));
 
57
    
 
58
    d->implicitAny = static_cast<ActionDescription::ImplicitAuthorization>(polkit_action_description_get_implicit_any(
 
59
        polkitActionDescription));
 
60
    d->implicitInactive = static_cast<ActionDescription::ImplicitAuthorization>(polkit_action_description_get_implicit_inactive(
 
61
        polkitActionDescription));
 
62
    d->implicitActive = static_cast<ActionDescription::ImplicitAuthorization>(polkit_action_description_get_implicit_active(
 
63
        polkitActionDescription));
 
64
}
 
65
 
 
66
ActionDescription::~ActionDescription()
 
67
{
 
68
    delete d;
 
69
}
 
70
 
 
71
QString ActionDescription::actionId() const
 
72
{
 
73
    return d->actionId;
 
74
}
 
75
 
 
76
QString ActionDescription::description() const
 
77
{
 
78
    return d->description;
 
79
}
 
80
 
 
81
QString ActionDescription::message() const
 
82
{
 
83
    return d->message;
 
84
}
 
85
 
 
86
QString ActionDescription::vendorName() const
 
87
{
 
88
    return d->vendorName;
 
89
}
 
90
 
 
91
QString ActionDescription::vendorUrl() const
 
92
{
 
93
    return d->vendorUrl;
 
94
}
 
95
 
 
96
QString ActionDescription::iconName() const
 
97
{
 
98
    return d->iconName;
 
99
}
 
100
 
 
101
ActionDescription::ImplicitAuthorization ActionDescription::implicitAny() const
 
102
{
 
103
    return d->implicitAny;
 
104
}
 
105
 
 
106
ActionDescription::ImplicitAuthorization ActionDescription::implicitInactive() const
 
107
{
 
108
    return d->implicitInactive;
 
109
}
 
110
 
 
111
ActionDescription::ImplicitAuthorization ActionDescription::implicitActive() const
 
112
{
 
113
    return d->implicitActive;
 
114
}