\section{KService\-Type\-Profile Class Reference}
\label{classKServiceTypeProfile}\index{KServiceTypeProfile@{KServiceTypeProfile}}
KService\-Type\-Profile represents the user's preferences for services of a service type. Represents the user's preferences for services of a service type.  


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

Collaboration diagram for KService\-Type\-Profile:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=231pt]{classKServiceTypeProfile__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef {\bf QValue\-List}$<$ {\bf KService\-Offer} $>$ {\bf Offer\-List}\label{classKServiceTypeProfile_w0}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
int {\bf preference} (const {\bf QString} \&\_\-service) const 
\item 
bool {\bf allow\-As\-Default} (const {\bf QString} \&\_\-service) const 
\item 
{\bf Offer\-List} {\bf offers} () const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KService::Ptr} {\bf preferred\-Service} (const {\bf QString} \&service\-Type, const {\bf QString} \&generic\-Service\-Type)
\item 
static {\bf KService\-Type\-Profile} $\ast$ {\bf service\-Type\-Profile} (const {\bf QString} \&servicetype, const {\bf QString} \&generic\-Service\-Type=QString::null)
\item 
static {\bf Offer\-List} {\bf offers} (const {\bf QString} \&servicetype, const {\bf QString} \&generic\-Service\-Type=QString::null)
\item 
static const {\bf QPtr\-List}$<$ {\bf KService\-Type\-Profile} $>$ \& {\bf service\-Type\-Profiles} ()
\item 
static void {\bf clear} ()
\item 
static void {\bf set\-Configuration\-Mode} ()
\item 
static bool {\bf configuration\-Mode} ()\label{classKServiceTypeProfile_e6}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KService\-Type\-Profile} (const {\bf QString} \&service\-Type, const {\bf QString} \&generic\-Service\-Type=QString::null)
\item 
void {\bf add\-Service} (const {\bf QString} \&\_\-service, int \_\-preference=1, bool \_\-allow\_\-as\_\-default=true)
\end{CompactItemize}


\subsection{Detailed Description}
KService\-Type\-Profile represents the user's preferences for services of a service type. Represents the user's preferences for services of a service type. 

It consists of a list of services (service offers) for the service type that is sorted by the user's preference. {\bf KTrader}{\rm (p.\,\pageref{classKTrader})} uses KService\-Type\-Profile to sort its results, so usually you can just use {\bf KTrader}{\rm (p.\,\pageref{classKTrader})} to find the user's preferred service.

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

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

{\bf KService\-Offer}{\rm (p.\,\pageref{classKServiceOffer})} 

{\bf KTrader}{\rm (p.\,\pageref{classKTrader})} \end{Desc}




Definition at line 117 of file kuserprofile.h.

\subsection{Constructor \& Destructor Documentation}
\index{KServiceTypeProfile@{KService\-Type\-Profile}!KServiceTypeProfile@{KServiceTypeProfile}}
\index{KServiceTypeProfile@{KServiceTypeProfile}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KService\-Type\-Profile::KService\-Type\-Profile (const {\bf QString} \& {\em service\-Type}, const {\bf QString} \& {\em generic\-Service\-Type} = {\tt QString::null})\hspace{0.3cm}{\tt  [protected]}}\label{classKServiceTypeProfile_b0}


Constructor is called when the user profile is read for the first time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service\-Type}]the service type (e.g. a MIME type) \item[{\em generic\-Service\-Type}]the generic service type (e.g. \char`\"{}Application\char`\"{} or \char`\"{}KParts/Read\-Only\-Part\char`\"{}). Can be QString::null, then the \char`\"{}Application\char`\"{} generic type will be used \end{description}
\end{Desc}


Definition at line 189 of file kuserprofile.cpp.

\subsection{Member Function Documentation}
\index{KServiceTypeProfile@{KService\-Type\-Profile}!preference@{preference}}
\index{preference@{preference}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KService\-Type\-Profile::preference (const {\bf QString} \& {\em \_\-service}) const}\label{classKServiceTypeProfile_a1}


Returns the users preference of the given service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-service}]the name of the service to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the user's preference number of the given {\tt \_\-service}, or 0 the service is unknown. \end{Desc}


