kmlpdmanager.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 KMLPDMANAGER_H
00021 #define KMLPDMANAGER_H
00022 
00023 #include "kmmanager.h"
00024 #include <qdict.h>
00025 
00026 class PrintcapEntry;
00027 class PrinttoolEntry;
00028 class GsChecker;
00029 
00030 class KMLpdManager : public KMManager
00031 {
00032 public:
00033     KMLpdManager(QObject *parent = 0, const char *name = 0);
00034     ~KMLpdManager();
00035 
00036     bool completePrinterShort(KMPrinter*);
00037     bool completePrinter(KMPrinter*);
00038     bool createPrinter(KMPrinter*);
00039     bool removePrinter(KMPrinter*);
00040     bool enablePrinter(KMPrinter*);
00041     bool disablePrinter(KMPrinter*);
00042 
00043     // Driver DB functions
00044     QString driverDbCreationProgram();
00045     QString driverDirectory();
00046 
00047     // Driver loading functions
00048     DrMain* loadDbDriver(KMDBEntry*);
00049     DrMain* loadPrinterDriver(KMPrinter *p, bool config = false);
00050     bool savePrinterDriver(KMPrinter*, DrMain*);
00051     bool validateDbDriver(KMDBEntry*);
00052 
00053 protected:
00054     void listPrinters();
00055     bool writePrinters();
00056     void loadPrintcapFile(const QString& filename);
00057     bool writePrintcapFile(const QString& filename);
00058     void loadPrinttoolDb(const QString& filename);
00059     QMap<QString,QString> loadPrinttoolCfgFile(const QString& filename);
00060     bool savePrinttoolCfgFile(const QString& templatefile, const QString& dirname, const QMap<QString,QString>& options);
00061     bool checkGsDriver(const QString& gsdriver);
00062     bool createSpooldir(PrintcapEntry*);
00063     bool createPrinttoolEntry(KMPrinter*, PrintcapEntry*);
00064     PrintcapEntry* findPrintcapEntry(const QString& name);
00065     PrinttoolEntry* findPrinttoolEntry(const QString& name);
00066     QString programName(int);
00067     void checkStatus();
00068     bool enablePrinter(KMPrinter*, bool);
00069 
00070 private:
00071     QDict<PrintcapEntry>    m_entries;
00072     QDict<PrinttoolEntry>   m_ptentries;
00073     GsChecker       *m_gschecker;
00074 };
00075 
00076 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys