[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/office/tellico/src
From: Robby Stephenson <robby () periapsis ! org>
Date: 2009-12-31 22:24:09
Message-ID: 1262298249.153371.31058.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1068327 by rstephenson:
use storedtransferjob instead, to have automatic gzip handling
M +4 -12 core/filehandler.cpp
M +2 -2 core/filehandler.h
M +14 -0 core/netaccess.cpp
M +2 -2 fetch/discogsfetcher.cpp
--- trunk/extragear/office/tellico/src/core/filehandler.cpp #1068326:1068327
@@ -48,7 +48,7 @@
using Tellico::FileHandler;
-FileHandler::FileRef::FileRef(const KUrl& url_, bool quiet_, bool allowCompressed_) \
: m_device(0), m_isValid(false) { +FileHandler::FileRef::FileRef(const KUrl& url_, \
bool quiet_) : m_device(0), m_isValid(false) { if(url_.isEmpty()) {
return;
}
@@ -65,15 +65,7 @@
return;
}
- if(allowCompressed_) {
- // 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);
- }
+ m_device = new QFile(m_filename);
m_isValid = true;
}
@@ -111,8 +103,8 @@
return new FileRef(url_, quiet_);
}
-QString FileHandler::readTextFile(const KUrl& url_, bool quiet_/*=false*/, bool \
useUTF8_ /*false*/, bool compress_/*=false*/) {
- FileRef f(url_, quiet_, compress_);
+QString FileHandler::readTextFile(const KUrl& url_, bool quiet_/*=false*/, bool \
useUTF8_ /*false*/) { + FileRef f(url_, quiet_);
if(!f.isValid()) {
return QString();
}
--- trunk/extragear/office/tellico/src/core/filehandler.h #1068326:1068327
@@ -69,7 +69,7 @@
private:
friend class FileHandler;
- explicit FileRef(const KUrl& url, bool quiet=false, bool allowCompressed=false);
+ explicit FileRef(const KUrl& url, bool quiet=false);
QIODevice* m_device;
QString m_filename;
bool m_isValid;
@@ -94,7 +94,7 @@
* @param allowCompressed Whether to check if the file is compressed or not
* @return A string containing the contents of a file
*/
- static QString readTextFile(const KUrl& url, bool quiet=false, bool useUTF8=false, \
bool allowCompressed=false); + static QString readTextFile(const KUrl& url, bool \
quiet=false, bool useUTF8=false); /**
* Read contents of an XML file into a QDomDocument.
*
--- trunk/extragear/office/tellico/src/core/netaccess.cpp #1068326:1068327
@@ -61,10 +61,24 @@
if(quiet_) {
flags |= KIO::HideProgressInfo;
}
+#if 0
+ // some http files get returned gzip'd and file_copy just copies the gzipd data
+ // but the FileRef can't handlle that automatically
KIO::Job* getJob = KIO::file_copy(url_, dest, -1, flags);
if(KIO::NetAccess::synchronousRun(getJob, window_)) {
return true;
}
+#else
+ // KIO::storedGet seems to handle Content-Encoding: gzip ok
+ KIO::StoredTransferJob* getJob = KIO::storedGet(url_, KIO::NoReload, flags);
+ if(KIO::NetAccess::synchronousRun(getJob, window_)) {
+ QFile f(target_);
+ if(f.open(QIODevice::WriteOnly)) {
+ f.write(getJob->data());
+ return true;
+ }
+ }
+#endif
if(getJob->ui()) {
getJob->ui()->showErrorMessage();
}
--- trunk/extragear/office/tellico/src/fetch/discogsfetcher.cpp #1068326:1068327
@@ -262,9 +262,9 @@
// myDebug() << "url: " << u;
// quiet, utf8, allowCompressed
- QString output = FileHandler::readTextFile(u, true, true, true);
+ QString output = FileHandler::readTextFile(u, true, true);
-#if 0
+#if 1
myWarning() << "Remove output debug from discogsfetcher.cpp";
QFile f(QLatin1String("/tmp/test2.xml"));
if(f.open(QIODevice::WriteOnly)) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic