kprintprocess.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 KPRINTPROCESS_H
00021 #define KPRINTPROCESS_H
00022 
00023 #include <kprocess.h>
00024 #include <qstringlist.h>
00025 
00026 class KPrintProcess : public KShellProcess
00027 {
00028     Q_OBJECT
00029 public:
00030     KPrintProcess();
00031     ~KPrintProcess();
00032 
00033     bool print();
00034     QString errorMessage() const;
00035 
00036     void setOutput( const QString& output );
00037     const QString& output() const;
00038     void setTempOutput( const QString& output );
00039     const QString& tempOutput() const;
00040     void setTempFiles( const QStringList& files );
00041     const QStringList& tempFiles() const;
00042     void setCommand( const QString& cmd );
00043     const QString& command() const;
00044 
00045     enum State { None = 0, Printing, Finishing };
00046     int state() const;
00047 
00048 signals:
00049     void printTerminated( KPrintProcess* );
00050     void printError( KPrintProcess*, const QString& );
00051 
00052 protected slots:
00053     void slotReceivedStderr(KProcess*, char*, int);
00054     void slotExited( KProcess* );
00055 
00056 private:
00057     QString m_buffer;
00058     QStringList m_tempfiles;
00059     QString m_output, m_tempoutput, m_command;
00060     int m_state;
00061 };
00062 
00063 inline const QString& KPrintProcess::output() const
00064 { return m_output; }
00065 
00066 inline const QString& KPrintProcess::tempOutput() const
00067 { return m_tempoutput; }
00068 
00069 inline const QStringList& KPrintProcess::tempFiles() const
00070 { return m_tempfiles; }
00071 
00072 inline const QString& KPrintProcess::command() const
00073 { return m_command; }
00074 
00075 inline void KPrintProcess::setOutput( const QString& s )
00076 { m_output = s; }
00077 
00078 inline void KPrintProcess::setTempOutput( const QString& s )
00079 { m_tempoutput = s; }
00080 
00081 inline void KPrintProcess::setTempFiles( const QStringList& l )
00082 { m_tempfiles = l; }
00083 
00084 inline void KPrintProcess::setCommand( const QString& c )
00085 { m_command = c; }
00086 
00087 inline int KPrintProcess::state() const
00088 { return m_state; }
00089 
00090 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys