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 00029 namespace KNetwork { 00030 class KStreamSocket; 00031 } 00032 00033 class KMCupsManager : public KMManager 00034 { 00035 friend class KMWIppPrinter; 00036 friend class KMCupsJobManager; 00037 00038 Q_OBJECT 00039 public: 00040 KMCupsManager(TQObject *parent, const char *name, const TQStringList & /*args*/); 00041 virtual ~KMCupsManager(); 00042 00043 // printer management functions 00044 bool createPrinter(KMPrinter *p); 00045 bool removePrinter(KMPrinter *p); 00046 bool enablePrinter(KMPrinter *p, bool state); 00047 bool startPrinter(KMPrinter *p, bool state); 00048 bool completePrinter(KMPrinter *p); 00049 bool completePrinterShort(KMPrinter *p); 00050 bool setDefaultPrinter(KMPrinter *p); 00051 bool testPrinter(KMPrinter *p); 00052 00053 // printer listing functions 00054 // driver DB functions 00055 TQString driverDbCreationProgram(); 00056 TQString driverDirectory(); 00057 00058 DrMain* loadPrinterDriver(KMPrinter *p, bool config = false); 00059 DrMain* loadFileDriver(const TQString& filename); 00060 bool savePrinterDriver(KMPrinter *p, DrMain *d); 00061 00062 bool restartServer(); 00063 bool configureServer(TQWidget *parent = 0); 00064 TQStringList detectLocalPrinters(); 00065 00066 void createPluginActions(KActionCollection*); 00067 void validatePluginActions(KActionCollection*, KMPrinter*); 00068 TQString stateInformation(); 00069 00070 public slots: 00071 void exportDriver(); 00072 void printerIppReport(); 00073 00074 protected slots: 00075 void slotConnectionFailed( int ); 00076 void slotConnectionSuccess(); 00077 void slotAsyncConnect(); 00078 00079 void hostPingSlot(); 00080 void hostPingFailedSlot(); 00081 00082 protected: 00083 // the real printer listing job is done here 00084 void listPrinters(); 00085 void loadServerPrinters(); 00086 void processRequest(IppRequest*); 00087 bool setPrinterState(KMPrinter *p, int st); 00088 DrMain* loadDriverFile(const TQString& filename); 00089 DrMain* loadMaticDriver(const TQString& drname); 00090 void saveDriverFile(DrMain *driver, const TQString& filename); 00091 void reportIppError(IppRequest*); 00092 void* loadCupsdConfFunction(const char*); 00093 void unloadCupsdConf(); 00094 TQString cupsInstallDir(); 00095 void ippReport(IppRequest&, int, const TQString&); 00096 void checkUpdatePossibleInternal(); 00097 00098 private: 00099 KLibrary *m_cupsdconf; 00100 KMPrinter *m_currentprinter; 00101 KNetwork::KStreamSocket *m_socket; 00102 bool m_hostSuccess; 00103 bool m_lookupDone; 00104 }; 00105 00106 #endif