\section{KMime\-Type Class Reference}
\label{classKMimeType}\index{KMimeType@{KMimeType}}
Represent a mime type, like \char`\"{}text/plain\char`\"{}, and the data that is associated with it.  


{\tt \#include $<$kmimetype.h$>$}

Inheritance diagram for KMime\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=178pt]{classKMimeType__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KMime\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=191pt]{classKMimeType__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef {\bf KShared\-Ptr}$<$ {\bf KMime\-Type} $>$ {\bf Ptr}\label{classKMimeType_w0}

\item 
typedef {\bf QValue\-List}$<$ {\bf Ptr} $>$ {\bf List}\label{classKMimeType_w1}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KMime\-Type} (const {\bf QString} \&\_\-fullpath, const {\bf QString} \&\_\-type, const {\bf QString} \&\_\-icon, const {\bf QString} \&\_\-comment, const {\bf QString\-List} \&\_\-patterns)
\item 
{\bf KMime\-Type} (const {\bf QString} \&\_\-fullpath)
\item 
{\bf KMime\-Type} ({\bf KDesktop\-File} $\ast$config)
\item 
{\bf KMime\-Type} ({\bf QData\-Stream} \&\_\-str, int {\bf offset})\label{classKMimeType_a3}

\item 
virtual {\bf QString} {\bf icon} (const {\bf QString} \&, bool) const 
\item 
virtual {\bf QString} {\bf icon} (const {\bf KURL} \&, bool) const 
\item 
virtual {\bf QPixmap} {\bf pixmap} ({\bf KIcon::Group} group, int force\_\-size=0, int state=0, {\bf QString} $\ast$path=0L) const 
\item 
virtual {\bf QPixmap} {\bf pixmap} (const {\bf KURL} \&\_\-url, {\bf KIcon::Group} \_\-group, int \_\-force\_\-size=0, int \_\-state=0, {\bf QString} $\ast$\_\-path=0L) const 
\item 
{\bf QString} {\bf comment} () const 
\item 
virtual {\bf QString} {\bf comment} (const {\bf QString} \&, bool) const 
\item 
virtual {\bf QString} {\bf comment} (const {\bf KURL} \&, bool) const 
\item 
const {\bf QString\-List} \& {\bf patterns} () const 
\item 
virtual void {\bf load} ({\bf QData\-Stream} \&qs)
\item 
virtual void {\bf save} ({\bf QData\-Stream} \&qs)
\item 
virtual {\bf QVariant} {\bf property} (const {\bf QString} \&\_\-name) const 
\item 
virtual {\bf QString\-List} {\bf property\-Names} () const 
\item 
{\bf QString} {\bf parent\-Mime\-Type} () const 
\item 
bool {\bf is} (const {\bf QString} \&mime\-Type\-Name) const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QPixmap} {\bf pixmap\-For\-URL} (const {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0, {\bf KIcon::Group} \_\-group={\bf KIcon::Desktop}, int \_\-force\_\-size=0, int \_\-state=0, {\bf QString} $\ast$\_\-path=0L)
\item 
static {\bf QString} {\bf icon\-For\-URL} (const {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0)
\item 
static {\bf QString} {\bf fav\-Icon\-For\-URL} (const {\bf KURL} \&url)
\item 
static {\bf Ptr} {\bf mime\-Type} (const {\bf QString} \&\_\-name)
\item 
static {\bf Ptr} {\bf find\-By\-URL} (const {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0, bool \_\-is\_\-local\_\-file=false, bool \_\-fast\_\-mode=false)
\item 
static {\bf Ptr} {\bf find\-By\-URL} (const {\bf KURL} \&\_\-url, mode\_\-t \_\-mode, bool \_\-is\_\-local\_\-file, bool \_\-fast\_\-mode, bool $\ast$accurate)\label{classKMimeType_e5}

\item 
static {\bf Ptr} {\bf find\-By\-Path} (const {\bf QString} \&path, mode\_\-t mode=0, bool fast\_\-mode=false)
\item 
static {\bf Ptr} {\bf find\-By\-Content} (const {\bf QByte\-Array} \&data, int $\ast$accuracy=0)
\item 
static {\bf Ptr} {\bf find\-By\-File\-Content} (const {\bf QString} \&file\-Name, int $\ast$accuracy=0)
\item 
static Format {\bf find\-Format\-By\-File\-Content} (const {\bf QString} \&file\-Name)
\item 
static {\bf List} {\bf all\-Mime\-Types} ()
\item 
static const {\bf QString} \& {\bf default\-Mime\-Type} ()
\item 
static {\bf KMime\-Type::Ptr} {\bf default\-Mime\-Type\-Ptr} ()
\item 
static {\bf KMime\-Type::Ptr} {\bf diagnose\-File\-Name} (const {\bf QString} \&file, {\bf QString} \&pattern)\label{classKMimeType_e13}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf load\-Internal} ({\bf QData\-Stream} \&)\label{classKMimeType_b0}

\item 
void {\bf init} ({\bf KDesktop\-File} $\ast$)\label{classKMimeType_b1}

\item 
int {\bf patterns\-Accuracy} () const \label{classKMimeType_b2}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKMimeType_b3}

\end{CompactItemize}
\subsection*{Static Protected Member Functions}
\begin{CompactItemize}
\item 
static void {\bf error\-Missing\-Mime\-Type} (const {\bf QString} \&\_\-type)
\item 
static void {\bf build\-Default\-Type} ()
\item 
static void {\bf check\-Essential\-Mime\-Types} ()
\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf QString\-List} {\bf m\_\-lst\-Patterns}\label{classKMimeType_p0}

