00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef KMJOBMANAGER_H
00021
#define KMJOBMANAGER_H
00022
00023
#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
00024
#warning internal header, do not use except if you are a KDEPrint developer
00025
#endif
00026
00027
#include <qobject.h>
00028
#include <qptrlist.h>
00029
#include <qdict.h>
00030
#include <qvaluelist.h>
00031
00032
class KMJob;
00033
class KMThreadJob;
00034
class KActionCollection;
00035
class KAction;
00036
00044
class KMJobManager :
public QObject
00045 {
00046 Q_OBJECT
00047
00048
public:
00049
enum JobType { ActiveJobs = 0, CompletedJobs = 1 };
00050
struct JobFilter
00051 {
00052 JobFilter() { m_type[0] = m_type[1] = 0; m_isspecial =
false; }
00053
int m_type[2];
00054
bool m_isspecial;
00055 };
00056
00057 KMJobManager(
QObject *parent = 0,
const char *name = 0);
00058
virtual ~KMJobManager();
00059
00060
static KMJobManager*
self();
00061
00062
void addPrinter(
const QString& pr, JobType type = ActiveJobs,
bool isSpecial =
false);
00063
void removePrinter(
const QString& pr, JobType type = ActiveJobs);
00064
void clearFilter();
00065
QDict<JobFilter>* filter();
00066
int limit();
00067
void setLimit(
int val);
00068
00069
00070 KMJob* findJob(
const QString& uri);
00071
00072
bool sendCommand(
const QString& uri,
int action,
const QString& arg = QString::null);
00073
bool sendCommand(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00074
const QPtrList<KMJob>& jobList(
bool reload =
true);
00075
void addJob(KMJob*);
00076 KMThreadJob* threadJob();
00077
00078
virtual int actions();
00079
virtual QValueList<KAction*> createPluginActions(KActionCollection*);
00080
virtual void validatePluginActions(KActionCollection*,
const QPtrList<KMJob>&);
00081
virtual bool doPluginAction(
int,
const QPtrList<KMJob>&);
00082
00083
protected:
00084
void discardAllJobs();
00085
void removeDiscardedJobs();
00086
00087
protected:
00088
virtual bool listJobs(
const QString& prname, JobType type,
int limit = 0);
00089
virtual bool sendCommandSystemJob(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00090
bool sendCommandThreadJob(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00091
00092
protected:
00093
QPtrList<KMJob> m_jobs;
00094
QDict<JobFilter> m_filter;
00095 KMThreadJob *m_threadjob;
00096 };
00097
00098
inline QDict<KMJobManager::JobFilter>* KMJobManager::filter()
00099 {
return &m_filter; }
00100
00101
inline void KMJobManager::clearFilter()
00102 { m_filter.clear(); }
00103
00104
inline KMThreadJob* KMJobManager::threadJob()
00105 {
return m_threadjob; }
00106
00107
#endif