From 6bc71e4d0a205607496c1ecb7a0dc584fe4382e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Fri, 19 May 2017 15:05:06 +0200 Subject: Qt: Add check for packet bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable menu items handling packet bytes if not having any. Bug: 13723 Change-Id: I9cdb1185910f865c61a8ee74e3cf3177159bf315 Reviewed-on: https://code.wireshark.org/review/21710 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- ui/qt/main_window_slots.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ui/qt') diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index c957a6e42a..a9db64ffc5 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1355,6 +1355,7 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { bool have_field_info = false; bool have_subtree = false; bool can_open_url = false; + bool have_packet_bytes = false; QByteArray field_filter; int field_id = -1; @@ -1364,6 +1365,10 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { if (fi && fi->tree_type != -1) { have_subtree = true; } + + if (fi && fi->ds_tvb) { + have_packet_bytes = true; + } } if (capture_file_.capFile() != NULL && fi != NULL) { @@ -1413,6 +1418,9 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { main_ui_->actionEditCopyValue->setEnabled(can_match_selected); main_ui_->actionEditCopyAsFilter->setEnabled(can_match_selected); + main_ui_->actionContextShowPacketBytes->setEnabled(have_packet_bytes); + main_ui_->actionFileExportPacketBytes->setEnabled(have_packet_bytes); + main_ui_->actionViewExpandSubtrees->setEnabled(have_subtree); main_ui_->actionGoGoToLinkedPacket->setEnabled(is_framenum); -- cgit v1.2.1