From 72a2afc0afd917e93249d034b968079135588c7e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 7 Oct 2014 10:59:55 -0500 Subject: Add proper OCS support to the base TDENewStuff class This relates to Bug 2127 --- tdenewstuff/engine.cpp | 53 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'tdenewstuff/engine.cpp') diff --git a/tdenewstuff/engine.cpp b/tdenewstuff/engine.cpp index f8e7163a9..1427f7eb7 100644 --- a/tdenewstuff/engine.cpp +++ b/tdenewstuff/engine.cpp @@ -141,34 +141,51 @@ void Engine::slotNewStuffJobResult( TDEIO::Job *job ) TQDomDocument doc; if ( !doc.setContent( knewstuffDoc ) ) { - kdDebug() << "Error parsing knewstuff.xml." << endl; + kdDebug() << "Error parsing OCS response." << endl; return; - } else { + } + else { TQDomElement knewstuff = doc.documentElement(); if ( knewstuff.isNull() ) { - kdDebug() << "No document in knewstuffproviders.xml." << endl; - } else { - TQDomNode p; - for ( p = knewstuff.firstChild(); !p.isNull(); p = p.nextSibling() ) { - TQDomElement stuff = p.toElement(); - if ( stuff.tagName() != "stuff" ) continue; - if ( stuff.attribute("type", mType) != mType ) continue; + kdDebug() << "No document in OCS response." << endl; + } + else { + TQDomElement content; + for(TQDomNode pn = knewstuff.firstChild(); !pn.isNull(); pn = pn.nextSibling()) + { + TQDomElement stuff = pn.toElement(); + + if(stuff.tagName() == "data") + { + content = pn.toElement(); + } + } + + if ( content.isNull() ) { + kdDebug() << "No content in OCS response." << endl; + } + else { + TQDomNode p; + for ( p = content.firstChild(); !p.isNull(); p = p.nextSibling() ) { + TQDomElement stuff = p.toElement(); + if ( stuff.tagName() != "content" ) continue; - Entry *entry = new Entry( stuff ); + Entry *entry = new Entry( stuff ); - mDownloadDialog->show(); + mDownloadDialog->show(); - mDownloadDialog->addEntry( entry ); + mDownloadDialog->addEntry( entry ); - kdDebug() << "KNEWSTUFF: " << entry->name() << endl; + kdDebug() << "KNEWSTUFF: " << entry->name() << endl; - kdDebug() << " SUMMARY: " << entry->summary() << endl; - kdDebug() << " VERSION: " << entry->version() << endl; - kdDebug() << " RELEASEDATE: " << TQString(entry->releaseDate().toString()) << endl; - kdDebug() << " RATING: " << entry->rating() << endl; + kdDebug() << " SUMMARY: " << entry->summary() << endl; + kdDebug() << " VERSION: " << entry->version() << endl; + kdDebug() << " RELEASEDATE: " << TQString(entry->releaseDate().toString()) << endl; + kdDebug() << " RATING: " << entry->rating() << endl; - kdDebug() << " LANGS: " << entry->langs().join(", ") << endl; + kdDebug() << " LANGS: " << entry->langs().join(", ") << endl; + } } } } -- cgit v1.2.1