meetingrequest/mrgui/src/cesmrmemotimevalidator.cpp
branchRCL_3
changeset 33 da5135c61bad
parent 0 8466d47a6819
equal deleted inserted replaced
32:a3a1ae9acec6 33:da5135c61bad
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   219     if ( MESMRCalEntry::EESMRCalEntryMemo == aEntry.Type() )
   219     if ( MESMRCalEntry::EESMRCalEntryMemo == aEntry.Type() )
   220         {
   220         {
   221         PreValidateEditorContent();
   221         PreValidateEditorContent();
   222 
   222 
   223         CCalEntry& entry( aEntry.Entry() );
   223         CCalEntry& entry( aEntry.Entry() );
   224 
   224         const CCalEntry& originalEntry( aEntry.OriginalEntry() );
       
   225         
   225         TTime start = StartDateTimeL();
   226         TTime start = StartDateTimeL();
   226         TTime end = EndDateTimeL();
   227         TTime end = EndDateTimeL();
   227 
   228 
   228         if ( end < start )
   229         if ( end < start )
   229             {
   230             {
   230             User::Leave( KErrArgument );
   231             User::Leave( KErrArgument );
   231             }
   232             }
   232 
   233 
   233         TCalTime startTime;
   234         TTime orgStartTime = originalEntry.StartTimeL().TimeLocalL();
   234         TCalTime endTime;
   235         TTime orgEndTime   = originalEntry.EndTimeL().TimeLocalL();
   235 
   236 
   236         // The default mode for memo is EFloating,
   237         if( orgStartTime != start || orgEndTime != end )
   237         // But some 3rd party application might have saved a different type
       
   238         // for one reason or another. In that case we are using
       
   239         // the existing value.
       
   240         if ( aEntry.IsStoredL() )
       
   241             {
   238             {
   242             TCalTime::TTimeMode timeMode =
   239             TCalTime startTime;
   243                         aEntry.Entry().StartTimeL().TimeMode();
   240             TCalTime endTime;
   244 
   241     
   245             switch ( timeMode )
   242             // The default mode for memo is EFloating,
       
   243             // But some 3rd party application might have saved a different type
       
   244             // for one reason or another. In that case we are using
       
   245             // the existing value.
       
   246             if ( aEntry.IsStoredL() )
   246                 {
   247                 {
   247                 case TCalTime::EFixedUtc:
   248                 TCalTime::TTimeMode timeMode =
   248                 	{
   249                             aEntry.Entry().StartTimeL().TimeMode();
   249 					startTime.SetTimeUtcL( start );
   250     
   250 					endTime.SetTimeUtcL( end );
   251                 switch ( timeMode )
   251 					break;
   252                     {
   252                 	}
   253                     case TCalTime::EFixedUtc:
   253                 case TCalTime::EFixedTimeZone:
   254                         {
   254                 	{
   255                         startTime.SetTimeUtcL( start );
   255 					startTime.SetTimeLocalL( start );
   256                         endTime.SetTimeUtcL( end );
   256 					endTime.SetTimeLocalL( end );
   257                         break;
   257 					break;
   258                         }
   258                 	}
   259                     case TCalTime::EFixedTimeZone:
   259                 case TCalTime::EFloating: // Fall through
   260                         {
   260                 default:
   261                         startTime.SetTimeLocalL( start );
   261                 	{
   262                         endTime.SetTimeLocalL( end );
   262 					startTime.SetTimeLocalFloatingL( start );
   263                         break;
   263 					endTime.SetTimeLocalFloatingL( end );
   264                         }
   264 					break;
   265                     case TCalTime::EFloating: // Fall through
   265                 	}
   266                     default:
       
   267                         {
       
   268                         startTime.SetTimeLocalFloatingL( start );
       
   269                         endTime.SetTimeLocalFloatingL( end );
       
   270                         break;
       
   271                         }
       
   272                     }
   266                 }
   273                 }
       
   274             else
       
   275                 {
       
   276                 startTime.SetTimeLocalFloatingL( start );
       
   277                 endTime.SetTimeLocalFloatingL( end );
       
   278                 }
       
   279     
       
   280             entry.SetStartAndEndTimeL( startTime, endTime );
   267             }
   281             }
   268         else
       
   269             {
       
   270             startTime.SetTimeLocalFloatingL( start );
       
   271             endTime.SetTimeLocalFloatingL( end );
       
   272             }
       
   273 
       
   274         entry.SetStartAndEndTimeL( startTime, endTime );
       
   275         }
   282         }
   276     }
   283     }
   277 
   284 
   278 // ---------------------------------------------------------------------------
   285 // ---------------------------------------------------------------------------
   279 // CESMRMemoTimeValidator::SetStartTimeFieldL
   286 // CESMRMemoTimeValidator::SetStartTimeFieldL
   304 void CESMRMemoTimeValidator::SetStartDateFieldL(
   311 void CESMRMemoTimeValidator::SetStartDateFieldL(
   305         CEikDateEditor& aStartDate )
   312         CEikDateEditor& aStartDate )
   306     {
   313     {
   307     FUNC_LOG;
   314     FUNC_LOG;
   308     iStartDate = &aStartDate;
   315     iStartDate = &aStartDate;
       
   316     
       
   317     if ( Time::NullTTime() != iCurrentStartTime )
       
   318         {
       
   319         SetDateToEditor( *iStartDate, iCurrentStartTime );
       
   320         }    
   309     }
   321     }
   310 
   322 
   311 // ---------------------------------------------------------------------------
   323 // ---------------------------------------------------------------------------
   312 // CESMRMemoTimeValidator::SetEndDateFieldL
   324 // CESMRMemoTimeValidator::SetEndDateFieldL
   313 // ---------------------------------------------------------------------------
   325 // ---------------------------------------------------------------------------
   315 void CESMRMemoTimeValidator::SetEndDateFieldL(
   327 void CESMRMemoTimeValidator::SetEndDateFieldL(
   316         CEikDateEditor& aEndDate )
   328         CEikDateEditor& aEndDate )
   317     {
   329     {
   318     FUNC_LOG;
   330     FUNC_LOG;
   319     iEndDate = &aEndDate;
   331     iEndDate = &aEndDate;
       
   332     
       
   333     if ( Time::NullTTime() != iCurrentEndTime )
       
   334         {
       
   335         SetDateToEditor( *iEndDate, iCurrentEndTime );
       
   336         } 
   320     }
   337     }
   321 
   338 
   322 // ---------------------------------------------------------------------------
   339 // ---------------------------------------------------------------------------
   323 // CESMRMemoTimeValidator::SetAlarmTimeFieldL
   340 // CESMRMemoTimeValidator::SetAlarmTimeFieldL
   324 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   345 // CESMRMemoTimeValidator::SetRecurrenceUntilDateFieldL
   362 // CESMRMemoTimeValidator::SetRecurrenceUntilDateFieldL
   346 // ---------------------------------------------------------------------------
   363 // ---------------------------------------------------------------------------
   347 //
   364 //
   348 void CESMRMemoTimeValidator::SetRecurrenceUntilDateFieldL(
   365 void CESMRMemoTimeValidator::SetRecurrenceUntilDateFieldL(
   349             CEikDateEditor& /*aRecurrenceUntil*/ )
   366             CEikDateEditor& /*aRecurrenceUntil*/ )
       
   367     {
       
   368     FUNC_LOG;
       
   369     // No implementation for memo
       
   370     }
       
   371 
       
   372 // ---------------------------------------------------------------------------
       
   373 // CESMRMemoTimeValidator::SetAbsoluteAlarmOnOffFieldL
       
   374 // ---------------------------------------------------------------------------
       
   375 //
       
   376 void CESMRMemoTimeValidator::SetAbsoluteAlarmOnOffFieldL( 
       
   377         MMRAbsoluteAlarmController& /*aAbsoluteAlarmController*/ )
   350     {
   378     {
   351     FUNC_LOG;
   379     FUNC_LOG;
   352     // No implementation for memo
   380     // No implementation for memo
   353     }
   381     }
   354 
   382