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

List:       kde-commits
Subject:    Re: KDE/kdegames/ksirtet/ksirtet
From:       "Nicolas Roffet" <nicolas-kde () roffet ! com>
Date:       2007-06-30 22:24:24
Message-ID: 33468.86.158.67.150.1183242264.squirrel () roffet ! is-a-geek ! com
[Download RAW message or body]

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<KSMainWindow>();
> > +       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<KSMainWindow>();
> +       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

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

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