aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/main_window.cpp
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-19 16:36:30 -0500
committerMichael Mann <mmann78@netscape.net>2015-12-21 13:26:30 +0000
commit39bdeb2706d552be51a07be30ddb2433a1f044b2 (patch)
tree2f57ac5e76e3adaf662ab3df9af0434b56395dec /ui/qt/main_window.cpp
parente3829d723dc85387665e2843e08a30954766506e (diff)
Confirm discarding data before restarting capture.
Modify existing MainWindow::testCaptureFileClose() to handle restart scenario. Bug: 9605 Change-Id: Ie57624ca482b050745474f5e1c61343f60292a42 Reviewed-on: https://code.wireshark.org/review/12733 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt/main_window.cpp')
-rw-r--r--ui/qt/main_window.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 2bdf68d40f..e1495e2985 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -1500,7 +1500,7 @@ void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compre
}
}
-bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what) {
+bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what, bool restart) {
bool capture_in_progress = FALSE;
if (!capture_file_.capFile() || capture_file_.capFile()->state == FILE_CLOSED)
@@ -1571,7 +1571,11 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what) {
msg_dialog.addButton(QMessageBox::Cancel);
if (capture_in_progress) {
- saveButton = msg_dialog.addButton(tr("Stop and Save"), QMessageBox::AcceptRole);
+ if (restart) {
+ saveButton = msg_dialog.addButton(tr("Save before Continue"), QMessageBox::AcceptRole);
+ } else {
+ saveButton = msg_dialog.addButton(tr("Stop and Save"), QMessageBox::AcceptRole);
+ }
} else {
saveButton = msg_dialog.addButton(QMessageBox::Save);
}
@@ -1587,8 +1591,14 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what) {
}
} else {
if (capture_in_progress) {
- discardButton = msg_dialog.addButton(tr("Stop and Continue without Saving"),
- QMessageBox::DestructiveRole);
+ if (restart) {
+ discardButton = msg_dialog.addButton(tr("Continue without Saving"),
+ QMessageBox::DestructiveRole);
+ }
+ else {
+ discardButton = msg_dialog.addButton(tr("Stop and Continue without Saving"),
+ QMessageBox::DestructiveRole);
+ }
} else {
discardButton = msg_dialog.addButton(tr("Continue &without Saving"), QMessageBox::DestructiveRole);
}
@@ -1613,16 +1623,19 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString before_what) {
}
else if(msg_dialog.clickedButton() == discardButton)
{
+ if (!restart)
+ {
#ifdef HAVE_LIBPCAP
- /*
- * If there's a capture in progress; we have to stop the capture
- * and then do the close.
- */
- if (capture_in_progress)
- captureStop();
+ /*
+ * If there's a capture in progress; we have to stop the capture
+ * and then do the close.
+ */
+ if (capture_in_progress)
+ captureStop();
#endif
- /* Just close the file, discarding changes */
- cf_close(capture_file_.capFile());
+ /* Just close the file, discarding changes */
+ cf_close(capture_file_.capFile());
+ }
return true;
}
else //cancelButton or some other unspecified button