BufferList should not determine that the current author has id = 0. This should really be in AuthorList. Besides BufferList shouldn't have to create an Author by itself.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35921 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-29 19:27:55 +00:00
parent be40bdeb3e
commit 0c9da47505
5 changed files with 17 additions and 4 deletions

View File

@ -90,6 +90,13 @@ void AuthorList::record(int id, Author const & a)
}
void AuthorList::recordCurrentAuthor(Author const & a)
{
// current author has id 0
record(0, a);
}
Author const & AuthorList::get(int id) const
{
LASSERT(id < (int)authors_.size() , /**/);

View File

@ -62,6 +62,8 @@ public:
///
void record(int id, Author const & a);
///
void recordCurrentAuthor(Author const & a);
///
Author const & get(int id) const;
///
typedef std::vector<Author> Authors;

View File

@ -295,12 +295,12 @@ Buffer * BufferList::getBufferFromTmp(string const & s)
}
void BufferList::setCurrentAuthor(docstring const & name, docstring const & email)
void BufferList::recordCurrentAuthor(Author const & author)
{
BufferStorage::iterator it = bstore.begin();
BufferStorage::iterator end = bstore.end();
for (; it != end; ++it)
(*it)->params().authors().record(0, Author(name, email));
(*it)->params().authors().recordCurrentAuthor(author);
}

View File

@ -19,6 +19,7 @@
namespace lyx {
class Author;
class Buffer;
class OutputParams;
@ -102,7 +103,7 @@ public:
/// \name Functions that just operate on all buffers
//@{
/// reset current author for all buffers
void setCurrentAuthor(docstring const & name, docstring const & email);
void recordCurrentAuthor(Author const & author);
/// Call changed() on all buffers, internal or not
void changed(bool update_metrics) const;
/// emergency save for all buffers

View File

@ -21,6 +21,7 @@
#include "GuiKeySymbol.h"
#include "qt_helpers.h"
#include "Author.h"
#include "BufferList.h"
#include "Color.h"
#include "ColorSet.h"
@ -3152,7 +3153,9 @@ void GuiPreferences::dispatchParams()
dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
// FIXME: these need lfuns
// FIXME UNICODE
theBufferList().setCurrentAuthor(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
Author const & author =
Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
theBufferList().recordCurrentAuthor(author);
lyx::formats = formats_;