aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-05-29 09:55:59 -0700
committerAnders Broman <a.broman58@gmail.com>2020-05-30 06:46:01 +0000
commit4e6f47fa622e773c3b432a23627a130387f2ffe8 (patch)
tree8c4cc832f0c0d2e76cdbe15abb385a7d010b7f6b /ui
parent76d92ba7e76ef0714090770ff1ee79861716388c (diff)
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>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/follow_stream_dialog.cpp2
-rw-r--r--ui/qt/io_graph_dialog.cpp2
-rw-r--r--ui/qt/show_packet_bytes_dialog.cpp18
3 files changed, 18 insertions, 4 deletions
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index fc26d109cc..d0db58b72e 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -47,8 +47,6 @@
#include <QPrintDialog>
#include <QPrinter>
#include <QScrollBar>
-#include <QTextEdit>
-#include <QTextStream>
// To do:
// - Show text while tapping.
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 160376abc6..fde5f4fdc9 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -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);
diff --git a/ui/qt/show_packet_bytes_dialog.cpp b/ui/qt/show_packet_bytes_dialog.cpp
index 53a58b7bc8..c19a5ddec3 100644
--- a/ui/qt/show_packet_bytes_dialog.cpp
+++ b/ui/qt/show_packet_bytes_dialog.cpp
@@ -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_) {