\end{CompactItemize}
\subsection*{Static Protected Attributes}
\begin{CompactItemize}
\item 
static bool {\bf s\_\-b\-Checked} = false
\item 
static {\bf Ptr} {\bf s\_\-p\-Default\-Type} = 0L\label{classKMimeType_t1}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KService\-Type\-Factory}\label{classKMimeType_n0}

\end{CompactItemize}


\subsection{Detailed Description}
Represent a mime type, like \char`\"{}text/plain\char`\"{}, and the data that is associated with it. 

The starting point you need is often the static methods.

KMime\-Type inherits {\bf KService\-Type}{\rm (p.\,\pageref{classKServiceType})} because \char`\"{}text/plain\char`\"{} can be used to find services (apps and components) \char`\"{}which can open text/plain\char`\"{}.

\begin{Desc}
\item[See also:]{\bf KService\-Type}{\rm (p.\,\pageref{classKServiceType})} \end{Desc}




Definition at line 47 of file kmimetype.h.

\subsection{Constructor \& Destructor Documentation}
\index{KMimeType@{KMime\-Type}!KMimeType@{KMimeType}}
\index{KMimeType@{KMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMime\-Type::KMime\-Type (const {\bf QString} \& {\em \_\-fullpath}, const {\bf QString} \& {\em \_\-type}, const {\bf QString} \& {\em \_\-icon}, const {\bf QString} \& {\em \_\-comment}, const {\bf QString\-List} \& {\em \_\-patterns})}\label{classKMimeType_a0}


Constructor. 

You may pass in arguments to create a mimetype with specific properties.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-fullpath}]the path to the configuration file (.desktop) \item[{\em \_\-type}]the mime type itself \item[{\em \_\-icon}]the name of the icon that represens the mime type \item[{\em \_\-comment}]a comment describing the mime type \item[{\em \_\-patterns}]a list of file globs that describes the names (or extensions) of the files with this mime type \end{description}
\end{Desc}


Definition at line 361 of file kmimetype.cpp.

Referenced by build\-Default\-Type().\index{KMimeType@{KMime\-Type}!KMimeType@{KMimeType}}
\index{KMimeType@{KMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMime\-Type::KMime\-Type (const {\bf QString} \& {\em \_\-fullpath})}\label{classKMimeType_a1}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-fullpath}]the path to the configuration file (.desktop) \end{description}
\end{Desc}


Definition at line 368 of file kmimetype.cpp.

References endl(), KService\-Type::is\-Valid(), and kd\-Warning().\index{KMimeType@{KMime\-Type}!KMimeType@{KMimeType}}
\index{KMimeType@{KMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMime\-Type::KMime\-Type ({\bf KDesktop\-File} $\ast$ {\em config})}\label{classKMimeType_a2}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]the desktop configuration file that describes the mime type \end{description}
\end{Desc}


Definition at line 377 of file kmimetype.cpp.

References endl(), KService\-Type::is\-Valid(), and kd\-Warning().

\subsection{Member Function Documentation}
\index{KMimeType@{KMime\-Type}!icon@{icon}}
\index{icon@{icon}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QString} KMime\-Type::icon (const {\bf QString} \&, bool) const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKMimeType_a5}


Return the filename of the icon associated with the mimetype. 

