send Memo to selected Contact
This commit is contained in:
@@ -74,6 +74,7 @@ void ChatModel::renderChatBox(QListWidget &view)
|
||||
|
||||
void ChatModel::renderChatBox(QListWidget *view)
|
||||
{
|
||||
|
||||
qDebug() << "called ChatModel::renderChatBox(QListWidget *view)";
|
||||
QString line = "";
|
||||
while(view->count() > 0)
|
||||
@@ -97,6 +98,7 @@ void ChatModel::renderChatBox(QListWidget *view)
|
||||
|
||||
QString MainWindow::createHeaderMemo(QString cid, QString zaddr, int version=0, int headerNumber=1)
|
||||
{
|
||||
|
||||
QString header="";
|
||||
QJsonDocument j;
|
||||
QJsonObject h;
|
||||
@@ -120,7 +122,14 @@ Tx MainWindow::createTxFromChatPage() {
|
||||
CAmount totalAmt;
|
||||
// For each addr/amt in the Chat tab
|
||||
{
|
||||
QString addr = ""; // We need to set the reply Address for our Contact here
|
||||
|
||||
|
||||
|
||||
// ui->ContactZaddr->setText("Zaddr");
|
||||
|
||||
|
||||
|
||||
QString addr = ui->ContactZaddr->text().trimmed(); // We need to set the reply Address for our Contact here
|
||||
// Remove label if it exists
|
||||
addr = AddressBook::addressFromAddressLabel(addr);
|
||||
|
||||
@@ -134,15 +143,15 @@ Tx MainWindow::createTxFromChatPage() {
|
||||
totalAmt = totalAmt + amt;
|
||||
QString cid = QString::number( time(NULL) % std::rand() ); // low entropy for testing!
|
||||
// QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces); // Needs to get a fix
|
||||
QString hmemo= createHeaderMemo(cid,"ZADDR");
|
||||
QString hmemo= createHeaderMemo(cid,"Some ZADDR");
|
||||
|
||||
QString memo = ui->memoTxtChat->toPlainText().trimmed();
|
||||
// ui->memoSizeChat->setLenDisplayLabel();
|
||||
|
||||
|
||||
tx.toAddrs.push_back(ToFields{addr, amt, hmemo.toUtf8().toHex()}) ;
|
||||
tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ;
|
||||
qDebug()<<hmemo;
|
||||
tx.toAddrs.push_back( ToFields{addr, amt, memo.toUtf8().toHex()});
|
||||
tx.toAddrs.push_back( ToFields{addr, amt, memo});
|
||||
|
||||
qDebug() << "pushback chattx";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "contactmodel.h"
|
||||
#include "addressbook.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
void ContactModel::renderContactList(QListWidget* view)
|
||||
{
|
||||
@@ -9,7 +10,8 @@ void ContactModel::renderContactList(QListWidget* view)
|
||||
}
|
||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
view->addItem(c.getName());
|
||||
view->addItem(c.getPartnerAddress());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -988,7 +988,22 @@ void MainWindow::setupchatTab() {
|
||||
// Send button
|
||||
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
|
||||
|
||||
|
||||
///////// Set selected Zaddr for Chat with Doubleklick
|
||||
|
||||
QObject::connect(ui->listContactWidget, &QTableView::doubleClicked, [=] () {
|
||||
for (auto p : AddressBook::getInstance()->getAllAddressLabels()) {
|
||||
QModelIndex index = ui->listContactWidget->currentIndex();
|
||||
QString itemText = index.data(Qt::DisplayRole).toString();
|
||||
ui->ContactZaddr->setText(itemText);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// ui->listContactWidget->setCurrentRow(1)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {
|
||||
QObject::connect(this, &QPlainTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay);
|
||||
|
||||
@@ -1354,9 +1354,9 @@
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>357</x>
|
||||
<y>460</y>
|
||||
<width>329</width>
|
||||
<x>340</x>
|
||||
<y>490</y>
|
||||
<width>61</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -1367,8 +1367,8 @@
|
||||
<widget class="MemoEdit" name="memoTxtChat">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>347</x>
|
||||
<y>483</y>
|
||||
<x>340</x>
|
||||
<y>510</y>
|
||||
<width>901</width>
|
||||
<height>128</height>
|
||||
</rect>
|
||||
@@ -1377,8 +1377,8 @@
|
||||
<widget class="QPushButton" name="btnInsertFrom">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>620</y>
|
||||
<x>350</x>
|
||||
<y>650</y>
|
||||
<width>158</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
@@ -1445,7 +1445,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1130</x>
|
||||
<y>620</y>
|
||||
<y>650</y>
|
||||
<width>114</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
@@ -1463,6 +1463,45 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_42">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>410</x>
|
||||
<y>490</y>
|
||||
<width>67</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ContactName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<y>490</y>
|
||||
<width>67</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ContactZaddr">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>740</x>
|
||||
<y>490</y>
|
||||
<width>171</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user