\section{KMime\-Type Class Reference}
\label{classKMimeType}\index{KMimeType@{KMimeType}}
Represent a mime type, like \char`\"{}text/plain\char`\"{}.  


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

Inheritance diagram for KMime\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=188pt]{classKMimeType__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KMime\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=255pt]{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)
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item 
{\bf KMime\-Type} (const  {\bf QString} \&\_\-fullpath)
\begin{CompactList}\small\item\em Construct a mimetype and take all information from a config file. \item\end{CompactList}\item 
{\bf KMime\-Type} ({\bf KDesktop\-File} $\ast$config)
\begin{CompactList}\small\item\em Construct a mimetype and take all information from a desktop file. \item\end{CompactList}\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 
\begin{CompactList}\small\item\em Return the filename of the icon associated with the mimetype. \item\end{CompactList}\item 
virtual {\bf QString} {\bf icon} (const  {\bf KURL} \&, bool) const 
\begin{CompactList}\small\item\em This function differs from the above only in that a {\bf KURL} may be provided instead of a {\bf QString} for convenience. \item\end{CompactList}\item 
virtual {\bf QPixmap} {\bf pixmap} ({\bf KIcon::Group} \_\-group, int \_\-force\_\-size=0, int \_\-state=0, {\bf QString} $\ast$\_\-path=0L) const 
\begin{CompactList}\small\item\em Use this function only if you don't have a special URL for which you search a pixmap. \item\end{CompactList}\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 
\begin{CompactList}\small\item\em Find the pixmap for a given file of this mimetype. \item\end{CompactList}\item 
{\bf QString} {\bf comment} () const 
\item 
virtual {\bf QString} {\bf comment} (const  {\bf QString} \&, bool) const 
\begin{CompactList}\small\item\em The arguments are unused, but provided so that KMime\-Type derived classes can use them. \item\end{CompactList}\item 
virtual {\bf QString} {\bf comment} (const  {\bf KURL} \&, bool) const 
\begin{CompactList}\small\item\em This function differs from the above only in that a {\bf KURL} may be provided instead of a {\bf QString} for convenience. \item\end{CompactList}\item 
const  {\bf QString\-List} \& {\bf patterns} () const 
\begin{CompactList}\small\item\em Retrieve the list of patterns associated with the MIME Type. \item\end{CompactList}\item 
virtual void {\bf load} ({\bf QData\-Stream} \&)
\begin{CompactList}\small\item\em Load the mimetype from a stream. \item\end{CompactList}\item 
virtual void {\bf save} ({\bf QData\-Stream} \&)
\begin{CompactList}\small\item\em Save the mimetype to a stream. \item\end{CompactList}\item 
virtual {\bf QVariant} {\bf property} (const  {\bf QString} \&\_\-name) const \label{classKMimeType_a15}

\item 
virtual {\bf QString\-List} {\bf property\-Names} () const \label{classKMimeType_a16}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QPixmap} {\bf pixmap\-For\-URL} (const  {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0, {\bf KIcon::Group} \_\-group=KIcon::Desktop, int \_\-force\_\-size=0, int \_\-state=0, {\bf QString} $\ast$\_\-path=0L)
\begin{CompactList}\small\item\em Convenience method to find the pixmap for a URL. \item\end{CompactList}\item 
{\bf QString} {\bf icon\-For\-URL} (const  {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0)
\begin{CompactList}\small\item\em The same functionality as pixmap\-For\-URL, but this method returns the name of the icon to load. \item\end{CompactList}\item 
{\bf QString} {\bf fav\-Icon\-For\-URL} (const  {\bf KURL} \&url)
\item 
{\bf Ptr} {\bf mime\-Type} (const  {\bf QString} \&\_\-name)
\begin{CompactList}\small\item\em Retrieve a pointer to the mime type {\tt \_\-name} or a pointer to the default mime type \char`\"{}application/octet-stream\char`\"{}. \item\end{CompactList}\item 
{\bf Ptr} {\bf find\-By\-URL} (const  {\bf KURL} \&\_\-url, mode\_\-t \_\-mode=0, bool \_\-is\_\-local\_\-file=false, bool \_\-fast\_\-mode=false)
\begin{CompactList}\small\item\em This function looks at mode\_\-t first. \item\end{CompactList}\item 
{\bf Ptr} {\bf find\-By\-Path} (const  {\bf QString} \&path, mode\_\-t mode=0, bool fast\_\-mode=false)
\begin{CompactList}\small\item\em Same as find\-By\-URL but for local files only - convenience method. \item\end{CompactList}\item 
{\bf Ptr} {\bf find\-By\-Content} (const  {\bf QByte\-Array} \&data, int $\ast$accuracy=0)
\begin{CompactList}\small\item\em Tries to find out the MIME type of a data chunk by looking for certain magic numbers and characteristic strings in it. \item\end{CompactList}\item 
{\bf Ptr} {\bf find\-By\-File\-Content} (const  {\bf QString} \&file\-Name, int $\ast$accuracy=0)
\begin{CompactList}\small\item\em Tries to find out the MIME type of a file by looking for certain magic numbers and characteristic strings in it. \item\end{CompactList}\item 
{\bf List} {\bf all\-Mime\-Types} ()
\begin{CompactList}\small\item\em Get all the mimetypes. \item\end{CompactList}\item 
const  {\bf QString} \& {\bf default\-Mime\-Type} ()
\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 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKMimeType_b2}

\end{CompactItemize}
\subsection*{Static Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf error\-Missing\-Mime\-Type} (const  {\bf QString} \&\_\-type)
\begin{CompactList}\small\item\em Signal a missing mime type. \item\end{CompactList}\item 
void {\bf build\-Default\-Type} ()
\begin{CompactList}\small\item\em This function makes sure that the default mime type exists. \item\end{CompactList}\item 
void {\bf check\-Essential\-Mime\-Types} ()
\begin{CompactList}\small\item\em This function makes sure that vital mime types are installed. \item\end{CompactList}\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 
bool {\bf s\_\-b\-Checked} = false
\begin{CompactList}\small\item\em Returns {\tt true} if check for vital mime types has been done. \item\end{CompactList}\item 
{\bf Ptr} {\bf s\_\-p\-Default\-Type} = 0L\label{classKMimeType_t1}

\end{CompactItemize}


\subsection{Detailed Description}
Represent a mime type, like \char`\"{}text/plain\char`\"{}. 

The starting point you need is often the static methods. See also {\bf KService\-Type}{\rm (p.\,\pageref{classKServiceType})}. 



Definition at line 43 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. 

Definition at line 280 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. 



Definition at line 287 of file kmimetype.cpp.

References KSycoca\-Entry::is\-Valid().\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. 



Definition at line 296 of file kmimetype.cpp.

References KSycoca\-Entry::is\-Valid().

\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 87 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}


This function differs from the above only in that a {\bf KURL} may be provided instead of a {\bf QString} for convenience. 



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

Definition at line 93 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} = 0, int {\em \_\-state} = 0, {\bf QString} $\ast$ {\em \_\-path} = 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. \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. \end{description}
\end{Desc}


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

Definition at line 361 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} = 0, int {\em \_\-state} = 0, {\bf QString} $\ast$ {\em \_\-path} = 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. \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. \end{description}
\end{Desc}


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

Definition at line 377 of file kmimetype.cpp.

References KIcon\-Loader::add\-Extra\-Desktop\-Themes(), KIcon\-Loader::extra\-Desktop\-Themes\-Added(), KService\-Type::icon(), KGlobal::icon\-Loader(), KURL::is\-Local\-File(), 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} = 0, {\bf KIcon::Group} {\em \_\-group} = KIcon::Desktop, int {\em \_\-force\_\-size} = 0, int {\em \_\-state} = 0, {\bf QString} $\ast$ {\em \_\-path} = 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 \_\-group}]The icon group where the icon is going to be used. \item[{\em \_\-force\_\-size}]Override globally configured icon 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. \end{description}
\end{Desc}


Definition at line 393 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(), KFile\-Dialog::init(), 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} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e1}


The same functionality as pixmap\-For\-URL, 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. 

Definition at line 411 of file kmimetype.cpp.

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

Referenced by KRecent\-Document::add(), 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}


\begin{Desc}
\item[Returns:]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.\end{Desc}
If unavailable, returns QString::null. 

Definition at line 428 of file kmimetype.cpp.

