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