kio Library: KFilePlugin Class Reference (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KFilePlugin Class Reference

Baseclass for a meta info plugin. More...

`#include <kfilemetainfo.h>`

Inheritance diagram for KFilePlugin:

[legend]
Collaboration diagram for KFilePlugin:

[legend]
List of all members.

## Public Member Functions
| KFilePlugin (QObject *parent, const char *name, const QStringList &args)
virtual bool | readInfo (KFileMetaInfo &info, uint what=KFileMetaInfo::Fastest)=0
virtual bool | writeInfo (const KFileMetaInfo &info) const
virtual QValidator * | createValidator (const QString &mimeType, const QString &group, const QString &key, QObject *parent, const char *name) const
## Protected Member Functions
KFileMimeTypeInfo::GroupInfo * | addGroupInfo (KFileMimeTypeInfo *info, const QString &key, const QString &translatedKey) const
void | setAttributes (KFileMimeTypeInfo::GroupInfo *gi, uint attr) const
void | addVariableInfo (KFileMimeTypeInfo::GroupInfo *gi, QVariant::Type type, uint attr) const
KFileMimeTypeInfo::ItemInfo * | addItemInfo (KFileMimeTypeInfo::GroupInfo *gi, const QString &key, const QString &translatedKey, QVariant::Type type)
void | setAttributes (KFileMimeTypeInfo::ItemInfo *item, uint attr)
void | setHint (KFileMimeTypeInfo::ItemInfo *item, uint hint)
void | setUnit (KFileMimeTypeInfo::ItemInfo *item, uint unit)
void | setPrefix (KFileMimeTypeInfo::ItemInfo *item, const QString &prefix)
void | setSuffix (KFileMimeTypeInfo::ItemInfo *item, const QString &suffix)
KFileMetaInfoGroup | appendGroup (KFileMetaInfo &info, const QString &key)
void | appendItem (KFileMetaInfoGroup &group, const QString &key, QVariant value)
KFileMimeTypeInfo * | addMimeTypeInfo (const QString &mimeType)
virtual void | virtual_hook (int id, void *data)
## Protected Attributes
QStringList | m_preferredKeys
QStringList | m_preferredGroups

## Detailed Description

Baseclass for a meta info plugin.

If you want to write your own plugin, you need to derive from this class.

In your plugin, you need to create a factory for the KFilePlugin

Example:

     typedef KGenericFactory<MyPlugin> MyFactory;
     K_EXPORT_COMPONENT_FACTORY(kfile_foo, MyFactory("kfile_foo"));

and then just overwrite the methods your plugin supports. If your plugin can only read data, it is sufficient to only write a readInfo() method. If you also want to support changing data and writing it back into the file, you usually need all methods.

Definition at line 1202 of file kfilemetainfo.h.

## Constructor & Destructor Documentation

KFilePlugin::KFilePlugin | ( | QObject * | parent,
|  | const char * | name,
|  | const QStringList & | args
| ) |

  | Creates a new KFilePlugin instance. Parameters:
  | parent | the parent of the QObject, can be 0
  | name | the name of the QObject, can be 0
  | args | currently ignored
Definition at line 765 of file kfilemetainfo.cpp.

## Member Function Documentation

virtual bool KFilePlugin::readInfo | ( | KFileMetaInfo & | info,
|  | uint | what = `KFileMetaInfo::Fastest`
| ) | `[pure virtual]`

  | Read the info from the file in this method and insert it into the provided KFileMetaInfo object. You can get the path to the file with info.path() Parameters:
  | info | the information will be written here
  | what | defines what to read, see KFileMetaInfo::What
Returns: true if successful, false if it failed

virtual bool KFilePlugin::writeInfo | ( | const KFileMetaInfo & | info | ) | const`[inline, virtual]`

  | Similar to the above method, but for writing the info back to the file. If you don't have any writable keys, don't implement this method Parameters:
  | info | the information that will be written
Returns: true if successful, false if it failed Definition at line 1235 of file kfilemetainfo.h. Referenced by KFileMetaInfo::applyChanges().

virtual QValidator* KFilePlugin::createValidator | ( | const QString & | mimeType,
|  | const QString & | group,
|  | const QString & | key,
|  | QObject * | parent,
|  | const char * | name
| ) | const`[inline, virtual]`

  | This method should create an appropriate validator for the specified item if it's editable or return a null pointer if not. If you don't have any editable items, you don't need this method. If you you don't need any validation, e.g. you accept any input, you can simply return 0L, or not reimplement this method at all. Parameters:
  | mimeType | the mime type
  | group | the group name of the validator item
  | key | the key name of the validator item
  | parent | the QObject parent, can be 0
  | name | the name of the QObject, can be 0
Definition at line 1254 of file kfilemetainfo.h. Referenced by KFileMimeTypeInfo::createValidator().

KFileMimeTypeInfo * KFilePlugin::addMimeTypeInfo | ( | const QString & | mimeType | ) | `[protected]`

| Call this in your constructor. Definition at line 777 of file kfilemetainfo.cpp.

The documentation for this class was generated from the following files:

- kfilemetainfo.h
- kfilemetainfo.cpp

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:44 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003