From kde-commits Sat Jun 30 22:24:24 2007 From: "Nicolas Roffet" Date: Sat, 30 Jun 2007 22:24:24 +0000 To: kde-commits Subject: Re: KDE/kdegames/ksirtet/ksirtet Message-Id: <33468.86.158.67.150.1183242264.squirrel () roffet ! is-a-geek ! com> X-MARC-Message: https://marc.info/?l=kde-commits&m=118324229906947 Hi David, Am Samstag, 30. Juni 2007 00:34:27 schrieben Sie: > On Saturday 30 June 2007, Nicolas Roffet wrote: > > + if ( KApplication::kApplication()->isSessionRestored() ) > > + kRestoreMainWindows(); > > + else { > > + KSMainWindow *mw = new KSMainWindow; > > + mw->show(); > > + } > > + return KApplication::kApplication()->exec(); > > Strange way of writing it. Surely you have kapplication instance in this > block already, so this could be written much simpler+shorter(+safer, in > case it doesn't have a kapp one day) as: > > + if ( app.isSessionRestored() ) > + kRestoreMainWindows(); > + else { > + KSMainWindow *mw = new KSMainWindow; > + mw->show(); > + } > + return app.exec(); Thanks for your help. Actually, the KApplication is been instanced in a factory class in the library (libksirtet) and not in the application (ksirtet) itself. (I don't know why and if it's a good idea...) -> So the only way to access it is "kapp" or "KApplication::kApplication()" (which is the same and as I found the 1st way of writing more disturbing, I chose to replace it by the 2nd). :-/ -- Nicolas