Method |
Description |
|
AllMimeTypes ( ) : List |
Get all the mimetypes. Useful for showing the list of available mimetypes. More memory consuming than the ones above, don't use unless really necessary. |
|
AllParentMimeTypes ( ) : List |
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. The usual reason to use this method is to look for a setting which is stored per mimetype (like PreviewJob does). |
|
Comment ( ) : string |
|
|
Comment ( Kimono.KUrl url ) : string |
Returns the descriptive comment associated with the MIME type. The url argument is unused, but provided so that KMimeType derived classes can use it. |
|
DefaultMimeType ( ) : string |
Returns the name of the default mimetype. Always application/octet-stream, but this method exists for performance purposes. |
|
DefaultMimeTypePtr ( ) : KMimeType |
Returns the default mimetype. Always application/octet-stream. This can be used to check the result of mimeType(name). |
|
Dispose ( ) : void |
|
|
ExtractKnownExtension ( string fileName ) : string |
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 |
|
FavIconForUrl ( Kimono.KUrl url ) : string |
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 string(). name="url" the URL of the favicon |
|
FindByContent ( Qyoto.QByteArray data ) : KMimeType |
|
|
FindByContent ( Qyoto.QByteArray data, int &accuracy ) : KMimeType |
Tries to find out the MIME type of a data chunk by looking for certain magic numbers and characteristic strings in it. name="data" the data to examine name="accuracy" If not a null pointer, accuracy is set to the accuracy of the match (which is in the range 0..100) |
|
FindByFileContent ( string fileName ) : KMimeType |
|
|
FindByFileContent ( string fileName, int &accuracy ) : KMimeType |
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. name="fileName" the path to the file name="accuracy" If not a null pointer, accuracy is set to the accuracy of the match (which is in the range 0..100) |
|
FindByNameAndContent ( string name, Qyoto.QByteArray data ) : KMimeType |
|
|
FindByNameAndContent ( string name, Qyoto.QByteArray data, long mode ) : KMimeType |
|
|
FindByNameAndContent ( string name, Qyoto.QByteArray data, long mode, int &accuracy ) : KMimeType |
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. 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. name="name" the filename or url representing this data. Only used for the extension, not used as a local filename. name="data" the data to examine when the extension isn't conclusive in itself name="mode" the mode of the file (used, for example, to identify executables) name="accuracy" If not a null pointer, accuracy is set to the accuracy of the match (which is in the range 0..100) |
|
FindByPath ( string path ) : KMimeType |
|
|
FindByPath ( string path, long mode ) : KMimeType |
|
|
FindByPath ( string path, long mode, bool fast_mode ) : KMimeType |
|
|
FindByPath ( string path, long mode, bool fast_mode, int &accuracy ) : KMimeType |
Finds a KMimeType with the given url. 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. Equivalent to KUrl u; u.setPath(path); return findByUrl( u, mode, true, fast_mode ); name="path" the path to the file name="mode" the mode of the file (used, for example, to identify executables) name="fast_mode" If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is fast. name="accuracy" If not a null pointer, accuracy is set to the accuracy of the match (which is in the range 0..100) |
|
FindByUrl ( Kimono.KUrl url ) : KMimeType |
|
|
FindByUrl ( Kimono.KUrl url, long mode ) : KMimeType |
|
|
FindByUrl ( Kimono.KUrl url, long mode, bool is_local_file ) : KMimeType |
|
|
FindByUrl ( Kimono.KUrl url, long mode, bool is_local_file, bool fast_mode ) : KMimeType |
|
|
FindByUrl ( Kimono.KUrl url, long mode, bool is_local_file, bool fast_mode, int &accuracy ) : KMimeType |
Finds a KMimeType with the given url. 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. name="url" 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. name="mode" the mode of the file (used, for example, to identify executables) name="is_local_file" true if the file is local; false if not, or if you don't know. name="fast_mode" If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is fast. name="accuracy" 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 > 80 (and have priority over the filename, others are < 80). |
|
IconName ( ) : string |
|
|
IconName ( Kimono.KUrl url ) : string |
Return the filename of the icon associated with the mimetype. Use KIconLoader.LoadMimeTypeIcon to load the icon. The url argument is unused, but is provided so that KMimeType-derived classes can use it (e.g. KFolderType uses the URL to return one out of 2 icons) |
|
IconNameForUrl ( Kimono.KUrl url ) : string |
|
|
IconNameForUrl ( Kimono.KUrl url, long mode ) : string |
Return the filename of the icon associated with the mimetype, for a given url. Use KIconLoader.LoadMimeTypeIcon to load the icon. name="url" URL for the file name="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 |
|
Is ( string mimeTypeName ) : bool |
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. |
|
IsBinaryData ( string fileName ) : bool |
Returns whether a file has an internal format that is not human readable. This is much more generic than "not mime.Is(text/plain)". Many application file formats (like rtf and postscript) are based on text, but text that the user should rarely ever see. |
|
IsBufferBinaryData ( Qyoto.QByteArray data ) : bool |
Returns whether a buffer has an internal format that is not human readable. This is much more generic than "not mime.Is(text/plain)". Many application file formats (like rtf and postscript) are based on text, but text that the user should rarely ever see. |
|
IsDefault ( ) : bool |
|
|
KMimeType ( QDataStream str, int offset ) : System |
The stream must already be positionned at the correct offset |
|
KMimeType ( string fullpath, string name, string comment ) : System |
Construct a mimetype and take all information from an XML file. name="fullpath" the path to the xml that describes the mime type name="name" the name of the mimetype (usually the end of the path) name="comment" the comment associated with the mimetype |
|
MimeType ( string name ) : KMimeType |
|
|
MimeType ( string name, KMimeType options ) : KMimeType |
Retrieve a pointer to the mime type name . Very important: Don't store the result in a KMimeType ! 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. name="name" the name of the mime type |
|
ParentMimeTypes ( ) : List |
If this mimetype is a subclass of one or more other mimetypes, return the list of those mimetypes. 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" Another example: application/x-shellscript is a subclass of two other mimetypes, application/x-executable and text/plain. (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.) |
|
Patterns ( ) : List |
Retrieve the list of patterns associated with the MIME Type. |
|