forked from osmocom/wireshark
Qt: Make our exported and saved line endings consistent.
Make sure we set QIODevice::Text on our QTextStreams when saving and exporting text so that we get native line endings on Windows. Change-Id: I4602157d2d170eb9a2c79032254ea5be236c7589 Reviewed-on: https://code.wireshark.org/review/37336 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
76d92ba7e7
commit
4e6f47fa62
|
@ -47,8 +47,6 @@
|
|||
#include <QPrintDialog>
|
||||
#include <QPrinter>
|
||||
#include <QScrollBar>
|
||||
#include <QTextEdit>
|
||||
#include <QTextStream>
|
||||
|
||||
// To do:
|
||||
// - Show text while tapping.
|
||||
|
|
|
@ -1557,7 +1557,7 @@ void IOGraphDialog::copyAsCsvClicked()
|
|||
bool IOGraphDialog::saveCsv(const QString &file_name) const
|
||||
{
|
||||
QFile save_file(file_name);
|
||||
save_file.open(QFile::WriteOnly);
|
||||
save_file.open(QFile::WriteOnly | QFile::Text);
|
||||
QTextStream out(&save_file);
|
||||
makeCsv(out);
|
||||
|
||||
|
|
|
@ -293,8 +293,24 @@ void ShowPacketBytesDialog::saveAs()
|
|||
if (file_name.isEmpty())
|
||||
return;
|
||||
|
||||
QFile::OpenMode open_mode = QFile::WriteOnly;
|
||||
switch (show_as_) {
|
||||
case ShowAsASCII:
|
||||
case ShowAsASCIIandControl:
|
||||
case ShowAsCArray:
|
||||
case ShowAsHexDump:
|
||||
case ShowAsISO8859_1:
|
||||
case ShowAsYAML:
|
||||
case ShowAsHTML:
|
||||
case ShowAsUTF8:
|
||||
open_mode |= QFile::Text;
|
||||
// case ShowAsUTF16: ???
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QFile file(file_name);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.open(open_mode);
|
||||
|
||||
switch (show_as_) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue