Qt: Fix Copy Description from context menu
Fix Copy->Description from context menu in Packet List and Packet Dialog. This was broken in gf6534b8a. Align MainWindow::actionEditCopyTriggered() using the same procedure. Improve ProtoTree::ctxCopyVisibleItems(). Bug: 16323 Change-Id: I564b73c027019bc59629aa84098db8f307e92d40 Reviewed-on: https://code.wireshark.org/review/36339 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
694c2bcbf0
commit
a2dc713c11
|
@ -1922,9 +1922,9 @@ void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type
|
|||
|
||||
switch (selection_type) {
|
||||
case CopySelectedDescription:
|
||||
if (finfo_selected && finfo_selected->rep
|
||||
&& strlen(finfo_selected->rep->representation) > 0) {
|
||||
clip.append(finfo_selected->rep->representation);
|
||||
if (proto_tree_->selectionModel()->hasSelection()) {
|
||||
QModelIndex idx = proto_tree_->selectionModel()->selectedIndexes().first();
|
||||
clip = idx.data(Qt::DisplayRole).toString();
|
||||
}
|
||||
break;
|
||||
case CopySelectedFieldName:
|
||||
|
|
|
@ -126,9 +126,11 @@ void ProtoTree::ctxCopyVisibleItems()
|
|||
if (send && send->property("selected_tree").isValid())
|
||||
selected_tree = true;
|
||||
|
||||
QString clip = toString();
|
||||
QString clip;
|
||||
if (selected_tree && selectionModel()->hasSelection())
|
||||
clip = toString(selectionModel()->selectedIndexes().first());
|
||||
else
|
||||
clip = toString();
|
||||
|
||||
if (clip.length() > 0)
|
||||
wsApp->clipboard()->setText(clip);
|
||||
|
@ -170,8 +172,7 @@ void ProtoTree::ctxCopySelectedInfo()
|
|||
break;
|
||||
|
||||
case ProtoTree::Description:
|
||||
if (finfo.fieldInfo()->rep && strlen(finfo.fieldInfo()->rep->representation) > 0)
|
||||
clip.append(finfo.fieldInfo()->rep->representation);
|
||||
clip = idx.data(Qt::DisplayRole).toString();
|
||||
break;
|
||||
|
||||
case ProtoTree::Value:
|
||||
|
|
Loading…
Reference in New Issue