org.kde.koala
Class KServiceGroup

java.lang.Object
  extended by org.kde.koala.KShared
      extended by org.kde.koala.KSycocaEntry
          extended by org.kde.koala.KServiceGroup
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KServiceGroup
extends KSycocaEntry

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 = (KService)(p);
       printf("Name = %s\n", s.name().latin1());
    }
    else if (p.isType(KST_KServiceGroup))
    {
       KServiceGroup g = (KServiceGroup)(p);
       // Sub group ...
    }
 }
 


Constructor Summary
protected KServiceGroup(java.lang.Class dummy)
           
  KServiceGroup(org.kde.qt.QDataStream _str, int offset, boolean deep)
          The stream must already be positionned at the correct offset
  KServiceGroup(java.lang.String name)
          Construct a dummy servicegroup indexed with name.
  KServiceGroup(java.lang.String _fullpath, java.lang.String _relpath)
          Construct a service and take all informations from a config file
 
Method Summary
protected  void addEntry(KSycocaEntry entry)
          Add a service to this group
 boolean allowInline()
           
 java.lang.String baseGroupName()
          Returns a non-empty string if the group is a special base group.
 java.lang.String caption()
          Returns the caption of this group.
 int childCount()
          Returns the total number of displayable services in this group and any of its subgroups.
 java.lang.String comment()
          Returns the comment about this service group.
 java.lang.String directoryEntryPath()
          Returns a path to the .directory file describing this service group.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 java.lang.String icon()
          Returns the name of the icon associated with the group.
 boolean inlineAlias()
           
 int inlineValue()
           
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 boolean isValid()
          Checks whether the entry is valid, returns always true.
 java.util.ArrayList layoutInfo()
          Returns information related to the layout of services in this group.
 void load(org.kde.qt.QDataStream arg1)
          Load the service from a stream.
 java.lang.String name()
          Name used for indexing.
 boolean noDisplay()
          Returns true if the NoDisplay flag was set, i.e.
 void parseAttribute(java.lang.String item, boolean showEmptyMenu, boolean showInline, boolean showInlineHeader, boolean showInlineAlias, int[] inlineValue)
          This function parse attributes into menu
 java.lang.String relPath()
          Returns the relative path of the service group.
 void save(org.kde.qt.QDataStream arg1)
          Save the service to a stream.
 void setAllowInline(boolean _b)
           
 void setInlineAlias(boolean _b)
           
 void setInlineValue(int _val)
           
 void setLayoutInfo(java.lang.String[] layout)
          Sets information related to the layout of services in this group.
 void setShowEmptyMenu(boolean b)
           
 void setShowInlineHeader(boolean _b)
           
 boolean showEmptyMenu()
          Return true if we want to display empty menu entry
 boolean showInlineHeader()
           
 java.util.ArrayList suppressGenericNames()
          Returns a list of untranslated generic names that should be be supressed when showing this group.
 
Methods inherited from class org.kde.koala.KSycocaEntry
entryPath, isDeleted, isType, offset, read, read, sycocaType
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KServiceGroup

protected KServiceGroup(java.lang.Class dummy)

KServiceGroup

public KServiceGroup(java.lang.String name)
Construct a dummy servicegroup indexed with name.

Parameters:
name - the name of the service group

KServiceGroup

public KServiceGroup(java.lang.String _fullpath,
                     java.lang.String _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

KServiceGroup

public KServiceGroup(org.kde.qt.QDataStream _str,
                     int offset,
                     boolean deep)
The stream must already be positionned at the correct offset

Method Detail

isValid

public boolean isValid()
Checks whether the entry is valid, returns always true.

Overrides:
isValid in class KSycocaEntry
Returns:
true

name

public java.lang.String name()
Name used for indexing.

Overrides:
name in class KSycocaEntry
Returns:
the service group's name

relPath

public java.lang.String relPath()
Returns the relative path of the service group.

Returns:
the service group's relative path

caption

public java.lang.String caption()
Returns the caption of this group.

Returns:
the caption of this group

icon

public java.lang.String icon()
Returns the name of the icon associated with the group.

Returns:
the name of the icon associated with the group, or null if not set

comment

public java.lang.String comment()
Returns the comment about this service group.

Returns:
the descriptive comment for the group, if there is one, or null if not set

childCount

public int childCount()
Returns the total number of displayable services in this group and any of its subgroups.

Returns:
the number of child services

noDisplay

public boolean noDisplay()
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

showEmptyMenu

public boolean showEmptyMenu()
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

setShowEmptyMenu

public void setShowEmptyMenu(boolean b)

showInlineHeader

public boolean showInlineHeader()
Returns:
true to show an inline header into menu

setShowInlineHeader

public void setShowInlineHeader(boolean _b)

inlineAlias

public boolean inlineAlias()
Returns:
true to show an inline alias item into menu

setInlineAlias

public void setInlineAlias(boolean _b)

allowInline

public boolean allowInline()
Returns:
true if we allow to inline menu.

setAllowInline

public void setAllowInline(boolean _b)

inlineValue

public int inlineValue()
Returns:
inline limite value

setInlineValue

public void setInlineValue(int _val)

suppressGenericNames

public java.util.ArrayList suppressGenericNames()
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.


setLayoutInfo

public void setLayoutInfo(java.lang.String[] layout)
Sets information related to the layout of services in this group.


layoutInfo

public java.util.ArrayList layoutInfo()
Returns information related to the layout of services in this group.


load

public void load(org.kde.qt.QDataStream arg1)
Load the service from a stream.

Overrides:
load in class KSycocaEntry

save

public void save(org.kde.qt.QDataStream arg1)
Save the service to a stream.

Overrides:
save in class KSycocaEntry

baseGroupName

public java.lang.String baseGroupName()
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

directoryEntryPath

public java.lang.String directoryEntryPath()
Returns a path to the .directory file describing this service group. The path is either absolute or relative to the "apps" resource.


parseAttribute

public void parseAttribute(java.lang.String item,
                           boolean showEmptyMenu,
                           boolean showInline,
                           boolean showInlineHeader,
                           boolean showInlineAlias,
                           int[] inlineValue)
This function parse attributes into menu


addEntry

protected void addEntry(KSycocaEntry entry)
Add a service to this group


finalize

protected void finalize()
                 throws java.lang.InternalError
Deletes the wrapped C++ instance

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.InternalError

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()


isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?