mirror of
https://github.com/monero-project/monero-gui
synced 2024-11-14 15:46:00 +01:00
settings page: daemon change + password prompt on seed view
This commit is contained in:
parent
9700944b7f
commit
2966b0db69
@ -30,6 +30,8 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
|
||||
import "../components"
|
||||
import moneroComponents 1.0
|
||||
@ -37,10 +39,33 @@ import moneroComponents.Clipboard 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
property var daemonAddress
|
||||
|
||||
color: "#F0EEEE"
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
|
||||
function initSettings(){
|
||||
|
||||
|
||||
// Mnemonic seed settings
|
||||
memoTextInput.text = qsTr("Click button to show seed") + translationManager.emptyString
|
||||
showSeedbtn.visible = true
|
||||
|
||||
// Daemon settings
|
||||
daemonAddress = persistentSettings.daemon_address.split(":");
|
||||
console.log("address" + persistentSettings.daemon_address)
|
||||
// try connecting to daemon
|
||||
var connectedToDaemon = currentWallet.connectToDaemon();
|
||||
|
||||
if(!connectedToDaemon){
|
||||
console.log("not connected");
|
||||
//TODO: Print error?
|
||||
//daemonStatusText.text = qsTr("Unable to connect to Daemon.")
|
||||
//daemonStatusText.visible = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
@ -72,7 +97,6 @@ Rectangle {
|
||||
selectByMouse: true
|
||||
height: 300
|
||||
width: 500
|
||||
text: qsTr("Click button to show seed") + translationManager.emptyString
|
||||
}
|
||||
Image {
|
||||
id : clipboardButton
|
||||
@ -101,9 +125,28 @@ Rectangle {
|
||||
pressedColor: "#FF4304"
|
||||
text: qsTr("Show seed")
|
||||
onClicked: {
|
||||
memoTextInput.text = currentWallet.seed
|
||||
settingsPasswordDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
PasswordDialog {
|
||||
id: settingsPasswordDialog
|
||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
||||
onAccepted: {
|
||||
if(appWindow.password == settingsPasswordDialog.password){
|
||||
memoTextInput.text = currentWallet.seed
|
||||
showSeedbtn.visible = false
|
||||
}
|
||||
|
||||
}
|
||||
onRejected: {
|
||||
|
||||
}
|
||||
onDiscard: {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@ -121,11 +164,92 @@ Rectangle {
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("Settings page loaded");
|
||||
}
|
||||
RowLayout {
|
||||
id: daemonAddrRow
|
||||
Label {
|
||||
id: daemonAddrLabel
|
||||
color: "#4A4949"
|
||||
text: qsTr("Daemon adress") + translationManager.emptyString
|
||||
}
|
||||
|
||||
|
||||
LineEdit {
|
||||
id: daemonAddr
|
||||
width: 180
|
||||
text: (daemonAddress != undefined)? daemonAddress[0] : ""
|
||||
placeholderText: qsTr("Hostname / IP")
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: daemonPort
|
||||
width: 150
|
||||
text: (daemonAddress != undefined)? daemonAddress[1] : ""
|
||||
placeholderText: qsTr("Port")
|
||||
}
|
||||
|
||||
|
||||
StandardButton {
|
||||
id: daemonAddrSave
|
||||
anchors.left: daemonPort.right
|
||||
anchors.leftMargin: 30
|
||||
width: 60
|
||||
text: qsTr("Save") + translationManager.emptyString
|
||||
shadowReleasedColor: "#FF4304"
|
||||
shadowPressedColor: "#B32D00"
|
||||
releasedColor: "#FF6C3C"
|
||||
pressedColor: "#FF4304"
|
||||
visible: true
|
||||
onClicked: {
|
||||
console.log("saving daemon adress settings")
|
||||
var newDaemon = daemonAddr.text + ":" + daemonPort.text
|
||||
if(persistentSettings.daemon_address != newDaemon) {
|
||||
persistentSettings.daemon_address = newDaemon
|
||||
//reconnect wallet
|
||||
appWindow.initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: daemonStatusRow
|
||||
Text {
|
||||
id: daemonStatusText
|
||||
font.family: "Arial"
|
||||
font.pixelSize: 18
|
||||
wrapMode: Text.Wrap
|
||||
textFormat: Text.RichText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: "#FF0000"
|
||||
visible: true //!currentWallet.connected
|
||||
}
|
||||
|
||||
// StandardButton {
|
||||
// id: checkConnectionButton
|
||||
// anchors.left: daemonStatusText.right
|
||||
// anchors.leftMargin: 30
|
||||
// width: 90
|
||||
// text: qsTr("Check again") + translationManager.emptyString
|
||||
// shadowReleasedColor: "#FF4304"
|
||||
// shadowPressedColor: "#B32D00"
|
||||
// releasedColor: "#FF6C3C"
|
||||
// pressedColor: "#FF4304"
|
||||
// visible: true
|
||||
// onClicked: {
|
||||
// checkDaemonConnection();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onPageCompleted() {
|
||||
console.log("Settings page loaded");
|
||||
initSettings();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user