diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2019-03-21 16:11:08 -0400 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2019-03-21 16:11:08 -0400 |
| commit | 3b791035bfefe0288b6e69147061075a0d5d309b (patch) | |
| tree | 617b10efcfa6a09c46b57ffc274a22d3298f5a4d | |
| parent | c47fed96b0a11ad29b95412eab5cd8bb10be92e5 (diff) | |
| parent | dc5028f019330c22f005bf57d3574d450067de41 (diff) | |
| download | monzero-gui-3b791035bfefe0288b6e69147061075a0d5d309b.tar.gz monzero-gui-3b791035bfefe0288b6e69147061075a0d5d309b.tar.xz monzero-gui-3b791035bfefe0288b6e69147061075a0d5d309b.zip | |
Merge pull request #1976
dc5028f SettingsInfo: allow a date for restore height (selsta)
| -rw-r--r-- | pages/settings/SettingsInfo.qml | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pages/settings/SettingsInfo.qml b/pages/settings/SettingsInfo.qml index e8f1b08a..4e98463a 100644 --- a/pages/settings/SettingsInfo.qml +++ b/pages/settings/SettingsInfo.qml @@ -31,6 +31,7 @@ import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.2 +import "../../js/Wizard.js" as Wizard import "../../version.js" as Version import "../../components" as MoneroComponents @@ -172,10 +173,19 @@ Rectangle { property var style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>" text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" <a href='#'> (Click to change)</a>") + translationManager.emptyString onLinkActivated: { - inputDialog.labelText = qsTr("Set a new restore height:") + translationManager.emptyString; + inputDialog.labelText = qsTr("Set a new restore height.\nYou can enter a block height or a date (YYYY-MM-DD):") + translationManager.emptyString; inputDialog.inputText = currentWallet ? currentWallet.walletCreationHeight : "0"; inputDialog.onAcceptedCallback = function() { - var _restoreHeight = parseInt(inputDialog.inputText); + var _restoreHeight; + if (inputDialog.inputText) { + var restoreHeightText = inputDialog.inputText; + // Parse date string or restore height as integer + if(restoreHeightText.indexOf('-') === 4 && restoreHeightText.length === 10) { + _restoreHeight = Wizard.getApproximateBlockchainHeight(restoreHeightText); + } else { + _restoreHeight = parseInt(restoreHeightText) + } + } if (!isNaN(_restoreHeight)) { if(_restoreHeight >= 0) { currentWallet.walletCreationHeight = _restoreHeight @@ -206,7 +216,7 @@ Rectangle { } } - appWindow.showStatusMessage(qsTr("Invalid restore height specified. Must be a number."),3); + appWindow.showStatusMessage(qsTr("Invalid restore height specified. Must be a number or a date formatted YYYY-MM-DD"),3); } inputDialog.onRejectedCallback = null; inputDialog.open() |
