Dot not swallow log messages

This commit is contained in:
Georg Baum 2013-02-03 19:21:54 +01:00
parent e82cc5d498
commit 1a48d5a967
3 changed files with 12 additions and 10 deletions

View File

@ -2253,8 +2253,11 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
switch (func.action()) { switch (func.action()) {
case LFUN_BUFFER_TOGGLE_READ_ONLY: case LFUN_BUFFER_TOGGLE_READ_ONLY:
if (lyxvc().inUse()) if (lyxvc().inUse()) {
lyxvc().toggleReadOnly(); string log = lyxvc().toggleReadOnly();
if (!log.empty())
dr.setMessage(log);
}
else else
setReadonly(!isReadonly()); setReadonly(!isReadonly());
break; break;

View File

@ -259,25 +259,24 @@ void LyXVC::undoLast()
} }
void LyXVC::toggleReadOnly() string LyXVC::toggleReadOnly()
{ {
if (!vcs) if (!vcs)
return; return string();
if (!vcs->toggleReadOnlyEnabled()) if (!vcs->toggleReadOnlyEnabled())
return; return string();
switch (vcs->status()) { switch (vcs->status()) {
case VCS::UNLOCKED: case VCS::UNLOCKED:
LYXERR(Debug::LYXVC, "LyXVC: toggle to locked"); LYXERR(Debug::LYXVC, "LyXVC: toggle to locked");
checkOut(); return checkOut();
break;
case VCS::LOCKED: case VCS::LOCKED:
LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked"); LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked");
checkIn(); return checkIn();
break;
case VCS::NOLOCKING: case VCS::NOLOCKING:
break; break;
} }
return string();
} }

View File

@ -135,7 +135,7 @@ public:
* keep things in synchro once we would allow user to toggle * keep things in synchro once we would allow user to toggle
* read-only flags. * read-only flags.
*/ */
void toggleReadOnly(); std::string toggleReadOnly();
/// Is the document under administration by VCS? /// Is the document under administration by VCS?
bool inUse() const; bool inUse() const;