diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:58:28 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:58:28 +0000 |
commit | 83b9bf0e3bfb1d842b10b80bbe749095b2c661a1 (patch) | |
tree | b05b1793361693ae88106648c2a953bed988f423 /krusader/krservices.h | |
download | krusader-83b9bf0e3bfb1d842b10b80bbe749095b2c661a1.tar.gz krusader-83b9bf0e3bfb1d842b10b80bbe749095b2c661a1.zip |
Added old KDE3 version of Krusader
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/krusader@1094427 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krusader/krservices.h')
-rw-r--r-- | krusader/krservices.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/krusader/krservices.h b/krusader/krservices.h new file mode 100644 index 0000000..d001cf2 --- /dev/null +++ b/krusader/krservices.h @@ -0,0 +1,78 @@ +/*************************************************************************** + krservices.h - description + ------------------- + begin : Thu Aug 8 2002 + copyright : (C) 2002 by Shie Erlich & Rafi Yanai + email : + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KRSERVICES_H +#define KRSERVICES_H + +#include <qstring.h> +#include <qstringlist.h> +#include <qmap.h> +#include <kprocess.h> + +/** + *@author Shie Erlich & Rafi Yanai + */ + +class KrServices { +public: + KrServices(){} + ~KrServices(){} + + static bool cmdExist(QString cmdName); + static QString detectFullPathName( QString name ); + static QString fullPathName( QString name, QString confName = QString::null ); + static QStringList separateArgs( QString args ); + static QString registerdProtocol(QString mimetype); + static void clearProtocolCache(); + static bool fileToStringList(QTextStream *stream, QStringList& target, bool keepEmptyLines=false); + static QString quote( QString name ); + static QStringList quote( const QStringList& names ); + +protected: + static QString escape( QString name ); + +private: + static QMap<QString,QString>* slaveMap; + +}; + + +// TODO: make KrServices a namespace and move it there + +// wraps over kprocess, but buffers stdout and stderr and allows easy access to them later +// note, that you still have to enable stdout,stderr in KEasyProcess::start() for buffering +// to happen (ie: start(KEasyProcess::Block, KEasyProcess::AllOutput);) +class KEasyProcess: public KProcess { + Q_OBJECT +public: + KEasyProcess(QObject *parent, const char *name=0); + KEasyProcess(); + virtual ~KEasyProcess() {} + + const QString& getStdout() const { return _stdout; } + const QString& getStderr() const { return _stderr; } + +protected slots: + void receivedStdout (KProcess *proc, char *buffer, int buflen); + void receivedStderr (KProcess *proc, char *buffer, int buflen); + void init(); + +private: + QString _stdout, _stderr; +}; + +#endif |