You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.3 KiB
101 lines
3.3 KiB
15 years ago
|
/* This file is part of the KDE libraries
|
||
|
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <mhk@caldera.de>
|
||
|
|
||
|
|
||
|
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.
|
||
|
*/
|
||
12 years ago
|
#ifndef __tdeio_man_h__
|
||
|
#define __tdeio_man_h__
|
||
15 years ago
|
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqcstring.h>
|
||
|
#include <tqstringlist.h>
|
||
|
#include <tqdict.h>
|
||
|
#include <tqbuffer.h>
|
||
15 years ago
|
|
||
|
|
||
12 years ago
|
#include <tdeio/global.h>
|
||
|
#include <tdeio/slavebase.h>
|
||
15 years ago
|
|
||
|
|
||
12 years ago
|
class MANProtocol : public TQObject, public TDEIO::SlaveBase
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
|
||
15 years ago
|
MANProtocol(const TQCString &pool_socket, const TQCString &app_socket);
|
||
15 years ago
|
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);
|
||
|
|
||
15 years ago
|
void outputError(const TQString& errmsg);
|
||
|
void outputMatchingPages(const TQStringList &matchingPages);
|
||
15 years ago
|
|
||
|
void showMainIndex();
|
||
15 years ago
|
void showIndex(const TQString& section);
|
||
15 years ago
|
|
||
|
// the following two functions are the interface to man2html
|
||
|
void output(const char *insert);
|
||
|
char *readManPage(const char *filename);
|
||
|
|
||
|
static MANProtocol *self();
|
||
|
|
||
|
private slots:
|
||
12 years ago
|
void slotGetStdOutput(TDEProcess*, char*, int);
|
||
|
void slotGetStdOutputUtf8(TDEProcess*, char*, int);
|
||
15 years ago
|
|
||
|
private:
|
||
|
void checkManPaths();
|
||
15 years ago
|
TQStringList manDirectories();
|
||
|
TQMap<TQString, TQString> buildIndexMap(const TQString& section);
|
||
|
bool addWhatIs(TQMap<TQString, TQString>& i, const TQString& f, const TQString& mark);
|
||
|
void parseWhatIs( TQMap<TQString, TQString> &i, TQTextStream &t, const TQString &mark );
|
||
|
TQStringList findPages(const TQString& section,
|
||
|
const TQString &title,
|
||
15 years ago
|
bool full_path = true);
|
||
|
|
||
|
void addToBuffer(const char *buffer, int buflen);
|
||
15 years ago
|
TQString pageName(const TQString& page) const;
|
||
|
TQStringList buildSectionList(const TQStringList& dirs) const;
|
||
|
void constructPath(TQStringList& constr_path, TQStringList constr_catmanpath);
|
||
15 years ago
|
private:
|
||
|
static MANProtocol *_self;
|
||
15 years ago
|
TQCString lastdir;
|
||
15 years ago
|
|
||
15 years ago
|
void findManPagesInSection(const TQString &dir, const TQString &title, bool full_path, TQStringList &list);
|
||
|
TQStringList m_manpath; ///< Path of man directories
|
||
|
TQStringList m_mandbpath; ///< Path of catman directories
|
||
|
TQStringList section_names;
|
||
15 years ago
|
|
||
15 years ago
|
TQString myStdStream;
|
||
|
TQString mySgml2RoffPath;
|
||
15 years ago
|
void getProgramPath();
|
||
|
|
||
13 years ago
|
TQCString m_htmlPath; ///< Path to TDE resources, encoded for HTML
|
||
|
TQCString m_cssPath; ///< Path to TDE resources, encoded for CSS
|
||
15 years ago
|
TQBuffer m_outputBuffer; ///< Buffer for the output
|
||
12 years ago
|
TQString m_manCSSFile; ///< Path to tdeio_man.css
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
#endif
|