Browse Source

Include Send Tab during labels update

pull/45/head
adityapk00 5 years ago
parent
commit
318ffe24a7
  1. 3
      src/mainwindow.cpp
  2. 1
      src/mainwindow.h
  3. 17
      src/rpc.cpp
  4. 25
      src/sendtab.cpp

3
src/mainwindow.cpp

@ -1397,6 +1397,9 @@ void MainWindow::updateLabels() {
addZAddrsToComboList(ui->rdioZSAddr->isChecked())(true);
}
// Update the Send Tab
updateFromCombo();
// Update the autocomplete
updateLabelsAutoComplete();
}

1
src/mainwindow.h

@ -52,6 +52,7 @@ public:
void updateLabels();
void updateTAddrCombo(bool checked);
void updateFromCombo();
Ui::MainWindow* ui;

17
src/rpc.cpp

@ -708,21 +708,8 @@ void RPC::updateUI(bool anyUnconfirmed) {
// Update balances model data, which will update the table too
balancesTableModel->setNewData(allBalances, utxos);
// Add all the addresses into the inputs combo box
auto lastFromAddr = ui->inputsCombo->currentText();
ui->inputsCombo->clear();
auto i = allBalances->constBegin();
while (i != allBalances->constEnd()) {
ui->inputsCombo->addItem(i.key(), i.value());
if (i.key() == lastFromAddr) ui->inputsCombo->setCurrentText(i.key());
++i;
}
if (lastFromAddr.isEmpty()) {
main->setDefaultPayFrom();
}
// Update from address
main->updateFromCombo();
};
// Function to process reply of the listunspent and z_listunspent API calls, used below.

25
src/sendtab.cpp

@ -159,6 +159,31 @@ void MainWindow::setDefaultPayFrom() {
}
};
void MainWindow::updateFromCombo() {
if (!rpc || !rpc->getAllBalances())
return;
auto lastFromAddr = ui->inputsCombo->currentText();
ui->inputsCombo->clear();
auto i = rpc->getAllBalances()->constBegin();
// Add all the addresses into the inputs combo box
while (i != rpc->getAllBalances()->constEnd()) {
ui->inputsCombo->addItem(i.key(), i.value());
if (i.key() == lastFromAddr) ui->inputsCombo->setCurrentText(i.key());
++i;
}
if (lastFromAddr.isEmpty()) {
setDefaultPayFrom();
}
else {
ui->inputsCombo->setCurrentText(lastFromAddr);
}
}
void MainWindow::inputComboTextChanged(int index) {
auto addr = ui->inputsCombo->itemText(index);
auto bal = rpc->getAllBalances()->value(addr);

Loading…
Cancel
Save