aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-07-23 19:16:36 -0700
committerGuy Harris <guy@alum.mit.edu>2016-07-24 02:17:25 +0000
commitf930da87a738171f10af56a4acd7979c1469211a (patch)
treed885db5815a426f5fc681b2f5729df3ff46a4660 /ui
parent5488581d183cf245a9ffdeb30732f155d9db8b99 (diff)
Enable "Save As..." iff cf_can_save_as() returns TRUE.
Currently, cf_can_save() really means "*there's something to save* and we can write it out"; "Save As..." should be enabled even if there are no changes to save, in case the user just wants to write the existing file contents out to a new file and have the new file be the current file. That matches the behavior of the GTK+ version. (We might want to enable "Save" even if there are no changes to save; some other programs do that, such as the TextEdit, WordPad, KWrite, and gedit simple text editors. If so, however, we should make "Save" write stuff out even if there are no changes to save. Note, however, that we're a bit different from most "editors", in that we don't read the entire file into memory - we keep the file open and read packet data from it, because we want to be able to read files that won't fit into memory. That *might* change what we ultimately want to do with "Save".) Bug: 12630 Change-Id: I8a2327b5d6ddab7c4f0367f132460b507da38577 Reviewed-on: https://code.wireshark.org/review/16612 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index fb43642047..c3ef551bfb 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -2013,6 +2013,7 @@ void MainWindow::setMenusForCaptureFile(bool force_disable)
bool enable = true;
bool can_write = false;
bool can_save = false;
+ bool can_save_as = false;
if (force_disable || capture_file_.capFile() == NULL || capture_file_.capFile()->state == FILE_READ_IN_PROGRESS) {
/* We have no capture file or we're currently reading a file */
@@ -2021,13 +2022,14 @@ void MainWindow::setMenusForCaptureFile(bool force_disable)
/* We have a capture file. Can we write or save? */
can_write = cf_can_write_with_wiretap(capture_file_.capFile());
can_save = cf_can_save(capture_file_.capFile());
+ can_save_as = cf_can_save_as(capture_file_.capFile());
}
main_ui_->actionViewReload_as_File_Format_or_Capture->setEnabled(enable);
main_ui_->actionFileMerge->setEnabled(can_write);
main_ui_->actionFileClose->setEnabled(enable);
main_ui_->actionFileSave->setEnabled(can_save);
- main_ui_->actionFileSaveAs->setEnabled(can_save);
+ main_ui_->actionFileSaveAs->setEnabled(can_save_as);
main_ui_->actionStatisticsCaptureFileProperties->setEnabled(enable);
/*
* "Export Specified Packets..." should be available only if