rem: c.writeEntry("Email Address", user+"@"+KolabConfig::self()->server() ); c.writeEntry("Name", KolabConfig::self()->realName() ); c.writeEntry("uoid", kapp->random() );
add: emailConfig->writeEntry("Email Address", user+"@"+KolabConfig::self()->server() ); emailConfig->writeEntry("Name", KolabConfig::self()->realName() ); emailConfig->writeEntry("uoid", kapp->random() );  if ( hasEmailIdentities ) delete emailConfig; emailConfig = 0;
context:     void apply()    {      KConfig c( "kmailrc" );      c.setGroup( "General" );      uint accCnt = c.readNumEntry( "accounts", 0 );      c.writeEntry( "accounts", accCnt+1 );      uint transCnt = c.readNumEntry( "transports", 0 );      c.writeEntry( "transports", transCnt+1 );      c.setGroup( QString("Account %1").arg(accCnt+1) );      int uid = kapp->random();      c.writeEntry( "Folder", uid );      c.writeEntry( "Id", uid );      c.writeEntry( "Type", "cachedimap");      c.writeEntry( "auth", "*");      c.writeEntry( "Name", "Kolab Server" );      c.writeEntry( "host", KolabConfig::self()->server() );      c.writeEntry( "login", KolabConfig::self()->user() );      c.setGroup( QString("Folder-%1").arg( uid ) );      c.writeEntry( "isOpen", true );      if ( KolabConfig::self()->savePassword() ) {        c.writeEntry( "pass", encryptStr(KolabConfig::self()->password()) );        c.writeEntry( "store-passwd", true );      }      c.setGroup( QString("Transport %1").arg(transCnt+1) );      c.writeEntry( "name", "Kolab Server" );      c.writeEntry( "host", KolabConfig::self()->server() );      // ### Should be done using the KPIM identity manager      if ( !c.hasGroup("Identity") )      {        c.setGroup( "Identity" );      }      else      {        int i = 0;        while (c.hasGroup(QString("Identity #%1").arg(i)))          ++i;        c.setGroup( QString("Identity #%1").arg(++i) );      }      QString user = KolabConfig::self()->user();      int pos = user.find( "@" );      if ( pos > 0 ) user = user.left( pos );      c.writeEntry("Email Address", user+"@"+KolabConfig::self()->server() );      c.writeEntry("Name", KolabConfig::self()->realName() );      c.writeEntry("uoid", kapp->random() );      // This needs to be done here, since it reference just just generated id      c.setGroup( "IMAP Resource" );      c.writeEntry("TheIMAPResourceAccount", uid);      c.writeEntry("TheIMAPResourceFolderParent", QString(".%1.directory/INBOX").arg( uid ));   }