KIO

scheduler.h
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 2000 Stephan Kulow <[email protected]>
4  Waldo Bastian <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef _kio_scheduler_h
23 #define _kio_scheduler_h
24 
25 #include "simplejob.h"
26 #include <QTimer>
27 #include <QMap>
28 
29 namespace KIO
30 {
31 
32 class Slave;
33 class SlaveConfig;
34 
35 class SchedulerPrivate;
109 class KIOCORE_EXPORT Scheduler : public QObject
110 {
111  Q_OBJECT
112  Q_CLASSINFO("D-Bus Interface", "org.kde.KIO.Scheduler")
113 public:
120  static void doJob(SimpleJob *job);
121 
122 #if KIOCORE_ENABLE_DEPRECATED_SINCE(4, 5)
123 
130  KIOCORE_DEPRECATED_VERSION(4, 5, "Use Scheduler::setJobPriority(SimpleJob *, int )")
131  static void scheduleJob(SimpleJob *job);
132 #endif
133 
142  static void setJobPriority(SimpleJob *job, int priority);
143 
148  static void cancelJob(SimpleJob *job);
149 
155  static void jobFinished(KIO::SimpleJob *job, KIO::Slave *slave);
156 
168  static void putSlaveOnHold(KIO::SimpleJob *job, const QUrl &url);
169 
174  static void removeSlaveOnHold();
175 
181  static void publishSlaveOnHold();
182 
194  static KIO::Slave *getConnectedSlave(const QUrl &url,
195  const KIO::MetaData &config = MetaData());
196 
213  static bool assignJobToSlave(KIO::Slave *slave, KIO::SimpleJob *job);
214 
227  static bool disconnectSlave(KIO::Slave *slave);
228 
235  // KDE5: those methods should probably be removed, ugly and only marginally useful
236  static bool connect(const char *signal, const QObject *receiver,
237  const char *member);
238 
239  static bool connect(const QObject *sender, const char *signal,
240  const QObject *receiver, const char *member);
241 
242  static bool disconnect(const QObject *sender, const char *signal,
243  const QObject *receiver, const char *member);
244 
245  bool connect(const QObject *sender, const char *signal,
246  const char *member);
247 
253  static void checkSlaveOnHold(bool b);
254 
255  static void emitReparseSlaveConfiguration();
256 
262  static bool isSlaveOnHoldFor(const QUrl &url);
263 
269  static void updateInternalMetaData(SimpleJob *job);
270 
271 Q_SIGNALS:
272  void slaveConnected(KIO::Slave *slave);
273  void slaveError(KIO::Slave *slave, int error, const QString &errorMsg);
274 
275  // DBUS
276  Q_SCRIPTABLE void reparseSlaveConfiguration(const QString &);
277  Q_SCRIPTABLE void slaveOnHoldListChanged();
278 
279 private:
280  Q_DISABLE_COPY(Scheduler)
281  Scheduler();
282  ~Scheduler();
283 
284  static Scheduler *self();
285 
286  Q_PRIVATE_SLOT(d_func(), void slotSlaveDied(KIO::Slave *slave))
287  Q_PRIVATE_SLOT(d_func(), void slotSlaveStatus(qint64 pid, const QByteArray &protocol,
288  const QString &host, bool connected))
289 
290  // connected to D-Bus signal:
291  Q_PRIVATE_SLOT(d_func(), void slotReparseSlaveConfiguration(const QString &, const QDBusMessage &))
292  Q_PRIVATE_SLOT(d_func(), void slotSlaveOnHoldListChanged())
293 
294  Q_PRIVATE_SLOT(d_func(), void slotSlaveConnected())
295  Q_PRIVATE_SLOT(d_func(), void slotSlaveError(int error, const QString &errorMsg))
296 private:
297  friend class SchedulerPrivate;
298  SchedulerPrivate *d_func();
299 };
300 
301 }
302 #endif
A namespace for KIO globals.
Definition: authinfo.h:34
MetaData is a simple map of key/value strings.
Definition: metadata.h:34
The KIO::Scheduler manages io-slaves for the application.
Definition: scheduler.h:109
A simple job (one url and one command).
Definition: simplejob.h:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jun 6 2020 22:49:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.