The arguments are unused, but provided so that KMime\-Type-derived classes can use them (e.g. {\bf KFolder\-Type}{\rm (p.\,\pageref{classKFolderType})} uses the URL to return one out of 2 icons)

\begin{Desc}
\item[Returns:]The path to the icon associated with this MIME type. \end{Desc}


Reimplemented in {\bf KFolder\-Type} {\rm (p.\,\pageref{classKFolderType_a2})}, and {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_a2})}.

Definition at line 100 of file kmimetype.h.\index{KMimeType@{KMime\-Type}!icon@{icon}}
\index{icon@{icon}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QString} KMime\-Type::icon (const {\bf KURL} \&, bool) const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKMimeType_a6}


Return the filename of the icon associated with the mimetype. 

The arguments are unused, but provided so that KMime\-Type-derived classes can use them (e.g. {\bf KFolder\-Type}{\rm (p.\,\pageref{classKFolderType})} uses the URL to return one out of 2 icons)

\begin{Desc}
\item[Returns:]The path to the icon associated with this MIME type. \end{Desc}


Reimplemented in {\bf KFolder\-Type} {\rm (p.\,\pageref{classKFolderType_a3})}, and {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_a3})}.

Definition at line 110 of file kmimetype.h.\index{KMimeType@{KMime\-Type}!pixmap@{pixmap}}
\index{pixmap@{pixmap}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPixmap} KMime\-Type::pixmap ({\bf KIcon::Group} {\em group}, int {\em force\_\-size} = {\tt 0}, int {\em state} = {\tt 0}, {\bf QString} $\ast$ {\em path} = {\tt 0L}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a7}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em group}]The icon group where the icon is going to be used. \item[{\em force\_\-size}]Override globallly configured icon size. Use 0 for the default size \item[{\em state}]The icon state, one of: {\tt {\bf KIcon::Default\-State}}, {\tt {\bf KIcon::Active\-State}} or {\tt {\bf KIcon::Disabled\-State}}. \item[{\em path}]Output parameter to get the full path. Seldom needed. Ignored if 0 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the pixmap of the mime type, can be a default icon if not found \end{Desc}


Reimplemented in {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_b0})}.

Definition at line 454 of file kmimetype.cpp.

References KIcon\-Loader::add\-Extra\-Desktop\-Themes(), KIcon\-Loader::extra\-Desktop\-Themes\-Added(), KService\-Type::icon(), KGlobal::icon\-Loader(), QPixmap::is\-Null(), KIcon\-Loader::load\-Icon(), and pixmap().

Referenced by KDEDesktop\-Mime\-Type::pixmap(), pixmap(), and pixmap\-For\-URL().\index{KMimeType@{KMime\-Type}!pixmap@{pixmap}}
\index{pixmap@{pixmap}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPixmap} KMime\-Type::pixmap (const {\bf KURL} \& {\em \_\-url}, {\bf KIcon::Group} {\em \_\-group}, int {\em \_\-force\_\-size} = {\tt 0}, int {\em \_\-state} = {\tt 0}, {\bf QString} $\ast$ {\em \_\-path} = {\tt 0L}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a8}


Find the pixmap for a given file of this mimetype. 

Convenience method that uses {\bf icon()}{\rm (p.\,\pageref{classKMimeType_a5})}, but also locates and load the pixmap.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]URL for the file. \item[{\em \_\-group}]The icon group where the icon is going to be used. \item[{\em \_\-force\_\-size}]Override globallly configured icon size. Use 0 for the default size \item[{\em \_\-state}]The icon state, one of: {\bf KIcon::Default\-State}, {\bf KIcon::Active\-State} or {\bf KIcon::Disabled\-State}. \item[{\em \_\-path}]Output parameter to get the full path. Seldom needed. Ignored if 0 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the pixmap of the URL, can be a default icon if not found \end{Desc}


Reimplemented in {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_a4})}.

Definition at line 470 of file kmimetype.cpp.

References KIcon\-Loader::add\-Extra\-Desktop\-Themes(), KIcon\-Loader::extra\-Desktop\-Themes\-Added(), KService\-Type::icon(), KGlobal::icon\-Loader(), QPixmap::is\-Null(), KIcon\-Loader::load\-Icon(), and pixmap().\index{KMimeType@{KMime\-Type}!pixmapForURL@{pixmapForURL}}
\index{pixmapForURL@{pixmapForURL}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPixmap} KMime\-Type::pixmap\-For\-URL (const {\bf KURL} \& {\em \_\-url}, mode\_\-t {\em \_\-mode} = {\tt 0}, {\bf KIcon::Group} {\em \_\-group} = {\tt {\bf KIcon::Desktop}}, int {\em \_\-force\_\-size} = {\tt 0}, int {\em \_\-state} = {\tt 0}, {\bf QString} $\ast$ {\em \_\-path} = {\tt 0L})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e0}


Convenience method to find the pixmap for a URL. 

Call this one when you don't know the mimetype.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]URL for the file. \item[{\em \_\-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 \item[{\em \_\-group}]The icon group where the icon is going to be used. \item[{\em \_\-force\_\-size}]Override globally configured icon size. Use 0 for the default size \item[{\em \_\-state}]The icon state, one of: {\bf KIcon::Default\-State}, {\bf KIcon::Active\-State} or {\bf KIcon::Disabled\-State}. \item[{\em \_\-path}]Output parameter to get the full path. Seldom needed. Ignored if 0 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the pixmap of the URL, can be a default icon if not found \end{Desc}


Definition at line 486 of file kmimetype.cpp.

References KIcon\-Loader::add\-Extra\-Desktop\-Themes(), KIcon\-Loader::extra\-Desktop\-Themes\-Added(), icon\-For\-URL(), KGlobal::icon\-Loader(), QPixmap::is\-Null(), KIcon\-Loader::load\-Icon(), and pixmap().

Referenced by KURLCombo\-Box::get\-Pixmap(), KURLPixmap\-Provider::pixmap\-For(), and KURLBar\-Item::set\-Icon().\index{KMimeType@{KMime\-Type}!iconForURL@{iconForURL}}
\index{iconForURL@{iconForURL}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMime\-Type::icon\-For\-URL (const {\bf KURL} \& {\em \_\-url}, mode\_\-t {\em \_\-mode} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e1}


The same functionality as {\bf pixmap\-For\-URL()}{\rm (p.\,\pageref{classKMimeType_e0})}, but this method returns the name of the icon to load. 

You'll have to use {\bf KIcon\-Loader} 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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]URL for the file \item[{\em \_\-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 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the name of the icon. The name of a default icon if there is no icon for the mime type \end{Desc}


Definition at line 504 of file kmimetype.cpp.

References default\-Mime\-Type\-Ptr(), fav\-Icon\-For\-URL(), find\-By\-URL(), KProtocol\-Info::icon(), QString::is\-Empty(), and KGlobal::static\-QString().

Referenced by KBookmark\-Group::add\-Bookmark(), KURIFilter\-Data::icon\-Name(), KFile\-Props\-Plugin::KFile\-Props\-Plugin(), KURLBar\-Item\-Dialog::KURLBar\-Item\-Dialog(), and pixmap\-For\-URL().\index{KMimeType@{KMime\-Type}!favIconForURL@{favIconForURL}}
\index{favIconForURL@{favIconForURL}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMime\-Type::fav\-Icon\-For\-URL (const {\bf KURL} \& {\em url})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e2}


Return the \char`\"{}favicon\char`\"{} (see {\tt http://www.favicon.com}) for the given {\tt url}, if available. 

Does NOT attempt to download the favicon, it only returns one that is already available.

If unavailable, returns QString::null. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em url}]the URL of the favicon \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the name of the favicon, or QString::null \end{Desc}


Definition at line 529 of file kmimetype.cpp.

References DCOPRef::call(), KGlobal::config(), DCOPReply::is\-Valid(), and KConfig\-Base::read\-Bool\-Entry().

Referenced by icon\-For\-URL().\index{KMimeType@{KMime\-Type}!comment@{comment}}
\index{comment@{comment}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMime\-Type::comment () const\hspace{0.3cm}{\tt  [inline]}}\label{classKMimeType_a9}


Returns the descriptive comment associated with the MIME type. 

\begin{Desc}
\item[Returns:]the descriptive comment associated with the MIME type \end{Desc}


Reimplemented from {\bf KService\-Type} {\rm (p.\,\pageref{classKServiceType_a6})}.

Definition at line 202 of file kmimetype.h.

Referenced by KDEDesktop\-Mime\-Type::comment(), and KFolder\-Type::comment().\index{KMimeType@{KMime\-Type}!comment@{comment}}
\index{comment@{comment}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QString} KMime\-Type::comment (const {\bf QString} \&, bool) const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKMimeType_a10}


Returns the descriptive comment associated with the MIME type. 

The arguments are unused, but provided so that KMime\-Type derived classes can use them.

\begin{Desc}
\item[Returns:]The descriptive comment associated with the MIME type, if any. \end{Desc}


Reimplemented in {\bf KFolder\-Type} {\rm (p.\,\pageref{classKFolderType_a4})}, and {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_a5})}.

Definition at line 211 of file kmimetype.h.\index{KMimeType@{KMime\-Type}!comment@{comment}}
\index{comment@{comment}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QString} KMime\-Type::comment (const {\bf KURL} \&, bool) const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKMimeType_a11}


Returns the descriptive comment associated with the MIME type. 

The arguments are unused, but provided so that KMime\-Type derived classes can use them.

\begin{Desc}
\item[Returns:]The descriptive comment associated with the MIME type, if any. \end{Desc}


Reimplemented in {\bf KFolder\-Type} {\rm (p.\,\pageref{classKFolderType_a5})}, and {\bf KDEDesktop\-Mime\-Type} {\rm (p.\,\pageref{classKDEDesktopMimeType_a6})}.

Definition at line 220 of file kmimetype.h.\index{KMimeType@{KMime\-Type}!patterns@{patterns}}
\index{patterns@{patterns}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString\-List}\& KMime\-Type::patterns () const\hspace{0.3cm}{\tt  [inline]}}\label{classKMimeType_a12}


Retrieve the list of patterns associated with the MIME Type. 

\begin{Desc}
\item[Returns:]a list of file globs that describe the file names (or, usually, the extensions) of files with this mime type \end{Desc}


Definition at line 227 of file kmimetype.h.\index{KMimeType@{KMime\-Type}!load@{load}}
\index{load@{load}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMime\-Type::load ({\bf QData\-Stream} \& {\em qs})\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a13}


Load the mimetype from a stream. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qs}]the stream to load from \end{description}
\end{Desc}


Reimplemented from {\bf KService\-Type} {\rm (p.\,\pageref{classKServiceType})}.

Definition at line 414 of file kmimetype.cpp.

References KSycoca\-Entry::load().\index{KMimeType@{KMime\-Type}!save@{save}}
\index{save@{save}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMime\-Type::save ({\bf QData\-Stream} \& {\em qs})\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a14}


Save the mimetype to a stream. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qs}]the stream to save to \end{description}
\end{Desc}


Reimplemented from {\bf KService\-Type} {\rm (p.\,\pageref{classKServiceType})}.

Definition at line 426 of file kmimetype.cpp.

References KSycoca\-Entry::save().\index{KMimeType@{KMime\-Type}!property@{property}}
\index{property@{property}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QVariant} KMime\-Type::property (const {\bf QString} \& {\em \_\-name}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a15}


Returns the property with the given {\tt \_\-name}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-name}]the name of the property \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value of the property \end{Desc}
\begin{Desc}
\item[See also:]{\bf property\-Names()}{\rm (p.\,\pageref{classKMimeType_a16})} \end{Desc}


Reimplemented from {\bf KService\-Type} {\rm (p.\,\pageref{classKServiceType_a12})}.

Definition at line 434 of file kmimetype.cpp.

References KService\-Type::property().

Referenced by parent\-Mime\-Type().\index{KMimeType@{KMime\-Type}!propertyNames@{propertyNames}}
\index{propertyNames@{propertyNames}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KMime\-Type::property\-Names () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a16}


Retrieves a list of all properties associated with this KMime\-Type. 

\begin{Desc}
\item[Returns:]a list of all property names \end{Desc}
\begin{Desc}
\item[See also:]{\bf property()}{\rm (p.\,\pageref{classKMimeType_a15})} \end{Desc}


Reimplemented from {\bf KService\-Type} {\rm (p.\,\pageref{classKServiceType_a13})}.

Definition at line 442 of file kmimetype.cpp.

References KService\-Type::property\-Names().\index{KMimeType@{KMime\-Type}!mimeType@{mimeType}}
\index{mimeType@{mimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::mime\-Type (const {\bf QString} \& {\em \_\-name})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e3}


Retrieve a pointer to the mime type {\tt \_\-name} or a pointer to the default mime type \char`\"{}application/octet-stream\char`\"{}. 

0L is {\em never\/} returned.

{\em Very\/} {\em important:\/} Don't store the result in a KMime\-Type$\ast$ !

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-name}]the name of the mime type \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the pointer to the KMime\-Type with the given {\tt \_\-name}, or a pointer to the application/octet-stream KMime\-Type if not found \end{Desc}
\begin{Desc}
\item[See also:]{\bf KService\-Type::service\-Type}{\rm (p.\,\pageref{classKServiceType_e0})} \end{Desc}


