\section{KService\-Type Class Reference}
\label{classKServiceType}\index{KServiceType@{KServiceType}}
A service type is the generic notion for a mimetype, a type of service instead of a type of file.  


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

Inheritance diagram for KService\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=178pt]{classKServiceType__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KService\-Type:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=299pt]{classKServiceType__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef {\bf KShared\-Ptr}$<$ {\bf KService\-Type} $>$ {\bf Ptr}\label{classKServiceType_w0}

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

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

\item 
{\bf QString} {\bf icon} () const 
\item 
{\bf QString} {\bf comment} () const 
\item 
{\bf QString} {\bf name} () const 
\item 
{\bf QString} {\bf desktop\-Entry\-Path} () const 
\item 
bool {\bf is\-Derived} () const 
\item 
{\bf QString} {\bf parent\-Service\-Type} () const 
\item 
bool {\bf inherits} (const {\bf QString} \&serv\-Type\-Name) const 
\item 
virtual {\bf QVariant} {\bf property} (const {\bf QString} \&\_\-name) const 
\item 
virtual {\bf QString\-List} {\bf property\-Names} () const 
\item 
bool {\bf is\-Valid} () const 
\item 
virtual QVariant::Type {\bf property\-Def} (const {\bf QString} \&\_\-name) const 
\item 
virtual {\bf QString\-List} {\bf property\-Def\-Names} () const \label{classKServiceType_a16}

\item 
virtual const {\bf QMap}$<$ {\bf QString}, QVariant::Type $>$ \& {\bf property\-Defs} () const \label{classKServiceType_a17}

\item 
virtual void {\bf save} ({\bf QData\-Stream} \&)\label{classKServiceType_a18}

\item 
virtual void {\bf load} ({\bf QData\-Stream} \&)\label{classKServiceType_a19}

\item 
{\bf Ptr} {\bf parent\-Type} ()\label{classKServiceType_a20}

\item 
void {\bf add\-Service} ({\bf KService::Ptr} service)\label{classKServiceType_a21}

\item 
{\bf KService::List} {\bf services} ()\label{classKServiceType_a22}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf Ptr} {\bf service\-Type} (const {\bf QString} \&\_\-name)
\item 
static {\bf KService::List} {\bf offers} (const {\bf QString} \&\_\-servicetype)
\item 
static {\bf List} {\bf all\-Service\-Types} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf init} ({\bf KDesktop\-File} $\ast$config)\label{classKServiceType_b0}

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

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf QString} {\bf m\_\-str\-Name}\label{classKServiceType_p0}

\item 
{\bf QString} {\bf m\_\-str\-Icon}\label{classKServiceType_p1}

\item 
{\bf QString} {\bf m\_\-str\-Comment}\label{classKServiceType_p2}

\item 
{\bf QMap}$<$ {\bf QString}, {\bf QVariant} $>$ {\bf m\_\-map\-Props}\label{classKServiceType_p3}

\item 
{\bf QMap}$<$ {\bf QString}, QVariant::Type $>$ {\bf m\_\-map\-Prop\-Defs}\label{classKServiceType_p4}

\item 
bool {\bf m\_\-b\-Valid}:1\label{classKServiceType_p5}

\item 
bool {\bf m\_\-b\-Derived}:1\label{classKServiceType_p6}

\end{CompactItemize}


\subsection{Detailed Description}
A service type is the generic notion for a mimetype, a type of service instead of a type of file. 

For instance, KOffice\-Filter is a service type. It is associated to services according to the user profile ({\bf kuserprofile.h}{\rm (p.\,\pageref{kuserprofile_8h})}). Service types are stored as desktop files in \$KDEHOME/share/servicetypes. \begin{Desc}
\item[See also:]{\bf KService}{\rm (p.\,\pageref{classKService})} \end{Desc}




Definition at line 45 of file kservicetype.h.

\subsection{Constructor \& Destructor Documentation}
\index{KServiceType@{KService\-Type}!KServiceType@{KServiceType}}
\index{KServiceType@{KServiceType}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KService\-Type::KService\-Type (const {\bf QString} \& {\em \_\-fullpath}, const {\bf QString} \& {\em \_\-name}, const {\bf QString} \& {\em \_\-icon}, const {\bf QString} \& {\em \_\-comment})}\label{classKServiceType_a0}


Constructor. 

You may pass in arguments to create a servicetype with specific properties. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-fullpath}]the path of the service type's desktop file \item[{\em \_\-name}]the name of the service type \item[{\em \_\-icon}]the icon name of the service type (can be null) \item[{\em \_\-comment}]a comment (can be null) \end{description}
\end{Desc}


Definition at line 109 of file kservicetype.cpp.

