diff --git a/src/Model/ChatItem.h b/src/Model/ChatItem.h index edfa8a0..11e3b65 100644 --- a/src/Model/ChatItem.h +++ b/src/Model/ChatItem.h @@ -36,6 +36,7 @@ class ChatItem QString getTxid(); int getConfirmations(); bool isOutgoing(); + bool isdouble(); bool isNotarized(); void setTimestamp(long timestamp); void setAddress(QString address); diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index 8700a32..691c65e 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -5,20 +5,17 @@ #include "addressbook.h" #include "mainwindow.h" #include "chatmodel.h" +#include "requestdialog.h" +#include "ui_requestdialog.h" +#include "settings.h" +#include "controller.h" + void ContactModel::renderContactList(QListView* view) { QStandardItemModel* contact = new QStandardItemModel(); - QMenu* contextMenu; - QAction* requestAction; - QAction* editAction; - contextMenu = new QMenu(view); - requestAction = new QAction("Send a contact request",contextMenu); - editAction = new QAction("Edit this contact",contextMenu); - - // QObject::connect(requestAction,SIGNAL(customContextMenuRequested(const QModelIndex)),this, SLOT(&ContactModel::requestActionClickedSlot)); - + for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) { @@ -34,9 +31,25 @@ void ContactModel::renderContactList(QListView* view) view->setUniformItemSizes(true); view->setDragDropMode(QAbstractItemView::DropOnly); view->show(); - view->setContextMenuPolicy(Qt::ActionsContextMenu); - view->addAction(requestAction); - view->addAction(editAction); + + } } + +void MainWindow::showRequesthush() { + + Ui_RequestDialog req; + QDialog d(this); + req.setupUi(&d); + Settings::saveRestore(&d); + + // setupDialog(main, &d, &req); + + // Setup the Label completer for the Address + + + d.exec(); + +} + diff --git a/src/contactmodel.h b/src/contactmodel.h index cfe57bc..095fe99 100644 --- a/src/contactmodel.h +++ b/src/contactmodel.h @@ -5,14 +5,17 @@ #include "Model/ContactItem.h" #include +#include "mainwindow.h" class ContactModel { public: + ContactModel() {} void renderContactList(QListView* view); + }; #endif \ No newline at end of file diff --git a/src/controller.cpp b/src/controller.cpp index 541821c..10b41bb 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -943,8 +943,7 @@ void Controller::refreshTransactions() { } - - // this->refresh(true); + items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d71baad..24f9b7c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1358,13 +1358,33 @@ void MainWindow::setupchatTab() { // ui->ContactZaddr->setText(p.getPartnerAddress()); // ui->MyZaddr->setText(p.getMyAddress()); ui->contactNameMemo->setText(p.getName()); - ui->memoTxtChat->clear(); + // ui->memoTxtChat->clear(); rpc->refresh(true); // updateChat(); } }); + + QMenu* contextMenu; + QAction* requestAction; + QAction* editAction; + QAction* HushAction; + QAction* requestHushAction; + contextMenu = new QMenu(ui->listContactWidget); + requestAction = new QAction("Send a contact request",contextMenu); + editAction = new QAction("Delete this contact",contextMenu); + HushAction = new QAction("Send a friend some Hush",contextMenu); + requestHushAction = new QAction("Request some Hush",contextMenu); + ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu); + ui->listContactWidget->addAction(requestAction); + ui->listContactWidget->addAction(editAction); + ui->listContactWidget->addAction(HushAction); + ui->listContactWidget->addAction(requestHushAction); + QObject::connect(requestHushAction, &QAction::triggered, [=]() { + MainWindow::showRequesthush(); + }); + ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat); } diff --git a/src/mainwindow.h b/src/mainwindow.h index fb08fdb..56bfbc6 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -60,6 +60,7 @@ public: void stopWebsocket(); void saveContact(); void saveandsendContact(); + void showRequesthush(); // void setmaxlenChat(int len); // void updateDisplay(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index a4a4e78..de58411 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1389,6 +1389,9 @@ QAbstractItemView::SingleSelection + + QAbstractItemView::SelectItems + @@ -1422,10 +1425,16 @@ QTextEdit::AutoNone - QTextEdit::FixedColumnWidth + QTextEdit::FixedPixelWidth - 80 + 600 + + + false + + + Qt::TextEditorInteraction