rem: KRES::Manager<ResourceNotes> m( "notes" ); m.readConfig(); KNotesIMAP::ResourceIMAP *r = new KNotesIMAP::ResourceIMAP( 0 ); r->setResourceName( i18n("Kolab Server") ); m.add( r ); m.writeConfig();
add: QString host = KolabConfig::self()->server(); QString basedn = host; basedn.replace(".",",dc="); basedn.prepend("dc=");  KConfig c( "kabldaprc" ); c.setGroup( "LDAP" ); bool hasMyServer = false; uint selHosts = c.readNumEntry("NumSelectedHosts", 0); for ( uint i = 0 ; i < selHosts && !hasMyServer; ++i ) if ( c.readEntry( QString("SelectedHost%1").arg(i) ) == host ) hasMyServer = true; if ( !hasMyServer ) { c.writeEntry( "NumSelectedHosts", selHosts + 1 ); c.writeEntry( QString("SelectedHost%1").arg(selHosts), host); c.writeEntry( QString("SelectedBase%1").arg(selHosts), basedn); c.writeEntry( QString("SelectedPort%1").arg(selHosts), "389"); }
context:     void apply()    {      KRES::Manager<ResourceNotes> m( "notes" );      m.readConfig();      KNotesIMAP::ResourceIMAP *r = new KNotesIMAP::ResourceIMAP( 0 );      r->setResourceName( i18n("Kolab Server") );      m.add( r );      m.writeConfig();    }