# kdeprint Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmmanager.h

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.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 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 KDEPRINT_EXPORT 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     // error management functions
    00078     QString errorMsg() const        { return m_errormsg; }
    00079     void setErrorMsg(const QString& s)  { m_errormsg = s; }
    00080
    00081     // support management ?
    00082     bool hasManagement() const      { return m_hasmanagement; }
    00083
    00084     // printer management functions
    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     // special printer management functions
    00104     bool createSpecialPrinter(KMPrinter *p);
    00105     bool removeSpecialPrinter(KMPrinter *p);
    00106
    00107     // printer listing functions
    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     // driver DB functions
    00116     virtual QString driverDbCreationProgram();
    00117     virtual QString driverDirectory();
    00118
    00119     // driver functions
    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     // configuration functions
    00128     bool invokeOptionsDialog(QWidget *parent = 0);
    00129     virtual QString stateInformation();
    00130
    00131     // server functions
    00132     int serverOperationMask() const     { return m_serveroperationmask; }
    00133     virtual bool restartServer();
    00134     virtual bool configureServer(QWidget *parent = 0);
    00135     virtual QStringList detectLocalPrinters();
    00136
    00137     // additional actions (for print manager)
    00138     virtual void createPluginActions(KActionCollection*);
    00139     virtual void validatePluginActions(KActionCollection*, KMPrinter*);
    00140
    00141     // utility function
    00142     void checkUpdatePossible();
    00143
    00144 signals:
    00145     void updatePossible( bool );
    00146
    00147 protected:
    00148     // the real printer listing job is done here
    00149     virtual void listPrinters();
    00150
    00151     // utility functions
    00152     void addPrinter(KMPrinter *p);  // in any case, the pointer given MUST not be used after
    00153                     // calling this function. Useful when listing printers.
    00154     void setHardDefault(KMPrinter*);
    00155     void setSoftDefault(KMPrinter*);
    00156     KMPrinter* softDefault() const;
    00157     KMPrinter* hardDefault() const;
    00158     // this function uncompress the given file (or does nothing
    00159     // if the file is not compressed). Returns wether the file was
    00160     // compressed or not.
    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;    // filtered printers
    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.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003