Qt: check that a file name was selected before trying to export follow content

Bug: 11763
Change-Id: Iab117fe9f572eccc3cf88a9f3ff86a22aa0e33c9
Reviewed-on: https://code.wireshark.org/review/12099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2015-11-24 15:10:21 +01:00
parent 9b7aaa2699
commit 0981a50a57
1 changed files with 14 additions and 12 deletions

View File

@ -220,22 +220,24 @@ void FollowStreamDialog::findText(bool go_back)
void FollowStreamDialog::saveAs()
{
QString file_name = QFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Stream Content As" UTF8_HORIZONTAL_ELLIPSIS)));
file_.setFileName(file_name);
file_.open( QIODevice::WriteOnly );
QTextStream out(&file_);
if (!file_name.isEmpty()) {
file_.setFileName(file_name);
file_.open( QIODevice::WriteOnly );
QTextStream out(&file_);
save_as_ = true;
save_as_ = true;
readStream();
readStream();
if ((follow_info_.show_type != SHOW_RAW) && (follow_info_.show_type != SHOW_UTF8))
{
out << ui->teStreamContent->toPlainText();
if ((follow_info_.show_type != SHOW_RAW) && (follow_info_.show_type != SHOW_UTF8))
{
out << ui->teStreamContent->toPlainText();
}
save_as_ = false;
file_.close();
}
save_as_ = false;
file_.close();
}
void FollowStreamDialog::helpButton()