kdecore Library API Documentation

KGlobal Class Reference

Access to the KDE global objects. More...

#include <kglobal.h>

Collaboration diagram for KGlobal:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

static KInstanceinstance ()
static KStandardDirsdirs ()
static KConfigconfig ()
static KSharedConfigsharedConfig ()
static KIconLoadericonLoader ()
static KLocalelocale ()
static KCharsetscharsets ()
static const QStringstaticQString (const char *str)
static const QStringstaticQString (const QString &str)
static void registerStaticDeleter (KStaticDeleterBase *d)
static void unregisterStaticDeleter (KStaticDeleterBase *d)
static void deleteStaticDeleters ()
static void setActiveInstance (KInstance *d)
static KInstanceactiveInstance ()

Static Public Attributes

static KStringDict * _stringDict = 0
static KInstance_instance = 0
static KLocale_locale = 0
static KCharsets_charsets = 0
static KStaticDeleterList * _staticDeleters = 0
static KInstance_activeInstance = 0

Related Functions

(Note that these are not member functions.)

KDECORE_EXPORT bool checkAccess (const QString &pathname, int mode)
kdbgstreamendl (kdbgstream &s)
kdbgstreamflush (kdbgstream &s)
KDECORE_EXPORT kdbgstream kdDebug (int area=0)
KDECORE_EXPORT QString kdBacktrace ()
KDECORE_EXPORT QString kdBacktrace (int levels)
KDECORE_EXPORT kdbgstream kdWarning (int area=0)
KDECORE_EXPORT kdbgstream kdError (int area=0)
KDECORE_EXPORT kdbgstream kdFatal (int area=0)
KDECORE_EXPORT void kdClearDebugConfig ()
 KMIN (a, b)
 KMAX (a, b)
 KABS (a)
 KCLAMP (x, low, high)

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)

Definition at line 44 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 81 of file kglobal.cpp.

References _instance.

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

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 _instance, and KInstance::dirs().

Referenced by KIconLoader::addExtraDesktopThemes(), KLocale::allCountriesTwoAlpha(), KConfigBackEnd::changeFileName(), KApplication::checkRecoverFile(), KSycoca::determineRelativePath(), KPalette::getPaletteList(), KDesktopFile::isAuthorizedDesktopFile(), KConfig::KConfig(), KIconTheme::KIconTheme(), KSimpleConfig::KSimpleConfig(), KLocale::langLookup(), KIconTheme::list(), KDesktopFile::locateLocal(), KSycoca::openDatabase(), KConfigINIBackEnd::parseConfigFiles(), KApplication::startKdeinit(), 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 _instance, and KInstance::config().

Referenced by KGlobalSettings::activeTextColor(), KGlobalSettings::activeTitleColor(), KGlobalSettings::alternateBackgroundColor(), KApplication::authorize(), KApplication::authorizeControlModule(), KApplication::authorizeControlModules(), KGlobalSettings::autoSelectDelay(), KGlobalSettings::baseColor(), KGlobalSettings::buttonBackground(), KGlobalSettings::buttonLayout(), KGlobalSettings::buttonTextColor(), KGlobalSettings::changeCursorOverIcon(), KCharsets::codecForName(), KGlobalSettings::completionMode(), KGlobalSettings::contextMenuKey(), KGlobalSettings::contrast(), KApplication::createApplicationPalette(), KIconTheme::current(), KGlobalSettings::desktopGeometry(), KGlobalSettings::dndEventDelay(), KGlobalSettings::fixedFont(), KGlobalSettings::generalFont(), KGlobalSettings::highlightColor(), KGlobalSettings::highlightedTextColor(), KGlobalSettings::inactiveTextColor(), KGlobalSettings::inactiveTitleColor(), KIconEffect::init(), KStdAccel::initialize(), KGlobalSettings::insertTearOffHandle(), KApplication::invokeMailer(), KCheckAccelerators::KCheckAccelerators(), KGlobalSettings::linkColor(), KGlobalSettings::menuFont(), KGlobalSettings::mouseSettings(), KGlobalSettings::opaqueResize(), KShortcutList::readSettings(), KGlobalSettings::shadeSortColumn(), KGlobalSettings::showContextMenusOnPress(), KGlobalSettings::showFilePreview(), KGlobalSettings::showIconsOnPushButtons(), KGlobalSettings::singleClick(), KGlobalSettings::splashScreenDesktopGeometry(), KGlobalSettings::taskbarFont(), KGlobalSettings::textColor(), KGlobalSettings::toolBarFont(), KGlobalSettings::toolBarHighlightColor(), KAccelAction::useFourModifierKeys(), KGlobalSettings::visitedLinkColor(), KGlobalSettings::visualActivate(), KGlobalSettings::visualActivateSpeed(), KGlobalSettings::wheelMouseZooms(), KGlobalSettings::windowTitleFont(), KAccelActions::writeActions(), KShortcutList::writeSettings(), and KApplication::x11EventFilter().

KSharedConfig * KGlobal::sharedConfig  )  [static]
 

Returns the general config object.

Returns:
the global configuration object.

Definition at line 67 of file kglobal.cpp.

References _instance, and KInstance::sharedConfig().

Referenced by KConfigSkeleton::KConfigSkeleton().

KIconLoader * KGlobal::iconLoader  )  [static]
 

Returns an iconloader object.

Returns:
the global iconloader object

Definition at line 74 of file kglobal.cpp.

References _instance, and KInstance::iconLoader().

Referenced by KApplication::notify(), and KIconLoader::unknown().

KLocale * KGlobal::locale  )  [static]
 

Returns the global locale object.

Returns:
the global locale object

Definition at line 87 of file kglobal.cpp.

References _instance, _locale, and KLocale::initInstance().

Referenced by KCharsets::codecForName(), KConfigBase::deleteEntry(), i18n(), KLocale::langLookup(), KCalendarSystem::locale(), KConfigBase::setLocale(), KGenericFactoryBase< KTypeList< Product, ProductListTail > >::setupTranslations(), KURLDrag::stringToUrl(), KURLDrag::urlToString(), KConfigBase::writeEntry(), and KGenericFactoryBase< KTypeList< Product, ProductListTail > >::~KGenericFactoryBase().

KCharsets * KGlobal::charsets  )  [static]
 

The global charset manager.

Returns:
the global charset manager

Definition at line 101 of file kglobal.cpp.

References _charsets.

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 125 of file kglobal.cpp.

References QString::fromLatin1().

Referenced by KApplication::authorizeKAction(), KStringHandler::from8Bit(), KIconLoader::iconPath(), KIconLoader::loadIcon(), KConfigBase::readEntry(), and KConfigBase::readListEntry().

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 143 of file kglobal.cpp.

References _stringDict.

void KGlobal::registerStaticDeleter KStaticDeleterBase d  )  [static]
 

Registers a static deleter.

Parameters:
d the static deleter to register
See also:
KStaticDeleterBase

KStaticDeleter

Definition at line 166 of file kglobal.cpp.

References _staticDeleters.

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 175 of file kglobal.cpp.

References _staticDeleters.

Referenced by KStaticDeleter< type >::setObject(), and KStaticDeleter< type >::~KStaticDeleter().

void KGlobal::deleteStaticDeleters  )  [static]
 

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

See also:
KStaticDeleterBase

KStaticDeleter

Definition at line 182 of file kglobal.cpp.

References _staticDeleters.

Referenced by KApplication::~KApplication().

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 111 of file kglobal.cpp.

References _activeInstance, _locale, QString::fromUtf8(), KInstance::instanceName(), and KLocale::setActiveCatalogue().

Referenced by KInstance::KInstance(), and KInstance::~KInstance().


Friends And Related Function Documentation

KDECORE_EXPORT bool checkAccess const QString pathname,
int  mode
[related]
 

Check, if a file may be accessed in a given mode. This is a wrapper around the access() system call. checkAccess() calls access() with the given parameters. If this is OK, checkAccess() returns true. If not, and W_OK is part of mode, it is checked if there is write access to the directory. If yes, checkAccess() returns true. In all other cases checkAccess() returns false.

Other than access() this function EXPLICITLY ignores non-existant files if checking for write access.

Parameters:
pathname The full path of the file you want to test
mode The access mode, as in the access() system call.
Returns:
Whether the access is allowed, true = Access allowed

Definition at line 2823 of file kapplication.cpp.

KMIN ,
[related]
 

A typesafe function to find the minimum of the two arguments.

Definition at line 177 of file kglobal.h.

KMAX ,
[related]
 

A typesafe function to find the maximum of the two arguments.

Definition at line 182 of file kglobal.h.

KABS  )  [related]
 

A typesafe function to determine the absolute value of the argument.

Definition at line 187 of file kglobal.h.

KCLAMP ,
low  ,
high 
[related]
 

A typesafe function that returns x if it's between low and high values. low if x is smaller than then low and high if x is bigger than high.

Definition at line 193 of file kglobal.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Jul 20 12:30:06 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003