]> git.lyx.org Git - lyx.git/blobdiff - src/LyXVC.cpp
Check path of Qt tools if qtchooser is detected
[lyx.git] / src / LyXVC.cpp
index 2dd5ac154cc83cd21f1cf23e8f1b1e9b921217cd..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())
@@ -322,13 +318,18 @@ string LyXVC::toggleReadOnly()
        case VCS::LOCKED: {
                LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked");
                string log;
-               if (checkIn(log) != Success)
+               if (checkIn(log) != VCSuccess)
                        return string();
                return log;
        }
        case VCS::NOLOCKING:
-       case VCS::UNVERSIONED:
-               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();
 }
@@ -337,7 +338,7 @@ string LyXVC::toggleReadOnly()
 bool LyXVC::inUse() const
 {
        if (vcs)
-               return vcs->status() != VCS::UNVERSIONED;
+               return true;
        return false;
 }
 
@@ -363,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();