Example #1
0
 void _k_receivedContentType(KIO::Job* job, const QString& mimetype)
 {
     KIO::TransferJob* tJob = qobject_cast<KIO::TransferJob*>(job);
     if (tJob && !tJob->error()) {
         tJob->putOnHold();
         KIO::Scheduler::publishSlaveOnHold();
         // Get suggested file name...
         mimeType = mimetype;
         const QString suggestedFileName (tJob->queryMetaData(QL1S("content-disposition-filename")));
         // kDebug(800) << "suggested filename:" << suggestedFileName << ", mimetype:" << mimetype;
         (void) downloadResource(tJob->url(), suggestedFileName, window, tJob->metaData());
     }
 }
Example #2
0
void TestLinkItr::slotJobResult(KJob *job)
{
    kDebug();
    m_job = 0;

    KIO::TransferJob *transfer = static_cast<KIO::TransferJob *>(job);
    const QString modDate = transfer->queryMetaData("modified");

    if (transfer->error() || transfer->isErrorPage()) {
        kDebug()<<"***********"<<transfer->error()<<"  "<<transfer->isErrorPage()<<endl;
        // can we assume that errorString will contain no entities?
        QString err = transfer->errorString();
        err.replace("\n", " ");
        setStatus(err);
    } else {
        if (!modDate.isEmpty())
            setStatus(modDate);
        else
            setStatus(i18n("OK"));
    }

    holder()->addAffectedBookmark(KBookmark::parentAddress(currentBookmark().address()));
    delayedEmitNextOne();
}