From 928b570a34738e5c28adf86488bd4fda377791ac Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Mon, 21 Mar 2016 20:56:01 -0400 Subject: Choose the appropriate initial directory for the Export Dissections window. Bug: 12105 Change-Id: Ib2398e5213b2ef2501660d1bba13dca66f04bd55 Reviewed-on: https://code.wireshark.org/review/14549 Petri-Dish: Jeff Morriss Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte Reviewed-by: Michael Mann --- ui/qt/export_dissection_dialog.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ui/qt') diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp index 53f6f869e1..769393da7e 100644 --- a/ui/qt/export_dissection_dialog.cpp +++ b/ui/qt/export_dissection_dialog.cpp @@ -36,14 +36,15 @@ #include "qt_ui_utils.h" -#include "wireshark_application.h" #include #include #include - #endif // Q_OS_WIN +#include +#include "wireshark_application.h" + ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *cap_file, export_type_e export_type): QFileDialog(parent), export_type_(export_type), @@ -52,6 +53,29 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca , save_bt_(NULL) #endif /* Q_OS_WIN */ { + + switch (prefs.gui_fileopen_style) { + + case FO_STYLE_LAST_OPENED: + /* The user has specified that we should start out in the last directory + * we looked in. If we've already opened a file, use its containing + * directory, if we could determine it, as the directory, otherwise + * use the "last opened" directory saved in the preferences file if + * there was one. + */ + setDirectory(wsApp->lastOpenDir()); + break; + + case FO_STYLE_SPECIFIED: + /* The user has specified that we should always start out in a + * specified directory; if they've specified that directory, + * start out by showing the files in that dir. + */ + if (prefs.gui_fileopen_dir[0] != '\0') + setDirectory(prefs.gui_fileopen_dir); + break; + } + #if !defined(Q_OS_WIN) QDialogButtonBox *button_box = findChild(); // Add extra widgets -- cgit v1.2.3