[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/akregator/src
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2005-04-08 7:29:49
Message-ID: 20050408072949.0BC63643 () office ! kde ! org
[Download RAW message or body]

CVS commit by osterfeld: 

some fixes concerning expiration of articles. I hope that helps to fix the unread \
count problems. Otherwise I have to debug a bit more what goes wrong with the unread \
count.


  M +8 -14     akregator_view.cpp   1.234
  M +16 -9     feed.cpp   1.89


--- kdepim/akregator/src/akregator_view.cpp  #1.233:1.234
@@ -1508,11 +1508,8 @@ void View::slotSetSelectedArticleUnread(
 
     MyArticle article = ali->article();
-    Feed* feed = article.feed();
-    if (article.status() != MyArticle::Read)
-    {
+    
         m_articles->setReceiveUpdates(false, false);
         article.setStatus(MyArticle::Unread);
         m_articles->setReceiveUpdates(true, false);
-    }
 }
 
@@ -1525,11 +1522,8 @@ void View::slotSetSelectedArticleNew()
 
     MyArticle article = ali->article();
-    Feed* feed = article.feed();
-        if (article.status() != MyArticle::Read)
-    {
+    
         m_articles->setReceiveUpdates(false, false);
         article.setStatus(MyArticle::New);
         m_articles->setReceiveUpdates(true, false);
-    }
 }
 

--- kdepim/akregator/src/feed.cpp  #1.88:1.89
@@ -148,5 +148,8 @@ void Feed::recalcUnreadCount()
     ArticleSequence::Iterator en = tarticles.end();
 
+    int oldUnread = m_archive->unread();
+    
     int unread = 0;
+
     for (it = tarticles.begin(); it != en; ++it)
         if (!(*it).isDeleted() && (*it).status() != MyArticle::Read)
@@ -152,5 +155,10 @@ void Feed::recalcUnreadCount()
         if (!(*it).isDeleted() && (*it).status() != MyArticle::Read)
             ++unread;
+
+    if (unread != oldUnread)
+    {
     m_archive->setUnread(unread);
+        modified();
+    }
 }
 
@@ -275,5 +283,5 @@ void Feed::appendArticles(const Document
         }
         // if the article's guid is no hash but an ID, we have to check if the \
                article was updated. That's done by comparing the hash values.
-        else if (!mya.guidIsHash() && mya.hash() != (*old).hash() && \
!mya.isDeleted()) +        else if (!mya.guidIsHash() && mya.hash() != (*old).hash() \
&& !(*old).isDeleted())  {
             mya.setKeep((*old).keep());
@@ -284,5 +292,5 @@ void Feed::appendArticles(const Document
             changed = true;
         }
-        else if (mya.isDeleted())
+        else if ((*old).isDeleted())
             deletedArticles.remove(mya);
     }
@@ -331,5 +339,5 @@ void Feed::appendArticle(const MyArticle
     if ( a.keep() || ( !usesExpiryByAge() || !isExpired(a) ) ) // if not expired
     {
-        if (a.status() != MyArticle::Read)
+        if (!a.isDeleted() && a.status() != MyArticle::Read)
         {
             setUnread(unread()+1);
@@ -489,7 +497,7 @@ void Feed::slotDeleteExpiredArticles()
         return;
 
-    ArticleSequence::ConstIterator it = m_articles.end();
-    ArticleSequence::ConstIterator tmp;
-    ArticleSequence::ConstIterator begin = m_articles.begin();
+    ArticleSequence::Iterator it = m_articles.end();
+    ArticleSequence::Iterator tmp;
+    ArticleSequence::Iterator begin = m_articles.begin();
     // when we found an article which is not yet expired, we can stop, since \
articles are sorted by date  bool foundNotYetExpired = false;
@@ -503,6 +511,5 @@ void Feed::slotDeleteExpiredArticles()
             {
                 tmp = it;
-                m_archive->deleteArticle((*tmp).guid());
-                m_articles.remove(*tmp);
+                (*tmp).setDeleted();
                 changed = true;
             }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic