• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

scheduler.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 /* This file is part of the KDE libraries
00003     Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
00004                        Waldo Bastian <bastian@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef _kio_scheduler_h
00023 #define _kio_scheduler_h
00024 
00025 #include "kio/job.h"
00026 #include "kio/jobclasses.h"
00027 #include <QtCore/QTimer>
00028 #include <QtCore/QMap>
00029 #include <QtGui/QWidgetList>
00030 #include <sys/types.h> // pid_t
00031 
00032 namespace KIO {
00033 
00034     class Slave;
00035     class SlaveConfig;
00036     class SessionData;
00037 
00038     class SchedulerPrivate;
00110     class KIO_EXPORT Scheduler : public QObject
00111     {
00112         Q_OBJECT
00113         Q_CLASSINFO("D-Bus Interface", "org.kde.KIO.Scheduler")
00114     public:
00121         static void doJob(SimpleJob *job);
00122 
00129         static void scheduleJob(SimpleJob *job);
00130 
00135         static void cancelJob(SimpleJob *job);
00136 
00142         static void jobFinished(KIO::SimpleJob *job, KIO::Slave *slave);
00143 
00155         static void putSlaveOnHold(KIO::SimpleJob *job, const KUrl &url);
00156 
00161         static void removeSlaveOnHold();
00162 
00168         static void publishSlaveOnHold();
00169 
00181         static KIO::Slave *getConnectedSlave(const KUrl &url,
00182                 const KIO::MetaData &config = MetaData() );
00183 
00184         /*
00185          * Uses @p slave to do @p job.
00186          * This function should be called immediately after creating a Job.
00187          *
00188          * @param slave The slave to use. The slave must have been obtained
00189          *              with a call to getConnectedSlave and must not
00190          *              be currently assigned to any other job.
00191          * @param job The job to do.
00192          *
00193          * @return true is successful, false otherwise.
00194          *
00195          * @see getConnectedSlave()
00196          * @see disconnectSlave()
00197          * @see slaveConnected()
00198          * @see slaveError()
00199          */
00200         static bool assignJobToSlave(KIO::Slave *slave, KIO::SimpleJob *job);
00201 
00202         /*
00203          * Disconnects @p slave.
00204          *
00205          * @param slave The slave to disconnect. The slave must have been
00206          *              obtained with a call to getConnectedSlave
00207          *              and must not be assigned to any job.
00208          *
00209          * @return true is successful, false otherwise.
00210          *
00211          * @see getConnectedSlave
00212          * @see assignJobToSlave
00213          */
00214         static bool disconnectSlave(KIO::Slave *slave);
00215 
00222         static void registerWindow(QWidget *wid);
00223 
00228         static void unregisterWindow(QObject *wid);
00229 
00236         static bool connect( const char *signal, const QObject *receiver,
00237                              const char *member);
00238 
00239         static bool connect( const QObject* sender, const char* signal,
00240                              const QObject* receiver, const char* member );
00241 
00242         static bool disconnect( const QObject* sender, const char* signal,
00243                                 const QObject* receiver, const char* member );
00244 
00245         bool connect( const QObject *sender, const char *signal,
00246                       const char *member );
00247 
00253         static void checkSlaveOnHold(bool b);
00254 
00255         static void emitReparseSlaveConfiguration();
00256 
00257     Q_SIGNALS:
00258         void slaveConnected(KIO::Slave *slave);
00259         void slaveError(KIO::Slave *slave, int error, const QString &errorMsg);
00260 
00261         // DBUS
00262         Q_SCRIPTABLE void reparseSlaveConfiguration(const QString &);
00263 
00264     private:
00265         Q_DISABLE_COPY(Scheduler)
00266         Scheduler();
00267         ~Scheduler();
00268 
00269         static Scheduler *self();
00270 
00271         Q_PRIVATE_SLOT(schedulerPrivate, void slotSlaveDied(KIO::Slave *slave))
00272         Q_PRIVATE_SLOT(schedulerPrivate, void slotSlaveStatus(pid_t pid, const QByteArray &protocol,
00273                                                const QString &host, bool connected))
00274 
00275         // connected to D-Bus signal:
00276         Q_PRIVATE_SLOT(schedulerPrivate, void slotReparseSlaveConfiguration(const QString &))
00277 
00278         Q_PRIVATE_SLOT(schedulerPrivate, void startStep())
00279         Q_PRIVATE_SLOT(schedulerPrivate, void slotCleanIdleSlaves())
00280         Q_PRIVATE_SLOT(schedulerPrivate, void slotSlaveConnected())
00281         Q_PRIVATE_SLOT(schedulerPrivate, void slotSlaveError(int error, const QString &errorMsg))
00282         Q_PRIVATE_SLOT(schedulerPrivate, void slotScheduleCoSlave())
00283         Q_PRIVATE_SLOT(schedulerPrivate, void slotUnregisterWindow(QObject *))
00284     private:
00285         friend class SchedulerPrivate;
00286         SchedulerPrivate * const d;
00287 };
00288 
00289 }
00290 #endif

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal