]> git.lyx.org Git - lyx.git/blobdiff - src/LyXVC.cpp
ar.po: updates from Hatim
[lyx.git] / src / LyXVC.cpp
index 19f265cc67ad10aafa21598edca0d6241b0e3cd5..fcea6491da7dc749e950c0a0768be2fed4c7a9ec 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;
@@ -45,6 +46,17 @@ LyXVC::~LyXVC()
 {}
 
 
+docstring LyXVC::vcstatus() const
+{
+       if (!vcs)
+               return docstring();
+       if (locking())
+               return bformat(_("%1$s lock"), from_ascii(vcs->vcname()));
+       else
+               return from_ascii(vcs->vcname());
+}
+
+
 bool LyXVC::fileInVC(FileName const & fn)
 {
        if (!RCS::findFile(fn).empty())
@@ -327,8 +339,13 @@ string LyXVC::toggleReadOnly()
                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 +354,7 @@ string LyXVC::toggleReadOnly()
 bool LyXVC::inUse() const
 {
        if (vcs)
-               return vcs->status() != VCS::UNVERSIONED;
+               return true;
        return false;
 }
 
@@ -363,7 +380,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();