Merge branch 'qml_app_ui_improve_link_share' into GSoC2017-evaluation-II

This commit is contained in:
Angela Mazzurco 2017-07-26 15:02:06 +02:00
commit 1b36ebc188
5 changed files with 256 additions and 77 deletions

View File

@ -27,6 +27,8 @@ Item
{ {
property ApplicationWindow mW property ApplicationWindow mW
property int infoIconHeight: 20
Column Column
{ {
anchors.fill: parent anchors.fill: parent
@ -62,51 +64,68 @@ Item
} }
} }
} }
Row
ButtonText
{ {
id: importButton
text: qsTr("Import trusted node")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
iconUrl: "/icons/paste.svg" spacing: 5
fontSize: 14
onClicked: ButtonIcon
{ {
var cptext = ClipboardWrapper.getFromClipBoard() height: infoIconHeight
anchors.verticalCenter: importButton.verticalCenter
width: height
imgUrl: "/icons/info.svg"
onClicked:
{
tooltipSpace.show(qsTr("Import a friend certificate from your clipboard. <br>"+
"This will add him as trusted node."))
console.log("typeof(cptext)", typeof(cptext)) }
if(cptext.search("://") > 0) }
mainWindow.handleIntentUri(cptext)
else ButtonText
rsApi.request( {
"/peers/examine_cert/", id: importButton
JSON.stringify({cert_string: cptext}), text: qsTr("Import trusted node")
function(par) fontSize: 14
{
console.log("/peers/examine_cert/ CB", onClicked:
par.response) {
var resp = JSON.parse(par.response) var cptext = ClipboardWrapper.getFromClipBoard()
if(resp.returncode === "fail")
console.log("typeof(cptext)", typeof(cptext))
if(cptext.search("://") > 0)
mainWindow.handleIntentUri(cptext)
else
rsApi.request(
"/peers/examine_cert/",
JSON.stringify({cert_string: cptext}),
function(par)
{ {
importErrorPop.text = resp.debug_msg console.log("/peers/examine_cert/ CB",
importErrorPop.open() par.response)
return var resp = JSON.parse(par.response)
} if(resp.returncode === "fail")
{
importErrorPop.text = resp.debug_msg
importErrorPop.open()
return
}
var jData = resp.data var jData = resp.data
stackView.push( stackView.push(
"qrc:/TrustedNodeDetails.qml", "qrc:/TrustedNodeDetails.qml",
{ {
nodeCert: cptext, nodeCert: cptext,
pgpName: jData.name, pgpName: jData.name,
pgpId: jData.pgp_id, pgpId: jData.pgp_id,
locationName: jData.location, locationName: jData.location,
sslIdTxt: jData.peer_id sslIdTxt: jData.peer_id
} }
) )
} }
) )
}
} }
} }
@ -139,55 +158,128 @@ Item
} }
} }
ButtonText Row
{ {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Export own certificate link") spacing: 5
iconUrl: "/icons/share.svg"
fontSize: 14 ButtonIcon
onClicked:
{ {
console.log("onClicked", text) height: infoIconHeight
rsApi.request( anchors.verticalCenter: btRsCert.verticalCenter
"/peers/self/certificate/", "", width: height
function(par) imgUrl: "/icons/info.svg"
{ onClicked:
var radix = JSON.parse(par.response).data.cert_string {
var name = mainWindow.user_name tooltipSpace.show(qsTr("Share your RetroShare link! <br>"+
var encodedName = UriJs.URI.encode(name) "Send it to a friend and start talk!"))
var nodeUrl = (
"retroshare://certificate?" + }
"name=" + encodedName + }
"&radix=" + UriJs.URI.encode(radix) +
"&location=" + encodedName ) ButtonText
ClipboardWrapper.postToClipBoard(nodeUrl) {
linkCopiedPopup.itemName = name id: btRsCert
linkCopiedPopup.open() text: qsTr("Export own certificate link")
platformGW.shareUrl(nodeUrl); fontSize: 14
}) onClicked:
{
console.log("onClicked", text)
rsApi.request(
"/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)
var nodeUrl = (
"retroshare://certificate?" +
"name=" + encodedName +
"&radix=" + UriJs.URI.encode(radix) +
"&location=" + encodedName )
ClipboardWrapper.postToClipBoard(nodeUrl)
linkCopiedPopup.itemName = name
linkCopiedPopup.open()
platformGW.shareUrl(nodeUrl);
})
}
} }
} }
ButtonText ButtonText
{ {
onClicked: plainCertificateRow.visible = !plainCertificateRow.visible
iconUrl: "/icons/options.svg"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Export own plain certificate") color: "white"
fontSize: 14 borderWidth: 1
iconUrl: "/icons/share.svg" text: qsTr("Advanced")
onClicked:
{
rsApi.request(
"/peers/self/certificate/", "",
function(par)
{
var radix = JSON.parse(par.response).data.cert_string
var name = mainWindow.user_name
ClipboardWrapper.postToClipBoard(radix)
linkCopiedPopup.itemName = name }
linkCopiedPopup.open()
}) Row
{
id: plainCertificateRow
anchors.horizontalCenter: parent.horizontalCenter
spacing: 5
visible: false
ButtonIcon
{
height: infoIconHeight
anchors.verticalCenter: btPlainCert.verticalCenter
width: height
imgUrl: "/icons/info.svg"
onClicked:
{
tooltipSpace.show(qsTr("This will copy your RetroShare plain certificate.<br>"+
"Add it manually to your friend client."))
}
} }
ButtonText
{
id: btPlainCert
text: qsTr("Export own plain certificate")
fontSize: 14
onClicked:
{
rsApi.request(
"/peers/self/certificate/", "",
function(par)
{
var radix = JSON.parse(par.response).data.cert_string
var name = mainWindow.user_name
ClipboardWrapper.postToClipBoard(radix)
linkCopiedPopup.itemName = name
linkCopiedPopup.open()
})
}
}
}
}
Rectangle
{
id: tooltipSpace
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
ToolTip
{
id: infoTooltip
timeout: 5000
Component.onCompleted: show("afafsaf",0)
}
function show (infoText)
{
infoTooltip.text = infoText
infoTooltip.open()
} }
} }

