• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • KIO
  • Job
Signals | Public Member Functions | Protected Member Functions | List of all members
KIO::Job Class Reference

#include <jobclasses.h>

Inheritance diagram for KIO::Job:
KCompositeJob KJob QObject KIO::ChmodJob KIO::CopyJob KIO::DeleteJob KIO::DirectorySizeJob KIO::FileCopyJob KIO::MetaInfoJob KIO::PreviewJob KIO::SimpleJob

Signals

void canceled (KJob *job)
 
void connected (KIO::Job *job)
 
- Signals inherited from KJob
void description (KJob *job, const QString &title, const QPair< QString, QString > &field1=qMakePair(QString(), QString()), const QPair< QString, QString > &field2=qMakePair(QString(), QString()))
 
void finished (KJob *job)
 
void infoMessage (KJob *job, const QString &plain, const QString &rich=QString())
 
void percent (KJob *job, unsigned long percent)
 
void processedAmount (KJob *job, KJob::Unit unit, qulonglong amount)
 
void processedSize (KJob *job, qulonglong size)
 
void result (KJob *job)
 
void resumed (KJob *job)
 
void speed (KJob *job, unsigned long speed)
 
void suspended (KJob *job)
 
void totalAmount (KJob *job, KJob::Unit unit, qulonglong amount)
 
void totalSize (KJob *job, qulonglong size)
 
void warning (KJob *job, const QString &plain, const QString &rich=QString())
 

Public Member Functions

virtual ~Job ()
 
void addMetaData (const QMap< QString, QString > &values)
 
void addMetaData (const QString &key, const QString &value)
 
QStringList detailedErrorStrings (const KUrl *reqUrl=0L, int method=-1) const
 
QString errorString () const
 
bool isInteractive () const
 
void mergeMetaData (const QMap< QString, QString > &values)
 
MetaData metaData () const
 
MetaData outgoingMetaData () const
 
Job * parentJob () const
 
QString queryMetaData (const QString &key)
 
void setMetaData (const KIO::MetaData &metaData)
 
void setParentJob (Job *parentJob)
 
void showErrorDialog (QWidget *parent=0)
 
void start ()
 
JobUiDelegate * ui () const
 
- Public Member Functions inherited from KCompositeJob
 KCompositeJob (QObject *parent=0)
 
virtual ~KCompositeJob ()
 
- Public Member Functions inherited from KJob
 KJob (QObject *parent=0)
 
virtual ~KJob ()
 
Capabilities capabilities () const
 
int error () const
 
virtual QString errorString () const
 
QString errorText () const
 
bool exec ()
 
bool isAutoDelete () const
 
bool isSuspended () const
 
unsigned long percent () const
 
qulonglong processedAmount (Unit unit) const
 
void setAutoDelete (bool autodelete)
 
void setUiDelegate (KJobUiDelegate *delegate)
 
virtual void start ()=0
 
qulonglong totalAmount (Unit unit) const
 
KJobUiDelegate * uiDelegate () const
 

Protected Member Functions

 Job ()
 
 Job (JobPrivate &dd)
 
virtual bool addSubjob (KJob *job)
 
virtual bool doKill ()
 
virtual bool doResume ()
 
virtual bool doSuspend ()
 
virtual bool removeSubjob (KJob *job)
 
- Protected Member Functions inherited from KCompositeJob
 KCompositeJob (KCompositeJobPrivate &dd, QObject *parent)
 
virtual bool addSubjob (KJob *job)
 
void clearSubjobs ()
 
bool hasSubjobs ()
 
virtual bool removeSubjob (KJob *job)
 
const QList< KJob * > & subjobs () const
 
- Protected Member Functions inherited from KJob
 KJob (KJobPrivate &dd, QObject *parent)
 
virtual bool doKill ()
 
virtual bool doResume ()
 
virtual bool doSuspend ()
 
void emitPercent (qulonglong processedAmount, qulonglong totalAmount)
 
void emitResult ()
 
void emitSpeed (unsigned long speed)
 
void setCapabilities (Capabilities capabilities)
 
void setError (int errorCode)
 
void setErrorText (const QString &errorText)
 
