mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
qml-app: Added button to deny friendship
This commit is contained in:
parent
3de3becb9b
commit
2c10e206b8
1 changed files with 27 additions and 14 deletions
|
@ -18,22 +18,13 @@
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
|
||||||
import "jsonpath.js" as JSONPath
|
import "jsonpath.js" as JSONPath
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
function refreshData() { rsApi.request("/peers/*", "") }
|
function refreshData() { rsApi.request("/peers/*", "", function(par) { jsonModel.json = par.response }) }
|
||||||
|
|
||||||
onFocusChanged: focus && refreshData()
|
onFocusChanged: focus && refreshData()
|
||||||
|
|
||||||
LibresapiLocalClient
|
|
||||||
{
|
|
||||||
id: rsApi
|
|
||||||
onGoodResponseReceived: jsonModel.json = msg
|
|
||||||
Component.onCompleted: { openConnection(apiSocketPath) }
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONListModel
|
JSONListModel
|
||||||
{
|
{
|
||||||
id: jsonModel
|
id: jsonModel
|
||||||
|
@ -46,11 +37,33 @@ Item
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: bottomButton.top
|
anchors.bottom: bottomButton.top
|
||||||
model: jsonModel.model
|
model: jsonModel.model
|
||||||
delegate: Text
|
delegate: Item
|
||||||
{
|
{
|
||||||
text: model.name
|
height: 50
|
||||||
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"
|
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
|
Button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue