rem: email = pos;
add: email = user;
context:     void apply()    {      QString email;      QString user = KolabConfig::self()->user();      int pos = user.find( "@" );      // with kolab the userid _is_ the full email      if ( pos > 0 )        // The user typed in a full email address. Assume it's correct        email = pos;      else        // Construct the email address. And use it for the username also        user = email = user+"@"+KolabConfig::self()->server();      KConfig c( "kmailrc" );      c.setGroup( "General" );      c.writeEntry( "checkmail-startup", true );      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", user );      if ( KolabConfig::self()->savePassword() ) {        c.writeEntry( "pass", encryptStr(KolabConfig::self()->password()) );        c.writeEntry( "store-passwd", true );      }      c.writeEntry( "port", "993" );      c.writeEntry( "use-ssl", true );      c.writeEntry( "sieve-support", "true" );      c.setGroup( QString("Folder-%1").arg( uid ) );      c.writeEntry( "isOpen", true );      c.setGroup( QString("Transport %1").arg(transCnt+1) );      c.writeEntry( "name", "Kolab Server" );      c.writeEntry( "host", KolabConfig::self()->server() );      c.writeEntry( "type", "smtp" );      c.writeEntry( "port", "465" );      c.writeEntry( "encryption", "SSL" );      c.writeEntry( "auth", true );      c.writeEntry( "authtype", "PLAIN" );      c.writeEntry( "user", email );      c.writeEntry( "pass", encryptStr(KolabConfig::self()->password()) );      c.writeEntry( "storepass", "true" );      // Write email in "default kcontrol settings", used by IdentityManager      // if it has to create a default identity.      KEMailSettings es;      es.setSetting( KEMailSettings::RealName, KolabConfig::self()->realName() );      es.setSetting( KEMailSettings::EmailAddress, email );      KPIM::IdentityManager identityManager;      if ( !identityManager.allEmails().contains( email ) ) {        // Not sure how to name the identity. First one is "Default", next one "Kolab", but then...        KPIM::Identity& identity = identityManager.newFromScratch( i18n( "Kolab" ) );        identity.setFullName( KolabConfig::self()->realName() );        identity.setEmailAddr( email );        identityManager.commit();      }      // 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 ));   }