diff --git a/components/PasswordDialog.qml b/components/PasswordDialog.qml
new file mode 100644
index 00000000..9c36e13c
--- /dev/null
+++ b/components/PasswordDialog.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
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
diff --git a/monero-core.pro b/monero-core.pro
index c247a802..9520cd37 100644
--- a/monero-core.pro
+++ b/monero-core.pro
@@ -155,6 +155,8 @@ langrel.CONFIG += no_link
QMAKE_EXTRA_TARGETS += langupd deploy deploy_win
QMAKE_EXTRA_COMPILERS += langrel
+
+
PRE_TARGETDEPS += langupd compiler_langrel_make_all
RESOURCES += qml.qrc
@@ -180,7 +182,8 @@ OTHER_FILES += \
$$TRANSLATIONS
DISTFILES += \
- notes.txt
+ notes.txt \
+ components/PasswordDialog.qml
# windows application icon
RC_FILE = monero-core.rc
diff --git a/qml.qrc b/qml.qrc
index eca9f561..dcf4b9b1 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -114,5 +114,6 @@
pages/Receive.qml
components/IconButton.qml
lang/flags/italy.png
+ components/PasswordDialog.qml
diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml
index f0556efc..488bd959 100644
--- a/wizard/WizardMain.qml
+++ b/wizard/WizardMain.qml
@@ -78,24 +78,6 @@ Rectangle {
}
}
- // TODO: remove it
- function handlePageChanged() {
-
-// switch (pages[currentPage]) {
-//// case finishPage:
-//// // display settings summary
-//// finishPage.updateSettingsSummary();
-//// nextButton.visible = false;
-//// break;
-// case recoveryWalletPage:
-// // disable "next button" until 25 words private key entered
-// nextButton.enabled = false
-// break
-// default:
-// nextButton.enabled = true
-
-// }
- }
function openCreateWalletPage() {
@@ -126,10 +108,9 @@ Rectangle {
//! actually writes the wallet
function applySettings() {
- print ("Here we apply the settings");
+ console.log("Here we apply the settings");
// here we need to actually move wallet to the new location
- // put wallet files to the subdirectory with the same name as
- // wallet name
+
var new_wallet_filename = settings.wallet_path + "/"
+ settings.account_name + "/"
+ settings.account_name;
@@ -138,9 +119,12 @@ Rectangle {
if (new_wallet_filename !== settings.wallet_filename) {
// using previously saved wallet;
settings.wallet.store(new_wallet_filename);
- //walletManager.moveWallet(settingsObject.wallet_filename, new_wallet_filename);
}
+ // protecting wallet with password
+ console.log("Protecting wallet with password: " + settings.wallet_password)
+ settings.wallet.setPassword(settings.wallet_password);
+
// saving wallet_filename;
settings['wallet_filename'] = new_wallet_filename;
@@ -163,17 +147,6 @@ Rectangle {
}
-// Settings {
-// id: persistentSettings
-
-// property string language
-// property string account_name
-// property string wallet_path
-// property bool auto_donations_enabled : true
-// property int auto_donations_amount : 50
-// property bool allow_background_mining : true
-// }
-
Rectangle {
id: nextButton
anchors.verticalCenter: parent.verticalCenter