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 KService::Ptr &service, int pref, int mimeTypeInheritanceLevel, bool allowedAsDefault)
 
 KServiceOffer (const KServiceOffer &)
 
bool allowAsDefault () const
 
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/4]

KServiceOffer::KServiceOffer ( )

Create an invalid service offer.

Definition at line 31 of file kserviceoffer.cpp.

◆ KServiceOffer() [2/4]

KServiceOffer::KServiceOffer ( const KServiceOffer _o)

Copy constructor.

Shallow copy (the KService will not be copied).

Definition at line 36 of file kserviceoffer.cpp.

◆ KServiceOffer() [3/4]

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

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.
allowedAsDefaulttrue if the service should be used as default
Deprecated:
Since 5.71, use constructor without allowedAsDefault argument

Definition at line 43 of file kserviceoffer.cpp.

◆ KServiceOffer() [4/4]

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 53 of file kserviceoffer.cpp.

Member Function Documentation

◆ allowAsDefault()

bool KServiceOffer::allowAsDefault ( ) const

Is it allowed to use this service for default actions (e.g.

Left Click in a file manager, or KRun in general).

Returns
true if the service is a allowed as default
Deprecated:
since 5.67, no know use case.

Definition at line 102 of file kserviceoffer.cpp.

◆ 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 123 of file kserviceoffer.cpp.

◆ mimeTypeInheritanceLevel()

int KServiceOffer::mimeTypeInheritanceLevel ( ) const

Mimetype inheritance level.

Definition at line 133 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 76 of file kserviceoffer.cpp.

◆ operator=()

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

Assignment operator.

Definition at line 66 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 108 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 118 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 128 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 113 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-2023 The KDE developers.
Generated on Fri Dec 1 2023 03:52:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.