2
* This file is part of Checkbox
4
* Copyright 2013 Canonical Ltd.
7
* - Andrew Haigh <andrew.haigh@cellsoftware.co.uk>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "PBJsonUtils.h"
24
// Key should be a meaningful name, ideally the member name
25
const QJsonObject PBJsonUtils::QDBusObjectPathArrayToJson(\
27
const QList<QDBusObjectPath> opath_list)
31
if ( opath_list.count() ) {
32
for (int i=0; i < opath_list.count();i++) {
33
QString path = opath_list.at(i).path();
34
jsonarray.append(path);
37
QJsonValue value(jsonarray);
38
object.insert(key,value);
42
// Key should be a meaningful name, ideally the member name
43
const QList<QDBusObjectPath> PBJsonUtils::JSONToQDBusObjectPathArray(\
45
const QJsonObject& object)
49
value = object.find(key).value();
50
jsonarray = value.toArray();
51
QList<QDBusObjectPath> opath_list;
52
for(int i=0; i<jsonarray.count(); i++) {
53
QString path = jsonarray.at(i).toString();
54
QDBusObjectPath opath(path);
55
opath_list.append(opath);