diff options
Diffstat (limited to 'src/sq_archivehandler.h')
-rw-r--r-- | src/sq_archivehandler.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/sq_archivehandler.h b/src/sq_archivehandler.h new file mode 100644 index 0000000..bc46a48 --- /dev/null +++ b/src/sq_archivehandler.h @@ -0,0 +1,67 @@ +/*************************************************************************** + sq_archivehandler.h - description + ------------------- + begin : ??? ??? 26 2004 + copyright : (C) 2004 by Baryshev Dmitry + email : ksquirrel.iv@gmail.com + ***************************************************************************/ + +#ifndef SQ_ARCHIVEHANDLER_H +#define SQ_ARCHIVEHANDLER_H + +#include <tqobject.h> +#include <tqstring.h> +#include <tqmap.h> + +// forward declarations +class KFileItem; +class KURL; + +#define SQ_AH SQ_ArchiveHandler + +/* + * Helper class for archive extracting via tdeio-slaves (since 0.7.1). + */ + +class SQ_ArchiveHandler : public TQObject, TQMap<TQString, TQString> +{ + TQ_OBJECT + + + public: + SQ_ArchiveHandler(TQObject *parent = 0, const char *name = 0); + ~SQ_ArchiveHandler(); + + /* + * Find protocol name by mimetype name. + * + * For example findProtocolByMime(""application/x-tgz"") will + * return "tar". + */ + TQString findProtocolByMime(const TQString &mime); + + /* + * Find protocol name by KFileItem's mimetype. + */ + TQString findProtocolByFile(KFileItem *item); + + /* + * Determine mimetype and emit unpack() signal + */ + void tryUnpack(KFileItem *); + + void tryUnpack(const KURL &, const TQString &mime); + + static SQ_ArchiveHandler* instance() { return m_instance; } + + private: + void fillProtocols(); + + signals: + void unpack(const KURL &); + + private: + static SQ_ArchiveHandler *m_instance; +}; + +#endif |