KDE 4.2 PyKDE API Reference

- KDE's Python API

# KComponentData Class Reference

`from PyKDE4.kdecore import *`

## Detailed Description

Per component data.

This class holds a KAboutData object or only a component name, a KStandardDirs object and a KSharedConfig object. Those objects normally are different per component but the same per instance of one component.

The application component data can always be accessed using KGlobal.mainComponent() (or the convenience function KGlobal.dirs() and KGlobal.config()) while the component data of the currently active component (mainly used for KParts) can be accessed using KGlobal.activeComponent().

Author:
  Torben Weis

Author:
  Matthias Kretz <kretz@kde.org>

## Enumerations

MainComponentRegistration | { RegisterAsMainComponent, SkipMainComponentRegistration }

## Methods

| __init__ (self)
| __init__ (self, KComponentData a0)
| __init__ (self, QByteArray componentName, QByteArray catalogName=QByteArray(), KComponentData.MainComponentRegistration registerAsMain=KComponentData.RegisterAsMainComponent)
| __init__ (self, KAboutData aboutData, KComponentData.MainComponentRegistration registerAsMain=KComponentData.RegisterAsMainComponent)
| __init__ (self, KAboutData aboutData, KComponentData.MainComponentRegistration registerAsMain=KComponentData.RegisterAsMainComponent)
KAboutData | aboutData (self)
QString | catalogName (self)
QString | componentName (self)
KSharedConfig.Ptr | config (self)
KStandardDirs | dirs (self)
bool | isValid (self)
bool | operator != (self, KComponentData rhs)
bool | operator == (self, KComponentData a0)
| setConfigName (self, QString name)
| virtual_hook (self, int id, void data)

## Method Documentation

__init__ | ( |  | self ) |

Creates an invalid KComponentData object.

See also:
  isValid()

__init__ | ( | self, |
|  | KComponentData | a0
| ) |  |  |

Copy constructor.

It does not copy the data. The data is shared between the old and new objects.

__init__ | ( | self, |
|  | QByteArray | componentName,
|  | QByteArray | catalogName=QByteArray(),
|  | KComponentData.MainComponentRegistration | registerAsMain=KComponentData.RegisterAsMainComponent
| ) |  |  |

Constructor.

Parameters:

  | componentName | the name of the component.
  | catalogName | the name of the translation catalog; if left empty componentName is used
  | registerAsMain | whether to register the component as the main component of the application. This has no effect, if the application already has a main component.

See also:
  KGlobal.mainComponent

__init__ | ( | self, |
|  | KAboutData | aboutData,
|  | KComponentData.MainComponentRegistration | registerAsMain=KComponentData.RegisterAsMainComponent
| ) |  |  |

Constructor.

A copy of the aboutData object is made.

Parameters:

  | aboutData | data about this component
  | registerAsMain | whether to register the component as the main component of the application. This has no effect, if the application already has a main component.

See also:
  KGlobal.mainComponent

See also:
  KAboutData

__init__ | ( | self, |
|  | KAboutData | aboutData,
|  | KComponentData.MainComponentRegistration | registerAsMain=KComponentData.RegisterAsMainComponent
| ) |  |  |

KAboutData aboutData | ( |  | self ) |

Returns the about data of this component.

Returns:
  The about data of the component. If none has been set in the constructor but a component name was set, a default constructed KAboutData object is returned.

QString catalogName | ( |  | self ) |

Returns the name of the translation catalog.

Returns:
  The catalog name.

QString componentName | ( |  | self ) |

Returns the name of the component.

Returns:
  The component name.

KSharedConfig.Ptr config | ( |  | self ) |

Returns the general config object ("appnamerc").

Returns:
  the KConfig object for the component.

KStandardDirs dirs | ( |  | self ) |

Returns the application standard dirs object.

Returns:
  The KStandardDirs of the application.

bool isValid | ( |  | self ) |

Returns whether this is a valid object.

Don't call any functions on invalid objects, that will crash. Assignment (and of course destruction) is the only valid operation you may do.

bool operator != | ( | self, |
|  | KComponentData | rhs
| ) |  |  |

Returns whether two KComponentData objects do not reference the same data.

bool operator == | ( | self, |
|  | KComponentData | a0
| ) |  |  |

Returns whether two KComponentData objects reference the same data.

setConfigName | ( | self, |
|  | QString | name
| ) |  |  |

Set name of default config file.

Parameters:

  | name | the name of the default config file

virtual_hook | ( | self, |
|  | int | id,
|  | void | data
| ) |  |  |

Standard trick to add virtuals later.

Internal:

## Enumeration Documentation

MainComponentRegistration

Enumerator:

  RegisterAsMainComponent |
  SkipMainComponentRegistration |