Git commit 6e2575ac1bbfeb79f06ff52cbcd3a92cd7dd19b1 by Sergio Martins. Committed on 31/10/2013 at 22:05. Pushed by smartins into branch 'KDE/4.11'. Reduce nesting, having a hard time reading this... M +28 -20 akonadi/calendar/incidencechanger.cpp http://commits.kde.org/kdepimlibs/6e2575ac1bbfeb79f06ff52cbcd3a92cd7dd19b1 diff --git a/akonadi/calendar/incidencechanger.cpp b/akonadi/calendar/incid= encechanger.cpp index 4cdce51..47d1f05 100644 --- a/akonadi/calendar/incidencechanger.cpp +++ b/akonadi/calendar/incidencechanger.cpp @@ -568,26 +568,34 @@ bool IncidenceChanger::Private::handleInvitationsAfte= rChange( const Change::Ptr break; case IncidenceChanger::ChangeTypeModify: { - if ( !change->originalItems.isEmpty() ) { - Q_ASSERT( change->originalItems.count() =3D=3D 1 ); - Incidence::Ptr oldIncidence =3D CalendarUtils::incidence( change= ->originalItems.first() ); - Incidence::Ptr newIncidence =3D CalendarUtils::incidence( change= ->newItem ); - if ( newIncidence->supportsGroupwareCommunication() && - Akonadi::CalendarUtils::thatIsMe( newIncidence->organizer()= ->email() ) ) { // If we're not the organizer, the user already saw the "Do= you really want to do this, incidence will become out of sync" - if ( mInvitationStatusByAtomicOperation.contains( change->atom= icOperationId ) ) { - handler.setDefaultAction( actionFromStatus( mInvitationStatu= sByAtomicOperation.value( change->atomicOperationId ) ) ); - } - const bool attendeeStatusChanged =3D myAttendeeStatusChanged( = newIncidence, - ol= dIncidence, - Ak= onadi::CalendarUtils::allEmails() ); - ITIPHandlerHelper::SendResult status =3D handler.sendIncidence= ModifiedMessage( KCalCore::iTIPRequest, - = newIncidence, - = attendeeStatusChanged ); - - if ( change->atomicOperationId !=3D 0 ) { - mInvitationStatusByAtomicOperation.insert( change->atomicOpe= rationId, status ); - } - } + if ( change->originalItems.isEmpty() ) { + break; + } + + Q_ASSERT( change->originalItems.count() =3D=3D 1 ); + Incidence::Ptr oldIncidence =3D CalendarUtils::incidence( change->= originalItems.first() ); + Incidence::Ptr newIncidence =3D CalendarUtils::incidence( change->= newItem ); + + if ( !newIncidence->supportsGroupwareCommunication() || + !Akonadi::CalendarUtils::thatIsMe( newIncidence->organizer()-= >email() ) ) { + // If we're not the organizer, the user already saw the "Do you = really want to do this, incidence will become out of sync" + break; + } + + if ( mInvitationStatusByAtomicOperation.contains( change->atomicOp= erationId ) ) { + handler.setDefaultAction( actionFromStatus( mInvitationStatusByA= tomicOperation.value( change->atomicOperationId ) ) ); + } + + const bool attendeeStatusChanged =3D myAttendeeStatusChanged( newI= ncidence, + oldInc= idence, + Akonad= i::CalendarUtils::allEmails() ); + + ITIPHandlerHelper::SendResult status =3D handler.sendIncidenceModi= fiedMessage( KCalCore::iTIPRequest, + = newIncidence, + = attendeeStatusChanged ); + + if ( change->atomicOperationId !=3D 0 ) { + mInvitationStatusByAtomicOperation.insert( change->atomicOperati= onId, status ); } } break;