clock2/clockui/uilayer/clockalarmeditor/src/clockalarmeditorimpl.cpp
branchRCL_3
changeset 25 bf573002ff72
parent 18 d68a4b5d5885
child 27 aba12c885d83
equal deleted inserted replaced
20:9c5b1510919f 25:bf573002ff72
    41 #include "clkcommon.h"
    41 #include "clkcommon.h"
    42 #include "clock_debug.h"
    42 #include "clock_debug.h"
    43 
    43 
    44 // Constants
    44 // Constants
    45 const TInt KZerothDay( 0 );
    45 const TInt KZerothDay( 0 );
       
    46 const TInt KNextDayIndex( 1 );
    46 const TInt KDaysInWeek( 7 );
    47 const TInt KDaysInWeek( 7 );
    47 const TInt KFirstLine( 1 );
    48 const TInt KFirstLine( 1 );
    48 const TInt KRepeatOnceIndex( 0 );
    49 const TInt KRepeatOnceIndex( 0 );
    49 const TInt KDailyIndex( 1 );
    50 const TInt KDailyIndex( 1 );
    50 const TInt KWorkdaysIndex( 2 );
    51 const TInt KWorkdaysIndex( 2 );
   408     // Cleanup
   409     // Cleanup
   409     CleanupStack::PopAndDestroy( alarmDescription );
   410     CleanupStack::PopAndDestroy( alarmDescription );
   410     
   411     
   411     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
   412     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
   412     // workdays. So when this functions is called, we check for the type and update the form accordingly.
   413     // workdays. So when this functions is called, we check for the type and update the form accordingly.
   413     if( KDailyIndex == iOccuranceIndex ||
   414     if( KWeeklyIndex != iOccuranceIndex )
   414         KWorkdaysIndex == iOccuranceIndex )
       
   415         {
   415         {
   416         DeleteAlmDayCtrlL();
   416         DeleteAlmDayCtrlL();
   417         }
   417         }
   418 		
   418 		
   419 	__PRINTS( "CClockAlarmEditorImpl::PreLayoutDynInitL - Exit" );
   419 	__PRINTS( "CClockAlarmEditorImpl::PreLayoutDynInitL - Exit" );
   664     // Get the new occurance index
   664     // Get the new occurance index
   665     GetSelectedOccIndex();
   665     GetSelectedOccIndex();
   666     
   666     
   667     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
   667     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
   668     // workdays. So when this functions is called, we check for the type and update the form accordingly.
   668     // workdays. So when this functions is called, we check for the type and update the form accordingly.
   669     if( KDailyIndex == iOccuranceIndex ||
   669     if( KWeeklyIndex != iOccuranceIndex )
   670         KWorkdaysIndex == iOccuranceIndex )
       
   671         {
   670         {
   672         DeleteAlmDayCtrlL();
   671         DeleteAlmDayCtrlL();
   673         }
   672         }
   674     // If it is not present, we need to create it.
   673     // If it is not present, we need to create it.
   675     else 
   674     else 
   950     __PRINTS( "CClockAlarmEditorImpl::GetActualAlarmTime - Entry" );
   949     __PRINTS( "CClockAlarmEditorImpl::GetActualAlarmTime - Entry" );
   951 	
   950 	
   952     // Get the current day of the week.
   951     // Get the current day of the week.
   953     TInt currentDay( aHomeTime.DayNoInWeek() );
   952     TInt currentDay( aHomeTime.DayNoInWeek() );
   954         
   953         
   955     if( ( KRepeatOnceIndex == iOccuranceIndex ) ||
   954     if( KWeeklyIndex == iOccuranceIndex )
   956         ( KWeeklyIndex == iOccuranceIndex ) )
       
   957         {
   955         {
   958         TInt dateOffset( KZerothDay );
   956         TInt dateOffset( KZerothDay );
   959 
   957 
   960         if( currentDay < iDayIndex )
   958         if( currentDay < iDayIndex )
   961             {
   959             {
   978                 dateOffset = KDaysInWeek;
   976                 dateOffset = KDaysInWeek;
   979                 }
   977                 }
   980             }
   978             }
   981         aTimeFromForm += TTimeIntervalDays( dateOffset );
   979         aTimeFromForm += TTimeIntervalDays( dateOffset );
   982         }
   980         }
       
   981         else if( KRepeatOnceIndex == iOccuranceIndex )  
       
   982             {            
       
   983             if( aTimeFromForm < aHomeTime )
       
   984                 {                  
       
   985                 aTimeFromForm += TTimeIntervalDays( KNextDayIndex );
       
   986                 }            
       
   987             }
   983     __PRINTS( "CClockAlarmEditorImpl::GetActualAlarmTime - Exit" );
   988     __PRINTS( "CClockAlarmEditorImpl::GetActualAlarmTime - Exit" );
   984     }
   989     }
   985 
   990 
   986 // ---------------------------------------------------------
   991 // ---------------------------------------------------------
   987 // CClockAlarmEditorImpl::GetAlarmInformationL
   992 // CClockAlarmEditorImpl::GetAlarmInformationL