forked from osmocom/wireshark
Qt: Update frame selected in several cases
Ensure that frameSelected(0) is emitted when not having a proto tree field selected because of: 1. No match when trying to restore selected field 2. Search selects a packet with no field to select 3. Current packet is deselected This will disable functionality which requires a selected field and updates the status bar according to selected field. Bug: 14658 Change-Id: I158fae4f26c02f718cee0030ef9e38b597876381 Reviewed-on: https://code.wireshark.org/review/27395 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
4513c66b1a
commit
612fb778f5
|
@ -269,8 +269,10 @@ void MainStatusBar::selectedFieldChanged(FieldInformation * finfo)
|
|||
{
|
||||
QString item_info;
|
||||
|
||||
if ( ! finfo )
|
||||
if ( ! finfo ) {
|
||||
pushFieldStatus(item_info);
|
||||
return;
|
||||
}
|
||||
|
||||
FieldInformation::HeaderInfo hInfo = finfo->headerInfo();
|
||||
|
||||
|
|
|
@ -360,7 +360,8 @@ PacketListModel *PacketList::packetListModel() const {
|
|||
return packet_list_model_;
|
||||
}
|
||||
|
||||
void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected) {
|
||||
void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected)
|
||||
{
|
||||
QTreeView::selectionChanged(selected, deselected);
|
||||
|
||||
if (!cap_file_) return;
|
||||
|
@ -388,6 +389,7 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
|
|||
|
||||
if (!cap_file_->edt) {
|
||||
viewport()->update();
|
||||
emit fieldSelected(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -402,9 +404,7 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
|
|||
viewport()->update();
|
||||
}
|
||||
|
||||
if (cap_file_->search_in_progress &&
|
||||
(cap_file_->search_pos != 0 || (cap_file_->string && cap_file_->decode_data)))
|
||||
{
|
||||
if (cap_file_->search_in_progress) {
|
||||
match_data mdata;
|
||||
field_info *fi = NULL;
|
||||
|
||||
|
@ -414,16 +414,19 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
|
|||
if (cf_find_string_protocol_tree(cap_file_, cap_file_->edt->tree, &mdata)) {
|
||||
fi = mdata.finfo;
|
||||
}
|
||||
} else {
|
||||
} else if (cap_file_->search_pos != 0) {
|
||||
// Find the finfo that corresponds to our byte.
|
||||
fi = proto_find_field_from_offset(cap_file_->edt->tree, cap_file_->search_pos,
|
||||
cap_file_->edt->tvb);
|
||||
}
|
||||
|
||||
if (fi) {
|
||||
emit fieldSelected(new FieldInformation(fi, this));
|
||||
FieldInformation finfo(fi, this);
|
||||
emit fieldSelected(&finfo);
|
||||
} else {
|
||||
emit fieldSelected(0);
|
||||
}
|
||||
} else if (!cap_file_->search_in_progress && proto_tree_) {
|
||||
} else if (proto_tree_) {
|
||||
proto_tree_->restoreSelectedField();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,7 +478,9 @@ void ProtoTree::restoreSelectedField()
|
|||
cur_index = proto_tree_model_->index(row, 0, cur_index);
|
||||
FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(cur_index).protoNode());
|
||||
if (!finfo.isValid() || finfo.headerInfo().id != hf_id) {
|
||||
// Did not find the selected hfid path in the selected packet
|
||||
cur_index = QModelIndex();
|
||||
emit fieldSelected(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue