KServiceGroup Class Reference
from PyKDE4.kdecore import *
Inherits: KSycocaEntry
Detailed Description
KServiceGroup represents a group of service, for example
screensavers.
This class is typically used like this:
// Start from root group
KServiceGroup.Ptr group = KServiceGroup.root();
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
Enumerations |
EntriesOption | { NoOptions, SortEntries, ExcludeNoDisplay, AllowSeparators, SortByGenericName } |
Methods |
| __init__ (self, QString name) |
| __init__ (self, QString _fullpath, QString _relpath) |
| __init__ (self, QDataStream _str, int offset, bool deep) |
| __init__ (self, KServiceGroup other) |
| addEntry (self, KSharedPtr entry) |
bool | allowInline (self) |
QString | baseGroupName (self) |
QString | caption (self) |
int | childCount (self) |
QString | comment (self) |
QString | directoryEntryPath (self) |
[KSharedPtr] | entries (self, bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=0) |
[KSharedPtr] | entries (self, bool sorted, bool excludeNoDisplay) |
[KSharedPtr] | entries (self, bool sorted=0) |
QString | icon (self) |
bool | inlineAlias (self) |
int | inlineValue (self) |
QStringList | layoutInfo (self) |
bool | noDisplay (self) |
QString | relPath (self) |
[KSharedPtr] | serviceEntries (self, KServiceGroup.EntriesOptions options=KServiceGroup.ExcludeNoDisplay) |
| setAllowInline (self, bool _b) |
| setInlineAlias (self, bool _b) |
| setInlineValue (self, int _val) |
| setLayoutInfo (self, QStringList layout) |
| setShowEmptyMenu (self, bool b) |
| setShowInlineHeader (self, bool _b) |
bool | showEmptyMenu (self) |
bool | showInlineHeader (self) |
QStringList | suppressGenericNames (self) |
Static Methods |
KSharedPtr | baseGroup (QString baseGroupName) |
KSharedPtr | childGroup (QString parent) |
KSharedPtr | group (QString relPath) |
KSharedPtr | root () |
Method Documentation
__init__ |
( |
self, |
|
|
|
QString |
name |
|
) |
|
|
|
Construct a dummy servicegroup indexed with name.
- Parameters:
-
| name | the name of the service group
|
__init__ |
( |
self, |
|
|
|
QString |
_fullpath, |
|
|
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
|
__init__ |
( |
self, |
|
|
|
QDataStream |
_str, |
|
|
int |
offset, |
|
|
bool |
deep |
|
) |
|
|
|
- Internal:
- construct a service from a stream.
The stream must already be positionned at the correct offset
addEntry |
( |
self, |
|
|
|
KSharedPtr |
entry |
|
) |
|
|
|
- Internal:
-
Add a service to this group
bool allowInline |
( |
|
self ) |
|
- Returns:
- true if we allow to inline menu.
QString baseGroupName |
( |
|
self ) |
|
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
Returns the caption of this group.
- Returns:
- the caption of this group
Returns the total number of displayable services in this group and
any of its subgroups.
- Returns:
- the number of child services
Returns the comment about this service group.
- Returns:
- the descriptive comment for the group, if there is one,
or QString() if not set
QString directoryEntryPath |
( |
|
self ) |
|
Returns a path to the .directory file describing this service group.
The path is either absolute or relative to the "apps" resource.
[KSharedPtr] entries |
( |
self, |
|
|
|
bool |
sorted, |
|
|
bool |
excludeNoDisplay, |
|
|
bool |
allowSeparators, |
|
|
bool |
sortByGenericName=0 |
|
) |
|
|
|
List of all Services and ServiceGroups within this
ServiceGroup.
- Parameters:
-
| sorted | true to sort items
|
- Returns:
- the list of entried
[KSharedPtr] entries |
( |
self, |
|
|
|
bool |
sorted, |
|
|
bool |
excludeNoDisplay |
|
) |
|
|
|
List of all Services and ServiceGroups within this
ServiceGroup.
- Parameters:
-
| sorted | true to sort items
|
- Returns:
- the list of entried
[KSharedPtr] entries |
( |
self, |
|
|
|
bool |
sorted=0 |
|
) |
|
|
|
List of all Services and ServiceGroups within this
ServiceGroup.
- Parameters:
-
| sorted | true to sort items
|
- Returns:
- the list of entried
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
bool inlineAlias |
( |
|
self ) |
|
- Returns:
- true to show an inline alias item into menu
- Returns:
- inline limite value
QStringList layoutInfo |
( |
|
self ) |
|
- Internal:
-
Returns information related to the layout of services in this group.
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
Returns the relative path of the service group.
- Returns:
- the service group's relative path
entries of this service group
setAllowInline |
( |
self, |
|
|
|
bool |
_b |
|
) |
|
|
|
setInlineAlias |
( |
self, |
|
|
|
bool |
_b |
|
) |
|
|
|
setInlineValue |
( |
self, |
|
|
|
int |
_val |
|
) |
|
|
|
setLayoutInfo |
( |
self, |
|
|
|
QStringList |
layout |
|
) |
|
|
|
- Internal:
-
Sets information related to the layout of services in this group.
setShowEmptyMenu |
( |
self, |
|
|
|
bool |
b |
|
) |
|
|
|
setShowInlineHeader |
( |
self, |
|
|
|
bool |
_b |
|
) |
|
|
|
bool showEmptyMenu |
( |
|
self ) |
|
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
bool showInlineHeader |
( |
|
self ) |
|
- Returns:
- true to show an inline header into menu
QStringList suppressGenericNames |
( |
|
self ) |
|
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.
Static Method Documentation
KSharedPtr baseGroup |
( |
QString |
baseGroupName |
|
) |
|
|
|
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.
This mechanism was fragile and isn't used in kde4 anymore.
- Deprecated:
- Use a servicetype and a proper trader query instead, for a better
way of finding related services.
KSharedPtr childGroup |
( |
QString |
parent |
|
) |
|
|
|
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
KSharedPtr group |
( |
QString |
relPath |
|
) |
|
|
|
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.
Returns the root service group.
- Returns:
- the root service group
Enumeration Documentation
options for groupEntries and serviceEntries
- Enumerator:
-
NoOptions = 0x0 | |
SortEntries = 0x1 | |
ExcludeNoDisplay = 0x2 | |
AllowSeparators = 0x4 | |
SortByGenericName = 0x8 | |