cabana: fix changing message size (#27544)

* cabana: fix changing message size

* fix naming signal untitled
This commit is contained in:
Willem Melching 2023-03-09 22:14:21 +01:00 committed by GitHub
parent b79f4594c4
commit 5b3a72267c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -194,7 +194,7 @@ EditMessageDialog::EditMessageDialog(const MessageId &msg_id, const QString &tit
form_layout->addRow(tr("Size"), size_spin);
btn_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
btn_box->button(QDialogButtonBox::Ok)->setEnabled(false);
validateName(name_edit->text());
form_layout->addRow(btn_box);
setFixedWidth(parent->width() * 0.9);
@ -204,9 +204,9 @@ EditMessageDialog::EditMessageDialog(const MessageId &msg_id, const QString &tit
}
void EditMessageDialog::validateName(const QString &text) {
bool valid = false;
bool valid = text.compare(UNTITLED, Qt::CaseInsensitive) != 0;
error_label->setVisible(false);
if (!text.isEmpty() && text != original_name && text.compare(UNTITLED, Qt::CaseInsensitive) != 0) {
if (!text.isEmpty() && valid && text != original_name) {
valid = std::none_of(dbc()->messages().begin(), dbc()->messages().end(),
[&text](auto &m) { return m.second.name == text; });
if (!valid) {