calendarui/editors/src/CalenEditorDataHandler.cpp
branchRCL_3
changeset 86 ed599363c2d7
parent 74 97232defd20e
equal deleted inserted replaced
78:356f28cd5ca0 86:ed599363c2d7
    28 #include <eikenv.h>
    28 #include <eikenv.h>
    29 #include <CalenInterimUtils2.h>
    29 #include <CalenInterimUtils2.h>
    30 #include <calencontext.h>
    30 #include <calencontext.h>
    31 #include <caleninstanceid.h>            // TCalenInstanceId
    31 #include <caleninstanceid.h>            // TCalenInstanceId
    32 #include <calenservices.h>
    32 #include <calenservices.h>
    33 #include <featmgr.h>
       
    34 
    33 
    35 // User includes
    34 // User includes
    36 #include "CalenEditorDataHandler.h"
    35 #include "CalenEditorDataHandler.h"
    37 #include "CalendarPrivateCRKeys.h"
    36 #include "CalendarPrivateCRKeys.h"
    38 #include "CalenDefaultEditors.hrh"
    37 #include "CalenDefaultEditors.hrh"
    41 #include "calenattachmentutils.h"
    40 #include "calenattachmentutils.h"
    42 #include "calenattachmentinfo.h"
    41 #include "calenattachmentinfo.h"
    43 #include "calenattachmentmodel.h"
    42 #include "calenattachmentmodel.h"
    44 #include "calenunifiededitor.h"
    43 #include "calenunifiededitor.h"
    45 #include "calendarui_debug.h"
    44 #include "calendarui_debug.h"
    46 #include "koreanlunardateutil.h"
       
    47 
    45 
    48 // Constants
    46 // Constants
    49 #define KNoOfDaysInWeek  7
    47 #define KNoOfDaysInWeek  7
    50 
    48 
    51 // ======== LOCAL FUNCTIONS ========
    49 // ======== LOCAL FUNCTIONS ========
   146     else
   144     else
   147         {
   145         {
   148         iInstanceId = iServices.Context().InstanceId();
   146         iInstanceId = iServices.Context().InstanceId();
   149         }
   147         }
   150     
   148     
   151     // Sets up TLS, must be done before FeatureManager is used.
   149 
   152     FeatureManager::InitializeLibL();
       
   153     // Used in destructor. 
       
   154     iFeatMgrInitialized = ETrue;
       
   155     
       
   156     TRACE_EXIT_POINT;
   150     TRACE_EXIT_POINT;
   157     }
   151     }
   158 
   152 
   159 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   160 // CCalenEditorDataHandler::NewL
   154 // CCalenEditorDataHandler::NewL
   192     {
   186     {
   193     TRACE_ENTRY_POINT;
   187     TRACE_ENTRY_POINT;
   194 
   188 
   195     delete iOriginal;
   189     delete iOriginal;
   196     delete iEdited;
   190     delete iEdited;
   197     
   191 
   198 	
       
   199 	// Do not call UnInitializeLib() if InitalizeLib() leaves.
       
   200     if ( iFeatMgrInitialized )
       
   201         {
       
   202         // Frees the TLS. Must be done after FeatureManager is used.
       
   203         FeatureManager::UnInitializeLib();  
       
   204         }  
       
   205         
       
   206     TRACE_EXIT_POINT;
   192     TRACE_EXIT_POINT;
   207     }
   193     }
   208 
   194 
   209 // ---------------------------------------------------------------------------
   195 // ---------------------------------------------------------------------------
   210 // CCalenEditorDataHandler::Edited
   196 // CCalenEditorDataHandler::Edited
   343              IsRepeatRuleEdited()    ||
   329              IsRepeatRuleEdited()    ||
   344              IsPriorityEdited()      ||
   330              IsPriorityEdited()      ||
   345              IsCalendarEditedL()     ||
   331              IsCalendarEditedL()     ||
   346              IsAttachmentExists()    ||
   332              IsAttachmentExists()    ||
   347              IsEventTypeEdited()     ||
   333              IsEventTypeEdited()     ||
   348              AllDayFieldEdited()     ||
   334              AllDayFieldEdited() );
   349              LunarFieldEdited() );
       
   350     }
   335     }
   351 
   336 
   352 // ---------------------------------------------------------------------------
   337 // ---------------------------------------------------------------------------
   353 // CCalenEditorDataHandler::TextFieldsEdited
   338 // CCalenEditorDataHandler::TextFieldsEdited
   354 // Returns ETrue if any of the text fields (e.g. summary) of the entry
   339 // Returns ETrue if any of the text fields (e.g. summary) of the entry
   426         }
   411         }
   427 
   412 
   428     // Repeat rule has to be modified in both cases
   413     // Repeat rule has to be modified in both cases
   429     if ( isNew || IsStartDateTimeEdited() || IsRepeatRuleEdited() )
   414     if ( isNew || IsStartDateTimeEdited() || IsRepeatRuleEdited() )
   430         {
   415         {
   431         if ( FeatureManager::FeatureSupported( KFeatureIdKorean ) && 
   416 
   432              Edited().EntryType() == CCalEntry::EAnniv &&
   417         if ( aRepeatTarget == CalCommon::EThisOnly)
   433              ( Edited().CalendarType() == ELunar || Edited().CalendarType() == ELunarLeap) )
   418             {
   434             { /* Lunar entries need special repeating dates */
       
   435             CKoreanLunarDateUtil* dateUtil = CKoreanLunarDateUtil::NewLC(&iServices);
       
   436             RArray<TCalTime> repeatDateList;
       
   437             CleanupClosePushL( repeatDateList );
       
   438             
       
   439             /* Clear previous repeat rules */
       
   440             iEntry.ClearRepeatingPropertiesL();
   419             iEntry.ClearRepeatingPropertiesL();
   441             TRAPD( err, dateUtil->GetLunarYearlyRepeatsL( repeatDateList, Edited().StartDateTime().DateTime(), UseFloatingTimeL() ) );
   420             }
   442             
   421         else if ( Edited().IsRepeating() )
   443             if( err == KErrNone )
   422             {
   444                 {
   423             // If we're an RDate (with repeat type ERepeatOther), don't try to set an RRule,
   445                 iEntry.SetRDatesL( repeatDateList );
   424             // but don't clear the repeat properties either.
   446                 }
   425             if( Edited().RepeatType() != ERepeatOther )
   447             
   426                 {
   448             /* Pop and destroy repeatDateList and dateUtil */
   427                 TCalRRule rrule;
   449             CleanupStack::PopAndDestroy(2);
   428 
   450             }
   429                 CalculateRepeatRuleL( Edited().StartDateTime(),
   451         else
   430                                       Edited().RepeatType(),
   452             {
   431                                       Edited().RepeatUntilDateTime(),
   453             if ( aRepeatTarget == CalCommon::EThisOnly)
   432                                       rrule );
   454                 {
   433 
   455                 iEntry.ClearRepeatingPropertiesL();
   434                 iEntry.SetRRuleL( rrule );
   456                 }
   435                 
   457             else if ( Edited().IsRepeating() )
   436                 // As there should not be any rdates, remove any that are
   458                 {
   437                 // still present
   459                 // If we're an RDate (with repeat type ERepeatOther), don't try to set an RRule,
   438                 RArray<TCalTime> emptyList;
   460                 // but don't clear the repeat properties either.
   439                 CleanupClosePushL( emptyList );
   461                 if( Edited().RepeatType() != ERepeatOther )
   440                 iEntry.SetRDatesL( emptyList );
       
   441                 CleanupStack::PopAndDestroy(); // emptyList
       
   442                 }
       
   443             else
       
   444                 {
       
   445                 // The repeat type is ERepeatOther, therefore as 
       
   446                 // it is impossible to create an entry of type
       
   447                 // ERepeat other using the editor either the repeat until
       
   448                 // date or the start date must have been changed
       
   449 
       
   450                 // The start date/time has changed, in order for the
       
   451                 // series to maintain its pattern, any rDates and if
       
   452                 // present rRule are moved by the same offset
       
   453                 // The repeat type is ERepeatOther, so check if we have any rdates
       
   454                 RArray<TCalTime> rDateList;
       
   455                 CleanupClosePushL( rDateList );
       
   456                 iEntry.GetRDatesL( rDateList );
       
   457                 TInt count = rDateList.Count();
       
   458 
       
   459                 if ( count == 0 )
   462                     {
   460                     {
       
   461                     // There are no rdates so the new until and start date can be applied
       
   462                     // directly.
   463                     TCalRRule rrule;
   463                     TCalRRule rrule;
   464                     
   464 
   465                     CalculateRepeatRuleL( Edited().StartDateTime(),
   465                     CalculateRepeatRuleL( Edited().StartDateTime(),
   466                     Edited().RepeatType(),
   466                                       Edited().RepeatType(),
   467                     Edited().RepeatUntilDateTime(),
   467                                       Edited().RepeatUntilDateTime(),
   468                     rrule );
   468                                       rrule );
   469                     
   469 
   470                     iEntry.SetRRuleL( rrule );
   470                     iEntry.SetRRuleL( rrule );
   471                     
       
   472                     // As there should not be any rdates, remove any that are
       
   473                     // still present
       
   474                     RArray<TCalTime> emptyList;
       
   475                     CleanupClosePushL( emptyList );
       
   476                     iEntry.SetRDatesL( emptyList );
       
   477                     CleanupStack::PopAndDestroy(); // emptyList
       
   478                     }
   471                     }
   479                 else
   472                 else
   480                     {
   473                     {
   481                     // The repeat type is ERepeatOther, therefore as 
   474                     // There are rDates which need to be checked.
   482                     // it is impossible to create an entry of type
   475                     if ( IsStartDateTimeEdited() )
   483                     // ERepeat other using the editor either the repeat until
   476                         {
   484                     // date or the start date must have been changed
   477                         // Need to shift any rdates
       
   478                         TTime editedStart = iEdited->StartDateTime();
       
   479                         TTime origStart = iOriginal->StartDateTime();
       
   480                         TTimeIntervalMicroSeconds offSet = editedStart.MicroSecondsFrom( origStart );
       
   481                         for ( TInt index = 0; index < count; index++ )
       
   482                             {
       
   483                             TCalTime& rDateTime = rDateList[ index ];
       
   484                             TTime shiftedTime = rDateTime.TimeUtcL();
       
   485                             TDateTime before = shiftedTime.DateTime();
       
   486                             shiftedTime += offSet;
       
   487                             TDateTime after = shiftedTime.DateTime();
       
   488                             rDateTime.SetTimeUtcL( shiftedTime ); 
       
   489                             }
       
   490                         }
       
   491 
       
   492                     //  Check and fix the rDates and rRules match the 
       
   493                     //  repeat until date and time.
       
   494                     TTime untilTime = Edited().RepeatUntilDateTime();
   485                     
   495                     
   486                     // The start date/time has changed, in order for the
   496                     // Remove any rdates that are after the the repeat until date
   487                     // series to maintain its pattern, any rDates and if
       
   488                     // present rRule are moved by the same offset
       
   489                     // The repeat type is ERepeatOther, so check if we have any rdates
       
   490                     RArray<TCalTime> rDateList;
       
   491                     CleanupClosePushL( rDateList );
       
   492                     iEntry.GetRDatesL( rDateList );
       
   493                     TInt count = rDateList.Count();
   497                     TInt count = rDateList.Count();
       
   498                     if ( count > 0 )
       
   499                         {
       
   500                         TInt index = count - 1;
       
   501                         do 
       
   502                             {
       
   503                             TTime lastRDate = CalenDateUtils::BeginningOfDay( rDateList[ index ].TimeLocalL() );
       
   504                             TDateTime before = lastRDate.DateTime();
       
   505                             if ( lastRDate > untilTime )
       
   506                                 {
       
   507                                 rDateList.Remove( index-- );
       
   508                                 }
       
   509                             else
       
   510                                 {
       
   511                                 index = KErrNotFound;
       
   512                                 }
       
   513                             } while ( index != KErrNotFound );
       
   514                         }
   494                     
   515                     
   495                     if ( count == 0 )
   516                     // Need to check if the end date of the
       
   517                     // rrule needs adjusting if it exists.
       
   518                     TCalRRule rRule;
       
   519                     if ( iEntry.GetRRuleL( rRule ) )
   496                         {
   520                         {
   497                         // There are no rdates so the new until and start date can be applied
   521                         count = rDateList.Count();
   498                         // directly.
       
   499                         TCalRRule rrule;
       
   500                         
       
   501                         CalculateRepeatRuleL( Edited().StartDateTime(),
       
   502                         Edited().RepeatType(),
       
   503                         Edited().RepeatUntilDateTime(),
       
   504                         rrule );
       
   505                         
       
   506                         iEntry.SetRRuleL( rrule );
       
   507                         }
       
   508                     else
       
   509                         {
       
   510                         // There are rDates which need to be checked.
       
   511                         if ( IsStartDateTimeEdited() )
       
   512                             {
       
   513                             // Need to shift any rdates
       
   514                             TTime editedStart = iEdited->StartDateTime();
       
   515                             TTime origStart = iOriginal->StartDateTime();
       
   516                             TTimeIntervalMicroSeconds offSet = editedStart.MicroSecondsFrom( origStart );
       
   517                             for ( TInt index = 0; index < count; index++ )
       
   518                                 {
       
   519                                 TCalTime& rDateTime = rDateList[ index ];
       
   520                                 TTime shiftedTime = rDateTime.TimeUtcL();
       
   521                                 TDateTime before = shiftedTime.DateTime();
       
   522                                 shiftedTime += offSet;
       
   523                                 TDateTime after = shiftedTime.DateTime();
       
   524                                 rDateTime.SetTimeUtcL( shiftedTime ); 
       
   525                                 }
       
   526                             }
       
   527                         
       
   528                         //  Check and fix the rDates and rRules match the 
       
   529                         //  repeat until date and time.
       
   530                         TTime untilTime = Edited().RepeatUntilDateTime();
       
   531                         
       
   532                         // Remove any rdates that are after the the repeat until date
       
   533                         TInt count = rDateList.Count();
       
   534                         if ( count > 0 )
   522                         if ( count > 0 )
   535                             {
   523                             {
   536                             TInt index = count - 1;
   524                             // There still exists some rdates, so only need to trim 
   537                             do 
   525                             // the rrule if it exists
   538                                 {
   526                             TTime lastRDate = CalenDateUtils::BeginningOfDay( rDateList[ count - 1 ].TimeLocalL() );
   539                                 TTime lastRDate = CalenDateUtils::BeginningOfDay( rDateList[ index ].TimeLocalL() );
   527                             const TTime& origUntilDate = Original().RepeatUntilDateTime();
   540                                 TDateTime before = lastRDate.DateTime();
   528                             TTime startDT = rRule.DtStart().TimeLocalL();
   541                                 if ( lastRDate > untilTime )
   529                             
       
   530                             if ( lastRDate <= origUntilDate && startDT > lastRDate )
       
   531                                 { 
       
   532                                 if ( startDT < untilTime)
   542                                     {
   533                                     {
   543                                     rDateList.Remove( index-- );
   534                                     if( origUntilDate != untilTime)
       
   535                                     	{
       
   536 										ApplyUntilDateToRRuleL( rRule, untilTime);
       
   537                                     	iEntry.SetRRuleL( rRule );
       
   538                                     	}
   544                                     }
   539                                     }
   545                                 else
   540                                  else
   546                                     {
   541                                     {
   547                                     index = KErrNotFound;
   542                                     // The repeat start is after the until date
   548                                     }
   543                                     // so remove any repeat information.
   549                                 } while ( index != KErrNotFound );
   544                                     iEntry.ClearRepeatingPropertiesL();
   550                             }
   545 
   551                         
   546                                     // If the entry date has been moved past the until
   552                         // Need to check if the end date of the
   547                                     // date, need to swap the an rDate for the entry.
   553                         // rrule needs adjusting if it exists.
   548                                     TTime startTime = iEntry.StartTimeL().TimeLocalL();
   554                         TCalRRule rRule;
   549 
   555                         if ( iEntry.GetRRuleL( rRule ) )
   550                                     if ( startTime > untilTime )
   556                             {
       
   557                             count = rDateList.Count();
       
   558                             if ( count > 0 )
       
   559                                 {
       
   560                                 // There still exists some rdates, so only need to trim 
       
   561                                 // the rrule if it exists
       
   562                                 TTime lastRDate = CalenDateUtils::BeginningOfDay( rDateList[ count - 1 ].TimeLocalL() );
       
   563                                 const TTime& origUntilDate = Original().RepeatUntilDateTime();
       
   564                                 TTime startDT = rRule.DtStart().TimeLocalL();
       
   565                                 
       
   566                                 if ( lastRDate <= origUntilDate && startDT > lastRDate )
       
   567                                     { 
       
   568                                     if ( startDT < untilTime)
       
   569                                         {
   551                                         {
   570                                         if( origUntilDate != untilTime)
   552                                         // Find the duration of the entry
       
   553                                         TTime endTime = iEntry.EndTimeL().TimeLocalL();
       
   554                                         TTimeIntervalMinutes duration;
       
   555                                         //startTime.MinutesFrom( endTime, duration );// for bug: CMCA-745CZ4
       
   556                                         endTime.MinutesFrom( startTime, duration );
       
   557                                         
       
   558                                         // Choose the first rDate as the new start time
       
   559                                         TCalTime newStartTime = rDateList[ 0 ];
       
   560                                         endTime = newStartTime.TimeLocalL() + duration;
       
   561 
       
   562                                         // FIXME.
       
   563                                         // If there is only one rDate left, the agenda model
       
   564                                         // will crash if it is deleted.
       
   565                                         if ( count != 0 )
   571                                             {
   566                                             {
   572                                             ApplyUntilDateToRRuleL( rRule, untilTime);
   567                                             rDateList.Remove( 0 );
   573                                             iEntry.SetRRuleL( rRule );
       
   574                                             }
   568                                             }
   575                                         }
   569 
   576                                     else
   570                                         TCalTime newEndTime;
   577                                         {
   571                                         if ( UseFloatingTimeL() )
   578                                         // The repeat start is after the until date
       
   579                                         // so remove any repeat information.
       
   580                                         iEntry.ClearRepeatingPropertiesL();
       
   581                                         
       
   582                                         // If the entry date has been moved past the until
       
   583                                         // date, need to swap the an rDate for the entry.
       
   584                                         TTime startTime = iEntry.StartTimeL().TimeLocalL();
       
   585                                         
       
   586                                         if ( startTime > untilTime )
       
   587                                             {
   572                                             {
   588                                             // Find the duration of the entry
   573                                             newEndTime.SetTimeLocalFloatingL( endTime );
   589                                             TTime endTime = iEntry.EndTimeL().TimeLocalL();
   574                                             }
   590                                             TTimeIntervalMinutes duration;
   575                                         else
   591                                             //startTime.MinutesFrom( endTime, duration );// for bug: CMCA-745CZ4
   576                                             {
   592                                             endTime.MinutesFrom( startTime, duration );
   577                                             newEndTime.SetTimeLocalL( endTime );
   593                                             
   578                                             }
   594                                             // Choose the first rDate as the new start time
   579 
   595                                             TCalTime newStartTime = rDateList[ 0 ];
   580                                         iEntry.SetStartAndEndTimeL( newStartTime, newEndTime );
   596                                             endTime = newStartTime.TimeLocalL() + duration;
   581                                         }    
   597                                             
       
   598                                             // FIXME.
       
   599                                             // If there is only one rDate left, the agenda model
       
   600                                             // will crash if it is deleted.
       
   601                                             if ( count != 0 )
       
   602                                                 {
       
   603                                                 rDateList.Remove( 0 );
       
   604                                                 }
       
   605                                             
       
   606                                             TCalTime newEndTime;
       
   607                                             if ( UseFloatingTimeL() )
       
   608                                                 {
       
   609                                                 newEndTime.SetTimeLocalFloatingL( endTime );
       
   610                                                 }
       
   611                                             else
       
   612                                                 {
       
   613                                                 newEndTime.SetTimeLocalL( endTime );
       
   614                                                 }
       
   615                                             
       
   616                                             iEntry.SetStartAndEndTimeL( newStartTime, newEndTime );
       
   617                                             }    
       
   618                                         }
       
   619                                     }
   582                                     }
   620                                 }
   583                                 }
   621                             }
   584                             }
   622                         
       
   623                         iEntry.SetRDatesL( rDateList );
       
   624                         }
   585                         }
   625                     
   586 
   626                     CleanupStack::PopAndDestroy(); // rDateList
   587                     iEntry.SetRDatesL( rDateList );
   627                     }
   588                     }
   628                 }
   589 
   629             else
   590                 CleanupStack::PopAndDestroy(); // rDateList
   630                 {
   591                 }
   631                 iEntry.ClearRepeatingPropertiesL();
   592             }
   632                 
   593         else
   633                 // FIXME  As the entry is supposedly not repeating
   594             {
   634                 // any rDates should be removed. Unforunately this
   595             iEntry.ClearRepeatingPropertiesL();
   635                 // is not possible at the moment because removing the 
   596 
   636                 // rdates will cause the agenda model to panic
   597             // FIXME  As the entry is supposedly not repeating
   637                 //
   598             // any rDates should be removed. Unforunately this
   638                 // RArray<TCalTime> emptyList;
   599             // is not possible at the moment because removing the 
   639                 // CleanupClosePushL( emptyList );
   600             // rdates will cause the agenda model to panic
   640                 // iEntry.SetRDatesL( emptyList );
   601             //
   641                 // CleanupStack::PopAndDestroy(); // emptyList
   602             // RArray<TCalTime> emptyList;
   642                 }
   603             // CleanupClosePushL( emptyList );
       
   604             // iEntry.SetRDatesL( emptyList );
       
   605             // CleanupStack::PopAndDestroy(); // emptyList
   643             }
   606             }
   644         }
   607         }
   645 
   608 
   646     if ( isNew || IsAlarmEditedL() && ( iEntry.StatusL() != CCalEntry::ETodoCompleted ) )
   609     if ( isNew || IsAlarmEditedL() && ( iEntry.StatusL() != CCalEntry::ETodoCompleted ) )
   647         {
   610         {
   670             TCalRRule ignore;
   633             TCalRRule ignore;
   671             TBool isRepeating = iEntry.GetRRuleL( ignore );
   634             TBool isRepeating = iEntry.GetRRuleL( ignore );
   672 
   635 
   673             // If edit alarm of repeating entry, we have to nudge start
   636             // If edit alarm of repeating entry, we have to nudge start
   674             // time to instance date
   637             // time to instance date
   675 
   638             if ( isRepeating &&  aRepeatTarget == CalCommon::EThisAndAll )
   676             if ( isRepeating &&  aRepeatTarget == CalCommon::EThisAndAll 
       
   677 			    || Edited().EntryType() == CCalEntry::EAnniv && Edited().CalendarType() != ESolar )
       
   678 				  // this is lunar anniv
       
   679                 {
   639                 {
   680                 // nudge to instance date;
   640                 // nudge to instance date;
   681                 TTime instanceDate = iInstanceDateTime.TimeLocalL();
   641                 TTime instanceDate = iInstanceDateTime.TimeLocalL();
   682                 if ( IsStartDateTimeEdited() )
   642                 if ( IsStartDateTimeEdited() )
   683                     {
   643                     {
   730                 break;
   690                 break;
   731             }
   691             }
   732         iEntry.SetPriorityL( priority );
   692         iEntry.SetPriorityL( priority );
   733         }
   693         }
   734 
   694 
   735     if (FeatureManager::FeatureSupported( KFeatureIdKorean ))
       
   736     	{
       
   737     	iEntry.SetUserInt32L( (TUint32)Edited().CalendarType() );	
       
   738     	}
       
   739     
       
   740     if ( isNew )
   695     if ( isNew )
   741         {
   696         {
   742         CCalEntry::TReplicationStatus status = CCalEntry::EOpen;
   697         CCalEntry::TReplicationStatus status = CCalEntry::EOpen;
   743         switch ( Edited().SynchType() )
   698         switch ( Edited().SynchType() )
   744             {
   699             {
   755                 ASSERT( EFalse );
   710                 ASSERT( EFalse );
   756                 break;
   711                 break;
   757             }
   712             }
   758         iEntry.SetReplicationStatusL( status );
   713         iEntry.SetReplicationStatusL( status );
   759         }
   714         }
   760 
   715     
   761     /**
   716     /**
   762      * S60 settings for new entries
   717      * S60 settings for new entries
   763      */
   718      */
   764     if ( IsCreatingNew() )
   719     if ( IsCreatingNew() )
   765         {
   720         {
   766 
   721         if ( Edited().EntryType() == CCalEntry::EAnniv )
   767         if ( Edited().EntryType() == CCalEntry::EAnniv && Edited().CalendarType() == ESolar)
   722             {
   768             { /* Lunar entries have different repeating */
       
   769             TCalRRule rrule( TCalRRule::EYearly );
   723             TCalRRule rrule( TCalRRule::EYearly );
   770             rrule.SetDtStart( iEntry.StartTimeL() );
   724             rrule.SetDtStart( iEntry.StartTimeL() );
   771             rrule.SetInterval( 1 );
   725             rrule.SetInterval( 1 );
   772             rrule.SetCount( 0 );
   726             rrule.SetCount( 0 );
   773             iEntry.SetRRuleL( rrule );
   727             iEntry.SetRRuleL( rrule );
  1489 CCalenEditorDataHandler::TError CCalenEditorDataHandler::CheckAlarmFieldsForErrorsL(TBool aSeries)
  1443 CCalenEditorDataHandler::TError CCalenEditorDataHandler::CheckAlarmFieldsForErrorsL(TBool aSeries)
  1490     {
  1444     {
  1491     TRACE_ENTRY_POINT;
  1445     TRACE_ENTRY_POINT;
  1492 
  1446 
  1493     TError error = EFormErrNone;
  1447     TError error = EFormErrNone;
  1494     
       
  1495 	if (FeatureManager::FeatureSupported( KFeatureIdKorean )) 
       
  1496 		{
       
  1497     	if( Edited().CalendarType() == ELunar ||
       
  1498     	    Edited().CalendarType() == ELunarLeap )
       
  1499     	    { /* Lunar entries have alarm as offset
       
  1500     	         and can't thus be erroneous */
       
  1501     	    return error;
       
  1502     	    }
       
  1503 		}
       
  1504 	
       
  1505     // If alarm not active, no check
  1448     // If alarm not active, no check
  1506     if ( Edited().IsAlarmActivated() )
  1449     if ( Edited().IsAlarmActivated() )
  1507         {
  1450         {
  1508         TTime alarm     = Edited().AlarmDateTime();
  1451         TTime alarm     = Edited().AlarmDateTime();
  1509         TTime startTime = Edited().StartDateTime();
  1452         TTime startTime = Edited().StartDateTime();
  2212         }
  2155         }
  2213     
  2156     
  2214     TRACE_EXIT_POINT;
  2157     TRACE_EXIT_POINT;
  2215     return fieldModified;
  2158     return fieldModified;
  2216     }
  2159     }
  2217 
       
  2218 TBool CCalenEditorDataHandler::LunarFieldEdited()
       
  2219     {
       
  2220     TRACE_ENTRY_POINT;
       
  2221 	TBool fieldModified = EFalse;
       
  2222 	
       
  2223     if (FeatureManager::FeatureSupported( KFeatureIdKorean )) 
       
  2224     	{
       
  2225     	if( iOriginal->CalendarType() != iEdited->CalendarType() )
       
  2226     	    {
       
  2227     	    fieldModified = ETrue;
       
  2228     	    }
       
  2229     	}
       
  2230     	
       
  2231     TRACE_EXIT_POINT;
       
  2232     return fieldModified;
       
  2233     }
       
  2234 
       
  2235 
  2160 
  2236 // -----------------------------------------------------------------------------
  2161 // -----------------------------------------------------------------------------
  2237 // CCalenEditorDataHandler::SetDefaultAlarmDateTimeL
  2162 // CCalenEditorDataHandler::SetDefaultAlarmDateTimeL
  2238 // Sets the alarm to the default value. This function is called after the user
  2163 // Sets the alarm to the default value. This function is called after the user
  2239 // forces an exit, e.g. when pressing the power off button.
  2164 // forces an exit, e.g. when pressing the power off button.