class KMimeMagic

More...

Deprecated! use with care
Definition#include <kmimemagic.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Protected Static Methods

Protected Members


Detailed Description

May be removed in KDE 4.0 Determine auto-magically the type of file, not only by using its extension, but also by reading its contents.

Unless specified otherwise, KMimeMagic uses $KDEDIR/share/mimelnk/magic for this purpose.

To make KMimeMagic restore the 'atime' of a file after it opened it, add its directory in kmimemagicrc like: [Settings] atimeDirs=/tmp,/var/tmp,/home/dfaure/tmp This isn't done by default because it changes the 'ctime'. See kmimemagic.cpp for a full discussion on this issue.

The basic usage of KMimeMagic is :

The result is contained in the class KMimeMagicResult.

 KMimeMagic ( const QString & configFile )

KMimeMagic

Create a parser and initialize it with the given config file.

 ~KMimeMagic ()

~KMimeMagic

Destroy the parser.

bool  mergeConfig ( const QString & configFile )

mergeConfig

Merge an existing parse table with the data from the given file.

Returns: true on success.

bool  mergeBufConfig (char *)

mergeBufConfig

Merge an existing parse table with the data from the given buffer.

Returns: true on success.

void  setFollowLinks ( bool _enable )

setFollowLinks

Enable/Disable follow-links.

(Default is disabled.)

KMimeMagicResult*  findFileType ( const QString & _filename )

findFileType

Try to find a MimeType for the given file.

If no special MimeType is found, the default MimeType is returned. This function looks at the content of the file.

Returns: A pointer to the result object. Do not delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic.

KMimeMagicResult*  findBufferType ( const QByteArray &p )

findBufferType

Same functionality as above, except data is not read from a file.

Instead a buffer can be supplied which is examined.

Returns: A pointer to the result object. Do not delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic.

KMimeMagicResult *  findBufferFileType ( const QByteArray &, const QString & filename )

findBufferFileType

Same functionality as findBufferType() but with additional capability of distinguishing between C-headers and C-Source.

For this purpose this function looks at the extension of the filename. This means that 'filename' can be a filename on some FTP server, too.

Returns: A pointer to the result object. Do not delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic.

KMimeMagic*  self ()

self

[static]

Returns a pointer to the unique KMimeMagic instance in this process.

KMimeMagicResult * magicResult

magicResult

[protected]

void  initStatic ()

initStatic

[protected static]

The result type.

static KMimeMagic* s_pSelf

s_pSelf

[protected]


Generated by: dfaure on faure on Tue Apr 16 08:49:48 2002, using kdoc 2.0a53.