meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencedatefield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
child 22 d620048b4810
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    35 // DEBUG
    35 // DEBUG
    36 #include "emailtrace.h"
    36 #include "emailtrace.h"
    37 namespace // codescanner::namespace
    37 namespace // codescanner::namespace
    38     {
    38     {
    39     const TInt KComponentCount( 2 );
    39     const TInt KComponentCount( 2 );
    40     const TInt KMargin (5);
       
    41     }
    40     }
    42 // ======== MEMBER FUNCTIONS ========
    41 // ======== MEMBER FUNCTIONS ========
    43 
    42 
    44 // -----------------------------------------------------------------------------
    43 // -----------------------------------------------------------------------------
    45 // CESMRViewerRecurrenceDateField::CESMRViewerRecurrenceDateField
    44 // CESMRViewerRecurrenceDateField::CESMRViewerRecurrenceDateField
    69 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    70 //
    69 //
    71 CESMRViewerRecurrenceDateField* CESMRViewerRecurrenceDateField::NewL()
    70 CESMRViewerRecurrenceDateField* CESMRViewerRecurrenceDateField::NewL()
    72     {
    71     {
    73     FUNC_LOG;
    72     FUNC_LOG;
    74     CESMRViewerRecurrenceDateField* self = 
    73     CESMRViewerRecurrenceDateField* self =
    75             new (ELeave) CESMRViewerRecurrenceDateField();
    74             new (ELeave) CESMRViewerRecurrenceDateField();
    76     CleanupStack::PushL( self );
    75     CleanupStack::PushL( self );
    77     self->ConstructL();
    76     self->ConstructL();
    78     CleanupStack::Pop( self );
    77     CleanupStack::Pop( self );
    79     return self;
    78     return self;
   114 // -----------------------------------------------------------------------------
   113 // -----------------------------------------------------------------------------
   115 //
   114 //
   116 TBool CESMRViewerRecurrenceDateField::ExecuteGenericCommandL( TInt aCommand )
   115 TBool CESMRViewerRecurrenceDateField::ExecuteGenericCommandL( TInt aCommand )
   117     {
   116     {
   118     FUNC_LOG;
   117     FUNC_LOG;
   119     
   118 
   120     TBool retValue( EFalse );
   119     TBool retValue( EFalse );
   121     
   120 
   122     if( (aCommand == EAknCmdOpen) && IsLocked()  )
   121     if( (aCommand == EAknCmdOpen) && IsLocked()  )
   123     	{
   122     	{
   124 		HandleTactileFeedbackL();
   123 		HandleTactileFeedbackL();
   125 		
   124 
   126     	CESMRGlobalNote::ExecuteL(
   125     	CESMRGlobalNote::ExecuteL(
   127     			CESMRGlobalNote::EESMRUnableToEdit );    	
   126     			CESMRGlobalNote::EESMRUnableToEdit );
   128     	retValue = ETrue;
   127     	retValue = ETrue;
   129     	}    
   128     	}
   130     else if ( EMRCmdDoEnvironmentChange == aCommand )
   129     else if ( EMRCmdDoEnvironmentChange == aCommand )
   131         {
   130         {
   132         FormatRepeatUntilDateL();
   131         FormatRepeatUntilDateL();
   133         retValue = ETrue;
   132         retValue = ETrue;
   134         }
   133         }
   135     
   134 
   136     return retValue;    
   135     return retValue;
   137     }
   136     }
   138 
   137 
   139 // -----------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   140 // CESMRViewerRecurrenceDateField::SizeChanged
   139 // CESMRViewerRecurrenceDateField::SizeChanged
   141 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   147     // First row
   146     // First row
   148     TAknLayoutRect row1LayoutRect =
   147     TAknLayoutRect row1LayoutRect =
   149         NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   148         NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   150     rect = row1LayoutRect.Rect();
   149     rect = row1LayoutRect.Rect();
   151 
   150 
   152     TAknLayoutText topicRect =
   151     TAknTextComponentLayout topicLayoutText =
   153         NMRLayoutManager::GetLayoutText(
   152             NMRLayoutManager::GetTextComponentLayout(
   154                 rect, NMRLayoutManager::EMRTextLayoutMultiRowTextEditor );
   153                     NMRLayoutManager::EMRTextLayoutMultiRowTextEditor );
   155 
   154 
   156     TRect rectWithMargin = topicRect.TextRect();
   155     AknLayoutUtils::LayoutLabel( iRepeatTopic, rect, topicLayoutText );
   157     rectWithMargin.iTl.iX += KMargin;
       
   158     iRepeatTopic->SetRect( rectWithMargin );
       
   159 
   156 
   160     rect = Rect();
   157     rect = Rect();
   161     // Move the iY down the height of the topic field
   158     // Move the iY down the height of the topic field
   162     TInt movement = row1LayoutRect.Rect().Height();
   159     TInt movement = row1LayoutRect.Rect().Height();
   163     rect.Move( 0, movement );
   160     rect.Move( 0, movement );
   165     // Second row
   162     // Second row
   166     TAknLayoutRect row2LayoutRect =
   163     TAknLayoutRect row2LayoutRect =
   167         NMRLayoutManager::GetFieldRowLayoutRect( rect, 2 );
   164         NMRLayoutManager::GetFieldRowLayoutRect( rect, 2 );
   168     rect = row2LayoutRect.Rect();
   165     rect = row2LayoutRect.Rect();
   169 
   166 
   170     TAknLayoutText dateRect =
   167     TAknTextComponentLayout dateLayoutText =
   171         NMRLayoutManager::GetLayoutText(
   168             NMRLayoutManager::GetTextComponentLayout(
   172                 rect, NMRLayoutManager::EMRTextLayoutMultiRowTextEditor );
   169                     NMRLayoutManager::EMRTextLayoutMultiRowTextEditor );
   173 
   170 
   174         rectWithMargin = dateRect.TextRect();
   171     AknLayoutUtils::LayoutLabel( iRepeatDate, rect, dateLayoutText );
   175     rectWithMargin.iTl.iX += KMargin;
       
   176     iRepeatDate->SetRect( rectWithMargin );
       
   177 
       
   178     // Setting font also for the label
       
   179     iRepeatTopic->SetFont( topicRect.Font() );
       
   180     iRepeatDate->SetFont( dateRect.Font() );
       
   181     }
   172     }
   182 
   173 
   183 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   184 // CESMRViewerRecurrenceDateField::MinimumSize
   175 // CESMRViewerRecurrenceDateField::MinimumSize
   185 // -----------------------------------------------------------------------------
   176 // -----------------------------------------------------------------------------
   207 void CESMRViewerRecurrenceDateField::InternalizeL(
   198 void CESMRViewerRecurrenceDateField::InternalizeL(
   208         MESMRCalEntry& aEntry )
   199         MESMRCalEntry& aEntry )
   209     {
   200     {
   210     FUNC_LOG;
   201     FUNC_LOG;
   211     // Get recurrence
   202     // Get recurrence
   212     TESMRRecurrenceValue recValue( ERecurrenceNot );    
   203     TESMRRecurrenceValue recValue( ERecurrenceNot );
   213     aEntry.GetRecurrenceL( recValue, iRepeatUntilDate );
   204     aEntry.GetRecurrenceL( recValue, iRepeatUntilDate );
   214 
   205 
   215     // Recurrence time has to be shown in the viewer as local time
   206     // Recurrence time has to be shown in the viewer as local time
   216     TCalTime recurrenceTime;
   207     TCalTime recurrenceTime;
   217     recurrenceTime.SetTimeUtcL( iRepeatUntilDate );    
   208     recurrenceTime.SetTimeUtcL( iRepeatUntilDate );
   218     iRepeatUntilDate = recurrenceTime.TimeLocalL();
   209     iRepeatUntilDate = recurrenceTime.TimeLocalL();
   219 
   210 
   220     if( aEntry.IsRecurrentEventL() &&
   211     if( aEntry.IsRecurrentEventL() &&
   221         recValue != ERecurrenceNot &&
   212         recValue != ERecurrenceNot &&
   222         Time::NullTTime() != iRepeatUntilDate )
   213         Time::NullTTime() != iRepeatUntilDate )
   275 
   266 
   276     HBufC* topicHolder =
   267     HBufC* topicHolder =
   277             StringLoader::LoadLC(
   268             StringLoader::LoadLC(
   278                     R_QTN_MEET_REQ_REPEAT_UNTIL,
   269                     R_QTN_MEET_REQ_REPEAT_UNTIL,
   279                     iEikonEnv );
   270                     iEikonEnv );
   280     
   271 
   281     // Set text for repeat topic (e.g. "Repeat until")
   272     // Set text for repeat topic (e.g. "Repeat until")
   282     iRepeatTopic->SetTextL( topicHolder->Des() );
   273     iRepeatTopic->SetTextL( *topicHolder );
   283     CleanupStack::PopAndDestroy( topicHolder );
   274     CleanupStack::PopAndDestroy( topicHolder );
   284 
   275 
   285     // Format date string
   276     // Format date string
   286     HBufC* timeFormatString = iEikonEnv->AllocReadResourceLC(
   277     HBufC* timeFormatString = iEikonEnv->AllocReadResourceLC(
   287                                     R_QTN_DATE_USUAL);
   278                                     R_QTN_DATE_USUAL);
   291 
   282 
   292     // Set repeat until date value
   283     // Set repeat until date value
   293     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalBuf );
   284     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finalBuf );
   294     iRepeatDate->SetTextL( finalBuf );
   285     iRepeatDate->SetTextL( finalBuf );
   295     CleanupStack::PopAndDestroy( timeFormatString );
   286     CleanupStack::PopAndDestroy( timeFormatString );
   296     timeFormatString = NULL;    
   287     timeFormatString = NULL;
   297     }
   288     }
   298 
   289 
   299 // End of file
   290 // End of file
   300 
   291 
   301 
   292