2017-04-20 15:39:59 -04:00
|
|
|
/*
|
|
|
|
* RetroShare Android QML App
|
|
|
|
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
|
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
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 org.retroshare.qml_components.LibresapiLocalClient 1.0
|
2017-04-20 15:39:59 -04:00
|
|
|
import "." //Needed for ClipboardWrapper singleton
|
|
|
|
import "URI.js" as UriJs
|
2016-09-15 07:07:13 -04:00
|
|
|
|
|
|
|
Item
|
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
property ApplicationWindow mW
|
2016-09-16 06:04:49 -04:00
|
|
|
|
2017-04-20 15:39:59 -04:00
|
|
|
Column
|
2016-09-15 07:07:13 -04:00
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
anchors.fill: parent
|
2016-09-15 07:07:13 -04:00
|
|
|
|
2017-04-20 15:39:59 -04:00
|
|
|
Text
|
2016-09-16 06:04:49 -04:00
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
text: qsTr("Import/export node from/to clipboard")
|
|
|
|
font.bold: true
|
|
|
|
wrapMode: Text.Wrap
|
2016-09-16 06:04:49 -04:00
|
|
|
}
|
2016-09-15 07:07:13 -04:00
|
|
|
|
2016-10-26 14:37:28 -04:00
|
|
|
Button
|
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
text: qsTr("Export own certificate link")
|
2016-10-26 14:37:28 -04:00
|
|
|
onClicked:
|
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
console.log("onClicked", text)
|
2017-04-13 10:47:27 -04:00
|
|
|
rsApi.request(
|
2017-04-20 15:39:59 -04:00
|
|
|
"/peers/self/certificate/", "",
|
|
|
|
function(par)
|
|
|
|
{
|
|
|
|
var radix = JSON.parse(par.response).data.cert_string
|
|
|
|
var name = mainWindow.user_name
|
|
|
|
var encodedName = UriJs.URI.encode(name)
|
|
|
|
ClipboardWrapper.postToClipBoard(
|
|
|
|
"retroshare://certificate?" +
|
|
|
|
"name=" + encodedName +
|
|
|
|
"&radix=" + UriJs.URI.encode(radix) +
|
|
|
|
"&location=" + encodedName
|
|
|
|
)
|
|
|
|
|
|
|
|
linkCopiedPopup.itemName = name
|
|
|
|
linkCopiedPopup.open()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button
|
|
|
|
{
|
|
|
|
text: qsTr("Import trusted node")
|
|
|
|
|
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
var cptext = ClipboardWrapper.getFromClipBoard()
|
|
|
|
|
|
|
|
console.log("typeof(cptext)", typeof(cptext))
|
|
|
|
if(cptext.search("://") > 0)
|
|
|
|
mainWindow.handleIntentUri(cptext)
|
|
|
|
else
|
|
|
|
rsApi.request(
|
2017-04-13 10:47:27 -04:00
|
|
|
"/peers/examine_cert/",
|
2017-04-20 15:39:59 -04:00
|
|
|
JSON.stringify({cert_string: cptext}),
|
2017-04-13 10:47:27 -04:00
|
|
|
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
|
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
text: qsTr("Export own plain certificate")
|
2016-09-22 06:48:08 -04:00
|
|
|
onClicked:
|
|
|
|
{
|
2017-04-20 15:39:59 -04:00
|
|
|
rsApi.request(
|
|
|
|
"/peers/self/certificate/", "",
|
|
|
|
function(par)
|
|
|
|
{
|
|
|
|
var jD = JSON.parse(par.response).data
|
|
|
|
ClipboardWrapper.postToClipBoard(jD.cert_string)
|
|
|
|
mainWindow.linkCopiedPopup.itemName=mainWindow.user_name
|
|
|
|
mainWindow.linkCopiedPopup.open()
|
|
|
|
})
|
2016-09-22 06:48:08 -04:00
|
|
|
}
|
|
|
|
}
|
2016-09-15 07:07:13 -04:00
|
|
|
}
|
|
|
|
}
|