]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
Make string conversion work with non-ucs2-characters if using qt 4.2
[lyx.git] / src / lyx_cb.C
index 3fcccaec4f72fe7a4dbe8996556d518eb98c4102..ffe3ce6ab6f16211857172a1d1f42a95ed2e77cf 100644 (file)
@@ -34,6 +34,7 @@
 #include "frontends/Alert.h"
 #include "frontends/Application.h"
 #include "frontends/FileDialog.h"
+#include "frontends/LyXView.h"
 
 #include "support/filefilterlist.h"
 #include "support/filetools.h"
@@ -61,6 +62,7 @@ namespace lyx {
 using support::addName;
 using support::bformat;
 using support::FileFilterList;
+using support::FileName;
 using support::ForkedProcess;
 using support::isLyXFilename;
 using support::libFileSearch;
@@ -101,7 +103,7 @@ bool quitting;      // flag, that we are quitting the program
 bool menuWrite(Buffer * buffer)
 {
        if (buffer->save()) {
-               LyX::ref().session().addLastFile(buffer->fileName());
+               LyX::ref().session().lastFiles().add(FileName(buffer->fileName()));
                return true;
        }
 
@@ -192,7 +194,7 @@ namespace {
 class AutoSaveBuffer : public ForkedProcess {
 public:
        ///
-       AutoSaveBuffer(BufferView & bv, string const & fname)
+       AutoSaveBuffer(BufferView & bv, FileName const & fname)
                : bv_(bv), fname_(fname) {}
        ///
        virtual shared_ptr<ForkedProcess> clone() const
@@ -206,13 +208,13 @@ private:
        virtual int generateChild();
        ///
        BufferView & bv_;
-       string fname_;
+       FileName fname_;
 };
 
 
 int AutoSaveBuffer::start()
 {
-       command_ = to_utf8(bformat(_("Auto-saving %1$s"), from_utf8(fname_)));
+       command_ = to_utf8(bformat(_("Auto-saving %1$s"), from_utf8(fname_.absFilename())));
        return run(DontWait);
 }
 
@@ -230,7 +232,7 @@ int AutoSaveBuffer::generateChild()
                // anyway.
                bool failed = false;
 
-               string const tmp_ret = tempName(string(), "lyxauto");
+               FileName const tmp_ret(tempName(string(), "lyxauto"));
                if (!tmp_ret.empty()) {
                        bv_.buffer()->writeFile(tmp_ret);
                        // assume successful write of tmp_ret
@@ -287,7 +289,7 @@ void autoSave(BufferView * bv)
        fname += onlyFilename(bv->buffer()->fileName());
        fname += '#';
 
-       AutoSaveBuffer autosave(*bv, fname);
+       AutoSaveBuffer autosave(*bv, FileName(fname));
        autosave.start();
 
        bv->buffer()->markBakClean();
@@ -404,10 +406,10 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 
 // This function runs "configure" and then rereads lyx.defaults to
 // reconfigure the automatic settings.
-void reconfigure(BufferView * bv)
+void reconfigure(LyXView & lv)
 {
        // emit message signal.
-       bv->buffer()->message(_("Running configure..."));
+       lv.message(_("Running configure..."));
 
        // Run configure in user lyx directory
        support::Path p(package().user_support());
@@ -416,7 +418,7 @@ void reconfigure(BufferView * bv)
        one.startscript(Systemcall::Wait, configure_command);
        p.pop();
        // emit message signal.
-       bv->buffer()->message(_("Reloading configuration..."));
+       lv.message(_("Reloading configuration..."));
        lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
        // Re-read packages.lst
        LaTeXFeatures::getAvailable();