00001 // -*- c++ -*- 00002 00003 /* 00004 * Copyright (C) 2004, Ian Reinhart Geiser <geiseri@kde.org> 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 as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef KSIMPLE_PROCESS_H 00023 #define KSIMPLE_PROCESS_H 00024 00025 #include <qobject.h> 00026 #include <qprocess.h> 00027 00034 class KSimpleProcess : public QObject 00035 { 00036 Q_OBJECT 00037 00038 public: 00050 static QString exec( const QString &args, bool addStdErr = false ); 00051 00052 private: 00053 KSimpleProcess(); 00054 ~KSimpleProcess(); 00055 void enter_loop(); 00056 QString execInternal( const QString &args, bool addStdError); 00057 00058 QString m_currBuffer; 00059 bool m_stdErrOn; 00060 QProcess *m_proc; 00061 00062 public slots: 00063 void slotProcessExited(); 00064 void slotReceivedStdout(); 00065 void slotReceivedStderr(); 00066 00067 friend class Im_lonely; // yet another reason why c++ is braindead... 00068 }; 00069 00070 #endif // KSIMPLE_PROCESS_H