* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#pragma implementation
#endif
-#include <fstream>
-
+#include "Lsstream.h"
#include "support/lyxlib.h"
#include "support/forkedcall.h"
#include "support/filetools.h"
#include <qmultilineedit.h>
#include <qinputdialog.h>
+#include <fstream>
+
using std::getline;
QPreambleDialog::QPreambleDialog(QPreamble * form)
// find an editor
string editor = GetEnv("EDITOR");
if (editor.empty()) {
- static string lastentry = "";
+ static string lastentry;
editor = QInputDialog::getText(
_("Enter editor program"), _("Editor"), QLineEdit::Normal,
lastentry.c_str()).latin1();
file.close();
- editor += " " + filename;
+ editor += ' ' + filename;
Forkedcall call;
return;
}
- string newtext;
- string line;
-
- while (getline(in, line)) {
- newtext += line + "\n";
- }
+ ostringstream newtext;
+ newtext << in.rdbuf();
+ // close the files before we delete the file
in.close();
+
lyx::unlink(filename);
- preambleLE->setText(newtext.c_str());
+ preambleLE->setText(newtext.str().c_str());
}