kprinterimpl.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License version 2 as published by the Free Software Foundation.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  **/
00020 
00021 #ifndef KPRINTERIMPL_H
00022 #define KPRINTERIMPL_H
00023 
00024 #include <qobject.h>
00025 #include <qstringlist.h>
00026 #include <qmap.h>
00027 #include <qptrlist.h>
00028 
00029 #include <kdelibs_export.h>
00030 
00031 class KPrinter;
00032 class KMPrinter;
00033 
00034 class KDEPRINT_EXPORT KPrinterImpl : public QObject
00035 {
00036     Q_OBJECT
00037 public:
00038     KPrinterImpl(QObject *parent = 0, const char *name = 0);
00039     virtual ~KPrinterImpl();
00040 
00041     virtual bool setupCommand(QString& cmd, KPrinter*);
00042     virtual void preparePrinting(KPrinter*);
00043     virtual void broadcastOption(const QString& key, const QString& value);
00044 
00045     bool printFiles(KPrinter*, const QStringList&, bool removeflag = false);
00046     // result:
00047     //  -1  ->  error
00048     //  0   ->  nothing happened
00049     //  1   ->  files filterd
00050     int filterFiles(KPrinter*, QStringList&, bool removeflag = false);
00051     int autoConvertFiles(KPrinter*, QStringList&, bool removeflag = false);
00052     void saveOptions(const QMap<QString,QString>& opts);
00053     const QMap<QString,QString>& loadOptions() const    { return m_options; }
00054     QString tempFile();
00055     QString quote(const QString&);
00056     void statusMessage(const QString&, KPrinter* = 0);
00057 
00058 protected:
00059     bool startPrinting(const QString& cmd, KPrinter *printer, const QStringList& files, bool removeflag = false);
00060     int dcopPrint(const QString& cmd, const QStringList& files, bool removeflag = false);
00061     bool setupSpecialCommand(QString&, KPrinter*, const QStringList&);
00062     int doFilterFiles(KPrinter* pr, QStringList& files, const QStringList& flist, const QMap<QString,QString>& opts, bool removeflag = false);
00063     void loadAppOptions();
00064     void saveAppOptions();
00065 
00066 protected:
00067     QMap<QString,QString>   m_options;  // use to save current options
00068 };
00069 
00070 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys