2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
2022-10-04 12:00:50 +02:00
|
|
|
|
|
|
|
|
import org.electrum 1.0
|
|
|
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
|
|
|
|
|
|
WizardComponent {
|
|
|
|
|
id: root
|
2023-04-29 13:45:28 +02:00
|
|
|
securePage: true
|
2022-10-04 12:00:50 +02:00
|
|
|
|
|
|
|
|
valid: false
|
|
|
|
|
|
2022-10-24 13:04:46 +02:00
|
|
|
function apply() {
|
2022-10-04 12:00:50 +02:00
|
|
|
if (bitcoin.isAddressList(import_ta.text)) {
|
|
|
|
|
wizard_data['address_list'] = import_ta.text
|
|
|
|
|
} else if (bitcoin.isPrivateKeyList(import_ta.text)) {
|
|
|
|
|
wizard_data['private_key_list'] = import_ta.text
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function verify(text) {
|
|
|
|
|
return bitcoin.isAddressList(text) || bitcoin.isPrivateKeyList(text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
width: parent.width
|
2023-11-15 18:28:44 +01:00
|
|
|
height: parent.height
|
2026-02-20 13:36:08 +01:00
|
|
|
|
2022-10-04 12:00:50 +02:00
|
|
|
InfoTextArea {
|
2022-11-04 15:59:27 +01:00
|
|
|
Layout.preferredWidth: parent.width
|
2026-02-20 13:36:08 +01:00
|
|
|
backgroundColor: constants.darkerDialogBackground
|
2022-10-04 12:00:50 +02:00
|
|
|
text: qsTr('Enter a list of Bitcoin addresses (this will create a watching-only wallet), or a list of private keys.')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
2023-03-06 18:05:54 +01:00
|
|
|
Layout.topMargin: constants.paddingMedium
|
2023-11-15 18:28:44 +01:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
|
|
ElTextArea {
|
2022-10-04 12:00:50 +02:00
|
|
|
id: import_ta
|
|
|
|
|
Layout.fillWidth: true
|
2023-11-15 18:28:44 +01:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
font.family: FixedFont
|
2022-10-04 12:00:50 +02:00
|
|
|
wrapMode: TextEdit.WrapAnywhere
|
|
|
|
|
onTextChanged: valid = verify(text)
|
2023-04-29 13:42:10 +02:00
|
|
|
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
|
2023-11-15 18:28:44 +01:00
|
|
|
background: PaneInsetBackground {
|
|
|
|
|
baseColor: constants.darkerDialogBackground
|
|
|
|
|
}
|
2022-10-04 12:00:50 +02:00
|
|
|
}
|
2023-11-15 18:28:44 +01:00
|
|
|
|
2022-10-04 12:00:50 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../../icons/paste.png'
|
|
|
|
|
icon.height: constants.iconSizeMedium
|
|
|
|
|
icon.width: constants.iconSizeMedium
|
|
|
|
|
onClicked: {
|
|
|
|
|
if (verify(AppController.clipboardToText())) {
|
|
|
|
|
if (import_ta.text != '')
|
|
|
|
|
import_ta.text = import_ta.text + '\n'
|
|
|
|
|
import_ta.text = import_ta.text + AppController.clipboardToText()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../../icons/qrcode.png'
|
|
|
|
|
icon.height: constants.iconSizeMedium
|
|
|
|
|
icon.width: constants.iconSizeMedium
|
|
|
|
|
onClicked: {
|
2023-04-24 13:34:05 +02:00
|
|
|
var dialog = app.scanDialog.createObject(app, {
|
|
|
|
|
hint: bitcoin.isAddressList(import_ta.text)
|
|
|
|
|
? qsTr('Scan another address')
|
|
|
|
|
: bitcoin.isPrivateKeyList(import_ta.text)
|
|
|
|
|
? qsTr('Scan another private key')
|
|
|
|
|
: qsTr('Scan a private key or an address')
|
|
|
|
|
})
|
2025-07-22 14:18:43 +02:00
|
|
|
dialog.onFoundText.connect(function(data) {
|
|
|
|
|
if (verify(data)) {
|
2022-10-04 12:00:50 +02:00
|
|
|
if (import_ta.text != '')
|
2023-11-24 20:48:04 +00:00
|
|
|
import_ta.text = import_ta.text + '\n'
|
2025-07-22 14:18:43 +02:00
|
|
|
import_ta.text = import_ta.text + data
|
2022-10-04 12:00:50 +02:00
|
|
|
}
|
2023-04-24 13:34:05 +02:00
|
|
|
dialog.close()
|
2022-10-04 12:00:50 +02:00
|
|
|
})
|
2023-04-24 13:34:05 +02:00
|
|
|
dialog.open()
|
2022-10-04 12:00:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bitcoin {
|
|
|
|
|
id: bitcoin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|