KIO::Job Class Reference
The base class for all jobs. More...
#include <jobclasses.h>
Inheritance diagram for KIO::Job:

Signals | |
void | result (KIO::Job *job) |
void | canceled (KIO::Job *job) |
void | infoMessage (KIO::Job *job, const QString &msg) |
void | connected (KIO::Job *job) |
void | percent (KIO::Job *job, unsigned long percent) |
void | totalSize (KIO::Job *job, KIO::filesize_t size) |
void | processedSize (KIO::Job *job, KIO::filesize_t size) |
void | speed (KIO::Job *job, unsigned long bytes_per_second) |
Public Methods | |
virtual void | kill (bool quietly=true) |
int | error () const |
int | progressId () const |
const QString & | errorText () const |
QString | errorString () const |
QStringList | detailedErrorStrings (const KURL *reqUrl=0L, int method=-1) const |
void | showErrorDialog (QWidget *parent=0L) |
void | setAutoErrorHandlingEnabled (bool enable, QWidget *parentWidget=0) |
bool | isAutoErrorHandlingEnabled () const |
void | setWindow (QWidget *window) |
QWidget * | window () const |
void | setParentJob (Job *parentJob) |
Job * | parentJob () const |
void | setMetaData (const KIO::MetaData &metaData) |
void | addMetaData (const QString &key, const QString &value) |
void | addMetaData (const QMap< QString, QString > &values) |
void | mergeMetaData (const QMap< QString, QString > &values) |
MetaData | metaData () const |
QString | queryMetaData (const QString &key) |
KIO::filesize_t | getProcessedSize () |
Protected Slots | |
virtual void | slotResult (KIO::Job *job) |
void | slotSpeed (KIO::Job *job, unsigned long bytes_per_second) |
void | slotInfoMessage (KIO::Job *job, const QString &msg) |
void | slotSpeedTimeout () |
Protected Methods | |
virtual void | addSubjob (Job *job, bool inheritMetaData=true) |
virtual void | removeSubjob (Job *job) |
void | emitPercent (KIO::filesize_t processedSize, KIO::filesize_t totalSize) |
void | emitSpeed (unsigned long bytes_per_second) |
void | emitResult () |
void | setProcessedSize (KIO::filesize_t size) |
Detailed Description
The base class for all jobs.For all jobs created in an application, the code looks like
KIO::Job * job = KIO::someoperation( some parameters ); connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) );
And slotResult is usually at least:
if ( job->error() ) job->showErrorDialog( this or 0L );
- See also:
- KIO::Scheduler , KIO::Slave
Definition at line 68 of file jobclasses.h.
Member Function Documentation
|
Abort this job. This kills all subjobs and deletes the job.
Reimplemented in KIO::SimpleJob. Definition at line 210 of file job.cpp. References canceled(), QPtrList< Job >::clear(), QPtrListIterator::current(), emitResult(), Observer::jobFinished(), and Observer::self(). Referenced by KImageFilePreview::clearPreview(), and KIO::ProgressBase::slotStop(). |
|
Returns the error code, if there has been an error. Only call this method from the slot connected to result().
Definition at line 95 of file jobclasses.h. Referenced by KIO::PreviewJob::slotResult(), KIO::DeleteJob::slotResult(), KIO::CopyJob::slotResult(), KIO::FileCopyJob::slotResult(), KIO::TransferJob::slotResult(), slotResult(), KIO::ChmodJob::slotResult(), and KIO::CopyJob::slotResultStating(). |
|
Returns the progress id for this job.
Definition at line 101 of file jobclasses.h. Referenced by Observer::slotTransferring(). |
|
Returns the error text if there has been an error. Only call if error is not 0. This is really internal, better use errorString or errorDialog.
Definition at line 111 of file jobclasses.h. Referenced by KIO::FileCopyJob::slotResult(), KIO::TransferJob::slotResult(), slotResult(), and KIO::ChmodJob::slotResult(). |
|
Converts an error code and a non-i18n error message into an error message in the current language. The low level (non-i18n) error message (usually a url) is put into the translated error message using %1. Example for errid == ERR_CANNOT_OPEN_FOR_READING: i18n( "Could not read\n%1" ).arg( errortext );
Definition at line 173 of file global.cpp. References KIO::buildErrorString(). Referenced by showErrorDialog(). |
|
Converts an error code and a non-i18n error message into i18n strings suitable for presentation in a detailed error message box.
Definition at line 422 of file global.cpp. References QString::arg(), QDateTime::currentDateTime(), KLocale::formatDateTime(), QString::fromLatin1(), KURL::htmlURL(), QString::isNull(), QStringList::join(), KGlobal::locale(), KURL::protocol(), and KIO::rawErrorDetail(). Referenced by showErrorDialog(). |
|
Display a dialog box to inform the user of the error given by this job. Only call if error is not 0, and only in the slot connected to result.
Definition at line 265 of file job.cpp. References detailedErrorStrings(), errorString(), KMessageBox::queuedDetailedError(), and KMessageBox::queuedMessageBox(). Referenced by emitResult(), and KDirLister::handleError(). |
|
Enable or disable the automatic error handling.
When automatic error handling is enabled and an error occurs, then showErrorDialog() is called with the specified The default is false. See also isAutoErrorHandlingEnabled , showErrorDialog
Definition at line 292 of file job.cpp. Referenced by KDirOperator::del(). |
|
Returns whether automatic error handling is enabled or disabled. See also setAutoErrorHandlingEnabled .
|
|
Associate this job with a window given by
Definition at line 303 of file job.cpp. References KIO::Scheduler::registerWindow(). Referenced by addSubjob(), and KDirOperator::del(). |
|
Returns the window this job is associated with.
|
|
Set the parent Job. One example use of this is when FileCopyJob calls open_RenameDlg, it must pass the correct progress ID of the parent CopyJob (to hide the progress dialog). You can set the parent job only once. By default a job does not have a parent job.
|
|
Returns the parent job, if there is one.
Definition at line 321 of file job.cpp. Referenced by KIO::FileCopyJob::slotCanResume(). |
|
Set meta data to be sent to the slave, replacing existing meta data.
|
|
Add key/value pair to the meta data that is sent to the slave.
Definition at line 343 of file job.cpp. References QMap< QString, QString >::insert(), and KStdAccel::key(). Referenced by KIO::get(), KIO::FileCopyJob::slotCanResume(), and KIO::TransferJob::slotFinished(). |
|
Add key/value pairs to the meta data that is sent to the slave. If a certain key already existed, it will be overridden.
Definition at line 348 of file job.cpp. References QMap::begin(), QMapConstIterator::data(), QMap::end(), QMap< QString, QString >::insert(), and QMapConstIterator::key(). |
|
Add key/value pairs to the meta data that is sent to the slave. If a certain key already existed, it will remain unchanged.
Definition at line 355 of file job.cpp. References QMap::begin(), QMapConstIterator::data(), QMap::end(), QMap< QString, QString >::insert(), and QMapConstIterator::key(). Referenced by addSubjob(). |
|
Get meta data received from the slave. (Valid when first data is received and/or slave is finished)
|
|
Query meta data received from the slave. (Valid when first data is received and/or slave is finished)
Definition at line 331 of file job.cpp. References QMap< QString, QString >::contains(), and KStdAccel::key(). Referenced by KIO::ListJob::slotFinished(), KIO::MimetypeJob::slotFinished(), KIO::TransferJob::slotFinished(), and KIO::StatJob::slotFinished(). |
|
Returns the processed size for this job.
Definition at line 137 of file job.cpp. Referenced by KIO::TransferJob::sendAsyncData(). |
|
Emitted when the job is finished, in any case (completed, canceled, failed...). Use error to know the result.
Referenced by addSubjob(), KIO::PreviewJob::availablePlugins(), KIO::MetaInfoJob::availablePlugins(), emitResult(), KIO::PreviewJob::supportedMimeTypes(), and KIO::MetaInfoJob::supportedMimeTypes(). |
|
Referenced by kill(). |
|
Emitted to display information about this job, as sent by the slave. Examples of message are "Resolving host", "Connecting to host...", etc.
Referenced by addSubjob(), KIO::SimpleJob::slotInfoMessage(), and slotInfoMessage(). |
|
Emitted when the slave successfully connected to the host. There is no guarantee the slave will send this, and this is currently unused (in the applications).
Referenced by KIO::SimpleJob::slotConnected(). |
|
Progress signal showing the overall progress of the job This is valid for any kind of job, and allows using a a progress bar very easily. (see KProgress). Note that this signal is not emitted for finished jobs.
Referenced by emitPercent(), KIO::FileCopyJob::slotPercent(), and KIO::DeleteJob::slotProcessedSize(). |
|
Emitted when we know the size of this job (data size for transfers, number of entries for listings).
Referenced by emitPercent(), KIO::CopyJob::slotProcessedSize(), KIO::CopyJob::slotTotalSize(), KIO::FileCopyJob::slotTotalSize(), and KIO::SimpleJob::slotTotalSize(). |
|
Regularly emitted to show the progress of this job (current data size for transfers, entries listed).
Referenced by KIO::TransferJob::sendAsyncData(), KIO::DeleteJob::slotProcessedSize(), KIO::CopyJob::slotProcessedSize(), KIO::FileCopyJob::slotProcessedSize(), and KIO::SimpleJob::slotProcessedSize(). |
|
Emitted to display information about the speed of this job.
Referenced by addSubjob(), emitSpeed(), and slotSpeedTimeout(). |
|
Called whenever a subjob finishes. Default implementation checks for errors and propagates to parent job, then calls removeSubjob. Override if you don't want subjobs errors to be propagated.
Reimplemented in KDirSize, KIO::ChmodJob, KIO::TransferJob, KIO::FileCopyJob, KIO::ListJob, KIO::CopyJob, KIO::DeleteJob, KIO::MetaInfoJob, and KIO::PreviewJob. Definition at line 231 of file job.cpp. References error(), errorText(), and removeSubjob(). Referenced by addSubjob(), and KDirSize::slotResult(). |
|
Forward signal from subjob.
Definition at line 243 of file job.cpp. References emitSpeed(). Referenced by addSubjob(). |
|
Forward signal from subjob.
Definition at line 249 of file job.cpp. References infoMessage(). Referenced by addSubjob(). |
|
Remove speed information.
Definition at line 254 of file job.cpp. References speed(), and QTimer::stop(). Referenced by emitSpeed(). |
|
Add a job that has to be finished before a result is emitted. This has obviously to be called before the finish signal is emitted by the slave.
Definition at line 142 of file job.cpp. References QPtrList< Job >::append(), QObject::connect(), infoMessage(), mergeMetaData(), result(), setWindow(), slotInfoMessage(), slotResult(), slotSpeed(), and speed(). Referenced by KIO::FileCopyJob::slotCanResume(), KIO::DeleteJob::slotResult(), KIO::CopyJob::slotResult(), and KIO::FileCopyJob::slotResult(). |
|
Mark a sub job as being done. If it's the last to wait on the job will emit a result - jobs with two steps might want to override slotResult in order to avoid calling this method.
Definition at line 163 of file job.cpp. References emitResult(), QPtrList< Job >::isEmpty(), and QPtrList< Job >::remove(). Referenced by KIO::ListJob::slotResult(), KIO::FileCopyJob::slotResult(), and slotResult(). |
|
Utility function for inherited jobs. Emits the percent signal if bigger than m_percent, after calculating it from the parameters.
Definition at line 171 of file job.cpp. References percent(), and totalSize(). Referenced by KIO::TransferJob::sendAsyncData(), KIO::CopyJob::slotProcessedSize(), KIO::FileCopyJob::slotProcessedSize(), and KIO::SimpleJob::slotProcessedSize(). |
|
Utility function for inherited jobs. Emits the speed signal and starts the timer for removing that info
Definition at line 187 of file job.cpp. References QObject::connect(), slotSpeedTimeout(), speed(), and QTimer::start(). Referenced by KIO::SimpleJob::slotSpeed(), and slotSpeed(). |
|
Utility function to emit the result signal, and suicide this job. It first tells the observer to hide the progress dialog for this job. Definition at line 199 of file job.cpp. References Observer::jobFinished(), result(), Observer::self(), and showErrorDialog(). Referenced by kill(), KIO::MetaInfoJob::MetaInfoJob(), removeSubjob(), KIO::FileCopyJob::slotCanResume(), KIO::SimpleJob::slotFinished(), KIO::CopyJob::slotResult(), KIO::FileCopyJob::slotResult(), KIO::TransferJob::slotResult(), KIO::ChmodJob::slotResult(), and KIO::CopyJob::slotResultStating(). |
|
Set the processed size, does not emit processedSize
Definition at line 132 of file job.cpp. Referenced by KIO::TransferJob::sendAsyncData(), KIO::DeleteJob::slotProcessedSize(), KIO::CopyJob::slotProcessedSize(), KIO::FileCopyJob::slotProcessedSize(), and KIO::SimpleJob::slotProcessedSize(). |
The documentation for this class was generated from the following files: