]> git.lyx.org Git - lyx.git/blobdiff - src/LyXVC.cpp
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / LyXVC.cpp
index fb6e8224266e7e6a81b9019b897b219b079e727e..b28139fb61c08d124220acde13dd986f42c324f7 100644 (file)
@@ -25,6 +25,7 @@
 #include "support/filetools.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
+#include "support/TempFile.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -40,11 +41,6 @@ LyXVC::LyXVC()
 }
 
 
-// for the sake of boost::scoped_ptr
-LyXVC::~LyXVC()
-{}
-
-
 bool LyXVC::fileInVC(FileName const & fn)
 {
        if (!RCS::findFile(fn).empty())
@@ -327,7 +323,13 @@ string LyXVC::toggleReadOnly()
                return log;
        }
        case VCS::NOLOCKING:
-               break;
+               Buffer * b = vcs->owner();
+               bool const newstate = !b->isReadonly();
+               string result = "LyXVC: toggle to ";
+               result += (newstate ? "readonly" : "readwrite");
+               LYXERR(Debug::LYXVC, result);
+               b->setReadonly(newstate);
+               return result;
        }
        return string();
 }
@@ -362,7 +364,9 @@ string const LyXVC::getLogFile() const
        if (!vcs)
                return string();
 
-       FileName const tmpf = FileName::tempName("lyxvclog");
+       TempFile tempfile("lyxvclog");
+       tempfile.setAutoRemove(false);
+       FileName const tmpf = tempfile.name();
        if (tmpf.empty()) {
                LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
                return string();