qml-app: Added button to deny friendship

This commit is contained in:
Gioacchino Mazzurco 2016-12-22 13:47:44 +01:00
parent 3de3becb9b
commit 2c10e206b8

View File

@ -18,22 +18,13 @@
import QtQuick 2.0
import QtQuick.Controls 1.4
import org.retroshare.qml_components.LibresapiLocalClient 1.0
import "jsonpath.js" as JSONPath
Item
{
function refreshData() { rsApi.request("/peers/*", "") }
function refreshData() { rsApi.request("/peers/*", "", function(par) { jsonModel.json = par.response }) }
onFocusChanged: focus && refreshData()
LibresapiLocalClient
{
id: rsApi
onGoodResponseReceived: jsonModel.json = msg
Component.onCompleted: { openConnection(apiSocketPath) }
}
JSONListModel
{
id: jsonModel
@ -46,11 +37,33 @@ Item
anchors.top: parent.top
anchors.bottom: bottomButton.top
model: jsonModel.model
delegate: Text
delegate: Item
{
height: 50
Row
{
height: 30
Text
{
text: model.name
onTextChanged: color = JSONPath.jsonPath(JSON.parse(jsonModel.json), "$.data[?(@.pgp_id=='"+model.pgp_id+"')].locations[*].is_online").reduce(function(cur,acc){return cur || acc}, false) ? "lime" : "darkslategray"
}
Rectangle
{
height: parent.height
width: parent.height
color: "red"
MouseArea
{
height: parent.height
width: parent.height
onClicked: rsApi.request("/peers/"+model.pgp_id+"/delete")
}
}
}
}
}
Button