References KGlobal::config(), KURL::is\-Local\-File(), KURL::protocol(), KConfig\-Base::read\-Bool\-Entry(), and QString::starts\-With().

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}


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


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

Definition at line 164 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}


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 172 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}


This function differs from the above only in that a {\bf KURL} may be provided instead of a {\bf QString} for convenience. 



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

Definition at line 178 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. 



Definition at line 183 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} \&)\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a13}


Load the mimetype from a stream. 



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

Definition at line 321 of file kmimetype.cpp.

References KService\-Type::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} \&)\hspace{0.3cm}{\tt  [virtual]}}\label{classKMimeType_a14}


Save the mimetype to a stream. 



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

Definition at line 333 of file kmimetype.cpp.

References KService\-Type::save().\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[See also:]{\bf KService\-Type::service\-Type}{\rm (p.\,\pageref{classKServiceType_e0})} \end{Desc}


Definition at line 131 of file kmimetype.cpp.

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

Referenced by KFile\-Tree\-View::add\-Branch(), check\-Essential\-Mime\-Types(), KFile\-Dialog::current\-Filter\-Mime\-Type(), find\-By\-Content(), find\-By\-File\-Content(), find\-By\-URL(), KFile\-Item::KFile\-Item(), and KFile\-Item::pixmap().\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} = 0, bool {\em \_\-is\_\-local\_\-file} = false, bool {\em \_\-fast\_\-mode} = false)\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e4}


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 {\bf KMime\-Magic}{\rm (p.\,\pageref{classKMimeMagic})} is used 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 \_\-fast\_\-mode}]If set to {\tt 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 {\em never\/} returned. {\em Very\/} {\em Important\/}: Don't store the result in a KMime\-Type$\ast$ ! \end{Desc}


Definition at line 152 of file kmimetype.cpp.

References check\-Essential\-Mime\-Types(), default\-Mime\-Type(), KProtocol\-Info::default\-Mimetype(), KProtocol\-Info::determine\-Mimetype\-From\-Extension(), QFile::encode\-Name(), QString::ends\-With(), KURL::file\-Name(), KMime\-Magic::find\-File\-Type(), QString::from\-Latin1(), QString::is\-Empty(), KURL::is\-Local\-File(), QString::is\-Null(), KMime\-Magic\-Result::is\-Valid(), KMime\-Magic\-Result::mime\-Type(), mime\-Type(), KURL::path(), KURL::protocol(), KMime\-Magic::self(), KIO::stat(), 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(), and KOpen\-With\-Dlg::set\-Service\-Type().\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} = 0, bool {\em fast\_\-mode} = false)\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e5}


Same as find\-By\-URL but for local files only - convenience method. 

Equivalent to {\bf KURL} u; u.set\-Path(path); return find\-By\-URL( u, mode, true, fast\_\-mode ); 

Definition at line 253 of file kmimetype.cpp.

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

Referenced by KFilter\-Base::find\-Filter\-By\-File\-Name(), KFile\-Meta\-Info::KFile\-Meta\-Info(), 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} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e6}


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

Returns application/octet-stream of the type can not be found this way. If accuracy is not a null pointer, $\ast$accuracy is set to the accuracy of the match (which is in the range 0..100). 

Definition at line 260 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} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKMimeType_e7}


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. If accuracy is not a null pointer, $\ast$accuracy is set to the accuracy of the match (which is in the range 0..100). 

Definition at line 270 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 KFile\-Props\-Plugin::KFile\-Props\-Plugin(), and KTar::KTar().\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_e8}


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. 

Definition at line 147 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_e9}


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


Definition at line 948 of file kmimetype.cpp.

References KGlobal::static\-QString().

Referenced by build\-Default\-Type(), find\-By\-Content(), find\-By\-File\-Content(), find\-By\-URL(), icon\-For\-URL(), KFile\-Item::init(), and KFile\-Props\-Plugin::KFile\-Props\-Plugin().\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. 



Definition at line 124 of file kmimetype.cpp.

References KMessage\-Box::sorry().

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 65 of file kmimetype.cpp.

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

Referenced by check\-Essential\-Mime\-Types(), 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 87 of file kmimetype.cpp.

References build\-Default\-Type(), KMessage\-Box::error(), 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}


Returns {\tt true} if check for vital mime types has been done. 



Definition at line 63 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}
