Jonathan Rainville 33a77ab761 fix(CommunityTransfer): fix private key display to match design
Fixes #2419

Makes it so the private key is elided by default so you can see it all from the get-go. If you focus the field, the key will "unfurl" and you can copy it manually.
Otherwise. the Copy button will always copy the whole key
2021-04-30 13:09:19 -04:00

78 lines
2.0 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.13
import QtQuick.Dialogs 1.3
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
ModalPopup {
property string privateKey
id: popup
height: 504
title: qsTr("Transfer ownership")
onClosed: {
popup.destroy();
}
Item {
anchors.fill: parent
Input {
property string elidedPkey: popup.privateKey.substring(0, 15) + "..." + popup.privateKey.substring(popup.privateKey.length - 16)
id: pKeyInput
label: qsTr("Community private key")
text: elidedPkey
textField.onFocusChanged: {
if (textField.focus) {
pKeyInput.text = popup.privateKey
} else {
pKeyInput.text = elidedPkey
}
}
copyToClipboard: true
textToCopy: popup.privateKey
}
StyledText {
id: infoText1
text: qsTr("You should keep it safe and only share it with people you trust to take ownership of your community")
anchors.top: pKeyInput.bottom
wrapMode: Text.WordWrap
anchors.topMargin: Style.current.padding
width: parent.width
font.pixelSize: 13
color: Style.current.secondaryText
}
StyledText {
id: infoText2
text: qsTr("You can also use this key to import your community on another device")
anchors.top: infoText1.bottom
wrapMode: Text.WordWrap
anchors.topMargin: Style.current.bigPadding
width: parent.width
font.pixelSize: 13
color: Style.current.secondaryText
}
}
footer: StatusRoundButton {
id: btnBack
anchors.left: parent.left
icon.name: "arrow-right"
icon.width: 20
icon.height: 16
rotation: 180
onClicked: {
popup.close()
}
}
}