diff options
author | John Thacker <johnthacker@gmail.com> | 2023-05-22 08:30:10 -0400 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2023-05-24 06:39:00 -0400 |
commit | 5f51c4bb33d5cba63e9f45f58866cb140563e935 (patch) | |
tree | 7cabeac31d5990d2287740699e43b76fd2ca1541 /ui/qt/models/decode_as_delegate.cpp | |
parent | cef49cd887972eb6b4b4139d699b92babff1f488 (diff) |
Decode As: Enable disabling a default dissector
Make it possible to use Decode As to set the current dissector
for an entry in a dissector table to NULL even if there is a
default dissector registered for that entry. (none) means (none)
This is different than disabling the dissector entirely, because
a dissector might be registered as default for multiple entries/ports,
and a user might want only to disable it for one entry, not in general.
Or, a dissector might have multiple registered dissectors and a
heuristic dissector, and a user might want to disable one dissector
registered value while still having the heuristic dissector enabled.
This is different than setting the dissector for the entry to Data,
because it still allows heuristic dissectors to get a chance.
This is different than setting a "Try heuristic sub-dissectors first"
preference, because it only affects the single entry in the tables,
instead of trying heuristic sub-dissectors first for all entries in
the table (and it works for all tables, even those that lack such a
preference.)
Move the default dissector to the top of the combobox so it is
still easy to reset to the default.
Fix #12098
Diffstat (limited to 'ui/qt/models/decode_as_delegate.cpp')
-rw-r--r-- | ui/qt/models/decode_as_delegate.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/qt/models/decode_as_delegate.cpp b/ui/qt/models/decode_as_delegate.cpp index b9b69151d3..3c300a79fc 100644 --- a/ui/qt/models/decode_as_delegate.cpp +++ b/ui/qt/models/decode_as_delegate.cpp @@ -271,7 +271,12 @@ QWidget* DecodeAsDelegate::createEditor(QWidget *parentWidget, const QStyleOptio for (dissector_info_t* protocol : protocols) { - cb_editor->addItem(protocol->proto_name, VariantPointer<dissector_info_t>::asQVariant(protocol)); + // Make it easy to reset to the default dissector + if (protocol->proto_name == item->defaultDissector()) { + cb_editor->insertItem(0, protocol->proto_name, VariantPointer<dissector_info_t>::asQVariant(protocol)); + } else { + cb_editor->addItem(protocol->proto_name, VariantPointer<dissector_info_t>::asQVariant(protocol)); + } } //Make sure the combo box is at least as wide as the column |