.TH "KIO::Scheduler" 3 "28 Jan 2004" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KIO::Scheduler \- The KIO::Scheduler manages io-slaves for the application.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <scheduler.h>\fP
.PP
Inherits \fBQObject\fP, and \fBDCOPObject\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "typedef \fBQPtrList\fP< \fBSimpleJob\fP > \fBJobList\fP"
.br
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "void \fBslotSlaveDied\fP (KIO::Slave *slave)"
.br
.ti -1c
.RI "void \fBslotSlaveStatus\fP (pid_t pid, const  \fBQCString\fP &protocol, const  \fBQString\fP &host, bool connected)"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBslaveConnected\fP (KIO::Slave *slave)"
.br
.ti -1c
.RI "void \fBslaveError\fP (KIO::Slave *slave, int error, const  \fBQString\fP &errorMsg)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "bool \fBconnect\fP (const  \fBQObject\fP *\fBsender\fP, const  char *signal, const  char *member)"
.br
.ti -1c
.RI "void \fBdebug_info\fP ()"
.br
.ti -1c
.RI "virtual bool \fBprocess\fP (const  \fBQCString\fP &fun, const  \fBQByteArray\fP &data, \fBQCString\fP &replyType, \fBQByteArray\fP &replyData)"
.br
.ti -1c
.RI "virtual QCStringList \fBfunctions\fP ()"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "void \fBdoJob\fP (\fBSimpleJob\fP *job)"
.br
.RI "\fIRegister \fCjob\fP with the scheduler. \fP"
.ti -1c
.RI "void \fBscheduleJob\fP (\fBSimpleJob\fP *job)"
.br
.RI "\fICalling ths function makes that \fCjob\fP gets scheduled for later execution, if multiple jobs are registered it might wait for other jobs to finish. \fP"
.ti -1c
.RI "void \fBcancelJob\fP (\fBSimpleJob\fP *job)"
.br
.RI "\fIStop the execution of a job. \fP"
.ti -1c
.RI "void \fBjobFinished\fP (\fBKIO::SimpleJob\fP *job, KIO::Slave *slave)"
.br
.RI "\fICalled when a job is done. \fP"
.ti -1c
.RI "void \fBputSlaveOnHold\fP (\fBKIO::SimpleJob\fP *job, const  \fBKURL\fP &url)"
.br
.RI "\fIPuts a slave on notice. \fP"
.ti -1c
.RI "void \fBremoveSlaveOnHold\fP ()"
.br
.RI "\fIRemoves any slave that might have been put on hold. \fP"
.ti -1c
.RI "void \fBpublishSlaveOnHold\fP ()"
.br
.RI "\fISend the slave that was put on hold back to KLauncher. \fP"
.ti -1c
.RI "KIO::Slave * \fBgetConnectedSlave\fP (const  \fBKURL\fP &url, const  KIO::MetaData &config=MetaData())"
.br
.RI "\fIRequests a slave for use in connection-oriented mode. \fP"
.ti -1c
.RI "bool \fBassignJobToSlave\fP (KIO::Slave *slave, \fBKIO::SimpleJob\fP *job)"
.br
.ti -1c
.RI "bool \fBdisconnectSlave\fP (KIO::Slave *slave)"
.br
.ti -1c
.RI "void \fBregisterWindow\fP (\fBQWidget\fP *wid)"
.br
.RI "\fIRegister the mainwindow \fCwid\fP with the \fBKIO\fP subsystem Do not call this, it is called automatically from \fBvoid\fP \fBKIO::Job::setWindow(QWidget *window)\fP 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
\fP"
.ti -1c
.RI "bool \fBconnect\fP (const  char *signal, const  \fBQObject\fP *receiver, const  char *member)"
.br
.RI "\fIFunction to connect signals emitted by the scheduler. \fP"
.ti -1c
.RI "bool \fBconnect\fP (const  \fBQObject\fP *\fBsender\fP, const  char *signal, const  \fBQObject\fP *receiver, const  char *member)"
.br
.ti -1c
.RI "bool \fBdisconnect\fP (const  \fBQObject\fP *\fBsender\fP, const  char *signal, const  \fBQObject\fP *receiver, const  char *member)"
.br
.ti -1c
.RI "void \fBcheckSlaveOnHold\fP (bool b)"
.br
.RI "\fIWhen true, the next job will check whether KLauncher has a slave on hold that is suitable for the job. \fP"
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "void \fBstartStep\fP ()"
.br
.ti -1c
.RI "void \fBslotCleanIdleSlaves\fP ()"
.br
.ti -1c
.RI "void \fBslotSlaveConnected\fP ()"
.br
.ti -1c
.RI "void \fBslotSlaveError\fP (int error, const  \fBQString\fP &errorMsg)"
.br
.ti -1c
.RI "void \fBslotScheduleCoSlave\fP ()"
.br
.ti -1c
.RI "void \fBslotUnregisterWindow\fP (\fBQObject\fP *)"
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "void \fBsetupSlave\fP (KIO::Slave *slave, const  \fBKURL\fP &url, const  \fBQString\fP &protocol, const  \fBQString\fP &proxy, bool newSlave, const  KIO::MetaData *config=0)"
.br
.ti -1c
.RI "bool \fBstartJobScheduled\fP (ProtocolInfo *protInfo)"
.br
.ti -1c
.RI "bool \fBstartJobDirect\fP ()"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
The KIO::Scheduler manages io-slaves for the application. 

