kdeprint Library API Documentation

kmjobmanager.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <goffioul@imec.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  *  Boston, MA 02111-1307, USA.
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     //KMJob* findJob(int ID);
00069     KMJob* findJob(const QString& uri);
00070     //bool sendCommand(int ID, int action, const QString& arg = QString::null);
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
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.2.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Feb 4 12:36:22 2004 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2003