Add info tooltip for each option

This commit is contained in:
Angela Mazzurco 2017-07-24 16:25:08 +02:00
parent 89034d2755
commit 731a10a6a5

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,70 @@ 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) // anchors.horizontalCenter: parent.horizontalCenter
{ iconUrl: "/icons/paste.svg"
console.log("/peers/examine_cert/ CB", fontSize: 14
par.response)
var resp = JSON.parse(par.response) onClicked:
if(resp.returncode === "fail") {
var cptext = ClipboardWrapper.getFromClipBoard()
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 +160,120 @@ 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() // anchors.horizontalCenter: parent.horizontalCenter
platformGW.shareUrl(nodeUrl); text: qsTr("Export own certificate link")
}) iconUrl: "/icons/share.svg"
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 Row
{ {
id: plainCertificateRow
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Export own plain certificate") spacing: 5
fontSize: 14 visible: false
iconUrl: "/icons/share.svg"
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 ButtonIcon
linkCopiedPopup.open() {
}) 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
iconUrl: "/icons/share.svg"
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()
} }
} }