save wallet name in appwindow

This commit is contained in:
Jaquee 2017-01-03 21:54:40 +01:00
parent 842e4df223
commit 8f56e98397
No known key found for this signature in database
GPG Key ID: 384E52B09F45DC39
2 changed files with 11 additions and 11 deletions

View File

@ -52,13 +52,6 @@ Window {
show() show()
} }
function usefulName(path) {
// arbitrary "short enough" limit
if (path.length < 32)
return path
return path.replace(/.*[\/\\]/, '').replace(/\.keys$/, '')
}
// TODO: implement without hardcoding sizes // TODO: implement without hardcoding sizes
width: 480 width: 480
height: walletName ? 240 : 200 height: walletName ? 240 : 200
@ -74,7 +67,7 @@ Window {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Label { Label {
text: root.walletName.length > 0 ? qsTr("Please enter wallet password for:<br>") + usefulName(root.walletName) : qsTr("Please enter wallet password") text: root.walletName.length > 0 ? qsTr("Please enter wallet password for:<br>") + root.walletName : qsTr("Please enter wallet password")
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -252,12 +252,20 @@ ApplicationWindow {
return wallet_path; return wallet_path;
} }
function usefulName(path) {
// arbitrary "short enough" limit
if (path.length < 32)
return path
return path.replace(/.*[\/\\]/, '').replace(/\.keys$/, '')
}
function onWalletConnectionStatusChanged(){ function onWalletConnectionStatusChanged(){
console.log("Wallet connection status changed") console.log("Wallet connection status changed")
middlePanel.updateStatus(); middlePanel.updateStatus();
} }
function onWalletOpened(wallet) { function onWalletOpened(wallet) {
walletName = usefulName(wallet.path)
console.log(">>> wallet opened: " + wallet) console.log(">>> wallet opened: " + wallet)
if (wallet.status !== Wallet.Status_Ok) { if (wallet.status !== Wallet.Status_Ok) {
if (appWindow.password === '') { if (appWindow.password === '') {
@ -265,7 +273,7 @@ ApplicationWindow {
console.log("closing wallet async : " + wallet.address) console.log("closing wallet async : " + wallet.address)
closeWallet(); closeWallet();
// try to open wallet with password; // try to open wallet with password;
passwordDialog.open(wallet.path); passwordDialog.open(walletName);
} else { } else {
// opening with password but password doesn't match // opening with password but password doesn't match
console.error("Error opening wallet with password: ", wallet.errorString); console.error("Error opening wallet with password: ", wallet.errorString);
@ -277,7 +285,7 @@ ApplicationWindow {
closeWallet(); closeWallet();
informationPopup.open() informationPopup.open()
informationPopup.onCloseCallback = function() { informationPopup.onCloseCallback = function() {
passwordDialog.open(wallet.path) passwordDialog.open(walletName)
} }
} }
return; return;
@ -674,7 +682,6 @@ ApplicationWindow {
rootItem.state = "wizard" rootItem.state = "wizard"
} }
objectName: "appWindow" objectName: "appWindow"
visible: true visible: true
width: rightPanelExpanded ? 1269 : 1269 - 300 width: rightPanelExpanded ? 1269 : 1269 - 300