Saving printing preferences from one print window to another

Bug: 14961
Change-Id: I324ac7526da29dca0b484b4dec6d1732e6247d66
Reviewed-on: https://code.wireshark.org/review/32953
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Luke Lynch 2019-04-22 21:19:40 -04:00 committed by Anders Broman
parent 8a112f219a
commit 57c5015a6b
4 changed files with 188 additions and 172 deletions

View File

@ -228,7 +228,7 @@ static void plugin_if_mainwindow_get_ws_info(GHashTable * data_set)
static void plugin_if_mainwindow_update_toolbars(GHashTable * data_set)
{
if (!gbl_cur_main_window_ || ! data_set)
if (!gbl_cur_main_window_ || !data_set)
return;
if (g_hash_table_lookup_extended(data_set, "toolbar_name", NULL, NULL)) {
@ -284,6 +284,7 @@ MainWindow::MainWindow(QWidget *parent) :
capture_filter_valid_(false)
#ifdef HAVE_LIBPCAP
, capture_interfaces_dialog_(NULL)
, pdlg_(NULL)
, info_data_()
#endif
, display_filter_dlg_(NULL)
@ -298,10 +299,10 @@ MainWindow::MainWindow(QWidget *parent) :
#endif
{
if (!gbl_cur_main_window_) {
connect(wsApp, SIGNAL(openStatCommandDialog(QString,const char*,void*)),
this, SLOT(openStatCommandDialog(QString,const char*,void*)));
connect(wsApp, SIGNAL(openTapParameterDialog(QString,const QString,void*)),
this, SLOT(openTapParameterDialog(QString,const QString,void*)));
connect(wsApp, SIGNAL(openStatCommandDialog(QString, const char*, void*)),
this, SLOT(openStatCommandDialog(QString, const char*, void*)));
connect(wsApp, SIGNAL(openTapParameterDialog(QString, const QString, void*)),
this, SLOT(openTapParameterDialog(QString, const QString, void*)));
}
gbl_cur_main_window_ = this;
#ifdef HAVE_LIBPCAP
@ -337,8 +338,8 @@ MainWindow::MainWindow(QWidget *parent) :
qRegisterMetaType<FilterAction::Action>("FilterAction::Action");
qRegisterMetaType<FilterAction::ActionType>("FilterAction::ActionType");
connect(this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SLOT(queuedFilterAction(QString,FilterAction::Action,FilterAction::ActionType)),
connect(this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SLOT(queuedFilterAction(QString, FilterAction::Action, FilterAction::ActionType)),
Qt::QueuedConnection);
//To prevent users use features before initialization complete
@ -376,7 +377,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(pushFilterSyntaxStatus(const QString&)),
main_ui_->statusBar, SLOT(pushFilterStatus(const QString&)));
connect(df_edit, SIGNAL(popFilterSyntaxStatus()), main_ui_->statusBar, SLOT(popFilterStatus()));
connect(df_edit, SIGNAL(filterPackets(QString,bool)), this, SLOT(filterPackets(QString,bool)));
connect(df_edit, SIGNAL(filterPackets(QString, bool)), this, SLOT(filterPackets(QString, bool)));
connect(df_edit, SIGNAL(showPreferencesDialog(QString)),
this, SLOT(showPreferencesDialog(QString)));
connect(wsApp, SIGNAL(preferencesChanged()), df_edit, SLOT(checkFilter()));
@ -385,8 +386,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(textChanged(QString)), funnel_statistics_, SLOT(displayFilterTextChanged(QString)));
connect(funnel_statistics_, SIGNAL(setDisplayFilter(QString)), df_edit, SLOT(setText(QString)));
connect(funnel_statistics_, SIGNAL(applyDisplayFilter()), df_combo_box_, SLOT(applyDisplayFilter()));
connect(funnel_statistics_, SIGNAL(openCaptureFile(QString,QString)),
this, SLOT(openCaptureFile(QString,QString)));
connect(funnel_statistics_, SIGNAL(openCaptureFile(QString, QString)),
this, SLOT(openCaptureFile(QString, QString)));
connect(this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
file_set_dialog_ = new FileSetDialog(this);
@ -410,8 +411,8 @@ MainWindow::MainWindow(QWidget *parent) :
#if defined(HAVE_LIBNL) && defined(HAVE_NL80211)
connect(wireless_frame_, SIGNAL(pushAdapterStatus(const QString&)),
main_ui_->statusBar, SLOT(pushTemporaryStatus(const QString&)));
connect (wireless_frame_, SIGNAL(showWirelessPreferences(QString)),
this, SLOT(showPreferencesDialog(QString)));
connect(wireless_frame_, SIGNAL(showWirelessPreferences(QString)),
this, SLOT(showPreferencesDialog(QString)));
#endif
main_ui_->goToFrame->hide();
@ -483,8 +484,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SIGNAL(frameSelected(int)));
connect(this, SIGNAL(frameSelected(int)),
this, SLOT(setMenusForSelectedPacket()));
connect(packet_list_->packetListModel(), SIGNAL(bgColorizationProgress(int,int)),
main_ui_->wirelessTimelineWidget, SLOT(bgColorizationProgress(int,int)));
connect(packet_list_->packetListModel(), SIGNAL(bgColorizationProgress(int, int)),
main_ui_->wirelessTimelineWidget, SLOT(bgColorizationProgress(int, int)));
proto_tree_ = new ProtoTree(&master_split_);
proto_tree_->installEventFilter(this);
@ -625,8 +626,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(showPreferencesDialog(QString)));
connect(packet_list_, SIGNAL(showProtocolPreferences(QString)),
this, SLOT(showPreferencesDialog(QString)));
connect(packet_list_, SIGNAL(editProtocolPreference(preference*,pref_module*)),
main_ui_->preferenceEditorFrame, SLOT(editPreference(preference*,pref_module*)));
connect(packet_list_, SIGNAL(editProtocolPreference(preference*, pref_module*)),
main_ui_->preferenceEditorFrame, SLOT(editPreference(preference*, pref_module*)));
connect(packet_list_, SIGNAL(editColumn(int)), this, SLOT(showColumnEditor(int)));
connect(main_ui_->columnEditorFrame, SIGNAL(columnEdited()),
packet_list_, SLOT(columnsChanged()));
@ -638,8 +639,8 @@ MainWindow::MainWindow(QWidget *parent) :
main_ui_->statusBar, SLOT(pushBusyStatus(QString)));
connect(packet_list_->packetListModel(), SIGNAL(popBusyStatus()),
main_ui_->statusBar, SLOT(popBusyStatus()));
connect(packet_list_->packetListModel(), SIGNAL(pushProgressStatus(QString,bool,bool,gboolean*)),
main_ui_->statusBar, SLOT(pushProgressStatus(QString,bool,bool,gboolean*)));
connect(packet_list_->packetListModel(), SIGNAL(pushProgressStatus(QString, bool, bool, gboolean*)),
main_ui_->statusBar, SLOT(pushProgressStatus(QString, bool, bool, gboolean*)));
connect(packet_list_->packetListModel(), SIGNAL(updateProgressStatus(int)),
main_ui_->statusBar, SLOT(updateProgressStatus(int)));
connect(packet_list_->packetListModel(), SIGNAL(popProgressStatus()),
@ -649,8 +650,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(openPacketDialog(bool)));
connect(proto_tree_, SIGNAL(showProtocolPreferences(QString)),
this, SLOT(showPreferencesDialog(QString)));
connect(proto_tree_, SIGNAL(editProtocolPreference(preference*,pref_module*)),
main_ui_->preferenceEditorFrame, SLOT(editPreference(preference*,pref_module*)));
connect(proto_tree_, SIGNAL(editProtocolPreference(preference*, pref_module*)),
main_ui_->preferenceEditorFrame, SLOT(editPreference(preference*, pref_module*)));
connect(main_ui_->statusBar, SIGNAL(showExpertInfo()),
this, SLOT(on_actionAnalyzeExpertInfo_triggered()));
@ -670,8 +671,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(main_ui_->welcomePage, SIGNAL(captureFilterSyntaxChanged(bool)),
this, SLOT(captureFilterSyntaxChanged(bool)));
connect(this->welcome_page_, SIGNAL(showExtcapOptions(QString&)),
this, SLOT(showExtcapOptionsDialog(QString&)));
connect(this->welcome_page_, SIGNAL(showExtcapOptions(QString&)),
this, SLOT(showExtcapOptionsDialog(QString&)));
#endif // HAVE_LIBPCAP
@ -728,14 +729,14 @@ QMenu *MainWindow::createPopupMenu()
if (!main_ui_->menuInterfaceToolbars->actions().isEmpty()) {
QMenu *submenu = menu->addMenu(main_ui_->menuInterfaceToolbars->title());
foreach (QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
foreach(QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
submenu->addAction(action);
}
}
if (!main_ui_->menuAdditionalToolbars->actions().isEmpty()) {
QMenu *subMenu = menu->addMenu(main_ui_->menuAdditionalToolbars->title());
foreach (QAction *action, main_ui_->menuAdditionalToolbars->actions()) {
foreach(QAction *action, main_ui_->menuAdditionalToolbars->actions()) {
subMenu->addAction(action);
}
}
@ -752,7 +753,7 @@ QMenu *MainWindow::createPopupMenu()
void MainWindow::addInterfaceToolbar(const iface_toolbar *toolbar_entry)
{
QMenu *menu = main_ui_->menuInterfaceToolbars;
bool visible = g_list_find_custom(recent.interface_toolbars, toolbar_entry->menu_title, (GCompareFunc) strcmp) ? true : false;
bool visible = g_list_find_custom(recent.interface_toolbars, toolbar_entry->menu_title, (GCompareFunc)strcmp) ? true : false;
QString title = QString().fromUtf8(toolbar_entry->menu_title);
QAction *action = new QAction(title, menu);
@ -762,7 +763,7 @@ void MainWindow::addInterfaceToolbar(const iface_toolbar *toolbar_entry)
action->setToolTip(tr("Show or hide the toolbar"));
QAction *before = NULL;
foreach (QAction *action, menu->actions()) {
foreach(QAction *action, menu->actions()) {
// Ensure we add the menu entries in sorted order
if (action->text().compare(title, Qt::CaseInsensitive) > 0) {
before = action;
@ -799,7 +800,7 @@ void MainWindow::removeInterfaceToolbar(const gchar *menu_title)
QMap<QAction *, QWidget *>::iterator i;
QString title = QString().fromUtf8(menu_title);
foreach (action, menu->actions()) {
foreach(action, menu->actions()) {
if (title.compare(action->text()) == 0) {
break;
}
@ -924,12 +925,13 @@ void MainWindow::closeEvent(QCloseEvent *event) {
#ifdef HAVE_LIBPCAP
if (capture_interfaces_dialog_) capture_interfaces_dialog_->close();
if (pdlg_) pdlg_->close();
#endif
// Make sure we kill any open dumpcap processes.
delete welcome_page_;
// One of the many places we assume one main window.
if(!wsApp->isInitialized()) {
if (!wsApp->isInitialized()) {
// If we're still initializing, QCoreApplication::quit() won't
// exit properly because we are not in the event loop. This
// means that the application won't clean up after itself. We
@ -960,7 +962,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
}
bool have_files = false;
foreach (QUrl drag_url, event->mimeData()->urls()) {
foreach(QUrl drag_url, event->mimeData()->urls()) {
if (!drag_url.toLocalFile().isEmpty()) {
have_files = true;
break;
@ -977,7 +979,7 @@ void MainWindow::dropEvent(QDropEvent *event)
QList<QByteArray> local_files;
int max_dropped_files = 100; // Arbitrary
foreach (QUrl drop_url, event->mimeData()->urls()) {
foreach(QUrl drop_url, event->mimeData()->urls()) {
QString drop_file = drop_url.toLocalFile();
if (!drop_file.isEmpty()) {
local_files << drop_file.toUtf8();
@ -1001,7 +1003,7 @@ void MainWindow::dropEvent(QDropEvent *event)
return;
}
char **in_filenames = (char **) g_malloc(sizeof(char*) * local_files.size());
char **in_filenames = (char **)g_malloc(sizeof(char*) * local_files.size());
char *tmpname = NULL;
for (int i = 0; i < local_files.size(); i++) {
@ -1052,7 +1054,7 @@ void MainWindow::loadWindowGeometry()
}
// if (prefs.gui_geometry_save_position) {
move(recent_geom.topLeft());
move(recent_geom.topLeft());
// }
if (// prefs.gui_geometry_save_size &&
@ -1407,7 +1409,7 @@ bool MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
/* If the file has comments, does the format the user selected
support them? If not, ask the user whether they want to
discard the comments or choose a different format. */
switch(save_as_dlg.saveAs(file_name, must_support_comments)) {
switch (save_as_dlg.saveAs(file_name, must_support_comments)) {
case SAVE:
/* The file can be saved in the specified format as is;
@ -1512,7 +1514,7 @@ void MainWindow::exportSelectedPackets() {
/* If the file has comments, does the format the user selected
support them? If not, ask the user whether they want to
discard the comments or choose a different format. */
switch(esp_dlg.exportSelectedPackets(file_name, &range)) {
switch (esp_dlg.exportSelectedPackets(file_name, &range)) {
case SAVE:
/* The file can be saved in the specified format as is;
@ -1886,7 +1888,7 @@ bool MainWindow::testCaptureFileClose(QString before_what, FileCloseContext cont
if (capture_file_.capFile() && saveCaptureFile(capture_file_.capFile(), true) == false)
return false;
do_close_file = true;
} else if(msg_dialog.clickedButton() == discard_button) {
} else if (msg_dialog.clickedButton() == discard_button) {
/* Just close the file, discarding changes */
do_close_file = true;
} else {
@ -1941,7 +1943,7 @@ bool MainWindow::testCaptureFileClose(QString before_what, FileCloseContext cont
void MainWindow::captureStop() {
stopCapture();
while(capture_file_.capFile() && capture_file_.capFile()->state == FILE_READ_IN_PROGRESS) {
while (capture_file_.capFile() && capture_file_.capFile()->state == FILE_READ_IN_PROGRESS) {
WiresharkApplication::processEvents();
}
}
@ -2019,7 +2021,7 @@ void MainWindow::initShowHideMainWidgets()
shmw_actions[main_ui_->actionViewPacketDetails] = proto_tree_;
shmw_actions[main_ui_->actionViewPacketBytes] = byte_view_tab_;
foreach (QAction *shmwa, shmw_actions.keys()) {
foreach(QAction *shmwa, shmw_actions.keys()) {
shmwa->setData(QVariant::fromValue(shmw_actions[shmwa]));
show_hide_actions_->addAction(shmwa);
showHideMainWidgets(shmwa);
@ -2053,7 +2055,7 @@ void MainWindow::initTimeDisplayFormatMenu()
td_actions[main_ui_->actionViewTimeDisplayFormatUTCDateYDOYandTimeOfDay] = TS_UTC_WITH_YDOY;
td_actions[main_ui_->actionViewTimeDisplayFormatUTCTimeOfDay] = TS_UTC;
foreach (QAction* tda, td_actions.keys()) {
foreach(QAction* tda, td_actions.keys()) {
tda->setData(QVariant::fromValue(td_actions[tda]));
time_display_actions_->addAction(tda);
}
@ -2077,7 +2079,7 @@ void MainWindow::initTimePrecisionFormatMenu()
tp_actions[main_ui_->actionViewTimeDisplayFormatPrecisionMicroseconds] = TS_PREC_FIXED_USEC;
tp_actions[main_ui_->actionViewTimeDisplayFormatPrecisionNanoseconds] = TS_PREC_FIXED_NSEC;
foreach (QAction* tpa, tp_actions.keys()) {
foreach(QAction* tpa, tp_actions.keys()) {
tpa->setData(QVariant::fromValue(tp_actions[tpa]));
time_precision_actions_->addAction(tpa);
}
@ -2101,7 +2103,7 @@ void MainWindow::initFreezeActions()
<< main_ui_->actionEditSetTimeReference
<< main_ui_->actionEditUnsetAllTimeReferences;
foreach (QAction *action, freeze_actions) {
foreach(QAction *action, freeze_actions) {
freeze_actions_ << QPair<QAction *, bool>(action, false);
}
}
@ -2132,7 +2134,7 @@ void MainWindow::initConversationMenus()
QMenu *submenu = packet_list_->colorizeMenu()->addMenu(conv_action->text());
i = 1;
foreach (QAction *cc_action, cc_actions) {
foreach(QAction *cc_action, cc_actions) {
conv_action = new ConversationAction(submenu, conv_filter);
conv_action->setText(cc_action->text());
conv_action->setIcon(cc_action->icon());
@ -2155,7 +2157,7 @@ void MainWindow::initConversationMenus()
// Proto tree colorization items
i = 1;
ColorizeAction *colorize_action;
foreach (QAction *cc_action, cc_actions) {
foreach(QAction *cc_action, cc_actions) {
colorize_action = new ColorizeAction(proto_tree_->colorizeMenu());
colorize_action->setText(cc_action->text());
colorize_action->setIcon(cc_action->icon());
@ -2208,7 +2210,7 @@ void MainWindow::setTitlebarForCaptureFile()
// "proxy icon".
//
setWindowFilePath(capture_file_.filePath());
}
}
setWindowModified(cf_has_unsaved_data(capture_file_.capFile()));
} else {
/* We have no capture file. */
@ -2343,7 +2345,7 @@ void MainWindow::setMenusForCaptureFile(bool force_disable)
main_ui_->actionFileExportPDU->setEnabled(enable);
main_ui_->actionFileExportTLSSessionKeys->setEnabled(enable);
foreach (QAction *eo_action, main_ui_->menuFileExportObjects->actions()) {
foreach(QAction *eo_action, main_ui_->menuFileExportObjects->actions()) {
eo_action->setEnabled(enable);
}
@ -2373,7 +2375,7 @@ void MainWindow::setMenusForCaptureInProgress(bool capture_in_progress) {
main_ui_->actionFileExportPDU->setEnabled(!capture_in_progress);
main_ui_->actionFileExportTLSSessionKeys->setEnabled(capture_in_progress);
foreach (QAction *eo_action, main_ui_->menuFileExportObjects->actions()) {
foreach(QAction *eo_action, main_ui_->menuFileExportObjects->actions()) {
eo_action->setEnabled(capture_in_progress);
}
@ -2477,12 +2479,12 @@ void MainWindow::changeEvent(QEvent* event)
// make sure that the "Clear Menu" item is retranslated
wsApp->emitAppSignal(WiresharkApplication::RecentCapturesChanged);
break;
case QEvent::LocaleChange:{
case QEvent::LocaleChange: {
QString locale = QLocale::system().name();
locale.truncate(locale.lastIndexOf('_'));
wsApp->loadLanguage(locale);
}
break;
}
break;
case QEvent::WindowStateChange:
main_ui_->actionViewFullScreen->setChecked(this->isFullScreen());
break;
@ -2510,7 +2512,7 @@ void MainWindow::setForCaptureInProgress(bool capture_in_progress, GArray *iface
#endif
QList<InterfaceToolbar *> toolbars = findChildren<InterfaceToolbar *>();
foreach (InterfaceToolbar *toolbar, toolbars) {
foreach(InterfaceToolbar *toolbar, toolbars) {
if (capture_in_progress) {
toolbar->startCapture(ifaces);
} else {
@ -2537,7 +2539,7 @@ static QList<register_stat_group_t> menu_groups = QList<register_stat_group_t>()
void MainWindow::addMenuActions(QList<QAction *> &actions, int menu_group)
{
foreach (QAction *action, actions) {
foreach(QAction *action, actions) {
switch (menu_group) {
case REGISTER_ANALYZE_GROUP_UNSORTED:
case REGISTER_STAT_GROUP_UNSORTED:
@ -2602,7 +2604,7 @@ void MainWindow::addMenuActions(QList<QAction *> &actions, int menu_group)
}
void MainWindow::removeMenuActions(QList<QAction *> &actions, int menu_group)
{
foreach (QAction *action, actions) {
foreach(QAction *action, actions) {
switch (menu_group) {
case REGISTER_ANALYZE_GROUP_UNSORTED:
case REGISTER_STAT_GROUP_UNSORTED:
@ -2658,7 +2660,7 @@ void MainWindow::addDynamicMenus()
wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY, main_ui_->actionTelephonySipFlows);
// Fill in each menu
foreach (register_stat_group_t menu_group, menu_groups) {
foreach(register_stat_group_t menu_group, menu_groups) {
QList<QAction *>actions = wsApp->dynamicMenuGroupItems(menu_group);
addMenuActions(actions, menu_group);
}
@ -2682,7 +2684,7 @@ void MainWindow::addDynamicMenus()
void MainWindow::reloadDynamicMenus()
{
foreach (register_stat_group_t menu_group, menu_groups) {
foreach(register_stat_group_t menu_group, menu_groups) {
QList<QAction *>actions = wsApp->removedMenuGroupItems(menu_group);
removeMenuActions(actions, menu_group);
@ -2709,7 +2711,7 @@ void MainWindow::externalMenuHelper(ext_menu_t * menu, QMenu * subMenu, gint de
children = menu->children;
/* Iterate the child entries */
while (children && children->data) {
item = (ext_menubar_t *) children->data;
item = (ext_menubar_t *)children->data;
if (item->type == EXT_MENUBAR_MENU) {
/* Handle Submenu entry */
@ -2737,7 +2739,7 @@ QMenu * MainWindow::searchSubMenu(QString objectName)
QString searchName = QString("menu") + objectName;
lst = main_ui_->menuBar->findChildren<QMenu*>();
foreach (QMenu* m, lst) {
foreach(QMenu* m, lst) {
if (QString::compare(m->objectName(), searchName) == 0)
return m;
}
@ -2752,7 +2754,7 @@ void MainWindow::addPluginIFStructures()
while (user_menu && user_menu->data) {
QMenu *subMenu = NULL;
ext_menu_t *menu = (ext_menu_t *) user_menu->data;
ext_menu_t *menu = (ext_menu_t *)user_menu->data;
/* On this level only menu items should exist. Not doing an assert here,
* as it could be an honest mistake */
@ -2776,7 +2778,7 @@ void MainWindow::addPluginIFStructures()
this->externalMenuHelper(menu, subMenu, 0);
/* Iterate Loop */
user_menu = g_list_next (user_menu);
user_menu = g_list_next(user_menu);
}
int cntToolbars = 0;
@ -2784,14 +2786,14 @@ void MainWindow::addPluginIFStructures()
QMenu *tbMenu = main_ui_->menuAdditionalToolbars;
GList *if_toolbars = ext_toolbar_get_entries();
while (if_toolbars && if_toolbars->data) {
ext_toolbar_t *toolbar = (ext_toolbar_t*) if_toolbars->data;
ext_toolbar_t *toolbar = (ext_toolbar_t*)if_toolbars->data;
if (toolbar->type != EXT_TOOLBAR_BAR) {
if_toolbars = g_list_next (if_toolbars);
if_toolbars = g_list_next(if_toolbars);
continue;
}
bool visible = g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc) strcmp) ? true : false;
bool visible = g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc)strcmp) ? true : false;
AdditionalToolBar *ifToolBar = AdditionalToolBar::create(this, toolbar);
@ -2808,7 +2810,7 @@ void MainWindow::addPluginIFStructures()
QAction *before = 0;
foreach (QAction *action, tbMenu->actions()) {
foreach(QAction *action, tbMenu->actions()) {
/* Ensure we add the menu entries in sorted order */
if (action->text().compare(toolbar->name, Qt::CaseInsensitive) > 0) {
before = action;
@ -2827,7 +2829,7 @@ void MainWindow::addPluginIFStructures()
cntToolbars++;
}
if_toolbars = g_list_next (if_toolbars);
if_toolbars = g_list_next(if_toolbars);
}
if (cntToolbars)
@ -2844,7 +2846,7 @@ void MainWindow::removeAdditionalToolbar(QString toolbarName)
AdditionalToolBar *ifToolBar = dynamic_cast<AdditionalToolBar *>(tb);
if (ifToolBar && ifToolBar->menuName().compare(toolbarName)) {
GList *entry = g_list_find_custom(recent.gui_additional_toolbars, qUtf8Printable(ifToolBar->menuName()), (GCompareFunc) strcmp);
GList *entry = g_list_find_custom(recent.gui_additional_toolbars, qUtf8Printable(ifToolBar->menuName()), (GCompareFunc)strcmp);
if (entry) {
recent.gui_additional_toolbars = g_list_remove(recent.gui_additional_toolbars, entry->data);
}

View File

@ -68,6 +68,7 @@
#include "capture_file.h"
#include "capture_file_dialog.h"
#include "print_dialog.h"
#include "capture_file_properties_dialog.h"
#include <ui/qt/utils/field_information.h>
#include <ui/qt/widgets/display_filter_combo.h>
@ -78,6 +79,7 @@
class AccordionFrame;
class ByteViewTab;
class CaptureInterfacesDialog;
class PrintDialog;
class FileSetDialog;
class FilterDialog;
class FunnelStatistics;
@ -200,6 +202,7 @@ private:
#ifdef HAVE_LIBPCAP
capture_session cap_session_;
CaptureInterfacesDialog *capture_interfaces_dialog_;
PrintDialog *pdlg_;
info_data_t info_data_;
#endif
FilterDialog *display_filter_dlg_;

View File

@ -217,7 +217,7 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned
} else {
/* Not valid. Tell the user, and go back and run the file
selection box again once they dismiss the alert. */
//bad_dfilter_alert_box(top_level, read_filter->str);
//bad_dfilter_alert_box(top_level, read_filter->str);
QMessageBox::warning(this, tr("Invalid Display Filter"),
QString("The filter expression ") +
read_filter +
@ -330,9 +330,9 @@ void MainWindow::layoutToolbars()
#endif
main_ui_->statusBar->setVisible(recent.statusbar_show);
foreach (QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
foreach(QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
QToolBar *toolbar = action->data().value<QToolBar *>();
if (g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc) strcmp)) {
if (g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc)strcmp)) {
toolbar->setVisible(true);
} else {
toolbar->setVisible(false);
@ -340,11 +340,11 @@ void MainWindow::layoutToolbars()
}
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
foreach (QToolBar *bar, toolbars) {
foreach(QToolBar *bar, toolbars) {
AdditionalToolBar *iftoolbar = dynamic_cast<AdditionalToolBar *>(bar);
if (iftoolbar) {
bool visible = false;
if (g_list_find_custom(recent.gui_additional_toolbars, qUtf8Printable(iftoolbar->menuName()), (GCompareFunc) strcmp))
if (g_list_find_custom(recent.gui_additional_toolbars, qUtf8Printable(iftoolbar->menuName()), (GCompareFunc)strcmp))
visible = true;
iftoolbar->setVisible(visible);
@ -377,29 +377,29 @@ void MainWindow::updateRecentActions()
main_ui_->actionViewPacketDetails->setChecked(recent.tree_view_show && prefs_has_layout_pane_content(layout_pane_content_pdetails));
main_ui_->actionViewPacketBytes->setChecked(recent.byte_view_show && prefs_has_layout_pane_content(layout_pane_content_pbytes));
foreach (QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
if (g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc) strcmp)) {
foreach(QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
if (g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc)strcmp)) {
action->setChecked(true);
} else {
action->setChecked(false);
}
}
foreach (QAction * action, main_ui_->menuAdditionalToolbars->actions()) {
foreach(QAction * action, main_ui_->menuAdditionalToolbars->actions()) {
ext_toolbar_t * toolbar = VariantPointer<ext_toolbar_t>::asPtr(action->data());
bool checked = false;
if (toolbar && g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc) strcmp))
if (toolbar && g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc)strcmp))
checked = true;
action->setChecked(checked);
}
foreach (QAction* tda, td_actions.keys()) {
foreach(QAction* tda, td_actions.keys()) {
if (recent.gui_time_format == td_actions[tda]) {
tda->setChecked(true);
}
}
foreach (QAction* tpa, tp_actions.keys()) {
foreach(QAction* tpa, tp_actions.keys()) {
if (recent.gui_time_precision == tp_actions[tpa]) {
tpa->setChecked(true);
break;
@ -425,7 +425,8 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
case FilterAction::ActionTypeAnd:
if (cur_filter.length()) {
new_filter = "(" + cur_filter + ") && (" + action_filter + ")";
} else {
}
else {
new_filter = action_filter;
}
break;
@ -458,7 +459,7 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
break;
}
switch(action) {
switch (action) {
case FilterAction::ActionApply:
df_combo_box_->lineEdit()->setText(new_filter);
df_combo_box_->applyDisplayFilter();
@ -788,7 +789,7 @@ void MainWindow::captureFileClosing() {
main_ui_->statusBar->captureFileClosing();
main_ui_->searchFrame->animatedHide();
main_ui_->goToFrame->animatedHide();
// gtk_widget_show(expert_info_none);
// gtk_widget_show(expert_info_none);
emit setCaptureFile(NULL);
emit setDissectedCaptureFile(NULL);
}
@ -827,7 +828,7 @@ void MainWindow::startCapture() {
guint i;
/* did the user ever select a capture interface before? */
if(global_capture_opts.num_selected == 0) {
if (global_capture_opts.num_selected == 0) {
QString msg = QString(tr("No interface selected"));
main_ui_->statusBar->pushTemporaryStatus(msg);
main_ui_->actionCaptureStart->setChecked(false);
@ -837,7 +838,7 @@ void MainWindow::startCapture() {
// Ideally we should have disabled the start capture
// toolbar buttons and menu items. This may not be the
// case, e.g. with QtMacExtras.
if(!capture_filter_valid_) {
if (!capture_filter_valid_) {
QString msg = QString(tr("Invalid capture filter"));
main_ui_->statusBar->pushTemporaryStatus(msg);
main_ui_->actionCaptureStart->setChecked(false);
@ -850,10 +851,10 @@ void MainWindow::startCapture() {
/* XXX - can this ever happen? */
if (cap_session_.state != CAPTURE_STOPPED)
return;
return;
/* close the currently loaded capture file */
cf_close((capture_file *) cap_session_.cf);
cf_close((capture_file *)cap_session_.cf);
/* Copy the selected interfaces to the set of interfaces to use for
this capture. */
@ -867,7 +868,7 @@ void MainWindow::startCapture() {
/* Add "interface name<live capture in progress>" on main status bar */
interface_names = get_iface_list_string(capture_opts, 0);
if (strlen (interface_names->str) > 0) {
if (strlen(interface_names->str) > 0) {
g_string_append(interface_names, ":");
}
g_string_append(interface_names, " ");
@ -892,8 +893,8 @@ void MainWindow::startCapture() {
the same as the one the other interfaces we've looked
at have? */
if (strcmp(interface_opts->cfilter, filter_ba.constData()) != 0) {
/* No, so not all selected interfaces have the same capture
filter. */
/* No, so not all selected interfaces have the same capture
filter. */
filter_ba.clear();
}
}
@ -919,12 +920,12 @@ void MainWindow::pipeTimeout() {
/* try to read data from the pipe only 5 times, to avoid blocking */
while(iterations < 5) {
while (iterations < 5) {
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: new iteration");*/
/* Oddly enough although Named pipes don't work on win9x,
PeekNamedPipe does !!! */
handle = (HANDLE) _get_osfhandle (pipe_source_);
handle = (HANDLE)_get_osfhandle(pipe_source_);
result = PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL);
/* Get the child process exit status */
@ -945,8 +946,7 @@ void MainWindow::pipeTimeout() {
delete pipe_timer_;
return;
}
}
else {
} else {
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: no data avail");*/
/* No data, stop now */
break;
@ -966,7 +966,8 @@ void MainWindow::pipeActivated(int source) {
pipe_notifier_->setEnabled(false);
if (pipe_input_cb_(pipe_source_, pipe_user_data_)) {
pipe_notifier_->setEnabled(true);
} else {
}
else {
delete pipe_notifier_;
}
#endif // _WIN32
@ -1042,7 +1043,7 @@ void MainWindow::updateRecentCaptures() {
/* Iterate through the actions in menuOpenRecentCaptureFile,
* removing special items, a maybe duplicate entry and every item above count_max */
int shortcut = Qt::Key_0;
foreach (recent_item_status *ri, wsApp->recentItems()) {
foreach(recent_item_status *ri, wsApp->recentItems()) {
// Add the new item
ra = new QAction(recentMenu);
ra->setData(ri->filename);
@ -1222,7 +1223,7 @@ void MainWindow::setMenusForSelectedPacket()
main_ui_->actionAnalyzeFollowTLSStream->setEnabled(is_tls);
main_ui_->actionAnalyzeFollowHTTPStream->setEnabled(is_http);
foreach (QAction *cc_action, cc_actions) {
foreach(QAction *cc_action, cc_actions) {
cc_action->setEnabled(frame_selected);
}
main_ui_->actionViewColorizeNewColoringRule->setEnabled(frame_selected);
@ -1265,7 +1266,7 @@ void MainWindow::setMenusForSelectedTreeRow(FieldInformation *finfo) {
int field_id = -1;
field_info * fi = 0;
if ( finfo )
if (finfo)
fi = finfo->fieldInfo();
if (capture_file_.capFile()) {
@ -1343,16 +1344,16 @@ void MainWindow::setMenusForSelectedTreeRow(FieldInformation *finfo) {
main_ui_->actionContextFilterFieldReference->setEnabled(can_open_url);
// Only enable / disable the following items if we have focus so that we
// don't clobber anything we may have set in setMenusForSelectedPacket.
// Only enable / disable the following items if we have focus so that we
// don't clobber anything we may have set in setMenusForSelectedPacket.
if (!proto_tree_ || !proto_tree_->hasFocus()) return;
emit packetInfoChanged(capture_file_.packetInfo());
emit fieldFilterChanged(field_filter);
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
// frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
// gbl_resolv_flags.transport_name));
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
// frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
// gbl_resolv_flags.transport_name));
main_ui_->actionAnalyzeAAFSelected->setEnabled(can_match_selected);
main_ui_->actionAnalyzeAAFNotSelected->setEnabled(can_match_selected);
@ -1403,7 +1404,7 @@ void MainWindow::startInterfaceCapture(bool valid, const QString capture_filter)
void MainWindow::applyGlobalCommandLineOptions()
{
if (global_dissect_options.time_format != TS_NOT_SET) {
foreach (QAction* tda, td_actions.keys()) {
foreach(QAction* tda, td_actions.keys()) {
if (global_dissect_options.time_format == td_actions[tda]) {
tda->setChecked(true);
recent.gui_time_format = global_dissect_options.time_format;
@ -1490,7 +1491,7 @@ void MainWindow::showAccordionFrame(AccordionFrame *show_frame, bool toggle)
<< main_ui_->preferenceEditorFrame << main_ui_->filterExpressionFrame;
frame_list.removeAll(show_frame);
foreach (AccordionFrame *af, frame_list) af->animatedHide();
foreach(AccordionFrame *af, frame_list) af->animatedHide();
if (toggle) {
if (show_frame->isVisible()) {
@ -1525,7 +1526,7 @@ void MainWindow::initViewColorizeMenu()
guint8 color_num = 1;
foreach (QAction *cc_action, cc_actions) {
foreach(QAction *cc_action, cc_actions) {
cc_action->setData(color_num);
connect(cc_action, SIGNAL(triggered()), this, SLOT(colorizeConversation()));
@ -1585,7 +1586,7 @@ void MainWindow::setFeaturesEnabled(bool enabled)
main_ui_->menuBar->setEnabled(enabled);
main_ui_->mainToolBar->setEnabled(enabled);
main_ui_->displayFilterToolBar->setEnabled(enabled);
if(enabled)
if (enabled)
{
main_ui_->statusBar->clearMessage();
#ifdef HAVE_LIBPCAP
@ -1647,8 +1648,8 @@ void MainWindow::openTapParameterDialog(const QString cfg_str, const QString arg
TapParameterDialog *tp_dialog = TapParameterDialog::showTapParameterStatistics(*this, capture_file_, cfg_str, arg, userdata);
if (!tp_dialog) return;
connect(tp_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(tp_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(tp_dialog, SIGNAL(updateFilter(QString)),
df_combo_box_->lineEdit(), SLOT(setText(QString)));
tp_dialog->show();
@ -1774,10 +1775,10 @@ void MainWindow::on_actionFileExportPacketBytes_triggered()
if (!capture_file_.capFile() || !capture_file_.capFile()->finfo_selected) return;
file_name = WiresharkFileDialog::getSaveFileName(this,
wsApp->windowTitleString(tr("Export Selected Packet Bytes")),
wsApp->lastOpenDir().canonicalPath(),
tr("Raw data (*.bin *.dat *.raw);;All Files (" ALL_FILES_WILDCARD ")")
);
wsApp->windowTitleString(tr("Export Selected Packet Bytes")),
wsApp->lastOpenDir().canonicalPath(),
tr("Raw data (*.bin *.dat *.raw);;All Files (" ALL_FILES_WILDCARD ")")
);
if (file_name.length() > 0) {
const guint8 *data_p;
@ -1785,7 +1786,7 @@ void MainWindow::on_actionFileExportPacketBytes_triggered()
data_p = tvb_get_ptr(capture_file_.capFile()->finfo_selected->ds_tvb, 0, -1) +
capture_file_.capFile()->finfo_selected->start;
fd = ws_open(qUtf8Printable(file_name), O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
fd = ws_open(qUtf8Printable(file_name), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
if (fd == -1) {
open_failure_alert_box(qUtf8Printable(file_name), errno, TRUE);
return;
@ -1849,16 +1850,16 @@ void MainWindow::on_actionFileExportTLSSessionKeys_triggered()
save_title.append(wsApp->windowTitleString(tr("Export TLS Session Keys (%Ln key(s))", "", keylist_len)));
file_name = WiresharkFileDialog::getSaveFileName(this,
save_title,
wsApp->lastOpenDir().canonicalPath(),
tr("TLS Session Keys (*.keys *.txt);;All Files (" ALL_FILES_WILDCARD ")")
);
save_title,
wsApp->lastOpenDir().canonicalPath(),
tr("TLS Session Keys (*.keys *.txt);;All Files (" ALL_FILES_WILDCARD ")")
);
if (file_name.length() > 0) {
gchar *keylist;
int fd;
keylist = ssl_export_sessions();
fd = ws_open(qUtf8Printable(file_name), O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
fd = ws_open(qUtf8Printable(file_name), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
if (fd == -1) {
open_failure_alert_box(qUtf8Printable(file_name), errno, TRUE);
g_free(keylist);
@ -1896,8 +1897,16 @@ void MainWindow::on_actionFilePrint_triggered()
capture_file *cf = capture_file_.capFile();
g_return_if_fail(cf);
PrintDialog pdlg(this, cf);
pdlg.exec();
if (!pdlg_)
{
pdlg_ = new PrintDialog(this, cf);
}
else
{
pdlg_->cap_file_ = cf;
}
pdlg_->exec();
}
// Edit Menu
@ -1912,10 +1921,10 @@ void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type
field_info *finfo_selected = capture_file_.capFile()->finfo_selected;
switch(selection_type) {
switch (selection_type) {
case CopySelectedDescription:
if (finfo_selected && finfo_selected->rep
&& strlen (finfo_selected->rep->representation) > 0) {
&& strlen(finfo_selected->rep->representation) > 0) {
clip.append(finfo_selected->rep->representation);
}
break;
@ -1992,7 +2001,7 @@ void MainWindow::on_actionEditFindPacket_triggered()
}
previous_focus_ = wsApp->focusWidget();
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
if (! main_ui_->searchFrame->isVisible()) {
if (!main_ui_->searchFrame->isVisible()) {
showAccordionFrame(main_ui_->searchFrame, true);
}
main_ui_->searchFrame->setFocus();
@ -2098,7 +2107,7 @@ void MainWindow::on_actionEditTimeShift_triggered()
connect(this, SIGNAL(setCaptureFile(capture_file*)),
&ts_dialog, SLOT(setCaptureFile(capture_file*)));
connect(&ts_dialog, SIGNAL(timeShifted()), packet_list_, SLOT(applyTimeShift()));
ts_dialog.exec();
ts_dialog.exec();
if (capture_file_.capFile()->unsaved_changes) {
updateForUnsavedChanges();
}
@ -2176,7 +2185,7 @@ void MainWindow::showHideMainWidgets(QAction *action)
recent.filter_toolbar_show = show;
main_ui_->actionViewFilterToolbar->setChecked(show);
#if defined(HAVE_LIBNL) && defined(HAVE_NL80211)
} else if (widget == main_ui_->wirelessToolBar) {
} else if (widget == main_ui_->wirelessToolBar) {
recent.wireless_toolbar_show = show;
main_ui_->actionViewWirelessToolbar->setChecked(show);
#endif
@ -2193,10 +2202,10 @@ void MainWindow::showHideMainWidgets(QAction *action)
recent.byte_view_show = show;
main_ui_->actionViewPacketBytes->setChecked(show);
} else {
foreach (QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
foreach(QAction *action, main_ui_->menuInterfaceToolbars->actions()) {
QToolBar *toolbar = action->data().value<QToolBar *>();
if (widget == toolbar) {
GList *entry = g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc) strcmp);
GList *entry = g_list_find_custom(recent.interface_toolbars, action->text().toUtf8(), (GCompareFunc)strcmp);
if (show && !entry) {
recent.interface_toolbars = g_list_append(recent.interface_toolbars, g_strdup(action->text().toUtf8()));
} else if (!show && entry) {
@ -2208,7 +2217,7 @@ void MainWindow::showHideMainWidgets(QAction *action)
ext_toolbar_t * toolbar = VariantPointer<ext_toolbar_t>::asPtr(action->data());
if (toolbar) {
GList *entry = g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc) strcmp);
GList *entry = g_list_find_custom(recent.gui_additional_toolbars, toolbar->name, (GCompareFunc)strcmp);
if (show && !entry) {
recent.gui_additional_toolbars = g_list_append(recent.gui_additional_toolbars, g_strdup(toolbar->name));
} else if (!show && entry) {
@ -2217,7 +2226,7 @@ void MainWindow::showHideMainWidgets(QAction *action)
action->setChecked(show);
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
foreach (QToolBar *bar, toolbars) {
foreach(QToolBar *bar, toolbars) {
AdditionalToolBar *iftoolbar = dynamic_cast<AdditionalToolBar *>(bar);
if (iftoolbar && iftoolbar->menuName().compare(toolbar->name) == 0) {
iftoolbar->setVisible(show);
@ -2292,7 +2301,7 @@ void MainWindow::on_actionViewTimeDisplaySecondsWithHoursAndMinutes_triggered(bo
void MainWindow::on_actionViewEditResolvedName_triggered()
{
// int column = packet_list_->selectedColumn();
//int column = packet_list_->selectedColumn();
int column = -1;
if (packet_list_->currentIndex().isValid()) {
@ -2364,8 +2373,8 @@ void MainWindow::on_actionViewColoringRules_triggered()
ColoringRulesDialog coloring_rules_dialog(this);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
coloring_rules_dialog.exec();
}
@ -2388,8 +2397,8 @@ void MainWindow::colorizeConversation(bool create_rule)
ColoringRulesDialog coloring_rules_dialog(this, filter);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
coloring_rules_dialog.exec();
} else {
gchar *err_msg = NULL;
@ -2439,9 +2448,9 @@ void MainWindow::colorizeWithFilter(QByteArray filter, int color_number)
// New coloring rule
ColoringRulesDialog coloring_rules_dialog(window(), filter);
connect(&coloring_rules_dialog, SIGNAL(accepted()),
packet_list_, SLOT(recolorPackets()));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
packet_list_, SLOT(recolorPackets()));
connect(&coloring_rules_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
coloring_rules_dialog.exec();
}
main_ui_->actionViewColorizeResetColorization->setEnabled(tmp_color_filters_used());
@ -2484,7 +2493,7 @@ void MainWindow::openPacketDialog(bool from_reference)
frame_data * fdata;
/* Find the frame for which we're popping up a dialog */
if(from_reference) {
if (from_reference) {
guint32 framenum = fvalue_get_uinteger(&(capture_file_.capFile()->finfo_selected->value));
if (framenum == 0)
return;
@ -2581,7 +2590,7 @@ void MainWindow::matchFieldFilter(FilterAction::Action action, FilterAction::Act
field_filter = packet_list_->getFilterFromRowAndColumn();
} else if (capture_file_.capFile() && capture_file_.capFile()->finfo_selected) {
char *tmp_field = proto_construct_match_selected_string(capture_file_.capFile()->finfo_selected,
capture_file_.capFile()->edt);
capture_file_.capFile()->edt);
field_filter = QString(tmp_field);
wmem_free(NULL, tmp_field);
}
@ -2626,7 +2635,7 @@ void MainWindow::on_actionAnalyzeCreateAColumn_triggered()
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);
capture_file_.capFile()->finfo_selected->hfinfo->abbrev, 0);
packet_list_->columnsChanged();
packet_list_->resizeColumnToContents(colnr);
@ -2802,8 +2811,8 @@ void MainWindow::on_actionAnalyzeFollowHTTPStream_triggered()
void MainWindow::openSCTPAllAssocsDialog()
{
SCTPAllAssocsDialog *sctp_dialog = new SCTPAllAssocsDialog(this, capture_file_.capFile());
connect(sctp_dialog, SIGNAL(filterPackets(QString,bool)),
this, SLOT(filterPackets(QString,bool)));
connect(sctp_dialog, SIGNAL(filterPackets(QString, bool)),
this, SLOT(filterPackets(QString, bool)));
connect(this, SIGNAL(setCaptureFile(capture_file*)),
sctp_dialog, SLOT(setCaptureFile(capture_file*)));
sctp_dialog->fillTable();
@ -2833,8 +2842,8 @@ void MainWindow::on_actionSCTPAnalyseThisAssociation_triggered()
return;
}
SCTPAssocAnalyseDialog *sctp_analyse = new SCTPAssocAnalyseDialog(this, assoc, capture_file_.capFile());
connect(sctp_analyse, SIGNAL(filterPackets(QString,bool)),
this, SLOT(filterPackets(QString,bool)));
connect(sctp_analyse, SIGNAL(filterPackets(QString, bool)),
this, SLOT(filterPackets(QString, bool)));
if (sctp_analyse->isMinimized() == true)
{
@ -2863,8 +2872,8 @@ void MainWindow::on_actionSCTPFilterThisAssociation_triggered()
void MainWindow::statCommandWlanStatistics(const char *arg, void *)
{
WlanStatisticsDialog *wlan_stats_dlg = new WlanStatisticsDialog(*this, capture_file_, arg);
connect(wlan_stats_dlg, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(wlan_stats_dlg, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
wlan_stats_dlg->show();
}
@ -2883,8 +2892,8 @@ void MainWindow::statCommandExpertInfo(const char *, void *)
connect(expert_dialog->getExpertInfoView(), SIGNAL(goToPacket(int, int)),
packet_list_, SLOT(goToPacket(int, int)));
connect(expert_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(expert_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
expert_dialog->show();
}
@ -2946,8 +2955,8 @@ void MainWindow::on_actionStatisticsTcpStreamWindowScaling_triggered()
void MainWindow::statCommandMulticastStatistics(const char *arg, void *)
{
MulticastStatisticsDialog *mcast_stats_dlg = new MulticastStatisticsDialog(*this, capture_file_, arg);
connect(mcast_stats_dlg, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(mcast_stats_dlg, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
mcast_stats_dlg->show();
}
@ -3082,12 +3091,12 @@ void MainWindow::on_actionStatisticsCollectd_triggered()
void MainWindow::statCommandConversations(const char *arg, void *userdata)
{
ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
connect(conv_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t,guint)),
this, SLOT(openFollowStreamDialog(follow_type_t,guint)));
connect(conv_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t, guint)),
this, SLOT(openFollowStreamDialog(follow_type_t, guint)));
connect(conv_dialog, SIGNAL(openTcpStreamGraph(int)),
this, SLOT(openTcpStreamDialog(int)));
this, SLOT(openTcpStreamDialog(int)));
conv_dialog->show();
}
@ -3100,8 +3109,8 @@ void MainWindow::on_actionStatisticsConversations_triggered()
void MainWindow::statCommandEndpoints(const char *arg, void *userdata)
{
EndpointDialog *endp_dialog = new EndpointDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
connect(endp_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(endp_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(endp_dialog, SIGNAL(openFollowStreamDialog(follow_type_t)),
this, SLOT(openFollowStreamDialogForType(follow_type_t)));
connect(endp_dialog, SIGNAL(openTcpStreamGraph(int)),
@ -3171,7 +3180,7 @@ void MainWindow::on_actionStatisticsDNS_triggered()
void MainWindow::actionStatisticsPlugin_triggered()
{
QAction* action = qobject_cast<QAction*>(sender());
if(action) {
if (action) {
openStatisticsTreeDialog(action->data().toString().toUtf8());
}
}
@ -3222,8 +3231,8 @@ void MainWindow::on_actionTelephonyISUPMessages_triggered()
void MainWindow::statCommandLteMacStatistics(const char *arg, void *)
{
LteMacStatisticsDialog *lte_mac_stats_dlg = new LteMacStatisticsDialog(*this, capture_file_, arg);
connect(lte_mac_stats_dlg, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(lte_mac_stats_dlg, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
lte_mac_stats_dlg->show();
}
@ -3235,8 +3244,8 @@ void MainWindow::on_actionTelephonyLteMacStatistics_triggered()
void MainWindow::statCommandLteRlcStatistics(const char *arg, void *)
{
LteRlcStatisticsDialog *lte_rlc_stats_dlg = new LteRlcStatisticsDialog(*this, capture_file_, arg);
connect(lte_rlc_stats_dlg, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(lte_rlc_stats_dlg, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
// N.B. It is necessary for the RLC Statistics window to launch the RLC graph in this way, to ensure
// that the goToPacket() signal/slot connection gets set up...
connect(lte_rlc_stats_dlg, SIGNAL(launchRLCGraph(bool, guint16, guint8, guint16, guint16, guint8)),
@ -3251,8 +3260,8 @@ void MainWindow::on_actionTelephonyLteRlcStatistics_triggered()
}
void MainWindow::launchRLCGraph(bool channelKnown,
guint16 ueid, guint8 rlcMode,
guint16 channelType, guint16 channelId, guint8 direction)
guint16 ueid, guint8 rlcMode,
guint16 channelType, guint16 channelId, guint8 direction)
{
LteRlcGraphDialog *lrg_dialog = new LteRlcGraphDialog(*this, capture_file_, channelKnown);
connect(lrg_dialog, SIGNAL(goToPacket(int)), packet_list_, SLOT(goToPacket(int)));
@ -3401,7 +3410,7 @@ void MainWindow::on_actionHelpMPReordercap_triggered() {
wsApp->helpTopicAction(LOCALPAGE_MAN_REORDERCAP);
}
void MainWindow::on_actionHelpMPText2cap_triggered() {
void MainWindow::on_actionHelpMPText2cap_triggered() {
wsApp->helpTopicAction(LOCALPAGE_MAN_TEXT2PCAP);
}
@ -3656,8 +3665,8 @@ void MainWindow::on_actionStatisticsResolvedAddresses_triggered()
void MainWindow::on_actionStatisticsProtocolHierarchy_triggered()
{
ProtocolHierarchyDialog *phd = new ProtocolHierarchyDialog(*this, capture_file_);
connect(phd, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)));
connect(phd, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
phd->show();
}
@ -3670,8 +3679,8 @@ void MainWindow::on_actionCaptureOptions_triggered()
connect(capture_interfaces_dialog_, SIGNAL(startCapture()), this, SLOT(startCapture()));
connect(capture_interfaces_dialog_, SIGNAL(stopCapture()), this, SLOT(stopCapture()));
connect(capture_interfaces_dialog_, SIGNAL(getPoints(int,PointList*)),
this->welcome_page_->getInterfaceFrame(), SLOT(getPoints(int,PointList*)));
connect(capture_interfaces_dialog_, SIGNAL(getPoints(int, PointList*)),
this->welcome_page_->getInterfaceFrame(), SLOT(getPoints(int, PointList*)));
connect(capture_interfaces_dialog_, SIGNAL(interfacesChanged()),
this->welcome_page_, SLOT(interfaceSelected()));
connect(capture_interfaces_dialog_, SIGNAL(interfacesChanged()),
@ -3724,7 +3733,7 @@ void MainWindow::externalMenuItem_triggered()
entry = (ext_menubar_t *)v.value<void *>();
if (entry->type == EXT_MENUBAR_ITEM) {
entry->callback(EXT_MENUBAR_QT_GUI, (gpointer) ((void *)main_ui_), entry->user_data);
entry->callback(EXT_MENUBAR_QT_GUI, (gpointer)((void *)main_ui_), entry->user_data);
} else {
QDesktopServices::openUrl(QUrl(QString((gchar *)entry->user_data)));
}
@ -3774,11 +3783,11 @@ void MainWindow::on_actionContextWikiProtocolPage_triggered()
const QString proto_abbrev = proto_registrar_get_abbrev(field_id);
int ret = QMessageBox::question(this, wsApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
tr("<p>The Wireshark Wiki is maintained by the community.</p>"
"<p>The page you are about to load might be wonderful, "
"incomplete, wrong, or nonexistent.</p>"
"<p>Proceed to the wiki?</p>"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
tr("<p>The Wireshark Wiki is maintained by the community.</p>"
"<p>The page you are about to load might be wonderful, "
"incomplete, wrong, or nonexistent.</p>"
"<p>Proceed to the wiki?</p>"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (ret != QMessageBox::Yes) return;
@ -3827,7 +3836,7 @@ void MainWindow::activatePluginIFToolbar(bool)
ext_toolbar_t *toolbar = VariantPointer<ext_toolbar_t>::asPtr(sendingAction->data());
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
foreach (QToolBar *bar, toolbars) {
foreach(QToolBar *bar, toolbars) {
AdditionalToolBar *iftoolbar = dynamic_cast<AdditionalToolBar *>(bar);
if (iftoolbar && iftoolbar->menuName().compare(toolbar->name) == 0) {
if (iftoolbar->isVisible()) {

View File

@ -22,7 +22,7 @@
#include <QPushButton>
namespace Ui {
class PrintDialog;
class PrintDialog;
}
class PrintDialog : public QDialog
@ -50,7 +50,9 @@ private:
QPushButton *print_bt_;
QFont header_font_;
QFont packet_font_;
public:
capture_file *cap_file_;
private:
print_args_t print_args_;
print_stream_ops_t stream_ops_;
print_stream_t stream_;