Mercurial > hg > svcore
comparison data/fileio/FileSource.cpp @ 461:2019d89ebcf9
* Some work on querying and cacheing plugin RDF from a central index
author | Chris Cannam |
---|---|
date | Fri, 17 Oct 2008 15:26:29 +0000 |
parents | 93fb1ebff76b |
children | 70b333085952 |
comparison
equal
deleted
inserted
replaced
460:93fb1ebff76b | 461:2019d89ebcf9 |
---|---|
419 } | 419 } |
420 | 420 |
421 void | 421 void |
422 FileSource::cleanup() | 422 FileSource::cleanup() |
423 { | 423 { |
424 if (m_done) { | |
425 delete m_localFile; // does not actually delete the file | |
426 m_localFile = 0; | |
427 } | |
424 m_done = true; | 428 m_done = true; |
425 if (m_http) { | 429 if (m_http) { |
426 QHttp *h = m_http; | 430 QHttp *h = m_http; |
427 m_http = 0; | 431 m_http = 0; |
428 h->abort(); | 432 h->abort(); |
432 QFtp *f = m_ftp; | 436 QFtp *f = m_ftp; |
433 m_ftp = 0; | 437 m_ftp = 0; |
434 f->abort(); | 438 f->abort(); |
435 f->deleteLater(); | 439 f->deleteLater(); |
436 } | 440 } |
437 delete m_localFile; // does not actually delete the file | 441 if (m_localFile) { |
438 m_localFile = 0; | 442 delete m_localFile; // does not actually delete the file |
443 m_localFile = 0; | |
444 } | |
439 } | 445 } |
440 | 446 |
441 bool | 447 bool |
442 FileSource::isRemote(QString fileOrUrl) | 448 FileSource::isRemote(QString fileOrUrl) |
443 { | 449 { |
658 } | 664 } |
659 } | 665 } |
660 | 666 |
661 if (error) { | 667 if (error) { |
662 #ifdef DEBUG_FILE_SOURCE | 668 #ifdef DEBUG_FILE_SOURCE |
663 std::cerr << "FileSource::done: error is " << error << ", deleting cache file" << std::endl; | 669 std::cerr << "FileSource::done: error is " << error << " (\"" |
670 << m_errorString.toStdString() << "\"), deleting cache file" << std::endl; | |
664 #endif | 671 #endif |
665 deleteCacheFile(); | 672 deleteCacheFile(); |
666 } | 673 } |
667 | 674 |
668 m_ok = !error; | 675 m_ok = !error; |
754 QDir dir(getPersistentCacheDirectory()); | 761 QDir dir(getPersistentCacheDirectory()); |
755 | 762 |
756 QString filename = | 763 QString filename = |
757 QString::fromLocal8Bit | 764 QString::fromLocal8Bit |
758 (QCryptographicHash::hash(url.toString().toLocal8Bit(), | 765 (QCryptographicHash::hash(url.toString().toLocal8Bit(), |
759 QCryptographicHash::Sha1).toBase64()); | 766 QCryptographicHash::Sha1).toHex()); |
760 | 767 |
761 return dir.filePath(filename); | 768 return dir.filePath(filename); |
762 } | 769 } |
763 | 770 |
764 bool | 771 bool |