References QString::is\-Empty().\index{KServiceType@{KService\-Type}!KServiceType@{KServiceType}}
\index{KServiceType@{KServiceType}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KService\-Type::KService\-Type (const {\bf QString} \& {\em \_\-fullpath})}\label{classKServiceType_a1}


Construct a service type and take all informations from a config file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-fullpath}]path of the desktop file, set to \char`\"{}\char`\"{} if calling from a inherited constructor. \end{description}
\end{Desc}


Definition at line 43 of file kservicetype.cpp.\index{KServiceType@{KService\-Type}!KServiceType@{KServiceType}}
\index{KServiceType@{KServiceType}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KService\-Type::KService\-Type ({\bf KDesktop\-File} $\ast$ {\em config})}\label{classKServiceType_a2}


Construct a service type and take all informations from a deskop file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]the configuration file \end{description}
\end{Desc}


Definition at line 51 of file kservicetype.cpp.

\subsection{Member Function Documentation}
\index{KServiceType@{KService\-Type}!icon@{icon}}
\index{icon@{icon}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KService\-Type::icon () const\hspace{0.3cm}{\tt  [inline]}}\label{classKServiceType_a5}


Returns the icon associated with this service type. 

Some derived classes offer special functions which take for example an URL and returns a special icon for this URL. An example is {\bf KMime\-Type}{\rm (p.\,\pageref{classKMimeType})}, {\bf KFolder\-Type}{\rm (p.\,\pageref{classKFolderType})} and others. \begin{Desc}
\item[Returns:]the name of the icon, can be QString::null. \end{Desc}


Definition at line 94 of file kservicetype.h.

Referenced by KDEDesktop\-Mime\-Type::icon(), KFolder\-Type::icon(), KDEDesktop\-Mime\-Type::pixmap(), and KMime\-Type::pixmap().\index{KServiceType@{KService\-Type}!comment@{comment}}
\index{comment@{comment}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KService\-Type::comment () const\hspace{0.3cm}{\tt  [inline]}}\label{classKServiceType_a6}


Returns the descriptive comment associated, if any. 

\begin{Desc}
\item[Returns:]the comment, or QString::null \end{Desc}


Reimplemented in {\bf KMime\-Type} {\rm (p.\,\pageref{classKMimeType_a9})}.

Definition at line 100 of file kservicetype.h.\index{KServiceType@{KService\-Type}!name@{name}}
\index{name@{name}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KService\-Type::name () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKServiceType_a7}


Returns the name of this service type. 

\begin{Desc}
\item[Returns:]the name of the service type \end{Desc}


Implements {\bf KSycoca\-Entry}.

Definition at line 106 of file kservicetype.h.

Referenced by inherits(), and KMime\-Type::is().\index{KServiceType@{KService\-Type}!desktopEntryPath@{desktopEntryPath}}
\index{desktopEntryPath@{desktopEntryPath}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KService\-Type::desktop\-Entry\-Path () const\hspace{0.3cm}{\tt  [inline]}}\label{classKServiceType_a8}


Returns the relative path to the desktop entry file responsible for this servicetype. 

For instance inode/directory.desktop, or kpart.desktop \begin{Desc}
\item[Returns:]the path of the desktop file \end{Desc}


Definition at line 114 of file kservicetype.h.

References KSycoca\-Entry::entry\-Path().\index{KServiceType@{KService\-Type}!isDerived@{isDerived}}
\index{isDerived@{isDerived}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KService\-Type::is\-Derived () const\hspace{0.3cm}{\tt  [inline]}}\label{classKServiceType_a9}


Checks whether this service type inherits another one. 

\begin{Desc}
\item[Returns:]true if this service type inherits another one \end{Desc}
\begin{Desc}
\item[See also:]{\bf parent\-Service\-Type()}{\rm (p.\,\pageref{classKServiceType_a10})} \end{Desc}


Definition at line 121 of file kservicetype.h.\index{KServiceType@{KService\-Type}!parentServiceType@{parentServiceType}}
\index{parentServiceType@{parentServiceType}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KService\-Type::parent\-Service\-Type () const}\label{classKServiceType_a10}


If this service type inherits from another service type, return the name of the parent. 

\begin{Desc}
\item[Returns:]the parent service type, or {\bf QString}:: null if not set \end{Desc}
\begin{Desc}
\item[See also:]{\bf is\-Derived()}{\rm (p.\,\pageref{classKServiceType_a9})} \end{Desc}


Definition at line 151 of file kservicetype.cpp.

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

Referenced by inherits().\index{KServiceType@{KService\-Type}!inherits@{inherits}}
\index{inherits@{inherits}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KService\-Type::inherits (const {\bf QString} \& {\em serv\-Type\-Name}) const}\label{classKServiceType_a11}


