summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2022-01-27 16:27:54 +0200
committerMavridis Philippe <mavridisf@gmail.com>2022-01-27 16:56:32 +0200
commita7d117f83a8077173ad95e28e3ba05ccf75eab70 (patch)
treef58f5ac4a9fd4b3ea21ee6d9c2255e152b80a0fc
parentb2735d92726e865990f79b821fda07357fa8a71c (diff)
downloadgtk-qt-engine-a7d117f83a8077173ad95e28e3ba05ccf75eab70.tar.gz
gtk-qt-engine-a7d117f83a8077173ad95e28e3ba05ccf75eab70.zip
KCM: Make sure Unicode is used for editing bashrc
This resolves issue #6. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-rw-r--r--kcm_gtk/kcmgtk.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/kcm_gtk/kcmgtk.cpp b/kcm_gtk/kcmgtk.cpp
index 0667731..bd3ab79 100644
--- a/kcm_gtk/kcmgtk.cpp
+++ b/kcm_gtk/kcmgtk.cpp
@@ -509,13 +509,14 @@ void KcmGtk::save()
if (file.exists())
{
file.open(IO_ReadOnly);
- TQByteArray fileData = file.readAll();
+ TQTextStream fileDataStream = TQTextStream(&file);
+ fileDataStream.setEncoding(TQTextStream::Locale);
+ TQString fileDataString = fileDataStream.read();
file.close();
TQString rcLine = "export GTK2_RC_FILES=$HOME/.gtkrc-2.0";
- TQString fileDataString(fileData);
fileDataString.replace("\n" + rcLine, "\n# (This is no longer needed from version 0.8 of the theme engine)\n# " + rcLine);
-
+
file.open(IO_WriteOnly);
stream.setDevice(TQT_TQIODEVICE(&file));
stream << fileDataString;