org.kde.koala

Class KMimeType

public class KMimeType extends KServiceType

Represent a mime type, like "text/plain", and the data that is associated with it. The starting point you need is often the static methods. KMimeType inherits KServiceType because "text/plain" can be used to find services (apps and components) "which can open text/plain".

See Also: KServiceType

UNKNOWN: Represent a mime type, like "text/plain", and the data that is associated with it.

Constructor Summary
protected KMimeType(Class dummy)
KMimeType(String _fullpath, String _type, String _icon, String _comment, String[] _patterns)
Constructor.
KMimeType(String _fullpath)
Construct a mimetype and take all information from a config file.
KMimeType(KDesktopFile config)
Construct a mimetype and take all information from a desktop file.
KMimeType(QDataStream _str, int offset)
The stream must already be positionned at the correct offset
Method Summary
protected static voidbuildDefaultType()
This function makes sure that the default mime type exists.
protected static voidcheckEssentialMimeTypes()
This function makes sure that vital mime types are installed.
Stringcomment()
Returns the descriptive comment associated with the MIME type.
Stringcomment(String arg1, boolean arg2)
Returns the descriptive comment associated with the MIME type.
Stringcomment(KURL arg1, boolean arg2)
Returns the descriptive comment associated with the MIME type.
static StringdefaultMimeType()
Returns the name of the default mimetype.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected static voiderrorMissingMimeType(String _type)
Signal a missing mime type.
static StringfavIconForURL(KURL url)
Return the "favicon" (see http://www.favicon.com) for the given url, if available.
protected voidfinalize()
Deletes the wrapped C++ instance
Stringicon(String arg1, boolean arg2)
Return the filename of the icon associated with the mimetype.
Stringicon(KURL arg1, boolean arg2)
Return the filename of the icon associated with the mimetype.
static StringiconForURL(KURL _url, long _mode)
The same functionality as pixmapForURL(), but this method returns the name of the icon to load.
static StringiconForURL(KURL _url)
protected voidinit(KDesktopFile arg1)
booleanis(String mimeTypeName)
Do not use name()=="somename" anymore, to check for a given mimetype.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
voidload(QDataStream qs)
Load the mimetype from a stream.
protected voidloadInternal(QDataStream arg1)
Determines the mimetype of file based on it's name and returns the matching pattern if any.
StringparentMimeType()
If this mimetype inherits from ("is also") another mimetype, return the name of the parent.
ArrayListpatterns()
Retrieve the list of patterns associated with the MIME Type.
protected intpatternsAccuracy()
QPixmappixmap(int group, int force_size, int state, StringBuffer path)
Use this function only if you don't have a special URL for which you search a pixmap.
QPixmappixmap(int group, int force_size, int state)
QPixmappixmap(int group, int force_size)
QPixmappixmap(int group)
QPixmappixmap(KURL _url, int _group, int _force_size, int _state, StringBuffer _path)
Find the pixmap for a given file of this mimetype.
QPixmappixmap(KURL _url, int _group, int _force_size, int _state)
QPixmappixmap(KURL _url, int _group, int _force_size)
QPixmappixmap(KURL _url, int _group)
static QPixmappixmapForURL(KURL _url, long _mode, int _group, int _force_size, int _state, StringBuffer _path)
Convenience method to find the pixmap for a URL.
static QPixmappixmapForURL(KURL _url, long _mode, int _group, int _force_size, int _state)
static QPixmappixmapForURL(KURL _url, long _mode, int _group, int _force_size)
static QPixmappixmapForURL(KURL _url, long _mode, int _group)
static QPixmappixmapForURL(KURL _url, long _mode)
static QPixmappixmapForURL(KURL _url)
QVariantproperty(String _name)
Returns the property with the given _name.
ArrayListpropertyNames()
Retrieves a list of all properties associated with this KMimeType.
voidsave(QDataStream qs)
Save the mimetype to a stream.

Constructor Detail

KMimeType

protected KMimeType(Class dummy)

KMimeType

public KMimeType(String _fullpath, String _type, String _icon, String _comment, String[] _patterns)
Constructor. You may pass in arguments to create a mimetype with specific properties.

Parameters: _fullpath the path to the configuration file (.desktop) _type the mime type itself _icon the name of the icon that represens the mime type _comment a comment describing the mime type _patterns a list of file globs that describes the names (or extensions) of the files with this mime type

UNKNOWN: Constructor.

KMimeType

public KMimeType(String _fullpath)
Construct a mimetype and take all information from a config file.

Parameters: _fullpath the path to the configuration file (.desktop)

UNKNOWN: Construct a mimetype and take all information from a config file.

KMimeType

public KMimeType(KDesktopFile config)
Construct a mimetype and take all information from a desktop file.

Parameters: config the desktop configuration file that describes the mime type

UNKNOWN: Construct a mimetype and take all information from a desktop file.

KMimeType

public KMimeType(QDataStream _str, int offset)
The stream must already be positionned at the correct offset

UNKNOWN:

Method Detail

buildDefaultType

protected static void buildDefaultType()
This function makes sure that the default mime type exists.

UNKNOWN: This function makes sure that the default mime type exists.

checkEssentialMimeTypes

protected static void checkEssentialMimeTypes()
This function makes sure that vital mime types are installed.

UNKNOWN: This function makes sure that vital mime types are installed.

comment

public String comment()
Returns the descriptive comment associated with the MIME type.

Returns: the descriptive comment associated with the MIME type

UNKNOWN: Returns the descriptive comment associated with the MIME type.

comment

public String comment(String arg1, boolean arg2)
Returns the descriptive comment associated with the MIME type. The arguments are unused, but provided so that KMimeType derived classes can use them.

Returns: The descriptive comment associated with the MIME type, if any.

UNKNOWN: Returns the descriptive comment associated with the MIME type.

comment

public String comment(KURL arg1, boolean arg2)
Returns the descriptive comment associated with the MIME type. The arguments are unused, but provided so that KMimeType derived classes can use them.

Returns: The descriptive comment associated with the MIME type, if any.

UNKNOWN: Returns the descriptive comment associated with the MIME type.

defaultMimeType

public static String defaultMimeType()
Returns the name of the default mimetype. Always application/octet-stream, but this method exists for performance purposes.

Returns: the name of the default mime type, always "application/octet-stream"

UNKNOWN: Returns the name of the default mimetype.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

errorMissingMimeType

protected static void errorMissingMimeType(String _type)
Signal a missing mime type.

Parameters: _type the missinf mime type

UNKNOWN: Signal a missing mime type.

favIconForURL

public static String favIconForURL(KURL url)
Return the "favicon" (see http://www.favicon.com) for the given url, if available. Does NOT attempt to download the favicon, it only returns one that is already available. If unavailable, returns null.

Parameters: url the URL of the favicon

Returns: the name of the favicon, or null

UNKNOWN: Return the "favicon" (see http://www.

finalize

protected void finalize()
Deletes the wrapped C++ instance

icon

public String icon(String arg1, boolean arg2)
Return the filename of the icon associated with the mimetype. The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. KFolderType uses the URL to return one out of 2 icons)

Returns: The path to the icon associated with this MIME type.

UNKNOWN: Return the filename of the icon associated with the mimetype.

icon

public String icon(KURL arg1, boolean arg2)
Return the filename of the icon associated with the mimetype. The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. KFolderType uses the URL to return one out of 2 icons)

Returns: The path to the icon associated with this MIME type.

UNKNOWN: Return the filename of the icon associated with the mimetype.

iconForURL

public static String iconForURL(KURL _url, long _mode)
The same functionality as pixmapForURL(), but this method returns the name of the icon to load. You'll have to use KIconLoader to load the pixmap for it. The advantage of this method is that you can store the result, and then use it later on for any kind of size.

Parameters: _url URL for the file _mode the mode of the file. The mode may modify the icon with overlays that show special properties of the icon. Use 0 for default

Returns: the name of the icon. The name of a default icon if there is no icon for the mime type

UNKNOWN: The same functionality as pixmapForURL(), but this method returns the name of the icon to load.

iconForURL

public static String iconForURL(KURL _url)

init

protected void init(KDesktopFile arg1)

is

public boolean is(String mimeTypeName)
Do not use name()=="somename" anymore, to check for a given mimetype. For mimetype inheritance to work, use is("somename") instead. Warning, do not use inherits(), that's the servicetype inheritance concept!

UNKNOWN: Do not use name()=="somename" anymore, to check for a given mimetype.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

load

public void load(QDataStream qs)
Load the mimetype from a stream.

Parameters: qs the stream to load from

UNKNOWN: Load the mimetype from a stream.

loadInternal

protected void loadInternal(QDataStream arg1)
Determines the mimetype of file based on it's name and returns the matching pattern if any.

UNKNOWN:

parentMimeType

public String parentMimeType()
If this mimetype inherits from ("is also") another mimetype, return the name of the parent. For instance a text/x-log is a special kind of text/plain, so the definition of text/x-log can say "X-KDE-IsAlso=text/plain". Or an smb-workgroup is a special kind of inode/directory, etc. This mechanism can also be used to rename mimetypes and preserve compat. Note that this notion doesn't map to the servicetype inheritance mechanism, since an application that handles the specific type doesn't necessarily handle the base type. The opposite is true though.

Returns: the parent mime type, or null if not set

UNKNOWN: If this mimetype inherits from ("is also") another mimetype, return the name of the parent.

patterns

public ArrayList patterns()
Retrieve the list of patterns associated with the MIME Type.

Returns: a list of file globs that describe the file names (or, usually, the extensions) of files with this mime type

UNKNOWN: Retrieve the list of patterns associated with the MIME Type.

patternsAccuracy

protected int patternsAccuracy()

pixmap

public QPixmap pixmap(int group, int force_size, int state, StringBuffer path)
Use this function only if you don't have a special URL for which you search a pixmap. This function is useful to find out, which icon is usually chosen for a certain mime type. Since no URL is passed, it is impossible to obey icon hints in desktop entries for example.

Parameters: group The icon group where the icon is going to be used. force_size Override globallly configured icon size. Use 0 for the default size state The icon state, one of: KIcon.DefaultState, KIcon.ActiveState or KIcon.DisabledState. path Output parameter to get the full path. Seldom needed. Ignored if 0

Returns: the pixmap of the mime type, can be a default icon if not found

UNKNOWN: Use this function only if you don't have a special URL for which you search a pixmap.

pixmap

public QPixmap pixmap(int group, int force_size, int state)

pixmap

public QPixmap pixmap(int group, int force_size)

pixmap

public QPixmap pixmap(int group)

pixmap

public QPixmap pixmap(KURL _url, int _group, int _force_size, int _state, StringBuffer _path)
Find the pixmap for a given file of this mimetype. Convenience method that uses icon(), but also locates and load the pixmap.

Parameters: _url URL for the file. _group The icon group where the icon is going to be used. _force_size Override globallly configured icon size. Use 0 for the default size _state The icon state, one of: KIcon.DefaultState, KIcon.ActiveState or KIcon.DisabledState. _path Output parameter to get the full path. Seldom needed. Ignored if 0

Returns: the pixmap of the URL, can be a default icon if not found

UNKNOWN: Find the pixmap for a given file of this mimetype.

pixmap

public QPixmap pixmap(KURL _url, int _group, int _force_size, int _state)

pixmap

public QPixmap pixmap(KURL _url, int _group, int _force_size)

pixmap

public QPixmap pixmap(KURL _url, int _group)

pixmapForURL

public static QPixmap pixmapForURL(KURL _url, long _mode, int _group, int _force_size, int _state, StringBuffer _path)
Convenience method to find the pixmap for a URL. Call this one when you don't know the mimetype.

Parameters: _url URL for the file. _mode the mode of the file. The mode may modify the icon with overlays that show special properties of the icon. Use 0 for default _group The icon group where the icon is going to be used. _force_size Override globally configured icon size. Use 0 for the default size _state The icon state, one of: KIcon.DefaultState, KIcon.ActiveState or KIcon.DisabledState. _path Output parameter to get the full path. Seldom needed. Ignored if 0

Returns: the pixmap of the URL, can be a default icon if not found

UNKNOWN: Convenience method to find the pixmap for a URL.

pixmapForURL

public static QPixmap pixmapForURL(KURL _url, long _mode, int _group, int _force_size, int _state)

pixmapForURL

public static QPixmap pixmapForURL(KURL _url, long _mode, int _group, int _force_size)

pixmapForURL

public static QPixmap pixmapForURL(KURL _url, long _mode, int _group)

pixmapForURL

public static QPixmap pixmapForURL(KURL _url, long _mode)

pixmapForURL

public static QPixmap pixmapForURL(KURL _url)

property

public QVariant property(String _name)
Returns the property with the given _name.

Parameters: _name the name of the property

Returns: the value of the property

See Also: KMimeType

UNKNOWN: Returns the property with the given _name.

propertyNames

public ArrayList propertyNames()
Retrieves a list of all properties associated with this KMimeType.

Returns: a list of all property names

See Also: KMimeType

UNKNOWN: Retrieves a list of all properties associated with this KMimeType.

save

public void save(QDataStream qs)
Save the mimetype to a stream.

Parameters: qs the stream to save to

UNKNOWN: Save the mimetype to a stream.