Fix comparison operators of Article, such as < and <=.
This fixes problems with QMap and articles having identical pubdate (operator< just compared pubdates, and QMap consideres
articles as equal when items are not comparable).
Fixes 114997 navigation problems and prevents creation of a new item when selecting an unread dupe article. (a new item was
created as map lookup failed).
SVN commit 495480 by osterfeld:
Fix comparison operators of Article, such as < and <=.
This fixes problems with QMap and articles having identical pubdate (operator< just compared pubdates, and QMap consideres
articles as equal when items are not comparable).
Fixes 114997 navigation problems and prevents creation of a new item when selecting an unread dupe article. (a new item was
created as map lookup failed).
BUG: 114997
M +6 -4 article.cpp
--- branches/ KDE/3.5/ kdepim/ akregator/ src/article. cpp #495479:495480
@@ -241,22 +241,24 @@
bool Article: :operator< (const Article &other) const
{
- return pubDate() > other.pubDate();
+ return pubDate() > other.pubDate() ||
+ (pubDate() == other.pubDate() && guid() < other.guid() );
}
bool Article: :operator< =(const Article &other) const
{
- return pubDate() >= other.pubDate();
+ return (pubDate() > other.pubDate() || *this == other);
}
bool Article: :operator> (const Article &other) const
{
- return pubDate() < other.pubDate();
+ return pubDate() < other.pubDate() ||
+ (pubDate() == other.pubDate() && guid() > other.guid() );
}
bool Article: :operator> =(const Article &other) const
{
- return pubDate() <= other.pubDate();
+ return (pubDate() > other.pubDate() || *this == other);
}
bool Article: :operator= =(const Article &other) const