Skip to content

Commit

Permalink
InputDialog: pre-populate input text
Browse files Browse the repository at this point in the history
  • Loading branch information
selsta committed Dec 9, 2019
1 parent f03ea04 commit 6ce92d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pages/Account.qml
Expand Up @@ -53,12 +53,12 @@ Rectangle {

function renameSubaddressAccountLabel(_index){
inputDialog.labelText = qsTr("Set the label of the selected account:") + translationManager.emptyString;
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(_index, 0);
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddressAccount.setLabel(_index, inputDialog.inputText)
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(_index, 0);
}

Clipboard { id: clipboard }
Expand Down Expand Up @@ -354,7 +354,6 @@ Rectangle {
text: qsTr("Create new account") + translationManager.emptyString;
onClicked: {
inputDialog.labelText = qsTr("Set the label of the new account:") + translationManager.emptyString
inputDialog.inputText = qsTr("(Untitled)") + translationManager.emptyString
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddressAccount.addRow(inputDialog.inputText)
appWindow.currentWallet.switchSubaddressAccount(appWindow.currentWallet.numSubaddressAccounts() - 1)
Expand Down
6 changes: 3 additions & 3 deletions pages/History.qml
Expand Up @@ -477,7 +477,6 @@ Rectangle {
return;

inputDialog.labelText = qsTr("Jump to page (1-%1)").arg(pages) + translationManager.emptyString;
inputDialog.inputText = "1";
inputDialog.onAcceptedCallback = function() {
var pageNumber = parseInt(inputDialog.inputText);
if (!isNaN(pageNumber) && pageNumber >= 1 && pageNumber <= pages) {
Expand Down Expand Up @@ -1195,7 +1194,7 @@ Rectangle {
if(res[i].state === 'copyable' && res[i].parent.hasOwnProperty('text')) toClipboard(res[i].parent.text);
if(res[i].state === 'copyable_address') root.toClipboard(address);
if(res[i].state === 'copyable_txkey') root.getTxKey(hash, res[i]);
if(res[i].state === 'set_tx_note') root.editDescription(hash);
if(res[i].state === 'set_tx_note') root.editDescription(hash, tx_note);
if(res[i].state === 'details') root.showTxDetails(hash, paymentId, destinations, subaddrAccount, subaddrIndex, dateTime, displayAmount, isout);
if(res[i].state === 'proof') root.showTxProof(hash, paymentId, destinations, subaddrAccount, subaddrIndex);
doCollapse = false;
Expand Down Expand Up @@ -1533,7 +1532,7 @@ Rectangle {
root.updateFilter();
}

function editDescription(_hash){
function editDescription(_hash, _tx_note){
inputDialog.labelText = qsTr("Set description:") + translationManager.emptyString;
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.setUserNote(_hash, inputDialog.inputText);
Expand All @@ -1542,6 +1541,7 @@ Rectangle {
}
inputDialog.onRejectedCallback = null;
inputDialog.open();
inputDialog.inputText = _tx_note;
}

function paginationPrevClicked(){
Expand Down
3 changes: 1 addition & 2 deletions pages/Receive.qml
Expand Up @@ -53,12 +53,12 @@ Rectangle {

function renameSubaddressLabel(_index){
inputDialog.labelText = qsTr("Set the label of the selected address:") + translationManager.emptyString;
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index);
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, _index, inputDialog.inputText);
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index);
}

Clipboard { id: clipboard }
Expand Down Expand Up @@ -254,7 +254,6 @@ Rectangle {
text: qsTr("Create new address") + translationManager.emptyString;
onClicked: {
inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
inputDialog.inputText = qsTr("(Untitled)") + translationManager.emptyString
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
Expand Down
2 changes: 1 addition & 1 deletion pages/settings/SettingsInfo.qml
Expand Up @@ -178,7 +178,6 @@ Rectangle {
text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" <a href='#'> (Click to change)</a>") + translationManager.emptyString
onLinkActivated: {
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;
if (inputDialog.inputText) {
Expand Down Expand Up @@ -225,6 +224,7 @@ Rectangle {
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
inputDialog.inputText = currentWallet ? currentWallet.walletCreationHeight : "0";
}

MouseArea {
Expand Down

0 comments on commit 6ce92d4

Please sign in to comment.