From 3c4ad8ec0b37db24aa34d0014afc82a7a35325d8 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sat, 13 Jul 2019 11:33:59 -0700 Subject: [PATCH] Hook up a file upload button action --- src/mainwindow.h | 1 + src/sendtab.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/mainwindow.h b/src/mainwindow.h index 157b821..9a1971d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -107,6 +107,7 @@ private: std::function addZAddrsToComboList(bool sapling); void memoButtonClicked(int number, bool includeReplyTo = false); + void fileUploadButtonClicked(int number); void setMemoEnabled(int number, bool enabled); void donate(); diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 8d68b28..c33390d 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -7,6 +7,7 @@ #include "settings.h" #include "rpc.h" #include "recurring.h" +#include using json = nlohmann::json; @@ -42,6 +43,11 @@ void MainWindow::setupSendTab() { this->memoButtonClicked(1); }); setMemoEnabled(1, false); + + // File upload button + QObject::connect(ui->FileBtn, &QPushButton::clicked, [=] () { + this->fileUploadButtonClicked(1); + }); // This is the damnest thing ever. If we do AddressBook::readFromStorage() directly, the whole file // doesn't get read. It needs to run in a timer after everything has finished to be able to read @@ -271,6 +277,15 @@ void MainWindow::addAddressSection() { horizontalLayout_13->addWidget(MemoBtn1); setMemoEnabled(itemNumber, false); + auto FileBtn = new QPushButton(verticalGroupBox); + FileBtn->setObjectName(QString("FileBtn") % QString::number(itemNumber)); + FileBtn->setText(tr("File Upload")); + // Connect File Upload button + QObject::connect(FileBtn, &QPushButton::clicked, [=] () { + this->fileUploadButtonClicked(itemNumber); + }); + horizontalLayout_13->addWidget(FileBtn); + sendAddressLayout->addLayout(horizontalLayout_13); auto MemoTxt1 = new QLabel(verticalGroupBox); @@ -311,6 +326,10 @@ void MainWindow::setMemoEnabled(int number, bool enabled) { } } +void MainWindow::fileUploadButtonClicked(int number) { + qDebug() << "File upload button clicked"; +} + void MainWindow::memoButtonClicked(int number, bool includeReplyTo) { // Memos can only be used with zAddrs. So check that first auto addr = ui->sendToWidgets->findChild(QString("Address") + QString::number(number));