class KFileMetaInfo

# class KFileMetaInfo | More...
Definition | `#include <kfilemetainfo.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- typedef KFileMimeTypeInfo::Hint Hint
- typedef KFileMimeTypeInfo::Unit Unit
- typedef KFileMimeTypeInfo::Attributes Attributes
- enum What { Fastest = 0x1, DontCare = 0x2, TechnicalInfo = 0x4, ContentInfo = 0x8, ExtenedAttr = 0x10, Thumbnail = 0x20, Preferred = 0x40, Everything = 0xffff }

#### Public Methods

- KFileMetaInfo ( const QString& path, const QString& mimeType = QString::null, uint what = Fastest)
- KFileMetaInfo ()
- KFileMetaInfo ( const KFileMetaInfo& original)
- ~KFileMetaInfo ()
- const KFileMetaInfo& operator= (const KFileMetaInfo& info )
- QStringList groups () const
- QStringList supportedGroups () const
- QStringList preferredGroups () const
- QStringList preferredKeys () const
- QStringList supportedKeys () const
- QStringList editableGroups () const
- KFileMetaInfoItem item (const QString& key) const
- KFileMetaInfoItem item (const KFileMetaInfoItem::Hint hint) const
- KFileMetaInfoItem saveItem ( const QString& key, const QString& preferredGroup = QString::null, bool createGroup = true )
- KFileMetaInfoGroup group (const QString& key) const
- KFileMetaInfoGroup operator[] (const QString& key) const
- bool addGroup ( const QString& name )
- bool removeGroup ( const QString& name )
- QStringList removedGroups ()
- bool applyChanges ()
- bool contains ( const QString& key ) const
- bool containsGroup ( const QString& key ) const
- const QVariant value ( const QString& key ) const
- bool isValid () const
- bool isEmpty () const
- QString mimeType () const
- QString path () const
- friend QDataStream& operator >> (QDataStream& s, KFileMetaInfo& )
- friend QDataStream& operator << (QDataStream& s, const KFileMetaInfo& )

#### Public Members

- Forward Data
- friend class KFilePlugin

#### Protected Methods

- KFileMetaInfoGroup appendGroup (const QString& name)
- KFilePlugin * const plugin () const
- void ref ()
- void deref ()

#### Protected Members

- Data* d

## Detailed Description

This is the class for objects that hold meta information about a file. The information is kept in form of a system of key/value pairs. See also KFileMetaInfoItem. This information is retrieved from the file through a plugin system, and this class is the main interface to it. If you want to write your own plugin, have a look at KFilePlugin. There are basically two different kinds of meta information: Fixed ones that the plugin knows about (e.g. an mp3 id3v1 tag has a well defined fixed list of fields), and variable keys that exist in mimetypes that support their own key/value system (comments in png files are of this type). Almost every file has fixed keys, but some also have variable keys.

The groups and the What enum are not yet supported, but already added to the interface so that adding support doesn't break compatibility.

typedef KFileMimeTypeInfo::Hint Hint | ### Hint

typedef KFileMimeTypeInfo::Unit Unit | ### Unit

typedef KFileMimeTypeInfo::Attributes Attributes | ### Attributes

enum What { Fastest = 0x1, DontCare = 0x2, TechnicalInfo = 0x4, ContentInfo = 0x8, ExtenedAttr = 0x10, Thumbnail = 0x20, Preferred = 0x40, Everything = 0xffff } | ### What

This is used to specify what a KFileMetaInfo object should read, so you can specify if you want to read "expensive" items or not.

- `Fastest` do the fastest possible read and omit all items that might need a significantly longer time than the others
- `Everything` read everything, even if it might take a while
- `DontCare` let the plugin decide what to read
- `TechnicalInfo` extract technical details about the file, like e.g. play time, resolution or a compression type
- `ContentInfo` read information about the content of the file, like comments or id3 tags
- `ExtendedAttr` read filesystem based extended attributes if they are supported for the filesystem
- `Thumbnail` only read the file's thumbnail, if it contains one
- `Preferred` get at least the preferred items

KFileMetaInfo ( const QString& path, const QString& mimeType = QString::null, uint what = Fastest) | ### KFileMetaInfo

The constructor.

creating a KFileMetaInfo item through this will autoload the plugin belonging to the mimetype and try to get meta information about the specified file.

If no info is available, you'll get an empty (not invalid) object. You can test for it with the isEmpty() method.

Parameters:

path | The file name. This must be the path to a local file.
mimeType | The name of the file's mimetype. If ommited, the mimetype is autodetected
what | one or more of the `What` enum values. It gives some hint to the plugin what information is desired. The plugin may still return more items.

KFileMetaInfo () | ### KFileMetaInfo

Default constructor. This will create an invalid object (see isValid().

KFileMetaInfo ( const KFileMetaInfo& original) | ### KFileMetaInfo

Copy constructor

~KFileMetaInfo () | ### ~KFileMetaInfo

const KFileMetaInfo& operator= (const KFileMetaInfo& info ) | ### operator=

The assignment operator, so you can do e.g.:

        KFileMetaInfo info;
        if (something) info = KFileMetaInfo("/the/file");

This will create a shared copy of the object. The actual data is automatically deleted if all copies go out of scope

QStringList groups () | ### groups

[const]

Returns: all keys groups that the file has.

QStringList supportedGroups () | ### supportedGroups

[const]

QStringList preferredGroups () | ### preferredGroups

[const]

QStringList preferredKeys () | ### preferredKeys

[const]

QStringList supportedKeys () | ### supportedKeys

[const]

QStringList editableGroups () | ### editableGroups

[const]

Returns: the list of groups that you can add or remove from the file.

KFileMetaInfoItem item (const QString& key) | ### item

[const]

KFileMetaInfoItem item (const KFileMetaInfoItem::Hint hint) | ### item

[const]

KFileMetaInfoItem saveItem ( const QString& key, const QString& preferredGroup = QString::null, bool createGroup = true ) | ### saveItem

KFileMetaInfoGroup group (const QString& key) | ### group

[const]

KFileMetaInfoGroup operator[] (const QString& key) | ### operator[]

[const]

bool addGroup ( const QString& name ) | ### addGroup

Try to add the specified group. This will only succeed if it is in the list of editableGroups(). Note that all non-variable items that belong to this group are automatically added as empty item.

bool removeGroup ( const QString& name ) | ### removeGroup

remove the specified group. This will only succeed if it is in the list of editableGroups(). Beware that this also removes all the items in that group, so always ask the user before removing it!

QStringList removedGroups () | ### removedGroups

bool applyChanges () | ### applyChanges

This method writes all pending changes of the meta info back to the file. If any items are marked as removed, they are really removed from the list. The info object as well as all items are updated.

Returns: true if successful, false if not

bool contains ( const QString& key ) | ### contains

[const]

Returns: whether an item for this key exists.

bool containsGroup ( const QString& key ) | ### containsGroup

[const]

Returns: whether a group with this name exists.

const QVariant value ( const QString& key ) | ### value

[const]

bool isValid () | ### isValid

[const]

Returns: true if the item is valid, i.e. if actually represents the info about a file, false if the object is uninitialized

bool isEmpty () | ### isEmpty

[const]

Returns: false if the object contains data, true if it's empty. You'll get an empty object if no plugin for the file could be found.

QString mimeType () | ### mimeType

[const]

QString path () | ### path

[const]

friend QDataStream& operator >> (QDataStream& s, KFileMetaInfo& ) | ### operator >>

friend QDataStream& operator << (QDataStream& s, const KFileMetaInfo& ) | ### operator <<

friend class KFilePlugin | ### KFilePlugin

KFileMetaInfoGroup appendGroup (const QString& name) | ### appendGroup

[protected]

KFilePlugin * const plugin () | ### plugin

[protected const]

Returns: a pointer to the plugin that belogs to this object's mimetype. It will be auto-loaded if it's currently not loaded

void ref () | ### ref

[protected]

void deref () | ### deref

[protected]

Data* d | ### d

[protected]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:57 2003, using kdoc 2.0a54.