Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 41640b7d04ef5b5040e7668305a5ba3d > files > 323

python-kde4-doc-4.11.4-1.mga4.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>KMimeType</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
  <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
</head>
<body>
<div id="container">
<div id="header">
  <div id="header_top">
    <div>
      <div>
        <img alt ="" src="../common/top-kde.jpg"/>
        KDE 4.9 PyKDE API Reference
      </div>
    </div>
  </div>
  <div id="header_bottom">
    <div id="location">
      <ul>
        <li>KDE's Python API</li>
      </ul>
    </div>

    <div id="menu">
      <ul>
        <li><a href="../modules.html">Overview</a></li>
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
<li><a href="http://kde.org/family/">Sitemap</a></li>
<li><a href="http://kde.org/contact/">Contact Us</a></li>
</ul>
    </div>
  </div>
</div>

<div id="body_wrapper">
<div id="body">
<div id="right">
<div class="content">
<div id="main">
<div class="clearer">&nbsp;</div>

<h1>KMimeType Class Reference</h1>
<code>from PyKDE4.kdecore import *</code>
<p>
Inherits: <a href="../kdecore/KServiceType.html">KServiceType</a> &#x2192; <a href="../kdecore/KSycocaEntry.html">KSycocaEntry</a><br />


<h2>Detailed Description</h2>

<p>Represent a mime type, like "text/plain", and the data that is associated
with it.
</p>
<p>
The starting point you need is often the static methods.
</p>
<p>
KMimeType inherits KServiceType because "text/plain" can be used to find
services (apps and components) "which can open text/plain".
</p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> KServiceType
</dd></dl>
</p>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#FindByNameOption">FindByNameOption</a>&nbsp;</td><td class="memItemRight" valign="bottom">{&nbsp;DontResolveAlias, ResolveAliases&nbsp;}</td></tr>
<tr><td colspan="2"><br><h2>Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#KMimeType">__init__</a> (self, QDataStream str, int offset)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#KMimeType">__init__</a> (self, QString fullpath, QString name, QString comment)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QStringList&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#allParentMimeTypes">allParentMimeTypes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#comment">comment</a> (self, <a href="../kdecore/KUrl.html">KUrl</a> url=KUrl())</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#iconName">iconName</a> (self, <a href="../kdecore/KUrl.html">KUrl</a> url=KUrl())</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#is">is_</a> (self, QString mimeTypeName)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isDefault">isDefault</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#mainExtension">mainExtension</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#parentMimeType">parentMimeType</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QStringList&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#parentMimeTypes">parentMimeTypes</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QStringList&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#patterns">patterns</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#userSpecifiedIconName">userSpecifiedIconName</a> (self)</td></tr>
<tr><td colspan="2"><br><h2>Static Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">[KSharedPtr<KMimeType>]&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#allMimeTypes">allMimeTypes</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#defaultMimeType">defaultMimeType</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#defaultMimeTypePtr">defaultMimeTypePtr</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#extractKnownExtension">extractKnownExtension</a> (QString fileName)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#favIconForUrl">favIconForUrl</a> (<a href="../kdecore/KUrl.html">KUrl</a> url)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>, int accuracy&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByContent">findByContent</a> (QByteArray data)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByContent">findByContent</a> (QIODevice device, int accuracy=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>, int accuracy&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByFileContent">findByFileContent</a> (QString fileName)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>, int accuracy&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByNameAndContent">findByNameAndContent</a> (QString name, QByteArray data, mode_t mode=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByNameAndContent">findByNameAndContent</a> (QString name, QIODevice device, mode_t mode=0, int accuracy=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>, int accuracy&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByPath">findByPath</a> (QString path, mode_t mode=0, bool fast_mode=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>, int accuracy&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#findByUrl">findByUrl</a> (<a href="../kdecore/KUrl.html">KUrl</a> url, mode_t mode=0, bool is_local_file=0, bool fast_mode=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#iconNameForUrl">iconNameForUrl</a> (<a href="../kdecore/KUrl.html">KUrl</a> url, mode_t mode=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isBinaryData">isBinaryData</a> (QString fileName)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isBufferBinaryData">isBufferBinaryData</a> (QByteArray data)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#matchFileName">matchFileName</a> (QString filename, QString pattern)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">KSharedPtr<KMimeType>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#mimeType">mimeType</a> (QString name, <a href="../kdecore/KMimeType.html#FindByNameOption">KMimeType.FindByNameOption</a> options=KMimeType.DontResolveAlias)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#sharedMimeInfoVersion">sharedMimeInfoVersion</a> ()</td></tr>
</table>
<hr><h2>Method Documentation</h2><a class="anchor" name="KMimeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QDataStream&nbsp;</td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"><em>offset</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p><dl class="internal" compact><dt><b>Internal:</b></dt><dd> Construct a service from a stream.
</dd></dl> </p>
<p>
The stream must already be positionned at the correct offset
</p></div></div><a class="anchor" name="KMimeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>fullpath</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>comment</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Construct a mimetype and take all information from an XML file.
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>fullpath</em>&nbsp;</td><td> the path to the xml that describes the mime type

<tr><td></td><td valign="top"><em>name</em>&nbsp;</td><td> the name of the mimetype (usually the end of the path)

<tr><td></td><td valign="top"><em>comment</em>&nbsp;</td><td> the comment associated with the mimetype
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="allParentMimeTypes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QStringList allParentMimeTypes</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Return all parent mimetypes of this mimetype, direct or indirect.
This includes the parent(s) of its parent(s), etc.
If this mimetype is an alias, the list also contains the canonical
name for this mimetype.
</p>
<p>
The usual reason to use this method is to look for a setting which
is stored per mimetype (like PreviewJob does).
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.1
</dd></dl>
</p></div></div><a class="anchor" name="comment"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString comment</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KUrl.html">KUrl</a>&nbsp;</td>
<td class="paramname"><em>url=KUrl()</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns the descriptive comment associated with the MIME type.
The url argument is unused, but provided so that KMimeType derived classes
can use it.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The descriptive comment associated with the MIME type, if any.
</dd></dl>
</p></div></div><a class="anchor" name="iconName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString iconName</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KUrl.html">KUrl</a>&nbsp;</td>
<td class="paramname"><em>url=KUrl()</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Return the filename of the icon associated with the mimetype.
Use KIconLoader.loadMimeTypeIcon to load the icon.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>url</em>&nbsp;</td><td> argument only used for directories, where the icon
can be specified in the .directory file.
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The name of the icon associated with this MIME type.
</dd></dl>
</p></div></div><a class="anchor" name="is"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool is_</td>
<td>(</td>
<td class="paramtype">&nbsp;<em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>mimeTypeName</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>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!
is() also supports mimetype aliases.
</p></div></div><a class="anchor" name="isDefault"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isDefault</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="mainExtension"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString mainExtension</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Return the primary extension associated with this mimetype, if any.
If patterns() returns (*.jpg, *.jpeg) then mainExtension will return ".jpg".
Note that the dot is included.
</p>
<p>
If none of the patterns is in *.foo format (for instance
&lt;code&gt;*.jp? or *.* or callgrind.out* &lt;/code&gt;)
then mainExtension() returns an empty string.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><a class="anchor" name="parentMimeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString parentMimeType</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>If this mimetype is a subclass of another mimetype,
return the name of the parent.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the parent mime type, or QString() if not set
</dd></dl> </p>
<p>
<dl class="deprecated" compact><dt><b>Deprecated:</b></dt><dd> this method does not support multiple inheritance,
which is actually part of the shared-mime-info standard.
Use is(), parentMimeTypes(), or allParentMimeTypes() instead of parentMimeType()
</dd></dl>
</p></div></div><a class="anchor" name="parentMimeTypes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QStringList parentMimeTypes</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>If this mimetype is a subclass of one or more other mimetypes,
return the list of those mimetypes.
</p>
<p>
For instance a application/javascript is a special kind of text/plain,
so the definition of application/javascript says
sub-class-of type="text/plain"
</p>
<p>
Another example: application/x-shellscript is a subclass of two other mimetypes,
application/x-executable and text/plain.
</p>
<p>
(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.)
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the list of parent mimetypes
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.1
</dd></dl>
</p></div></div><a class="anchor" name="patterns"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QStringList patterns</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Retrieve the list of patterns associated with the MIME Type.
<dl class="return" compact><dt><b>Returns:</b></dt><dd> a list of file globs that describe the file names
(or, usually, the extensions) of files with this mime type
</dd></dl>
</p></div></div><a class="anchor" name="userSpecifiedIconName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString userSpecifiedIconName</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"><em>self</em>&nbsp;)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the user-specified icon for this mimetype. This is empty most of the time,
you probably want to use iconName() instead. This method is for the mimetype editor.
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl>
</p></div></div><hr><h2>Static Method Documentation</h2><a class="anchor" name="allMimeTypes"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">[KSharedPtr<KMimeType>] allMimeTypes</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Get all the mimetypes.
</p>
<p>
Useful for showing the list of
available mimetypes.
More memory consuming than the ones above, don't use unless
really necessary.
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the list of all existing KMimeTypes
</dd></dl>
</p></div></div><a class="anchor" name="defaultMimeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString defaultMimeType</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the name of the default mimetype.
Always application/octet-stream, but this method exists
for performance purposes.
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the name of the default mime type, always
"application/octet-stream"
</dd></dl>
</p></div></div><a class="anchor" name="defaultMimeTypePtr"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType> defaultMimeTypePtr</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the default mimetype.
Always application/octet-stream.
This can be used to check the result of mimeType(name).
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the "application/octet-stream" mimetype pointer.
</dd></dl>
</p></div></div><a class="anchor" name="extractKnownExtension"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString extractKnownExtension</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>fileName</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Determines the extension from a filename (or full path) using the mimetype database.
This allows to extract "tar.bz2" for foo.tar.bz2
but still return "txt" for my.doc.with.dots.txt
</p></div></div><a class="anchor" name="favIconForUrl"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString favIconForUrl</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KUrl.html">KUrl</a>&nbsp;</td>
<td class="paramname"><em>url</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Return the "favicon" (see http://www.favicon.com) for the given <b>url,</b>
if available. Does NOT attempt to download the favicon, it only returns
one that is already available.
</p>
<p>
If unavailable, returns QString().
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>url</em>&nbsp;</td><td> the URL of the favicon
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> the name of the favicon, or QString()
</dd></dl>
</p></div></div><a class="anchor" name="findByContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType>, int accuracy findByContent</td>
<td>(</td>
<td class="paramtype">QByteArray&nbsp;</td>
<td class="paramname"><em>data</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Tries to find out the MIME type of a data chunk by looking for
certain magic numbers and characteristic strings in it.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>device</em>&nbsp;</td><td> the IO device providing the data to examine

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a pointer to the KMimeType. "application/octet-stream" is
returned if the type can not be found this way.
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.4
</dd></dl>
</p></div></div><a class="anchor" name="findByContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType> findByContent</td>
<td>(</td>
<td class="paramtype">QIODevice&nbsp;</td>
<td class="paramname"><em>device</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"><em>accuracy=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Tries to find out the MIME type of a data chunk by looking for
certain magic numbers and characteristic strings in it.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>device</em>&nbsp;</td><td> the IO device providing the data to examine

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a pointer to the KMimeType. "application/octet-stream" is
returned if the type can not be found this way.
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.4
</dd></dl>
</p></div></div><a class="anchor" name="findByFileContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType>, int accuracy findByFileContent</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>fileName</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Tries to find out the MIME type of a file by looking for
certain magic numbers and characteristic strings in it.
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.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>fileName</em>&nbsp;</td><td> the path to the file

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a pointer to the KMimeType, or the default mimetype
(application/octet-stream) if the file cannot be opened.
</dd></dl>
</p></div></div><a class="anchor" name="findByNameAndContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType>, int accuracy findByNameAndContent</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QByteArray&nbsp;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">mode_t&nbsp;</td>
<td class="paramname"><em>mode=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Tries to find out the MIME type of filename/url and a data chunk.
Whether to trust the extension or the data depends on the results of both approaches,
and is determined automatically.
</p>
<p>
This method is useful for instance in the get() method of kioslaves, and anywhere else
where a filename is associated with some data which is available immediately.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>name</em>&nbsp;</td><td> the filename or url representing this data.
Only used for the extension, not used as a local filename.

<tr><td></td><td valign="top"><em>device</em>&nbsp;</td><td> the IO device providing the data to examine when the extension isn't conclusive in itself

<tr><td></td><td valign="top"><em>mode</em>&nbsp;</td><td> the mode of the file (used, for example, to identify executables)

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a pointer to the KMimeType. "application/octet-stream" is
returned if the type can not be found this way.
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.4
</dd></dl>
</p></div></div><a class="anchor" name="findByNameAndContent"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType> findByNameAndContent</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QIODevice&nbsp;</td>
<td class="paramname"><em>device</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">mode_t&nbsp;</td>
<td class="paramname"><em>mode=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"><em>accuracy=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Tries to find out the MIME type of filename/url and a data chunk.
Whether to trust the extension or the data depends on the results of both approaches,
and is determined automatically.
</p>
<p>
This method is useful for instance in the get() method of kioslaves, and anywhere else
where a filename is associated with some data which is available immediately.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>name</em>&nbsp;</td><td> the filename or url representing this data.
Only used for the extension, not used as a local filename.

<tr><td></td><td valign="top"><em>device</em>&nbsp;</td><td> the IO device providing the data to examine when the extension isn't conclusive in itself

<tr><td></td><td valign="top"><em>mode</em>&nbsp;</td><td> the mode of the file (used, for example, to identify executables)

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> a pointer to the KMimeType. "application/octet-stream" is
returned if the type can not be found this way.
</dd></dl> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.4
</dd></dl>
</p></div></div><a class="anchor" name="findByPath"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType>, int accuracy findByPath</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>path</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">mode_t&nbsp;</td>
<td class="paramname"><em>mode=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"><em>fast_mode=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Finds a KMimeType with the given <b>url.</b>
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
KRun instead, but this function returns immediately while
KRun is async. If no extension matches, then
the file contents will be examined if the URL is a local file, or
"application/octet-stream" is returned otherwise.
</p>
<p>
Equivalent to
<pre class="fragment">
 KUrl u(path);
 return findByUrl( u, mode, true, fast_mode );
</pre>
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>path</em>&nbsp;</td><td> the path to the file (a file name is enough, in fast mode)

<tr><td></td><td valign="top"><em>mode</em>&nbsp;</td><td> the mode of the file (used, for example, to identify
executables)

<tr><td></td><td valign="top"><em>fast_mode</em>&nbsp;</td><td> If set to true no disk access is allowed to
find out the mimetype. The result may be suboptimal, but
it is <b>fast.</b>

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> If not a null pointer, *accuracy is set to the
accuracy of the match (which is in the range 0..100)
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> A pointer to the matching mimetype. 0 is never returned.
</dd></dl>
</p></div></div><a class="anchor" name="findByUrl"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType>, int accuracy findByUrl</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KUrl.html">KUrl</a>&nbsp;</td>
<td class="paramname"><em>url</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">mode_t&nbsp;</td>
<td class="paramname"><em>mode=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"><em>is_local_file=0</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"><em>fast_mode=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Finds a KMimeType with the given <b>url.</b>
This function looks at mode_t first.
If that does not help it looks at the extension (and the contents, for local files).
This method is fine for many protocols like ftp, file, fish, zip etc.,
but is not for http (e.g. cgi scripts
make extension-based checking unreliable).
For HTTP you should use KRun instead (to open the URL, in an app
or internally), or a KIO.mimetype() job (to find the mimetype without
downloading), or a KIO.get() job (to find the mimetype and then download).
In fact KRun is the most complete solution, but deriving from it just
for this is a bit cumbersome.
</p>
<p>
If no extension matches, then the file contents will be examined if the URL is a local file, or
"application/octet-stream" is returned otherwise.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>url</em>&nbsp;</td><td> 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.

<tr><td></td><td valign="top"><em>mode</em>&nbsp;</td><td> the mode of the file (used, for example, to identify
executables)

<tr><td></td><td valign="top"><em>is_local_file</em>&nbsp;</td><td> true if the file is local; false if not, or if you don't know.

<tr><td></td><td valign="top"><em>fast_mode</em>&nbsp;</td><td> If set to true no disk access is allowed to
find out the mimetype. The result may be suboptimal, but
it is <b>fast.</b>

<tr><td></td><td valign="top"><em>accuracy</em>&nbsp;</td><td> if set, the accuracy of the result, between 0 and 100.
For instance, when the extension was used to determine the mimetype,
the accuracy is set to 80, as per the shared-mime spec.
Some 'magic' rules (used when !fast_mode) have an accuracy &gt; 80
(and have priority over the filename, others are &lt; 80).
</td></tr>
</table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> A pointer to the matching mimetype. 0 is never returned.
</dd></dl> <b>Very</b> <b>Important:</b> Don't store the result in a KMimeType* !
</p></div></div><a class="anchor" name="iconNameForUrl"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString iconNameForUrl</td>
<td>(</td>
<td class="paramtype"><a href="../kdecore/KUrl.html">KUrl</a>&nbsp;</td>
<td class="paramname"><em>url</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">mode_t&nbsp;</td>
<td class="paramname"><em>mode=0</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Return the filename of the icon associated with the mimetype, for a given url.
Use KIconLoader.loadMimeTypeIcon to load the icon.
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>url</em>&nbsp;</td><td> URL for the file

<tr><td></td><td valign="top"><em>mode</em>&nbsp;</td><td> the mode of the file. The mode may modify the icon
with overlays that show special properties of the
icon. Use 0 for default
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> the name of the icon. The name of a default icon if there is no icon
for the mime type
</dd></dl>
</p></div></div><a class="anchor" name="isBinaryData"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isBinaryData</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>fileName</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns whether a file has an internal format that is not human readable.
This is much more generic than "not mime-&gt;is(text/plain)".
Many application file formats (like rtf and postscript) are based on text,
but text that the user should rarely ever see.
</p></div></div><a class="anchor" name="isBufferBinaryData"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isBufferBinaryData</td>
<td>(</td>
<td class="paramtype">QByteArray&nbsp;</td>
<td class="paramname"><em>data</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns whether a buffer has an internal format that is not human readable.
This is much more generic than "not mime-&gt;is(text/plain)".
Many application file formats (like rtf and postscript) are based on text,
but text that the user should rarely ever see.
</p></div></div><a class="anchor" name="matchFileName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool matchFileName</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>pattern</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Returns true if the given filename matches the given pattern.
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.6.1
</dd></dl>
</p></div></div><a class="anchor" name="mimeType"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">KSharedPtr<KMimeType> mimeType</td>
<td>(</td>
<td class="paramtype">QString&nbsp;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KMimeType.html#FindByNameOption">KMimeType.FindByNameOption</a>&nbsp;</td>
<td class="paramname"><em>options=KMimeType.DontResolveAlias</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Retrieve a pointer to the mime type <b>name</b>
</p>
<p>
<b>Very</b> <b>important:</b> Don't store the result in a KMimeType* !
</p>
<p>
Also note that you get a new KMimeType pointer every time you call this.
Don't ever write code that compares mimetype pointers, compare names instead.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>name</em>&nbsp;</td><td> the name of the mime type

<tr><td></td><td valign="top"><em>options</em>&nbsp;</td><td> controls how the mime type is searched for
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> the pointer to the KMimeType with the given <b>name,</b> or
0 if not found
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> KServiceType.serviceType
</dd></dl>
</p></div></div><a class="anchor" name="sharedMimeInfoVersion"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">int sharedMimeInfoVersion</td>
<td>(</td>
<td class="paramtype">&nbsp;</td>
<td class="paramname">)</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the version of the installed update-mime-database program
(from freedesktop.org shared-mime-info). This is used by unit tests
and by the code that writes out icon definitions.
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.3
</dd></dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd> -1 on error, otherwise a version number to use like this:
</dd></dl> <pre class="fragment">
 if (version &gt;= KDE_MAKE_VERSION(0, 40, 0)) { ... }
</pre>
</p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="FindByNameOption"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">FindByNameOption</td>
</tr>
</table>
</div>
<div class="memdoc"><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>DontResolveAlias</em>&nbsp;</td><td><tr><td valign="top"><em>ResolveAliases</em>&nbsp;=&nbsp;1</td><td></table>
</dl>
</div></div><p>
</div>
</div>
</div>

<div id="left">

<div class="menu_box">
<div class="nav_list">
<ul>
<li><a href="../allclasses.html">Full Index</a></li>
</ul>
</div>

<a name="cp-menu" /><div class="menutitle"><div>
  <h2 id="cp-menu-project">Modules</h2>
</div></div>
<div class="nav_list">
<ul><li><a href="../akonadi/index.html">akonadi</a></li>
<li><a href="../dnssd/index.html">dnssd</a></li>
<li><a href="../kdecore/index.html">kdecore</a></li>
<li><a href="../kdeui/index.html">kdeui</a></li>
<li><a href="../khtml/index.html">khtml</a></li>
<li><a href="../kio/index.html">kio</a></li>
<li><a href="../knewstuff/index.html">knewstuff</a></li>
<li><a href="../kparts/index.html">kparts</a></li>
<li><a href="../kutils/index.html">kutils</a></li>
<li><a href="../nepomuk/index.html">nepomuk</a></li>
<li><a href="../phonon/index.html">phonon</a></li>
<li><a href="../plasma/index.html">plasma</a></li>
<li><a href="../polkitqt/index.html">polkitqt</a></li>
<li><a href="../solid/index.html">solid</a></li>
<li><a href="../soprano/index.html">soprano</a></li>
</ul></div></div>

</div>

</div>
  <div class="clearer"/>
</div>

<div id="end_body"></div>
</div>
<div id="footer"><div id="footer_text">
This documentation is maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;simon&#64;simonzone&#46;com">Simon Edwards</a>.<br />
        KDE<sup>&#174;</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>&#174;</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
        <a href="http://www.kde.org/contact/impressum.php">Legal</a>
    </div></div>
</body>
</html>