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

List:       kde-commits
Subject:    [kdepim-runtime/akregator_port] krsslocal: fixed retrieveItems() to handle errors while parsing xml
From:       Alessandro Cosentino <cosenal () gmail ! com>
Date:       2012-03-31 15:16:46
Message-ID: 20120331151646.5EAB4A60FE () git ! kde ! org
[Download RAW message or body]

Git commit d7e9c1f6d9c91f15845fc74ee6b6900fabec0929 by Alessandro Cosentino.
Committed on 20/08/2011 at 15:03.
Pushed by osterfeld into branch 'akregator_port'.

fixed retrieveItems() to handle errors while parsing xml

M  +10   -20   krsslocal/krsslocalresource.cpp
M  +1    -4    krsslocal/krsslocalresource.h

http://commits.kde.org/kdepim-runtime/d7e9c1f6d9c91f15845fc74ee6b6900fabec0929

diff --git a/krsslocal/krsslocalresource.cpp b/krsslocal/krsslocalresource.cpp
index 5dfc27a..d4fffa4 100644
--- a/krsslocal/krsslocalresource.cpp
+++ b/krsslocal/krsslocalresource.cpp
@@ -82,7 +82,7 @@ void KRssLocalResource::retrieveCollections()
     
     //it customizes the root collection with an opml icon
     top.attribute<Akonadi::EntityDisplayAttribute>( Collection::AddIfMissing \
                )->setIconName( QString("application-opml+xml") );
-    //TODO: modify CMakeLists.txt to install the icon
+    //TODO: modify CMakeLists.txt so that it installs the icon
     
     Collection::List list;
     list = buildCollectionTree(parser.topLevelNodes(), list, top); 
@@ -96,8 +96,6 @@ Collection::List KRssLocalResource::buildCollectionTree( \
QList<shared_ptr<const  {
     list << parent;
   
-    
-    
     foreach(const shared_ptr<const ParsedNode> parsedNode, listOfNodes) {
       if (!parsedNode->isFolder()) {
 	    Collection c = (static_pointer_cast<const \
ParsedFeed>(parsedNode))->toAkonadiCollection(); @@ -221,36 +219,28 @@ void \
KRssLocalResource::itemRemoved( const Akonadi::Item &item )  // of this template code \
to keep it simple  }
 
-void KRssLocalResource::intervalFetch()
-{
-
-}
-
-void KRssLocalResource::fetchFeed(const Akonadi::Collection &feed)
-{
-    Q_UNUSED(feed);
-}
-
 void KRssLocalResource::slotLoadingComplete(Syndication::Loader* loader, \
Syndication::FeedPtr feed,   Syndication::ErrorCode status)
 {
      Q_UNUSED(loader);
      
-     if (status != Syndication::Success)
-         return;
+     if (status != Syndication::Success) {
+	    kWarning() << "Error while parsing xml file";
+	    itemsRetrievalDone();
+	    return;
+     }
 
      QString title = feed->title();
      const QList<Syndication::ItemPtr> syndItems = feed->items();
      Akonadi::Item::List items;
      Q_FOREACH( const Syndication::ItemPtr& syndItem, syndItems ) {
-            Akonadi::Item item;
-            item.setRemoteId( syndItem->id() );
-	    item.setMimeType( QLatin1String("application/rss+xml") );
-	    
+            kWarning() << syndItem->title();
+	    Akonadi::Item item( QLatin1String("application/rss+xml") );
+	    item.setRemoteId( syndItem->id() );
             items << item;
      }
      
-     itemsRetrieved(items);
+     itemsRetrieved( items );
 
 }
 
diff --git a/krsslocal/krsslocalresource.h b/krsslocal/krsslocalresource.h
index e558616..d28a888 100644
--- a/krsslocal/krsslocalresource.h
+++ b/krsslocal/krsslocalresource.h
@@ -26,12 +26,9 @@ class KRssLocalResource : public Akonadi::ResourceBase,
     void retrieveCollections();
     void retrieveItems( const Akonadi::Collection &col );
     bool retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts );
-    
-  private Q_SLOTS:
-    void intervalFetch();
     void slotLoadingComplete(Syndication::Loader* loader, Syndication::FeedPtr feed, \
  Syndication::ErrorCode status);
-    
+        
   protected:
     virtual void aboutToQuit();
 


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

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