# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KServiceTypeProfile Class Reference

This class holds the offers for a service type (e.g. More...

`#include <kuserprofile.h>`

Collaboration diagram for KServiceTypeProfile:

[legend]
List of all members.

## Public Types

typedef QValueList< KServiceOffer > | OfferList

## Public Member Functions

int | preference (const QString &_service) const
bool | allowAsDefault (const QString &_service) const
OfferList | offers () const

## Static Public Member Functions

KService::Ptr | preferredService (const QString &serviceType, const QString &genericServiceType)
KServiceTypeProfile * | serviceTypeProfile (const QString &servicetype, const QString &genericServiceType=QString::null)
OfferList | offers (const QString &servicetype, const QString &genericServiceType=QString::null)
const QPtrList< KServiceTypeProfile > & | serviceTypeProfiles ()
void | clear ()
| Clear all cached information.
void | setConfigurationMode ()
| This method activates a special mode of KServiceTypeProfile, in which all/all and all/allfiles are excluded from the results of the queries.
bool | configurationMode ()

## Protected Member Functions

| KServiceTypeProfile (const QString &_servicetype, const QString &_genericServiceType=QString::null)
| Constructor is called when the user profile is read for the first time.
void | addService (const QString &_service, int _preference=1, bool _allow_as_default=TRUE)
| Add a service to this profile.

## Detailed Description

This class holds the offers for a service type (e.g.

in old terms "the bindings for a mimetype")

Definition at line 76 of file kuserprofile.h.

## Constructor & Destructor Documentation

KServiceTypeProfile::KServiceTypeProfile | ( | const QString & | _servicetype,
|  | const QString & | _genericServiceType = QString::null
| ) | `[protected]`

| Constructor is called when the user profile is read for the first time. Definition at line 177 of file kuserprofile.cpp. References QPtrList< KServiceTypeProfile >::append().

## Member Function Documentation

int KServiceTypeProfile::preference | ( | const QString & | _service | ) | const

Returns:
  the users preference of this special service or 0 if the service is unknown.

Definition at line 201 of file kuserprofile.cpp.

References QMap< QString, Service >::end(), and QMap< QString, Service >::find().

KService::Ptr KServiceTypeProfile::preferredService | ( | const QString & | serviceType,
|  | const QString & | genericServiceType
| ) | `[static]`

Returns:
  the preferred service (convenience method) for _serviceType and _genericServiceType (Application, type of component, or empty).

preferredService(m,true) is equivalent to preferredService(m,"Application") preferredService(m,false) is equivalent to preferredService(m,QString::null) This call allows e.g. preferredService(m,"KParts/ReadOnlyPart").

Definition at line 284 of file kuserprofile.cpp.

References QValueList::begin(), QValueList::end(), and offers().

Referenced by KRun::runURL().

KServiceTypeProfile * KServiceTypeProfile::serviceTypeProfile | ( | const QString & | servicetype,
|  | const QString & | genericServiceType = QString::null
| ) | `[static]`

Returns:
  the profile for the requested service type.

Definition at line 225 of file kuserprofile.cpp.

References QPtrListIterator::current(), QString::isEmpty(), and KGlobal::staticQString().

Referenced by offers().

KServiceTypeProfile::OfferList KServiceTypeProfile::offers | ( | const QString & | servicetype,
|  | const QString & | genericServiceType = QString::null
| ) | `[static]`

Returns:
  the offers associated with a given servicetype, sorted by preference This is what KTrader uses to get the list of offers, before applying the constraints and preferences.

If `genericServiceType` is specified a list is returned with the offers associated with the combination of the two service types. This is almost like an "foo in ServiceTypes" constraint in the Trader, 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, `servicetype` is the mimetype and `genericServiceType` is "KParts/ReadOnlyPart".

Definition at line 93 of file kuserprofile.cpp.

References QValueList::append(), QValueList::begin(), QValueList::count(), QPtrListIterator::current(), QValueList::end(), QString::isEmpty(), KServiceType::offers(), offers(), and serviceTypeProfile().

Referenced by preferredService(), and KTrader::query().

void KServiceTypeProfile::clear | ( |  | ) | `[inline, static]`

| Clear all cached information. Definition at line 127 of file kuserprofile.h.

void KServiceTypeProfile::setConfigurationMode | ( |  | ) | `[inline, static]`

| This method activates a special mode of KServiceTypeProfile, 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 134 of file kuserprofile.h.

void KServiceTypeProfile::addService | ( | const QString & | _service,
|  | int | _preference = 1,
|  | bool | _allow_as_default = TRUE
| ) | `[protected]`

| Add a service to this profile. Definition at line 194 of file kuserprofile.cpp.

The documentation for this class was generated from the following files:

- kuserprofile.h
- kuserprofile.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:23:05 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001