aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2018-08-31 09:28:04 +0200
committerAnders Broman <a.broman58@gmail.com>2018-08-31 10:29:50 +0000
commit589413d8772f1450be9bd4a2550cb99a95f71299 (patch)
tree8f5a87930ca92a99bf1fed4bfd301b5b509ba60b /ui
parent5720ac5fd0398bc84640a6f637406da512df7aa9 (diff)
Qt: Improve fetching preferences from a tree item.
The special-case "text only" header field will not give preferences for the selected protocol, so we have to traverse the parents to get a usable node. Change-Id: I647f275839db337dedaeb67664402af1fe9f21c1 Reviewed-on: https://code.wireshark.org/review/29363 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/proto_tree.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index 15e78bed6b..c97a172d96 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -181,7 +181,13 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
ctx_menu_.addAction(window()->findChild<QAction *>("actionGoGoToLinkedPacket"));
ctx_menu_.addAction(window()->findChild<QAction *>("actionContextShowLinkedPacketInNewWindow"));
- proto_prefs_menu_.setModule(finfo.moduleName());
+ // The "text only" header field will not give preferences for the selected protocol.
+ // Use parent in this case.
+ proto_node *node = proto_tree_model_->protoNodeFromIndex(index).protoNode();
+ while (node && node->finfo->hfinfo->id == hf_text_only)
+ node = node->parent;
+ FieldInformation pref_finfo(node);
+ proto_prefs_menu_.setModule(pref_finfo.moduleName());
decode_as_->setData(QVariant::fromValue(true));