From 8183b245c6c53ac9480194e4547ed373bd362b9f Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 21:57:47 +0200 Subject: [PATCH] add a first Button for a new HushChat Address on chattab --- src/addressbook.cpp | 7 ++++--- src/chatmodel.cpp | 10 ++++++---- src/mainwindow.cpp | 13 ++++++++++++- src/mainwindow.h | 2 ++ src/mainwindow.ui | 27 +++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 298b057..ce706d0 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -212,10 +212,11 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) ////// We need a better popup here. AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid,avatar); - QMessageBox::critical( + + QMessageBox::information( parent, - QObject::tr("Add Successfully"), - QObject::tr("juhu").arg(newLabel), + QObject::tr("Added Contact"), + QObject::tr("successfully added your new contact").arg(newLabel), QMessageBox::Ok ); return; diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c8ab957..34be5c0 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -535,12 +535,14 @@ void::MainWindow::addContact() { return; } - ////// We need a better popup here. + ///////Todo: Test if label allready exist! + + ////// Success, so show it AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar); - QMessageBox::critical( + QMessageBox::information( this, - QObject::tr("Add Successfully"), - QObject::tr("juhu").arg(newLabel), + QObject::tr("Added Contact"), + QObject::tr("successfully added your new contact").arg(newLabel), QMessageBox::Ok ); return; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a691a56..ed4bb95 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1554,4 +1554,15 @@ MainWindow::~MainWindow() delete wsserver; delete wormhole; -} \ No newline at end of file +} +void MainWindow::on_givemeZaddr_clicked() +{ + + bool sapling = true; + rpc->createNewZaddr(sapling, [=] (json reply) { + QString hushchataddr = QString::fromStdString(reply.get()[0]); + QMessageBox::information(this, "Your new Hushchataddress",hushchataddr); + // ui->listReceiveAddresses->insertItem(0, hushchataddr); + // ui->listReceiveAddresses->setCurrentIndex(0); + }); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 54f9dc8..9e91245 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -95,6 +95,8 @@ public slots: private slots: + void on_givemeZaddr_clicked(); + private: void closeEvent(QCloseEvent* event); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 6be3969..2c1adc6 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1598,6 +1598,32 @@ true + + + + 80 + 10 + 211 + 41 + + + + New HushChat Address + + + + :/icons/res/message-icon.svg:/icons/res/message-icon.svg + + + + 33 + 29 + + + + true + + lcdNumber listContactWidget label_39 @@ -1609,6 +1635,7 @@ safeContactRequest pushContact sendContact + givemeZaddr