void setPercent (unsigned long percentage)
 
void setProcessedAmount (Unit unit, qulonglong amount)
 
void setTotalAmount (Unit unit, qulonglong amount)
 

Additional Inherited Members

- Public Types inherited from KJob
enum  Capability
 
enum  KillVerbosity
 
enum  Unit
 
- Public Slots inherited from KJob
bool kill (KillVerbosity verbosity=Quietly)
 
bool resume ()
 
bool suspend ()
 
- Public Attributes inherited from KJob
 Bytes
 
 Directories
 
 EmitResult
 
 Files
 
 Killable
 
 KilledJobError
 
 NoCapabilities
 
 NoError
 
 Quietly
 
 Suspendable
 
 UserDefinedError
 
- Protected Slots inherited from KCompositeJob
virtual void slotInfoMessage (KJob *job, const QString &plain, const QString &rich)
 
virtual void slotResult (KJob *job)
 
- Protected Attributes inherited from KJob
KJobPrivate *const d_ptr
 

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( KJob * ) ),
this, SLOT( slotResult( KJob * ) ) );
KCompositeJob::slotResult
virtual void slotResult(KJob *job)
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KJob
KJob::result
void result(KJob *job)

(other connects, specific to the job)

And slotResult is usually at least:

if ( job->error() )
job->uiDelegate()->showErrorMessage();
KJobUiDelegate::showErrorMessage
virtual void showErrorMessage()
KJob::error
int error() const
KJob::uiDelegate
KJobUiDelegate * uiDelegate() const
See also
KIO::Scheduler

Definition at line 94 of file jobclasses.h.

Constructor & Destructor Documentation

◆ Job() [1/2]

Job::Job ( )
protected

Definition at line 76 of file job.cpp.

◆ Job() [2/2]

Job::Job ( JobPrivate &  dd)
protected

Definition at line 81 of file job.cpp.

◆ ~Job()

Job::~Job ( )
virtual

Definition at line 86 of file job.cpp.

Member Function Documentation

◆ addMetaData() [1/2]

void Job::addMetaData ( const QMap< QString, QString > &  values)

Add key/value pairs to the meta data that is sent to the slave.

If a certain key already existed, it will be overridden.

Parameters
valuesthe meta data to add
See also
setMetaData()
mergeMetaData()

Definition at line 269 of file job.cpp.

◆ addMetaData() [2/2]

void Job::addMetaData ( const QString &  key,
const QString &  value 
)

Add key/value pair to the meta data that is sent to the slave.

Parameters
keythe key of the meta data
valuethe value of the meta data
See also
setMetaData()
mergeMetaData()

Definition at line 264 of file job.cpp.

◆ addSubjob()

bool Job::addSubjob ( KJob *  job)
protectedvirtual

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.

Parameters
jobthe subjob to add

Reimplemented from KCompositeJob.

Definition at line 95 of file job.cpp.

◆ canceled

void KIO::Job::canceled ( KJob *  job)
signal
Deprecated:
. Don't use ! Emitted when the job is canceled. Signal result() is emitted as well, and error() is, in this case, ERR_USER_CANCELED.
Parameters
jobthe job that emitted this signal

◆ connected

void KIO::Job::connected ( KIO::Job *  job)
signal

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).

Parameters
jobthe job that emitted this signal

◆ detailedErrorStrings()

QStringList KIO::Job::detailedErrorStrings ( const KUrl *  reqUrl = 0L,
int  method = -1 
) const

Converts an error code and a non-i18n error message into i18n strings suitable for presentation in a detailed error message box.

Parameters
reqUrlthe request URL that generated this error message
methodthe method that generated this error message (unimplemented)
Returns
the following strings: caption, error + description, causes+solutions

Definition at line 419 of file global.cpp.

◆ doKill()

bool Job::doKill ( )
protectedvirtual

Abort this job.

This kills all subjobs and deletes the job.

Reimplemented from KJob.

Reimplemented in KIO::SimpleJob.

Definition at line 175 of file job.cpp.

◆ doResume()

bool Job::doResume ( )
protectedvirtual

Resume this job.

See also
suspend

Reimplemented from KJob.

