Disable the Send button when the limit is exceeded

This commit is contained in:
defnax 2021-01-11 21:31:42 +01:00
parent 39a89dd2a9
commit 44fc3ea50c
3 changed files with 17 additions and 12 deletions

View file

@ -393,7 +393,7 @@ void MessageComposer::updateCells(int,int)
{ {
int rowCount = ui.recipientWidget->rowCount(); int rowCount = ui.recipientWidget->rowCount();
int row; int row;
bool has_gxs = false ; has_gxs = false ;
for (row = 0; row < rowCount; ++row) for (row = 0; row < rowCount; ++row)
{ {
@ -410,6 +410,7 @@ void MessageComposer::updateCells(int,int)
ui.respond_to_CB->show(); ui.respond_to_CB->show();
ui.distantFrame->show(); ui.distantFrame->show();
ui.fromLabel->show(); ui.fromLabel->show();
checkLength();
} }
else else
{ {
@ -2880,15 +2881,17 @@ void MessageComposer::checkLength()
lineLabel->setText("|"); lineLabel->setText("|");
if(has_gxs) {
if(charRemains >= 0) { if(charRemains >= 0) {
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains); text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel { }");
}else{ }else{
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains)); text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
infoLabel->setStyleSheet("QStatusBar QLabel#infoLabel {color: red; font: bold; }");
} }
ui.actionSend->setEnabled(charRemains>=0);
//ui.actionSend->setEnabled(charRemains>=0);
infoLabel->setText(text); infoLabel->setText(text);
} }
else {
infoLabel->setText("");
ui.actionSend->setEnabled(true);
}
}

View file

@ -263,6 +263,8 @@ private:
QLabel *lengthLabel; QLabel *lengthLabel;
QLabel *lineLabel; QLabel *lineLabel;
bool has_gxs;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MessageComposer ui; Ui::MessageComposer ui;

View file

@ -18,7 +18,7 @@
</property> </property>
<widget class="QWidget" name="tabFeed"> <widget class="QWidget" name="tabFeed">
<attribute name="title"> <attribute name="title">
<string>Log</string> <string>Activity</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="tabFeedVLayout"> <layout class="QVBoxLayout" name="tabFeedVLayout">
<item> <item>