void KCalResourceSlox::parseMembersAttribute( const QDomElement &e, Incidence *incidence ) { incidence->clearAttendees(); QDomNode n; for( n = e.firstChild(); !n.isNull(); n = n.nextSibling() ) { QDomElement memberElement = n.toElement(); if ( memberElement.tagName() == fieldName( Participant ) ) { QString member = memberElement.text(); KABC::Addressee account; if ( mAccounts ) account = mAccounts->lookupUser( member ); else kError() << "KCalResourceSlox: no accounts set"; QString name; QString email; Attendee *a = incidence->attendeeByUid( member ); if ( account.isEmpty() ) { if ( a ) continue; name = member; email = member + '@' + KUrl( mPrefs->url() ).host(); } else { name = account.realName(); email = account.preferredEmail(); } if ( a ) { a->setName( name ); a->setEmail( email ); } else { a = new Attendee( name, email ); a->setUid( member ); incidence->addAttendee( a ); } QString status = memberElement.attribute( "confirm" ); if ( !status.isEmpty() ) { if ( status == "accept" ) { a->setStatus( Attendee::Accepted ); } else if ( status == "decline" ) { a->setStatus( Attendee::Declined ); } else { a->setStatus( Attendee::NeedsAction ); } } } else { kDebug() << "Unknown tag in members attribute:" << memberElement.tagName(); } } }
void KOAttendeeEditor::updateAttendee() { Attendee *a = currentAttendee(); if ( !a || mDisableItemUpdate ) return; QString name; QString email; KPIM::getNameAndMail(mNameEdit->text(), name, email); bool iAmTheOrganizer = mOrganizerCombo && KOPrefs::instance()->thatIsMe( mOrganizerCombo->currentText() ); if ( iAmTheOrganizer ) { bool myself = KPIM::compareEmail( email, mOrganizerCombo->currentText(), false ); bool wasMyself = KPIM::compareEmail( a->email(), mOrganizerCombo->currentText(), false ); if ( myself ) { mStatusCombo->setCurrentItem( KCal::Attendee::Accepted ); mRsvpButton->setChecked( false ); mRsvpButton->setEnabled( false ); } else if ( wasMyself ) { // this was me, but is no longer, reset mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction ); mRsvpButton->setChecked( true ); mRsvpButton->setEnabled( true ); } } a->setName( name ); a->setUid( mUid ); a->setEmail( email ); a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); a->setRSVP( mRsvpButton->isChecked() ); updateCurrentItem(); }