Reimplemented in KIO::SimpleJob, KIO::TransferJob, and KIO::FileCopyJob.

Definition at line 196 of file job.cpp.

◆ doSuspend()

bool Job::doSuspend ( )
protectedvirtual

Suspend this job.

See also
resume

Reimplemented from KJob.

Reimplemented in KIO::CopyJob, KIO::SimpleJob, and KIO::FileCopyJob.

Definition at line 186 of file job.cpp.

◆ errorString()

QString KIO::Job::errorString ( ) const
virtual

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 );
i18n
QString i18n(const char *text)

Use this to display the error yourself, but for a dialog box use uiDelegate()->showErrorMessage(). Do not call it if error() is not 0.

Returns
the error message and if there is no error, a message telling the user that the app is broken, so check with error() whether there is an error

Reimplemented from KJob.

Definition at line 159 of file global.cpp.

◆ isInteractive()

bool Job::isInteractive ( ) const

Returns whether the user should be asked about things when the job is unsure, like whether to overwrite existing files etc.

Returns
true if user interactions are enabled (true by default), false if setUiDelegate(0) was called.
See also
setUiDelegate()

Definition at line 230 of file job.cpp.

◆ mergeMetaData()

void Job::mergeMetaData ( const QMap< QString, QString > &  values)

Add key/value pairs to the meta data that is sent to the slave.

If a certain key already existed, it will remain unchanged.

Parameters
valuesthe meta data to merge
See also
setMetaData()
addMetaData()

Definition at line 277 of file job.cpp.

◆ metaData()

MetaData Job::metaData ( ) const

Get meta data received from the slave.

(Valid when first data is received and/or slave is finished)

Returns
the job's meta data

Definition at line 248 of file job.cpp.

◆ outgoingMetaData()

MetaData Job::outgoingMetaData ( ) const

. For the scheduler. Do not use.

Definition at line 287 of file job.cpp.

◆ parentJob()

Job * Job::parentJob ( ) const

Returns the parent job, if there is one.

Returns
the parent job, or 0 if there is none
See also
setParentJob

Definition at line 243 of file job.cpp.

◆ queryMetaData()

QString Job::queryMetaData ( const QString &  key)

Query meta data received from the slave.

(Valid when first data is received and/or slave is finished)

Parameters
keythe key of the meta data to retrieve
Returns
the value of the meta data, or QString() if the key does not exist

Definition at line 253 of file job.cpp.

◆ removeSubjob()

bool Job::removeSubjob ( KJob *  job)
protectedvirtual

Mark a sub job as being done.

KDE4 change: this doesn't terminate the parent job anymore, call emitResult to do that.

Parameters
jobthe subjob to remove

Reimplemented from KCompositeJob.

Definition at line 118 of file job.cpp.

◆ setMetaData()

void Job::setMetaData ( const KIO::MetaData &  metaData)

Set meta data to be sent to the slave, replacing existing meta data.

Parameters
metaDatathe meta data to set
See also
addMetaData()
mergeMetaData()

Definition at line 258 of file job.cpp.

◆ setParentJob()

void Job::setParentJob ( Job *  parentJob)

Set the parent Job.

One example use of this is when FileCopyJob calls RenameDialog::open, 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.

Parameters
parentJobthe new parent job

Definition at line 235 of file job.cpp.

◆ showErrorDialog()

void Job::showErrorDialog ( QWidget *  parent = 0)

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.

Parameters
parentthe parent widget for the dialog box, can be 0 for top-level
Deprecated:
you should use job->uiDelegate()->setWindow(parent) and job->uiDelegate()->showErrorMessage() instead

Definition at line 216 of file job.cpp.

◆ start()

void KIO::Job::start ( )
inlinevirtual

Implements KJob.

Definition at line 103 of file jobclasses.h.

◆ ui()

JobUiDelegate * Job::ui ( ) const

Retrieves the UI delegate of this job.

This method is basically a convenience for static_cast<KIO::JobUiDelegate*>(uiDelegate()).

Returns
the delegate used by the job to communicate with the UI

Definition at line 90 of file job.cpp.


The documentation for this class was generated from the following files:
  • jobclasses.h
  • global.cpp
  • job.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal