[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    ANN: KGlobal: Access to KDE globals
From:       Sirtaj Singh Kang <ssk () physics ! unimelb ! edu ! au>
Date:       1999-05-27 6:38:49
[Download RAW message or body]


Hi,

I don't think anybody will argue that #include<kapp.h> to access globals
like kapp and config was suboptimal, so Stephan and I came up with
KGlobal, Your Source of Global Variables for Daily Needs. 

Now you can access these variables via:

#include<kglobal.h>
#include<kconfig.h>	// Needed to use KConfig
#include<klocale.h>	// Needed to use KLocale

...
	KConfig *appcfg = KGlobal::config();
	QString mystr = i18n( "This is a string" );

How this will affect your code:

-> All methods are static and return a pointer to the variable.

-> You will have to explicitly #include the header for the type of the var
that you want to use, since they are all "class KConfig;" style incomplete
decls in KGlobal. Eg. #include<kconfig.h> to use KGlobal::config().

This reduces the overhead that kapp caused by including lots of headers
that you didn't need. 

-> kapp.h may not provide many of the old variables much longer. Please
use kglobal.h wherever possible.

There are some object ownership isses to sort out as stuff is moved out of
kapp where necessary, but this will not affect the use of KGlobal.

(Coolo: anything to add?)

-Taj.

Sirtaj S. Kang       taj@kde.org         ssk@physics.unimelb.edu.au
Univ of Melbourne	
			"I'm a commercial operating system."
				-Doug Michels (CEO SCO)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic