Subaddresses minimal version: supports default account only

This commit is contained in:
kenshi84
2017-07-04 12:34:09 +09:00
parent 3b069ec049
commit cee0474e37
28 changed files with 934 additions and 56 deletions

View File

@@ -310,8 +310,10 @@ ApplicationWindow {
}
function updateBalance() {
middlePanel.unlockedBalanceText = leftPanel.unlockedBalanceText = middlePanel.state === "Receive" ? qsTr("HIDDEN") : walletManager.displayAmount(currentWallet.unlockedBalance);
middlePanel.balanceText = leftPanel.balanceText = middlePanel.state === "Receive" ? qsTr("HIDDEN") : walletManager.displayAmount(currentWallet.balance);
if (!currentWallet)
return;
middlePanel.unlockedBalanceText = leftPanel.unlockedBalanceText = middlePanel.state === "Receive" ? qsTr("HIDDEN") : walletManager.displayAmount(currentWallet.unlockedBalance(currentWallet.currentSubaddressAccount));
middlePanel.balanceText = leftPanel.balanceText = middlePanel.state === "Receive" ? qsTr("HIDDEN") : walletManager.displayAmount(currentWallet.balance(currentWallet.currentSubaddressAccount));
}
function onWalletConnectionStatusChanged(status){
@@ -329,7 +331,7 @@ ApplicationWindow {
}
// initialize transaction history once wallet is initialized first time;
if (!walletInitialized) {
currentWallet.history.refresh()
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
walletInitialized = true
}
}
@@ -377,7 +379,7 @@ ApplicationWindow {
if(foundNewBlock) {
foundNewBlock = false;
console.log("New block found - updating history")
currentWallet.history.refresh()
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
timeToUnlock = currentWallet.history.minutesToUnlock
leftPanel.minutesToUnlockTxt = (timeToUnlock > 0)? (timeToUnlock == 20)? qsTr("Unlocked balance (waiting for block)") : qsTr("Unlocked balance (~%1 min)").arg(timeToUnlock) : qsTr("Unlocked balance");
}
@@ -453,6 +455,9 @@ ApplicationWindow {
console.log("Saving wallet after first refresh");
currentWallet.store()
isNewWallet = false
// Update History
currentWallet.history.refresh(currentWallet.currentSubaddressAccount);
}
// recovering from seed is finished after first refresh
@@ -463,7 +468,7 @@ ApplicationWindow {
// Update history on every refresh if it's empty
if(currentWallet.history.count == 0)
currentWallet.history.refresh()
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
onWalletUpdate();
}
@@ -526,19 +531,21 @@ ApplicationWindow {
currentWallet.refresh()
console.log("Confirmed money found")
// history refresh is handled by walletUpdated
currentWallet.history.refresh(currentWallet.currentSubaddressAccount) // this will refresh model
currentWallet.subaddress.refresh(currentWallet.currentSubaddressAccount)
}
function onWalletUnconfirmedMoneyReceived(txId, amount) {
// refresh history
console.log("unconfirmed money found")
currentWallet.history.refresh()
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
}
function onWalletMoneySent(txId, amount) {
// refresh transaction history here
console.log("money sent found")
currentWallet.refresh()
currentWallet.history.refresh() // this will refresh model
currentWallet.history.refresh(currentWallet.currentSubaddressAccount) // this will refresh model
}
function walletsFound() {
@@ -584,8 +591,11 @@ ApplicationWindow {
// here we show confirmation popup;
transactionConfirmationPopup.title = qsTr("Confirmation") + translationManager.emptyString
transactionConfirmationPopup.text = qsTr("Please confirm transaction:\n")
+ (address === "" ? "" : (qsTr("\nAddress: ") + address))
transactionConfirmationPopup.text = qsTr("Please confirm transaction:\n");
for (var i = 0; i < transaction.subaddrIndices.length; ++i)
transactionConfirmationPopup.text += qsTr("\nSpending address index: ") + transaction.subaddrIndices[i]
transactionConfirmationPopup.text +=
(address === "" ? "" : (qsTr("\n\nAddress: ") + address))
+ (paymentId === "" ? "" : (qsTr("\nPayment ID: ") + paymentId))
+ qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount)
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee)
@@ -1185,6 +1195,23 @@ ApplicationWindow {
}
}
InputDialog {
id: inputDialog
visible: false
z: parent.z + 1
anchors.fill: parent
property var onAcceptedCallback
property var onRejectedCallback
onAccepted: {
if (onAcceptedCallback)
onAcceptedCallback()
}
onRejected: {
if (onRejectedCallback)
onRejectedCallback()
}
}
DaemonManagerDialog {
id: daemonManagerDialog
onRejected: {