meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
child 22 d620048b4810
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
   122     CESMRField::SetOutlineFocusL ( aFocus );
   122     CESMRField::SetOutlineFocusL ( aFocus );
   123 
   123 
   124     //Focus gained
   124     //Focus gained
   125     if ( aFocus )
   125     if ( aFocus )
   126         {
   126         {
   127         ChangeMiddleSoftKeyL( 
   127         ChangeMiddleSoftKeyL(
   128                 EESMRCmdOpenMultiCalenSelectQuery, R_QTN_MSK_OPEN );
   128                 EESMRCmdOpenMultiCalenSelectQuery, R_QTN_MSK_OPEN );
   129         }
   129         }
   130     }
   130     }
   131 
   131 
   132 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   142        aCommand == EAknCmdOpen )
   142        aCommand == EAknCmdOpen )
   143         {
   143         {
   144         if( IsLocked() )
   144         if( IsLocked() )
   145         	{
   145         	{
   146 			HandleTactileFeedbackL();
   146 			HandleTactileFeedbackL();
   147 			
   147 
   148         	CESMRGlobalNote::ExecuteL(
   148         	CESMRGlobalNote::ExecuteL(
   149         			CESMRGlobalNote::EESMRUnableToEdit );
   149         			CESMRGlobalNote::EESMRUnableToEdit );
   150         	isUsed = ETrue;
   150         	isUsed = ETrue;
   151 			}
   151 			}
   152         		    	
   152 
   153 		else if( iTypeChangeEnabled )
   153 		else if( iTypeChangeEnabled )
   154             {
   154             {
   155 			HandleTactileFeedbackL();
   155 			HandleTactileFeedbackL();
   156 		
   156 
   157 		    ExecuteTypeQueryL();
   157 		    ExecuteTypeQueryL();
   158             isUsed = ETrue;
   158             isUsed = ETrue;
   159             }
   159             }
   160         }
   160         }
   161 
   161 
   174 		return;
   174 		return;
   175 		}
   175 		}
   176 
   176 
   177 	CESMRField::LockL();
   177 	CESMRField::LockL();
   178 
   178 
   179 	delete iLockIcon;	
   179 	delete iLockIcon;
   180 	iLockIcon = NULL;
   180 	iLockIcon = NULL;
   181 	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
   181 	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
   182 	iIcon->SetParent( this );		
   182 	iIcon->SetParent( this );
   183 	}
   183 	}
   184 
   184 
   185 // ---------------------------------------------------------------------------
   185 // ---------------------------------------------------------------------------
   186 // CMRMultiCalenField::ExecuteTypeQueryL
   186 // CMRMultiCalenField::ExecuteTypeQueryL
   187 // ---------------------------------------------------------------------------
   187 // ---------------------------------------------------------------------------
   236     align.SetHAlignment( EHLeft );
   236     align.SetHAlignment( EHLeft );
   237     align.SetVAlignment( EVCenter );
   237     align.SetVAlignment( EVCenter );
   238     iCalenName->SetAlignment( align );
   238     iCalenName->SetAlignment( align );
   239 
   239 
   240     iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapCalendarSelection );
   240     iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapCalendarSelection );
   241     
   241 
   242     }
   242     }
   243 
   243 
   244 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   245 // CMRMultiCalenField::UpdateLabelL
   245 // CMRMultiCalenField::UpdateLabelL
   246 // ---------------------------------------------------------------------------
   246 // ---------------------------------------------------------------------------
   268 
   268 
   269     if ( iCalenName )
   269     if ( iCalenName )
   270     	{
   270     	{
   271     	++count;
   271     	++count;
   272     	}
   272     	}
   273     
   273 
   274     if ( iLockIcon )
   274     if ( iLockIcon )
   275     	{
   275     	{
   276     	++count;
   276     	++count;
   277     	}
   277     	}
   278     return count;
   278     return count;
   322     TAknLayoutRect iconLayout =
   322     TAknLayoutRect iconLayout =
   323         NMRLayoutManager::GetLayoutRect(
   323         NMRLayoutManager::GetLayoutRect(
   324                 rect, NMRLayoutManager::EMRLayoutTextEditorIcon );
   324                 rect, NMRLayoutManager::EMRLayoutTextEditorIcon );
   325     TRect iconRect( iconLayout.Rect() );
   325     TRect iconRect( iconLayout.Rect() );
   326     iIcon->SetRect( iconRect );
   326     iIcon->SetRect( iconRect );
   327     
   327 
   328     // Layouting lock icon
   328     // Layouting lock icon
   329     TAknLayoutRect rowLayoutRect( 
   329     TAknLayoutRect rowLayoutRect(
   330             NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
   330             NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
   331     TRect rowRect( rowLayoutRect.Rect() );
   331     TRect rowRect( rowLayoutRect.Rect() );
   332     if( iLockIcon )
   332     if( iLockIcon )
   333         {
   333         {
   334         TAknWindowComponentLayout iconLayout( 
   334         TAknWindowComponentLayout iconLayout(
   335                 NMRLayoutManager::GetWindowComponentLayout( 
   335                 NMRLayoutManager::GetWindowComponentLayout(
   336                     NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   336                     NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   337         AknLayoutUtils::LayoutImage( iLockIcon, rowRect, iconLayout );
   337         AknLayoutUtils::LayoutImage( iLockIcon, rowRect, iconLayout );
   338         }
   338         }
   339 
   339 
   340     // Layouting label
   340     // Layouting label
   341     TAknLayoutText viewerLayoutText;
   341     TAknTextComponentLayout viewerLayoutText;
   342     if( iLockIcon )
   342     if( iLockIcon )
   343     	{
   343         {
   344     	viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect, 
   344         viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
   345     			NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   345                 NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   346     	}
   346         }
   347     else
   347     else
   348     	{
   348         {
   349     	viewerLayoutText = NMRLayoutManager::GetLayoutText( rowRect, 
   349         viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
   350     			NMRLayoutManager::EMRTextLayoutTextEditor );
   350                 NMRLayoutManager::EMRTextLayoutTextEditor );
   351     	}
   351         }
   352 
   352 
   353     TRect viewerRect( viewerLayoutText.TextRect() );    
   353     AknLayoutUtils::LayoutLabel( iCalenName, rect, viewerLayoutText );
   354     iCalenName->SetRect( viewerRect );
   354     TRect viewerRect( iCalenName->Rect() );
   355     
   355 
   356     // Move focus rect so that it's relative to field's position.
   356     // Move focus rect so that it's relative to field's position.
   357     viewerRect.Move( -Position() );
   357     viewerRect.Move( -Position() );
   358     
   358 
   359     TAknLayoutRect bgLayoutRect = 
   359     TAknLayoutRect bgLayoutRect =
   360         NMRLayoutManager::GetLayoutRect( 
   360         NMRLayoutManager::GetLayoutRect(
   361                 rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   361                 rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   362     TRect bgRect( bgLayoutRect.Rect() );
   362     TRect bgRect( bgLayoutRect.Rect() );
   363     
   363 
   364     // Adjust background rect according to viewerRect 
   364     // Adjust background rect according to viewerRect
   365     bgRect.SetWidth( viewerRect.Width() );
   365     bgRect.SetWidth( viewerRect.Width() );
   366     
   366 
   367     // Move focus rect so that it's relative to field's position.
   367     // Move focus rect so that it's relative to field's position.
   368     bgRect.Move( -Position() );
   368     bgRect.Move( -Position() );
   369         
   369 
   370     SetFocusRect( bgRect );
   370     SetFocusRect( bgRect );
   371     }
   371     }
   372 
   372 
   373 // ---------------------------------------------------------------------------
   373 // ---------------------------------------------------------------------------
   374 // CMRMultiCalenField::SetContainerWindowL
   374 // CMRMultiCalenField::SetContainerWindowL
   390 // ---------------------------------------------------------------------------
   390 // ---------------------------------------------------------------------------
   391 //
   391 //
   392 void CMRMultiCalenField::SetTextDimmed()
   392 void CMRMultiCalenField::SetTextDimmed()
   393     {
   393     {
   394     FUNC_LOG;
   394     FUNC_LOG;
   395     
   395 
   396     NMRColorManager::SetColor(
   396     NMRColorManager::SetColor(
   397             *iCalenName, 
   397             *iCalenName,
   398             NMRColorManager::EMRMainAreaTextColorDimmed );
   398             NMRColorManager::EMRMainAreaTextColorDimmed );
   399     }
   399     }
   400 
   400 
   401 // ---------------------------------------------------------------------------
   401 // ---------------------------------------------------------------------------
   402 // CMRMultiCalenField::TypeChangeEnabledL
   402 // CMRMultiCalenField::TypeChangeEnabledL
   403 // ---------------------------------------------------------------------------
   403 // ---------------------------------------------------------------------------
   404 //
   404 //
   405 TBool CMRMultiCalenField::TypeChangeEnabledL()
   405 TBool CMRMultiCalenField::TypeChangeEnabledL()
   406     {  
   406     {
   407     TBool ret( ETrue );
   407     TBool ret( ETrue );
   408     
   408 
   409     /*
   409     /*
   410      * Case 1:
   410      * Case 1:
   411      * If entry is single occurancy of a series, calendar type change  
   411      * If entry is single occurancy of a series, calendar type change
   412      * is disabled for the user.
   412      * is disabled for the user.
   413      */
   413      */
   414     if( iEntry->IsRecurrentEventL() && 
   414     if( iEntry->IsRecurrentEventL() &&
   415             iEntry->RecurrenceModRule() == MESMRCalEntry::EESMRThisOnly &&
   415             iEntry->RecurrenceModRule() == MESMRCalEntry::EESMRThisOnly &&
   416                 FieldMode() == EESMRFieldModeEdit )
   416                 FieldMode() == EESMRFieldModeEdit )
   417         {
   417         {
   418         ret = EFalse;
   418         ret = EFalse;
   419         }
   419         }
   420     
   420 
   421     /*
   421     /*
   422      * Case 2:
   422      * Case 2:
   423      * If entry is meeting request, and opened from mailbox that does not
   423      * If entry is meeting request, and opened from mailbox that does not
   424      * support multiple calendar, calendar type change is disabled 
   424      * support multiple calendar, calendar type change is disabled
   425      * for the user.
   425      * for the user.
   426      */
   426      */
   427     if( ret && CCalenInterimUtils2::IsMeetingRequestL( iEntry->Entry() ) &&
   427     if( ret && CCalenInterimUtils2::IsMeetingRequestL( iEntry->Entry() ) &&
   428             FieldMode() == EESMRFieldModeEdit )
   428             FieldMode() == EESMRFieldModeEdit )
   429         {
   429         {
   430         MESMRMeetingRequestEntry* entry = 
   430         MESMRMeetingRequestEntry* entry =
   431             static_cast< MESMRMeetingRequestEntry* >( iEntry );
   431             static_cast< MESMRMeetingRequestEntry* >( iEntry );
   432         
   432 
   433         // If entry's current plugin is active sync, it means that 
   433         // If entry's current plugin is active sync, it means that
   434         // Mail For Exchange is in use. This means, that multiple calendar 
   434         // Mail For Exchange is in use. This means, that multiple calendar
   435         // functionality is not supported.
   435         // functionality is not supported.
   436         if( entry->CurrentPluginL() == EESMRActiveSync )
   436         if( entry->CurrentPluginL() == EESMRActiveSync )
   437             {
   437             {
   438             ret = EFalse;
   438             ret = EFalse;
   439             }
   439             }
   440         }
   440         }
   441     
   441 
   442     /*
   442     /*
   443      * Case 3:
   443      * Case 3:
   444 	 * When the organizer of the MR edits an already sent MR, calendar 
   444 	 * When the organizer of the MR edits an already sent MR, calendar
   445 	 * cannot be changed --> calendar selection needs to be locked.
   445 	 * cannot be changed --> calendar selection needs to be locked.
   446      */
   446      */
   447     if( ret && CCalenInterimUtils2::IsMeetingRequestL( iEntry->Entry() ) &&
   447     if( ret && CCalenInterimUtils2::IsMeetingRequestL( iEntry->Entry() ) &&
   448             FieldMode() == EESMRFieldModeEdit )
   448             FieldMode() == EESMRFieldModeEdit )
   449     	{
   449     	{
   450 		MESMRMeetingRequestEntry* entry = 
   450 		MESMRMeetingRequestEntry* entry =
   451 				static_cast< MESMRMeetingRequestEntry* >( iEntry );
   451 				static_cast< MESMRMeetingRequestEntry* >( iEntry );
   452 		if( entry->RoleL() == EESMRRoleOrganizer && entry->IsSentL() )
   452 		if( entry->RoleL() == EESMRRoleOrganizer && entry->IsSentL() )
   453 			{
   453 			{
   454 			ret = EFalse;    
   454 			ret = EFalse;
   455 			}
   455 			}
   456     	}
   456     	}
   457     
   457 
   458     return ret;
   458     return ret;
   459     }
   459     }
   460 
   460 
   461 // EOF
   461 // EOF
   462 
   462