It also queues jobs and assigns the job to a slave when one becomes available.
.PP
There are 3 possible ways for a job to get a slave:
.PP
1) Direct. This is the default. When you create a job the KIO::Scheduler will be notified and will find either an existing slave that is idle or it will create a new slave for the job.
.PP
Example: \fBTransferJob\fP *job = \fBKIO::get\fP(\fBKURL\fP('http://www.kde.org'));
.PP
2) Scheduled If you create a lot of jobs, you might want not want to have a slave for each job. If you schedule a job, a maximum number of slaves will be created. When more jobs arrive, they will be queued. When a slave is finished with a job, it will be assigned a job from the queue.
.PP
Example: 
.PP
.nf

    \fBTransferJob\fP *job = \fBKIO::get\fP(\fBKURL\fP('http://www.kde.org'));
    KIO::Scheduler::scheduleJob(job);
 
.PP
.PP
3) \fBConnection\fP Oriented For some operations it is important that multiple jobs use the same connection. This can only be ensured if all these jobs use the same slave.
.PP
You can ask the scheduler to open a slave for connection oriented operations. You can then use the scheduler to assign jobs to this slave. The jobs will be queued and the slave will handle these jobs one after the other.
.PP
Example: 
.PP
.nf

    Slave *slave = \fBKIO::Scheduler::getConnectedSlave\fP(
            \fBKURL\fP('pop3://bastian:password@mail.kde.org'));
    \fBTransferJob\fP *job1 = \fBKIO::get\fP(
            \fBKURL\fP('pop3://bastian:password@mail.kde.org/msg1'));
    KIO::Scheduler::assignJobToSlave(slave, job1);
    \fBTransferJob\fP *job2 = \fBKIO::get\fP(
            \fBKURL\fP('pop3://bastian:password@mail.kde.org/msg2'));
    KIO::Scheduler::assignJobToSlave(slave, job2);
    \fBTransferJob\fP *job3 = \fBKIO::get\fP(
            \fBKURL\fP('pop3://bastian:password@mail.kde.org/msg3'));
    KIO::Scheduler::assignJobToSlave(slave, job3);
.PP
.PP
.PP
.nf
    // ... Wait for jobs to finish...
.PP
.PP
.PP
.nf
    KIO::Scheduler::disconnectSlave(slave);
 
.PP
 