Definition at line 141 of file kmimetype.cpp.

References build\-Default\-Type(), and KSycoca\-Entry::is\-Type().

Referenced by KFile\-Tree\-View::add\-Branch(), check\-Essential\-Mime\-Types(), KFile\-Dialog::current\-Filter\-Mime\-Type(), KDir\-Lister::do\-Mime\-Filter(), find\-By\-Content(), find\-By\-File\-Content(), find\-By\-URL(), KService::has\-Service\-Type(), KService::initial\-Preference\-For\-Mime\-Type(), is(), KRun::is\-Executable\-File(), KDesktop\-Props\-Plugin::KDesktop\-Props\-Plugin(), KFile\-Item::KFile\-Item(), KMime\-Type\-Chooser::patterns(), KFile\-Item::pixmap(), KFile\-Item::read\-UDSEntry(), and KFile\-Dialog::update\-Auto\-Select\-Extension().\index{KMimeType@{KMime\-Type}!findByURL@{findByURL}}
\index{findByURL@{findByURL}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::find\-By\-URL (const {\bf KURL} \& {\em \_\-url}, mode\_\-t {\em \_\-mode} = {\tt 0}, bool {\em \_\-is\_\-local\_\-file} = {\tt false}, bool {\em \_\-fast\_\-mode} = {\tt false})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e4}


