mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 17:09:34 -05: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
@ -80,12 +80,21 @@ Item
|
||||
JSON.stringify({cert_string: cptext}),
|
||||
function(par)
|
||||
{
|
||||
console.log("/peers/examine_cert/ CB", par)
|
||||
var jData = JSON.parse(par.response).data
|
||||
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: otherKeyField.text,
|
||||
nodeCert: cptext,
|
||||
pgpName: jData.name,
|
||||
pgpId: jData.pgp_id,
|
||||
locationName: jData.location,
|
||||
@ -106,12 +115,26 @@ Item
|
||||
"/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()
|
||||
var radix = JSON.parse(par.response).data.cert_string
|
||||
var name = mainWindow.user_name
|
||||
ClipboardWrapper.postToClipBoard(radix)
|
||||
|
||||
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>icons/rating-unrated.png</file>
|
||||
<file>icons/rating.png</file>
|
||||
<file>TimedPopup.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user