KServiceOffer

Search for usage in LXR

KServiceOffer Class Reference

#include <kserviceoffer.h>

Public Member Functions

 KServiceOffer ()
 
 KServiceOffer (const KService::Ptr &service, int pref, int mimeTypeInheritanceLevel)
 
 KServiceOffer (const KServiceOffer &)
 
bool isValid () const
 
int mimeTypeInheritanceLevel () const
 
bool operator< (const KServiceOffer &) const
 
KServiceOfferoperator= (const KServiceOffer &other)
 
int preference () const
 
KService::Ptr service () const
 
void setMimeTypeInheritanceLevel (int level)
 
void setPreference (int p)
 

Detailed Description

Holds the user's preference of a service.

This class holds the user-specific preferences of a service (whether it can be a default offer or not, how big is the preference for this offer, ...). Basically it is a reference to a KService, a number that represents the user's preference (bigger is better) and a flag whether the KService can be used as default.

See also
KService

Definition at line 30 of file kserviceoffer.h.

Constructor & Destructor Documentation

◆ KServiceOffer() [1/3]

KServiceOffer::KServiceOffer ( )

Create an invalid service offer.

Definition at line 28 of file kserviceoffer.cpp.

◆ KServiceOffer() [2/3]

KServiceOffer::KServiceOffer ( const KServiceOffer & _o)

Copy constructor.

Shallow copy (the KService will not be copied).

Definition at line 33 of file kserviceoffer.cpp.

◆ KServiceOffer() [3/3]

KServiceOffer::KServiceOffer ( const KService::Ptr & service,
int pref,
int mimeTypeInheritanceLevel )

Creates a new KServiceOffer.

Parameters
servicea pointer to the KService
prefthe user's preference value, must be positive, bigger is better
mimeTypeInheritanceLevellevel of MIME type inheritance which allows this service to handling the MIME type. 0 if no inheritance involved, 1 for parent MIME type, etc.
Since
5.71

Definition at line 39 of file kserviceoffer.cpp.

Member Function Documentation

◆ isValid()

bool KServiceOffer::isValid ( ) const

Check whether the entry is valid.

A service is valid if its preference value is positive.

Returns
true if the service offer is valid

Definition at line 88 of file kserviceoffer.cpp.

◆ mimeTypeInheritanceLevel()

int KServiceOffer::mimeTypeInheritanceLevel ( ) const

Mimetype inheritance level.

Definition at line 98 of file kserviceoffer.cpp.

◆ operator<()

bool KServiceOffer::operator< ( const KServiceOffer & _o) const

A service is bigger that the other when it can be default (and the other is not) and its preference value it higher.

Definition at line 59 of file kserviceoffer.cpp.

◆ operator=()

KServiceOffer & KServiceOffer::operator= ( const KServiceOffer & other)

Assignment operator.

Definition at line 49 of file kserviceoffer.cpp.

◆ preference()

int KServiceOffer::preference ( ) const

The bigger this number is, the better is this service.

Returns
the preference number (negative numbers will be returned by invalid service offers)

Definition at line 73 of file kserviceoffer.cpp.

◆ service()

KService::Ptr KServiceOffer::service ( ) const

The service which this offer is about.

Returns
the service this offer is about, can be nullptr in valid offers or when not set

Definition at line 83 of file kserviceoffer.cpp.

◆ setMimeTypeInheritanceLevel()

void KServiceOffer::setMimeTypeInheritanceLevel ( int level)

When copying an offer from a parent MIME type, remember that it's an inherited capability (for sorting purposes; we prefer a handler for postscript over any text/plain handler)

Definition at line 93 of file kserviceoffer.cpp.

◆ setPreference()

void KServiceOffer::setPreference ( int p)

The bigger this number is, the better is this service.

Set the preference number

- only for KMimeTypeTrader

Definition at line 78 of file kserviceoffer.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.