From f26f9900761baa5913bc05a1afbf21d97b5e2143 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Fri, 12 Feb 2010 07:21:11 +0000 Subject: [PATCH] Kill locker() API in VCS git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33438 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXVC.cpp | 4 ++-- src/LyXVC.h | 13 ++----------- src/VCBackend.cpp | 3 --- src/VCBackend.h | 8 ++++---- src/frontends/qt4/GuiView.cpp | 2 +- src/frontends/qt4/GuiWorkArea.cpp | 6 +++--- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index 173756f9e7..c66ce169b0 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -259,9 +259,9 @@ string const LyXVC::versionString() const } -string const & LyXVC::locker() const +bool LyXVC::locking() const { - return vcs->locker(); + return vcs->status() != VCS::NOLOCKING; } diff --git a/src/LyXVC.h b/src/LyXVC.h index b4cef3c910..92db82c52c 100644 --- a/src/LyXVC.h +++ b/src/LyXVC.h @@ -127,18 +127,9 @@ public: std::string const versionString() const; /** - * Returns the userid of the person who has locked the doc. - * FIXME This property is descendant from the original VCS - * and used in RCS for user id or "unlocked" strings. - * It would be problem to use this under SVN since getting - * the locker would need connection to server any time we - * load document. SVN currently (mis)uses this as a signal - * for locking state, as we do not have API for vcstatus(). - * The RCS code for user id parsing is working but we don't display - * it anywhere. One possibility is to provide proper vcstatus() - * interface and kill the whole locker thing. + * Returns whether we use locking for the given file. */ - std::string const & locker() const; + bool locking() const; // type of the revision information enum RevisionInfo { diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index dd3aa9b9cf..e10ea872d3 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -536,16 +536,13 @@ FileName const SVN::findFile(FileName const & file) void SVN::scanMaster() { - locker_.clear(); // vcstatus code is somewhat superflous, until we want // to implement read-only toggle for svn. vcstatus = NOLOCKING; if (checkLockMode()) { if (isLocked()) { - locker_ = "Locked"; vcstatus = LOCKED; } else { - locker_ = "Unlocked"; vcstatus = UNLOCKED; } } diff --git a/src/VCBackend.h b/src/VCBackend.h index c43846ed5a..7a277edcc6 100644 --- a/src/VCBackend.h +++ b/src/VCBackend.h @@ -67,8 +67,6 @@ public: virtual void getLog(support::FileName const &) = 0; /// return the current version description virtual std::string const versionString() const = 0; - /// return the user who has locked the file - std::string const & locker() const { return locker_; } /// set the owning buffer void owner(Buffer * b) { owner_ = b; } /// return the owning buffer @@ -103,8 +101,6 @@ protected: /// The status of the VC controlled file. VCStatus vcstatus; - /// The user currently keeping the lock on the VC file. - std::string locker_; /// The buffer using this VC Buffer * owner_; }; @@ -164,6 +160,8 @@ private: * string or if it must be a float/int. */ std::string version_; + /// The user currently keeping the lock on the VC file (or "Unlocked"). + std::string locker_; }; @@ -218,6 +216,8 @@ private: support::FileName file_; // revision number from scanMaster std::string version_; + /// The user currently keeping the lock on the VC file. + std::string locker_; }; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 5b3b72d6bc..d6c2e51bdd 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1583,7 +1583,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) case LFUN_VC_LOCKING_TOGGLE: enable = doc_buffer && !doc_buffer->isReadonly() && doc_buffer->lyxvc().lockingToggleEnabled(); - flag.setOnOff(enable && !doc_buffer->lyxvc().locker().empty()); + flag.setOnOff(enable && doc_buffer->lyxvc().locking()); break; case LFUN_VC_REVERT: enable = doc_buffer && doc_buffer->lyxvc().inUse(); diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index ab6aafff7a..1ab194b039 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1192,10 +1192,10 @@ void GuiWorkArea::updateWindowTitle() maximize_title = fileName.displayName(30); minimize_title = from_utf8(fileName.onlyFileName()); if (buf.lyxvc().inUse()) { - if (buf.lyxvc().locker().empty()) - maximize_title += _(" (version control)"); - else + if (buf.lyxvc().locking()) maximize_title += _(" (version control, locking)"); + else + maximize_title += _(" (version control)"); } if (!buf.isClean()) { maximize_title += _(" (changed)");