.TH "KMimeType" kde3 "11 Jun 2005" "Version Version 3.4.1" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMimeType \- Represent a mime type, like 'text/plain', and the data that is associated with it.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kmimetype.h>\fP
.PP
Inherits \fBKServiceType\fP.
.PP
Inherited by \fBKDEDesktopMimeType\fP, \fBKExecMimeType\fP, and \fBKFolderType\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "typedef \fBKSharedPtr\fP< \fBKMimeType\fP > \fBPtr\fP"
.br
.ti -1c
.RI "typedef \fBQValueList\fP< \fBPtr\fP > \fBList\fP"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMimeType\fP (const \fBQString\fP &_fullpath, const \fBQString\fP &_type, const \fBQString\fP &_icon, const \fBQString\fP &_comment, const \fBQStringList\fP &_patterns)"
.br
.ti -1c
.RI "\fBKMimeType\fP (const \fBQString\fP &_fullpath)"
.br
.ti -1c
.RI "\fBKMimeType\fP (\fBKDesktopFile\fP *config)"
.br
.ti -1c
.RI "\fBKMimeType\fP (\fBQDataStream\fP &_str, int \fBoffset\fP)"
.br
.ti -1c
.RI "virtual \fBQString\fP \fBicon\fP (const \fBQString\fP &, bool) const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBicon\fP (const \fBKURL\fP &, bool) const "
.br
.ti -1c
.RI "virtual \fBQPixmap\fP \fBpixmap\fP (\fBKIcon::Group\fP group, int force_size=0, int state=0, \fBQString\fP *path=0L) const "
.br
.ti -1c
.RI "virtual \fBQPixmap\fP \fBpixmap\fP (const \fBKURL\fP &_url, \fBKIcon::Group\fP _group, int _force_size=0, int _state=0, \fBQString\fP *_path=0L) const "
.br
.ti -1c
.RI "\fBQString\fP \fBcomment\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBcomment\fP (const \fBQString\fP &, bool) const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBcomment\fP (const \fBKURL\fP &, bool) const "
.br
.ti -1c
.RI "const \fBQStringList\fP & \fBpatterns\fP () const "
.br
.ti -1c
.RI "virtual void \fBload\fP (\fBQDataStream\fP &qs)"
.br
.ti -1c
.RI "virtual void \fBsave\fP (\fBQDataStream\fP &qs)"
.br
.ti -1c
.RI "virtual \fBQVariant\fP \fBproperty\fP (const \fBQString\fP &_name) const "
.br
.ti -1c
.RI "virtual \fBQStringList\fP \fBpropertyNames\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBparentMimeType\fP () const "
.br
.ti -1c
.RI "bool \fBis\fP (const \fBQString\fP &mimeTypeName) const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBQPixmap\fP \fBpixmapForURL\fP (const \fBKURL\fP &_url, mode_t _mode=0, \fBKIcon::Group\fP _group=\fBKIcon::Desktop\fP, int _force_size=0, int _state=0, \fBQString\fP *_path=0L)"
.br
.ti -1c
.RI "static \fBQString\fP \fBiconForURL\fP (const \fBKURL\fP &_url, mode_t _mode=0)"
.br
.ti -1c
.RI "static \fBQString\fP \fBfavIconForURL\fP (const \fBKURL\fP &url)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBmimeType\fP (const \fBQString\fP &_name)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBfindByURL\fP (const \fBKURL\fP &_url, mode_t _mode=0, bool _is_local_file=false, bool _fast_mode=false)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBfindByURL\fP (const \fBKURL\fP &_url, mode_t _mode, bool _is_local_file, bool _fast_mode, bool *accurate)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBfindByPath\fP (const \fBQString\fP &path, mode_t mode=0, bool fast_mode=false)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBfindByContent\fP (const \fBQByteArray\fP &data, int *accuracy=0)"
.br
.ti -1c
.RI "static \fBPtr\fP \fBfindByFileContent\fP (const \fBQString\fP &fileName, int *accuracy=0)"
.br
.ti -1c
.RI "static Format \fBfindFormatByFileContent\fP (const \fBQString\fP &fileName)"
.br
.ti -1c
.RI "static \fBList\fP \fBallMimeTypes\fP ()"
.br
.ti -1c
.RI "static const \fBQString\fP & \fBdefaultMimeType\fP ()"
.br
.ti -1c
.RI "static \fBKMimeType::Ptr\fP \fBdefaultMimeTypePtr\fP ()"
.br
.ti -1c
.RI "static \fBKMimeType::Ptr\fP \fBdiagnoseFileName\fP (const \fBQString\fP &file, \fBQString\fP &pattern)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "void \fBloadInternal\fP (\fBQDataStream\fP &)"
.br
.ti -1c
.RI "void \fBinit\fP (\fBKDesktopFile\fP *)"
.br
.ti -1c
.RI "int \fBpatternsAccuracy\fP () const "
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Static Protected Member Functions"

.in +1c
.ti -1c
.RI "static void \fBerrorMissingMimeType\fP (const \fBQString\fP &_type)"
.br
.ti -1c
.RI "static void \fBbuildDefaultType\fP ()"
.br
.ti -1c
.RI "static void \fBcheckEssentialMimeTypes\fP ()"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "\fBQStringList\fP \fBm_lstPatterns\fP"
.br
.in -1c
.SS "Static Protected Attributes"

.in +1c
.ti -1c
.RI "static bool \fBs_bChecked\fP = false"
.br
.ti -1c
.RI "static \fBPtr\fP \fBs_pDefaultType\fP = 0L"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKServiceTypeFactory\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
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.
.PP
KMimeType inherits \fBKServiceType\fP because 'text/plain' can be used to find services (apps and components) 'which can open text/plain'.
.PP
\fBSee also:\fP
.RS 4
\fBKServiceType\fP 
.RE
.PP

.PP
Definition at line 47 of file kmimetype.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KMimeType::KMimeType (const \fBQString\fP & _fullpath, const \fBQString\fP & _type, const \fBQString\fP & _icon, const \fBQString\fP & _comment, const \fBQStringList\fP & _patterns)"
.PP
Constructor. 
.PP
You may pass in arguments to create a mimetype with specific properties.
.PP
\fBParameters:\fP
.RS 4
\fI_fullpath\fP the path to the configuration file (.desktop) 
.br
\fI_type\fP the mime type itself 
.br
\fI_icon\fP the name of the icon that represens the mime type 
.br
\fI_comment\fP a comment describing the mime type 
.br
\fI_patterns\fP a list of file globs that describes the names (or extensions) of the files with this mime type 
.RE
.PP

.PP
Definition at line 361 of file kmimetype.cpp.
.PP
Referenced by buildDefaultType().
.SS "KMimeType::KMimeType (const \fBQString\fP & _fullpath)"
.PP
Construct a mimetype and take all information from a config file. 
.PP
\fBParameters:\fP
.RS 4
\fI_fullpath\fP the path to the configuration file (.desktop) 
.RE
.PP

.PP
Definition at line 368 of file kmimetype.cpp.
.PP
References endl(), KServiceType::isValid(), and kdWarning().
.SS "KMimeType::KMimeType (\fBKDesktopFile\fP * config)"
.PP
Construct a mimetype and take all information from a desktop file. 
.PP
\fBParameters:\fP
.RS 4
\fIconfig\fP the desktop configuration file that describes the mime type 
.RE
.PP

.PP
Definition at line 377 of file kmimetype.cpp.
.PP
References endl(), KServiceType::isValid(), and kdWarning().
.SH "Member Function Documentation"
.PP 
.SS "virtual \fBQString\fP KMimeType::icon (const \fBQString\fP &, bool) const\fC [inline, virtual]\fP"
.PP
Return the filename of the icon associated with the mimetype. 
.PP
The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. \fBKFolderType\fP uses the URL to return one out of 2 icons)
.PP
\fBReturns:\fP
.RS 4
The path to the icon associated with this MIME type. 
.RE
.PP

.PP
Reimplemented in \fBKFolderType\fP, and \fBKDEDesktopMimeType\fP.
.PP
Definition at line 100 of file kmimetype.h.
.SS "virtual \fBQString\fP KMimeType::icon (const \fBKURL\fP &, bool) const\fC [inline, virtual]\fP"
.PP
Return the filename of the icon associated with the mimetype. 
.PP
The arguments are unused, but provided so that KMimeType-derived classes can use them (e.g. \fBKFolderType\fP uses the URL to return one out of 2 icons)
.PP
\fBReturns:\fP
.RS 4
The path to the icon associated with this MIME type. 
.RE
.PP

.PP
Reimplemented in \fBKFolderType\fP, and \fBKDEDesktopMimeType\fP.
.PP
Definition at line 110 of file kmimetype.h.
.SS "\fBQPixmap\fP KMimeType::pixmap (\fBKIcon::Group\fP group, int force_size = \fC0\fP, int state = \fC0\fP, \fBQString\fP * path = \fC0L\fP) const\fC [virtual]\fP"
.PP
Use this function only if you don't have a special URL for which you search a pixmap. 
.PP
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. 
.PP
\fBParameters:\fP
.RS 4
\fIgroup\fP The icon group where the icon is going to be used. 
.br
\fIforce_size\fP Override globallly configured icon size. Use 0 for the default size 
.br
\fIstate\fP The icon state, one of: \fC\fBKIcon::DefaultState\fP\fP, \fC\fBKIcon::ActiveState\fP\fP or \fC\fBKIcon::DisabledState\fP\fP. 
.br
\fIpath\fP Output parameter to get the full path. Seldom needed. Ignored if 0 
.RE
.PP
\fBReturns:\fP
.RS 4
the pixmap of the mime type, can be a default icon if not found 
.RE
.PP

.PP
Reimplemented in \fBKDEDesktopMimeType\fP.
.PP
Definition at line 454 of file kmimetype.cpp.
.PP
References KIconLoader::addExtraDesktopThemes(), KIconLoader::extraDesktopThemesAdded(), KServiceType::icon(), KGlobal::iconLoader(), QPixmap::isNull(), KIconLoader::loadIcon(), and pixmap().
.PP
Referenced by KDEDesktopMimeType::pixmap(), pixmap(), and pixmapForURL().
.SS "\fBQPixmap\fP KMimeType::pixmap (const \fBKURL\fP & _url, \fBKIcon::Group\fP _group, int _force_size = \fC0\fP, int _state = \fC0\fP, \fBQString\fP * _path = \fC0L\fP) const\fC [virtual]\fP"
.PP
Find the pixmap for a given file of this mimetype. 
.PP
Convenience method that uses \fBicon()\fP, but also locates and load the pixmap.
.PP
\fBParameters:\fP
.RS 4
\fI_url\fP URL for the file. 
.br
\fI_group\fP The icon group where the icon is going to be used. 
.br
\fI_force_size\fP Override globallly configured icon size. Use 0 for the default size 
.br
\fI_state\fP The icon state, one of: \fBKIcon::DefaultState\fP, \fBKIcon::ActiveState\fP or \fBKIcon::DisabledState\fP. 
.br
\fI_path\fP Output parameter to get the full path. Seldom needed. Ignored if 0 
.RE
.PP
\fBReturns:\fP
.RS 4
the pixmap of the URL, can be a default icon if not found 
.RE
.PP

.PP
Reimplemented in \fBKDEDesktopMimeType\fP.
.PP
Definition at line 470 of file kmimetype.cpp.
.PP
References KIconLoader::addExtraDesktopThemes(), KIconLoader::extraDesktopThemesAdded(), KServiceType::icon(), KGlobal::iconLoader(), QPixmap::isNull(), KIconLoader::loadIcon(), and pixmap().
.SS "\fBQPixmap\fP KMimeType::pixmapForURL (const \fBKURL\fP & _url, mode_t _mode = \fC0\fP, \fBKIcon::Group\fP _group = \fC\fBKIcon::Desktop\fP\fP, int _force_size = \fC0\fP, int _state = \fC0\fP, \fBQString\fP * _path = \fC0L\fP)\fC [static]\fP"
.PP
Convenience method to find the pixmap for a URL. 
.PP
Call this one when you don't know the mimetype.
.PP
\fBParameters:\fP
.RS 4
\fI_url\fP URL for the file. 
.br
\fI_mode\fP the mode of the file. The mode may modify the icon with overlays that show special properties of the icon. Use 0 for default 
.br
\fI_group\fP The icon group where the icon is going to be used. 
.br
\fI_force_size\fP Override globally configured icon size. Use 0 for the default size 
.br
\fI_state\fP The icon state, one of: \fBKIcon::DefaultState\fP, \fBKIcon::ActiveState\fP or \fBKIcon::DisabledState\fP. 
.br
\fI_path\fP Output parameter to get the full path. Seldom needed. Ignored if 0 
.RE
.PP
\fBReturns:\fP
.RS 4
the pixmap of the URL, can be a default icon if not found 
.RE
.PP

.PP
Definition at line 486 of file kmimetype.cpp.
.PP
References KIconLoader::addExtraDesktopThemes(), KIconLoader::extraDesktopThemesAdded(), iconForURL(), KGlobal::iconLoader(), QPixmap::isNull(), KIconLoader::loadIcon(), and pixmap().
.PP
Referenced by KURLComboBox::getPixmap(), KURLPixmapProvider::pixmapFor(), and KURLBarItem::setIcon().
.SS "\fBQString\fP KMimeType::iconForURL (const \fBKURL\fP & _url, mode_t _mode = \fC0\fP)\fC [static]\fP"
.PP
The same functionality as \fBpixmapForURL()\fP, but this method returns the name of the icon to load. 
.PP
You'll have to use \fBKIconLoader\fP 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. 
.PP
\fBParameters:\fP
.RS 4
\fI_url\fP URL for the file 
.br
\fI_mode\fP the mode of the file. The mode may modify the icon with overlays that show special properties of the icon. Use 0 for default 
.RE
.PP
\fBReturns:\fP
.RS 4
the name of the icon. The name of a default icon if there is no icon for the mime type 
.RE
.PP

