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 int infoIconHeight: 20
Column
{
anchors.fill: parent
@ -62,51 +64,70 @@ Item
}
}
}
ButtonText
Row
{
id: importButton
text: qsTr("Import trusted node")
anchors.horizontalCenter: parent.horizontalCenter
iconUrl: "/icons/paste.svg"
fontSize: 14
spacing: 5
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
rsApi.request(
"/peers/examine_cert/",
JSON.stringify({cert_string: cptext}),
function(par)
{
console.log("/peers/examine_cert/ CB",
par.response)
var resp = JSON.parse(par.response)
if(resp.returncode === "fail")
}
}
ButtonText
{
id: importButton
text: qsTr("Import trusted node")
// anchors.horizontalCenter: parent.horizontalCenter
iconUrl: "/icons/paste.svg"
fontSize: 14
onClicked:
{
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
importErrorPop.open()
return
}
console.log("/peers/examine_cert/ CB",
par.response)
var resp = JSON.parse(par.response)
if(resp.returncode === "fail")
{
importErrorPop.text = resp.debug_msg
importErrorPop.open()
return
}
var jData = resp.data
stackView.push(
"qrc:/TrustedNodeDetails.qml",
{
nodeCert: cptext,
pgpName: jData.name,
pgpId: jData.pgp_id,
locationName: jData.location,
sslIdTxt: jData.peer_id
}
)
}
)
var jData = resp.data
stackView.push(
"qrc:/TrustedNodeDetails.qml",
{
nodeCert: cptext,
pgpName: jData.name,
pgpId: jData.pgp_id,
locationName: jData.location,
sslIdTxt: jData.peer_id
}
)
}
)
}
}
}
@ -139,55 +160,120 @@ Item
}
}
ButtonText
Row
{
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Export own certificate link")
iconUrl: "/icons/share.svg"
fontSize: 14
onClicked:
spacing: 5
ButtonIcon
{
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);
})
height: infoIconHeight
anchors.verticalCenter: btRsCert.verticalCenter
width: height
imgUrl: "/icons/info.svg"
onClicked:
{
tooltipSpace.show(qsTr("Share your RetroShare link! <br>"+
"Send it to a friend and start talk!"))
}
}
ButtonText
{
id: btRsCert
// anchors.horizontalCenter: parent.horizontalCenter
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
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)
spacing: 5
visible: false
linkCopiedPopup.itemName = name
linkCopiedPopup.open()
})
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
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()
}
}