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

List:       kde-commits
Subject:    playground/pim/krss/resources/libkrssresource
From:       Dmitry Ivanov <vonami () gmail ! com>
Date:       2009-06-14 14:44:01
Message-ID: 1244990641.537605.30115.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 981955 by divanov:

retrieveItems() should handle fetch starting/stopping like fetchFeed() does


 M  +17 -0     rssresourcebase.cpp  


--- trunk/playground/pim/krss/resources/libkrssresource/rssresourcebase.cpp #981954:981955
@@ -348,7 +348,13 @@
     job->setBackendJob( backendJob );
     job->setSynchronizeFlags( flagsSynchronizable() );
     connect( job, SIGNAL( result( KJob* ) ), this, SLOT( slotItemsRetrieved( KJob* ) ) );
+    connect( job, SIGNAL( percent( KJob*, unsigned long) ),
+             this, SLOT( slotFetchPercent( KJob*, unsigned long ) ) );
+    d->m_fetchJobs.insert( job, collection.id() );
     job->start();
+    emit fetchStarted( collection.id() );
+    if ( d->m_fetchJobs.count() == 1 )
+        emit fetchQueueStarted();
     return;
 }
 
@@ -486,11 +492,22 @@
 
 void RssResourceBase::slotItemsRetrieved( KJob * job )
 {
+    Q_ASSERT( d->m_fetchJobs.contains( job ) );
+    const KRss::Feed::Id id = d->m_fetchJobs.take( job );
+
     if ( job->error() ) {
         kWarning() << "Failed to retrieve items";
         kWarning() << job->errorString();
+        ( job->error() == KJob::KilledJobError ? emit fetchAborted( id ) :
+                                                 emit fetchFailed( id, job->errorString() ) );
     }
+    else {
+        emit fetchFinished( id );
+    }
 
+    if ( d->m_fetchJobs.count() == 0 )
+        emit fetchQueueFinished();
+
     itemsRetrievalDone();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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