View File

@ -109,7 +109,7 @@ Item
ButtonText ButtonText
{ {
id: bottomButton id: bottomButton
text: qsTr("Add Trusted Node") text: qsTr("Add/Share Trusted Node")
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
onClicked: stackView.push("qrc:/AddTrustedNode.qml") onClicked: stackView.push("qrc:/AddTrustedNode.qml")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter

View File

@ -194,6 +194,26 @@ Drawer
ClipboardWrapper.getFromClipBoard(), ClipboardWrapper.getFromClipBoard(),
handleIntentUri); handleIntentUri);
}, },
"Share identity": function()
{
rsApi.request(
"/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)
var nodeUrl = (
"retroshare://certificate?" +
"name=" + encodedName +
"&radix=" + UriJs.URI.encode(radix) +
"&location=" + encodedName )
ClipboardWrapper.postToClipBoard(nodeUrl)
linkCopiedPopup.itemName = name
linkCopiedPopup.open()
platformGW.shareUrl(nodeUrl);
})
},
"Terminate Core": function() "Terminate Core": function()
{ {
rsApi.request("/control/shutdown"); rsApi.request("/control/shutdown");
@ -219,6 +239,12 @@ Drawer
icon: "/icons/add.svg" icon: "/icons/add.svg"
} }
ListElement ListElement
{
title: "Share identity"
showOnCoreReady: true
icon: "/icons/share.svg"
}
ListElement
{ {
title: "Terminate Core" title: "Terminate Core"
showOnOsAndroid: false showOnOsAndroid: false

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="48"
viewBox="0 0 48 48"
width="48"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="info.svg">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="706"
id="namedview8"
showgrid="false"
inkscape:zoom="4.9166667"
inkscape:cx="-8.7457627"
inkscape:cy="24.828087"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<path
d="M0 0h48v48h-48z"
fill="none"
id="path4" />
<path
d="M 24,-0.06779661 C 10.702542,-0.06779661 -0.06779661,10.702542 -0.06779661,24 -0.06779661,37.297458 10.702542,48.067797 24,48.067797 37.297458,48.067797 48.067797,37.297458 48.067797,24 48.067797,10.702542 37.297458,-0.06779661 24,-0.06779661 Z m 2.40678,36.10169461 -4.81356,0 0,-14.440678 4.81356,0 0,14.440678 z m 0,-19.254237 -4.81356,0 0,-4.813559 4.81356,0 0,4.813559 z"
id="path6"
style="fill:#039bd5;fill-opacity:1;stroke:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -63,5 +63,6 @@
<file>icons/paste.svg</file> <file>icons/paste.svg</file>
<file>icons/share.svg</file> <file>icons/share.svg</file>
<file>icons/chat-bubble.svg</file> <file>icons/chat-bubble.svg</file>
<file>icons/info.svg</file>
</qresource> </qresource>
</RCC> </RCC>