2
* This file is part of the Polkit-qt project
3
* Copyright (C) 2009 Radek Novacek <rnovacek@redhat.com>
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.
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.
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.
23
#include <QtCore/QStringList>
25
#include <polkit/polkit.h>
27
using namespace PolkitQt;
29
class Details::Private
34
PolkitDetails *polkitDetails;
37
Details::Details(QObject *parent)
42
d->polkitDetails = polkit_details_new();
45
Details::Details(PolkitDetails *pkDetails, QObject *parent)
50
d->polkitDetails = pkDetails;
55
g_object_unref(d->polkitDetails);
59
QString Details::lookup(const QString &key) const
61
const gchar *result = polkit_details_lookup(d->polkitDetails, key.toUtf8().data());
63
return QString::fromUtf8(result);
68
void Details::insert(const QString &key, const QString &value)
70
polkit_details_insert(d->polkitDetails, key.toUtf8().data(), value.toUtf8().data());
73
QStringList Details::getKeys() const
75
gchar **result = polkit_details_get_keys(d->polkitDetails);
77
int len = g_strv_length(result);
78
for (int i = 0; i < len; i++)
80
list.append(QString::fromUtf8(result[i]));