rem: if ( isRestored() ) {
add: if ( isSessionRestored() ) {
context: int KontactApp::newInstance(){  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();  QString moduleName;  if ( Kontact::Prefs::self()->forceStartupPlugin() ) {    moduleName = Kontact::Prefs::self()->forcedStartupPlugin();  }  if ( args->isSet( "module" ) ) {    moduleName = QString::fromLocal8Bit( args->getOption( "module" ) );  }  if ( isRestored() ) {    // There can only be one main window    if ( KMainWindow::canBeRestored( 1 ) ) {      mMainWindow = new Kontact::MainWindow();      setMainWidget( mMainWindow );      mMainWindow->show();      mMainWindow->restore( 1 );    }  } else {    if ( !mMainWindow ) {      mMainWindow = new Kontact::MainWindow();      if ( !moduleName.isEmpty() )        mMainWindow->setActivePluginModule( moduleName );      mMainWindow->show();      setMainWidget( mMainWindow );      // --iconify is needed in kontact, although kstart can do that too,      // because kstart returns immediately so it's too early to talk DCOP to the app.      if ( args->isSet( "iconify" ) )        KWin::iconifyWindow( mMainWindow->winId(), false /*no animation*/ );    } else {      if ( !moduleName.isEmpty() )        mMainWindow->setActivePluginModule( moduleName );    }  }  startKOrgac();  // Handle startup notification and window activation  // (The first time it will do nothing except note that it was called)  return KUniqueApplication::newInstance();}