diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kioslave/man/kio_man.h | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/man/kio_man.h')
-rw-r--r-- | kioslave/man/kio_man.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/kioslave/man/kio_man.h b/kioslave/man/kio_man.h new file mode 100644 index 000000000..f571082db --- /dev/null +++ b/kioslave/man/kio_man.h @@ -0,0 +1,99 @@ +/* This file is part of the KDE libraries + Copyright (c) 2000 Matthias Hoelzer-Kluepfel <[email protected]> + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef __kio_man_h__ +#define __kio_man_h__ + + +#include <qstring.h> +#include <qcstring.h> +#include <qstringlist.h> +#include <qdict.h> +#include <qbuffer.h> + + +#include <kio/global.h> +#include <kio/slavebase.h> + + +class MANProtocol : public QObject, public KIO::SlaveBase +{ + Q_OBJECT + +public: + + MANProtocol(const QCString &pool_socket, const QCString &app_socket); + virtual ~MANProtocol(); + + virtual void get(const KURL& url); + virtual void stat(const KURL& url); + + virtual void mimetype(const KURL &url); + virtual void listDir(const KURL &url); + + void outputError(const QString& errmsg); + void outputMatchingPages(const QStringList &matchingPages); + + void showMainIndex(); + void showIndex(const QString& section); + + // the following two functions are the interface to man2html + void output(const char *insert); + char *readManPage(const char *filename); + + static MANProtocol *self(); + +private slots: + void slotGetStdOutput(KProcess*, char*, int); + +private: + void checkManPaths(); + QStringList manDirectories(); + QMap<QString, QString> buildIndexMap(const QString& section); + bool addWhatIs(QMap<QString, QString>& i, const QString& f, const QString& mark); + void parseWhatIs( QMap<QString, QString> &i, QTextStream &t, const QString &mark ); + QStringList findPages(const QString& section, + const QString &title, + bool full_path = true); + + void addToBuffer(const char *buffer, int buflen); + QString pageName(const QString& page) const; + QStringList buildSectionList(const QStringList& dirs) const; + void constructPath(QStringList& constr_path, QStringList constr_catmanpath); +private: + static MANProtocol *_self; + QCString lastdir; + + void findManPagesInSection(const QString &dir, const QString &title, bool full_path, QStringList &list); + QStringList m_manpath; ///< Path of man directories + QStringList m_mandbpath; ///< Path of catman directories + QStringList section_names; + + QString myStdStream; + QString mySgml2RoffPath; + void getProgramPath(); + + QCString m_htmlPath; ///< Path to KDE resources, encoded for HTML + QCString m_cssPath; ///< Path to KDE resources, encoded for CSS + QBuffer m_outputBuffer; ///< Buffer for the output + QString m_manCSSFile; ///< Path to kio_man.css +}; + + +#endif |