72a2afc0 | 2014-10-07 10:59:55 | Timothy Pearson |
Add proper OCS support to the base TDENewStuff class This relates to Bug 2127 |
||
M tdenewstuff/engine.cpp M tdenewstuff/entry.cpp M tdenewstuff/provider.cpp |
||
diff --git a/tdenewstuff/engine.cpp b/tdenewstuff/engine.cpp index f8e7163..1427f7e 100644 --- a/tdenewstuff/engine.cpp +++ b/tdenewstuff/engine.cpp @@ -141,34 +141,51 @@ 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(); - Entry *entry = new Entry( stuff ); + if(stuff.tagName() == "data") + { + content = pn.toElement(); + } + } - mDownloadDialog->show(); + 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; - mDownloadDialog->addEntry( entry ); + Entry *entry = new Entry( stuff ); - kdDebug() << "KNEWSTUFF: " << entry->name() << endl; + mDownloadDialog->show(); - kdDebug() << " SUMMARY: " << entry->summary() << endl; - kdDebug() << " VERSION: " << entry->version() << endl; - kdDebug() << " RELEASEDATE: " << TQString(entry->releaseDate().toString()) << endl; - kdDebug() << " RATING: " << entry->rating() << endl; + mDownloadDialog->addEntry( entry ); - kdDebug() << " LANGS: " << entry->langs().join(", ") << 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() << " LANGS: " << entry->langs().join(", ") << endl; + } } } } diff --git a/tdenewstuff/entry.cpp b/tdenewstuff/entry.cpp index 2713fad..3213f27 100644 --- a/tdenewstuff/entry.cpp +++ b/tdenewstuff/entry.cpp @@ -301,6 +301,10 @@ // FIXME // It appears that OCS has removed the ability to retrieve author EMail; // further confirmation is needed before removing EMail-related code +// NOTE +// OCS also removed the ability to have individually localized names and summaries for a single item +// As this would be a useful feature to add to the OCS system I'm keeping the lang code skeleton in at this time +// Note that the "language" XML tag refers to the intended language of the content, not the language of the entry! void Entry::parseDomElement( const TQDomElement &element ) { if ( element.tagName() != "content" ) return; @@ -308,17 +312,6 @@ TQDomNode n; TQString lang; - for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - TQDomElement e = n.toElement(); - if ( e.tagName() == "language" ) - { - lang = e.text(); - } - } - if (lang == "") { - lang = TQString::null; - } - for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { TQDomElement e = n.toElement(); if ( e.tagName() == "name" ) diff --git a/tdenewstuff/provider.cpp b/tdenewstuff/provider.cpp index 8d576ca..ee76d88 100644 --- a/tdenewstuff/provider.cpp +++ b/tdenewstuff/provider.cpp @@ -316,7 +316,12 @@ //int maxEntries = 50; int maxEntries = 100; - setDownloadUrl( KURL( mBaseURL ) ); + // FIXME + // The download URL assumes no more than 100 entries will be present on the remote server + // Any more and assembly of the list from multiple fetched pages will be required; the TDENewStuff Engine class does not have support for paging at this time + setDownloadUrl( KURL( mBaseURL + "content/data?categories=" + desiredCategories + "&search=&sortmode=alpha&page=0&pagesize=" + TQString("%1").arg(maxEntries) ) ); + // FIXME + // Uploading is not implemented at this time setUploadUrl( KURL( mBaseURL ) ); setNoUploadUrl( KURL( mBaseURL ) ); @@ -347,8 +352,9 @@ cfg->setGroup("TDENewStuff"); TQString providersUrl = providersList; - if( providersUrl.isEmpty() ) - providersUrl = cfg->readEntry( "ProvidersUrl" ); + if( providersUrl.isEmpty() ) { + providersUrl = cfg->readEntry( "ProvidersUrl" ); + } if ( providersUrl.isEmpty() ) { TQString server = cfg->readEntry( "MasterServer", |
||
89a87055 | 2014-10-07 11:00:59 | Timothy Pearson |
Merge branch 'master' of https://scm.trinitydesktop.org/scm/git/tdelibs |
||
M CMakeLists.txt M config.h.cmake M tdeabc/CMakeLists.txt M tdecore/CMakeLists.txt M tdecore/kdemacros.h.cmake M tdecore/kinstance.cpp M tdecore/kinstance.h M tdecore/tdeglobal.cpp |
||
diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ee5c1..45f161b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,8 @@ OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON ) OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} ) -option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_ALL_OPTIONS} ) +option( WITH_TDEHWLIB "Enable TDE hwlib globally" ON ) +option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_TDEHWLIB} ) option( WITH_HAL "Enable HAL support" OFF ) option( WITH_DEVKITPOWER "Enable DeviceKit Power support" OFF ) option( WITH_LOGINDPOWER "Enable Logind/Systemd Power support" OFF ) @@ -455,16 +456,29 @@ endif( HAVE_RES_INIT) set( CMAKE_REQUIRED_LIBRARIES util ) -check_c_source_runs(" - #include <pty.h> - int main(int argc, char* argv) { - int master_fd, slave_fd; - int result; - result = openpty(&master_fd, &slave_fd, 0, 0, 0); - return 0; - }" - HAVE_OPENPTY -) +if( HAVE_PTY_H ) + check_c_source_runs(" + #include <pty.h> + int main(int argc, char* argv) { + int master_fd, slave_fd; + int result; + result = openpty(&master_fd, &slave_fd, 0, 0, 0); + return 0; + }" + HAVE_OPENPTY + ) +elseif( HAVE_UTIL_H ) + check_c_source_runs(" + #include <util.h> + int main(int argc, char* argv) { + int master_fd, slave_fd; + int result; + result = openpty(&master_fd, &slave_fd, 0, 0, 0); + return 0; + }" + HAVE_OPENPTY + ) +endif( ) if( HAVE_OPENPTY ) set( LIB_UTIL util ) endif( ) @@ -493,6 +507,10 @@ set( KDELIBSUFF "${LIB_SUFFIX}" ) set( kde_socklen_t socklen_t ) +if( WITH_TDEHWLIB ) + set( __TDE_HAVE_TDEHWLIB 1 ) +endif( WITH_TDEHWLIB ) + ##### check for libdl ########################### diff --git a/config.h.cmake b/config.h.cmake index 7dcd1ae..b1e4eb3 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -389,7 +389,7 @@ #cmakedefine HAVE_MEMORY_H 1 /* Define if you want MIT-SHM support */ -#undef HAVE_MITSHM +#cmakedefine HAVE_MITSHM @HAVE_MITSHM@ /* Define if you have mkdtemp */ #cmakedefine HAVE_MKDTEMP 1 @@ -822,13 +822,13 @@ /* Define to the name of the environment variable that determines the dynamic library search path. */ -#undef LTDL_SHLIBPATH_VAR +#cmakedefine LTDL_SHLIBPATH_VAR "@LTDL_SHLIBPATH_VAR@" /* Define to the extension used for shared libraries, say, ".so". */ #undef LTDL_SHLIB_EXT /* Define to the system default library search path. */ -#undef LTDL_SYSSEARCHPATH +#cmakedefine LTDL_SYSSEARCHPATH "@LTDL_SYSSEARCHPATH@" /* Define to the sub-directory in which libtool stores uninstalled libraries. */ @@ -927,10 +927,10 @@ #endif /* where rgb.txt is in */ -#undef X11_RGBFILE +#cmakedefine X11_RGBFILE "@X11_RGBFILE@" /* Defines the executable of xmllint */ -#undef XMLLINT +#cmakedefine XMLLINT "@XMLLINT@" /* Defined if your system has XRandR support */ #cmakedefine XRANDR_SUPPORT 1 @@ -1189,10 +1189,10 @@ #undef __KDE_HAVE_GCC_VISIBILITY /* path to su */ -#define __PATH_SU "@__PATH_SU@" +#cmakedefine __PATH_SU "@__PATH_SU@" ** Diff limit reached (max: 250 lines) ** |