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
#include <kdelibs_export.h>
00033
00034
class KMJob;
00035
class KMThreadJob;
00036
class KActionCollection;
00037
class KAction;
00038
00046
class KDEPRINT_EXPORT KMJobManager :
public QObject
00047 {
00048 Q_OBJECT
00049
00050
public:
00051
enum JobType { ActiveJobs = 0, CompletedJobs = 1 };
00052
struct JobFilter
00053 {
00054 JobFilter() { m_type[0] = m_type[1] = 0; m_isspecial =
false; }
00055
int m_type[2];
00056
bool m_isspecial;
00057 };
00058
00059 KMJobManager(
QObject *parent = 0,
const char *name = 0);
00060
virtual ~KMJobManager();
00061
00062
static KMJobManager*
self();
00063
00064
void addPrinter(
const QString& pr, JobType type = ActiveJobs,
bool isSpecial =
false);
00065
void removePrinter(
const QString& pr, JobType type = ActiveJobs);
00066
void clearFilter();
00067
QDict<JobFilter>* filter();
00068
int limit();
00069
void setLimit(
int val);
00070
00071
00072 KMJob* findJob(
const QString& uri);
00073
00074
bool sendCommand(
const QString& uri,
int action,
const QString& arg = QString::null);
00075
bool sendCommand(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00076
const QPtrList<KMJob>& jobList(
bool reload =
true);
00077
void addJob(KMJob*);
00078 KMThreadJob* threadJob();
00079
00080
virtual int actions();
00081
virtual QValueList<KAction*> createPluginActions(KActionCollection*);
00082
virtual void validatePluginActions(KActionCollection*,
const QPtrList<KMJob>&);
00083
virtual bool doPluginAction(
int,
const QPtrList<KMJob>&);
00084
00085
protected:
00086
void discardAllJobs();
00087
void removeDiscardedJobs();
00088
00089
protected:
00090
virtual bool listJobs(
const QString& prname, JobType type,
int limit = 0);
00091
virtual bool sendCommandSystemJob(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00092
bool sendCommandThreadJob(
const QPtrList<KMJob>& jobs,
int action,
const QString& arg = QString::null);
00093
00094
protected:
00095
QPtrList<KMJob> m_jobs;
00096
QDict<JobFilter> m_filter;
00097 KMThreadJob *m_threadjob;
00098 };
00099
00100
inline QDict<KMJobManager::JobFilter>* KMJobManager::filter()
00101 {
return &m_filter; }
00102
00103
inline void KMJobManager::clearFilter()
00104 { m_filter.clear(); }
00105
00106
inline KMThreadJob* KMJobManager::threadJob()
00107 {
return m_threadjob; }
00108
00109
#endif