emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
0:8466d47a6819 1:12c456ceeff2
    51 // </cmail>
    51 // </cmail>
    52 #include <alf/alfenv.h>
    52 #include <alf/alfenv.h>
    53 #include <alf/alfcommand.h>
    53 #include <alf/alfcommand.h>
    54 #include <aknnotewrappers.h>
    54 #include <aknnotewrappers.h>
    55 // <cmail>
    55 // <cmail>
       
    56 #include <layoutmetadata.cdl.h>
    56 #include <aknlayoutscalable_apps.cdl.h>
    57 #include <aknlayoutscalable_apps.cdl.h>
    57 // </cmail>
    58 // </cmail>
    58 #include <featmgr.h>
    59 #include <featmgr.h>
    59 //</cmail>
    60 //</cmail>
    60 
    61 
   429 	ReScaleUiL(); // In case that Landscape/Portrait has changed.
   430 	ReScaleUiL(); // In case that Landscape/Portrait has changed.
   430 	// </cmail>
   431 	// </cmail>
   431 
   432 
   432 	// <cmail> Touch
   433 	// <cmail> Touch
   433 	iSearchList->SetFocusedL(ETrue);
   434 	iSearchList->SetFocusedL(ETrue);
       
   435 	FocusVisibilityChange( iAppUi.IsFocusShown() );
   434 	// </cmail>
   436 	// </cmail>
   435  	}
   437  	}
   436 
   438 
   437 void CFSEmailUiSearchListVisualiser::ChildDoDeactivate()
   439 void CFSEmailUiSearchListVisualiser::ChildDoDeactivate()
   438 	{
   440 	{
   732 	{
   734 	{
   733     FUNC_LOG;
   735     FUNC_LOG;
   734     CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType );
   736     CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType );
   735     if ( iFirstStartCompleted ) // Safety
   737     if ( iFirstStartCompleted ) // Safety
   736         {
   738         {
       
   739         if ( aType == EScreenLayoutChanged )
       
   740             {
       
   741             SetStatusBarLayout();
       
   742             }
       
   743     
   737         if ( iSearchTreeListVisualizer )
   744         if ( iSearchTreeListVisualizer )
   738             {
   745             {
   739             TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
   746             TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
   740             iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );            
   747             iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );            
   741             }
   748             }
   758     CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen );
   765     CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen );
   759     iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen );
   766     iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen );
   760     }
   767     }
   761 
   768 
   762 // -----------------------------------------------------------------------------
   769 // -----------------------------------------------------------------------------
   763 //  CFSEmailUiSearchListVisualiser::HandleTimerFocusStateChange
   770 //  CFSEmailUiSearchListVisualiser::FocusVisibilityChange
   764 // -----------------------------------------------------------------------------
   771 // -----------------------------------------------------------------------------
   765 //
   772 //
   766 void CFSEmailUiSearchListVisualiser::HandleTimerFocusStateChange( TBool aShow )
   773 void CFSEmailUiSearchListVisualiser::FocusVisibilityChange(
       
   774         TBool aVisible )
   767     {
   775     {
   768     CFsEmailUiViewBase::HandleTimerFocusStateChange( aShow );
   776     CFsEmailUiViewBase::FocusVisibilityChange( aVisible );
   769     iSearchTreeListVisualizer->SetFocusVisibility( aShow );
   777     iSearchTreeListVisualizer->SetFocusVisibility( aVisible );
   770     }
   778     }
   771 
   779 
   772 // ---------------------------------------------------------------------------
   780 // ---------------------------------------------------------------------------
   773 // CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
   781 // CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
   774 // Sets status bar layout
   782 // Sets status bar layout
   775 // ---------------------------------------------------------------------------
   783 // ---------------------------------------------------------------------------
   776 //
   784 //
   777 void CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
   785 void CFSEmailUiSearchListVisualiser::SetStatusBarLayout()
   778 	{
   786 	{
   779 	if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )
   787     TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
   780 		{
   788     if( Layout_Meta_Data::IsLandscapeOrientation() )
   781 		TRAP_IGNORE(
   789         {
   782 			StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
   790         // landscape must use different layout
   783 		}
   791         res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
       
   792         }
       
   793     
       
   794     if ( StatusPane()->CurrentLayoutResId() !=  res )
       
   795         {
       
   796         TRAP_IGNORE(
       
   797             StatusPane()->SwitchLayoutL( res ));
       
   798         }
   784 	}
   799 	}
   785 
   800 
   786 void CFSEmailUiSearchListVisualiser::HandleCommandL( TInt aCommand )
   801 void CFSEmailUiSearchListVisualiser::HandleCommandL( TInt aCommand )
   787     {
   802     {
   788     FUNC_LOG;
   803     FUNC_LOG;
   907 				DeleteFocusedMessageL();
   922 				DeleteFocusedMessageL();
   908 				}
   923 				}
   909 			}
   924 			}
   910             break;
   925             break;
   911         case EAknSoftkeyOpen:
   926         case EAknSoftkeyOpen:
       
   927     		if (!iAppUi.IsFocusShown())
       
   928     			{
       
   929     			iAppUi.SetFocusVisibility( ETrue);
       
   930     			break;
       
   931     			}
   912         case EFsEmailUiCmdOpen:
   932         case EFsEmailUiCmdOpen:
   913         	{
   933         	{
   914  			if ( iSearchList->Count() )
   934  			if ( iSearchList->Count() )
   915 				{
   935 				{
   916 				OpenHighlightedMailL();	       	
   936 				OpenHighlightedMailL();	       	
  1150         if ( AknLayoutUtils::LayoutMirrored() )
  1170         if ( AknLayoutUtils::LayoutMirrored() )
  1151             {
  1171             {
  1152             if ( scanCode == EStdKeyRightArrow ) scanCode = EStdKeyLeftArrow;
  1172             if ( scanCode == EStdKeyRightArrow ) scanCode = EStdKeyLeftArrow;
  1153             else if ( scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
  1173             else if ( scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
  1154             }
  1174             }
  1155         
  1175         // Handle possible focus visibility change
       
  1176 		if ((scanCode == EStdKeyRightArrow)
       
  1177 			|| (scanCode == EStdKeyLeftArrow)
       
  1178 			|| (scanCode == EStdKeyUpArrow)
       
  1179 			|| (scanCode == EStdKeyDownArrow)
       
  1180 			|| (scanCode == EStdKeyEnter)
       
  1181 			|| (scanCode == EStdKeyDeviceA)
       
  1182 			|| (scanCode == EStdKeyDevice3))
       
  1183 			{
       
  1184             // If the focus was not active already, ignore the key press
       
  1185             if( !iAppUi.SetFocusVisibility( ETrue ) )
       
  1186                 {
       
  1187                 return ETrue;
       
  1188                 }
       
  1189             
       
  1190 			}
  1156         switch ( scanCode )
  1191         switch ( scanCode )
  1157             {
  1192             {
  1158             case EStdKeyDevice3: // CENTER CLICK
  1193             case EStdKeyDevice3: // CENTER CLICK
  1159             case EStdKeyEnter:  // ENTER EITHER SELECTS ITEM IN TOOLBAR OR OPENS MAIL
  1194             case EStdKeyEnter:  // ENTER EITHER SELECTS ITEM IN TOOLBAR OR OPENS MAIL
  1160             case EStdKeyNkpEnter:
  1195             case EStdKeyNkpEnter:
  1240 
  1275 
  1241 	// The anchor layout mirrors itself automatically when necessary.
  1276 	// The anchor layout mirrors itself automatically when necessary.
  1242 	// There's no need to mirror anything manually here.
  1277 	// There's no need to mirror anything manually here.
  1243 	
  1278 	
  1244 	// BAR BACGROUND IMAGE
  1279 	// BAR BACGROUND IMAGE
  1245     //<cmail> platform layout changes
       
  1246     TRect contBarRect = iAppUi.LayoutHandler()->GetControlBarRect();
  1280     TRect contBarRect = iAppUi.LayoutHandler()->GetControlBarRect();
  1247     TPoint& tl( contBarRect.iTl );
  1281     TPoint& tl( contBarRect.iTl );
  1248     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 0, 
  1282     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 0, 
  1249         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1283         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1250         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1284         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1252     TPoint& br( contBarRect.iBr );
  1286     TPoint& br( contBarRect.iBr );
  1253     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0, 
  1287     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0, 
  1254         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1288         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1255         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1289         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1256         TAlfTimedPoint( br.iX, br.iY ));
  1290         TAlfTimedPoint( br.iX, br.iY ));
  1257     //</cmail>
       
  1258 
       
  1259 	// LOOKING GLASS IMAGE
       
  1260     //<cmail> search magnifier icon removed from cmail
       
  1261     /*TRect searchIconRect( iAppUi.LayoutHandler()->GetControlBarMailboxIconRect() );
       
  1262     const TPoint& tl( searchIconRect.iTl );
       
  1263     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, 
       
  1264         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1265         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize,
       
  1266         TAlfTimedPoint(0, 0 ));
       
  1267     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, 
       
  1268         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  1269         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  1270         TAlfTimedPoint(KSearchIconWidth, iAppUi.LayoutHandler()->ControlBarHeight()));*/	
       
  1271         
  1291         
  1272 	// TEXT
  1292 	// TEXT
  1273     //<cmail> platform layout changes
       
  1274     TRect textRect =  iAppUi.LayoutHandler()->GetSearchListHeaderTextLayout().TextRect();
  1293     TRect textRect =  iAppUi.LayoutHandler()->GetSearchListHeaderTextLayout().TextRect();
  1275     tl = textRect.iTl;
  1294     tl = textRect.iTl;
  1276     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, 
  1295     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, 
  1277         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1296         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1278         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1297         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1280     br = textRect.iBr;
  1299     br = textRect.iBr;
  1281     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, 
  1300     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, 
  1282         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1301         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1283         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1302         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1284         TAlfTimedPoint( br.iX, br.iY ));
  1303         TAlfTimedPoint( br.iX, br.iY ));
  1285     //</cmail>
  1304 
  1286 
  1305     TRect listRect = iAppUi.LayoutHandler()->GetListRect( ETrue );
  1287     //<cmail> platform layout changes
       
  1288     TRect listRect = iAppUi.LayoutHandler()->GetListRect();
       
  1289     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2, 
  1306     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2, 
  1290         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1307         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1291         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1308         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1292         TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
  1309         TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
  1293     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2, 
  1310     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2, 
  1294         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1311         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  1295         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1312         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  1296         TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
  1313         TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
  1297     //</cmail>
       
  1298 	}
  1314 	}
  1299 
  1315 
  1300 
  1316 
  1301 TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromIndex( TInt aItemIdx ) const
  1317 TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromIndex( TInt aItemIdx ) const
  1302     {
  1318     {
  2280 	    iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[prevIdx].iSearchListItemId );
  2296 	    iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[prevIdx].iSearchListItemId );
  2281 	    ChangeReadStatusOfHighlightedL( ETrue );
  2297 	    ChangeReadStatusOfHighlightedL( ETrue );
  2282         aFoundPreviousMsgId = MsgIdFromIndex( prevIdx );
  2298         aFoundPreviousMsgId = MsgIdFromIndex( prevIdx );
  2283 	    ret = KErrNone;
  2299 	    ret = KErrNone;
  2284 	    }
  2300 	    }
       
  2301 	
  2285 	if ( ret == KErrNone )
  2302 	if ( ret == KErrNone )
  2286 		{
  2303 		{
  2287 		OpenHighlightedMailL();
  2304 		OpenHighlightedMailL();
  2288 		}		
  2305 		}		
  2289 	return ret;
  2306 	return ret;
  2290 	}
  2307 	}
  2291 
  2308 
       
  2309 TInt CFSEmailUiSearchListVisualiser::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId )
       
  2310 	{
       
  2311 	FUNC_LOG;
       
  2312 	TInt ret(KErrNotFound);	
       
  2313 	
       
  2314 	TInt idx = ItemIndexFromMessageId( aFoundPreviousMsgId );	
       
  2315 	if ( idx >= 0 )
       
  2316 		{		
       
  2317 		// Focus the previous message
       
  2318 		iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[idx].iSearchListItemId );
       
  2319 		ChangeReadStatusOfHighlightedL( ETrue );
       
  2320 		ret = KErrNone;		
       
  2321 		}
       
  2322 
       
  2323 	if ( ret == KErrNone )
       
  2324 		{
       
  2325 		OpenHighlightedMailL();
       
  2326 		}
       
  2327 	
       
  2328 	return ret;
       
  2329 	}
  2292 
  2330 
  2293 	// Helper functions to get highlighted message id and folder id
  2331 	// Helper functions to get highlighted message id and folder id
  2294 TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageFolderId()
  2332 TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageFolderId()
  2295 	{
  2333 	{
  2296     FUNC_LOG;
  2334     FUNC_LOG;
  2346         case MFsTreeListObserver::EFsTreeListItemWillGetFocused:
  2384         case MFsTreeListObserver::EFsTreeListItemWillGetFocused:
  2347             {
  2385             {
  2348             SetMskL(); 
  2386             SetMskL(); 
  2349             break;
  2387             break;
  2350             }            
  2388             }            
       
  2389         case MFsTreeListObserver::EFsFocusVisibilityChange:
       
  2390         	{
       
  2391         	iAppUi.SetFocusVisibility( EFalse );
       
  2392         	break;
       
  2393         	}
  2351         case MFsTreeListObserver::EFsTreeListItemTouchFocused:
  2394         case MFsTreeListObserver::EFsTreeListItemTouchFocused:
  2352         default:
  2395         default:
  2353             //Just ignore rest of events
  2396             //Just ignore rest of events
  2354             break;             
  2397             break;             
  2355         }                   
  2398         }