Finds a KMime\-Type with the given {\tt \_\-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 {\bf KRun}{\rm (p.\,\pageref{classKRun})} instead, but this function returns immediately while {\bf KRun}{\rm (p.\,\pageref{classKRun})} is async. If no extension matches, then the file will be examined if the URL a local file or \char`\"{}application/octet-stream\char`\"{} is returned otherwise.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-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 \char`\"{}http://localhost/mist.gz\#gzip:/decompress\char`\"{} would have to pass the \char`\"{}http://...\char`\"{} URL part, while \char`\"{}file:/tmp/x.tar\#tar:/src/test.gz\#gzip:/decompress\char`\"{} would have to pass the \char`\"{}tar:/...\char`\"{} part of the URL, since gzip is a filter protocol and not a filesystem protocol. \item[{\em \_\-mode}]the mode of the file (used, for example, to identify executables) \item[{\em \_\-is\_\-local\_\-file}]true if the file is local \item[{\em \_\-fast\_\-mode}]If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is {\em fast\/}. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the matching mimetype. 0L is never returned. {\em Very\/} {\em Important:\/} Don't store the result in a KMime\-Type$\ast$ ! \end{Desc}


Definition at line 165 of file kmimetype.cpp.

References check\-Essential\-Mime\-Types(), default\-Mime\-Type(), KProtocol\-Info::default\-Mimetype(), default\-Mime\-Type\-Ptr(), KProtocol\-Info::determine\-Mimetype\-From\-Extension(), QString::ends\-With(), KMime\-Magic::find\-File\-Type(), QString::is\-Empty(), KMime\-Magic\-Result::is\-Valid(), KMime\-Magic\-Result::mime\-Type(), mime\-Type(), KMime\-Magic::self(), and KGlobal::static\-QString().

Referenced by KFile\-Item::determine\-Mime\-Type(), find\-By\-Path(), icon\-For\-URL(), KFile\-Item::init(), KFile\-Props\-Plugin::KFile\-Props\-Plugin(), KImage\-IO::mime\-Type(), KFile\-Item::pixmap(), KIO::Forwarding\-Slave\-Base::prepare\-UDSEntry(), KOpen\-With\-Dlg::set\-Service\-Type(), and KIO::List\-Job::slot\-Finished().\index{KMimeType@{KMime\-Type}!findByPath@{findByPath}}
\index{findByPath@{findByPath}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::find\-By\-Path (const {\bf QString} \& {\em path}, mode\_\-t {\em mode} = {\tt 0}, bool {\em fast\_\-mode} = {\tt false})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e6}


Finds a KMime\-Type with the given {\tt \_\-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 {\bf KRun}{\rm (p.\,\pageref{classKRun})} instead, but this function returns immediately while {\bf KRun}{\rm (p.\,\pageref{classKRun})} is async. If no extension matches, then the file will be examined if the URL a local file or \char`\"{}application/octet-stream\char`\"{} is returned otherwise.

Equivalent to 

\footnotesize\begin{verbatim} KURL u;
 u.setPath(path);
 return findByURL( u, mode, true, fast_mode );
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]the path to the file \item[{\em mode}]the mode of the file (used, for example, to identify executables) \item[{\em fast\_\-mode}]If set to true no disk access is allowed to find out the mimetype. The result may be suboptimal, but it is {\em fast\/}. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the matching mimetype. 0L is never returned. \end{Desc}


Definition at line 304 of file kmimetype.cpp.

References find\-By\-URL(), and KURL::set\-Path().

Referenced by KFilter\-Base::find\-Filter\-By\-File\-Name(), find\-Format\-By\-File\-Content(), and KTar::KTar().\index{KMimeType@{KMime\-Type}!findByContent@{findByContent}}
\index{findByContent@{findByContent}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::find\-By\-Content (const {\bf QByte\-Array} \& {\em data}, int $\ast$ {\em accuracy} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e7}


Tries to find out the MIME type of a data chunk by looking for certain magic numbers and characteristic strings in it. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]the data to examine \item[{\em accuracy}]If not a null pointer, $\ast$accuracy is set to the accuracy of the match (which is in the range 0..100) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a pointer to the KMime\-Type. application/octet-stream's KMime\-Type of the type can not be found this way. \end{Desc}


Definition at line 311 of file kmimetype.cpp.

References KMime\-Magic\-Result::accuracy(), default\-Mime\-Type(), KMime\-Magic::find\-Buffer\-Type(), KMime\-Magic\-Result::is\-Valid(), mime\-Type(), KMime\-Magic\-Result::mime\-Type(), and KMime\-Magic::self().\index{KMimeType@{KMime\-Type}!findByFileContent@{findByFileContent}}
\index{findByFileContent@{findByFileContent}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::find\-By\-File\-Content (const {\bf QString} \& {\em file\-Name}, int $\ast$ {\em accuracy} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e8}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]the path to the file \item[{\em accuracy}]If not a null pointer, $\ast$accuracy is set to the accuracy of the match (which is in the range 0..100) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a pointer to the KMime\-Type. application/octet-stream's KMime\-Type of the type can not be found this way. \end{Desc}


Definition at line 321 of file kmimetype.cpp.

References KMime\-Magic\-Result::accuracy(), default\-Mime\-Type(), KMime\-Magic::find\-File\-Type(), KMime\-Magic\-Result::is\-Valid(), mime\-Type(), KMime\-Magic\-Result::mime\-Type(), and KMime\-Magic::self().

Referenced by find\-Format\-By\-File\-Content(), KFile\-Props\-Plugin::KFile\-Props\-Plugin(), and KTar::KTar().\index{KMimeType@{KMime\-Type}!findFormatByFileContent@{findFormatByFileContent}}
\index{findFormatByFileContent@{findFormatByFileContent}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMime\-Type::Format KMime\-Type::find\-Format\-By\-File\-Content (const {\bf QString} \& {\em file\-Name})\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e9}


Returns whether a file has an internal format that is human readable, or that would be human readable after decompression. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 334 of file kmimetype.cpp.

References find\-By\-File\-Content(), find\-By\-Path(), QVariant::is\-Valid(), QFile::open(), and QVariant::to\-Bool().\index{KMimeType@{KMime\-Type}!allMimeTypes@{allMimeTypes}}
\index{allMimeTypes@{allMimeTypes}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::List} KMime\-Type::all\-Mime\-Types ()\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e10}


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. \begin{Desc}
\item[Returns:]the list of all existing KMime\-Types \end{Desc}


Definition at line 160 of file kmimetype.cpp.

Referenced by KApplication\-Props\-Plugin::KApplication\-Props\-Plugin().\index{KMimeType@{KMime\-Type}!defaultMimeType@{defaultMimeType}}
\index{defaultMimeType@{defaultMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString} \& KMime\-Type::default\-Mime\-Type ()\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e11}


Returns the name of the default mimetype. 

Always application/octet-stream, but this method exists for performance purposes. \begin{Desc}
\item[Returns:]the name of the default mime type, always \char`\"{}application/octet-stream\char`\"{} \end{Desc}


Definition at line 1123 of file kmimetype.cpp.

References KGlobal::static\-QString().

Referenced by build\-Default\-Type(), find\-By\-Content(), find\-By\-File\-Content(), find\-By\-URL(), KFile\-Props\-Plugin::KFile\-Props\-Plugin(), and KMime\-Type\-Chooser::patterns().\index{KMimeType@{KMime\-Type}!defaultMimeTypePtr@{defaultMimeTypePtr}}
\index{defaultMimeTypePtr@{defaultMimeTypePtr}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMime\-Type::Ptr} KMime\-Type::default\-Mime\-Type\-Ptr ()\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e12}