.PP
Definition at line 99 of file scheduler.h.
.SH "Member Function Documentation"
.PP 
.SS "void KIO::Scheduler::doJob (\fBSimpleJob\fP * job)\fC [inline, static]\fP"
.PP
Register \fCjob\fP with the scheduler. The default is to create a new slave for the job if no slave is available. This can be changed by calling \fBscheduleJob\fP. Definition at line 116 of file scheduler.h.
.PP
References _doJob().
.SS "void KIO::Scheduler::scheduleJob (\fBSimpleJob\fP * job)\fC [inline, static]\fP"
.PP
Calling ths function makes that \fCjob\fP gets scheduled for later execution, if multiple jobs are registered it might wait for other jobs to finish. Definition at line 124 of file scheduler.h.
.PP
References _scheduleJob().
.SS "void KIO::Scheduler::cancelJob (\fBSimpleJob\fP * job)\fC [inline, static]\fP"
.PP
Stop the execution of a job. Definition at line 130 of file scheduler.h.
.PP
References _cancelJob().
.SS "void KIO::Scheduler::jobFinished (\fBKIO::SimpleJob\fP * job, KIO::Slave * slave)\fC [inline, static]\fP"
.PP
Called when a job is done. Definition at line 136 of file scheduler.h.
.PP
References _jobFinished().
.SS "void KIO::Scheduler::putSlaveOnHold (\fBKIO::SimpleJob\fP * job, const \fBKURL\fP & url)\fC [inline, static]\fP"
.PP
Puts a slave on notice. A next job may reuse this slave if it requests the same URL.
.PP
A job can be put on hold after it has emit'ed its mimetype. Based on the mimetype, the program can give control to another component in the same process which can then resume the job by simply asking for the same URL again. Definition at line 148 of file scheduler.h.
.PP
References _putSlaveOnHold().
.SS "void KIO::Scheduler::removeSlaveOnHold ()\fC [inline, static]\fP"
.PP
Removes any slave that might have been put on hold. If a slave was put on hold it will be killed. Definition at line 155 of file scheduler.h.
.PP
References _removeSlaveOnHold().
.SS "void KIO::Scheduler::publishSlaveOnHold ()\fC [inline, static]\fP"
.PP
Send the slave that was put on hold back to KLauncher. This allows another process to take over the slave and resume the job that was started. Definition at line 163 of file scheduler.h.
.PP
References _publishSlaveOnHold().
.PP
Referenced by KRun::foundMimeType().
.SS "KIO::Slave* KIO::Scheduler::getConnectedSlave (const \fBKURL\fP & url, const KIO::MetaData & config = MetaData())\fC [inline, static]\fP"
.PP
Requests a slave for use in connection-oriented mode. \fBParameters:\fP
.RS 4
\fIurl\fP This defines the username,password,host & port to connect with. 
.br
\fIconfig\fP Configuration data for the slave.
.RE
.PP
\fBReturns:\fP
.RS 4
A pointer to a connected slave or 0 if an error occured. 
.RE
.PP
\fBSee also:\fP
.RS 4
assignJobToSlave 
.PP
disconnectSlave 
.RE
.PP
Definition at line 177 of file scheduler.h.
.PP
References _getConnectedSlave().
.SS "void KIO::Scheduler::registerWindow (\fBQWidget\fP * wid)\fC [inline, static]\fP"
.PP
Register the mainwindow \fCwid\fP with the \fBKIO\fP subsystem Do not call this, it is called automatically from \fBvoid\fP \fBKIO::Job::setWindow(QWidget *window)\fP 
.PP
\fBSince:\fP
.RS 4
3.1. 
.RE
.PP
Definition at line 221 of file scheduler.h.
.PP
References _registerWindow().
.SS "bool KIO::Scheduler::connect (const char * signal, const \fBQObject\fP * receiver, const char * member)\fC [inline, static]\fP"
.PP
Function to connect signals emitted by the scheduler. \fBSee also:\fP
.RS 4
slaveConnected 
.PP
slaveError 
.RE
.PP
Definition at line 231 of file scheduler.h.
.PP
References QObject::connect().
.SS "void KIO::Scheduler::checkSlaveOnHold (bool b)\fC [inline, static]\fP"
.PP
When true, the next job will check whether KLauncher has a slave on hold that is suitable for the job. Definition at line 251 of file scheduler.h.
.PP
References _checkSlaveOnHold().
.SS "void Scheduler::slotUnregisterWindow (\fBQObject\fP *)\fC [protected, slot]\fP"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 878 of file scheduler.cpp.
.PP
References QMap< QObject *, long >::end(), and QMap< QObject *, long >::find().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
