calendarui/editors/src/calenrepeatfield.cpp
branchRCL_3
changeset 20 9c5b1510919f
parent 0 f979ecb2b13e
child 28 96907930389d
equal deleted inserted replaced
18:d68a4b5d5885 20:9c5b1510919f
    32 #include <CalenDefaultEditorsData.rsg>
    32 #include <CalenDefaultEditorsData.rsg>
    33 
    33 
    34 // debug
    34 // debug
    35 #include "calendarui_debug.h"
    35 #include "calendarui_debug.h"
    36 
    36 
       
    37 //Feb 29th will be read as 28 as indexing of days starts from 0,1,2....
       
    38 const TInt KLastDayInFebLeapYear = 28;
       
    39 
    37 // CONSTRUCTION AND DESTRUCTION METHODS
    40 // CONSTRUCTION AND DESTRUCTION METHODS
    38 
    41 
    39 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    40 // CCalenRepeatField::NewL
    43 // CCalenRepeatField::NewL
    41 // (other items were commented in a header).
    44 // (other items were commented in a header).
   261             {
   264             {
   262             until = iUnifiedEditor.Edited().RepeatUntilDateTime();
   265             until = iUnifiedEditor.Edited().RepeatUntilDateTime();
   263             }
   266             }
   264         else
   267         else
   265             {
   268             {
   266             TDateTime repUntilDateTime( ECalenMaxYear, TMonth(ECalenMaxMonth), ECalenMaxDay, 0, 0, 0, 0 );
   269 			//Fix for repeated event date change:
   267             TTime aTime( repUntilDateTime );
   270             TDateTime startDate = start.DateTime();
       
   271             
       
   272             //Checking for leap year feb.29th, next year it should be 28.
       
   273             TInt untilDay;
       
   274             if(startDate.Month() == EFebruary && startDate.Day() == KLastDayInFebLeapYear)
       
   275                 {
       
   276                 untilDay = KLastDayInFebLeapYear - 1;
       
   277                 }
       
   278             else
       
   279                 {
       
   280                 untilDay = startDate.Day();
       
   281                 }
       
   282             
       
   283             TDateTime repOneYear(startDate.Year()+1,startDate.Month(), untilDay, 0, 0, 0, 0);
       
   284             TTime aTime( repOneYear );
   268             until = aTime;
   285             until = aTime;
   269             }
   286             }
   270 
   287 
   271         iUnifiedEditor.Edited().SetRepeatingL( static_cast<TCalenRepeatIndex>( repeatType ), until );
   288         iUnifiedEditor.Edited().SetRepeatingL( static_cast<TCalenRepeatIndex>( repeatType ), until );
   272         SetRepeatUntilLineDimmedL( EFalse );
   289         SetRepeatUntilLineDimmedL( EFalse );