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

List:       kde-commits
Subject:    KDE/kdepim/akregator/src
From:       Teemu Rytilahti <tpr () d5k ! net>
Date:       2008-08-22 0:14:02
Message-ID: 1219364042.224904.406.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 850675 by rytilahti:

use a singleshot timer to add the favicon listener. randomizes the timer's timeout \
between 1-4000ms, hope it isn't too much. this causes gui to show-up before starting \
doing the fetches and behave nicer for the user.

 M  +8 -2      feed.cpp  
 M  +2 -0      feed.h  


--- trunk/KDE/kdepim/akregator/src/feed.cpp #850674:850675
@@ -42,6 +42,7 @@
 #include <KIcon>
 #include <kstandarddirs.h>
 #include <kurl.h>
+#include <KRandom>
 
 //#include <qtl.h>
 
@@ -52,6 +53,7 @@
 #include <QIcon>
 #include <QList>
 #include <QPixmap>
+#include <QTimer>
 
 #include <boost/bind.hpp>
 
@@ -367,8 +369,8 @@
 void Feed::setXmlUrl(const QString& s)
 {
     d->xmlUrl = s;
-    if( ! Settings::fetchOnStartup() ) // TODO: perhaps this should have a \
randomized timer also not to block the ui on startup? another option could be a \
                favicon cache, which may not be a bad idea..
-        FeedIconManager::self()->addListener( KUrl( d->xmlUrl ), this );
+    if( ! Settings::fetchOnStartup() )
+        QTimer::singleShot(KRandom::random() % 4000, this, \
SLOT(slotAddFeedIconListener())); // TODO: let's give a gui some time to show up \
before starting the fetch when no fetch on startup is used. replace this with \
something proper later...  }
 
 QString Feed::htmlUrl() const { return d->htmlUrl; }
@@ -449,6 +451,10 @@
     }
 }
 
+void Feed::slotAddFeedIconListener()
+{
+    FeedIconManager::self()->addListener( KUrl( d->xmlUrl ), this );
+}
 
 void Feed::appendArticles(const Syndication::FeedPtr feed)
 {
--- trunk/KDE/kdepim/akregator/src/feed.h #850674:850675
@@ -228,6 +228,8 @@
 
         /** add this feed to the fetch queue @c queue */
         void slotAddToFetchQueue(Akregator::FetchQueue* queue, bool \
intervalFetchOnly=false); +        
+        void slotAddFeedIconListener();
 
     signals:
         /** emitted when fetching started */


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

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