bool IncidenceChanger::changeIncidence( Incidence *oldinc, Incidence *newinc, int action, bool counter ) { kdDebug(5850)<<"IncidenceChanger::changeIncidence for incidence \""<<newinc->summary()<<"\" ( old one was \""<<oldinc->summary()<<"\")"<<endl; if( incidencesEqual( newinc, oldinc ) ) { // Don't do anything kdDebug(5850) << "Incidence not changed\n"; if ( counter ) { KCal::MailScheduler scheduler( mCalendar ); scheduler.performTransaction( newinc, Scheduler::Reply ); } } else { kdDebug(5850) << "Incidence changed\n"; bool statusChanged = myAttendeeStatusChanged( oldinc, newinc ); int revision = newinc->revision(); newinc->setRevision( revision + 1 ); // FIXME: Use a generic method for this! Ideally, have an interface class // for group cheduling. Each implementation could then just do what // it wants with the event. If no groupware is used,use the null // pattern... bool revert = KOPrefs::instance()->mUseGroupwareCommunication; if ( !counter && revert && KOGroupware::instance()->sendICalMessage( 0, KCal::Scheduler::Request, newinc, false, statusChanged ) ) { // Accept the event changes if ( action<0 ) { emit incidenceChanged( oldinc, newinc ); } else { emit incidenceChanged( oldinc, newinc, action ); } revert = false; } if ( counter && revert ) { // pseudo counter as done by outlook Event *e = dynamic_cast<Event*>( newinc ); if ( e ) { Incidence* tmp = oldinc->clone(); tmp->setSummary( i18n("Counter proposal: %1").arg( e->summary() ) ); tmp->setDescription( e->description() ); tmp->addComment( i18n("Proposed new meeting time: %1 - %2").arg( e->dtStartStr() ).arg( e->dtEndStr() ) ); KCal::MailScheduler scheduler( mCalendar ); scheduler.performTransaction( tmp, Scheduler::Reply ); } else { kdWarning(5850) << k_funcinfo << "Counter proposals only supported for events" << endl; } } if ( revert ) { assignIncidence( newinc, oldinc ); return false; } } return true; }