Ejemplo n.º 1
0
void DccTransferRecv::slotLocalGotResult( KIO::Job* job )
{
    kdDebug() << "DccTransferRecv::slotLocalGotResult() [BEGIN]" << endl;

    KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job );
    disconnect( transferJob, 0, 0, 0 );

    switch ( transferJob->error() )
    {
        case 0:                                   // no error
            kdDebug() << "DccTransferRecv::slotLocalGotResult(): job->error() returned 0." << endl
                << "DccTransferRecv::slotLocalGotResult(): Why was I called in spite of no error?" << endl;
            break;
        case KIO::ERR_FILE_ALREADY_EXIST:
            askAndPrepareLocalKio( i18n( "<b>The file already exists.</b><br>"
                "%1<br>" )
                .arg( m_fileURL.prettyURL() ),
                DccResumeDialog::RA_Overwrite | DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel,
                DccResumeDialog::RA_Overwrite );
            break;
        default:
            askAndPrepareLocalKio( i18n( "<b>Could not open the file.<br>"
                "Error: %1</b><br>"
                "%2<br>" )
                .arg( transferJob->error() )
                .arg( m_fileURL.prettyURL() ),
                DccResumeDialog::RA_Rename | DccResumeDialog::RA_Cancel,
                DccResumeDialog::RA_Rename );
    }

    kdDebug() << "DccTransferRecv::slotLocalGotResult() [END]" << endl;
}
Ejemplo n.º 2
0
 void _k_contentTypeCheckFailed(KJob* job)
 {
     KIO::TransferJob* tJob = qobject_cast<KIO::TransferJob*>(job);
     // On error simply call downloadResource which will probably fail as well.
     if (tJob && tJob->error()) {
         (void)downloadResource(tJob->url(), QString(), window, tJob->metaData());
     }
 }
Ejemplo n.º 3
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());
     }
 }
Ejemplo n.º 4
0
void KonqRun::scanFile()
{
    KParts::BrowserRun::scanFile();
    // could be a static cast as of now, but who would notify when
    // BrowserRun changes
    KIO::TransferJob *job = dynamic_cast<KIO::TransferJob*>(KRun::job());
    if (job && !job->error()) {
        connect(job, SIGNAL(redirection(KIO::Job*,KUrl)),
                SLOT(slotRedirection(KIO::Job*,KUrl)));
        if (m_pView && m_pView->service()->desktopEntryName() != "konq_sidebartng") {
            connect(job, SIGNAL(infoMessage(KJob*,QString,QString)),
                    m_pView, SLOT(slotInfoMessage(KJob*,QString)));
        }
    }
}
Ejemplo n.º 5
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();
}