disable chatinput while sending #139
This commit is contained in:
@@ -544,6 +544,7 @@ void MainWindow::sendChat() {
|
|||||||
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
|
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
|
||||||
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
|
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
|
||||||
QMessageBox::Ok, this);
|
QMessageBox::Ok, this);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
msg.exec();
|
msg.exec();
|
||||||
return;
|
return;
|
||||||
@@ -573,6 +574,7 @@ void MainWindow::sendChat() {
|
|||||||
QMessageBox::Ok, this);
|
QMessageBox::Ok, this);
|
||||||
|
|
||||||
msg.exec();
|
msg.exec();
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
// abort the Tx
|
// abort the Tx
|
||||||
return;
|
return;
|
||||||
@@ -592,6 +594,7 @@ void MainWindow::sendChat() {
|
|||||||
movie->start();
|
movie->start();
|
||||||
ui->sendChatButton->show();
|
ui->sendChatButton->show();
|
||||||
ui->sendChatButton->setEnabled(false);
|
ui->sendChatButton->setEnabled(false);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -601,6 +604,8 @@ void MainWindow::sendChat() {
|
|||||||
movie1->start();
|
movie1->start();
|
||||||
ui->sendChatButton->show();
|
ui->sendChatButton->show();
|
||||||
ui->sendChatButton->setEnabled(false);
|
ui->sendChatButton->setEnabled(false);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->memoTxtChat->clear();
|
ui->memoTxtChat->clear();
|
||||||
@@ -619,6 +624,8 @@ void MainWindow::sendChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie->stop();
|
movie->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
QPixmap send(":/icons/res/sendBlack.png");
|
QPixmap send(":/icons/res/sendBlack.png");
|
||||||
@@ -626,6 +633,7 @@ void MainWindow::sendChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie1->stop();
|
movie1->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -638,6 +646,7 @@ void MainWindow::sendChat() {
|
|||||||
// Errored out
|
// Errored out
|
||||||
[=] (QString opid, QString errStr) {
|
[=] (QString opid, QString errStr) {
|
||||||
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
if (!opid.isEmpty())
|
if (!opid.isEmpty())
|
||||||
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
||||||
@@ -652,6 +661,7 @@ void MainWindow::sendChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie->stop();
|
movie->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
QPixmap send(":/icons/res/sendBlack.png");
|
QPixmap send(":/icons/res/sendBlack.png");
|
||||||
@@ -659,6 +669,7 @@ void MainWindow::sendChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie1->stop();
|
movie1->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -676,6 +687,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
|
|||||||
if (!Settings::isValidAddress(toAddr.addr)) {
|
if (!Settings::isValidAddress(toAddr.addr)) {
|
||||||
QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr);
|
QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr);
|
||||||
return QString(tr("Recipient Address ")) % addr % tr(" is Invalid");
|
return QString(tr("Recipient Address ")) % addr % tr(" is Invalid");
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
||||||
@@ -693,6 +705,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
|
|||||||
if (available < total) {
|
if (available < total) {
|
||||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1367,6 +1367,11 @@ void MainWindow::setupchatTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
|
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
|
||||||
|
QObject::connect(ui->sendChatButton, &QPushButton::clicked, [&] () {
|
||||||
|
|
||||||
|
ui->memoTxtChat->setEnabled(false);
|
||||||
|
|
||||||
|
});
|
||||||
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
|
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
|
||||||
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);
|
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);
|
||||||
|
|
||||||
@@ -1764,6 +1769,7 @@ void MainWindow::sendMoneyChat() {
|
|||||||
QMessageBox::Ok, this);
|
QMessageBox::Ok, this);
|
||||||
|
|
||||||
msg.exec();
|
msg.exec();
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
// abort the Tx
|
// abort the Tx
|
||||||
return;
|
return;
|
||||||
@@ -1792,6 +1798,7 @@ void MainWindow::sendMoneyChat() {
|
|||||||
movie1->start();
|
movie1->start();
|
||||||
ui->sendChatButton->show();
|
ui->sendChatButton->show();
|
||||||
ui->sendChatButton->setEnabled(false);
|
ui->sendChatButton->setEnabled(false);
|
||||||
|
ui->memoTxtChat->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->memoTxtChat->clear();
|
ui->memoTxtChat->clear();
|
||||||
@@ -1810,6 +1817,7 @@ void MainWindow::sendMoneyChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie->stop();
|
movie->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
QPixmap send(":/icons/res/sendBlack.png");
|
QPixmap send(":/icons/res/sendBlack.png");
|
||||||
@@ -1817,6 +1825,7 @@ void MainWindow::sendMoneyChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie1->stop();
|
movie1->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -1824,17 +1833,20 @@ void MainWindow::sendMoneyChat() {
|
|||||||
// Force a UI update so we get the unconfirmed Tx
|
// Force a UI update so we get the unconfirmed Tx
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
ui->memoTxtChat->clear();
|
ui->memoTxtChat->clear();
|
||||||
|
// ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
},
|
},
|
||||||
// Errored out
|
// Errored out
|
||||||
[=] (QString opid, QString errStr) {
|
[=] (QString opid, QString errStr) {
|
||||||
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
if (!opid.isEmpty())
|
if (!opid.isEmpty())
|
||||||
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
||||||
|
|
||||||
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
||||||
movie->stop();
|
movie->stop();
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
if (theme == "Dark" || theme == "Midnight") {
|
if (theme == "Dark" || theme == "Midnight") {
|
||||||
@@ -1843,6 +1855,7 @@ void MainWindow::sendMoneyChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie->stop();
|
movie->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
QPixmap send(":/icons/res/sendBlack.png");
|
QPixmap send(":/icons/res/sendBlack.png");
|
||||||
@@ -1850,9 +1863,9 @@ void MainWindow::sendMoneyChat() {
|
|||||||
ui->sendChatButton->setIcon(sendIcon);
|
ui->sendChatButton->setIcon(sendIcon);
|
||||||
movie1->stop();
|
movie1->stop();
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -1867,12 +1880,14 @@ QString MainWindow::doSendChatMoneyTxValidations(Tx tx) {
|
|||||||
if (!Settings::isValidAddress(toAddr.addr)) {
|
if (!Settings::isValidAddress(toAddr.addr)) {
|
||||||
QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr);
|
QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr);
|
||||||
return QString(tr("Recipient Address ")) % addr % tr(" is Invalid");
|
return QString(tr("Recipient Address ")) % addr % tr(" is Invalid");
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
||||||
// somewhere, so just add a check to make sure.
|
// somewhere, so just add a check to make sure.
|
||||||
if (toAddr.amount.toqint64() < 0) {
|
if (toAddr.amount.toqint64() < 0) {
|
||||||
return QString(tr("Amount for address '%1' is invalid!").arg(toAddr.addr));
|
return QString(tr("Amount for address '%1' is invalid!").arg(toAddr.addr));
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
total = total + toAddr.amount;
|
total = total + toAddr.amount;
|
||||||
@@ -1884,6 +1899,8 @@ QString MainWindow::doSendChatMoneyTxValidations(Tx tx) {
|
|||||||
if (available < total) {
|
if (available < total) {
|
||||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||||
|
ui->memoTxtChat->setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user