diff options
Diffstat (limited to 'src/entry.cpp')
-rw-r--r-- | src/entry.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/entry.cpp b/src/entry.cpp index fc97354..a1274db 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -252,8 +252,13 @@ bool Entry::setField(const TQString& name_, const TQString& value_) { } // the string store is probable only useful for fields with auto-completion or choice/number/bool + bool shareType = f->type() == Field::Choice || + f->type() == Field::Bool || + f->type() == Field::Image || + f->type() == Field::Rating || + f->type() == Field::Number; if(!(f->flags() & Field::AllowMultiple) && - ((f->type() == Field::Choice || f->type() == Field::Bool || f->type() == Field::Number) || + (shareType || (f->type() == Field::Line && (f->flags() & Field::AllowCompletion)))) { m_fields.insert(Tellico::shareString(name_), Tellico::shareString(value_)); } else { @@ -415,6 +420,16 @@ int Entry::compareValues(EntryPtr e1, EntryPtr e2, FieldPtr f) { if(f->name() == Latin1Literal("lccn") && LCCNValidator::formalize(s1) == LCCNValidator::formalize(s2)) { return 5; } + if(f->name() == Latin1Literal("arxiv")) { + // normalize and unVersion arxiv ID + s1.remove(TQRegExp(TQString::fromLatin1("^arxiv:"), false)); + s1.remove(TQRegExp(TQString::fromLatin1("v\\d+$"))); + s2.remove(TQRegExp(TQString::fromLatin1("^arxiv:"), false)); + s2.remove(TQRegExp(TQString::fromLatin1("v\\d+$"))); + if(s1 == s2) { + return 5; + } + } if(f->formatFlag() == Field::FormatName) { s1 = e1->field(f, true).lower(); s2 = e2->field(f, true).lower(); |