kio Library: KServiceGroup Class Reference (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KServiceGroup Class Reference

KServiceGroup represents a group of service, for example screensavers. Represents a group of services. More...

`#include <kservicegroup.h>`

Inheritance diagram for KServiceGroup:

[legend]
Collaboration diagram for KServiceGroup:

[legend]
List of all members.

## Public Types
typedef KSharedPtr< KServiceGroup > | Ptr
typedef KSharedPtr< KSycocaEntry > | SPtr
typedef QValueList< SPtr > | List
## Public Member Functions
| KServiceGroup (const QString &name)
| KServiceGroup (const QString &_fullpath, const QString &_relpath)
| KServiceGroup (QDataStream &_str, int offset, bool deep)
bool | isValid () const
virtual QString | name () const
virtual QString | relPath () const
QString | caption () const
QString | icon () const
QString | comment () const
int | childCount ()
bool | noDisplay () const
QStringList | suppressGenericNames () const
void | setLayoutInfo (const QStringList &layout)
QStringList | layoutInfo () const
virtual void | load (QDataStream &)
virtual void | save (QDataStream &)
List | entries (bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=false)
virtual List | entries (bool sorted, bool excludeNoDisplay)
virtual List | entries (bool sorted=false)
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 (KSycocaEntry *entry)
virtual void | virtual_hook (int id, void *data)
## Protected Attributes
QString | m_strCaption
QString | m_strIcon
QString | m_strComment
List | m_serviceList
bool | m_bDeep
QString | m_strBaseGroupName
int | m_childCount
## Friends
class | KBuildServiceGroupFactory

## Detailed Description

KServiceGroup represents a group of service, for example screensavers. Represents a group of services.

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().latin1());
        }
        else if (p->isType(KST_KServiceGroup))
        {
           KServiceGroup *g = static_cast<KServiceGroup *>(p);
           // Sub group ...
        }
     }

Definition at line 67 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
Since: 3.1 Definition at line 43 of file kservicegroup.cpp. References name().

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

  | Construct a service and take all informations from a config file. Parameters:
  | _fullpath | full path to the config file
  | _relpath | relative path to the config file
Definition at line 50 of file kservicegroup.cpp. References QString::findRev(), KConfigBase::hasKey(), QString::isEmpty(), QString::left(), QString::length(), QString::mid(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readListEntry(), QString::right(), and KConfigBase::setDesktopGroup().

## Member Function Documentation

bool KServiceGroup::isValid | ( |  | ) | const`[inline, virtual]`

| Checks whether the entry is valid, returns always true. Returns: true Implements KSycocaEntry. Definition at line 103 of file kservicegroup.h.

virtual QString KServiceGroup::name | ( |  | ) | const`[inline, virtual]`

| Name used for indexing. Returns: the service group's name Implements KSycocaEntry. Definition at line 109 of file kservicegroup.h. References KSycocaEntry::entryPath(). Referenced by entries(), and KServiceGroup().

virtual QString KServiceGroup::relPath | ( |  | ) | const`[inline, virtual]`

| Returns the relative path of the service group. Returns: the service group's relative path Definition at line 115 of file kservicegroup.h. References KSycocaEntry::entryPath(). Referenced by entries(), and group().

QString KServiceGroup::caption | ( |  | ) | const`[inline]`

| Returns the caption of this group. Returns: the caption of this group Definition at line 121 of file kservicegroup.h.

QString KServiceGroup::icon | ( |  | ) | const`[inline]`

| Returns the name of the icon associated with the group. Returns: the name of the icon associated with the group, or QString::null if not set Definition at line 128 of file kservicegroup.h.

QString KServiceGroup::comment | ( |  | ) | const`[inline]`

| Returns the comment about this service group. Returns: the descriptive comment for the group, if there is one, or QString::null if not set Definition at line 135 of file kservicegroup.h.

int KServiceGroup::childCount | ( |  | ) |

| Returns the total number of displayable services in this group and any of its subgroups. Returns: the number of child services Definition at line 114 of file kservicegroup.cpp. References QValueList::begin(), QValueList::end(), KSycocaEntry::isType(), and KService::noDisplay().

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 Since: 3.1 Definition at line 141 of file kservicegroup.cpp. References QString::startsWith(). Referenced by entries().

QStringList KServiceGroup::suppressGenericNames | ( |  | ) | const

| Returns a list of untranslated generic names that should be be supressed 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. Since: 3.2 Definition at line 146 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 Since: 3.2 Definition at line 246 of file kservicegroup.cpp. References QValueList< KSortableItem< T, Key > >::begin(), QValueList::begin(), QValueList< KSortableItem< T, Key > >::end(), QValueList::end(), group(), KSortableValueList< T, Key >::insert(), QString::isEmpty(), KSycocaEntry::isType(), QString::length(), QString::local8Bit(), m_serviceList, KService::menuId(), QString::mid(), KSycocaEntry::name(), name(), KService::noDisplay(), noDisplay(), relPath(), QValueList< KSortableItem< T, Key > >::remove(), and KSortableValueList< T, Key >::sort(). Referenced by entries().

KServiceGroup::List KServiceGroup::entries | ( | bool | sorted = `false` | ) | `[virtual]`

  | List of all Services and ServiceGroups within this ServiceGroup. Parameters:
  | sorted | true to sort items
Returns: the list of entried Definition at line 226 of file kservicegroup.cpp. References entries().

QString KServiceGroup::baseGroupName | ( |  | ) | const`[inline]`

| 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 215 of file kservicegroup.h.

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. Since: 3.2 Definition at line 504 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 479 of file kservicegroup.cpp.

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

| Returns the root service group. Returns: the root service group Definition at line 485 of file kservicegroup.cpp. Referenced by group().

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 491 of file kservicegroup.cpp. References QString::isEmpty(), relPath(), and root(). Referenced by entries().

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 Since: 3.1 Definition at line 498 of file kservicegroup.cpp.

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

- kservicegroup.h
- kservicegroup.cpp

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:25:17 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003