comparison libgui/src/m-editor/file-editor-tab.cc @ 18299:6736fc9bce24 gui-release

Set codec when loading/saving files in editor (Bug #41226) * libgui/src/m-editor/file-editor-tab.cc: set UTF-8 codec on load and save.
author John Donoghue <john.donoghue@ieee.org>
date Fri, 17 Jan 2014 19:51:22 -0500
parents 3a26bb54655e
children 106da7544504
comparison
equal deleted inserted replaced
18294:01646e48a650 18299:6736fc9bce24
1009 QFile file (file_to_load); 1009 QFile file (file_to_load);
1010 if (!file.open (QFile::ReadOnly)) 1010 if (!file.open (QFile::ReadOnly))
1011 return file.errorString (); 1011 return file.errorString ();
1012 1012
1013 QTextStream in (&file); 1013 QTextStream in (&file);
1014 in.setCodec("UTF-8");
1014 QApplication::setOverrideCursor (Qt::WaitCursor); 1015 QApplication::setOverrideCursor (Qt::WaitCursor);
1015 _edit_area->setText (in.readAll ()); 1016 _edit_area->setText (in.readAll ());
1016 QApplication::restoreOverrideCursor (); 1017 QApplication::restoreOverrideCursor ();
1017 1018
1018 _copy_available = false; // no selection yet available 1019 _copy_available = false; // no selection yet available
1075 return; 1076 return;
1076 } 1077 }
1077 1078
1078 // save the contents into the file 1079 // save the contents into the file
1079 QTextStream out (&file); 1080 QTextStream out (&file);
1081 out.setCodec("UTF-8");
1080 QApplication::setOverrideCursor (Qt::WaitCursor); 1082 QApplication::setOverrideCursor (Qt::WaitCursor);
1081 out << _edit_area->text (); 1083 out << _edit_area->text ();
1082 out.flush (); 1084 out.flush ();
1083 QApplication::restoreOverrideCursor (); 1085 QApplication::restoreOverrideCursor ();
1084 file.flush (); 1086 file.flush ();