diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2021-07-06 11:43:09 -0400 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2021-07-06 11:43:09 -0400 |
| commit | 0b0bc871841ad5cd3b810a4293cbc190e7c417db (patch) | |
| tree | 274d8afe55eaa89eb9dd18c0d7de50889bc7cdb5 | |
| parent | 59fcda43c6fc3c83828b44f8a1086422f351faa5 (diff) | |
| parent | f75a2447a753aa8a3117dcea042589e41bd7b8d4 (diff) | |
| download | monzero-gui-0b0bc871841ad5cd3b810a4293cbc190e7c417db.tar.gz monzero-gui-0b0bc871841ad5cd3b810a4293cbc190e7c417db.tar.xz monzero-gui-0b0bc871841ad5cd3b810a4293cbc190e7c417db.zip | |
Merge pull request #3544
f75a244 Wizard: set unused wallet name (selsta)
| -rw-r--r-- | js/Wizard.js | 11 | ||||
| -rw-r--r-- | wizard/WizardWalletInput.qml | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/js/Wizard.js b/js/Wizard.js index 61ac105d..76b41864 100644 --- a/js/Wizard.js +++ b/js/Wizard.js @@ -82,6 +82,17 @@ function walletPathExists(accountsDir, directory, filename, isIOS, walletManager return false; } +function unusedWalletName(directory, filename, walletManager) { + for (var i = 0; i < 100; i++) { + var walletName = filename + (i > 0 ? "_" + i : ""); + if (!walletManager.walletExists(directory + "/" + walletName + "/" + walletName)) { + return walletName; + } + } + + return filename; +} + function isAscii(str){ for (var i = 0; i < str.length; i++) { if (str.charCodeAt(i) > 127) diff --git a/wizard/WizardWalletInput.qml b/wizard/WizardWalletInput.qml index 024f2eb4..5f86295c 100644 --- a/wizard/WizardWalletInput.qml +++ b/wizard/WizardWalletInput.qml @@ -57,7 +57,7 @@ GridLayout { walletName.error = !walletName.verify(); walletLocation.error = walletLocation.text === ""; walletLocation.text = appWindow.accountsDir; - walletName.text = defaultAccountName; + walletName.text = Wizard.unusedWalletName(appWindow.accountsDir, defaultAccountName, walletManager); } MoneroComponents.LineEdit { |
