KIO

scheduler.h
1 // -*- c++ -*-
2 /*
3  This file is part of the KDE libraries
4  SPDX-FileCopyrightText: 2000 Stephan Kulow <[email protected]>
5  SPDX-FileCopyrightText: 2000 Waldo Bastian <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef _kio_scheduler_h
11 #define _kio_scheduler_h
12 
13 #include "simplejob.h"
14 #include <QTimer>
15 #include <QMap>
16 
17 namespace KIO
18 {
19 
20 class Slave;
21 class SlaveConfig;
22 
23 class SchedulerPrivate;
97 class KIOCORE_EXPORT Scheduler : public QObject
98 {
99  Q_OBJECT
100  Q_CLASSINFO("D-Bus Interface", "org.kde.KIO.Scheduler")
101 public:
108  static void doJob(SimpleJob *job);
109 
110 #if KIOCORE_ENABLE_DEPRECATED_SINCE(4, 5)
111 
118  KIOCORE_DEPRECATED_VERSION(4, 5, "Use Scheduler::setJobPriority(SimpleJob *, int )")
119  static void scheduleJob(SimpleJob *job);
120 #endif
121 
130  static void setJobPriority(SimpleJob *job, int priority);
131 
136  static void cancelJob(SimpleJob *job);
137 
143  static void jobFinished(KIO::SimpleJob *job, KIO::Slave *slave);
144 
156  static void putSlaveOnHold(KIO::SimpleJob *job, const QUrl &url);
157 
162  static void removeSlaveOnHold();
163 
169  static void publishSlaveOnHold();
170 
182  static KIO::Slave *getConnectedSlave(const QUrl &url,
183  const KIO::MetaData &config = MetaData());
184 
201  static bool assignJobToSlave(KIO::Slave *slave, KIO::SimpleJob *job);
202 
215  static bool disconnectSlave(KIO::Slave *slave);
216 
223  // KDE5: those methods should probably be removed, ugly and only marginally useful
224  static bool connect(const char *signal, const QObject *receiver,
225  const char *member);
226 
227  static bool connect(const QObject *sender, const char *signal,
228  const QObject *receiver, const char *member);
229 
230  static bool disconnect(const QObject *sender, const char *signal,
231  const QObject *receiver, const char *member);
232 
233  bool connect(const QObject *sender, const char *signal,
234  const char *member);
235 
241  static void checkSlaveOnHold(bool b);
242 
243  static void emitReparseSlaveConfiguration();
244 
250  static bool isSlaveOnHoldFor(const QUrl &url);
251 
257  static void updateInternalMetaData(SimpleJob *job);
258 
259 Q_SIGNALS:
260  void slaveConnected(KIO::Slave *slave);
261  void slaveError(KIO::Slave *slave, int error, const QString &errorMsg);
262 
263  // DBUS
264  Q_SCRIPTABLE void reparseSlaveConfiguration(const QString &);
265  Q_SCRIPTABLE void slaveOnHoldListChanged();
266 
267 private:
268  Q_DISABLE_COPY(Scheduler)
269  Scheduler();
270  ~Scheduler();
271 
272  static Scheduler *self();
273 
274  Q_PRIVATE_SLOT(d_func(), void slotSlaveDied(KIO::Slave *slave))
275  Q_PRIVATE_SLOT(d_func(), void slotSlaveStatus(qint64 pid, const QByteArray &protocol,
276  const QString &host, bool connected))
277 
278  // connected to D-Bus signal:
279  Q_PRIVATE_SLOT(d_func(), void slotReparseSlaveConfiguration(const QString &, const QDBusMessage &))
280  Q_PRIVATE_SLOT(d_func(), void slotSlaveOnHoldListChanged())
281 
282  Q_PRIVATE_SLOT(d_func(), void slotSlaveConnected())
283  Q_PRIVATE_SLOT(d_func(), void slotSlaveError(int error, const QString &errorMsg))
284 private:
285  friend class SchedulerPrivate;
286  SchedulerPrivate *d_func();
287 };
288 
289 }
290 #endif
A namespace for KIO globals.
MetaData is a simple map of key/value strings.
Definition: metadata.h:23
The KIO::Scheduler manages io-slaves for the application.
Definition: scheduler.h:97
A simple job (one url and one command).
Definition: simplejob.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 16 2021 23:03:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.