void FavIconRequestJobPrivate::slotData(Job *job, const QByteArray &data) { KIO::TransferJob *tjob = static_cast<KIO::TransferJob *>(job); unsigned int oldSize = m_iconData.size(); // Size limit. Stop downloading if the file is huge. // Testcase (as of june 2008, at least): http://planet-soc.com/favicon.ico, 136K and strange format. // Another case: sites which redirect from "/favicon.ico" to "/" and return the main page. if (oldSize > 0x10000) { // 65K qCDebug(FAVICONS_LOG) << "Favicon too big, aborting download of" << tjob->url(); const QUrl iconUrl = tjob->url(); KIO::FavIconsCache::instance()->addFailedDownload(iconUrl); tjob->kill(KJob::EmitResult); } else { m_iconData.resize(oldSize + data.size()); memcpy(m_iconData.data() + oldSize, data.data(), data.size()); } }
void DccTransferRecv::slotLocalCanResume( KIO::Job* job, KIO::filesize_t size ) { kdDebug() << "DccTransferRecv::slotLocalCanResume() [BEGIN]" << endl << "DccTransferRecv::slotLocalCanResume(): size: " << QString::number( size ) << endl; if ( size != 0 ) { KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job ); disconnect( transferJob, 0, 0, 0 ); transferJob->kill(); if ( KonversationApplication::instance()->getDccTransferManager()->isLocalFileInWritingProcess( m_fileURL ) ) { askAndPrepareLocalKio( i18n( "<b>The file is used by another transfer.</b><br>" "%1<br>" ) .arg( m_fileURL.prettyURL() ), DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel, DccResumeDialog::RA_Rename ); } else if ( Preferences::dccAutoResume() ) { prepareLocalKio( false, true, size ); } else { askAndPrepareLocalKio( i18n( "<b>A partial file exists.</b><br>" "%1<br>" "Size of the partial file: %2 bytes<br>" ) .arg( m_fileURL.prettyURL() ) .arg( KGlobal::locale()->formatNumber( size, 0 ) ), DccResumeDialog::RA_Resume | DccResumeDialog::RA_Overwrite | DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel, DccResumeDialog::RA_Resume, size ); } } kdDebug() << "DccTransferRecv::slotLocalCanResume() [END]" << endl; }