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

List:       kde-commits
Subject:    [kdepim-runtime/akregator_port] krsslocal: small bugs fixed in methods that write back to opml
From:       Alessandro Cosentino <cosenal () gmail ! com>
Date:       2012-03-31 15:16:46
Message-ID: 20120331151646.A6B61A6128 () git ! kde ! org
[Download RAW message or body]

Git commit 9c2c8f79cf535bd9ee14a7a26a6d90d235a4a61c by Alessandro Cosentino.
Committed on 09/09/2011 at 23:13.
Pushed by osterfeld into branch 'akregator_port'.

small bugs fixed in methods that write back to opml

M  +20   -21   krsslocal/krsslocalresource.cpp
M  +5    -2    krsslocal/opmlparser.cpp
M  +6    -3    krsslocal/util.cpp

http://commits.kde.org/kdepim-runtime/9c2c8f79cf535bd9ee14a7a26a6d90d235a4a61c

diff --git a/krsslocal/krsslocalresource.cpp b/krsslocal/krsslocalresource.cpp
index 7e868c9..d05d929 100644
--- a/krsslocal/krsslocalresource.cpp
+++ b/krsslocal/krsslocalresource.cpp
@@ -92,9 +92,6 @@ QString KRssLocalResource::mimeType()
 void KRssLocalResource::retrieveCollections()
 {
     
-    //it forces previous changes of the Collections to be written back
-    fetchCollections();
-  
     const QString path = Settings::self()->path();
     
     /* We'll parse the opml file */
@@ -292,7 +289,8 @@ void KRssLocalResource::itemChanged( const Akonadi::Item &item, \
const QSet<QByte  
 void KRssLocalResource::collectionChanged(const Akonadi::Collection& collection)
 {  
-  Q_UNUSED( collection );
+
+  changeCommitted( collection );
   
   if (!writeBackTimer->isActive()) {
       writeBackTimer->start(WRITE_BACK_TIMEOUT);
@@ -322,24 +320,25 @@ void KRssLocalResource::fetchCollectionsFinished(KJob *job) {
 void KRssLocalResource::writeFeedsToOpml(const QString &path, const \
QList<boost::shared_ptr< const ParsedNode> >& nodes)  {
   
-  KSaveFile file( path );
-  if ( !file.open( QIODevice::ReadWrite | QIODevice::Text ) ) {
-     error( i18n("Could not open %1: %2", path, file.errorString()) );
-     return;
- }
- 
-  QXmlStreamWriter writer( &file );
-  writer.setAutoFormatting( true );
-  writer.writeStartDocument();
-  OpmlWriter::writeOpml( writer, nodes, QLatin1String("test_title")); //TODO: \
                replace with the actual title
-  writer.writeEndDocument();
-  
-  if ( !file.finalize() ) {
-     error( i18n("Could not save %1: %2", path, file.errorString()) );
-  }
-  file.close();
-  return;
+    KSaveFile file( path );
+    if ( !file.open( QIODevice::ReadWrite | QIODevice::Text ) ) {
+      error( i18n("Could not open %1: %2", path, file.errorString()) );
+      return;
+    }
   
+    QXmlStreamWriter writer( &file );
+    writer.setAutoFormatting( true );
+    writer.writeStartDocument();
+    OpmlWriter::writeOpml( writer, nodes, QLatin1String("test_title")); //TODO: \
replace with the actual title +    writer.writeEndDocument();
+    
+    if ( !file.finalize() ) {
+      error( i18n("Could not save %1: %2", path, file.errorString()) );
+    }
+    
+    file.close();
+    return;
+    
 }
 
 
diff --git a/krsslocal/opmlparser.cpp b/krsslocal/opmlparser.cpp
index 4cc1b6a..6d9d83b 100644
--- a/krsslocal/opmlparser.cpp
+++ b/krsslocal/opmlparser.cpp
@@ -183,7 +183,7 @@ shared_ptr<ParsedFeed> ParsedFeed::fromAkonadiCollection( const \
Akonadi::Collect  {
     const KRss::FeedCollection feedCollection = collection;
     shared_ptr<ParsedFeed> parsedFeed( new ParsedFeed );
-    parsedFeed->setTitle( feedCollection.title() );
+    parsedFeed->setTitle( collection.name() );
     parsedFeed->d->xmlUrl = feedCollection.xmlUrl();
     parsedFeed->d->htmlUrl = feedCollection.htmlUrl();
     parsedFeed->d->description = feedCollection.description();
@@ -487,13 +487,16 @@ void OpmlWriter::writeOutlineFeed( QXmlStreamWriter& writer, \
const shared_ptr<co  writer.writeStartElement( QLatin1String("outline") );
     writer.writeAttribute( QLatin1String("text"), feed->title() );
     writer.writeAttribute( QLatin1String("title"), feed->title() );
-    writer.writeAttribute( QLatin1String("description"), feed->description() );
+//    writer.writeAttribute( QLatin1String("description"), feed->description() );
     writer.writeAttribute( QLatin1String("htmlUrl"), feed->htmlUrl() );
     writer.writeAttribute( QLatin1String("xmlUrl"), feed->xmlUrl() );
+    writer.writeAttribute( QLatin1String("type"), feed->type());
+/*    
     QHashIterator<QString, QString> it( feed->attributes() );
     while ( it.hasNext() ) {
         it.next();
         writer.writeAttribute( it.key(), it.value() );
     }
+*/
     writer.writeEndElement();   // outline
 }
diff --git a/krsslocal/util.cpp b/krsslocal/util.cpp
index f1b06fb..54d7d94 100644
--- a/krsslocal/util.cpp
+++ b/krsslocal/util.cpp
@@ -145,17 +145,20 @@ QList< boost::shared_ptr< const KRssResource::ParsedNode > > \
KRssResource::Util:  node = ParsedFeed::fromAkonadiCollection ( collection );
 	    }
 	    else if (feedCollection.feedType() == QLatin1String( "" )) { //it's a feed. \
again, correct test??? +		QList< boost::shared_ptr< const KRssResource::ParsedNode > \
> children = parsedDescendants( collections, collection ); +		if (parent == \
> Akonadi::Collection::root()) {
+		    return children;
+		}
 		boost::shared_ptr<ParsedFolder> parsedFolder( new ParsedFolder );
 		parsedFolder->setTitle( feedCollection.name() );
-		QList< boost::shared_ptr< const KRssResource::ParsedNode > > children = \
parsedDescendants( collections, collection );  parsedFolder->setChildren( children );
-		
-		node = parsedFolder;		  
+		node = parsedFolder;		
 	    }
 	    else {
 		kWarning() << "Collection type not recognized";
 	    }
 	    collections.removeOne( collection );
+
 	    nodesList.append( node );
 	}
     }


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

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