~kubuntu-members/kdepimlibs/4.11

« back to all changes in this revision

Viewing changes to akonadi/calendar/incidencechanger.cpp

  • Committer: Sergio Martins
  • Date: 2013-10-31 22:05:57 UTC
  • Revision ID: git-v1:6e2575ac1bbfeb79f06ff52cbcd3a92cd7dd19b1
Reduce nesting, having a hard time reading this...

Show diffs side-by-side

added added

removed removed

Lines of Context:
568
568
      break;
569
569
      case IncidenceChanger::ChangeTypeModify:
570
570
      {
571
 
        if ( !change->originalItems.isEmpty() ) {
572
 
          Q_ASSERT( change->originalItems.count() == 1 );
573
 
          Incidence::Ptr oldIncidence = CalendarUtils::incidence( change->originalItems.first() );
574
 
          Incidence::Ptr newIncidence = CalendarUtils::incidence( change->newItem );
575
 
          if ( newIncidence->supportsGroupwareCommunication() &&
576
 
               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"
577
 
            if ( mInvitationStatusByAtomicOperation.contains( change->atomicOperationId ) ) {
578
 
              handler.setDefaultAction( actionFromStatus( mInvitationStatusByAtomicOperation.value( change->atomicOperationId ) ) );
579
 
            }
580
 
            const bool attendeeStatusChanged = myAttendeeStatusChanged( newIncidence,
581
 
                                                                        oldIncidence,
582
 
                                                                        Akonadi::CalendarUtils::allEmails() );
583
 
            ITIPHandlerHelper::SendResult status = handler.sendIncidenceModifiedMessage( KCalCore::iTIPRequest,
584
 
                                                                                              newIncidence,
585
 
                                                                                              attendeeStatusChanged );
586
 
 
587
 
            if ( change->atomicOperationId != 0 ) {
588
 
              mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
589
 
            }
590
 
          }
 
571
        if ( change->originalItems.isEmpty() ) {
 
572
          break;
 
573
        }
 
574
 
 
575
        Q_ASSERT( change->originalItems.count() == 1 );
 
576
        Incidence::Ptr oldIncidence = CalendarUtils::incidence( change->originalItems.first() );
 
577
        Incidence::Ptr newIncidence = CalendarUtils::incidence( change->newItem );
 
578
 
 
579
        if ( !newIncidence->supportsGroupwareCommunication() ||
 
580
             !Akonadi::CalendarUtils::thatIsMe( newIncidence->organizer()->email() ) ) {
 
581
          // If we're not the organizer, the user already saw the "Do you really want to do this, incidence will become out of sync"
 
582
          break;
 
583
        }
 
584
 
 
585
        if ( mInvitationStatusByAtomicOperation.contains( change->atomicOperationId ) ) {
 
586
          handler.setDefaultAction( actionFromStatus( mInvitationStatusByAtomicOperation.value( change->atomicOperationId ) ) );
 
587
        }
 
588
 
 
589
        const bool attendeeStatusChanged = myAttendeeStatusChanged( newIncidence,
 
590
                                                                    oldIncidence,
 
591
                                                                    Akonadi::CalendarUtils::allEmails() );
 
592
 
 
593
        ITIPHandlerHelper::SendResult status = handler.sendIncidenceModifiedMessage( KCalCore::iTIPRequest,
 
594
                                                                                     newIncidence,
 
595
                                                                                     attendeeStatusChanged );
 
596
 
 
597
        if ( change->atomicOperationId != 0 ) {
 
598
          mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
591
599
        }
592
600
      }
593
601
      break;