\section{KGlobal Class Reference}
\label{classKGlobal}\index{KGlobal@{KGlobal}}
Access to the {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} global objects.  


{\tt \#include $<$kglobal.h$>$}

Collaboration diagram for KGlobal:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=141pt]{classKGlobal__coll__graph}
\end{center}
\end{figure}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KInstance} $\ast$ {\bf instance} ()
\item 
static {\bf KStandard\-Dirs} $\ast$ {\bf dirs} ()
\item 
static {\bf KConfig} $\ast$ {\bf config} ()
\item 
static {\bf KShared\-Config} $\ast$ {\bf shared\-Config} ()
\item 
static {\bf KIcon\-Loader} $\ast$ {\bf icon\-Loader} ()
\item 
static {\bf KLocale} $\ast$ {\bf locale} ()
\item 
static {\bf KCharsets} $\ast$ {\bf charsets} ()
\item 
static const {\bf QString} \& {\bf static\-QString} (const char $\ast$str)
\item 
static const {\bf QString} \& {\bf static\-QString} (const {\bf QString} \&str)
\item 
static void {\bf register\-Static\-Deleter} ({\bf KStatic\-Deleter\-Base} $\ast$d)
\item 
static void {\bf unregister\-Static\-Deleter} ({\bf KStatic\-Deleter\-Base} $\ast$d)
\item 
static void {\bf delete\-Static\-Deleters} ()
\item 
static void {\bf set\-Active\-Instance} ({\bf KInstance} $\ast$d)
\item 
static {\bf KInstance} $\ast$ {\bf active\-Instance} ()\label{classKGlobal_e13}

\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
static KString\-Dict $\ast$ {\bf \_\-string\-Dict} = 0\label{classKGlobal_s0}

\item 
static {\bf KInstance} $\ast$ {\bf \_\-instance} = 0\label{classKGlobal_s1}

\item 
static {\bf KLocale} $\ast$ {\bf \_\-locale} = 0\label{classKGlobal_s2}

\item 
static {\bf KCharsets} $\ast$ {\bf \_\-charsets} = 0\label{classKGlobal_s3}

\item 
static KStatic\-Deleter\-List $\ast$ {\bf \_\-static\-Deleters} = 0\label{classKGlobal_s4}

\item 
static {\bf KInstance} $\ast$ {\bf \_\-active\-Instance} = 0\label{classKGlobal_s5}

\end{CompactItemize}
\subsection*{Related Functions}
(Note that these are not member functions.) \begin{CompactItemize}
\item 
KDECORE\_\-EXPORT bool {\bf check\-Access} (const {\bf QString} \&pathname, int mode)
\item 
{\bf kdbgstream} \& {\bf endl} ({\bf kdbgstream} \&s)
\item 
{\bf kdbgstream} \& {\bf flush} ({\bf kdbgstream} \&s)
\item 
KDECORE\_\-EXPORT {\bf kdbgstream} {\bf kd\-Debug} (int area=0)
\item 
KDECORE\_\-EXPORT {\bf QString} {\bf kd\-Backtrace} ()
\item 
KDECORE\_\-EXPORT {\bf QString} {\bf kd\-Backtrace} (int levels)
\item 
KDECORE\_\-EXPORT {\bf kdbgstream} {\bf kd\-Warning} (int area=0)
\item 
KDECORE\_\-EXPORT {\bf kdbgstream} {\bf kd\-Error} (int area=0)
\item 
KDECORE\_\-EXPORT {\bf kdbgstream} {\bf kd\-Fatal} (int area=0)
\item 
KDECORE\_\-EXPORT void {\bf kd\-Clear\-Debug\-Config} ()
\item 
{\bf KMIN}(a, b)
\item 
{\bf KMAX}(a, b)
\item 
{\bf KABS}(a)
\item 
{\bf KCLAMP}(x, low, high)
\end{CompactItemize}


\subsection{Detailed Description}
Access to the {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} 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 {\bf KStatic\-Deleter\-Base}{\rm (p.\,\pageref{classKStaticDeleterBase})}.

\begin{Desc}
\item[See also:]{\bf KStatic\-Deleter\-Base}{\rm (p.\,\pageref{classKStaticDeleterBase})} \end{Desc}
\begin{Desc}
\item[Author:]Sirtaj Singh Kang ({\tt taj@kde.org}) \end{Desc}




Definition at line 44 of file kglobal.h.

\subsection{Member Function Documentation}
\index{KGlobal@{KGlobal}!instance@{instance}}
\index{instance@{instance}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KInstance} $\ast$ KGlobal::instance ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e0}


Returns the global instance. 

There is always at least one instance of a component in one application (in most cases the application itself). \begin{Desc}
\item[Returns:]the global instance \end{Desc}


Definition at line 81 of file kglobal.cpp.

Referenced by KApplication::caption(), KLocale::KLocale(), and KApplication::x11Event\-Filter().\index{KGlobal@{KGlobal}!dirs@{dirs}}
\index{dirs@{dirs}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KStandard\-Dirs} $\ast$ KGlobal::dirs ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e1}


Returns the application standard dirs object. 

\begin{Desc}
\item[Returns:]the global standard dir object \end{Desc}


Definition at line 53 of file kglobal.cpp.

References KInstance::dirs().

Referenced by KIcon\-Loader::add\-Extra\-Desktop\-Themes(), KLocale::all\-Countries\-Two\-Alpha(), KConfig\-Back\-End::change\-File\-Name(), KPalette::get\-Palette\-List(), KDesktop\-File::is\-Authorized\-Desktop\-File(), KIcon\-Theme::KIcon\-Theme(), KLocale::lang\-Lookup(), KIcon\-Theme::list(), KDesktop\-File::locate\-Local(), and KConfig\-INIBack\-End::parse\-Config\-Files().\index{KGlobal@{KGlobal}!config@{config}}
\index{config@{config}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KConfig} $\ast$ KGlobal::config ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e2}


Returns the general config object. 

\begin{Desc}
\item[Returns:]the global configuration object. \end{Desc}


Definition at line 60 of file kglobal.cpp.

References KInstance::config().

Referenced by KApplication::authorize(), KApplication::authorize\-Control\-Module(), KApplication::authorize\-Control\-Modules(), KCharsets::codec\-For\-Name(), KApplication::create\-Application\-Palette(), KIcon\-Theme::current(), KIcon\-Effect::init(), KShortcut\-List::read\-Settings(), KShortcut\-List::write\-Settings(), and KApplication::x11Event\-Filter().\index{KGlobal@{KGlobal}!sharedConfig@{sharedConfig}}
\index{sharedConfig@{sharedConfig}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KShared\-Config} $\ast$ KGlobal::shared\-Config ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e3}


Returns the general config object. 

\begin{Desc}
\item[Returns:]the global configuration object. \end{Desc}


Definition at line 67 of file kglobal.cpp.

References KInstance::shared\-Config().

Referenced by KConfig\-Skeleton::KConfig\-Skeleton().\index{KGlobal@{KGlobal}!iconLoader@{iconLoader}}
\index{iconLoader@{iconLoader}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KIcon\-Loader} $\ast$ KGlobal::icon\-Loader ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e4}


Returns an iconloader object. 

\begin{Desc}
\item[Returns:]the global iconloader object \end{Desc}


Definition at line 74 of file kglobal.cpp.

References KInstance::icon\-Loader().

Referenced by KIcon\-Loader::unknown().\index{KGlobal@{KGlobal}!locale@{locale}}
\index{locale@{locale}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KLocale} $\ast$ KGlobal::locale ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e5}


Returns the global locale object. 

\begin{Desc}
\item[Returns:]the global locale object \end{Desc}


Definition at line 87 of file kglobal.cpp.

Referenced by KCharsets::codec\-For\-Name(), KLocale::i18n(), KLocale::lang\-Lookup(), and KConfig\-Base::set\-Locale().\index{KGlobal@{KGlobal}!charsets@{charsets}}
\index{charsets@{charsets}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KCharsets} $\ast$ KGlobal::charsets ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e6}


The global charset manager. 

\begin{Desc}
\item[Returns:]the global charset manager \end{Desc}


Definition at line 101 of file kglobal.cpp.

Referenced by KCharsets::descriptive\-Encoding\-Names().\index{KGlobal@{KGlobal}!staticQString@{staticQString}}
\index{staticQString@{staticQString}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString} \& KGlobal::static\-QString (const char $\ast$ {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e7}


Creates a static {\bf QString}. 

To be used inside functions(!) like: 

\footnotesize\begin{verbatim} static const QString &myString = KGlobal::staticQString("myText");
\end{verbatim}
\normalsize


!!! Do \_\-NOT\_\- use: !!! 

\footnotesize\begin{verbatim} static QString myString = KGlobal::staticQString("myText");
\end{verbatim}
\normalsize
 This creates a static object (instead of a static reference) and as you know static objects are EVIL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to create \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the static string \end{Desc}


Definition at line 125 of file kglobal.cpp.

Referenced by KApplication::authorize\-KAction(), KString\-Handler::from8Bit(), KIcon\-Loader::icon\-Path(), KIcon\-Loader::load\-Icon(), KConfig\-Base::read\-Entry(), and KConfig\-Base::read\-List\-Entry().\index{KGlobal@{KGlobal}!staticQString@{staticQString}}
\index{staticQString@{staticQString}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString} \& KGlobal::static\-QString (const {\bf QString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e8}


Creates a static {\bf QString}. 

To be used inside functions(!) like: 

\footnotesize\begin{verbatim} static const QString &myString = KGlobal::staticQString(i18n("My Text"));
\end{verbatim}
\normalsize


!!! Do \_\-NOT\_\- use: !!! 

\footnotesize\begin{verbatim} static QString myString = KGlobal::staticQString(i18n("myText"));
\end{verbatim}
\normalsize
 This creates a static object (instead of a static reference) and as you know static objects are EVIL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to create \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the static string \end{Desc}


Definition at line 143 of file kglobal.cpp.

References QString::find(), and QString::insert().\index{KGlobal@{KGlobal}!registerStaticDeleter@{registerStaticDeleter}}
\index{registerStaticDeleter@{registerStaticDeleter}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KGlobal::register\-Static\-Deleter ({\bf KStatic\-Deleter\-Base} $\ast$ {\em d})\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e9}


Registers a static deleter. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em d}]the static deleter to register \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KStatic\-Deleter\-Base}{\rm (p.\,\pageref{classKStaticDeleterBase})} 

{\bf KStatic\-Deleter}{\rm (p.\,\pageref{classKStaticDeleter})} \end{Desc}


Definition at line 166 of file kglobal.cpp.

References QString::append().

Referenced by KStatic\-Deleter$<$ type $>$::set\-Object().\index{KGlobal@{KGlobal}!unregisterStaticDeleter@{unregisterStaticDeleter}}
\index{unregisterStaticDeleter@{unregisterStaticDeleter}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KGlobal::unregister\-Static\-Deleter ({\bf KStatic\-Deleter\-Base} $\ast$ {\em d})\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e10}


Unregisters a static deleter. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em d}]the static deleter to unregister \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KStatic\-Deleter\-Base}{\rm (p.\,\pageref{classKStaticDeleterBase})} 

{\bf KStatic\-Deleter}{\rm (p.\,\pageref{classKStaticDeleter})} \end{Desc}


Definition at line 175 of file kglobal.cpp.

Referenced by KStatic\-Deleter$<$ type $>$::set\-Object().\index{KGlobal@{KGlobal}!deleteStaticDeleters@{deleteStaticDeleters}}
\index{deleteStaticDeleters@{deleteStaticDeleters}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KGlobal::delete\-Static\-Deleters ()\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e11}


Calls {\bf KStatic\-Deleter\-Base::destruct\-Object()}{\rm (p.\,\pageref{classKStaticDeleterBase_a1})} on all registered static deleters and unregisters them all. 

\begin{Desc}
\item[See also:]{\bf KStatic\-Deleter\-Base}{\rm (p.\,\pageref{classKStaticDeleterBase})} 

{\bf KStatic\-Deleter}{\rm (p.\,\pageref{classKStaticDeleter})} \end{Desc}


Definition at line 182 of file kglobal.cpp.\index{KGlobal@{KGlobal}!setActiveInstance@{setActiveInstance}}
\index{setActiveInstance@{setActiveInstance}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KGlobal::set\-Active\-Instance ({\bf KInstance} $\ast$ {\em d})\hspace{0.3cm}{\tt  [static]}}\label{classKGlobal_e12}


The instance currently active (useful in a multi-instance application, such as a KParts application). 

Don't use this - it's mainly for {\bf KAbout\-Dialog} and {\bf KBug\-Report}. 

Definition at line 111 of file kglobal.cpp.

References KLocale::set\-Active\-Catalogue().

Referenced by KInstance::KInstance(), and KInstance::$\sim$KInstance().

\subsection{Friends And Related Function Documentation}
\index{KGlobal@{KGlobal}!checkAccess@{checkAccess}}
\index{checkAccess@{checkAccess}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDECORE\_\-EXPORT bool check\-Access (const {\bf QString} \& {\em pathname}, int {\em mode})\hspace{0.3cm}{\tt  [related]}}\label{classKGlobal_m0}


Check, if a file may be accessed in a given mode. 

This is a wrapper around the access() system call. {\bf check\-Access()}{\rm (p.\,\pageref{classKGlobal_m0})} calls access() with the given parameters. If this is OK, {\bf check\-Access()}{\rm (p.\,\pageref{classKGlobal_m0})} returns true. If not, and W\_\-OK is part of mode, it is checked if there is write access to the directory. If yes, {\bf check\-Access()}{\rm (p.\,\pageref{classKGlobal_m0})} returns true. In all other cases {\bf check\-Access()}{\rm (p.\,\pageref{classKGlobal_m0})} returns false.

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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pathname}]The full path of the file you want to test \item[{\em mode}]The access mode, as in the access() system call. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Whether the access is allowed, true = Access allowed \end{Desc}


Definition at line 2823 of file kapplication.cpp.

References QString::find\-Rev(), and QString::truncate().\index{KGlobal@{KGlobal}!KMIN@{KMIN}}
\index{KMIN@{KMIN}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMIN(a, b)\hspace{0.3cm}{\tt  [related]}}\label{classKGlobal_m10}


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



Definition at line 177 of file kglobal.h.\index{KGlobal@{KGlobal}!KMAX@{KMAX}}
\index{KMAX@{KMAX}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMAX(a, b)\hspace{0.3cm}{\tt  [related]}}\label{classKGlobal_m11}


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



Definition at line 182 of file kglobal.h.\index{KGlobal@{KGlobal}!KABS@{KABS}}
\index{KABS@{KABS}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KABS(a)\hspace{0.3cm}{\tt  [related]}}\label{classKGlobal_m12}


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



Definition at line 187 of file kglobal.h.\index{KGlobal@{KGlobal}!KCLAMP@{KCLAMP}}
\index{KCLAMP@{KCLAMP}!KGlobal@{KGlobal}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCLAMP(x, low, high)\hspace{0.3cm}{\tt  [related]}}\label{classKGlobal_m13}


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:\begin{CompactItemize}
\item 
kglobal.h\item 
kapplication.h\item 
kdebug.h\item 
kglobal.cpp\end{CompactItemize}
