kjob.h docs error

David Faure faure at kde.org
Wed May 20 13:02:17 BST 2009


On Thursday 14 May 2009, Martin Koller wrote:
> -     * Do not call it if error() is not 0.
> +     * Only call if error is not 0.

Correct.

> Beside that: how can a job fail but have NO error text ?

Happens with e.g. KIO::ERR_USER_CANCELED, or ERR_NO_CONTENT,
since those are handled programmatically and not shown to the user.

> In my case KIO::copy() to a remote url "sftp://machine/path"
> calls my slotResult(KJob *theJob) and theJob->error() gives 1.

   KilledJobError = 1,

> In this case I also call  theJob->uiDelegate()->showErrorMessage();
> but I see no dialog (I'm running my KDE4 (4.2.3) ported kbackup program
> inside a KDE3 session if that matters).

void KDialogJobUiDelegate::showErrorMessage()
{
    if ( job()->error() != KJob::KilledJobError )
    {
        KMessageBox::queuedMessageBox( d->errorParentWidget, KMessageBox::Error, job()->errorString() );
    }
}

The program killed the job, there is no reason to show the user "the program changed
its mind and killed your job". It's up to the program to handle this, it might or might not
be an error.

If you have no idea why it's killed, put a breakpoint in KJob::kill :-)

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list