]> git.lyx.org Git - lyx.git/blobdiff - src/callback.cpp
Use home made code for the bool facet.
[lyx.git] / src / callback.cpp
index 6eab414618c425ca1450681bc8d996fac911d3dd..7053831020a205a262a96af6323d165e376b8c03 100644 (file)
@@ -29,8 +29,7 @@
 #include "LyX.h"
 #include "Layout.h"
 #include "LyXRC.h"
-#include "LyXText.h"
-#include "Paragraph.h"
+#include "Text.h"
 #include "Undo.h"
 
 #include "frontends/alert.h"
 #include <cerrno>
 #include <fstream>
 
+using std::back_inserter;
+using std::copy;
+using std::endl;
+using std::make_pair;
+using std::string;
+using std::ifstream;
+using std::ios;
+using std::istream_iterator;
+
+using boost::shared_ptr;
+
 
 namespace lyx {
 
@@ -78,21 +88,9 @@ using support::Systemcall;
 using support::tempName;
 using support::unlink;
 
-using boost::shared_ptr;
-
 namespace Alert = frontend::Alert;
 namespace fs = boost::filesystem;
 
-using std::back_inserter;
-using std::copy;
-using std::endl;
-using std::make_pair;
-using std::string;
-using std::ifstream;
-using std::ios;
-using std::istream_iterator;
-
-
 // this should be static, but I need it in Buffer.cpp
 bool quitting; // flag, that we are quitting the program
 
@@ -165,9 +163,9 @@ bool writeAs(Buffer * buffer, string const & newname)
        if (fs::exists(filename.toFilesystemEncoding())) {
                docstring const file = makeDisplayPath(fname, 30);
                docstring text = bformat(_("The document %1$s already exists.\n\n"
-                                                    "Do you want to over-write that document?"), file);
-               int const ret = Alert::prompt(_("Over-write document?"),
-                       text, 0, 1, _("&Over-write"), _("&Cancel"));
+                                          "Do you want to overwrite that document?"), file);
+               int const ret = Alert::prompt(_("Overwrite document?"),
+                       text, 0, 1, _("&Overwrite"), _("&Cancel"));
 
                if (ret == 1)
                        return false;
@@ -399,7 +397,18 @@ docstring const getContentsOfPlaintextFile(BufferView * bv, string const & f,
 #endif
 
        // FIXME UNICODE: We don't know the encoding of the file
-       return normalize_kc(from_utf8(tmpstr));
+       docstring file_content = from_utf8(tmpstr);
+       if (file_content.empty()) {
+               Alert::error(_("Reading not UTF-8 encoded file"),
+                                       _("The file is not UTF-8 encoded.\n"
+                                       "It will be read as local 8Bit-encoded.\n"
+                                       "If this does not give the correct result\n"
+                                       "then please change the encoding of the file\n"
+                                       "to UTF-8 with a program other than LyX.\n"));
+               file_content = from_local8bit(tmpstr);
+       }
+
+       return normalize_c(file_content);
 }