Returns the default mimetype. 

Always application/octet-stream. This can be used to check the result of mime\-Type(name). \begin{Desc}
\item[Returns:]the \char`\"{}application/octet-stream\char`\"{} mimetype pointer. \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 89 of file kmimetype.cpp.

References build\-Default\-Type().

Referenced by find\-By\-URL(), icon\-For\-URL(), and KDesktop\-Props\-Plugin::KDesktop\-Props\-Plugin().\index{KMimeType@{KMime\-Type}!parentMimeType@{parentMimeType}}
\index{parentMimeType@{parentMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMime\-Type::parent\-Mime\-Type () const}\label{classKMimeType_a17}


If this mimetype inherits from (\char`\"{}is also\char`\"{}) 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 \char`\"{}X-KDE-Is\-Also=text/plain\char`\"{}. 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.

\begin{Desc}
\item[Returns:]the parent mime type, or QString::null if not set \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 554 of file kmimetype.cpp.

References property(), and QVariant::to\-String().

Referenced by is().\index{KMimeType@{KMime\-Type}!is@{is}}
\index{is@{is}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMime\-Type::is (const {\bf QString} \& {\em mime\-Type\-Name}) const}\label{classKMimeType_a18}


Do not use {\bf name()}{\rm (p.\,\pageref{classKServiceType_a7})}==\char`\"{}somename\char`\"{} anymore, to check for a given mimetype. 

For mimetype inheritance to work, use is(\char`\"{}somename\char`\"{}) instead. Warning, do not use {\bf inherits()}{\rm (p.\,\pageref{classKServiceType_a11})}, that's the servicetype inheritance concept! \begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 560 of file kmimetype.cpp.

References QString::is\-Empty(), mime\-Type(), KService\-Type::name(), and parent\-Mime\-Type().\index{KMimeType@{KMime\-Type}!errorMissingMimeType@{errorMissingMimeType}}
\index{errorMissingMimeType@{errorMissingMimeType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMime\-Type::error\-Missing\-Mime\-Type (const {\bf QString} \& {\em \_\-type})\hspace{0.3cm}{\tt  [static, protected]}}\label{classKMimeType_f0}


Signal a missing mime type. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-type}]the missinf mime type \end{description}
\end{Desc}


Definition at line 134 of file kmimetype.cpp.

Referenced by build\-Default\-Type(), and check\-Essential\-Mime\-Types().\index{KMimeType@{KMime\-Type}!buildDefaultType@{buildDefaultType}}
\index{buildDefaultType@{buildDefaultType}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMime\-Type::build\-Default\-Type ()\hspace{0.3cm}{\tt  [static, protected]}}\label{classKMimeType_f1}


This function makes sure that the default mime type exists. 



Definition at line 68 of file kmimetype.cpp.

References default\-Mime\-Type(), error\-Missing\-Mime\-Type(), KSycoca\-Entry::is\-Type(), KMime\-Type(), and KStandard\-Dirs::resource\-Dirs().

Referenced by check\-Essential\-Mime\-Types(), default\-Mime\-Type\-Ptr(), and mime\-Type().\index{KMimeType@{KMime\-Type}!checkEssentialMimeTypes@{checkEssentialMimeTypes}}
\index{checkEssentialMimeTypes@{checkEssentialMimeTypes}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMime\-Type::check\-Essential\-Mime\-Types ()\hspace{0.3cm}{\tt  [static, protected]}}\label{classKMimeType_f2}


This function makes sure that vital mime types are installed. 



Definition at line 97 of file kmimetype.cpp.

References build\-Default\-Type(), error\-Missing\-Mime\-Type(), mime\-Type(), and s\_\-b\-Checked.

Referenced by find\-By\-URL().

\subsection{Member Data Documentation}
\index{KMimeType@{KMime\-Type}!s_bChecked@{s\_\-bChecked}}
\index{s_bChecked@{s\_\-bChecked}!KMimeType@{KMime\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool {\bf KMime\-Type::s\_\-b\-Checked} = false\hspace{0.3cm}{\tt  [static, protected]}}\label{classKMimeType_t0}


true if check for vital mime types has been done. 



Definition at line 66 of file kmimetype.cpp.

Referenced by check\-Essential\-Mime\-Types().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmimetype.h\item 
kmimetype.cpp\end{CompactItemize}
