From a97f1ddf0695aba97d5a821012fb4aaaf21d2c38 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Fri, 12 Feb 2010 01:44:04 +0000 Subject: [PATCH] Connect to InsetInfo git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33426 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 10 ++++++---- src/insets/InsetInfo.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 14dac1d46c..7aa037a580 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3490,11 +3490,13 @@ bool Buffer::loadLyXFile(FileName const & s) && !LyXVC::file_not_found_hook(s)) return false; - if (s.isReadableFile() - && readFileHelper(s)) { + if (s.isReadableFile()){ + // InsetInfo needs to know if file is under VCS lyxvc().file_found_hook(s); - setReadonly(!s.isWritable()); - return true; + if (readFileHelper(s)) { + setReadonly(!s.isWritable()); + return true; + } } return false; } diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 10b16bbef1..0df2fd5941 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -23,6 +23,7 @@ #include "LayoutFile.h" #include "LyXAction.h" #include "LyXRC.h" +#include "LyXVC.h" #include "Lexer.h" #include "MetricsInfo.h" #include "ParagraphParameters.h" @@ -173,7 +174,8 @@ bool InsetInfo::validateModifyArgument(docstring const & arg) const case TEXTCLASS_INFO: return true; case BUFFER_INFO: - return name == "name" || name == "path" || name == "class"; + return name == "name" || name == "path" || name == "class" || + name == "file-revision"; } return false; } @@ -371,6 +373,9 @@ void InsetInfo::updateInfo() setText(from_utf8(buffer().filePath())); else if (name_ == "class") setText(from_utf8(bp.documentClass().name())); + else if (name_ == "file-revision" && buffer().lyxvc().inUse() && + !buffer().lyxvc().revisionInfo(LyXVC::File).empty()) + setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::File))); else setText(_("Unknown buffer info")); break;