diff options
Diffstat (limited to 'src/collections')
-rw-r--r-- | src/collections/filecatalog.cpp | 17 | ||||
-rw-r--r-- | src/collections/filecatalog.h | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/collections/filecatalog.cpp b/src/collections/filecatalog.cpp index 92d088f..afba7fc 100644 --- a/src/collections/filecatalog.cpp +++ b/src/collections/filecatalog.cpp @@ -102,4 +102,21 @@ Tellico::Data::FieldVec FileCatalog::defaultFields() { return list; } +int FileCatalog::sameEntry(Data::EntryPtr entry1_, Data::EntryPtr entry2_) const { + // equal urls are always equal, even if modification time or something is different + if(Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("url"), this) > 0) { + return 100; // good match + } + // if volume or created time is different, it can't be same entry + if(Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("volume"), this) == 0 || + Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("created"), this) == 0 || + Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("size"), this) == 0) { + return 0; + } + int res = Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("title"), this); + res += Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("description"), this); + res += Entry::compareValues(entry1_, entry2_, TQString::fromLatin1("mimetype"), this); + return res; +} + #include "filecatalog.moc" diff --git a/src/collections/filecatalog.h b/src/collections/filecatalog.h index f2ede29..6a08dc9 100644 --- a/src/collections/filecatalog.h +++ b/src/collections/filecatalog.h @@ -1,5 +1,5 @@ /*************************************************************************** - copyright : (C) 2005-2006 by Robby Stephenson + copyright : (C) 2005-2008 by Robby Stephenson email : robby@periapsis.org ***************************************************************************/ @@ -30,6 +30,7 @@ public: FileCatalog(bool addFields, const TQString& title = TQString()); virtual Type type() const { return File; } + virtual int sameEntry(Data::EntryPtr entry1, Data::EntryPtr entry2) const; static FieldVec defaultFields(); }; |