change some gui elements, deactivate contact request for now
This commit is contained in:
@@ -36,6 +36,7 @@ void ChatModel::setItems(std::vector<ChatItem> items)
|
||||
for(ChatItem c : items)
|
||||
{
|
||||
this->chatItems[c.getTimestamp()] = c;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view)
|
||||
line += QString(c.second.getMemo()) + QString("\n");
|
||||
view->addItem(line);
|
||||
line ="";
|
||||
}
|
||||
}else{}
|
||||
|
||||
if ((ui->MyZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)){
|
||||
line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
|
||||
@@ -321,7 +322,7 @@ Tx MainWindow::createTxForSafeContactRequest() {
|
||||
|
||||
QString hmemo= createHeaderMemo(type,cid,myAddr);
|
||||
|
||||
tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ;
|
||||
// tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ;
|
||||
|
||||
qDebug() << "pushback chattx";
|
||||
}
|
||||
@@ -334,7 +335,7 @@ Tx MainWindow::createTxForSafeContactRequest() {
|
||||
|
||||
qDebug() << "ChatTx created";
|
||||
}
|
||||
|
||||
//////////////////De-activated for now///////////////////
|
||||
void MainWindow::safeContactRequest() {
|
||||
|
||||
////////////////////////////Todo: Check if its a zaddr//////////
|
||||
@@ -357,9 +358,9 @@ void MainWindow::safeContactRequest() {
|
||||
// return;
|
||||
// }
|
||||
|
||||
Tx tx = createTxForSafeContactRequest();
|
||||
/* Tx tx = createTxForSafeContactRequest();
|
||||
|
||||
QString error = doSendChatTxValidations(tx);
|
||||
QString error = doSendRequestTxValidations(tx);
|
||||
|
||||
if (!error.isEmpty()) {
|
||||
// Something went wrong, so show an error and exit
|
||||
@@ -419,14 +420,14 @@ void MainWindow::safeContactRequest() {
|
||||
|
||||
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
||||
}
|
||||
);
|
||||
}
|
||||
);*/
|
||||
}
|
||||
|
||||
|
||||
QString MainWindow::doSendRequestTxValidations(Tx tx) {
|
||||
// Check to see if we have enough verified funds to send the Tx.
|
||||
|
||||
CAmount total;
|
||||
/* CAmount total;
|
||||
for (auto toAddr : tx.toAddrs) {
|
||||
if (!Settings::isValidAddress(toAddr.addr)) {
|
||||
QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr);
|
||||
@@ -450,5 +451,5 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) {
|
||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
return "";*/
|
||||
}
|
||||
|
||||
@@ -879,37 +879,40 @@ void Controller::refreshTransactions() {
|
||||
QString memo;
|
||||
if (!o["memo"].is_null()) {
|
||||
memo = QString::fromStdString(o["memo"]);
|
||||
}
|
||||
ChatItem item = ChatItem(
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
datetime,
|
||||
address,
|
||||
QString(""),
|
||||
memo,
|
||||
true // is an outgoing message
|
||||
memo
|
||||
// true // is an outgoing message
|
||||
);
|
||||
chatModel->addMessage(item);
|
||||
}
|
||||
|
||||
|
||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||
total_amount = total_amount + amount;
|
||||
}
|
||||
// }
|
||||
|
||||
{
|
||||
// {
|
||||
// Concat all the addresses
|
||||
|
||||
QList<QString> addresses;
|
||||
for (auto item : items) {
|
||||
// QList<QString> addresses;
|
||||
// for (auto item : items) {
|
||||
|
||||
addresses.push_back(item.address);
|
||||
// addresses.push_back(item.address);
|
||||
|
||||
address = addresses.join(",");
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
txdata.push_back(TransactionItem{
|
||||
"send", datetime, address, txid,confirmations, items
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Incoming Transaction
|
||||
address = (it["address"].is_null() ? "" : QString::fromStdString(it["address"]));
|
||||
@@ -919,8 +922,14 @@ void Controller::refreshTransactions() {
|
||||
if (!it["memo"].is_null()) {
|
||||
memo = QString::fromStdString(it["memo"]);
|
||||
}
|
||||
|
||||
TransactionItem tx{
|
||||
"Receive", datetime, address, txid,confirmations, items
|
||||
};
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
txdata.push_back(tx);
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
datetime,
|
||||
address,
|
||||
QString(""),
|
||||
@@ -933,13 +942,6 @@ void Controller::refreshTransactions() {
|
||||
CAmount::fromqint64(it["amount"].get<json::number_integer_t>()),
|
||||
memo
|
||||
});
|
||||
|
||||
|
||||
TransactionItem tx{
|
||||
"Receive", datetime, address, txid,confirmations, items
|
||||
};
|
||||
|
||||
txdata.push_back(tx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ void MainWindow::setupTransactionsTab() {
|
||||
qApp->processEvents();
|
||||
|
||||
// Click the memo button
|
||||
this->memoButtonClicked(1, true);
|
||||
this->memoButtonClicked(1, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1460,7 +1460,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
<string><html><head/><body><p>Send to :</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ContactName">
|
||||
@@ -1468,18 +1468,18 @@
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>490</y>
|
||||
<width>161</width>
|
||||
<width>81</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Your HushChat zaddr:</string>
|
||||
<string><html><head/><body><p>My zaddr :</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ContactZaddr">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<x>420</x>
|
||||
<y>460</y>
|
||||
<width>691</width>
|
||||
<height>20</height>
|
||||
@@ -1514,7 +1514,7 @@
|
||||
<widget class="QLabel" name="MyZaddr">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>490</x>
|
||||
<x>420</x>
|
||||
<y>490</y>
|
||||
<width>691</width>
|
||||
<height>20</height>
|
||||
|
||||
@@ -35,7 +35,7 @@ void MainWindow::setupSendTab() {
|
||||
});
|
||||
|
||||
// The first Memo button
|
||||
QObject::connect(ui->MemoBtn1, &QPushButton::clicked, [=] () {
|
||||
QObject::connect(ui->MemoBtn1, &QPushButton::clicked, [=] () {
|
||||
this->memoButtonClicked(1);
|
||||
});
|
||||
setMemoEnabled(1, false);
|
||||
@@ -377,15 +377,15 @@ void MainWindow::setMemoEnabled(int number, bool enabled) {
|
||||
|
||||
void MainWindow::memoButtonClicked(int number, bool includeReplyTo) {
|
||||
// Memos can only be used with zAddrs. So check that first
|
||||
auto addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") + QString::number(number));
|
||||
if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Memos can only be used with z-addresses"),
|
||||
tr("The memo field can only be used with a z-address.\n") + addr->text() + tr("\ndoesn't look like a z-address"),
|
||||
QMessageBox::Ok, this);
|
||||
// auto addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") + QString::number(number));
|
||||
//if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||
// QMessageBox msg(QMessageBox::Critical, tr("Memos can only be used with z-addresses"),
|
||||
// tr("The memo field can only be used with a z-address.\n") + addr->text() + tr("\ndoesn't look like a z-address"),
|
||||
// QMessageBox::Ok, this);
|
||||
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
// msg.exec();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Get the current memo if it exists
|
||||
auto memoTxt = ui->sendToWidgets->findChild<QLabel *>(QString("MemoTxt") + QString::number(number));
|
||||
|
||||
Reference in New Issue
Block a user