• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

KServiceGroup Class Reference

#include <kservicegroup.h>

Inheritance diagram for KServiceGroup:

Inheritance graph
[legend]

List of all members.


Detailed Description

KServiceGroup represents a group of service, for example screensavers.

This class is typically used like this:

 // Lookup screensaver group
 KServiceGroup::Ptr group = KServiceGroup::baseGroup("screensavers");
 if (!group || !group->isValid()) return;

 KServiceGroup::List list = group->entries();

 // Iterate over all entries in the group
 for( KServiceGroup::List::ConstIterator it = list.begin();
      it != list.end(); it++)
 {
    KSycocaEntry *p = (*it);
    if (p->isType(KST_KService))
    {
       KService *s = static_cast<KService *>(p);
       printf("Name = %s\n", s->name().toLatin1());
    }
    else if (p->isType(KST_KServiceGroup))
    {
       KServiceGroup *g = static_cast<KServiceGroup *>(p);
       // Sub group ...
    }
 }
Represents a group of services

Definition at line 61 of file kservicegroup.h.


Public Types

enum  EntriesOption {
  NoOptions = 0x0, SortEntries = 0x1, ExcludeNoDisplay = 0x2, AllowSeparators = 0x4,
  SortByGenericName = 0x8
}
typedef KSharedPtr< KServiceGroup > Ptr
typedef KSharedPtr< KSycocaEntry > SPtr
typedef QList< SPtr > List

Public Member Functions

 KServiceGroup (const QString &name)
 KServiceGroup (const QString &_fullpath, const QString &_relpath)
 KServiceGroup (QDataStream &_str, int offset, bool deep)
virtual ~KServiceGroup ()
QString relPath () const
QString caption () const
QString icon () const
QString comment () const
int childCount () const
bool noDisplay () const
bool showEmptyMenu () const
void setShowEmptyMenu (bool b)
bool showInlineHeader () const
void setShowInlineHeader (bool _b)
bool inlineAlias () const
void setInlineAlias (bool _b)
bool allowInline () const
void setAllowInline (bool _b)
int inlineValue () const
void setInlineValue (int _val)
QStringList suppressGenericNames () const
void setLayoutInfo (const QStringList &layout)
QStringList layoutInfo () const
List entries (bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=false)
List entries (bool sorted, bool excludeNoDisplay)
List entries (bool sorted=false)
QList< Ptr > groupEntries (EntriesOptions options=ExcludeNoDisplay)
KService::List serviceEntries (EntriesOptions options=ExcludeNoDisplay)
QString baseGroupName () const
QString directoryEntryPath () const

Static Public Member Functions

static Ptr baseGroup (const QString &baseGroupName)
static Ptr root ()
static Ptr group (const QString &relPath)
static Ptr childGroup (const QString &parent)

Protected Member Functions

void addEntry (const KSycocaEntry::Ptr &entry)

Friends

class KBuildServiceGroupFactory

Member Typedef Documentation

typedef KSharedPtr<KServiceGroup> KServiceGroup::Ptr

Reimplemented from KSycocaEntry.

Definition at line 65 of file kservicegroup.h.

typedef KSharedPtr<KSycocaEntry> KServiceGroup::SPtr

Definition at line 66 of file kservicegroup.h.

typedef QList<SPtr> KServiceGroup::List

Reimplemented from KSycocaEntry.

Definition at line 67 of file kservicegroup.h.


Member Enumeration Documentation

enum KServiceGroup::EntriesOption

options for groupEntries and serviceEntries

Enumerator:
NoOptions 
SortEntries 
ExcludeNoDisplay 
AllowSeparators 
SortByGenericName 

Definition at line 204 of file kservicegroup.h.


Constructor & Destructor Documentation

KServiceGroup::KServiceGroup ( const QString &  name  ) 

Construct a dummy servicegroup indexed with name.

Parameters:
name the name of the service group

Definition at line 35 of file kservicegroup.cpp.

KServiceGroup::KServiceGroup ( const QString &  _fullpath,
const QString &  _relpath 
)

Construct a service and take all information from a config file.

Parameters:
_fullpath full path to the config file
_relpath relative path to the config file

Definition at line 40 of file kservicegroup.cpp.

KServiceGroup::KServiceGroup ( QDataStream &  _str,
int  offset,
bool  deep 
)

Definition at line 95 of file kservicegroup.cpp.

KServiceGroup::~KServiceGroup (  )  [virtual]

Definition at line 103 of file kservicegroup.cpp.


Member Function Documentation

QString KServiceGroup::relPath (  )  const

Returns the relative path of the service group.

Returns:
the service group's relative path

Definition at line 107 of file kservicegroup.cpp.

QString KServiceGroup::caption (  )  const

Returns the caption of this group.

Returns:
the caption of this group

Definition at line 112 of file kservicegroup.cpp.

QString KServiceGroup::icon (  )  const

Returns the name of the icon associated with the group.

Returns:
the name of the icon associated with the group, or QString() if not set

Definition at line 118 of file kservicegroup.cpp.

QString KServiceGroup::comment (  )  const

Returns the comment about this service group.

Returns:
the descriptive comment for the group, if there is one, or QString() if not set

Definition at line 124 of file kservicegroup.cpp.

int KServiceGroup::childCount (  )  const

Returns the total number of displayable services in this group and any of its subgroups.

Returns:
the number of child services

Definition at line 130 of file kservicegroup.cpp.

bool KServiceGroup::noDisplay (  )  const

Returns true if the NoDisplay flag was set, i.e.

if this group should be hidden from menus, while still being in ksycoca.

Returns:
true to hide this service group, false to display it

