From 0358a1efa55949a78d7641453429fa4bc1b34695 Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Tue, 22 Jan 2019 18:31:33 -0800 Subject: [PATCH 1/3] add execute method to allow autonomous Txns --- .gitignore | 1 + src/mainwindow.cpp | 19 +++++++------ src/rpc.cpp | 66 ++++++++++++++++++++++++++++++---------------- src/rpc.h | 18 ++++++++++--- src/sendtab.cpp | 25 +++++++++++------- src/turnstile.cpp | 24 +++++++++-------- 6 files changed, 99 insertions(+), 54 deletions(-) diff --git a/.gitignore b/.gitignore index ad04c2d..40c5a53 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ release/ x64/ artifacts/ .vscode/ +res/libsodium/libsodium* src/ui_*.h *.autosave src/precompiled.h.cpp diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3ec9b68..49c17d9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -616,17 +616,20 @@ void MainWindow::postToZBoard() { tx.toAddrs.push_back(ToFields{ toAddr, Settings::getZboardAmount(), memo, memo.toUtf8().toHex() }); tx.fee = Settings::getMinerFee(); - json params = json::array(); - rpc->fillTxJsonParams(params, tx); - std::cout << std::setw(2) << params << std::endl; - // And send the Tx - rpc->sendZTransaction(params, [=](const json& reply) { - QString opid = QString::fromStdString(reply.get()); + rpc->executeTransaction(tx, [=] (QString opid) { ui->statusBar->showMessage(tr("Computing Tx: ") % opid); + }, + [=] (QString opid, QString txid) { + ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); + }, + [=] (QString opid, QString errStr) { + ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000); - // And then start monitoring the transaction - rpc->addNewTxToWatch(tx, opid); + if (!opid.isEmpty()) + errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr; + + QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); }); } } diff --git a/src/rpc.cpp b/src/rpc.cpp index 7eab839..1527502 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -213,7 +213,8 @@ void RPC::getTransactions(const std::function& cb) { conn->doRPCWithDefaultErrorHandling(payload, cb); } -void RPC::sendZTransaction(json params, const std::function& cb) { +void RPC::sendZTransaction(json params, const std::function& cb, + const std::function& err) { json payload = { {"jsonrpc", "1.0"}, {"id", "someid"}, @@ -221,7 +222,13 @@ void RPC::sendZTransaction(json params, const std::function& cb) { {"params", params} }; - conn->doRPCWithDefaultErrorHandling(payload, cb); + conn->doRPC(payload, cb, [=] (auto reply, auto parsed) { + if (!parsed.is_discarded() && !parsed["error"]["message"].is_null()) { + err(QString::fromStdString(parsed["error"]["message"])); + } else { + err(reply->errorString()); + } + }); } /** @@ -831,12 +838,36 @@ void RPC::refreshSentZTrans() { ); } -void RPC::addNewTxToWatch(Tx tx, const QString& newOpid) { - watchingOps.insert(newOpid, tx); +void RPC::addNewTxToWatch(const QString& newOpid, WatchedTx wtx) { + watchingOps.insert(newOpid, wtx); watchTxStatus(); } + +// Execute a transaction! +void RPC::executeTransaction(Tx tx, + const std::function submitted, + const std::function computed, + const std::function error) { + // First, create the json params + json params = json::array(); + fillTxJsonParams(params, tx); + std::cout << std::setw(2) << params << std::endl; + + sendZTransaction(params, [=](const json& reply) { + QString opid = QString::fromStdString(reply.get()); + + // And then start monitoring the transaction + addNewTxToWatch( opid, WatchedTx { opid, tx, computed, error} ); + submitted(opid); + }, + [=](QString errStr) { + error("", errStr); + }); +} + + void RPC::watchTxStatus() { if (conn == nullptr) return noConnection(); @@ -856,35 +887,26 @@ void RPC::watchTxStatus() { if (watchingOps.contains(id)) { // And if it ended up successful QString status = QString::fromStdString(it["status"]); + main->loadingLabel->setVisible(false); + if (status == "success") { auto txid = QString::fromStdString(it["result"]["txid"]); - SentTxStore::addToSentTx(watchingOps.value(id), txid); - - main->ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); - main->loadingLabel->setVisible(false); + SentTxStore::addToSentTx(watchingOps[id].tx, txid); + auto wtx = watchingOps[id]; watchingOps.remove(id); + wtx.completed(id, txid); // Refresh balances to show unconfirmed balances - refresh(true); + refresh(true); } else if (status == "failed") { // If it failed, then we'll actually show a warning. auto errorMsg = QString::fromStdString(it["error"]["message"]); - QMessageBox msg( - QMessageBox::Critical, - QObject::tr("Transaction Error"), - QObject::tr("The transaction with id ") % id % QObject::tr(" failed. The error was") + ":\n\n" + errorMsg, - QMessageBox::Ok, - main - ); - - watchingOps.remove(id); - - main->ui->statusBar->showMessage(QObject::tr(" Tx ") % id % QObject::tr(" failed"), 15 * 1000); - main->loadingLabel->setVisible(false); - msg.exec(); + auto wtx = watchingOps[id]; + watchingOps.remove(id); + wtx.error(id, errorMsg); } } diff --git a/src/rpc.h b/src/rpc.h index 3b53fb8..40c0b05 100644 --- a/src/rpc.h +++ b/src/rpc.h @@ -24,6 +24,13 @@ struct TransactionItem { QString memo; }; +struct WatchedTx { + QString opid; + Tx tx; + std::function completed; + std::function error; +}; + class RPC { public: @@ -42,10 +49,15 @@ public: void refreshZECPrice(); void getZboardTopics(std::function)> cb); + void executeTransaction(Tx tx, + const std::function submitted, + const std::function computed, + const std::function error); + void fillTxJsonParams(json& params, Tx tx); - void sendZTransaction (json params, const std::function& cb); + void sendZTransaction(json params, const std::function& cb, const std::function& err); void watchTxStatus(); - void addNewTxToWatch(Tx tx, const QString& newOpid); + void addNewTxToWatch(const QString& newOpid, WatchedTx wtx); const TxTableModel* getTransactionsModel() { return transactionsTableModel; } const QList* getAllZAddresses() { return zaddresses; } @@ -98,7 +110,7 @@ private: QMap* usedAddresses = nullptr; QList* zaddresses = nullptr; - QMap watchingOps; + QMap watchingOps; TxTableModel* transactionsTableModel = nullptr; BalancesTableModel* balancesTableModel = nullptr; diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 5c1364d..d5f51d7 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -620,18 +620,23 @@ void MainWindow::sendButton() { // Show a dialog to confirm the Tx if (confirmTx(tx)) { - json params = json::array(); - rpc->fillTxJsonParams(params, tx); - std::cout << std::setw(2) << params << std::endl; - // And send the Tx - rpc->sendZTransaction(params, [=](const json& reply) { - QString opid = QString::fromStdString(reply.get()); - ui->statusBar->showMessage(tr("Computing Tx: ") % opid); + rpc->executeTransaction(tx, + [=] (QString opid) { + ui->statusBar->showMessage(tr("Computing Tx: ") % opid); + }, + [=] (QString opid, QString txid) { + ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); + }, + [=] (QString opid, QString errStr) { + ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000); - // And then start monitoring the transaction - rpc->addNewTxToWatch(tx, opid); - }); + if (!opid.isEmpty()) + errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr; + + QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); + } + ); } } diff --git a/src/turnstile.cpp b/src/turnstile.cpp index a2e1c2c..a94118d 100644 --- a/src/turnstile.cpp +++ b/src/turnstile.cpp @@ -351,17 +351,19 @@ void Turnstile::executeMigrationStep() { } void Turnstile::doSendTx(Tx tx, std::function cb) { - json params = json::array(); - rpc->fillTxJsonParams(params, tx); - std::cout << std::setw(2) << params << std::endl; - rpc->sendZTransaction(params, [=] (const json& reply) { - QString opid = QString::fromStdString(reply.get()); - //qDebug() << opid; - mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid); + rpc->executeTransaction(tx, [=] (QString opid) { + mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid); + }, + [=] (QString opid, QString txid) { + mainwindow->ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); + }, + [=] (QString opid, QString errStr) { + mainwindow->ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000); - // And then start monitoring the transaction - rpc->addNewTxToWatch(tx, opid); + if (!opid.isEmpty()) + errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr; - cb(); - }); + QMessageBox::critical(mainwindow, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); + }); + } From beb038e82d085b6a0ce61a3172a0874046b4da4d Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Tue, 22 Jan 2019 20:42:26 -0800 Subject: [PATCH 2/3] Recurring Dialogs --- src/mainwindow.ui | 43 +++++--- src/newrecurring.ui | 216 +++++++++++++++++++++++++++++++++++++++++ src/recurring.cpp | 14 +++ src/recurring.h | 22 +++++ src/recurringdialog.ui | 92 ++++++++++++++++++ src/rpc.cpp | 8 +- zec-qt-wallet.pro | 10 +- 7 files changed, 387 insertions(+), 18 deletions(-) create mode 100644 src/newrecurring.ui create mode 100644 src/recurring.cpp create mode 100644 src/recurring.h create mode 100644 src/recurringdialog.ui diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 7e758d1..799fc90 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -22,7 +22,7 @@ - 2 + 1 @@ -346,8 +346,8 @@ 0 0 - 920 - 334 + 928 + 380 @@ -552,13 +552,6 @@ - - - - - - - @@ -572,6 +565,34 @@ + + + + + + + + + + + This transaction does not recur + + + + + + + Setup Recurring Payment + + + + + + + + + + @@ -992,7 +1013,7 @@ 0 0 968 - 22 + 19 diff --git a/src/newrecurring.ui b/src/newrecurring.ui new file mode 100644 index 0000000..d1b70fa --- /dev/null +++ b/src/newrecurring.ui @@ -0,0 +1,216 @@ + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + To + + + + + + + From + + + + + + + Schedule + + + + + + + Number of payments + + + + + + + Amount + + + + + + + Next Payment + + + + + + + TextLabel + + + + + + + Payment Description + + + + + + + + + + + + Every + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Forever + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/recurring.cpp b/src/recurring.cpp new file mode 100644 index 0000000..032794a --- /dev/null +++ b/src/recurring.cpp @@ -0,0 +1,14 @@ +#include "recurring.h" +#include "ui_recurringdialog.h" + +RecurringDialog::RecurringDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::RecurringDialog) +{ + ui->setupUi(this); +} + +RecurringDialog::~RecurringDialog() +{ + delete ui; +} diff --git a/src/recurring.h b/src/recurring.h new file mode 100644 index 0000000..2cc86ae --- /dev/null +++ b/src/recurring.h @@ -0,0 +1,22 @@ +#ifndef RECURRING_H +#define RECURRING_H + +#include + +namespace Ui { +class RecurringDialog; +} + +class RecurringDialog : public QDialog +{ + Q_OBJECT + +public: + explicit RecurringDialog(QWidget *parent = nullptr); + ~RecurringDialog(); + +private: + Ui::RecurringDialog *ui; +}; + +#endif // RECURRING_H diff --git a/src/recurringdialog.ui b/src/recurringdialog.ui new file mode 100644 index 0000000..c957d87 --- /dev/null +++ b/src/recurringdialog.ui @@ -0,0 +1,92 @@ + + + RecurringDialog + + + + 0 + 0 + 601 + 438 + + + + Dialog + + + + + + + + + + + Add + + + + + + + Edit + + + + + + + Delete + + + + + + + Qt::Vertical + + + QDialogButtonBox::Close + + + + + + + + + + + buttonBox + accepted() + RecurringDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + RecurringDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/rpc.cpp b/src/rpc.cpp index 1527502..738e3fa 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -535,6 +535,9 @@ void RPC::getInfoThenRefresh(bool force) { // Something changed, so refresh everything. lastBlock = curBlock; + // See if the turnstile migration has any steps that need to be done. + turnstile->executeMigrationStep(); + refreshBalances(); refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans() refreshTransactions(); @@ -667,10 +670,7 @@ void RPC::refreshAddresses() { } // Function to create the data model and update the views, used below. -void RPC::updateUI(bool anyUnconfirmed) { - // See if the turnstile migration has any steps that need to be done. - turnstile->executeMigrationStep(); - +void RPC::updateUI(bool anyUnconfirmed) { ui->unconfirmedWarning->setVisible(anyUnconfirmed); // Update balances model data, which will update the table too diff --git a/zec-qt-wallet.pro b/zec-qt-wallet.pro index 730c9bd..1d9c835 100644 --- a/zec-qt-wallet.pro +++ b/zec-qt-wallet.pro @@ -51,7 +51,8 @@ SOURCES += \ src/fillediconlabel.cpp \ src/addressbook.cpp \ src/logger.cpp \ - src/addresscombo.cpp + src/addresscombo.cpp \ + src/recurring.cpp HEADERS += \ src/mainwindow.h \ @@ -71,7 +72,8 @@ HEADERS += \ src/fillediconlabel.h \ src/addressbook.h \ src/logger.h \ - src/addresscombo.h + src/addresscombo.h \ + src/recurring.h FORMS += \ src/mainwindow.ui \ @@ -84,7 +86,9 @@ FORMS += \ src/memodialog.ui \ src/connection.ui \ src/zboard.ui \ - src/addressbook.ui + src/addressbook.ui \ + src/recurringdialog.ui \ + src/newrecurring.ui TRANSLATIONS = res/zec_qt_wallet_es.ts \ From ace903807070820d69494c9e2b4796bf8d996c67 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Thu, 24 Jan 2019 15:09:14 -0800 Subject: [PATCH 3/3] Send page checkbox --- src/mainwindow.h | 3 + src/mainwindow.ui | 92 +++++++++----- src/newrecurring.ui | 287 ++++++++++++++++++++++++-------------------- src/recurring.cpp | 56 +++++++-- src/recurring.h | 44 ++++--- src/sendtab.cpp | 30 +++++ 6 files changed, 326 insertions(+), 186 deletions(-) diff --git a/src/mainwindow.h b/src/mainwindow.h index 5b5350e..d37ce6c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -38,6 +38,7 @@ public: ~MainWindow(); void updateLabelsAutoComplete(); + RPC* getRPC() { return rpc; } void setDefaultPayFrom(); @@ -76,6 +77,8 @@ private: void addAddressSection(); void maxAmountChecked(int checked); + void editSchedule(); + void addressChanged(int number, const QString& text); void amountChanged (int number, const QString& text); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 799fc90..e86c960 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -346,8 +346,8 @@ 0 0 - 928 - 380 + 920 + 301 @@ -530,6 +530,50 @@ + + + + + + Recurring payment + + + + + + + Every month, starting 12-May-2012, for 6 payments + + + + + + + Edit Schedule + + + false + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -552,6 +596,20 @@ + + + + + + + + + + + + + + @@ -565,34 +623,6 @@ - - - - - - - - - - - This transaction does not recur - - - - - - - Setup Recurring Payment - - - - - - - - - - @@ -1013,7 +1043,7 @@ 0 0 968 - 19 + 22 diff --git a/src/newrecurring.ui b/src/newrecurring.ui index d1b70fa..f8f8521 100644 --- a/src/newrecurring.ui +++ b/src/newrecurring.ui @@ -1,131 +1,23 @@ - Dialog - + newRecurringDialog + 0 0 - 400 - 300 + 740 + 403 - Dialog + Edit Schedule - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - To - - - - - - - From - - - - - - - Schedule - - - - - - - Number of payments - - - - - - - Amount - - - - - - - Next Payment - - - - - - - TextLabel - - - - - - - Payment Description - - - - - - - + - - - Every - - - - - - - - + @@ -142,18 +34,119 @@ - - + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Schedule + + + + + + + Payment Description + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + + - - - - - - Forever + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + From + + + + + + + Number of payments + + + + + + + Amount + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + @@ -169,21 +162,57 @@ - - - - Qt::Horizontal + + + + Next Payment + + + + + + + + + + To + + + + + + + + + + Memo + + + AddressCombo + QComboBox +
addresscombo.h
+
+
+ + txtDesc + cmbFromAddress + txtToAddr + txtAmt + cmbCurrency + cmbSchedule + txtNumPayments + buttonBox accepted() - Dialog + newRecurringDialog accept() @@ -199,7 +228,7 @@ buttonBox rejected() - Dialog + newRecurringDialog reject() diff --git a/src/recurring.cpp b/src/recurring.cpp index 032794a..64affec 100644 --- a/src/recurring.cpp +++ b/src/recurring.cpp @@ -1,14 +1,48 @@ #include "recurring.h" -#include "ui_recurringdialog.h" -RecurringDialog::RecurringDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::RecurringDialog) -{ - ui->setupUi(this); -} +#include "mainwindow.h" +#include "rpc.h" +#include "settings.h" +#include "ui_newrecurring.h" -RecurringDialog::~RecurringDialog() -{ - delete ui; -} +void Recurring::showEditDialog(QWidget* parent, MainWindow* main, Tx tx) { + Ui_newRecurringDialog ui; + QDialog d(parent); + ui.setupUi(&d); + Settings::saveRestore(&d); + + // Add all the from addresses + auto allBalances = main->getRPC()->getAllBalances(); + for (QString addr : allBalances->keys()) { + ui.cmbFromAddress->addItem(addr, allBalances->value(addr)); + } + + if (!tx.fromAddr.isEmpty()) { + ui.cmbFromAddress->setCurrentText(tx.fromAddr); + ui.cmbFromAddress->setEnabled(false); + } + + ui.cmbCurrency->addItem(Settings::getTokenName()); + ui.cmbCurrency->addItem("USD"); + + if (tx.toAddrs.length() > 0) { + ui.txtToAddr->setText(tx.toAddrs[0].addr); + ui.txtToAddr->setEnabled(false); + + ui.txtAmt->setText(Settings::getDecimalString(tx.toAddrs[0].amount)); + ui.txtAmt->setEnabled(false); + + ui.txtMemo->setPlainText(tx.toAddrs[0].txtMemo); + ui.txtMemo->setEnabled(false); + } + + ui.cmbSchedule->addItem("Every Day", QVariant(Schedule::DAY)); + ui.cmbSchedule->addItem("Every Week", QVariant(Schedule::WEEK)); + ui.cmbSchedule->addItem("Every Month", QVariant(Schedule::MONTH)); + ui.cmbSchedule->addItem("Every Year", QVariant(Schedule::YEAR)); + + ui.txtNumPayments->setText("10"); + + ui.txtDesc->setFocus(); + d.exec(); +} \ No newline at end of file diff --git a/src/recurring.h b/src/recurring.h index 2cc86ae..3f27115 100644 --- a/src/recurring.h +++ b/src/recurring.h @@ -1,22 +1,36 @@ #ifndef RECURRING_H #define RECURRING_H -#include +#include "precompiled.h" -namespace Ui { -class RecurringDialog; -} +#include "mainwindow.h" -class RecurringDialog : public QDialog -{ - Q_OBJECT - -public: - explicit RecurringDialog(QWidget *parent = nullptr); - ~RecurringDialog(); - -private: - Ui::RecurringDialog *ui; +enum Schedule { + DAY = 1, + WEEK, + MONTH, + YEAR }; -#endif // RECURRING_H +struct RecurringPaymentInfo { + QString desc; + QString fromAddr; + QString toAddr; + double amt; + QString currency; + Schedule schedule; + int numPayments; + + long startBlock; + int completedPayments; +}; + +class Recurring +{ +public: + Recurring(); + + static void showEditDialog(QWidget* parent, MainWindow* main, Tx tx); +}; + +#endif // RECURRING_H \ No newline at end of file diff --git a/src/sendtab.cpp b/src/sendtab.cpp index d5f51d7..05ce4dc 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -3,8 +3,10 @@ #include "addressbook.h" #include "ui_confirm.h" #include "ui_memodialog.h" +#include "ui_newrecurring.h" #include "settings.h" #include "rpc.h" +#include "recurring.h" using json = nlohmann::json; @@ -80,6 +82,29 @@ void MainWindow::setupSendTab() { QFont f = ui->Address1->font(); f.setPointSize(f.pointSize() - 1); ui->MemoTxt1->setFont(f); + + // Recurring button + QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) { + if (checked) { + ui->btnRecurSchedule->setEnabled(true); + } else { + ui->btnRecurSchedule->setEnabled(false); + ui->lblRecurDesc->setText(""); + } + + }); + + // Recurring schedule button + QObject::connect(ui->btnRecurSchedule, &QPushButton::clicked, this, &MainWindow::editSchedule); + + // Set the default state for the whole page + removeExtraAddresses(); +} + +void MainWindow::editSchedule() { + // Open the edit schedule dialog + Recurring::showEditDialog(this, this, createTxFromSendPage()); + } void MainWindow::updateLabelsAutoComplete() { @@ -354,6 +379,11 @@ void MainWindow::removeExtraAddresses() { delete addressGroupBox; } + + // Reset the recurring button + ui->chkRecurring->setCheckState(Qt::Unchecked); + ui->btnRecurSchedule->setEnabled(false); + ui->lblRecurDesc->setText(""); } void MainWindow::maxAmountChecked(int checked) {