[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/KDE/4.11] akonadi/calendar: Reduce nesting, having a hard time reading this...
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2013-10-31 22:06:37
Message-ID: E1Vc0Nx-00084M-7f () scm ! kde ! org
[Download RAW message or body]

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/incidencechanger.cpp
index 4cdce51..47d1f05 100644
--- a/akonadi/calendar/incidencechanger.cpp
+++ b/akonadi/calendar/incidencechanger.cpp
@@ -568,26 +568,34 @@ bool IncidenceChanger::Private::handleInvitationsAfterChange( const Change::Ptr
       break;
       case IncidenceChanger::ChangeTypeModify:
       {
-        if ( !change->originalItems.isEmpty() ) {
-          Q_ASSERT( change->originalItems.count() == 1 );
-          Incidence::Ptr oldIncidence = CalendarUtils::incidence( change->originalItems.first() );
-          Incidence::Ptr newIncidence = 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->atomicOperationId ) ) {
-              handler.setDefaultAction( actionFromStatus( mInvitationStatusByAtomicOperation.value( \
                change->atomicOperationId ) ) );
-            }
-            const bool attendeeStatusChanged = myAttendeeStatusChanged( newIncidence,
-                                                                        oldIncidence,
-                                                                        \
                Akonadi::CalendarUtils::allEmails() );
-            ITIPHandlerHelper::SendResult status = handler.sendIncidenceModifiedMessage( \
                KCalCore::iTIPRequest,
-                                                                                              \
                newIncidence,
-                                                                                              \
                attendeeStatusChanged );
-
-            if ( change->atomicOperationId != 0 ) {
-              mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
-            }
-          }
+        if ( change->originalItems.isEmpty() ) {
+          break;
+        }
+
+        Q_ASSERT( change->originalItems.count() == 1 );
+        Incidence::Ptr oldIncidence = CalendarUtils::incidence( change->originalItems.first() );
+        Incidence::Ptr newIncidence = 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->atomicOperationId ) ) {
+          handler.setDefaultAction( actionFromStatus( mInvitationStatusByAtomicOperation.value( \
change->atomicOperationId ) ) ); +        }
+
+        const bool attendeeStatusChanged = myAttendeeStatusChanged( newIncidence,
+                                                                    oldIncidence,
+                                                                    Akonadi::CalendarUtils::allEmails() \
); +
+        ITIPHandlerHelper::SendResult status = handler.sendIncidenceModifiedMessage( \
KCalCore::iTIPRequest, +                                                                                  \
newIncidence, +                                                                                     \
attendeeStatusChanged ); +
+        if ( change->atomicOperationId != 0 ) {
+          mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
         }
       }
       break;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic