kmmanager.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef KMMANAGER_H
00021 #define KMMANAGER_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 <kdeprint/kmprinter.h>
00028 
00029 #include <qobject.h>
00030 #include <qstring.h>
00031 #include <qptrlist.h>
00032 
00033 class DrMain;
00034 class KMDBEntry;
00035 class KMVirtualManager;
00036 class KMSpecialManager;
00037 class QWidget;
00038 class KActionCollection;
00039 class PrinterFilter;
00040 
00048 class KMManager : public QObject
00049 {
00050     Q_OBJECT
00051 
00052 friend class KMVirtualManager;
00053 friend class KMSpecialManager;
00054 friend class KMFactory;
00055 
00056 public:
00057     enum PrinterOperations {
00058         PrinterEnabling  = 0x01,
00059         PrinterCreation  = 0x02,
00060         PrinterDefault   = 0x04,
00061         PrinterTesting   = 0x08,
00062         PrinterConfigure = 0x10,
00063         PrinterRemoval   = 0x20,
00064         PrinterAll       = 0xFF
00065     };
00066     enum ServerOperations {
00067         ServerRestarting = 0x1,
00068         ServerConfigure  = 0x2,
00069         ServerAll        = 0xF
00070     };
00071 
00072     KMManager(QObject *parent = 0, const char *name = 0);
00073     virtual ~KMManager();
00074 
00075     static KMManager* self();
00076 
00077     
00078     QString errorMsg() const        { return m_errormsg; }
00079     void setErrorMsg(const QString& s)  { m_errormsg = s; }
00080 
00081     
00082     bool hasManagement() const      { return m_hasmanagement; }
00083 
00084     
00085     virtual bool createPrinter(KMPrinter *p);
00086     virtual bool removePrinter(KMPrinter *p);
00087     virtual bool enablePrinter(KMPrinter *p, bool on);
00088     virtual bool startPrinter(KMPrinter *p, bool on);
00089     virtual bool completePrinter(KMPrinter *p);
00090     virtual bool completePrinterShort(KMPrinter *p);
00091     virtual bool setDefaultPrinter(KMPrinter *p);
00092     virtual bool testPrinter(KMPrinter *p);
00093     bool upPrinter(KMPrinter *p, bool state);
00094     bool modifyPrinter(KMPrinter *oldp, KMPrinter *newp);
00095     bool removePrinter(const QString& name);
00096     bool enablePrinter(const QString& name, bool state);
00097     bool startPrinter(const QString& name, bool state);
00098     bool completePrinter(const QString& name);
00099     bool setDefaultPrinter(const QString& name);
00100     int printerOperationMask() const    { return m_printeroperationmask; }
00101     int addPrinterWizard(QWidget *parent = 0);
00102 
00103     
00104     bool createSpecialPrinter(KMPrinter *p);
00105     bool removeSpecialPrinter(KMPrinter *p);
00106 
00107     
00108     KMPrinter* findPrinter(const QString& name);
00109     QPtrList<KMPrinter>* printerList(bool reload = true);
00110     QPtrList<KMPrinter>* printerListComplete(bool reload = true);
00111     KMPrinter* defaultPrinter();
00112     void enableFilter(bool on);
00113     bool isFilterEnabled() const;
00114 
00115     
00116     virtual QString driverDbCreationProgram();
00117     virtual QString driverDirectory();
00118 
00119     
00120     virtual DrMain* loadPrinterDriver(KMPrinter *p, bool config = false);
00121     virtual DrMain* loadDbDriver(KMDBEntry *entry);
00122     virtual DrMain* loadFileDriver(const QString& filename);
00123     DrMain* loadDriver(KMPrinter *p, bool config = false);
00124     virtual bool savePrinterDriver(KMPrinter *p, DrMain *d);
00125     virtual bool validateDbDriver(KMDBEntry *entry);
00126 
00127     
00128     bool invokeOptionsDialog(QWidget *parent = 0);
00129     virtual QString stateInformation();
00130 
00131     
00132     int serverOperationMask() const     { return m_serveroperationmask; }
00133     virtual bool restartServer();
00134     virtual bool configureServer(QWidget *parent = 0);
00135     virtual QStringList detectLocalPrinters();
00136 
00137     
00138     virtual void createPluginActions(KActionCollection*);
00139     virtual void validatePluginActions(KActionCollection*, KMPrinter*);
00140 
00141     
00142     void checkUpdatePossible();
00143 
00144 signals:
00145     void updatePossible( bool );
00146 
00147 protected:
00148     
00149     virtual void listPrinters();
00150 
00151     
00152     void addPrinter(KMPrinter *p);  
00153                     
00154     void setHardDefault(KMPrinter*);
00155     void setSoftDefault(KMPrinter*);
00156     KMPrinter* softDefault() const;
00157     KMPrinter* hardDefault() const;
00158     
00159     
00160     
00161     bool uncompressFile(const QString& srcname, QString& destname);
00162     bool notImplemented();
00163     void setHasManagement(bool on)      { m_hasmanagement = on; }
00164     void setPrinterOperationMask(int m) { m_printeroperationmask = m; }
00165     void setServerOperationMask(int m)  { m_serveroperationmask = m; }
00166     QString testPage();
00167     void discardAllPrinters(bool);
00168     void setUpdatePossible( bool );
00169     virtual void checkUpdatePossibleInternal();
00170 
00171 protected:
00172     QString         m_errormsg;
00173     KMPrinterList       m_printers, m_fprinters;    
00174     bool            m_hasmanagement;
00175     int         m_printeroperationmask;
00176     int             m_serveroperationmask;
00177     KMSpecialManager    *m_specialmgr;
00178     KMVirtualManager    *m_virtualmgr;
00179     PrinterFilter   *m_printerfilter;
00180     bool m_updatepossible;
00181 };
00182 
00183 #endif
 
This file is part of the documentation for kdeprint Library Version 3.2.0.