Qt: Show "unknown colorfilters" warning when opening the dialog

Show the warning about unknown colorfilters being disabled when
opening the "Coloring Rules..." dialog to make the user aware of
this before starting editing the rules.

The user may have corrected the filter and enabled it while having
the dialog open, and then this warning would be misleading.

Change-Id: Ic7f10495e5561bc2fea413c89cf9ebd187c8f113
Reviewed-on: https://code.wireshark.org/review/29909
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Stig Bjørlykke 2018-09-29 00:00:19 +02:00 committed by Peter Wu
parent b0dd361d48
commit 45be966822
1 changed files with 11 additions and 11 deletions

View File

@ -80,6 +80,17 @@ ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
ui->coloringRulesTreeView->setCurrentIndex(QModelIndex());
}
if (prefs.unknown_colorfilters) {
QMessageBox mb;
mb.setText(tr("Your coloring rules file contains unknown rules"));
mb.setInformativeText(tr("Wireshark doesn't recognize one or more of your coloring rules. "
"They have been disabled."));
mb.setStandardButtons(QMessageBox::Ok);
mb.exec();
prefs.unknown_colorfilters = FALSE;
}
updateHint();
}
@ -309,17 +320,6 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
void ColoringRulesDialog::on_buttonBox_accepted()
{
if (prefs.unknown_colorfilters) {
QMessageBox mb;
mb.setText(tr("Your coloring rules file contains unknown rules"));
mb.setInformativeText(tr("Wireshark doesn't recognize one or more of your coloring rules. "
"They have been disabled."));
mb.setStandardButtons(QMessageBox::Ok);
int result = mb.exec();
if (result != QMessageBox::Save) return;
}
QString err;
if (!colorRuleModel_.writeColors(err)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err.toUtf8().constData());