mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
* src/Author.h:
* src/Changes.cpp: * src/support/userinfo.cpp: * src/Paragraph.cpp: * src/Changes.h: * src/Buffer.cpp: * src/Paragraph.h: * src/BufferParams.cpp: do not save the name of authors in LyX documents, who have not made a single change in change tracking mode git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
39cf8bcf16
commit
7f74d469a4
12
src/Author.h
12
src/Author.h
@ -26,7 +26,7 @@ public:
|
||||
Author() {}
|
||||
|
||||
Author(docstring const & name, docstring const & email)
|
||||
: name_(name), email_(email) {}
|
||||
: name_(name), email_(email), used_(true) {}
|
||||
|
||||
docstring const name() const {
|
||||
return name_;
|
||||
@ -36,12 +36,22 @@ public:
|
||||
return email_;
|
||||
}
|
||||
|
||||
void used(bool u) const {
|
||||
used_ = u;
|
||||
}
|
||||
|
||||
bool used() const {
|
||||
return used_;
|
||||
}
|
||||
|
||||
friend std::istream & operator>>(std::istream & os, Author & a);
|
||||
|
||||
private:
|
||||
docstring name_;
|
||||
|
||||
docstring email_;
|
||||
|
||||
mutable bool used_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -846,6 +846,19 @@ bool Buffer::write(ostream & ofs) const
|
||||
<< "\\lyxformat " << LYX_FORMAT << "\n"
|
||||
<< "\\begin_document\n";
|
||||
|
||||
|
||||
/// For each author, set 'used' to true if there is a change
|
||||
/// by this author in the document; otherwise set it to 'false'.
|
||||
AuthorList::Authors::const_iterator a_it = params().authors().begin();
|
||||
AuthorList::Authors::const_iterator a_end = params().authors().end();
|
||||
for (; a_it != a_end; ++a_it)
|
||||
a_it->second.used(false);
|
||||
|
||||
ParIterator const end = par_iterator_end();
|
||||
ParIterator it = par_iterator_begin();
|
||||
for ( ; it != end; ++it)
|
||||
it->checkAuthors(params().authors());
|
||||
|
||||
// now write out the buffer parameters.
|
||||
ofs << "\\begin_header\n";
|
||||
params().writeFile(ofs);
|
||||
|
@ -766,7 +766,10 @@ void BufferParams::writeFile(ostream & os) const
|
||||
AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
|
||||
AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
|
||||
for (; a_it != a_end; ++a_it) {
|
||||
os << "\\author " << a_it->second << "\n";
|
||||
if (a_it->second.used())
|
||||
os << "\\author " << a_it->second << "\n";
|
||||
else
|
||||
os << "\\author " << Author() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,4 +357,13 @@ void Changes::lyxMarkChange(std::ostream & os, int & column,
|
||||
}
|
||||
|
||||
|
||||
void Changes::checkAuthors(AuthorList const & authorList)
|
||||
{
|
||||
ChangeTable::const_iterator it = table_.begin();
|
||||
ChangeTable::const_iterator endit = table_.end();
|
||||
for ( ; it != endit ; ++it)
|
||||
if (it->change.type != Change::UNCHANGED)
|
||||
authorList.get(it->change.author).used(true);
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class AuthorList;
|
||||
|
||||
class Change {
|
||||
public:
|
||||
@ -85,6 +86,9 @@ public:
|
||||
static void lyxMarkChange(std::ostream & os, int & column,
|
||||
Change const & old, Change const & change);
|
||||
|
||||
///
|
||||
void checkAuthors(AuthorList const & authorList);
|
||||
|
||||
private:
|
||||
class Range {
|
||||
public:
|
||||
|
@ -210,7 +210,7 @@ public:
|
||||
///
|
||||
ParagraphParameters params;
|
||||
|
||||
private:
|
||||
//private:
|
||||
///
|
||||
pos_type size() const { return owner_->size(); }
|
||||
/// match a string against a particular point in the paragraph
|
||||
@ -2682,4 +2682,10 @@ int Paragraph::checkBiblio(bool track_changes)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::checkAuthors(AuthorList const & authorList)
|
||||
{
|
||||
pimpl_->changes_.checkAuthors(authorList);
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -368,6 +368,10 @@ public:
|
||||
/// was previously past that position. Return 0 otherwise.
|
||||
int checkBiblio(bool track_changes);
|
||||
|
||||
/// For each author, set 'used' to true if there is a change
|
||||
/// by this author in the paragraph.
|
||||
void checkAuthors(AuthorList const & authorList);
|
||||
|
||||
public:
|
||||
///
|
||||
InsetList insetlist;
|
||||
|
@ -36,11 +36,6 @@ namespace support {
|
||||
|
||||
docstring const user_name()
|
||||
{
|
||||
//FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
|
||||
//The code after should be used only after user approval.
|
||||
return from_ascii("Anonymous");
|
||||
|
||||
|
||||
#if defined (_WIN32)
|
||||
|
||||
char name[UNLEN + 1];
|
||||
|
Loading…
Reference in New Issue
Block a user