Bug 84471 - Items are unsorted if no pub dates are provided (only rdf?)
Summary: Items are unsorted if no pub dates are provided (only rdf?)
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: cvs
Platform: Unlisted Binaries Linux
: VHI major
Target Milestone: ---
Assignee: Sashmit Bhaduri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-04 21:09 UTC by Frank Osterfeld
Modified: 2004-07-11 20:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Osterfeld 2004-07-04 21:09:19 UTC
Articles are totally unsorted after the initial fetch,  
if the items have no pubdate element.  
IMO in this case the order in the rss file should be preserved.  
Example: http://www.gentoo.org/rdf/en/glsa-index.rdf 
This is rdf, i am not sure if that is a rdf-only problem.
Comment 1 Stanislav Karchebny 2004-07-04 22:03:24 UTC
In the absence of pubDate field sorting goes completely bonkers. I think this is something top-priority before beta5.

Lets call it "Sort out sorting".
Comment 2 Sashmit Bhaduri 2004-07-08 17:38:01 UTC
should only break if feed has more than 59 items upon fetching.
Comment 3 Sashmit Bhaduri 2004-07-08 17:48:59 UTC
CVS commit by sashmit: 

/me stabs all feeds that don't have pubDate.. like the dot..

- unbreak sorting of feeds that have more than 60 items
- honor the structure of the feed if no pubDate is given.. which
  is reverse of what we were doing.

Note that this reverses all articles in the dot. We need to find out 
whether it's more common in feeds without pubDate/dc:date/date to list
articles in chronological (GLSA) or reverse chronological order (like the dot)

CCMAIL: 84471-done@bugs.kde.org


  M +11 -2     feed.cpp   1.38
  M +6 -5      myarticle.cpp   1.15
  M +1 -0      myarticle.h   1.8


--- kdenonbeta/akregator/src/feed.cpp  #1.37:1.38
@@ -19,4 +19,5 @@
 
 #include <qtimer.h>
+#include <qdatetime.h>
 #include <qlistview.h>
 #include <qdom.h>
@@ -118,4 +119,7 @@ void Feed::appendArticles(const Document
     Article::List::ConstIterator en = d.articles().end();
     //kdDebug() << "m_unread before appending articles=="<<m_unread<<endl;
+    
+    int nudge=0;
+
     for (it = d.articles().begin(); it != en; ++it)
     {
@@ -133,5 +137,8 @@ void Feed::appendArticles(const Document
                         mya.setStatus(MyArticle::Unread);
                 }
+
+                mya.offsetFetchTime(nudge);
                 appendArticle(mya);
+                nudge++;
             }
             //else{
@@ -147,10 +154,12 @@ void Feed::appendArticles(const Document
                     mya.setStatus(MyArticle::Unread);
             }
+        
+            mya.offsetFetchTime(nudge);
             appendArticle(mya);
+            nudge++;
         }
     }
     articles.enableSorting(true);
     articles.sort();
-    //kdDebug() << "m_unread after appending articles=="<<m_unread<<endl;
 }
 

--- kdenonbeta/akregator/src/myarticle.cpp  #1.14:1.15
@@ -33,11 +33,7 @@ MyArticle::MyArticle() : d(new Private)
 MyArticle::MyArticle(Article article) : d(new Private)
 {
-    static int padding=60;
-    padding--;
-    if (padding==1)
-        padding=60;
     d->article = article;
     d->fetchDate = QDateTime::currentDateTime();
-    d->fetchDate=d->fetchDate.addSecs(padding); // temp HACK..
+    
     if (article.title().isEmpty())
         d->title=buildTitle();
@@ -69,4 +65,9 @@ MyArticle &MyArticle::operator=(const My
 }
 
+void MyArticle::offsetFetchTime(int secs)
+{
+    d->fetchDate=d->fetchDate.addSecs(secs);
+}
+
 bool MyArticle::operator<(const MyArticle &other) const
 {

--- kdenonbeta/akregator/src/myarticle.h  #1.7:1.8
@@ -42,4 +42,5 @@ namespace Akregator
              */
             bool isTheSameAs(const MyArticle &other);
+            void offsetFetchTime(int secs);
 
             QString title() const;


Comment 4 Wilbert Berendsen 2004-07-11 20:38:25 UTC
I think the articles in the Dot should appear with the same order as in the RDF file. Now they appear in reverse order. They are added from the beginning to the end, but in the qlistview the items that are added last appear at the beginning.