# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KGlobal Class Reference

Access to the KDE global objects. More...

`#include <kglobal.h>`

Collaboration diagram for KGlobal:

[legend]
List of all members.

## Static Public Member Functions

KInstance * | instance ()
| Returns the global instance.
KStandardDirs * | dirs ()
| Returns the application standard dirs object.
KConfig * | config ()
| Returns the general config object.
KIconLoader * | iconLoader ()
| Returns an iconloader object.
KLocale * | locale ()
| Returns the global locale object.
KCharsets * | charsets ()
| The global charset manager.
const QString & | staticQString (const char *str)
| Creates a static QString.
const QString & | staticQString (const QString &str)
| Creates a static QString.
void | registerStaticDeleter (KStaticDeleterBase *d)
| Registers a static deleter.
void | unregisterStaticDeleter (KStaticDeleterBase *d)
| Unregisters a static deleter.
void | deleteStaticDeleters ()
| Calls KStaticDeleterBase::destructObject() on all registered static deleters and unregisters them all.
void | setActiveInstance (KInstance *d)
| The instance currently active (useful in a multi-instance application, such as a KParts application).
KInstance * | activeInstance ()

## Static Public Attributes

KStringDict * | _stringDict = 0
KInstance * | _instance = 0
KLocale * | _locale = 0
KCharsets * | _charsets = 0
KStaticDeleterList * | _staticDeleters = 0
KInstance * | _activeInstance = 0

## Detailed Description

Access to the KDE global objects.

KGlobal provides you with pointers of many central objects that exist only once in the process. It is also responsible for managing instances of KStaticDeleterBase.

See also:
  KStaticDeleterBase

Author:
  Sirtaj Singh Kang (taj@kde.org)

Version:
  Id
    kglobal.h,v 1.44.2.2 2003/09/02 02:27:45 raabe Exp

Definition at line 45 of file kglobal.h.

## Member Function Documentation

KInstance * KGlobal::instance | ( |  | ) | `[static]`

Returns the global instance.

There is always at least one instance of a component in one application (in most cases the application itself).

Returns:
  the global instance

Definition at line 74 of file kglobal.cpp.

Referenced by KApplication::caption(), KWin::icon(), KLocale::KLocale(), and KTempFile::KTempFile().

KStandardDirs * KGlobal::dirs | ( |  | ) | `[static]`

Returns the application standard dirs object.

Returns:
  the global standard dir object

Definition at line 53 of file kglobal.cpp.

References KInstance::dirs().

Referenced by KIconLoader::addExtraDesktopThemes(), KLocale::allCountriesTwoAlpha(), KConfigBackEnd::changeFileName(), KApplication::checkRecoverFile(), KPalette::getPaletteList(), KDesktopFile::isAuthorizedDesktopFile(), KConfig::KConfig(), KIconTheme::KIconTheme(), KSimpleConfig::KSimpleConfig(), KLocale::langLookup(), KIconTheme::list(), KConfigINIBackEnd::parseConfigFiles(), and KApplication::tempSaveName().

KConfig * KGlobal::config | ( |  | ) | `[static]`

Returns the general config object.

Returns:
  the global configuration object.

Definition at line 60 of file kglobal.cpp.

References KInstance::config().

Referenced by KGlobalSettings::activeTextColor(), KGlobalSettings::activeTitleColor(), KGlobalSettings::alternateBackgroundColor(), KApplication::authorize(), KGlobalSettings::autoSelectDelay(), KGlobalSettings::baseColor(), KGlobalSettings::changeCursorOverIcon(), KCharsets::codecForName(), KGlobalSettings::completionMode(), KGlobalSettings::contextMenuKey(), KGlobalSettings::contrast(), KApplication::createApplicationPalette(), KIconTheme::current(), KGlobalSettings::dndEventDelay(), KGlobalSettings::fixedFont(), KGlobalSettings::generalFont(), KGlobalSettings::highlightColor(), KGlobalSettings::highlightedTextColor(), KGlobalSettings::inactiveTextColor(), KGlobalSettings::inactiveTitleColor(), KIconEffect::init(), KGlobalSettings::insertTearOffHandle(), KGlobalSettings::linkColor(), KGlobalSettings::menuFont(), KGlobalSettings::mouseSettings(), KShortcutList::readSettings(), KGlobalSettings::showContextMenusOnPress(), KGlobalSettings::singleClick(), KGlobalSettings::taskbarFont(), KGlobalSettings::textColor(), KGlobalSettings::toolBarFont(), KGlobalSettings::toolBarHighlightColor(), KGlobalSettings::visitedLinkColor(), KGlobalSettings::visualActivate(), KGlobalSettings::visualActivateSpeed(), KGlobalSettings::wheelMouseZooms(), KGlobalSettings::windowTitleFont(), and KShortcutList::writeSettings().

KIconLoader * KGlobal::iconLoader | ( |  | ) | `[static]`

Returns an iconloader object.

Returns:
  the global iconloader object

Definition at line 67 of file kglobal.cpp.

References KInstance::iconLoader().

Referenced by KIconLoader::unknown().

KLocale * KGlobal::locale | ( |  | ) | `[static]`

Returns the global locale object.

Returns:
  the global locale object

Definition at line 80 of file kglobal.cpp.

Referenced by KCharsets::codecForName(), KConfigBase::deleteEntry(), KLocale::langLookup(), KConfigBase::setLocale(), and KConfigBase::writeEntry().

KCharsets * KGlobal::charsets | ( |  | ) | `[static]`

The global charset manager.

Returns:
  the global charset manager

Definition at line 94 of file kglobal.cpp.

Referenced by KCharsets::descriptiveEncodingNames().

const QString & KGlobal::staticQString | ( | const char * | str | ) | `[static]`

Creates a static QString.

To be used inside functions(!) like:

     static const QString &myString = KGlobal::staticQString("myText");

!!! Do _NOT_ use: !!!

     static QString myString = KGlobal::staticQString("myText");

This creates a static object (instead of a static reference) and as you know static objects are EVIL.

Parameters:

  str | the string to create

Returns:
  the static string

Definition at line 118 of file kglobal.cpp.

References QString::fromLatin1().

Referenced by KApplication::authorizeKAction(), KIconLoader::iconPath(), KURL::isLocalFile(), KIconLoader::loadIcon(), KConfigBase::readEntry(), and KURL::setEncodedPath().

const QString & KGlobal::staticQString | ( | const QString & | str | ) | `[static]`

Creates a static QString.

To be used inside functions(!) like:

     static const QString &myString = KGlobal::staticQString(i18n("My Text"));

!!! Do _NOT_ use: !!!

     static QString myString = KGlobal::staticQString(i18n("myText"));

This creates a static object (instead of a static reference) and as you know static objects are EVIL.

Parameters:

  str | the string to create

Returns:
  the static string

Definition at line 136 of file kglobal.cpp.

void KGlobal::registerStaticDeleter | ( | KStaticDeleterBase * | d | ) | `[static]`

Registers a static deleter.

Parameters:

  d | the static deleter to register

See also:
  KStaticDeleterBase

  KStaticDeleter

Definition at line 159 of file kglobal.cpp.

Referenced by KStaticDeleter< type >::setObject().

void KGlobal::unregisterStaticDeleter | ( | KStaticDeleterBase * | d | ) | `[static]`

Unregisters a static deleter.

Parameters:

  d | the static deleter to unregister

See also:
  KStaticDeleterBase

  KStaticDeleter

Definition at line 168 of file kglobal.cpp.

Referenced by KStaticDeleter< type >::setObject().

void KGlobal::deleteStaticDeleters | ( |  | ) | `[static]`

Calls KStaticDeleterBase::destructObject() on all registered static deleters and unregisters them all.

See also:
  KStaticDeleterBase

  KStaticDeleter

Definition at line 175 of file kglobal.cpp.

void KGlobal::setActiveInstance | ( | KInstance * | d | ) | `[static]`

| The instance currently active (useful in a multi-instance application, such as a KParts application). Don't use this - it's mainly for KAboutDialog and KBugReport. Definition at line 104 of file kglobal.cpp. References QString::fromUtf8(), and KLocale::setActiveCatalogue(). Referenced by KInstance::KInstance(), and KInstance::~KInstance().

The documentation for this class was generated from the following files:

- kglobal.h
- kglobal.cpp

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 12:49:02 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001