Checks whether this service type is or inherits from {\tt serv\-Type\-Name}. 

\begin{Desc}
\item[Returns:]true if this servicetype is or inherits from {\tt serv\-Type\-Name} \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 157 of file kservicetype.cpp.

References QString::is\-Empty(), name(), parent\-Service\-Type(), and service\-Type().\index{KServiceType@{KService\-Type}!property@{property}}
\index{property@{property}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QVariant} KService\-Type::property (const {\bf QString} \& {\em \_\-name}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKServiceType_a12}


Returns the requested property. 

Some often used properties have convenience access functions like {\bf name()}{\rm (p.\,\pageref{classKServiceType_a7})}, {\bf comment()}{\rm (p.\,\pageref{classKServiceType_a6})} etc.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-name}]the name of the property \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the property, or invalid if not found \end{Desc}


Reimplemented in {\bf KMime\-Type} {\rm (p.\,\pageref{classKMimeType_a15})}.

Definition at line 174 of file kservicetype.cpp.

References QMap::end(), and QMap::find().

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


Returns the list of all properties of this service type. 

\begin{Desc}
\item[Returns:]the list of properties \end{Desc}


Reimplemented in {\bf KMime\-Type} {\rm (p.\,\pageref{classKMimeType_a16})}.

Definition at line 194 of file kservicetype.cpp.

References QMap::begin(), and QMap::end().

Referenced by KMime\-Type::property\-Names().\index{KServiceType@{KService\-Type}!isValid@{isValid}}
\index{isValid@{isValid}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KService\-Type::is\-Valid () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKServiceType_a14}


Checks whether the service type is valid. 

\begin{Desc}
\item[Returns:]true if the service is valid (e.g. name is not empty) \end{Desc}


Implements {\bf KSycoca\-Entry}.

Definition at line 158 of file kservicetype.h.

Referenced by KMime\-Type::KMime\-Type().\index{KServiceType@{KService\-Type}!propertyDef@{propertyDef}}
\index{propertyDef@{propertyDef}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}QVariant::Type KService\-Type::property\-Def (const {\bf QString} \& {\em \_\-name}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKServiceType_a15}


Returns the type of 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 property type, or null if not found \end{Desc}


Definition at line 210 of file kservicetype.cpp.

References QMap::end(), and QMap::find().\index{KServiceType@{KService\-Type}!serviceType@{serviceType}}
\index{serviceType@{serviceType}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService\-Type::Ptr} KService\-Type::service\-Type (const {\bf QString} \& {\em \_\-name})\hspace{0.3cm}{\tt  [static]}}\label{classKServiceType_e0}


Returns a pointer to the servicetype '\_\-name' or 0L if the service type is unknown. 

VERY IMPORTANT : don't store the result in a KService\-Type $\ast$ ! \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-name}]the name of the service type to search \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the pointer to the service type, or 0 \end{Desc}


Definition at line 230 of file kservicetype.cpp.

Referenced by KService::has\-Service\-Type(), inherits(), and KService::initial\-Preference\-For\-Mime\-Type().\index{KServiceType@{KService\-Type}!offers@{offers}}
\index{offers@{offers}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService::List} KService\-Type::offers (const {\bf QString} \& {\em \_\-servicetype})\hspace{0.3cm}{\tt  [static]}}\label{classKServiceType_e1}


Returns all services supporting the given servicetype name. 

This doesn't take care of the user profile. In fact it is used by {\bf KService\-Type\-Profile}{\rm (p.\,\pageref{classKServiceTypeProfile})}, which is used by {\bf KTrader}{\rm (p.\,\pageref{classKTrader})}, and that's the one you should use. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-servicetype}]the name of the service type to search \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the list of all services of the given type \end{Desc}


Definition at line 251 of file kservicetype.cpp.

References endl(), QString::is\-Empty(), kd\-Warning(), and KSycoca\-Entry::offset().

Referenced by KService\-Type\-Profile::offers().\index{KServiceType@{KService\-Type}!allServiceTypes@{allServiceTypes}}
\index{allServiceTypes@{allServiceTypes}!KServiceType@{KService\-Type}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService\-Type::List} KService\-Type::all\-Service\-Types ()\hspace{0.3cm}{\tt  [static]}}\label{classKServiceType_e2}


Returns a list of all the supported servicetypes. 

Useful for showing the list of available servicetypes in a listbox, for example. More memory consuming than the ones above, don't use unless really necessary. \begin{Desc}
\item[Returns:]the list of all services \end{Desc}


Definition at line 320 of file kservicetype.cpp.

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