.PP
Definition at line 504 of file kmimetype.cpp.
.PP
References defaultMimeTypePtr(), favIconForURL(), findByURL(), KProtocolInfo::icon(), QString::isEmpty(), and KGlobal::staticQString().
.PP
Referenced by KBookmarkGroup::addBookmark(), KURIFilterData::iconName(), KFilePropsPlugin::KFilePropsPlugin(), KURLBarItemDialog::KURLBarItemDialog(), and pixmapForURL().
.SS "\fBQString\fP KMimeType::favIconForURL (const \fBKURL\fP & url)\fC [static]\fP"
.PP
Return the 'favicon' (see http://www.favicon.com) for the given \fCurl\fP, if available. 
.PP
Does NOT attempt to download the favicon, it only returns one that is already available.
.PP
If unavailable, returns QString::null. 
.PP
\fBParameters:\fP
.RS 4
\fIurl\fP the URL of the favicon 
.RE
.PP
\fBReturns:\fP
.RS 4
the name of the favicon, or QString::null 
.RE
.PP

.PP
Definition at line 529 of file kmimetype.cpp.
.PP
References DCOPRef::call(), KGlobal::config(), DCOPReply::isValid(), and KConfigBase::readBoolEntry().
.PP
Referenced by iconForURL().
.SS "\fBQString\fP KMimeType::comment () const\fC [inline]\fP"
.PP
Returns the descriptive comment associated with the MIME type. 
.PP
\fBReturns:\fP
.RS 4
the descriptive comment associated with the MIME type 
.RE
.PP

.PP
Reimplemented from \fBKServiceType\fP.
.PP
Definition at line 202 of file kmimetype.h.
.PP
Referenced by KDEDesktopMimeType::comment(), and KFolderType::comment().
.SS "virtual \fBQString\fP KMimeType::comment (const \fBQString\fP &, bool) const\fC [inline, virtual]\fP"
.PP
Returns the descriptive comment associated with the MIME type. 
.PP
The arguments are unused, but provided so that KMimeType derived classes can use them.
.PP
\fBReturns:\fP
.RS 4
The descriptive comment associated with the MIME type, if any. 
.RE
.PP

.PP
Reimplemented in \fBKFolderType\fP, and \fBKDEDesktopMimeType\fP.
.PP
Definition at line 211 of file kmimetype.h.
.SS "virtual \fBQString\fP KMimeType::comment (const \fBKURL\fP &, bool) const\fC [inline, virtual]\fP"
.PP
Returns the descriptive comment associated with the MIME type. 
.PP
The arguments are unused, but provided so that KMimeType derived classes can use them.
.PP
\fBReturns:\fP
.RS 4
The descriptive comment associated with the MIME type, if any. 
.RE
.PP

.PP
Reimplemented in \fBKFolderType\fP, and \fBKDEDesktopMimeType\fP.
.PP
Definition at line 220 of file kmimetype.h.
.SS "const \fBQStringList\fP& KMimeType::patterns () const\fC [inline]\fP"
.PP
Retrieve the list of patterns associated with the MIME Type. 
.PP
\fBReturns:\fP
.RS 4
a list of file globs that describe the file names (or, usually, the extensions) of files with this mime type 
.RE
.PP

.PP
Definition at line 227 of file kmimetype.h.
.SS "void KMimeType::load (\fBQDataStream\fP & qs)\fC [virtual]\fP"
.PP
Load the mimetype from a stream. 
.PP
\fBParameters:\fP
.RS 4
\fIqs\fP the stream to load from 
.RE
.PP

.PP
Reimplemented from \fBKServiceType\fP.
.PP
Definition at line 414 of file kmimetype.cpp.
.PP
References KSycocaEntry::load().
.SS "void KMimeType::save (\fBQDataStream\fP & qs)\fC [virtual]\fP"
.PP
Save the mimetype to a stream. 
.PP
\fBParameters:\fP
.RS 4
\fIqs\fP the stream to save to 
.RE
.PP

.PP
Reimplemented from \fBKServiceType\fP.
.PP
Definition at line 426 of file kmimetype.cpp.
.PP
References KSycocaEntry::save().
.SS "\fBQVariant\fP KMimeType::property (const \fBQString\fP & _name) const\fC [virtual]\fP"
.PP
Returns the property with the given \fC_name\fP. 
.PP
\fBParameters:\fP
.RS 4
\fI_name\fP the name of the property 
.RE
.PP
\fBReturns:\fP
.RS 4
the value of the property 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBpropertyNames()\fP 
.RE
.PP

.PP
Reimplemented from \fBKServiceType\fP.
.PP
Definition at line 434 of file kmimetype.cpp.
.PP
References KServiceType::property().
.PP
Referenced by parentMimeType().
.SS "\fBQStringList\fP KMimeType::propertyNames () const\fC [virtual]\fP"
.PP
Retrieves a list of all properties associated with this KMimeType. 
.PP
\fBReturns:\fP
.RS 4
a list of all property names 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBproperty()\fP 
.RE
.PP

.PP
Reimplemented from \fBKServiceType\fP.
.PP
Definition at line 442 of file kmimetype.cpp.
.PP
References KServiceType::propertyNames().
.SS "\fBKMimeType::Ptr\fP KMimeType::mimeType (const \fBQString\fP & _name)\fC [static]\fP"
.PP
Retrieve a pointer to the mime type \fC_name\fP or a pointer to the default mime type 'application/octet-stream'. 
.PP
0L is \fInever\fP returned.
.PP
\fIVery\fP \fIimportant:\fP Don't store the result in a KMimeType* !
.PP
\fBParameters:\fP
.RS 4
\fI_name\fP the name of the mime type 
.RE
.PP
\fBReturns:\fP
.RS 4
the pointer to the KMimeType with the given \fC_name\fP, or a pointer to the application/octet-stream KMimeType if not found 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKServiceType::serviceType\fP 
.RE
.PP

.PP
Definition at line 141 of file kmimetype.cpp.
.PP
References buildDefaultType(), and KSycocaEntry::isType().
.PP
Referenced by KFileTreeView::addBranch(), checkEssentialMimeTypes(), KFileDialog::currentFilterMimeType(), KDirLister::doMimeFilter(), findByContent(), findByFileContent(), findByURL(), KService::hasServiceType(), KService::initialPreferenceForMimeType(), is(), KRun::isExecutableFile(), KDesktopPropsPlugin::KDesktopPropsPlugin(), KFileItem::KFileItem(), KMimeTypeChooser::patterns(), KFileItem::pixmap(), KFileItem::readUDSEntry(), and KFileDialog::updateAutoSelectExtension().
.SS "\fBKMimeType::Ptr\fP KMimeType::findByURL (const \fBKURL\fP & _url, mode_t _mode = \fC0\fP, bool _is_local_file = \fCfalse\fP, bool _fast_mode = \fCfalse\fP)\fC [static]\fP"
.PP
Finds a KMimeType with the given \fC_url\fP. 
.PP
This function looks at mode_t first. If that does not help it looks at the extension. This is fine for FTP, FILE, TAR and friends, but is not for HTTP ( cgi scripts! ). You should use \fBKRun\fP instead, but this function returns immediately while \fBKRun\fP is async. If no extension matches, then the file will be examined if the URL a local file or 'application/octet-stream' is returned otherwise.
.PP
\fBParameters:\fP
.RS 4
\fI_url\fP Is the right most URL with a filesystem protocol. It is up to you to find out about that if you have a nested URL. For example 'http://localhost/mist.gz#gzip:/decompress' would have to pass the 'http://...' URL part, while 'file:/tmp/x.tar#tar:/src/test.gz#gzip:/decompress' would have to pass the 'tar:/...' part of the URL, since gzip is a filter protocol and not a filesystem protocol. 
.br
\fI_mode\fP the mode of the file (used, for example, to identify executables) 
.br
\fI_is_local_file\fP true if the file is local 
.br
\fI_fast_mode\fP If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is \fIfast\fP. 
.RE
.PP
\fBReturns:\fP
.RS 4
A pointer to the matching mimetype. 0L is never returned. \fIVery\fP \fIImportant:\fP Don't store the result in a KMimeType* ! 
.RE
.PP

.PP
Definition at line 165 of file kmimetype.cpp.
.PP
References checkEssentialMimeTypes(), defaultMimeType(), KProtocolInfo::defaultMimetype(), defaultMimeTypePtr(), KProtocolInfo::determineMimetypeFromExtension(), QString::endsWith(), KMimeMagic::findFileType(), QString::isEmpty(), KMimeMagicResult::isValid(), KMimeMagicResult::mimeType(), mimeType(), KMimeMagic::self(), and KGlobal::staticQString().
.PP
Referenced by KFileItem::determineMimeType(), findByPath(), iconForURL(), KFileItem::init(), KFilePropsPlugin::KFilePropsPlugin(), KImageIO::mimeType(), KFileItem::pixmap(), KIO::ForwardingSlaveBase::prepareUDSEntry(), KOpenWithDlg::setServiceType(), and KIO::ListJob::slotFinished().
.SS "\fBKMimeType::Ptr\fP KMimeType::findByPath (const \fBQString\fP & path, mode_t mode = \fC0\fP, bool fast_mode = \fCfalse\fP)\fC [static]\fP"
.PP
Finds a KMimeType with the given \fC_url\fP. 
.PP
This function looks at mode_t first. If that does not help it looks at the extension. This is fine for FTP, FILE, TAR and friends, but is not for HTTP ( cgi scripts! ). You should use \fBKRun\fP instead, but this function returns immediately while \fBKRun\fP is async. If no extension matches, then the file will be examined if the URL a local file or 'application/octet-stream' is returned otherwise.
.PP
Equivalent to 
.PP
.nf
 KURL u;
 u.setPath(path);
 return findByURL( u, mode, true, fast_mode );

.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIpath\fP the path to the file 
.br
\fImode\fP the mode of the file (used, for example, to identify executables) 
.br
\fIfast_mode\fP If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is \fIfast\fP. 
.RE
.PP
\fBReturns:\fP
.RS 4
A pointer to the matching mimetype. 0L is never returned. 
.RE
.PP

.PP
Definition at line 304 of file kmimetype.cpp.
.PP
References findByURL(), and KURL::setPath().
.PP
Referenced by KFilterBase::findFilterByFileName(), findFormatByFileContent(), and KTar::KTar().
.SS "\fBKMimeType::Ptr\fP KMimeType::findByContent (const \fBQByteArray\fP & data, int * accuracy = \fC0\fP)\fC [static]\fP"
.PP
Tries to find out the MIME type of a data chunk by looking for certain magic numbers and characteristic strings in it. 
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP the data to examine 
.br
\fIaccuracy\fP If not a null pointer, *accuracy is set to the accuracy of the match (which is in the range 0..100) 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the KMimeType. application/octet-stream's KMimeType of the type can not be found this way. 
.RE
.PP

.PP
Definition at line 311 of file kmimetype.cpp.
.PP
References KMimeMagicResult::accuracy(), defaultMimeType(), KMimeMagic::findBufferType(), KMimeMagicResult::isValid(), mimeType(), KMimeMagicResult::mimeType(), and KMimeMagic::self().
.SS "\fBKMimeType::Ptr\fP KMimeType::findByFileContent (const \fBQString\fP & fileName, int * accuracy = \fC0\fP)\fC [static]\fP"
.PP
Tries to find out the MIME type of a file by looking for certain magic numbers and characteristic strings in it. 
.PP
This function is similar to the previous one. Note that the file name is not used for determining the file type, it is just used for loading the file's contents.
.PP
\fBParameters:\fP
.RS 4
\fIfileName\fP the path to the file 
.br
\fIaccuracy\fP If not a null pointer, *accuracy is set to the accuracy of the match (which is in the range 0..100) 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the KMimeType. application/octet-stream's KMimeType of the type can not be found this way. 
.RE
.PP

.PP
Definition at line 321 of file kmimetype.cpp.
.PP
References KMimeMagicResult::accuracy(), defaultMimeType(), KMimeMagic::findFileType(), KMimeMagicResult::isValid(), mimeType(), KMimeMagicResult::mimeType(), and KMimeMagic::self().
.PP
Referenced by findFormatByFileContent(), KFilePropsPlugin::KFilePropsPlugin(), and KTar::KTar().
.SS "KMimeType::Format KMimeType::findFormatByFileContent (const \fBQString\fP & fileName)\fC [static]\fP"
.PP
Returns whether a file has an internal format that is human readable, or that would be human readable after decompression. 
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 334 of file kmimetype.cpp.
.PP
References findByFileContent(), findByPath(), QVariant::isValid(), QFile::open(), and QVariant::toBool().
.SS "\fBKMimeType::List\fP KMimeType::allMimeTypes ()\fC [static]\fP"
.PP
Get all the mimetypes. 
.PP
Useful for showing the list of available mimetypes. More memory consuming than the ones above, don't use unless really necessary. 
.PP
\fBReturns:\fP
.RS 4
the list of all existing KMimeTypes 
.RE
.PP

.PP
Definition at line 160 of file kmimetype.cpp.
.PP
Referenced by KApplicationPropsPlugin::KApplicationPropsPlugin().
.SS "const \fBQString\fP & KMimeType::defaultMimeType ()\fC [static]\fP"
.PP
Returns the name of the default mimetype. 
.PP
Always application/octet-stream, but this method exists for performance purposes. 
.PP
\fBReturns:\fP
.RS 4
the name of the default mime type, always 'application/octet-stream' 
.RE
.PP

.PP
Definition at line 1123 of file kmimetype.cpp.
.PP
References KGlobal::staticQString().
.PP
Referenced by buildDefaultType(), findByContent(), findByFileContent(), findByURL(), KFilePropsPlugin::KFilePropsPlugin(), and KMimeTypeChooser::patterns().
.SS "\fBKMimeType::Ptr\fP KMimeType::defaultMimeTypePtr ()\fC [static]\fP"
.PP
Returns the default mimetype. 
.PP
Always application/octet-stream. This can be used to check the result of mimeType(name). 
.PP
\fBReturns:\fP
.RS 4
the 'application/octet-stream' mimetype pointer. 
.RE
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 89 of file kmimetype.cpp.
.PP
References buildDefaultType().
.PP
Referenced by findByURL(), iconForURL(), and KDesktopPropsPlugin::KDesktopPropsPlugin().
.SS "\fBQString\fP KMimeType::parentMimeType () const"
.PP
If this mimetype inherits from ('is also') another mimetype, return the name of the parent. 
.PP
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.
.PP
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.
.PP
\fBReturns:\fP
.RS 4
the parent mime type, or QString::null if not set 
.RE
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 554 of file kmimetype.cpp.
.PP
References property(), and QVariant::toString().
.PP
Referenced by is().
.SS "bool KMimeType::is (const \fBQString\fP & mimeTypeName) const"
.PP
Do not use \fBname()\fP=='somename' anymore, to check for a given mimetype. 
.PP
For mimetype inheritance to work, use is('somename') instead. Warning, do not use \fBinherits()\fP, that's the servicetype inheritance concept! 
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 560 of file kmimetype.cpp.
.PP
References QString::isEmpty(), mimeType(), KServiceType::name(), and parentMimeType().
.SS "void KMimeType::errorMissingMimeType (const \fBQString\fP & _type)\fC [static, protected]\fP"
.PP
Signal a missing mime type. 
.PP
\fBParameters:\fP
.RS 4
\fI_type\fP the missinf mime type 
.RE
.PP

.PP
Definition at line 134 of file kmimetype.cpp.
.PP
Referenced by buildDefaultType(), and checkEssentialMimeTypes().
.SS "void KMimeType::buildDefaultType ()\fC [static, protected]\fP"
.PP
This function makes sure that the default mime type exists. 
.PP
Definition at line 68 of file kmimetype.cpp.
.PP
References defaultMimeType(), errorMissingMimeType(), KSycocaEntry::isType(), KMimeType(), and KStandardDirs::resourceDirs().
.PP
Referenced by checkEssentialMimeTypes(), defaultMimeTypePtr(), and mimeType().
.SS "void KMimeType::checkEssentialMimeTypes ()\fC [static, protected]\fP"
.PP
This function makes sure that vital mime types are installed. 
.PP
Definition at line 97 of file kmimetype.cpp.
.PP
References buildDefaultType(), errorMissingMimeType(), mimeType(), and s_bChecked.
.PP
Referenced by findByURL().
.SH "Member Data Documentation"
.PP 
.SS "bool \fBKMimeType::s_bChecked\fP = false\fC [static, protected]\fP"
.PP
true if check for vital mime types has been done. 
.PP
Definition at line 66 of file kmimetype.cpp.
.PP
Referenced by checkEssentialMimeTypes().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
