emailuis/emailui/src/ncsheadercontainer.cpp
changeset 3 a4d6f1ea0416
parent 2 5253a20d2a1e
child 4 e7aa27f58ae1
equal deleted inserted replaced
2:5253a20d2a1e 3:a4d6f1ea0416
   197 //
   197 //
   198 void CNcsHeaderContainer::FocusChanged( TDrawNow aDrawNow )
   198 void CNcsHeaderContainer::FocusChanged( TDrawNow aDrawNow )
   199 	{
   199 	{
   200     FUNC_LOG;
   200     FUNC_LOG;
   201     
   201     
   202     CCoeControl* focused = FindFocused();
   202     CCoeControl* focused = iFocused;
       
   203     
       
   204     if ( !focused )
       
   205         {
       
   206         focused = FindFocused();
       
   207         iFocused = focused;
       
   208         }
       
   209     
   203     if ( !IsFocused() )
   210     if ( !IsFocused() )
   204         {
   211         {
   205         if ( focused )
   212         if ( focused )
   206             {
   213             {
   207             // We're loosing focus (probably going to message body)
   214             // We're loosing focus (probably going to message body)
   211             }
   218             }
   212 
   219 
   213         // Remove MSK label when header loses focus
   220         // Remove MSK label when header loses focus
   214         TRAP_IGNORE( SetMskL() );
   221         TRAP_IGNORE( SetMskL() );
   215 		}
   222 		}
   216 	else if ( IsFocused() && !focused && !iRALInProgress )
   223 	else if ( IsFocused() && !focused )
   217 		{
   224 		{
   218 		// We're gaining focus from the message body
   225 		// We're gaining focus from the message body
   219 		// Set the focus to the last control in the control array
   226 		// Set the focus to the last control in the control array
   220 		// (either attachment line or subject field)
   227 		// (either attachment line or subject field)
   221 		CCoeControlArray::TCursor cur = Components().End();
   228 		CCoeControlArray::TCursor cur = Components().End();
   222 		cur.Prev();
   229 		cur.Prev();
   223 		cur.Control<CCoeControl>()->SetFocus( ETrue, aDrawNow );
   230 		cur.Control<CCoeControl>()->SetFocus( ETrue, aDrawNow );
   224 		}
   231 		}
   225 	}
   232 	}
       
   233 
       
   234 // ---------------------------------------------------------------------------
       
   235 // CNcsHeaderContainer::ShowCursor
       
   236 // ---------------------------------------------------------------------------
       
   237 //
       
   238 void CNcsHeaderContainer::ShowCursor( TBool aShow )
       
   239     {
       
   240     CCoeControl* focused = FindFocused();
       
   241     if ( focused )
       
   242         {
       
   243         iFocused = focused;
       
   244         }
       
   245     iFocused->SetFocus( aShow, EDrawNow );
       
   246     }
   226 
   247 
   227 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   228 // CNcsHeaderContainer::Draw() const
   249 // CNcsHeaderContainer::Draw() const
   229 // Draws the display
   250 // Draws the display
   230 // -----------------------------------------------------------------------------
   251 // -----------------------------------------------------------------------------
   501 		    // to next one
   522 		    // to next one
   502 		    if ( aType == EEventKey && 
   523 		    if ( aType == EEventKey && 
   503 		         ( aKeyEvent.iCode == EKeyEnter || 
   524 		         ( aKeyEvent.iCode == EKeyEnter || 
   504 		           aKeyEvent.iScanCode == EStdKeyEnter) )
   525 		           aKeyEvent.iScanCode == EStdKeyEnter) )
   505 		        {
   526 		        {
   506 		        ret = FindFocused()->OfferKeyEventL( aKeyEvent, aType );
   527 		        FindFocused()->OfferKeyEventL( aKeyEvent, aType );
   507 		        return EKeyWasConsumed;
   528 		        ret = EKeyWasConsumed;
       
   529 		        doScroll = ETrue;
   508 		        }
   530 		        }
   509 		    }
   531 		    }
   510     	}
   532     	}
   511     if ( ret == EKeyWasNotConsumed )
   533     if ( ret == EKeyWasNotConsumed )
   512     	{
   534     	{
  1307 		    iRALInProgress = ETrue;
  1329 		    iRALInProgress = ETrue;
  1308     		CNcsAddressInputField* addressField = NULL;
  1330     		CNcsAddressInputField* addressField = NULL;
  1309     		addressField = static_cast<CNcsAddressInputField*>( focused );
  1331     		addressField = static_cast<CNcsAddressInputField*>( focused );
  1310     		HBufC* lookupText = addressField->GetLookupTextLC();
  1332     		HBufC* lookupText = addressField->GetLookupTextLC();
  1311     		CPbkxRemoteContactLookupServiceUiContext::TResult::TExitReason ex;
  1333     		CPbkxRemoteContactLookupServiceUiContext::TResult::TExitReason ex;
  1312     		// set focus to false for header - the focus should be on popup
       
  1313     		focused->SetFocus( EFalse, ENoDrawNow );
       
  1314             CNcsEmailAddressObject* address = ExecuteRemoteSearchL(
  1334             CNcsEmailAddressObject* address = ExecuteRemoteSearchL(
  1315                 ex, *lookupText );
  1335                 ex, *lookupText );
  1316             iRALInProgress = EFalse;
  1336             iRALInProgress = EFalse;
  1317             // set focus back to on
       
  1318             focused->SetFocus( ETrue, ENoDrawNow );
       
  1319             if ( address )
  1337             if ( address )
  1320                 {
  1338                 {
  1321                 CleanupStack::PushL( address );
  1339                 CleanupStack::PushL( address );
  1322                 IncludeAddressL( *address );
  1340                 IncludeAddressL( *address );
  1323                 CleanupStack::PopAndDestroy( address );
  1341                 CleanupStack::PopAndDestroy( address );