org.kde.koala
Class KServiceType

java.lang.Object
  extended by org.kde.koala.KShared
      extended by org.kde.koala.KSycocaEntry
          extended by org.kde.koala.KServiceType
All Implemented Interfaces:
org.kde.qt.QtSupport
Direct Known Subclasses:
KMimeType

public class KServiceType
extends KSycocaEntry

A service type is the generic notion for a mimetype, a type of service instead of a type of file. For instance, KOfficeFilter is a service type. It is associated to services according to the user profile (kuserprofile.h). Service types are stored as desktop files in $KDEHOME/share/servicetypes.

See Also:
KService

Constructor Summary
protected KServiceType(java.lang.Class dummy)
           
  KServiceType(KDesktopFile config)
          Construct a service type and take all informations from a deskop file.
  KServiceType(org.kde.qt.QDataStream _str, int offset)
          The stream must already be positionned at the correct offset
  KServiceType(java.lang.String _fullpath)
          Construct a service type and take all informations from a config file.
  KServiceType(java.lang.String _fullpath, java.lang.String _name, java.lang.String _icon, java.lang.String _comment)
          Constructor.
 
Method Summary
 java.lang.String comment()
          Returns the descriptive comment associated, if any.
 java.lang.String desktopEntryPath()
          Returns the relative path to the desktop entry file responsible for this servicetype.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 java.lang.String icon()
          Returns the icon associated with this service type.
 boolean inherits(java.lang.String servTypeName)
          Checks whether this service type is or inherits from servTypeName.
protected  void init(KDesktopFile config)
          Returns a list of all the supported servicetypes.
 boolean isDerived()
          Checks whether this service type inherits another one.
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 boolean isValid()
          Checks whether the service type is valid.
 void load(org.kde.qt.QDataStream arg1)
          Load ourselves from the data stream.
 java.lang.String name()
          Returns the name of this service type.
 java.lang.String parentServiceType()
          If this service type inherits from another service type, return the name of the parent.
 org.kde.qt.QVariant property(java.lang.String _name)
          Returns the requested property.
 int propertyDef(java.lang.String _name)
          Returns the type of the property with the given _name.
 java.util.ArrayList propertyDefNames()
           
 java.util.ArrayList propertyNames()
          Returns the list of all properties of this service type.
 void save(org.kde.qt.QDataStream arg1)
          Save ourselves to the data stream.
 
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

KServiceType

protected KServiceType(java.lang.Class dummy)

KServiceType

public KServiceType(java.lang.String _fullpath,
                    java.lang.String _name,
                    java.lang.String _icon,
                    java.lang.String _comment)
Constructor. You may pass in arguments to create a servicetype with specific properties.

Parameters:
_fullpath - the path of the service type's desktop file
_name - the name of the service type
_icon - the icon name of the service type (can be null)
_comment - a comment (can be null)

KServiceType

public KServiceType(java.lang.String _fullpath)
Construct a service type and take all informations from a config file.

Parameters:
_fullpath - path of the desktop file, set to "" if calling from a inherited constructor.

KServiceType

public KServiceType(KDesktopFile config)
Construct a service type and take all informations from a deskop file.

Parameters:
config - the configuration file

KServiceType

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

Method Detail

icon

public java.lang.String icon()
Returns the icon associated with this service type. Some derived classes offer special functions which take for example an URL and returns a special icon for this URL. An example is KMimeType, KFolderType and others.

Returns:
the name of the icon, can be null.

comment

public java.lang.String comment()
Returns the descriptive comment associated, if any.

Returns:
the comment, or null

name

public java.lang.String name()
Returns the name of this service type.

Overrides:
name in class KSycocaEntry
Returns:
the name of the service type

desktopEntryPath

public java.lang.String desktopEntryPath()
Returns the relative path to the desktop entry file responsible for this servicetype. For instance inode/directory.desktop, or kpart.desktop

Returns:
the path of the desktop file

isDerived

public boolean isDerived()
Checks whether this service type inherits another one.

Returns:
true if this service type inherits another one
See Also:
parentServiceType()

parentServiceType

public java.lang.String parentServiceType()
If this service type inherits from another service type, return the name of the parent.

Returns:
the parent service type, or String. null if not set
See Also:
isDerived()

inherits

public boolean inherits(java.lang.String servTypeName)
Checks whether this service type is or inherits from servTypeName.

Returns:
true if this servicetype is or inherits from servTypeName

property

public org.kde.qt.QVariant property(java.lang.String _name)
Returns the requested property. Some often used properties have convenience access functions like name(), comment() etc.

Parameters:
_name - the name of the property
Returns:
the property, or invalid if not found

propertyNames

public java.util.ArrayList propertyNames()
Returns the list of all properties of this service type.

Returns:
the list of properties

isValid

public boolean isValid()
Checks whether the service type is valid.

Overrides:
isValid in class KSycocaEntry
Returns:
true if the service is valid (e.g. name is not empty)

propertyDef

public int propertyDef(java.lang.String _name)
Returns the type of the property with the given _name.

Parameters:
_name - the name of the property
Returns:
the property type, or null if not found

propertyDefNames

public java.util.ArrayList propertyDefNames()

save

public void save(org.kde.qt.QDataStream arg1)
Save ourselves to the data stream.

Overrides:
save in class KSycocaEntry

load

public void load(org.kde.qt.QDataStream arg1)
Load ourselves from the data stream.

Overrides:
load in class KSycocaEntry

init

protected void init(KDesktopFile config)
Returns a list of all the supported servicetypes. Useful for showing the list of available servicetypes in a listbox, for example. More memory consuming than the ones above, don't use unless really necessary.


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?