]> git.lyx.org Git - lyx.git/blobdiff - src/LyXVC.cpp
typo
[lyx.git] / src / LyXVC.cpp
index 4dbcfd2675f5041bda2285e6950f266cc2fee87a..806d5e81436790e8bc6ed4b949fb9e68e5353443 100644 (file)
@@ -37,13 +37,19 @@ namespace Alert = frontend::Alert;
 
 LyXVC::LyXVC()
 {
-       owner_ = 0;
+       owner_ = nullptr;
 }
 
 
-// for the sake of boost::scoped_ptr
-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)
@@ -85,7 +91,7 @@ bool LyXVC::file_found_hook(FileName const & fn)
        }
 
        // file is not under any VCS.
-       vcs.reset(0);
+       vcs.reset(nullptr);
        return false;
 }
 
@@ -180,7 +186,7 @@ bool LyXVC::registrer()
                        _("(no initial description)"));
        if (!ok) {
                LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
-               vcs.reset(0);
+               vcs.reset(nullptr);
                return false;
        }
        if (response.empty())
@@ -256,7 +262,7 @@ string LyXVC::checkOut()
        if (!vcs)
                return string();
        //RCS allows checkOut only in ReadOnly mode
-       if (vcs->toggleReadOnlyEnabled() && !owner_->isReadonly())
+       if (vcs->toggleReadOnlyEnabled() && !owner_->hasReadonlyFlag())
                return string();
 
        LYXERR(Debug::LYXVC, "LyXVC: checkOut");
@@ -328,7 +334,13 @@ string LyXVC::toggleReadOnly()
                return log;
        }
        case VCS::NOLOCKING:
-               break;
+               Buffer * b = vcs->owner();
+               bool const newstate = !b->hasReadonlyFlag();
+               string result = "LyXVC: toggle to ";
+               result += (newstate ? "readonly" : "readwrite");
+               LYXERR(Debug::LYXVC, result);
+               b->setReadonly(newstate);
+               return result;
        }
        return string();
 }
@@ -435,8 +447,8 @@ bool LyXVC::repoUpdateEnabled() const
 {
        return vcs && vcs->repoUpdateEnabled();
 }
-       
-       
+
+
 bool LyXVC::prepareFileRevision(string const & rev, std::string & f)
 {
        return vcs && vcs->prepareFileRevision(rev, f);