kmjobmanager.h
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; }
00053         int m_type[2];
00054     };
00055 
00056     KMJobManager(QObject *parent = 0, const char *name = 0);
00057     virtual ~KMJobManager();
00058 
00059     static KMJobManager* self();
00060 
00061     void addPrinter(const QString& pr, JobType type = ActiveJobs);
00062     void removePrinter(const QString& pr, JobType type = ActiveJobs);
00063     void clearFilter();
00064     QDict<JobFilter>* filter();
00065     int limit();
00066     void setLimit(int val);
00067 
00068     
00069     KMJob* findJob(const QString& uri);
00070     
00071     bool sendCommand(const QString& uri, int action, const QString& arg = QString::null);
00072     bool sendCommand(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
00073     const QPtrList<KMJob>& jobList(bool reload = true);
00074     void addJob(KMJob*);
00075     KMThreadJob* threadJob();
00076 
00077     virtual int actions();
00078     virtual QValueList<KAction*> createPluginActions(KActionCollection*);
00079     virtual void validatePluginActions(KActionCollection*, const QPtrList<KMJob>&);
00080     virtual bool doPluginAction(int, const QPtrList<KMJob>&);
00081 
00082 protected:
00083     void discardAllJobs();
00084     void removeDiscardedJobs();
00085 
00086 protected:
00087     virtual bool listJobs(const QString& prname, JobType type, int limit = 0);
00088     virtual bool sendCommandSystemJob(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
00089     bool sendCommandThreadJob(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
00090 
00091 protected:
00092     QPtrList<KMJob> m_jobs;
00093     QDict<JobFilter>    m_filter;
00094     KMThreadJob *m_threadjob;
00095 };
00096 
00097 inline QDict<KMJobManager::JobFilter>* KMJobManager::filter()
00098 { return &m_filter; }
00099 
00100 inline void KMJobManager::clearFilter()
00101 { m_filter.clear(); }
00102 
00103 inline KMThreadJob* KMJobManager::threadJob()
00104 { return m_threadjob; }
00105 
00106 #endif
 
This file is part of the documentation for kdeprint Library Version 3.2.0.