Definition at line 208 of file kuserprofile.cpp.

References QMap::end(), and QMap::find().\index{KServiceTypeProfile@{KService\-Type\-Profile}!allowAsDefault@{allowAsDefault}}
\index{allowAsDefault@{allowAsDefault}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KService\-Type\-Profile::allow\-As\-Default (const {\bf QString} \& {\em \_\-service}) const}\label{classKServiceTypeProfile_a2}


Checks whether the given {\tt \_\-service} can be used as default. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-service}]the name of the service to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if allowed as default \end{Desc}


Definition at line 217 of file kuserprofile.cpp.

References QMap::end(), QMap::find(), and KService::service\-By\-Name().\index{KServiceTypeProfile@{KService\-Type\-Profile}!offers@{offers}}
\index{offers@{offers}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService\-Type\-Profile::Offer\-List} KService\-Type\-Profile::offers () const}\label{classKServiceTypeProfile_a3}


Returns the list of all service offers for the service types that are represented by this profile. 

\begin{Desc}
\item[Returns:]the list of {\bf KService\-Offer}{\rm (p.\,\pageref{classKServiceOffer})} instances \end{Desc}


Definition at line 249 of file kuserprofile.cpp.

References QValue\-List::append(), QValue\-List::begin(), QMap::end(), QValue\-List::end(), endl(), QMap::find(), QString::is\-Empty(), kd\-Debug(), KService\-Type::offers(), and offers().

Referenced by offers(), preferred\-Service(), and KTrader::query().\index{KServiceTypeProfile@{KService\-Type\-Profile}!preferredService@{preferredService}}
\index{preferredService@{preferredService}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService::Ptr} KService\-Type\-Profile::preferred\-Service (const {\bf QString} \& {\em service\-Type}, const {\bf QString} \& {\em generic\-Service\-Type})\hspace{0.3cm}{\tt  [static]}}\label{classKServiceTypeProfile_e0}


Returns the preferred service for {\tt \_\-service\-Type} and {\tt \_\-generic\-Service\-Type} (\char`\"{}Application\char`\"{}, type of component, or null). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service\-Type}]the service type (e.g. a MIME type) \item[{\em generic\-Service\-Type}]the generic service type (e.g. \char`\"{}Application\char`\"{} or \char`\"{}KParts/Read\-Only\-Part\char`\"{}) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the preferred service, or 0 if no service is available \end{Desc}


Definition at line 292 of file kuserprofile.cpp.

References QValue\-List::begin(), QValue\-List::end(), and offers().

Referenced by KRun::run\-URL().\index{KServiceTypeProfile@{KService\-Type\-Profile}!serviceTypeProfile@{serviceTypeProfile}}
\index{serviceTypeProfile@{serviceTypeProfile}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService\-Type\-Profile} $\ast$ KService\-Type\-Profile::service\-Type\-Profile (const {\bf QString} \& {\em servicetype}, const {\bf QString} \& {\em generic\-Service\-Type} = {\tt QString::null})\hspace{0.3cm}{\tt  [static]}}\label{classKServiceTypeProfile_e1}


Returns the profile for the requested service type. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em servicetype}]the service type (e.g. a MIME type) \item[{\em generic\-Service\-Type}]the generic service type (e.g. \char`\"{}Application\char`\"{} or \char`\"{}KParts/Read\-Only\-Part\char`\"{}). Can be QString::null, then the \char`\"{}Application\char`\"{} generic type will be used \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the KService\-Type\-Profile with the given arguments, or 0 if not found \end{Desc}


Definition at line 232 of file kuserprofile.cpp.

References QPtr\-List\-Iterator::current(), and KGlobal::static\-QString().

Referenced by offers().\index{KServiceTypeProfile@{KService\-Type\-Profile}!offers@{offers}}
\index{offers@{offers}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KService\-Type\-Profile::Offer\-List} KService\-Type\-Profile::offers (const {\bf QString} \& {\em servicetype}, const {\bf QString} \& {\em generic\-Service\-Type} = {\tt QString::null})\hspace{0.3cm}{\tt  [static]}}\label{classKServiceTypeProfile_e2}


