diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-09 02:01:05 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-09 17:57:52 +0000 |
commit | 7d5ce06cbe35f3f818695c87e5b0f42172ee3784 (patch) | |
tree | b1819216afd831302cc94af54187122a2efdd4d8 /ui/qt | |
parent | 1abbb503e4242f56921b7ee950f185711e9f85c0 (diff) |
Pull the error reporting into {read,save}_filter_list.
Change-Id: I4d9582661f2f1728d400eeb2a1b1dea98f32ce7f
Reviewed-on: https://code.wireshark.org/review/20982
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/capture_filter_edit.cpp | 13 | ||||
-rw-r--r-- | ui/qt/display_filter_edit.cpp | 13 | ||||
-rw-r--r-- | ui/qt/filter_dialog.cpp | 34 | ||||
-rw-r--r-- | ui/qt/wireshark_application.cpp | 18 |
4 files changed, 5 insertions, 73 deletions
diff --git a/ui/qt/capture_filter_edit.cpp b/ui/qt/capture_filter_edit.cpp index 89e2bd8df4..083b1df119 100644 --- a/ui/qt/capture_filter_edit.cpp +++ b/ui/qt/capture_filter_edit.cpp @@ -506,18 +506,7 @@ void CaptureFilterEdit::removeFilter() } } - char *f_path; - int f_save_errno; - - save_filter_list(CFILTER_LIST, &f_path, &f_save_errno); - if (f_path != NULL) { - // We had an error saving the filter. - QString warning_title = tr("Unable to save capture filter settings."); - QString warning_msg = tr("Could not save to your capture filter file\n\"%1\": %2.").arg(f_path).arg(g_strerror(f_save_errno)); - - QMessageBox::warning(this, warning_title, warning_msg, QMessageBox::Ok); - g_free(f_path); - } + save_filter_list(CFILTER_LIST); updateBookmarkMenu(); } diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp index 97b035fc5d..eb44075462 100644 --- a/ui/qt/display_filter_edit.cpp +++ b/ui/qt/display_filter_edit.cpp @@ -537,18 +537,7 @@ void DisplayFilterEdit::removeFilter() } } - char *f_path; - int f_save_errno; - - save_filter_list(DFILTER_LIST, &f_path, &f_save_errno); - if (f_path != NULL) { - // We had an error saving the filter. - QString warning_title = tr("Unable to save display filter settings."); - QString warning_msg = tr("Could not save to your display filter file\n\"%1\": %2.").arg(f_path).arg(g_strerror(f_save_errno)); - - QMessageBox::warning(this, warning_title, warning_msg, QMessageBox::Ok); - g_free(f_path); - } + save_filter_list(DFILTER_LIST); updateBookmarkMenu(); } diff --git a/ui/qt/filter_dialog.cpp b/ui/qt/filter_dialog.cpp index 9652a327dc..dd05ead167 100644 --- a/ui/qt/filter_dialog.cpp +++ b/ui/qt/filter_dialog.cpp @@ -203,39 +203,7 @@ void FilterDialog::on_buttonBox_accepted() ++it; } - char *pf_dir_path; - char *f_path; - int f_save_errno; - - /* Create the directory that holds personal configuration files, - if necessary. */ - if (create_persconffile_dir(&pf_dir_path) == -1) { - QMessageBox::warning(this, tr("Unable to create profile directory."), - tr("Unable to create directory\n\"%1\"\nfor filter files: %2.") - .arg(pf_dir_path) - .arg(g_strerror(errno)), - QMessageBox::Ok); - g_free(pf_dir_path); - return; - } - - save_filter_list(fl_type, &f_path, &f_save_errno); - if (f_path != NULL) { - /* We had an error saving the filter. */ - QString warning_title; - QString warning_msg; - if (fl_type == CFILTER_LIST) { - warning_title = tr("Unable to save capture filter settings."); - warning_msg = tr("Could not save to your capture filter file\n\"%1\": %2.") - .arg(f_path).arg(g_strerror(f_save_errno)); - } else { - warning_title = tr("Unable to save display filter settings."); - warning_msg = tr("Could not save to your display filter file\n\"%1\": %2.") - .arg(f_path).arg(g_strerror(f_save_errno)); - } - QMessageBox::warning(this, warning_title, warning_msg, QMessageBox::Ok); - g_free(f_path); - } + save_filter_list(fl_type); if (filter_type_ == CaptureFilter) { wsApp->emitAppSignal(WiresharkApplication::CaptureFilterListChanged); diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 7f25a2138f..3345bf4bd3 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -1095,8 +1095,6 @@ void WiresharkApplication::allSystemsGo() _e_prefs *WiresharkApplication::readConfigurationFiles(bool reset) { - int cf_open_errno, df_open_errno; - char *cf_path, *df_path; e_prefs *prefs_p; if (reset) { @@ -1123,22 +1121,10 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(bool reset) #endif /* Read the capture filter file. */ - read_filter_list(CFILTER_LIST, &cf_path, &cf_open_errno); - if (cf_path != NULL) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open your capture filter file\n\"%s\": %s.", cf_path, - g_strerror(cf_open_errno)); - g_free(cf_path); - } + read_filter_list(CFILTER_LIST); /* Read the display filter file. */ - read_filter_list(DFILTER_LIST, &df_path, &df_open_errno); - if (df_path != NULL) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open your display filter file\n\"%s\": %s.", df_path, - g_strerror(df_open_errno)); - g_free(df_path); - } + read_filter_list(DFILTER_LIST); /* * Read the files that enable and disable protocols and heuristic |