Qt: Inhibit Disable Protocol when applicable
authorJaap Keuter <jaap.keuter@xs4all.nl>
Thu, 4 May 2017 12:21:27 +0000 (14:21 +0200)
committerMichael Mann <mmann78@netscape.net>
Thu, 4 May 2017 21:20:42 +0000 (21:20 +0000)
The packet details context menu allows you, through the Protocol
Preferences sub menu to manipulate (disable) the protocol dissection
through the Disable <protocol>... option. This opens up the appropriate
dialog and select the applicable protocol.
This fails for protocols which have their can_toggle flag reset (e.g.
the frame protocol). The dialog opens, but the protocol can't be found,
hence the top item is selected.

Instead disable the menu option for protocols which can't have their
enabled state toggled.

Change-Id: Ifa83f656a8ab747f379d3ca0114520e5efed4b67
Reviewed-on: https://code.wireshark.org/review/21494
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
ui/qt/protocol_preferences_menu.cpp

index f16aded36e545a1a68c70b88364eb203568235ab..96543c586d06b8c40702b11905453a7c821df13d 100644 (file)
@@ -172,6 +172,7 @@ void ProtocolPreferencesMenu::setModule(const char *module_name)
 
     QAction *disable_action = new QAction(tr("Disable %1" UTF8_HORIZONTAL_ELLIPSIS).arg(short_name), this);
     connect(disable_action, SIGNAL(triggered(bool)), this, SLOT(disableProtocolTriggered()));
+    disable_action->setDisabled(!proto_can_toggle_protocol(proto_id));
 
     module_ = prefs_find_module(module_name);
     if (!module_ || !prefs_is_registered_protocol(module_name)) {