Returns the offers associated with a given servicetype, sorted by preference. 

This is what {\bf KTrader}{\rm (p.\,\pageref{classKTrader})} uses to get the list of offers, before applying the constraints and preferences.

If {\tt generic\-Service\-Type} is specified, a list is returned with the offers associated with the combination of the two service types. This is almost like an \char`\"{}foo in Service\-Types\char`\"{} constraint in the {\bf KTrader}{\rm (p.\,\pageref{classKTrader})}, but the difference is that to order the offers, we will look at entries specifically for those two service types. Typically, this is used for getting the list of embeddable components that can handle a given mimetype. In that case, {\tt servicetype} is the mimetype and {\tt generic\-Service\-Type} is \char`\"{}KParts/Read\-Only\-Part\char`\"{}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em servicetype}]the service type (e.g. a MIME type) \item[{\em generic\-Service\-Type}]the generic service type (e.g. \char`\"{}Application\char`\"{} or \char`\"{}KParts/Read\-Only\-Part\char`\"{}). Can be QString::null, then all generic types will be included \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the list of offers witht he given parameters \end{Desc}


Definition at line 105 of file kuserprofile.cpp.

References QValue\-List::append(), QValue\-List::begin(), QPtr\-List\-Iterator::current(), QValue\-List::end(), endl(), kd\-Debug(), KService\-Type::offers(), offers(), and service\-Type\-Profile().\index{KServiceTypeProfile@{KService\-Type\-Profile}!serviceTypeProfiles@{serviceTypeProfiles}}
\index{serviceTypeProfiles@{serviceTypeProfiles}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static const {\bf QPtr\-List}$<${\bf KService\-Type\-Profile}$>$\& KService\-Type\-Profile::service\-Type\-Profiles ()\hspace{0.3cm}{\tt  [inline, static]}}\label{classKServiceTypeProfile_e3}


Returns a list of all KService\-Type\-Profiles. 

\begin{Desc}
\item[Returns:]a list of all KService\-Type\-Profiles \end{Desc}


Definition at line 192 of file kuserprofile.h.\index{KServiceTypeProfile@{KService\-Type\-Profile}!clear@{clear}}
\index{clear@{clear}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KService\-Type\-Profile::clear ()\hspace{0.3cm}{\tt  [static]}}\label{classKServiceTypeProfile_e4}


Clear all cached information. 



Definition at line 99 of file kuserprofile.cpp.

References KStatic\-Deleter$<$ type $>$::destruct\-Object().\index{KServiceTypeProfile@{KService\-Type\-Profile}!setConfigurationMode@{setConfigurationMode}}
\index{setConfigurationMode@{setConfigurationMode}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static void KService\-Type\-Profile::set\-Configuration\-Mode ()\hspace{0.3cm}{\tt  [inline, static]}}\label{classKServiceTypeProfile_e5}


This method activates a special mode of KService\-Type\-Profile, in which all/all and all/allfiles are excluded from the results of the queries. 

It is meant for the configuration module \_\-only\_\-. 

Definition at line 205 of file kuserprofile.h.\index{KServiceTypeProfile@{KService\-Type\-Profile}!addService@{addService}}
\index{addService@{addService}!KServiceTypeProfile@{KService\-Type\-Profile}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KService\-Type\-Profile::add\-Service (const {\bf QString} \& {\em \_\-service}, int {\em \_\-preference} = {\tt 1}, bool {\em \_\-allow\_\-as\_\-default} = {\tt true})\hspace{0.3cm}{\tt  [protected]}}\label{classKServiceTypeProfile_b1}


Add a service to this profile. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-service}]the name of the service \item[{\em \_\-preference}]the user's preference value, must be positive, bigger is better \item[{\em \_\-allow\_\-as\_\-default}]true if the service should be used as default \end{description}
\end{Desc}


Definition at line 201 of file kuserprofile.cpp.

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