mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 13:54:27 -04:00
Qml app: fixed import/export of plain certificate
Added TimedPopup that is a common use case so it is reusable without code duplication
This commit is contained in:
parent
39646f32f0
commit
0b82b73131
3 changed files with 72 additions and 7 deletions
|
@ -80,12 +80,21 @@ Item
|
||||||
JSON.stringify({cert_string: cptext}),
|
JSON.stringify({cert_string: cptext}),
|
||||||
function(par)
|
function(par)
|
||||||
{
|
{
|
||||||
console.log("/peers/examine_cert/ CB", par)
|
console.log("/peers/examine_cert/ CB",
|
||||||
var jData = JSON.parse(par.response).data
|
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(
|
stackView.push(
|
||||||
"qrc:/TrustedNodeDetails.qml",
|
"qrc:/TrustedNodeDetails.qml",
|
||||||
{
|
{
|
||||||
nodeCert: otherKeyField.text,
|
nodeCert: cptext,
|
||||||
pgpName: jData.name,
|
pgpName: jData.name,
|
||||||
pgpId: jData.pgp_id,
|
pgpId: jData.pgp_id,
|
||||||
locationName: jData.location,
|
locationName: jData.location,
|
||||||
|
@ -106,12 +115,26 @@ Item
|
||||||
"/peers/self/certificate/", "",
|
"/peers/self/certificate/", "",
|
||||||
function(par)
|
function(par)
|
||||||
{
|
{
|
||||||
var jD = JSON.parse(par.response).data
|
var radix = JSON.parse(par.response).data.cert_string
|
||||||
ClipboardWrapper.postToClipBoard(jD.cert_string)
|
var name = mainWindow.user_name
|
||||||
mainWindow.linkCopiedPopup.itemName=mainWindow.user_name
|
ClipboardWrapper.postToClipBoard(radix)
|
||||||
mainWindow.linkCopiedPopup.open()
|
|
||||||
|
linkCopiedPopup.itemName = name
|
||||||
|
linkCopiedPopup.open()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimedPopup
|
||||||
|
{
|
||||||
|
id: importErrorPop
|
||||||
|
property alias text: popText.text
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: popText
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
41
retroshare-qml-app/src/TimedPopup.qml
Normal file
41
retroshare-qml-app/src/TimedPopup.qml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* RetroShare Android QML App
|
||||||
|
* Copyright (C) 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
|
Popup
|
||||||
|
{
|
||||||
|
property alias duration: timer.interval
|
||||||
|
|
||||||
|
|
||||||
|
id: popupRoot
|
||||||
|
visible: false
|
||||||
|
onVisibleChanged: if(visible) timer.start()
|
||||||
|
x: parent.x + parent.width/2 - width/2
|
||||||
|
y: parent.y + parent.height/2 - height/2
|
||||||
|
|
||||||
|
|
||||||
|
Timer
|
||||||
|
{
|
||||||
|
id: timer
|
||||||
|
interval: 1500
|
||||||
|
onTriggered: popupRoot.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,5 +28,6 @@
|
||||||
<file>ColorHash.qml</file>
|
<file>ColorHash.qml</file>
|
||||||
<file>icons/rating-unrated.png</file>
|
<file>icons/rating-unrated.png</file>
|
||||||
<file>icons/rating.png</file>
|
<file>icons/rating.png</file>
|
||||||
|
<file>TimedPopup.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue