Carsten Pfeiffer wrote: > > Hi, > > what should you do, when you need stuff from KGlobal, but you're not > having a KApplication? > E.g. currently you can't use KConfig without a KInstance/KApplication, > because KConfig uses KGlobal::dirs(), which is only available when there > is a KInstance. > > Should anyone needing KGlobal, KConfig and most possibly other classes > before KApplication create a temporary KInstance itself? The destructor of > KInstance should then set KGlobal::_instance to 0, so that the KApplication > object can become the next KGlobal::_instance. > > And we'd need to have a policy: before calling any methods in kdelibs, you > need to have either a KInstance or KApplication. > > Is this correct? > What should KGlobal::config() be when it doesn't know what name you want to use? The same with KLocale, KStandardDirs (which needs KConfig :) and KIconLoader. They all need to know the name of your application. If you need something of these before you have the KApplication, create a KInstance with the same name. KInstance is only about the name. You're right, that the self() pattern isn't implemented properly. Greetings, Stephan -- As long as Linux remains a religion of freeware fanatics, Microsoft have nothing to worry about. By Michael Surkan, PC Week Online