aboutsummaryrefslogtreecommitdiff
path: root/main.qml
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-08-16 23:21:46 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-08-16 23:21:46 +0300
commit6f1343aaa04bf2e4f959b5d3201239fe7fc85398 (patch)
tree2ecbb789a6b40d88f492221e92620c9b75fccc37 /main.qml
parentfc7a7ddf25d0a3cd7c7e6b7d07897435e1a2a43e (diff)
downloadmonzero-gui-6f1343aaa04bf2e4f959b5d3201239fe7fc85398.tar.gz
monzero-gui-6f1343aaa04bf2e4f959b5d3201239fe7fc85398.tar.xz
monzero-gui-6f1343aaa04bf2e4f959b5d3201239fe7fc85398.zip
ask user for the password if wallet is password-protected
Diffstat (limited to 'main.qml')
-rw-r--r--main.qml40
1 files changed, 33 insertions, 7 deletions
diff --git a/main.qml b/main.qml
index 919d0a8b..7320d3af 100644
--- a/main.qml
+++ b/main.qml
@@ -139,19 +139,18 @@ ApplicationWindow {
if (typeof wizard.settings['wallet'] !== 'undefined') {
wallet = wizard.settings['wallet'];
} else {
- var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
- + persistentSettings.account_name;
+ var wallet_path = walletPath();
+
console.log("opening wallet at: ", wallet_path);
// TODO: wallet password dialog
wallet = walletManager.openWallet(wallet_path, "", persistentSettings.testnet);
if (wallet.status !== Wallet.Status_Ok) {
- console.log("Error opening wallet: ", wallet.errorString);
- informationPopup.title = qsTr("Error") + translationManager.emptyString;
- informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
- informationPopup.icon = StandardIcon.Critical
- informationPopup.open()
+ console.error("Error opening wallet with empty password: ", wallet.errorString);
+
+ // try to open wallet with password;
+ passwordDialog.open();
return;
}
console.log("Wallet opened successfully: ", wallet.errorString);
@@ -165,6 +164,13 @@ ApplicationWindow {
}
+ function walletPath() {
+ var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
+ + persistentSettings.account_name;
+ return wallet_path;
+ }
+
+
function onWalletUpdate() {
console.log(">>> wallet updated")
basicPanel.unlockedBalanceText = leftPanel.unlockedBalanceText = walletManager.displayAmount(wallet.unlockedBalance);
@@ -291,6 +297,7 @@ ApplicationWindow {
// Information dialog
MessageDialog {
id: informationPopup
+
standardButtons: StandardButton.Ok
}
@@ -303,6 +310,25 @@ ApplicationWindow {
}
}
+ PasswordDialog {
+ id: passwordDialog
+ standardButtons: StandardButton.Ok + StandardButton.Cancel
+ onAccepted: {
+
+ var wallet_path = walletPath();
+ console.log("opening wallet with password: ", wallet_path);
+ wallet = walletManager.openWallet(wallet_path, password, persistentSettings.testnet);
+ if (wallet.status !== Wallet.Status_Ok) {
+ console.error("Error opening wallet with password: ", wallet.errorString);
+ informationPopup.title = qsTr("Error") + translationManager.emptyString;
+ informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
+ informationPopup.icon = StandardIcon.Critical
+ informationPopup.open()
+
+ }
+ }
+ }
+
Window {
id: walletInitializationSplash
modality: Qt.ApplicationModal