Remember query after closing Follow Stream

Update main filter after follow stream dialog is closed - Use:
   previous_filter if new 'Back' button (passed in follow() method)
   filter_out_filter_ if 'Filter Out This Stream' button (built by appending !current_stream to previous_filter)
   leave filter alone if window closed using Close button or window close. (current stream)

Change-Id: Ic02edeaffdc65ff0f33cac4cb9afb8cde28963c7
Reviewed-on: https://code.wireshark.org/review/16277
Reviewed-by: Jim Young <jim.young.ws@gmail.com>
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
David Morsberger 2016-07-03 19:36:12 -04:00 committed by Anders Broman
parent ea0b2e0d36
commit 448c89e30b
2 changed files with 32 additions and 5 deletions

View File

@ -135,6 +135,9 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
b_save_ = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole);
connect(b_save_, SIGNAL(clicked()), this, SLOT(saveAs()));
b_back_ = ui->buttonBox->addButton(tr("Back"), QDialogButtonBox::ActionRole);
connect(b_back_, SIGNAL(clicked()), this, SLOT(backButton()));
ProgressFrame::addToButtonBox(ui->buttonBox, &parent);
connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton()));
@ -300,13 +303,31 @@ void FollowStreamDialog::helpButton()
wsApp->helpTopicAction(HELP_FOLLOW_STREAM_DIALOG);
}
void FollowStreamDialog::filterOut()
void FollowStreamDialog::backButton()
{
emit updateFilter(filter_out_filter_, TRUE);
output_filter_ = previous_filter_;
close();
}
void FollowStreamDialog::filterOut()
{
output_filter_ = filter_out_filter_;
close();
}
void FollowStreamDialog::close()
{
// Update filter - Use:
// previous_filter if 'Close' (passed in follow() method)
// filter_out_filter_ if 'Filter Out This Stream' (built by appending !current_stream to previous_filter)
// leave filter alone if window closed. (current stream)
emit updateFilter(output_filter_, TRUE);
WiresharkDialog::close();
}
void FollowStreamDialog::on_cbDirections_currentIndexChanged(int idx)
{
switch(idx)
@ -349,7 +370,7 @@ void FollowStreamDialog::on_streamNumberSpinBox_valueChanged(int stream_num)
if (file_closed_) return;
if (stream_num >= 0) {
follow(QString(), true, stream_num);
follow(previous_filter_, true, stream_num);
}
}
@ -843,9 +864,9 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_stream_index,
return false;
}
if (follow_type_ == FOLLOW_SSL)
if (follow_type_ == FOLLOW_SSL || follow_type_ == FOLLOW_HTTP)
{
/* we got ssl so we can follow */
/* we got ssl/http so we can follow */
removeStreamControls();
}
@ -865,6 +886,7 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_stream_index,
return false;
}
previous_filter_ = previous_filter;
/* append the negation */
if(!previous_filter.isEmpty()) {
filter_out_filter_ = QString("%1 and !(%2)")

View File

@ -70,6 +70,8 @@ private slots:
void on_leFind_returnPressed();
void helpButton();
void backButton();
void close();
void filterOut();
void useRegexFind(bool use_regex);
void findText(bool go_back = true);
@ -108,6 +110,7 @@ private:
QPushButton *b_find_;
QPushButton *b_print_;
QPushButton *b_save_;
QPushButton *b_back_;
follow_type_t follow_type_;
follow_info_t follow_info_;
@ -116,7 +119,9 @@ private:
QString data_out_filename_;
static const int max_document_length_;
bool truncated_;
QString previous_filter_;
QString filter_out_filter_;
QString output_filter_;
int client_buffer_count_;
int server_buffer_count_;
int client_packet_count_;