2017-04-16 08:46:43 -04:00
|
|
|
import QtQuick 2.7
|
2017-03-24 07:02:13 -04:00
|
|
|
import QtQuick.Controls 2.0
|
2016-09-15 07:07:13 -04:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
|
|
|
|
|
|
|
Item
|
|
|
|
{
|
2016-09-16 06:04:49 -04:00
|
|
|
function refreshData() { rsApi.request("/peers/self/certificate/", "") }
|
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
Component.onCompleted:
|
|
|
|
{
|
|
|
|
rsApi.openConnection(apiSocketPath)
|
2016-09-16 06:04:49 -04:00
|
|
|
refreshData()
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
2016-09-16 06:04:49 -04:00
|
|
|
onFocusChanged: focus && refreshData()
|
2016-09-15 07:07:13 -04:00
|
|
|
|
|
|
|
LibresapiLocalClient
|
|
|
|
{
|
|
|
|
id: rsApi
|
2016-09-16 06:04:49 -04:00
|
|
|
onGoodResponseReceived:
|
|
|
|
{
|
|
|
|
var jsonData = JSON.parse(msg)
|
|
|
|
if(jsonData && jsonData.data && jsonData.data.cert_string)
|
|
|
|
myKeyField.text = jsonData.data.cert_string
|
|
|
|
}
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout
|
|
|
|
{
|
2016-10-26 14:37:28 -04:00
|
|
|
anchors.fill: parent
|
2016-09-15 07:07:13 -04:00
|
|
|
|
2016-10-26 14:37:28 -04:00
|
|
|
Button
|
|
|
|
{
|
|
|
|
id: bottomButton
|
|
|
|
text: "Add trusted node"
|
|
|
|
onClicked:
|
|
|
|
{
|
2017-04-13 10:47:27 -04:00
|
|
|
rsApi.request(
|
|
|
|
"/peers/examine_cert/",
|
|
|
|
JSON.stringify({cert_string: otherKeyField.text}),
|
|
|
|
function(par)
|
|
|
|
{
|
|
|
|
console.log("/peers/examine_cert/ CB", par)
|
|
|
|
var jData = JSON.parse(par.response).data
|
|
|
|
stackView.push(
|
|
|
|
"qrc:/TrustedNodeDetails.qml",
|
|
|
|
{
|
|
|
|
nodeCert: otherKeyField.text,
|
|
|
|
pgpName: jData.name,
|
|
|
|
pgpId: jData.pgp_id,
|
|
|
|
locationName: jData.location,
|
|
|
|
sslIdTxt: jData.peer_id
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
2016-10-26 14:37:28 -04:00
|
|
|
}
|
|
|
|
}
|
2016-09-22 06:48:08 -04:00
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Copy"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
myKeyField.selectAll()
|
|
|
|
myKeyField.copy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: "Paste"
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
otherKeyField.selectAll()
|
|
|
|
otherKeyField.paste()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-26 14:37:28 -04:00
|
|
|
TextField { id: myKeyField }
|
|
|
|
TextField { id: otherKeyField }
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
}
|