From 80f5e3bd7410fae2ce60a14ebe1dff2ac5256bb5 Mon Sep 17 00:00:00 2001 From: Gio Date: Tue, 27 Sep 2016 14:05:14 +0200 Subject: [PATCH] Add view to list trusted nodes --- retroshare-qml-app/src/qml.qrc | 1 + retroshare-qml-app/src/qml/Contacts.qml | 7 +-- .../src/qml/TrustedNodesView.qml | 58 +++++++++++++++++++ retroshare-qml-app/src/qml/main.qml | 14 ++--- 4 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 retroshare-qml-app/src/qml/TrustedNodesView.qml diff --git a/retroshare-qml-app/src/qml.qrc b/retroshare-qml-app/src/qml.qrc index 0a2b127ca..54ce78395 100644 --- a/retroshare-qml-app/src/qml.qrc +++ b/retroshare-qml-app/src/qml.qrc @@ -21,5 +21,6 @@ qml/Contacts.qml qml/AddTrustedNode.qml qml/RsLoginPassView.qml + qml/TrustedNodesView.qml diff --git a/retroshare-qml-app/src/qml/Contacts.qml b/retroshare-qml-app/src/qml/Contacts.qml index 1a405c873..63364d516 100644 --- a/retroshare-qml-app/src/qml/Contacts.qml +++ b/retroshare-qml-app/src/qml/Contacts.qml @@ -22,11 +22,7 @@ import org.retroshare.qml_components.LibresapiLocalClient 1.0 Item { - function refreshData() - { - rsApi.openConnection(apiSocketPath) - rsApi.request("/identity/*/", "") - } + function refreshData() { rsApi.request("/identity/*/", "") } onFocusChanged: focus && refreshData() @@ -34,6 +30,7 @@ Item { id: rsApi onGoodResponseReceived: locationsModel.json = msg + Component.onCompleted: { openConnection(apiSocketPath) } } JSONListModel diff --git a/retroshare-qml-app/src/qml/TrustedNodesView.qml b/retroshare-qml-app/src/qml/TrustedNodesView.qml new file mode 100644 index 000000000..7464948f8 --- /dev/null +++ b/retroshare-qml-app/src/qml/TrustedNodesView.qml @@ -0,0 +1,58 @@ +/* + * RetroShare Android QML App + * Copyright (C) 2016 Gioacchino Mazzurco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.0 +import QtQuick.Controls 1.4 +import org.retroshare.qml_components.LibresapiLocalClient 1.0 + +Item +{ + function refreshData() { rsApi.request("/peers", "") } + + onFocusChanged: focus && refreshData() + + LibresapiLocalClient + { + id: rsApi + onGoodResponseReceived: jsonModel.json = msg + Component.onCompleted: { openConnection(apiSocketPath) } + } + + JSONListModel + { + id: jsonModel + query: "$.data[*]" + } + + ListView + { + width: parent.width + anchors.top: parent.top + anchors.bottom: bottomButton.top + model: jsonModel.model + delegate: Text { text: model.name } + } + + Button + { + id: bottomButton + text: "Add Trusted Node" + anchors.bottom: parent.bottom + onClicked: swipeView.currentIndex = addTrustedNodeView.SwipeView.index + } +} diff --git a/retroshare-qml-app/src/qml/main.qml b/retroshare-qml-app/src/qml/main.qml index d34cfe4eb..716ea5550 100644 --- a/retroshare-qml-app/src/qml/main.qml +++ b/retroshare-qml-app/src/qml/main.qml @@ -78,9 +78,11 @@ ApplicationWindow qParent: swipeView } - AddTrustedNode + TrustedNodesView { id: trustedNodesView } + + Contacts { - id: addTrustedNodeView + id: contactsView visible: true } @@ -105,13 +107,11 @@ ApplicationWindow height: 100 } -/* - - Contacts + AddTrustedNode { - id: contactsView + id: addTrustedNodeView visible: true - }*/ + } } }