rem: KABC::DistributionListManager manager( ab ); manager.load();  QStringList dists = manager.listNames(); for (QStringList::Iterator it = dists.begin(); it != dists.end(); ++it) { KABC::DistributionList *list = manager.list( (*it) ); if ( list ) { QStringList emails = list->emails(); printf("alias %s\t %s\n", (*it).replace(QRegExp(" "), "_").local8Bit().data(), emails.join(",").local8Bit().data()); } } } else if ( args->isSet( "write" ) ) {
add: printf( "alias %s\t%s %s <%s>\n", key.local8Bit().data(), (*it).givenName().local8Bit().data(), (*it).familyName().local8Bit().data(), (*it).preferredEmail().local8Bit().data() );
context: int main(int argc, char **argv){    KInstance instance( "kabc2mutt" );    KCmdLineArgs::init( argc, argv, "kabc2mutt",	    i18n("kabc - mutt converter"), "0.1" );    KCmdLineArgs::addCmdLineOptions( options );    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();    KABC::AddressBook *ab = KABC::StdAddressBook::self();    if ( args->isSet( "read" ) ) {        // print all addressees	KABC::AddressBook::Iterator it;        for (it = ab->begin(); it != ab->end(); ++it) {	    if ( (*it).preferredEmail().isEmpty() )		continue;	    QString key = (*it).givenName().left(3) + (*it).familyName().left(3);		    printf("alias %s\t%s %s <%s>\n", key.local8Bit().data(),		    (*it).givenName().local8Bit().data(),		    (*it).familyName().local8Bit().data(),		    (*it).preferredEmail().local8Bit().data());	}	// print all ditribution lists	KABC::DistributionListManager manager( ab );	manager.load();	QStringList dists = manager.listNames();	for (QStringList::Iterator it = dists.begin(); it != dists.end(); ++it) {	    KABC::DistributionList *list = manager.list( (*it) );	    if ( list ) {		QStringList emails = list->emails();		printf("alias %s\t %s\n",			(*it).replace(QRegExp(" "), "_").local8Bit().data(),			emails.join(",").local8Bit().data());	    }	}    } else if ( args->isSet( "write" ) ) {	/**	 * atm mutt doesn't support writing back email addresses to	 * a programm, so patching mutt would be the only way for	 * adding addresses from it.	 */    }    return 0;}