kmcupsmanager.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., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #ifndef KMCUPSMANAGER_H
00021 #define KMCUPSMANAGER_H
00022 
00023 #include "kmmanager.h"
00024 
00025 class IppRequest;
00026 class KLibrary;
00027 class KExtendedSocket;
00028 class QSocket;
00029 
00030 class KMCupsManager : public KMManager
00031 {
00032     friend class KMWIppPrinter;
00033     friend class KMCupsJobManager;
00034 
00035     Q_OBJECT
00036 public:
00037     KMCupsManager(QObject *parent, const char *name, const QStringList & /*args*/);
00038     virtual ~KMCupsManager();
00039 
00040     // printer management functions
00041     bool createPrinter(KMPrinter *p);
00042     bool removePrinter(KMPrinter *p);
00043     bool enablePrinter(KMPrinter *p, bool state);
00044     bool startPrinter(KMPrinter *p, bool state);
00045     bool completePrinter(KMPrinter *p);
00046     bool completePrinterShort(KMPrinter *p);
00047     bool setDefaultPrinter(KMPrinter *p);
00048     bool testPrinter(KMPrinter *p);
00049 
00050     // printer listing functions
00051     // driver DB functions
00052     QString driverDbCreationProgram();
00053     QString driverDirectory();
00054 
00055     DrMain* loadPrinterDriver(KMPrinter *p, bool config = false);
00056     DrMain* loadFileDriver(const QString& filename);
00057     bool savePrinterDriver(KMPrinter *p, DrMain *d);
00058 
00059     bool restartServer();
00060     bool configureServer(QWidget *parent = 0);
00061     QStringList detectLocalPrinters();
00062 
00063     void createPluginActions(KActionCollection*);
00064     void validatePluginActions(KActionCollection*, KMPrinter*);
00065     QString stateInformation();
00066 
00067 public slots:
00068     void exportDriver();
00069     void printerIppReport();
00070 
00071 protected slots:
00072     void hostPingSlot();
00073     void hostPingFailedSlot();
00074 
00075 protected:
00076     // the real printer listing job is done here
00077     void listPrinters();
00078     void loadServerPrinters();
00079     void processRequest(IppRequest*);
00080     bool setPrinterState(KMPrinter *p, int st);
00081     DrMain* loadDriverFile(const QString& filename);
00082     DrMain* loadMaticDriver(const QString& drname);
00083     void saveDriverFile(DrMain *driver, const QString& filename);
00084     void reportIppError(IppRequest*);
00085     void* loadCupsdConfFunction(const char*);
00086     void unloadCupsdConf();
00087     QString cupsInstallDir();
00088     void ippReport(IppRequest&, int, const QString&);
00089     void checkUpdatePossibleInternal();
00090 
00091 private:
00092     KLibrary    *m_cupsdconf;
00093     KMPrinter   *m_currentprinter;
00094     bool m_hostSuccess;
00095     bool m_lookupDone;
00096 };
00097 
00098 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys