aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-12-07 01:46:20 +0000
committerGerald Combs <gerald@wireshark.org>2012-12-07 01:46:20 +0000
commit59cd52b5caae3806fbaba984833a8edd2752f2c4 (patch)
treef886df01065a589edecb4617770e7f599ef396cf
parent2b240a299b3cf26a5ef52e400588bb2e56d2a57f (diff)
Implement the items under "Edit→Copy", "Analyze→Apply as Filter" and
"Analyze→Prepare a Filter". Add a context menu to the protocol tree and fill in the items we've implemented so far. Add an "applyAllPreferences" method and corresponding "preferencesUpdated" signal to wsApp. Use it to set the maximum display filter combo count. Move the packet filtering code from the display filter edit to the main window (which makes more sense and matches what we're doing in the GTK+ version and gets rid of more global cfile references). Try to center the display filter edit button images. Use a different "close" button in the main toolbar. It looks better but is still wrong (on OS X at least). svn path=/trunk/; revision=46434
-rw-r--r--ui/gtk/main_filter_toolbar.c12
-rw-r--r--ui/qt/display_filter_combo.cpp17
-rw-r--r--ui/qt/display_filter_combo.h3
-rw-r--r--ui/qt/display_filter_edit.cpp62
-rw-r--r--ui/qt/display_filter_edit.h6
-rw-r--r--ui/qt/main.cpp8
-rw-r--r--ui/qt/main_window.cpp24
-rw-r--r--ui/qt/main_window.h41
-rw-r--r--ui/qt/main_window.ui184
-rw-r--r--ui/qt/main_window_slots.cpp372
-rw-r--r--ui/qt/packet_list.cpp21
-rw-r--r--ui/qt/packet_list.h5
-rw-r--r--ui/qt/proto_tree.cpp80
-rw-r--r--ui/qt/proto_tree.h5
-rw-r--r--ui/qt/wireshark_application.cpp6
-rw-r--r--ui/qt/wireshark_application.h2
16 files changed, 770 insertions, 78 deletions
diff --git a/ui/gtk/main_filter_toolbar.c b/ui/gtk/main_filter_toolbar.c
index 2388261c70..19e991850b 100644
--- a/ui/gtk/main_filter_toolbar.c
+++ b/ui/gtk/main_filter_toolbar.c
@@ -420,4 +420,16 @@ main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
return (cf_status == CF_OK);
}
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/qt/display_filter_combo.cpp b/ui/qt/display_filter_combo.cpp
index abc35e8b28..9816668ad9 100644
--- a/ui/qt/display_filter_combo.cpp
+++ b/ui/qt/display_filter_combo.cpp
@@ -26,8 +26,11 @@
#include "qt_ui_utils.h"
#include "ui/recent.h"
+#include <epan/prefs.h>
+
#include "display_filter_edit.h"
#include "display_filter_combo.h"
+#include "wireshark_application.h"
#include <QCompleter>
@@ -69,6 +72,8 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
"}"
);
completer()->setCompletionMode(QCompleter::PopupCompletion);
+
+ connect(wsApp, SIGNAL(updatePreferences()), this, SLOT(updateMaxCount()));
}
extern "C" void dfilter_recent_combo_write_all(FILE *rf) {
@@ -90,6 +95,18 @@ void DisplayFilterCombo::writeRecent(FILE *rf) {
}
}
+void DisplayFilterCombo::applyDisplayFilter()
+{
+ DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(lineEdit());
+
+ if (df_edit) df_edit->applyDisplayFilter();
+}
+
+void DisplayFilterCombo::updateMaxCount()
+{
+ setMaxCount(prefs.gui_recent_df_entries_max);
+}
+
extern "C" gboolean dfilter_combo_add_recent(gchar *filter) {
if (!cur_display_filter_combo)
return FALSE;
diff --git a/ui/qt/display_filter_combo.h b/ui/qt/display_filter_combo.h
index 30c166fbb1..bd9505181c 100644
--- a/ui/qt/display_filter_combo.h
+++ b/ui/qt/display_filter_combo.h
@@ -38,7 +38,10 @@ public:
signals:
public slots:
+ void applyDisplayFilter();
+private slots:
+ void updateMaxCount();
};
#endif // DISPLAY_FILTER_COMBO_H
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index 48e60a15ac..916d035292 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -88,7 +88,9 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
SyntaxLineEdit(parent),
plain_(plain),
- field_name_only_(false)
+ field_name_only_(false),
+ apply_button_(NULL)
+
{
setAccessibleName(tr("Display filter entry"));
@@ -118,16 +120,16 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
" border-top-left-radius: 3px;"
" border-bottom-left-radius: 3px;"
" padding-left: 1px;"
- " image: url(:/dfilter/dfilter_bookmark_normal.png);"
+ " background: palette(base) url(:/dfilter/dfilter_bookmark_normal.png) no-repeat center;"
// " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
// " stop: 0 #f6f7fa, stop: 1 #dadbde);"
"}"
"QToolButton:hover {"
- " image: url(:/dfilter/dfilter_bookmark_hover.png);"
+ " background: palette(base) url(:/dfilter/dfilter_bookmark_hover.png) no-repeat center;"
"}"
"QToolButton:pressed {"
- " image: url(:/dfilter/dfilter_bookmark_pressed.png);"
+ " background: palette(base) url(:/dfilter/dfilter_bookmark_pressed.png) no-repeat center;"
"}"
// "QToolButton:pressed {"
@@ -143,39 +145,39 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
clear_button_->setCursor(Qt::ArrowCursor);
clear_button_->setStyleSheet(
"QToolButton {"
- " image: url(:/dfilter/dfilter_erase_normal.png);"
+ " background: palette(base) url(:/dfilter/dfilter_erase_normal.png) no-repeat center;"
" border: none;"
" width: 16px;"
"}"
"QToolButton:hover {"
- " image: url(:/dfilter/dfilter_erase_active.png);"
+ " background: palette(base) url(:/dfilter/dfilter_erase_active.png) no-repeat center;"
"}"
"QToolButton:pressed {"
- " image: url(:/dfilter/dfilter_erase_selected.png);"
+ " background: palette(base) url(:/dfilter/dfilter_erase_selected.png) no-repeat center;"
"}"
);
clear_button_->hide();
connect(clear_button_, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));
- apply_button_ = NULL;
if (!plain_) {
apply_button_ = new QToolButton(this);
apply_button_->setCursor(Qt::ArrowCursor);
+ apply_button_->setEnabled(false);
apply_button_->setStyleSheet(
"QToolButton { /* all types of tool button */"
" border 0 0 0 0;"
" border-top-right-radius: 3px;"
" border-bottom-right-radius: 3px;"
" padding-right: 1px;"
- " image: url(:/dfilter/dfilter_apply_normal.png);"
+ " background: palette(base) url(:/dfilter/dfilter_apply_normal.png) no-repeat center;"
"}"
"QToolButton:hover {"
- " image: url(:/dfilter/dfilter_apply_hover.png);"
+ " background: palette(base) url(:/dfilter/dfilter_apply_hover.png) no-repeat center;"
"}"
"QToolButton:pressed {"
- " image: url(:/dfilter/dfilter_apply_pressed.png);"
+ " background: palette(base) url(:/dfilter/dfilter_apply_pressed.png) no-repeat center;"
"}"
);
connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyDisplayFilter()));
@@ -301,43 +303,17 @@ void DisplayFilterEdit::showDisplayFilterDialog()
void DisplayFilterEdit::applyDisplayFilter()
{
- QString dfString(text());
- gchar *dftext = NULL;
- cf_status_t cf_status;
-
if (syntaxState() != Valid && syntaxState() != Empty) {
return;
}
- if (dfString.length() > 0)
- dftext = g_strdup(dfString.toUtf8().constData());
- cf_status = cf_filter_packets(&cfile, dftext, FALSE);
- g_free(dftext);
-
- if (cf_status == CF_OK) {
- if (apply_button_) {
- apply_button_->setEnabled(false);
- }
- if (dfString.length() < 1) {
-// gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_CLEAR_KEY), FALSE);
-// gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_SAVE_KEY), FALSE);
- }
- }
-
- if (cf_status == CF_OK && dfString.length() > 0) {
-// int index;
-
- g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: add \"%s\" to recent display filters", this->text().toUtf8().constData());
+ QString new_filter = text();
+ emit filterPackets(new_filter, true);
+}
-// if(!dfilter_entry_match(filter_cm,s, &index)){
-// gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(filter_cm), s);
-// index++;
-// }
-// while ((guint)index >= prefs.gui_recent_df_entries_max){
-// gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(filter_cm), index);
-// index--;
-// }
- }
+void DisplayFilterEdit::displayFilterSuccess(bool success)
+{
+ apply_button_->setEnabled(!success);
}
/*
diff --git a/ui/qt/display_filter_edit.h b/ui/qt/display_filter_edit.h
index 6c5524385e..efe69e28b0 100644
--- a/ui/qt/display_filter_edit.h
+++ b/ui/qt/display_filter_edit.h
@@ -39,10 +39,13 @@ protected:
// void focusInEvent(QFocusEvent *evt);
// void focusOutEvent(QFocusEvent *evt);
+public slots:
+ void applyDisplayFilter();
+ void displayFilterSuccess(bool success);
+
private slots:
void checkFilter(const QString &text);
void showDisplayFilterDialog();
- void applyDisplayFilter();
private:
bool plain_;
@@ -56,6 +59,7 @@ signals:
void pushFilterSyntaxStatus(QString&);
void popFilterSyntaxStatus();
void pushFilterSyntaxWarning(QString&);
+ void filterPackets(QString& new_filter, bool force);
public slots:
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index c5f0ed1ce4..983fe8b0b0 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -1055,10 +1055,10 @@ int main(int argc, char *argv[])
capture_opts_trim_ring_num_files(&global_capture_opts);
#endif /* HAVE_LIBPCAP */
- /* Notify all registered modules that have had any of their preferences
- changed either from one of the preferences file or from the command
- line that their preferences have changed. */
- prefs_apply_all();
+ /* Notify all registered modules that have had any of their preferences
+ changed either from one of the preferences file or from the command
+ line that their preferences have changed. */
+ wsApp->applyAllPreferences();
#ifdef HAVE_LIBPCAP
if ((global_capture_opts.num_selected == 0) &&
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index ad72f60731..6101e52fe8 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -99,6 +99,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(pushFilterSyntaxStatus(QString&)), main_ui_->statusBar, SLOT(pushFilterStatus(QString&)));
connect(df_edit, SIGNAL(popFilterSyntaxStatus()), main_ui_->statusBar, SLOT(popFilterStatus()));
connect(df_edit, SIGNAL(pushFilterSyntaxWarning(QString&)), main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
+ connect(df_edit, SIGNAL(filterPackets(QString&,bool)), this, SLOT(filterPackets(QString&,bool)));
+ connect (this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
// http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
// http://qt-project.org/doc/qt-4.8/qstyle.html#StandardPixmap-enum
@@ -106,7 +108,7 @@ MainWindow::MainWindow(QWidget *parent) :
QIcon().fromTheme("document-open", style()->standardIcon(QStyle::SP_DirIcon)));
// main_ui_->actionFileSave set in main_window.ui
main_ui_->actionFileClose->setIcon(
- QIcon().fromTheme("process-stop", style()->standardIcon(QStyle::SP_BrowserStop)));
+ QIcon().fromTheme("process-stop", style()->standardIcon(QStyle::SP_DialogCloseButton)));
// In Qt4 multiple toolbars and "pretty" are mutually exculsive on OS X. If
// unifiedTitleAndToolBarOnMac is enabled everything ends up in the same row.
@@ -150,20 +152,20 @@ MainWindow::MainWindow(QWidget *parent) :
packet_list_ = new PacketList(packet_splitter_);
- ProtoTree *proto_tree = new ProtoTree(packet_splitter_);
- proto_tree->setHeaderHidden(true);
- proto_tree->installEventFilter(this);
+ proto_tree_ = new ProtoTree(packet_splitter_);
+ proto_tree_->setHeaderHidden(true);
+ proto_tree_->installEventFilter(this);
ByteViewTab *byte_view_tab = new ByteViewTab(packet_splitter_);
byte_view_tab->setTabPosition(QTabWidget::South);
byte_view_tab->setDocumentMode(true);
- packet_list_->setProtoTree(proto_tree);
+ packet_list_->setProtoTree(proto_tree_);
packet_list_->setByteViewTab(byte_view_tab);
packet_list_->installEventFilter(this);
packet_splitter_->addWidget(packet_list_);
- packet_splitter_->addWidget(proto_tree);
+ packet_splitter_->addWidget(proto_tree_);
packet_splitter_->addWidget(byte_view_tab);
main_ui_->mainStack->addWidget(packet_splitter_);
@@ -220,16 +222,16 @@ MainWindow::MainWindow(QWidget *parent) :
packet_list_, SLOT(goLastPacket()));
connect(main_ui_->actionViewExpandSubtrees, SIGNAL(triggered()),
- proto_tree, SLOT(expandSubtrees()));
+ proto_tree_, SLOT(expandSubtrees()));
connect(main_ui_->actionViewExpandAll, SIGNAL(triggered()),
- proto_tree, SLOT(expandAll()));
+ proto_tree_, SLOT(expandAll()));
connect(main_ui_->actionViewCollapseAll, SIGNAL(triggered()),
- proto_tree, SLOT(collapseAll()));
+ proto_tree_, SLOT(collapseAll()));
- connect(proto_tree, SIGNAL(protoItemSelected(QString&)),
+ connect(proto_tree_, SIGNAL(protoItemSelected(QString&)),
main_ui_->statusBar, SLOT(pushFieldStatus(QString&)));
- connect(proto_tree, SIGNAL(protoItemSelected(field_info *)),
+ connect(proto_tree_, SIGNAL(protoItemSelected(field_info *)),
this, SLOT(setMenusForSelectedTreeRow(field_info *)));
connect(&file_set_dialog_, SIGNAL(fileSetOpenCaptureFile(QString&)),
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index ea8bc74893..c7492ae055 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -75,6 +75,21 @@ protected:
void closeEvent (QCloseEvent *event);
private:
+ enum MatchSelected {
+ MatchSelectedReplace,
+ MatchSelectedAnd,
+ MatchSelectedOr,
+ MatchSelectedNot,
+ MatchSelectedAndNot,
+ MatchSelectedOrNot
+ };
+
+ enum CopySelected {
+ CopySelectedDescription,
+ CopySelectedFieldName,
+ CopySelectedValue
+ };
+
Ui::MainWindow *main_ui_;
QMenu *open_recent_menu_;
QSplitter *packet_splitter_;
@@ -82,6 +97,7 @@ private:
DisplayFilterCombo *df_combo_box_;
capture_file *cap_file_;
PacketList *packet_list_;
+ ProtoTree *proto_tree_;
QWidget *previous_focus_;
FileSetDialog file_set_dialog_;
bool capture_stopping_;
@@ -119,10 +135,12 @@ private:
signals:
void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct);
void setCaptureFile(capture_file *cf);
+ void displayFilterSuccess(bool success);
public slots:
// in main_window_slots.cpp
void openCaptureFile(QString& cf_path = *new QString(), QString &display_filter = *new QString());
+ void filterPackets(QString& new_filter = *new QString(), bool force = false);
#ifdef HAVE_LIBPCAP
void captureCapturePrepared(capture_options *capture_opts);
@@ -175,9 +193,31 @@ private slots:
void on_actionFileExportObjectsSMB_triggered();
void on_actionFilePrint_triggered();
+ void on_actionFileExportSSLSessionKeys_triggered();
+
+ void actionEditCopyTriggered(MainWindow::CopySelected selection_type);
+ void on_actionEditCopyDescription_triggered();
+ void on_actionEditCopyFieldName_triggered();
+ void on_actionEditCopyValue_triggered();
+ void on_actionEditCopyAsFilter_triggered();
+
void on_actionGoGoToPacket_triggered();
void resetPreviousFocus();
+ void matchSelectedFilter(QString &field_filter, MainWindow::MatchSelected filter_type, bool apply = false, bool copy_only = false);
+ void on_actionAnalyzeAAFSelected_triggered();
+ void on_actionAnalyzeAAFNotSelected_triggered();
+ void on_actionAnalyzeAAFAndSelected_triggered();
+ void on_actionAnalyzeAAFOrSelected_triggered();
+ void on_actionAnalyzeAAFAndNotSelected_triggered();
+ void on_actionAnalyzeAAFOrNotSelected_triggered();
+ void on_actionAnalyzePAFSelected_triggered();
+ void on_actionAnalyzePAFNotSelected_triggered();
+ void on_actionAnalyzePAFAndSelected_triggered();
+ void on_actionAnalyzePAFOrSelected_triggered();
+ void on_actionAnalyzePAFAndNotSelected_triggered();
+ void on_actionAnalyzePAFOrNotSelected_triggered();
+
void on_actionHelpContents_triggered();
void on_actionHelpMPWireshark_triggered();
void on_actionHelpMPWireshark_Filter_triggered();
@@ -198,7 +238,6 @@ private slots:
void on_goToLineEdit_returnPressed();
void on_actionStartCapture_triggered();
void on_actionStopCapture_triggered();
- void on_actionFileExportSSLSessionKeys_triggered();
};
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 3ad2e72f14..ab8d9c364e 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -90,7 +90,7 @@
<x>0</x>
<y>0</y>
<width>960</width>
- <height>21</height>
+ <height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -155,6 +155,17 @@
<property name="title">
<string>Edit</string>
</property>
+ <widget class="QMenu" name="menuEditCopy">
+ <property name="title">
+ <string>Copy</string>
+ </property>
+ <addaction name="actionEditCopyDescription"/>
+ <addaction name="actionEditCopyFieldName"/>
+ <addaction name="actionEditCopyValue"/>
+ <addaction name="separator"/>
+ <addaction name="actionEditCopyAsFilter"/>
+ </widget>
+ <addaction name="menuEditCopy"/>
</widget>
<widget class="QMenu" name="menuCapture">
<property name="title">
@@ -221,11 +232,45 @@
<addaction name="separator"/>
<addaction name="actionViewReload"/>
</widget>
+ <widget class="QMenu" name="menuAnalyze">
+ <property name="title">
+ <string>Analyze</string>
+ </property>
+ <widget class="QMenu" name="menuApplyAsFilter">
+ <property name="title">
+ <string>Apply as Filter</string>
+ </property>
+ <addaction name="actionAnalyzeAAFSelected"/>
+ <addaction name="actionAnalyzeAAFNotSelected"/>
+ <addaction name="actionAnalyzeAAFAndSelected"/>
+ <addaction name="actionAnalyzeAAFOrSelected"/>
+ <addaction name="actionAnalyzeAAFAndNotSelected"/>
+ <addaction name="actionAnalyzeAAFOrNotSelected"/>
+ </widget>
+ <widget class="QMenu" name="menuPrepareAFilter">
+ <property name="title">
+ <string>Prepare a Filter</string>
+ </property>
+ <addaction name="actionAnalyzePAFSelected"/>
+ <addaction name="actionAnalyzePAFNotSelected"/>
+ <addaction name="actionAnalyzePAFAndSelected"/>
+ <addaction name="actionAnalyzePAFOrSelected"/>
+ <addaction name="actionAnalyzePAFAndNotSelected"/>
+ <addaction name="actionAnalyzePAFOrNotSelected"/>
+ </widget>
+ <addaction name="actionDisplayFilters"/>
+ <addaction name="actionDisplayFilterMacros"/>
+ <addaction name="separator"/>
+ <addaction name="actionApplyAsColumn"/>
+ <addaction name="menuApplyAsFilter"/>
+ <addaction name="menuPrepareAFilter"/>
+ </widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuView"/>
<addaction name="menuGo"/>
<addaction name="menuCapture"/>
+ <addaction name="menuAnalyze"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
@@ -746,6 +791,143 @@
<string>&amp;SMB...</string>
</property>
</action>
+ <action name="actionEditCopyDescription">
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+D</string>
+ </property>
+ </action>
+ <action name="actionEditCopyFieldName">
+ <property name="text">
+ <string>Field Name</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+F</string>
+ </property>
+ </action>
+ <action name="actionEditCopyValue">
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+V</string>
+ </property>
+ </action>
+ <action name="actionEditCopyAsFilter">
+ <property name="text">
+ <string>As Filter</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+C</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFSelected">
+ <property name="text">
+ <string>&amp;Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFNotSelected">
+ <property name="text">
+ <string>&amp;Not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>Not Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFAndSelected">
+ <property name="text">
+ <string>... &amp;and Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... and Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFOrSelected">
+ <property name="text">
+ <string>... &amp;or Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... or Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFAndNotSelected">
+ <property name="text">
+ <string>... a&amp;nd not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... and not Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzeAAFOrNotSelected">
+ <property name="text">
+ <string>... o&amp;r not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... or not Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFSelected">
+ <property name="text">
+ <string>&amp;Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFNotSelected">
+ <property name="text">
+ <string>&amp;Not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>Not Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFAndSelected">
+ <property name="text">
+ <string>... &amp;and Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... and Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFOrSelected">
+ <property name="text">
+ <string>... &amp;or Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... or Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFAndNotSelected">
+ <property name="text">
+ <string>... a&amp;nd not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... and not Selected</string>
+ </property>
+ </action>
+ <action name="actionAnalyzePAFOrNotSelected">
+ <property name="text">
+ <string>... o&amp;r not Selected</string>
+ </property>
+ <property name="toolTip">
+ <string>... or not Selected</string>
+ </property>
+ </action>
+ <action name="actionDisplayFilters">
+ <property name="text">
+ <string>Display Filters...</string>
+ </property>
+ </action>
+ <action name="actionDisplayFilterMacros">
+ <property name="text">
+ <string>Display Filter &amp;Macros...</string>
+ </property>
+ </action>
+ <action name="actionApplyAsColumn">
+ <property name="text">
+ <string>Apply as Column</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 2c3069fd0f..42717d87ff 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -64,6 +64,7 @@
#include "print_dialog.h"
#include <QMessageBox>
+#include <QClipboard>
#include <QDebug>
@@ -165,6 +166,24 @@ void MainWindow::openCaptureFile(QString &cf_path, QString &display_filter)
main_ui_->statusBar->showExpert();
}
+void MainWindow::filterPackets(QString& new_filter, bool force)
+{
+ cf_status_t cf_status;
+
+ cf_status = cf_filter_packets(&cfile, new_filter.toUtf8().data(), force);
+
+ if (cf_status == CF_OK) {
+ emit displayFilterSuccess(true);
+ if (new_filter.length() > 0) {
+ if (df_combo_box_->findText(new_filter) < 0) {
+ df_combo_box_->insertItem(0, new_filter);
+ }
+ }
+ } else {
+ emit displayFilterSuccess(false);
+ }
+}
+
// Capture callbacks
#ifdef HAVE_LIBPCAP
@@ -539,19 +558,14 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) {
}
properties = prefs_is_registered_protocol(abbrev);
*/
-
+ bool can_match_selected = proto_can_match_selected(cap_file_->finfo_selected, cap_file_->edt);
// set_menu_sensitivity(ui_manager_tree_view_menu,
// "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
// TRUE);
-// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
-// proto_can_match_selected(cf->finfo_selected, cf->edt));
+
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
// hfinfo->type != FT_NONE);
-// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
-// proto_can_match_selected(cf->finfo_selected, cf->edt));
-// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
-// proto_can_match_selected(cf->finfo_selected, cf->edt));
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
// proto_can_match_selected(cf->finfo_selected, cf->edt));
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
@@ -569,6 +583,11 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) {
// set_menu_sensitivity(ui_manager_main_menubar,
// "/Menubar/GoMenu/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
+
+ main_ui_->actionEditCopyDescription->setEnabled(can_match_selected);
+ main_ui_->actionEditCopyFieldName->setEnabled(can_match_selected);
+ main_ui_->actionEditCopyValue->setEnabled(can_match_selected);
+ main_ui_->actionEditCopyAsFilter->setEnabled(can_match_selected);
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description",
// proto_can_match_selected(cf->finfo_selected, cf->edt));
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname",
@@ -577,12 +596,23 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) {
// proto_can_match_selected(cf->finfo_selected, cf->edt));
// 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/ApplyasColumn",
// hfinfo->type != FT_NONE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter",
-// proto_can_match_selected(cf->finfo_selected, cf->edt));
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter",
-// proto_can_match_selected(cf->finfo_selected, cf->edt));
+ main_ui_->actionAnalyzeAAFSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzeAAFNotSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzeAAFAndSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzeAAFOrSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzeAAFAndNotSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzeAAFOrNotSelected->setEnabled(can_match_selected);
+
+ main_ui_->actionAnalyzePAFSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzePAFNotSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzePAFAndSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzePAFOrSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzePAFAndNotSelected->setEnabled(can_match_selected);
+ main_ui_->actionAnalyzePAFOrNotSelected->setEnabled(can_match_selected);
+
main_ui_->actionViewExpandSubtrees->setEnabled(cap_file_->finfo_selected->tree_type != -1);
// prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
// if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
@@ -612,13 +642,26 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) {
main_ui_->actionFileExportPacketBytes->setEnabled(false);
// set_menu_sensitivity(ui_manager_main_menubar,
// "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
+ main_ui_->actionEditCopyDescription->setEnabled(false);
+ main_ui_->actionEditCopyFieldName->setEnabled(false);
+ main_ui_->actionEditCopyValue->setEnabled(false);
+ main_ui_->actionEditCopyAsFilter->setEnabled(false);
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
+
+ main_ui_->actionAnalyzeAAFSelected->setEnabled(false);
+ main_ui_->actionAnalyzeAAFNotSelected->setEnabled(false);
+ main_ui_->actionAnalyzeAAFAndSelected->setEnabled(false);
+ main_ui_->actionAnalyzeAAFOrSelected->setEnabled(false);
+ main_ui_->actionAnalyzeAAFAndNotSelected->setEnabled(false);
+ main_ui_->actionAnalyzeAAFOrNotSelected->setEnabled(false);
+
+ main_ui_->actionAnalyzePAFSelected->setEnabled(false);
+ main_ui_->actionAnalyzePAFNotSelected->setEnabled(false);
+ main_ui_->actionAnalyzePAFAndSelected->setEnabled(false);
+ main_ui_->actionAnalyzePAFOrSelected->setEnabled(false);
+ main_ui_->actionAnalyzePAFAndNotSelected->setEnabled(false);
+ main_ui_->actionAnalyzePAFOrNotSelected->setEnabled(false);
+
main_ui_->actionViewExpandSubtrees->setEnabled(false);
}
}
@@ -839,12 +882,307 @@ void MainWindow::on_actionFilePrint_triggered()
pdlg.exec();
}
+// Edit Menu
+
+// XXX This should probably be somewhere else.
+void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type)
+{
+ char label_str[ITEM_LABEL_LENGTH];
+ QString clip;
+
+ if (!cap_file_) return;
+
+ switch(selection_type) {
+ case CopySelectedDescription:
+ if (cap_file_->finfo_selected->rep &&
+ strlen (cap_file_->finfo_selected->rep->representation) > 0) {
+ clip.append(cap_file_->finfo_selected->rep->representation);
+ }
+ break;
+ case CopySelectedFieldName:
+ if (cap_file_->finfo_selected->hfinfo->abbrev != 0) {
+ clip.append(cap_file_->finfo_selected->hfinfo->abbrev);
+ }
+ break;
+ case CopySelectedValue:
+ if (cap_file_->edt != 0) {
+ clip.append(get_node_field_value(cap_file_->finfo_selected, cap_file_->edt));
+ }
+ break;
+ }
+
+ if (clip.length() == 0) {
+ /* If no representation then... Try to read the value */
+ proto_item_fill_label(cap_file_->finfo_selected, label_str);
+ clip.append(label_str);
+ }
+
+ if (clip.length()) {
+ wsApp->clipboard()->setText(clip);
+ } else {
+ QString err = tr("Couldn't copy text. Try another item.");
+ main_ui_->statusBar->pushTemporaryStatus(err);
+ }
+}
+
+void MainWindow::on_actionEditCopyDescription_triggered()
+{
+ actionEditCopyTriggered(CopySelectedDescription);
+}
+
+void MainWindow::on_actionEditCopyFieldName_triggered()
+{
+ actionEditCopyTriggered(CopySelectedFieldName);
+}
+
+void MainWindow::on_actionEditCopyValue_triggered()
+{
+ actionEditCopyTriggered(CopySelectedValue);
+}
+
+void MainWindow::on_actionEditCopyAsFilter_triggered()
+{
+ if (!cap_file_) return;
+
+ QString filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ matchSelectedFilter(filter, MatchSelectedReplace, false, true);
+}
+
// View Menu
// Expand / collapse slots in proto_tree
// Go Menu
+// Analyze Menu
+
+// XXX This should probably be somewhere else.
+void MainWindow::matchSelectedFilter(QString &field_filter, MainWindow::MatchSelected filter_type, bool apply, bool copy_only)
+{
+ QString cur_filter;
+ QString new_filter;
+
+ if (field_filter.length() < 1) {
+ QString err = tr("Couldn't build a filter. Try another item.");
+ main_ui_->statusBar->pushTemporaryStatus(err);
+ return;
+ }
+
+ if (!df_combo_box_) return;
+
+ cur_filter = df_combo_box_->lineEdit()->text();
+
+ switch (filter_type) {
+ case MatchSelectedReplace:
+ new_filter = field_filter;
+ break;
+ case MatchSelectedAnd:
+ if (cur_filter.length()) {
+ new_filter = "(" + cur_filter + ") && (" + field_filter + ")";
+ } else {
+ new_filter = field_filter;
+ }
+ break;
+ case MatchSelectedOr:
+ if (cur_filter.length()) {
+ new_filter = "(" + cur_filter + ") || (" + field_filter + ")";
+ } else {
+ new_filter = field_filter;
+ }
+ break;
+ case MatchSelectedNot:
+ new_filter = "!(" + field_filter + ")";
+ break;
+ case MatchSelectedAndNot:
+ if (cur_filter.length()) {
+ new_filter = "(" + cur_filter + ") && !(" + field_filter + ")";
+ } else {
+ new_filter = "!(" + field_filter + ")";
+ }
+ break;
+ case MatchSelectedOrNot:
+ if (cur_filter.length()) {
+ new_filter = "(" + cur_filter + ") || !(" + field_filter + ")";
+ } else {
+ new_filter = "!(" + field_filter + ")";
+ }
+ break;
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ if (copy_only) {
+ wsApp->clipboard()->setText(new_filter);
+ } else {
+ df_combo_box_->lineEdit()->setText(new_filter);
+ if (apply) {
+ df_combo_box_->applyDisplayFilter();
+ } else {
+ df_combo_box_->lineEdit()->setFocus();
+ }
+ }
+
+}
+
+void MainWindow::on_actionAnalyzeAAFSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedReplace, true, false);
+}
+
+void MainWindow::on_actionAnalyzeAAFNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedNot, true, false);
+}
+
+void MainWindow::on_actionAnalyzeAAFAndSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedAnd, true, false);
+}
+
+void MainWindow::on_actionAnalyzeAAFOrSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedOr, true, false);
+}
+
+void MainWindow::on_actionAnalyzeAAFAndNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedAndNot, true, false);
+}
+
+void MainWindow::on_actionAnalyzeAAFOrNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedOrNot, true, false);
+}
+
+void MainWindow::on_actionAnalyzePAFSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedReplace, false, false);
+}
+
+void MainWindow::on_actionAnalyzePAFNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedNot, false, false);
+}
+
+void MainWindow::on_actionAnalyzePAFAndSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedAnd, false, false);
+}
+
+void MainWindow::on_actionAnalyzePAFOrSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedOr, false, false);
+}
+
+void MainWindow::on_actionAnalyzePAFAndNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedAndNot, false, false);
+}
+
+void MainWindow::on_actionAnalyzePAFOrNotSelected_triggered()
+{
+ QString filter;
+
+ if (packet_list_->contextMenuActive()) {
+ // filter = packet_list_->getSelectedColumnFilter();
+ } else {
+ filter = proto_construct_match_selected_string(cap_file_->finfo_selected,
+ cap_file_->edt);
+ }
+ matchSelectedFilter(filter, MatchSelectedOrNot, false, false);
+}
+
+
// Next / previous / first / last slots in packet_list
// Help Menu
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index a557abdee6..bd4a9bc0d5 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -47,6 +47,7 @@
#include <QTabWidget>
#include <QTextEdit>
#include <QScrollBar>
+#include <QContextMenuEvent>
// If we ever add the ability to open multiple capture files we might be
// able to use something like QMap<capture_file *, PacketList *> to match
@@ -300,6 +301,21 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
}
}
+void PacketList::contextMenuEvent(QContextMenuEvent *event)
+{
+ foreach (QMenu *submenu, submenus_) {
+ foreach (QAction *a, submenu->actions()) {
+ a->setData(true);
+ }
+ }
+ ctx_menu_.exec(event->globalPos());
+ foreach (QMenu *submenu, submenus_) {
+ foreach (QAction *a, submenu->actions()) {
+ a->setData(QVariant());
+ }
+ }
+}
+
// Redraw the packet list and detail
void PacketList::updateAll() {
update();
@@ -351,6 +367,11 @@ void PacketList::writeRecent(FILE *rf) {
}
+bool PacketList::contextMenuActive()
+{
+ return ctx_menu_.isVisible();
+}
+
// Slots
void PacketList::setCaptureFile(capture_file *cf)
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index 2b620c3258..e96d95300c 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -30,6 +30,7 @@
#include <QTreeView>
#include <QTreeWidget>
+#include <QMenu>
// It might make more sense to subclass QTableView here.
class PacketList : public QTreeView
@@ -43,16 +44,20 @@ public:
void updateAll();
void clear();
void writeRecent(FILE *rf);
+ bool contextMenuActive();
protected:
void showEvent (QShowEvent *event);
void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
+ void contextMenuEvent(QContextMenuEvent *event);
private:
PacketListModel *packet_list_model_;
ProtoTree *proto_tree_;
ByteViewTab *byte_view_tab_;
capture_file *cap_file_;
+ QMenu ctx_menu_;
+ QList<QMenu *> submenus_;
signals:
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index e115ea5fbb..c4592041c2 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -33,6 +33,8 @@
#include <QTreeWidgetItemIterator>
#include <QDesktopServices>
#include <QUrl>
+#include <QContextMenuEvent>
+#include <QMainWindow>
QColor expert_color_comment ( 0x00, 0xff, 0x00 ); /* Green */
QColor expert_color_chat ( 0x80, 0xb7, 0xf7 ); /* light blue */
@@ -151,9 +153,82 @@ proto_tree_draw_node(proto_node *node, gpointer data)
ProtoTree::ProtoTree(QWidget *parent) :
QTreeWidget(parent)
{
+ QMenu *submenu, *subsubmenu;
+
setAccessibleName(tr("Packet details"));
setUniformRowHeights(true);
+ ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandSubtrees"));
+ ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandAll"));
+ ctx_menu_.addAction(window()->findChild<QAction *>("actionViewCollapseAll"));
+ ctx_menu_.addSeparator();
+// " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
+ ctx_menu_.addSeparator();
+ submenu = new QMenu(tr("Apply as Filter"));
+ ctx_menu_.addMenu(submenu);
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected"));
+ submenu = new QMenu(tr("Prepare a Filter"));
+ ctx_menu_.addMenu(submenu);
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected"));
+ submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected"));
+ submenu = new QMenu(tr("Colorize with Filter"));
+ ctx_menu_.addMenu(submenu);
+// " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
+// " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
+// " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
+// " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
+// " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
+// " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
+// " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
+// " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
+// " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
+// " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
+// " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
+// " </menu>\n"
+// " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
+// " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
+// " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
+ ctx_menu_.addSeparator();
+ submenu = new QMenu(tr("Copy"));
+ ctx_menu_.addMenu(submenu);
+ submenu->addAction(window()->findChild<QAction *>("actionEditCopyDescription"));
+ submenu->addAction(window()->findChild<QAction *>("actionEditCopyFieldName"));
+ submenu->addAction(window()->findChild<QAction *>("actionEditCopyValue"));
+ submenu->addSeparator();
+ submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter"));
+ subsubmenu = new QMenu(tr("Bytes"));
+ submenu->addMenu(subsubmenu);
+ subsubmenu->addSeparator();
+// " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
+// " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
+// " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
+// " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
+// " <separator/>\n"
+// " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
+// " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
+// " </menu>\n"
+// " </menu>\n"
+// " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
+ ctx_menu_.addSeparator();
+// " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
+// " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
+// " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
+// " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
+ ctx_menu_.addSeparator();
+// " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
+// " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
+// " <menuitem name='ResolveName' action='/ResolveName'/>\n"
+// " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
+
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(updateSelectionStatus(QTreeWidgetItem*)));
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expand(QModelIndex)));
@@ -167,6 +242,11 @@ void ProtoTree::clear() {
QTreeWidget::clear();
}
+void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
+{
+ ctx_menu_.exec(event->globalPos());
+}
+
void ProtoTree::fillProtocolTree(proto_tree *protocol_tree) {
clear();
setFont(wsApp->monospaceFont());
diff --git a/ui/qt/proto_tree.h b/ui/qt/proto_tree.h
index 9ac95e05f0..bd18ae4f58 100644
--- a/ui/qt/proto_tree.h
+++ b/ui/qt/proto_tree.h
@@ -29,6 +29,7 @@
#include <epan/proto.h>
#include <QTreeWidget>
+#include <QMenu>
Q_DECLARE_METATYPE(field_info *)
@@ -40,7 +41,11 @@ public:
void fillProtocolTree(proto_tree *protocol_tree);
void clear();
+protected:
+ void contextMenuEvent(QContextMenuEvent *event);
+
private:
+ QMenu ctx_menu_;
signals:
void protoItemSelected(QString &);
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 5eb69dc5c1..667ed35751 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -415,6 +415,12 @@ void WiresharkApplication::allSystemsGo()
}
}
+void WiresharkApplication::applyAllPreferences()
+{
+ prefs_apply_all();
+ emit updatePreferences();
+}
+
QList<recent_item_status *> WiresharkApplication::recentItems() const {
return recent_items;
}
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index a050e30270..68f991b019 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -60,6 +60,7 @@ public:
void registerUpdate(register_action_e action, const char *message);
void allSystemsGo();
+ void applyAllPreferences();
QList<recent_item_status *> recentItems() const;
void addRecentItem(const QString &filename, qint64 size, bool accessible);
#ifdef HAVE_LIBPCAP
@@ -86,6 +87,7 @@ signals:
void openCaptureFile(QString &cf_path);
void updateRecentItemStatus(const QString &filename, qint64 size, bool accessible);
void splashUpdate(register_action_e action, const char *message);
+ void updatePreferences();
#ifdef HAVE_LIBPCAP
// XXX It might make more sense to move these to main.cpp or main_window.cpp or their own class.