Qt: add new protocol name when reporting deprecation

When entering a deprecated protocol name in the filter a warning is
placed in the status bar to this effect. The new protocol name is
not reveiled though, leaving the user in doubt what to use.
This change adds the new protocol name to the text in the status bar.

Change-Id: Ib892f79893471065eca81c7cf17e165256fdc9a9
Reviewed-on: https://code.wireshark.org/review/36086
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Jaap Keuter 2020-02-12 21:34:02 +01:00 committed by Stig Bjørlykke
parent e6dfc1ca01
commit 40b8293d43
2 changed files with 15 additions and 7 deletions

View File

@ -748,8 +748,7 @@ string(ip.dst) matches "^172\.(1[6-9]|2[0-9]|3[0-1])\..{1,3}\.255"
Using the != operator on combined expressions like `eth.addr`, `ip.addr`,
`tcp.port`, and `udp.port` will probably not work as expected. Wireshark
will show the warning “"!=" is deprecated or may have unexpected
results” when you use it.
will show the warning “"!=" may have unexpected results” when you use it.
People often use a filter string like `ip.addr == 1.2.3.4`
to display all packets containing the IP address 1.2.3.4.
@ -787,9 +786,8 @@ For example, the DHCP dissector was originally developed for the BOOTP
protocol but as of Wireshark 3.0 all of the “bootp” display filter
fields have been renamed to their “dhcp” equivalents. You can still use
the old filter names for the time being, e.g. “bootp.type” is equivalent
to “dhcp.type” but Wireshark will show the warning “"bootp.type" is
deprecated or may have unexpected results” when you use it. Support for
the deprecated fields may be removed in the future.
to “dhcp.type” but Wireshark will show the warning “"bootp" is deprecated”
when you use it. Support for the deprecated fields may be removed in the future.
[[ChWorkFilterAddExpressionSection]]

View File

@ -20,6 +20,7 @@
#include <ui/qt/widgets/syntax_line_edit.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/stock_icon.h>
@ -161,13 +162,22 @@ void SyntaxLineEdit::checkDisplayFilter(QString filter)
}
if (depr) {
// You keep using that word. I do not think it means what you think it means.
// Possible alternatives: ::Troubled, or ::Problematic maybe?
setSyntaxState(SyntaxLineEdit::Deprecated);
/*
* We're being lazy and only printing the first "problem" token.
* Would it be better to print all of them?
*/
syntax_error_message_ = tr("\"%1\" is deprecated or may have unexpected results. See the User's Guide.")
.arg((const char *) g_ptr_array_index(depr, 0));
QString token((const char *)g_ptr_array_index(depr, 0));
gchar *token_str = qstring_strdup(token.section('.', 0, 0));
header_field_info *hfi = proto_registrar_get_byalias(token_str);
if (hfi)
syntax_error_message_ = tr("\"%1\" is deprecated in favour of \"%2\". "
"See the User's Guide.").arg(token_str).arg(hfi->abbrev);
else
syntax_error_message_ = tr("\"%1\" may have unexpected results. "
"See the User's Guide.").arg(token_str);
g_free(token_str);
} else {
setSyntaxState(SyntaxLineEdit::Valid);
}