diff options
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/main_window.h | 1 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 5 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 23 | ||||
-rw-r--r-- | ui/qt/proto_tree.cpp | 7 |
4 files changed, 28 insertions, 8 deletions
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index e4becaf39e..1d379079ce 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -356,6 +356,7 @@ private slots: #endif void matchFieldFilter(FilterAction::Action action, FilterAction::ActionType filter_type); + void on_actionAnalyzeCreateAColumn_triggered(); void on_actionAnalyzeAAFSelected_triggered(); void on_actionAnalyzeAAFNotSelected_triggered(); void on_actionAnalyzeAAFAndSelected_triggered(); diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index d62d46c1aa..d05587f108 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -1206,11 +1206,8 @@ </property> </action> <action name="actionAnalyzeCreateAColumn"> - <property name="enabled"> - <bool>false</bool> - </property> <property name="text"> - <string>Create a Column</string> + <string>Apply as Column</string> </property> <property name="toolTip"> <string>Create a packet list column from the selected field.</string> diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 41b8371d1d..354f0b8dce 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1233,8 +1233,8 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { // set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", // proto_can_match_selected(cf->finfo_selected, cf->edt)); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/CreateAColumn", -// hfinfo->type != FT_NONE); + main_ui_->actionAnalyzeCreateAColumn->setEnabled(can_match_selected); + main_ui_->actionAnalyzeAAFSelected->setEnabled(can_match_selected); main_ui_->actionAnalyzeAAFNotSelected->setEnabled(can_match_selected); main_ui_->actionAnalyzeAAFAndSelected->setEnabled(can_match_selected); @@ -1287,7 +1287,8 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { main_ui_->actionEditCopyFieldName->setEnabled(false); main_ui_->actionEditCopyValue->setEnabled(false); main_ui_->actionEditCopyAsFilter->setEnabled(false); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/CreateAColumn", FALSE); + + main_ui_->actionAnalyzeCreateAColumn->setEnabled(false); main_ui_->actionAnalyzeAAFSelected->setEnabled(false); main_ui_->actionAnalyzeAAFNotSelected->setEnabled(false); @@ -2192,6 +2193,22 @@ void MainWindow::matchFieldFilter(FilterAction::Action action, FilterAction::Act filterAction(field_filter, action, filter_type); } +void MainWindow::on_actionAnalyzeCreateAColumn_triggered() +{ + gint colnr = 0; + + if ( capture_file_.capFile() != 0 && capture_file_.capFile()->finfo_selected != 0 ) + { + colnr = column_prefs_add_custom(COL_CUSTOM, capture_file_.capFile()->finfo_selected->hfinfo->name, + capture_file_.capFile()->finfo_selected->hfinfo->abbrev,0); + + packet_list_->redrawVisiblePackets(); + packet_list_->resizeColumnToContents(colnr); + + prefs_main_write(); + } +} + // XXX We could probably create the analyze and prepare actions // dynamically using FilterActions and consolidate the methods // below into one callback. diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index c12b2dc48d..ac2dac3a52 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -167,8 +167,13 @@ ProtoTree::ProtoTree(QWidget *parent) : ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandAll")); ctx_menu_.addAction(window()->findChild<QAction *>("actionViewCollapseAll")); ctx_menu_.addSeparator(); -// " <menuitem name='CreateAColumn' action='/Create a Column'/>\n" + + action = window()->findChild<QAction *>("actionAnalyzeCreateAColumn"); + ctx_menu_.addAction(action); + ctx_menu_.addSeparator(); + action = window()->findChild<QAction *>("actionApply_as_Filter"); + submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); |