36 #include <QtCore/QHash>
37 #include <QtGui/QWidget>
38 #include <QtDBus/QtDBus>
46 #ifndef KDE_USE_FINAL // already defined in job.cpp
74 Q_ASSERT(newPriority >= -10 && newPriority <= 10);
75 newPriority = qBound(-10, newPriority, 10);
76 int unbiasedSerial = oldSerial % m_jobsPerPriority;
77 return unbiasedSerial + newPriority * m_jobsPerPriority;
83 m_grimTimer.setSingleShot(
true);
84 connect (&m_grimTimer, SIGNAL(
timeout()), SLOT(grimReaper()));
91 m_idleSlaves.insert(slave->
host(), slave);
104 QMultiHash<QString, Slave *>::Iterator it = m_idleSlaves.find(url.host());
105 if (it == m_idleSlaves.end()) {
106 it = m_idleSlaves.begin();
108 if (it == m_idleSlaves.end()) {
112 m_idleSlaves.erase(it);
119 QMultiHash<QString, Slave *>::Iterator it = m_idleSlaves.begin();
120 for (; it != m_idleSlaves.end(); ++it) {
121 if (it.value() == slave) {
122 m_idleSlaves.erase(it);
131 return m_idleSlaves.values();
134 void SlaveKeeper::scheduleGrimReaper()
136 if (!m_grimTimer.isActive()) {
142 void SlaveKeeper::grimReaper()
144 QMultiHash<QString, Slave *>::Iterator it = m_idleSlaves.begin();
145 while (it != m_idleSlaves.end()) {
146 Slave *slave = it.value();
148 it = m_idleSlaves.erase(it);
150 kDebug (7006) <<
"Idle slave" << slave <<
"still has job" << slave->
job();
159 if (!m_idleSlaves.isEmpty()) {
160 scheduleGrimReaper();
168 if (first != m_queuedJobs.constEnd()) {
177 Q_ASSERT(serial != 0);
178 Q_ASSERT(!m_queuedJobs.contains(serial));
179 Q_ASSERT(!m_runningJobs.contains(job));
180 m_queuedJobs.insert(serial, job);
185 Q_ASSERT(!m_queuedJobs.isEmpty());
188 m_queuedJobs.erase(first);
189 m_runningJobs.insert(job);
196 if (m_runningJobs.remove(job)) {
197 Q_ASSERT(!m_queuedJobs.contains(serial));
200 if (m_queuedJobs.remove(serial)) {
209 Q_FOREACH (
SimpleJob *job, m_runningJobs) {
221 m_startJobsTimer.setSingleShot(
true);
222 connect (&m_startJobsTimer, SIGNAL(
timeout()), SLOT(startRunnableJobs()));
228 if (it == m_connectedSlaves.end()) {
237 m_runnableSlaves.insert(slave);
238 m_startJobsTimer.start();
248 if (it == m_connectedSlaves.end()) {
255 Q_ASSERT(!m_runnableSlaves.contains(slave));
258 const bool removedRunning = jobs.
runningJob == job;
259 const bool removedWaiting = jobs.
waitingList.removeAll(job) != 0;
260 if (removedRunning) {
262 Q_ASSERT(!removedWaiting);
264 const bool removedTheJob = removedRunning || removedWaiting;
268 return removedTheJob;
272 m_runnableSlaves.insert(slave);
273 m_startJobsTimer.start();
275 if (removedWaiting && jobs.
waitingList.isEmpty()) {
276 m_runnableSlaves.remove(slave);
278 return removedTheJob;
284 if (!m_connectedSlaves.contains(slave)) {
292 if (it == m_connectedSlaves.end()) {
303 m_connectedSlaves.erase(it);
304 m_runnableSlaves.remove(slave);
314 if (it == m_connectedSlaves.end()) {
317 return it.value().runningJob == 0;
322 void ConnectedSlaveQueue::startRunnableJobs()
325 while (it != m_runnableSlaves.end()) {
329 m_startJobsTimer.start();
333 it = m_runnableSlaves.erase(it);
341 const int port = url.port() == -1 ? 0 : url.port();
343 if (slave->
host() ==
"<reset>") {
351 Q_ASSERT(slave->
host() == url.host());
352 Q_ASSERT(slave->
port() == port);
360 Q_UNUSED(queuesBySerial);
361 #ifdef SCHEDULER_DEBUG
364 Q_FOREACH (
HostQueue *hq, *queuesBySerial) {
365 Q_ASSERT(!seen.contains(hq));
374 Q_UNUSED(runningJobsCount);
375 #ifdef SCHEDULER_DEBUG
376 int realRunningJobsCount = 0;
377 Q_FOREACH (
const HostQueue &hq, *queues) {
380 Q_ASSERT(realRunningJobsCount == runningJobsCount);
384 Q_FOREACH (
const HostQueue &hq, *queues) {
385 Q_FOREACH (
SimpleJob *job, hq.runningJobs()) {
386 Q_ASSERT(!seenJobs.contains(job));
387 seenJobs.insert(job);
395 : m_schedPrivate(sp),
396 m_maxConnectionsPerHost(maxSlavesPerHost ? maxSlavesPerHost : maxSlaves),
397 m_maxConnectionsTotal(qMax(maxSlaves, maxSlavesPerHost)),
398 m_runningJobsCount(0)
401 kDebug(7006) <<
"m_maxConnectionsTotal:" << m_maxConnectionsTotal
402 <<
"m_maxConnectionsPerHost:" << m_maxConnectionsPerHost;
403 Q_ASSERT(m_maxConnectionsPerHost >= 1);
404 Q_ASSERT(maxSlaves >= maxSlavesPerHost);
405 m_startJobTimer.setSingleShot(
true);
406 connect (&m_startJobTimer, SIGNAL(
timeout()), SLOT(startAJob()));
421 HostQueue &hq = m_queuesByHostname[hostname];
437 if (m_queuesBySerial.remove(prevLowestSerial) == 0) {
438 Q_UNUSED(wasQueueEmpty);
439 Q_ASSERT(wasQueueEmpty);
443 #ifdef SCHEDULER_DEBUG
447 Q_ASSERT(!m_queuesBySerial.contains(prevLowestSerial));
452 m_startJobTimer.start();
461 if (it == m_queuesByHostname.end()) {
471 const bool needReinsert = hq.
lowestSerial() != prevLowestSerial;
474 if (needReinsert && m_queuesBySerial.remove(prevLowestSerial)) {
494 if (m_queuesBySerial.remove(prevLowestSerial) == 0) {
502 m_runningJobsCount--;
503 Q_ASSERT(m_runningJobsCount >= 0);
513 m_queuesByHostname.remove(jobPriv->
m_url.host());
520 m_startJobTimer.start();
542 SLOT(slotSlaveStatus(pid_t,QByteArray,
QString,
bool)));
544 kError() <<
"couldn't create slave:" << errortext;
555 const bool removedUnconnected = m_slaveKeeper.
removeSlave(slave);
556 Q_ASSERT(!(removedConnected && removedUnconnected));
557 return removedConnected || removedUnconnected;
563 Q_FOREACH (
const HostQueue &hq, m_queuesByHostname) {
571 void ProtoQueue::startAJob()
576 #ifdef SCHEDULER_DEBUG
577 kDebug(7006) <<
"m_runningJobsCount:" << m_runningJobsCount;
578 Q_FOREACH (
const HostQueue &hq, m_queuesByHostname) {
579 Q_FOREACH (
SimpleJob *job, hq.runningJobs()) {
584 if (m_runningJobsCount >= m_maxConnectionsTotal) {
585 #ifdef SCHEDULER_DEBUG
586 kDebug(7006) <<
"not starting any jobs because maxConnectionsTotal has been reached.";
592 if (first != m_queuesBySerial.end()) {
595 const int prevLowestSerial = first.key();
596 Q_UNUSED(prevLowestSerial);
605 m_queuesBySerial.erase(first);
617 m_runningJobsCount++;
619 bool isNewSlave =
false;
642 #ifdef SCHEDULER_DEBUG
643 kDebug(7006) <<
"not starting any jobs because there is no queued job.";
647 if (!m_queuesBySerial.isEmpty()) {
648 m_startJobTimer.start();
654 class KIO::SchedulerPrivate
661 m_ignoreConfigReparse(false)
678 Slave *m_slaveOnHold;
681 bool m_ignoreConfigReparse;
687 #ifndef KDE_NO_DEPRECATED
690 void setJobPriority(
SimpleJob *job,
int priority);
694 void removeSlaveOnHold();
698 void checkSlaveOnHold(
bool b);
699 void publishSlaveOnHold();
701 bool isSlaveOnHoldFor(
const KUrl& url);
702 void registerWindow(
QWidget *wid);
703 void updateInternalMetaData(
SimpleJob* job);
710 void slotSlaveStatus(pid_t pid,
const QByteArray &protocol,
711 const QString &host,
bool connected);
713 void slotReparseSlaveConfiguration(
const QString &,
const QDBusMessage&);
714 void slotSlaveOnHoldListChanged();
716 void slotSlaveConnected();
717 void slotSlaveError(
int error,
const QString &errorMsg);
718 void slotUnregisterWindow(
QObject *);
722 ProtoQueue *pq = m_protocols.value(protocol, 0);
724 kDebug(7006) <<
"creating ProtoQueue instance for" << protocol;
727 int maxSlavesPerHost = -1;
728 if (!host.isEmpty()) {
732 maxSlavesPerHost = value;
734 if (maxSlavesPerHost == -1) {
738 pq =
new ProtoQueue(
this, maxSlaves, qMin(maxSlaves, maxSlavesPerHost));
739 m_protocols.insert(protocol, pq);
752 return schedulerPrivate->q;
755 SchedulerPrivate *Scheduler::d_func()
757 return schedulerPrivate;
763 return schedulerPrivate->q;
769 return schedulerPrivate->heldSlaveForJob(job);
773 Scheduler::Scheduler()
776 setObjectName(
"scheduler" );
778 const QString dbusPath =
"/KIO/Scheduler";
779 const QString dbusInterface =
"org.kde.KIO.Scheduler";
780 QDBusConnection dbus = QDBusConnection::sessionBus();
781 dbus.registerObject(
"/KIO/Scheduler",
this, QDBusConnection::ExportScriptableSlots |
782 QDBusConnection::ExportScriptableSignals );
783 dbus.connect(
QString(), dbusPath, dbusInterface,
"reparseSlaveConfiguration",
784 this, SLOT(slotReparseSlaveConfiguration(
QString,QDBusMessage)));
785 dbus.connect(
QString(), dbusPath, dbusInterface,
"slaveOnHoldListChanged",
786 this, SLOT(slotSlaveOnHoldListChanged()));
789 Scheduler::~Scheduler()
795 schedulerPrivate->doJob(job);
798 #ifndef KDE_NO_DEPRECATED
801 schedulerPrivate->scheduleJob(job);
807 schedulerPrivate->setJobPriority(job, priority);
812 schedulerPrivate->cancelJob(job);
817 schedulerPrivate->jobFinished(job, slave);
822 schedulerPrivate->putSlaveOnHold(job, url);
827 schedulerPrivate->removeSlaveOnHold();
832 schedulerPrivate->publishSlaveOnHold();
837 return schedulerPrivate->isSlaveOnHoldFor(url);
842 schedulerPrivate->updateInternalMetaData(job);
848 return schedulerPrivate->getConnectedSlave(url, config);
853 return schedulerPrivate->assignJobToSlave(slave, job);
858 return schedulerPrivate->disconnectSlave(slave);
863 schedulerPrivate->registerWindow(wid);
868 schedulerPrivate->slotUnregisterWindow(wid);
874 return QObject::connect(
self(), signal, receiver, member);
878 const QObject* receiver,
const char* member )
880 return QObject::connect(sender, signal, receiver, member);
884 const QObject* receiver,
const char* member )
886 return QObject::disconnect(sender, signal, receiver, member);
892 return QObject::connect(sender, signal, member);
897 schedulerPrivate->checkSlaveOnHold(b);
904 schedulerPrivate->slotReparseSlaveConfiguration(
QString(), QDBusMessage());
906 schedulerPrivate->m_ignoreConfigReparse =
true;
911 void SchedulerPrivate::slotReparseSlaveConfiguration(
const QString &proto,
const QDBusMessage&)
913 if (m_ignoreConfigReparse) {
914 kDebug(7006) <<
"Ignoring signal sent by myself";
915 m_ignoreConfigReparse =
false;
919 kDebug(7006) <<
"proto=" << proto;
926 m_protocols.constFind(proto);
928 if (it == m_protocols.constEnd()) {
933 for (; it != endIt; ++it) {
934 Q_FOREACH(
Slave *slave, (*it)->allSlaves()) {
941 void SchedulerPrivate::slotSlaveOnHoldListChanged()
943 m_checkOnHold =
true;
954 if (cmd ==
CMD_SPECIAL && protocol.startsWith(QLatin1String(
"http"), Qt::CaseInsensitive))
960 void SchedulerPrivate::doJob(
SimpleJob *job)
963 if (QThread::currentThread() != QCoreApplication::instance()->thread()) {
964 kWarning(7006) <<
"KIO is not thread-safe.";
973 m_checkOnHold =
false;
980 #ifndef KDE_NO_DEPRECATED
981 void SchedulerPrivate::scheduleJob(
SimpleJob *job)
984 setJobPriority(job, 1);
988 void SchedulerPrivate::setJobPriority(
SimpleJob *job,
int priority)
990 kDebug(7006) << job << priority;
995 void SchedulerPrivate::cancelJob(
SimpleJob *job)
1004 kDebug(7006) << job << slave;
1006 kDebug(7006) <<
"Scheduler: killing slave " << slave->slave_pid();
1009 jobFinished(job, slave);
1014 kDebug(7006) << job << slave;
1015 if (QThread::currentThread() != QCoreApplication::instance()->thread()) {
1016 kWarning(7006) <<
"KIO is not thread-safe.";
1033 kDebug(7006) <<
"Updating ioslaves with new internal metadata information";
1034 ProtoQueue * queue = m_protocols.value(slave->protocol());
1036 QListIterator<Slave*> it (queue->
allSlaves());
1037 while (it.hasNext()) {
1038 Slave* runningSlave = it.next();
1039 if (slave->host() == runningSlave->
host()) {
1040 slave->setConfig(metaDataFor(slave->protocol(), jobPriv->
m_proxyList, job->
url()));
1041 kDebug(7006) <<
"Updated configuration of" << slave->protocol()
1042 <<
"ioslave, pid=" << slave->slave_pid();
1048 slave->disconnect(job);
1061 schedulerPrivate->setupSlave(slave, url, protocol, proxyList, newSlave, config);
1066 const QString host = url.host();
1068 sessionData.configDataFor( configData, protocol, host );
1069 if (proxyList.isEmpty()) {
1070 configData.remove(QLatin1String(
"UseProxy"));
1071 configData.remove(QLatin1String(
"ProxyUrls"));
1073 configData[QLatin1String(
"UseProxy")] = proxyList.first();
1074 configData[QLatin1String(
"ProxyUrls")] = proxyList.join(QLatin1String(
","));
1077 if ( configData.contains(
"EnableAutoLogin") &&
1078 configData.value(
"EnableAutoLogin").compare(
"true", Qt::CaseInsensitive) == 0 )
1082 bool usern = (protocol ==
"ftp");
1085 configData[
"autoLoginUser"] = l.
login;
1086 configData[
"autoLoginPass"] = l.
password;
1091 for ( ; it != l.
macdef.constEnd(); ++it )
1092 macdef += it.key() +
'\\' + it.value().join(
"\\" ) +
'\n';
1093 configData[
"autoLoginMacro"] = macdef;
1104 int port = url.port();
1107 const QString host = url.host();
1111 if (newSlave || slave->
host() != host || slave->
port() != port ||
1112 slave->
user() != user || slave->
passwd() != passwd) {
1114 MetaData configData = metaDataFor(protocol, proxyList, url);
1116 configData += *config;
1120 slave->
setHost(host, port, user, passwd);
1125 void SchedulerPrivate::slotSlaveStatus(pid_t,
const QByteArray&,
const QString &,
bool)
1130 void SchedulerPrivate::slotSlaveDied(
KIO::Slave *slave)
1141 pq->removeSlave(slave);
1143 if (slave == m_slaveOnHold) {
1145 m_urlOnHold.clear();
1153 kDebug(7006) << job << url << slave;
1154 slave->disconnect(job);
1160 if (m_slaveOnHold) {
1161 m_slaveOnHold->
kill();
1163 m_slaveOnHold = slave;
1165 m_slaveOnHold->suspend();
1168 void SchedulerPrivate::publishSlaveOnHold()
1170 kDebug(7006) << m_slaveOnHold;
1174 m_slaveOnHold->hold(m_urlOnHold);
1175 emit q->slaveOnHoldListChanged();
1178 bool SchedulerPrivate::isSlaveOnHoldFor(
const KUrl& url)
1180 if (url.isValid() && m_urlOnHold.isValid() && url == m_urlOnHold)
1195 if (!slave && m_slaveOnHold) {
1201 canJobReuse = ( canJobReuse || cmd ==
CMD_SPECIAL );
1204 const QString resume = outgoing.value(
"resume");
1205 kDebug(7006) <<
"Resume metadata is" << resume;
1206 canJobReuse = (resume.isEmpty() || resume ==
"0");
1210 if (job->
url() == m_urlOnHold) {
1212 kDebug(7006) <<
"HOLD: Reusing held slave (" << m_slaveOnHold <<
")";
1213 slave = m_slaveOnHold;
1215 kDebug(7006) <<
"HOLD: Discarding held slave (" << m_slaveOnHold <<
")";
1216 m_slaveOnHold->kill();
1219 m_urlOnHold.clear();
1222 kDebug(7006) <<
"HOLD: Reusing klauncher held slave (" << slave <<
")";
1228 void SchedulerPrivate::removeSlaveOnHold()
1230 kDebug(7006) << m_slaveOnHold;
1231 if (m_slaveOnHold) {
1232 m_slaveOnHold->kill();
1235 m_urlOnHold.clear();
1242 ProtoQueue *pq = protoQ(protocol, url.host());
1246 setupSlave(slave, url, protocol, proxyList,
true, &config);
1250 q->connect(slave, SIGNAL(connected()),
1251 SLOT(slotSlaveConnected()));
1252 q->connect(slave, SIGNAL(error(
int,
QString)),
1253 SLOT(slotSlaveError(
int,
QString)));
1255 kDebug(7006) << url << slave;
1260 void SchedulerPrivate::slotSlaveConnected()
1263 Slave *slave =
static_cast<Slave *
>(q->sender());
1265 q->disconnect(slave, SIGNAL(connected()), q, SLOT(slotSlaveConnected()));
1266 emit q->slaveConnected(slave);
1269 void SchedulerPrivate::slotSlaveError(
int errorNr,
const QString &errorMsg)
1271 Slave *slave =
static_cast<Slave *
>(q->sender());
1272 kDebug(7006) << slave << errorNr << errorMsg;
1277 emit q->slaveError(slave, errorNr, errorMsg);
1283 kDebug(7006) << slave << job;
1293 bool SchedulerPrivate::disconnectSlave(
KIO::Slave *slave)
1300 void SchedulerPrivate::checkSlaveOnHold(
bool b)
1322 while (w && w->parentWidget()) {
1323 w = w->parentWidget();
1325 return (w ? w->window() : 0);
1328 void SchedulerPrivate::registerWindow(
QWidget *wid)
1336 if (!m_windowList.contains(obj))
1341 WId windowId = window->winId();
1342 m_windowList.insert(obj, windowId);
1343 q->connect(window, SIGNAL(destroyed(
QObject*)),
1344 SLOT(slotUnregisterWindow(
QObject*)));
1345 QDBusInterface(
"org.kde.kded",
"/kded",
"org.kde.kded").
1346 call(QDBus::NoBlock,
"registerWindowId", qlonglong(windowId));
1350 void SchedulerPrivate::slotUnregisterWindow(
QObject *obj)
1356 if (it == m_windowList.end())
1358 WId windowId = it.value();
1359 q->disconnect(it.key(), SIGNAL(destroyed(
QObject*)),
1360 q, SLOT(slotUnregisterWindow(
QObject*)));
1361 m_windowList.erase( it );
1362 QDBusInterface(
"org.kde.kded",
"/kded",
"org.kde.kded").
1363 call(QDBus::NoBlock,
"unregisterWindowId", qlonglong(windowId));
1366 void SchedulerPrivate::updateInternalMetaData(
SimpleJob* job)
1371 const KUrl jobUrl = job->
url();
1374 while (it.hasNext()) {
1376 if (it.key().startsWith(QLatin1String(
"{internal~currenthost}"), Qt::CaseInsensitive)) {
1378 }
else if (it.key().startsWith(QLatin1String(
"{internal~allhosts}"), Qt::CaseInsensitive)) {
1385 #include "scheduler.moc"
1386 #include "scheduler_p.moc"
static void removeSlaveOnHold()
Removes any slave that might have been put on hold.
bool isJobRunning(KIO::SimpleJob *job) const
bool kill(KillVerbosity verbosity=Quietly)
static void scheduleJob(SimpleJob *job)
Schedules job scheduled for later execution.
MetaData configData(const QString &protocol, const QString &host)
Query slave configuration for slaves of type protocol when dealing with host.
static void doJob(SimpleJob *job)
Register job with the scheduler.
static int maxSlaves(const QString &protocol)
bool isIdle(KIO::Slave *slave)
static KIO::Slave * getConnectedSlave(const KUrl &url, const KIO::MetaData &config=MetaData())
Requests a slave for use in connection-oriented mode.
void removeJob(KIO::SimpleJob *job)
static void reparseConfiguration()
Force a reload of the general config file of io-slaves ( kioslaverc).
MetaData m_internalMetaData
static void setJobPriority(SimpleJob *job, int priority)
Changes the priority of job; jobs of the same priority run in the order in which they were created...
static NetRC * self()
A reference to the instance of the class.
void setConfigData(const QString &protocol, const QString &host, const QString &key, const QString &value)
Configure slaves of type protocol by setting key to value.
static bool disconnectSlave(KIO::Slave *slave)
Disconnects slave.
#define K_GLOBAL_STATIC(TYPE, NAME)
void changeJobPriority(KIO::SimpleJob *job, int newPriority)
void slotError(int, const QString &)
const KUrl & url() const
Returns the SimpleJob's URL.
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static void emitReparseSlaveConfiguration()
QList< SimpleJob * > waitingList
void kill()
Force termination.
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static int maxSlavesPerHost(const QString &protocol)
void reset()
Undo any changes made by calls to setConfigData.
static void unregisterWindow(QObject *wid)
static void updateInternalMetaData(SimpleJob *job)
Updates the internal metadata from job.
void queueJob(KIO::SimpleJob *job)
static Slave * holdSlave(const QString &protocol, const KUrl &url)
Requests a slave on hold for ths url, from klauncher, if there is such a job.
static void checkSlaveOnHold(bool b)
When true, the next job will check whether KLauncher has a slave on hold that is suitable for the job...
static bool assignJobToSlave(KIO::Slave *slave, KIO::SimpleJob *job)
Uses slave to do job.
void addSlave(KIO::Slave *slave)
static void setupSlave(KIO::Slave *slave, const KUrl &url, const QString &protocol, const QStringList &proxyList, bool newSlave, const KIO::MetaData *config=0)
static void jobFinished(KIO::SimpleJob *job, KIO::Slave *slave)
Called when a job is done.
virtual void setHost(const QString &host, quint16 port, const QString &user, const QString &passwd)
Set host for url.
static bool mayReturnContent(int cmd, const QString &protocol)
QString protocol()
The protocol this slave handles.
static const int s_idleSlaveLifetime
KIO::SimpleJob * job() const
KIO::Slave * createSlave(const QString &protocol, KIO::SimpleJob *job, const KUrl &url)
QList< KIO::Slave * > allSlaves() const
void resetHost()
Clear host info.
static Scheduler * scheduler()
static void startJob(SimpleJob *job, Slave *slave)
void setProtocol(const QString &protocol)
QList< KIO::Slave * > allSlaves() const
static void verifyRunningJobsCount(QHash< QString, HostQueue > *queues, int runningJobsCount)
static void cancelJob(SimpleJob *job)
Stop the execution of a job.
bool queueJob(KIO::SimpleJob *job, KIO::Slave *slave)
static bool isSlaveOnHoldFor(const KUrl &url)
Returns true if there is a slave on hold for url.
static int jobCommand(SimpleJob *job)
virtual void start(KIO::Slave *slave)
bool removeJob(KIO::SimpleJob *job)
int runningJobsCount() const
virtual void send(int cmd, const QByteArray &arr=QByteArray())
Sends the given command to the kioslave.
QList< KIO::Slave * > allSlaves() const
QMap< QString, QStringList > macdef
static Slave * jobSlave(SimpleJob *job)
void returnSlave(KIO::Slave *slave)
static void putSlaveOnHold(KIO::SimpleJob *job, const KUrl &url)
Puts a slave on notice.
bool removeJob(KIO::SimpleJob *job)
ConnectedSlaveQueue m_connectedSlaveQueue
static QString slaveProtocol(const KUrl &url, QString &proxy)
Return the protocol to use in order to handle the given url It's usually the same, except that FTP, when handled by a proxy, needs an HTTP ioslave.
static SimpleJobPrivate * get(KIO::SimpleJob *job)
The KIO::Scheduler manages io-slaves for the application.
bool isQueueEmpty() const
int changedPrioritySerial(int oldSerial, int newPriority) const
virtual void setConfig(const MetaData &config)
Configure slave.
static void ensureNoDuplicates(QMap< int, HostQueue * > *queuesBySerial)
static Slave * heldSlaveForJob(SimpleJob *job)
ProtoQueue(KIO::SchedulerPrivate *sp, int maxSlaves, int maxSlavesPerHost)
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static void registerWindow(QWidget *wid)
Register the mainwindow wid with the KIO subsystem Do not call this, it is called automatically from ...
void reload()
Reloads the auto login information.
static const int maxSerial
bool removeSlave(KIO::Slave *slave)
void queueJob(KIO::SimpleJob *job)
void setIdle()
Marks this slave as idle.
static Slave * createSlave(const QString &protocol, const KUrl &url, int &error, QString &error_text)
Creates a new slave.
bool lookup(const KUrl &url, AutoLogin &login, bool userealnetrc=false, const QString &type=QString(), LookUpMode mode=LookUpMode(exactOnly)|defaultOnly)
Looks up the login information for the given url.
Q_SCRIPTABLE void reparseSlaveConfiguration(const QString &)
The transfer job pumps data into and/or out of a Slave.
bool removeSlave(KIO::Slave *slave)
static void publishSlaveOnHold()
Send the slave that was put on hold back to KLauncher.
void setJob(KIO::SimpleJob *job)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static SlaveConfig * self()
static bool connect(const char *signal, const QObject *receiver, const char *member)
Function to connect signals emitted by the scheduler.
KIO::SimpleJob * takeFirstInQueue()
static bool checkForHeldSlave(const KUrl &url)
Returns true if klauncher is holding a slave for url.
bool removeSlave(KIO::Slave *slave)
void setConnected(bool c)
QList< KIO::Slave * > allSlaves() const
static QWidget * topLevelWindow(QWidget *widget)
Contains auto login information.
KIO::Slave * takeSlaveForJob(KIO::SimpleJob *job)
A simple job (one url and one command).