Definition at line 223 of file kservicegroup.cpp.

bool KServiceGroup::showEmptyMenu (  )  const

Return true if we want to display empty menu entry.

Returns:
true to show this service group as menu entry is empty, false to hide it

Definition at line 169 of file kservicegroup.cpp.

void KServiceGroup::setShowEmptyMenu ( bool  b  ) 

Definition at line 187 of file kservicegroup.cpp.

bool KServiceGroup::showInlineHeader (  )  const

Returns:
true to show an inline header into menu

Definition at line 163 of file kservicegroup.cpp.

void KServiceGroup::setShowInlineHeader ( bool  _b  ) 

Definition at line 193 of file kservicegroup.cpp.

bool KServiceGroup::inlineAlias (  )  const

Returns:
true to show an inline alias item into menu

Definition at line 175 of file kservicegroup.cpp.

void KServiceGroup::setInlineAlias ( bool  _b  ) 

Definition at line 181 of file kservicegroup.cpp.

bool KServiceGroup::allowInline (  )  const

Returns:
true if we allow to inline menu.

Definition at line 211 of file kservicegroup.cpp.

void KServiceGroup::setAllowInline ( bool  _b  ) 

Definition at line 217 of file kservicegroup.cpp.

int KServiceGroup::inlineValue (  )  const

Returns:
inline limite value

Definition at line 199 of file kservicegroup.cpp.

void KServiceGroup::setInlineValue ( int  _val  ) 

Definition at line 205 of file kservicegroup.cpp.

QStringList KServiceGroup::suppressGenericNames (  )  const

Returns a list of untranslated generic names that should be be suppressed when showing this group.

E.g. The group "Games/Arcade" might want to suppress the generic name "Arcade Game" since it's redundant in this particular context.

Definition at line 229 of file kservicegroup.cpp.

void KServiceGroup::setLayoutInfo ( const QStringList &  layout  ) 

Definition at line 705 of file kservicegroup.cpp.

QStringList KServiceGroup::layoutInfo (  )  const

Definition at line 711 of file kservicegroup.cpp.

KServiceGroup::List KServiceGroup::entries ( bool  sorted,
bool  excludeNoDisplay,
bool  allowSeparators,
bool  sortByGenericName = false 
)

List of all Services and ServiceGroups within this ServiceGroup.

Parameters:
sorted true to sort items
excludeNoDisplay true to exclude items marked "NoDisplay"
allowSeparators true to allow separator items to be included
sortByGenericName true to sort GenericName+Name instead of Name+GenericName
Returns:
the list of entries

Definition at line 373 of file kservicegroup.cpp.

KServiceGroup::List KServiceGroup::entries ( bool  sorted,
bool  excludeNoDisplay 
)

Definition at line 366 of file kservicegroup.cpp.

KServiceGroup::List KServiceGroup::entries ( bool  sorted = false  ) 

List of all Services and ServiceGroups within this ServiceGroup.

Parameters:
sorted true to sort items
Returns:
the list of entried

Definition at line 359 of file kservicegroup.cpp.

QList< KServiceGroup::Ptr > KServiceGroup::groupEntries ( EntriesOptions  options = ExcludeNoDisplay  ) 

subgroups for this service group

Definition at line 322 of file kservicegroup.cpp.

KService::List KServiceGroup::serviceEntries ( EntriesOptions  options = ExcludeNoDisplay  ) 

entries of this service group

Definition at line 339 of file kservicegroup.cpp.

QString KServiceGroup::baseGroupName (  )  const

Returns a non-empty string if the group is a special base group.

By default, "Settings/" is the kcontrol base group ("settings") and "System/Screensavers/" is the screensavers base group ("screensavers"). This allows moving the groups without breaking those apps.

The base group is defined by the X-KDE-BaseGroup key in the .directory file.

Returns:
the base group name, or null if no base group

Definition at line 742 of file kservicegroup.cpp.

QString KServiceGroup::directoryEntryPath (  )  const

Returns a path to the .directory file describing this service group.

The path is either absolute or relative to the "apps" resource.

Definition at line 748 of file kservicegroup.cpp.

KServiceGroup::Ptr KServiceGroup::baseGroup ( const QString &  baseGroupName  )  [static]

Returns the group for the given baseGroupName.

Can return 0L if the directory (or the .directory file) was deleted.

Returns:
the base group with the given name, or 0 if not available.

Definition at line 718 of file kservicegroup.cpp.

KServiceGroup::Ptr KServiceGroup::root (  )  [static]

Returns the root service group.

Returns:
the root service group

Definition at line 724 of file kservicegroup.cpp.

KServiceGroup::Ptr KServiceGroup::group ( const QString &  relPath  )  [static]

Returns the group with the given relative path.

Parameters:
relPath the path of the service group
Returns:
the group with the given relative path name.

Definition at line 730 of file kservicegroup.cpp.

KServiceGroup::Ptr KServiceGroup::childGroup ( const QString &  parent  )  [static]

Returns the group of services that have X-KDE-ParentApp equal to parent (siblings).

Parameters:
parent the name of the service's parent
Returns:
the services group

Definition at line 737 of file kservicegroup.cpp.

void KServiceGroup::addEntry ( const KSycocaEntry::Ptr &  entry  )  [protected]

Definition at line 278 of file kservicegroup.cpp.


Friends And Related Function Documentation

friend class KBuildServiceGroupFactory [friend]

Definition at line 63 of file kservicegroup.h.


The documentation for this class was generated from the following files:
  • kservicegroup.h
  • kservicegroup.cpp

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   WTF
  • KJSEmbed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  •   core
  • Phonon
  •   Backend
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal