|
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()) |
|
|
| 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 |
|
| QObject (QObject *parent) |
|
| QObject (QObject *parent, const char *name) |
|
virtual | ~QObject () |
|
bool | blockSignals (bool block) |
|
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
|
const QObjectList & | children () const |
|
const char * | className () const |
|
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
|
void | deleteLater () |
|
void | destroyed (QObject *obj) |
|
bool | disconnect (const QObject *receiver, const char *method) |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () |
|
QList< QByteArray > | dynamicPropertyNames () const |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
T | findChild (const QString &name) const |
|
QList< T > | findChildren (const QRegExp ®Exp) const |
|
QList< T > | findChildren (const QString &name) const |
|
bool | inherits (const char *className) const |
|
void | insertChild (QObject *object) |
|
void | installEventFilter (QObject *filterObj) |
|
bool | isA (const char *className) const |
|
bool | isWidgetType () const |
|
void | killTimer (int id) |
|
virtual const QMetaObject * | metaObject () const |
|
void | moveToThread (QThread *targetThread) |
|
const char * | name () const |
|
const char * | name (const char *defaultName) const |
|
QString | objectName () const |
|
QObject * | parent () const |
|
QVariant | property (const char *name) const |
|
void | removeChild (QObject *object) |
|
void | removeEventFilter (QObject *obj) |
|
void | setName (const char *name) |
|
void | setObjectName (const QString &name) |
|
void | setParent (QObject *parent) |
|
bool | setProperty (const char *name, const QVariant &value) |
|
bool | signalsBlocked () const |
|
int | startTimer (int interval) |
|
QThread * | thread () const |
|
|
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
QByteArray | normalizeSignalSlot (const char *signalSlot) |
|
| objectName |
|
The base class for all jobs.
For all jobs created in an application, the code looks like
void SomeClass::methodWithAsynchronousJobCall()
{
KJob * job = someoperation( some parameters );
this, SLOT( handleResult(
KJob * ) ) );
}
(other connects, specific to the job)
And handleResult is usually at least:
void SomeClass::handleResult(
KJob *job )
{
doSomething();
}
With the synchronous interface the code looks like
void SomeClass::methodWithSynchronousJobCall()
{
KJob *job = someoperation( some parameters );
{
}
else
{
}
}
Subclasses must implement start(), which should trigger the execution of the job (although the work should be done asynchronously). errorString() should also be reimplemented by any subclasses that introduce new error codes.
- Note
- : KJob and its subclasses are meant to be used in a fire-and-forget way. Jobs will delete themselves when they finish using deleteLater() (although this behaviour can be changed), so a job instance will disappear after the next event loop run.
Definition at line 84 of file kjob.h.
Emitted to display general description of this job.
A description has a title and two optional fields which can be used to complete the description.
Examples of titles are "Copying", "Creating resource", etc. The fields of the description can be "Source" with an URL, and, "Destination" with an URL for a "Copying" description.
- Parameters
-
job | the job that emitted this signal |
title | the general description of the job |
field1 | first field (localized name and value) |
field2 | second field (localized name and value) |
Returns the error text if there has been an error.
Only call if error is not 0.
This is usually some extra data associated with the error, such as a URL. Use errorString() to get a human-readable, translated message.
- Returns
- a string to help understand the error
Definition at line 225 of file kjob.cpp.
Executes the job synchronously.
This will start a nested QEventLoop internally. Nested event loop can be dangerous and can have unintended side effects, you should avoid calling exec() whenever you can and use the asynchronous interface of KJob instead.
Should you indeed call this method, you need to make sure that all callers are reentrant, so that events delivered by the inner event loop don't cause non-reentrant functions to be called, which usually wreaks havoc.
Note that the event loop started by this method does not process user input events, which means your user interface will effectivly be blocked. Other events like paint or network events are still being processed. The advantage of not processing user input events is that the chance of accidental reentrancy is greatly reduced. Still you should avoid calling this function.
- Returns
- true if the job has been executed without error, false otherwise
Definition at line 192 of file kjob.cpp.
void KJob::finished |
( |
KJob * |
job | ) |
|
|
signal |
Emitted when the job is finished, in any case.
It is used to notify observers that the job is terminated and that progress can be hidden.
This is a private signal, it can't be emitted directly by subclasses of KJob, use emitResult() instead.
In general, to be notified of a job's completion, client code should connect to result() rather than finished(), so that kill(Quietly) is indeed quiet. However if you store a list of jobs and they might get killed silently, then you must connect to this instead of result(), to avoid dangling pointers in your list.
- Parameters
-
job | the job that emitted this signal |
- See also
- result
void KJob::percent |
( |
KJob * |
job, |
|
|
unsigned long |
percent |
|
) |
| |
|
signal |
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 KProgressBar). Note that this signal is not emitted for finished jobs.
This is a private signal, it can't be emitted directly by subclasses of KJob, use emitPercent(), setPercent() setTotalAmount() or setProcessedAmount() instead.
- Parameters
-
job | the job that emitted this signal |
percent | the percentage |
void KJob::result |
( |
KJob * |
job | ) |
|
|
signal |
Emitted when the job is finished (except when killed with KJob::Quietly).
Use error to know if the job was finished with error.
This is a private signal, it can't be emitted directly by subclasses of KJob, use emitResult() instead.
Please connect to this signal instead of finished.
- Parameters
-
job | the job that emitted this signal |
- See also
- kill
virtual void KJob::start |
( |
| ) |
|
|
pure virtual |
Starts the job asynchronously.
When the job is finished, result() is emitted.
Warning: Never implement any synchronous workload in this method. This method should just trigger the job startup, not do any work itself. It is expected to be non-blocking.
This is the method all subclasses need to implement. It should setup and trigger the workload of the job. It should not do any work itself. This includes all signals and terminating the job, e.g. by emitResult(). The workload, which could be another method of the subclass, is to be triggered using the event loop, e.g. by code like:
void ExampleJob::start()
{
}