From kde-commits Thu Dec 31 21:28:39 2009 From: Robby Stephenson Date: Thu, 31 Dec 2009 21:28:39 +0000 To: kde-commits Subject: extragear/office/tellico Message-Id: <1262294919.294215.26981.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=126229492832241 SVN commit 1068316 by rstephenson: temporary fix for discogs download and unit test M +1 -0 ChangeLog M +5 -1 src/core/filehandler.cpp M +4 -1 src/core/netaccess.cpp M +7 -4 src/fetch/discogsfetcher.cpp M +2 -2 src/tests/CMakeLists.txt A src/tests/discogsfetchertest.cpp [License: GPL (v2/3)] A src/tests/discogsfetchertest.h [License: GPL (v2/3)] --- trunk/extragear/office/tellico/ChangeLog #1068315:1068316 @@ -1,6 +1,7 @@ 2009-12-31 Robby Stephenson * Fixed adding "link-only" files (BUG #220645). + * Fixed Discogs track download and title search. 2009-12-22 Robby Stephenson --- trunk/extragear/office/tellico/src/core/filehandler.cpp #1068315:1068316 @@ -66,7 +66,11 @@ } if(allowCompressed_) { - m_device = KFilterDev::deviceForFile(m_filename); + // a gzip'd temporary file won't have a suffix of .gx + // so KFilterDev::deviceForFile won't work + // just assume it's always gzip + QIODevice* fileDevice = new QFile(m_filename); + m_device = KFilterDev::device(fileDevice, QLatin1String("application/x-gzip")); } else { m_device = new QFile(m_filename); } --- trunk/extragear/office/tellico/src/core/netaccess.cpp #1068315:1068316 @@ -42,6 +42,7 @@ if(url_.isLocalFile()) { return KIO::NetAccess::download(url_, target_, window_); } + Q_ASSERT(target_.isEmpty()); // copied from KIO::NetAccess::download() apidox except for quiet part if(target_.isEmpty()) { KTemporaryFile tmpFile; @@ -64,7 +65,9 @@ if(KIO::NetAccess::synchronousRun(getJob, window_)) { return true; } - getJob->ui()->showErrorMessage(); + if(getJob->ui()) { + getJob->ui()->showErrorMessage(); + } return false; } --- trunk/extragear/office/tellico/src/fetch/discogsfetcher.cpp #1068315:1068316 @@ -57,9 +57,12 @@ using Tellico::Fetch::DiscogsFetcher; DiscogsFetcher::DiscogsFetcher(QObject* parent_) - : Fetcher(parent_), m_xsltHandler(0), - m_limit(DISCOGS_MAX_RETURNS_TOTAL), - m_job(0), m_started(false) { + : Fetcher(parent_) + , m_xsltHandler(0) + , m_limit(DISCOGS_MAX_RETURNS_TOTAL) + , m_job(0) + , m_started(false) + , m_apiKey(QLatin1String(DISCOGS_API_KEY)) { } DiscogsFetcher::~DiscogsFetcher() { @@ -104,7 +107,7 @@ case Title: u.setPath(QLatin1String("/search")); u.addQueryItem(QLatin1String("q"), request().value); - u.addQueryItem(QLatin1String("type"), QLatin1String("release")); + u.addQueryItem(QLatin1String("type"), QLatin1String("releases")); break; case Person: --- trunk/extragear/office/tellico/src/tests/CMakeLists.txt #1068315:1068316 @@ -102,8 +102,8 @@ KDE4_ADD_UNIT_TEST(citebasefetchertest NOGUI citebasefetchertest.cpp) TARGET_LINK_LIBRARIES(citebasefetchertest fetch ${TELLICO_TEST_LIBS}) -#KDE4_ADD_UNIT_TEST(discogsfetchertest NOGUI discogsfetchertest.cpp) -#TARGET_LINK_LIBRARIES(discogsfetchertest fetch ${TELLICO_TEST_LIBS}) +KDE4_ADD_UNIT_TEST(discogsfetchertest NOGUI discogsfetchertest.cpp) +TARGET_LINK_LIBRARIES(discogsfetchertest fetch ${TELLICO_TEST_LIBS}) KDE4_ADD_UNIT_TEST(googlescholarfetchertest NOGUI googlescholarfetchertest.cpp) TARGET_LINK_LIBRARIES(googlescholarfetchertest fetch ${TELLICO_TEST_LIBS})