add error message for messages over 512 chars

This commit is contained in:
DenioD
2020-05-26 19:40:42 +02:00
parent 537d3828b0
commit eb0bb65230

View File

@@ -349,6 +349,22 @@ void MainWindow::sendChat() {
return;
}
int max = 512;
QString chattext = ui->memoTxtChat->toPlainText();
int size = chattext.size();
if (size > max){
// auto addr = "";
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
QMessageBox::Ok, this);
msg.exec();
return;
}
Tx tx = createTxFromChatPage();
QString error = doSendChatTxValidations(tx);
@@ -646,6 +662,22 @@ void MainWindow::ContactRequest() {
return;
}
int max = 512;
QString chattext = contactRequest.getMemo();;
int size = chattext.size();
if (size > max){
// auto addr = "";
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
QMessageBox::Ok, this);
msg.exec();
return;
}
Tx tx = createTxForSafeContactRequest();
QString error = doSendRequestTxValidations(tx);