kio Library API Documentation

KServiceGroup Class Reference

This class is typically used like this:. More...

#include <kservicegroup.h>

Inheritance diagram for KServiceGroup:

Inheritance graph
[legend]
Collaboration diagram for KServiceGroup:

Collaboration graph
[legend]
List of all members.

Public Types

typedef KSharedPtr< KServiceGroupPtr
typedef KSharedPtr< KSycocaEntrySPtr
typedef QValueList< SPtrList

Public Member Functions

 KServiceGroup (const QString &name)
 Construct a dummy servicegroup indexed with name
Since:
3.1.


 KServiceGroup (const QString &_fullpath, const QString &_relpath)
 Construct a service and take all informations from a config file.

 KServiceGroup (QDataStream &_str, int offset, bool deep)
bool isValid () const
virtual QString name () const
 Name used for indexing.

virtual QString relPath () const
QString caption () const
QString icon () const
QString comment () const
int childCount ()
bool noDisplay () const
virtual void load (QDataStream &)
virtual void save (QDataStream &)
virtual List entries (bool sorted, bool excludeNoDisplay)
 List of all Services and ServiceGroups within this ServiceGroup.

virtual List entries (bool sorted=false)
 As above with excludeNoDisplay true.

QString baseGroupName () const

Static Public Member Functions

Ptr baseGroup (const QString &baseGroupName)
Ptr root ()
Ptr group (const QString &relPath)
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

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


Constructor & Destructor Documentation

KServiceGroup::KServiceGroup const QString name  ) 
 

Construct a dummy servicegroup indexed with name

Since:
3.1.

Definition at line 40 of file kservicegroup.cpp.

References KSycocaEntry::m_bDeleted, and 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 47 of file kservicegroup.cpp.

References QString::findRev(), QString::isEmpty(), QString::left(), QString::length(), KSycocaEntry::m_bDeleted, QString::mid(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), QString::right(), and KConfigBase::setDesktopGroup().


Member Function Documentation

bool KServiceGroup::isValid  )  const [inline, virtual]
 

Returns:
true

Implements KSycocaEntry.

Definition at line 97 of file kservicegroup.h.

virtual QString KServiceGroup::name  )  const [inline, virtual]
 

Name used for indexing.

Implements KSycocaEntry.

Definition at line 102 of file kservicegroup.h.

References KSycocaEntry::entryPath().

Referenced by entries(), and KServiceGroup().

QString KServiceGroup::caption  )  const [inline]
 

Returns:
the caption of this group

Definition at line 108 of file kservicegroup.h.

QString KServiceGroup::icon  )  const [inline]
 

Returns:
the icon associated with the group.

Definition at line 113 of file kservicegroup.h.

QString KServiceGroup::comment  )  const [inline]
 

Returns:
the descriptive comment for the group, if there is one.

Definition at line 118 of file kservicegroup.h.

int KServiceGroup::childCount  ) 
 

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

Definition at line 93 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.
Since:
3.1

Definition at line 120 of file kservicegroup.cpp.

Referenced by entries().

KServiceGroup::List KServiceGroup::entries bool  sorted,
bool  excludeNoDisplay
[virtual]
 

List of all Services and ServiceGroups within this ServiceGroup.

Parameters:
sorted indicates whether to sort items
whether to include items marked "NoDisplay"

Definition at line 202 of file kservicegroup.cpp.

References QValueList::append(), QValueList< KSortableItem< T, Key > >::begin(), QValueList::begin(), QValueList< KSortableItem< T, Key > >::end(), QValueList::end(), QString::findRev(), QString::fromUtf8(), KSortableValueList< T, Key >::insert(), KSycocaEntry::isType(), KStdAccel::key(), QString::length(), KSycocaEntry::List, QString::local8Bit(), m_serviceList, QString::mid(), KStdAccel::name(), KSycocaEntry::name(), name(), KService::noDisplay(), noDisplay(), QValueList::remove(), KSortableValueList< T, Key >::sort(), and QString::truncate().

Referenced by entries().

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

As above with excludeNoDisplay true.

Definition at line 196 of file kservicegroup.cpp.

References entries().

QString KServiceGroup::baseGroupName  )  const [inline]
 

Returns:
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.

Definition at line 165 of file kservicegroup.h.

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.

Definition at line 331 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
Since:
3.1

Definition at line 350 of file kservicegroup.cpp.


The documentation for this class was generated from the following files:
KDE Logo
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:22:30 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001