idlehomescreen/widgetmanager/src/wmmaincontainer.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
child 18 d05a55b217df
equal deleted inserted replaced
12:9674c1a575e9 17:b8fae6b8a148
   722 //
   722 //
   723 void CWmMainContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   723 void CWmMainContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   724     {
   724     {
   725     if ( !iClosingDown  )
   725     if ( !iClosingDown  )
   726         {
   726         {
   727 		
   727         TBool eatEvent( EFalse );
       
   728         TPointerEvent event( aPointerEvent );
       
   729 
   728 		if (aPointerEvent.iType == TPointerEvent::EButton1Down)
   730 		if (aPointerEvent.iType == TPointerEvent::EButton1Down)
   729 			{
   731 			{
   730 	        // Check if user clicked a child control
   732 	        // Check if user clicked a child control
   731 	        CCoeControl* control = FindChildControlByPoint( aPointerEvent.iPosition );
   733 	        CCoeControl* control = FindChildControlByPoint( aPointerEvent.iPosition );
   732 	        if ( control && !control->IsFocused() )
   734 	        if ( control && !control->IsFocused() )
   746 	            // update focus mode accordingly
   748 	            // update focus mode accordingly
   747 	            UpdateFocusMode();
   749 	            UpdateFocusMode();
   748 	            // repaint
   750 	            // repaint
   749 	            DrawDeferred();
   751 	            DrawDeferred();
   750 	            }
   752 	            }
       
   753 	        
       
   754 	        // stylus popup should not be opened when uninstalling. 
       
   755 	        // ou1cimx1#302973
       
   756 	        if ( control == iWidgetsList && iWidgetsList->IsFocused() )
       
   757 	             {
       
   758 	             TInt itemIndex = iWidgetsList->CurrentListBoxItemIndex();
       
   759 	             TBool itemPointed = iWidgetsList->View()->XYPosToItemIndex(
       
   760 	                                     aPointerEvent.iPosition,
       
   761 	                                     itemIndex );
       
   762 	             if ( itemIndex >= 0 && itemPointed )
       
   763 	                 {
       
   764 	                 CWmWidgetData& data = iWidgetsList->WidgetData( itemIndex );                
       
   765 	                 if ( &data && data.IsUninstalling() )
       
   766 	                     {
       
   767                          event.iType = TPointerEvent::EButton1Up;
       
   768 	                     eatEvent = ETrue;
       
   769 	                     }
       
   770 	                 }
       
   771 	             }
       
   772 	        
   751 			}
   773 			}
   752         
   774 		
   753         CCoeControl::HandlePointerEventL( aPointerEvent );
   775 		// set downkey event to base class
       
   776 		CCoeControl::HandlePointerEventL( aPointerEvent );
       
   777 		
       
   778 		// send key up event if selected widget is being uninstalled.
       
   779 		// stylus popup shouldn't be displayed for this item.
       
   780 		if ( eatEvent )
       
   781 		    {
       
   782             CCoeControl::HandlePointerEventL( event );
       
   783 		    }
   754         }
   784         }
   755     }
   785     }
   756 
   786 
   757 // ---------------------------------------------------------
   787 // ---------------------------------------------------------
   758 // CWmMainContainer::InitializeControlsL
   788 // CWmMainContainer::InitializeControlsL
   948     TBool retVal( EFalse );
   978     TBool retVal( EFalse );
   949     CWmWidgetData* data = iWidgetsList->WidgetData();
   979     CWmWidgetData* data = iWidgetsList->WidgetData();
   950     if ( WidgetSelected() && data && !data->IsUninstalling() )
   980     if ( WidgetSelected() && data && !data->IsUninstalling() )
   951         {
   981         {
   952         if ( data->WidgetType() == CWmWidgetData::ECps &&
   982         if ( data->WidgetType() == CWmWidgetData::ECps &&
   953                 data->PublisherUid() != KNullUid )
   983             data->PublisherUid() != KNullUid && 
       
   984             data->WrtType() != CWmWidgetData::EUnIdentified )
   954             {
   985             {
   955             retVal = ETrue;
   986             retVal = ETrue;
   956             }
   987             }
   957         }
   988         }
   958     return retVal;
   989     return retVal;
  1023 // ---------------------------------------------------------------------------
  1054 // ---------------------------------------------------------------------------
  1024 //
  1055 //
  1025 void CWmMainContainer::AddWidgetToHomeScreenL()
  1056 void CWmMainContainer::AddWidgetToHomeScreenL()
  1026     {
  1057     {
  1027     CWmWidgetData* data = iWidgetsList->WidgetData();
  1058     CWmWidgetData* data = iWidgetsList->WidgetData();
  1028     if ( !iClosingDown && data && !data->IsUninstalling() )
  1059     if ( !iClosingDown )
  1029         {
  1060         {
  1030         if ( iFindbox && iFindPaneIsVisible )
  1061         if ( iFindbox && iFindPaneIsVisible )
  1031             {
  1062             {
  1032             DeactivateFindPaneL();
  1063             DeactivateFindPaneL();
  1033             }
  1064             }
  1034 
       
  1035         // set add to homescreen to be executed later
       
  1036         iWmPlugin.SetPostponedCommandL(
       
  1037             CWmPlugin::EAddToHomescreen,
       
  1038             data->HsContentInfo() );
       
  1039 
       
  1040         // check if we can add any widgets to hs. 
       
  1041         TBool hsContentFull = ETrue;
       
  1042         for ( TInt i=0; i<iWidgetsList->WidgetDataCount(); i++ )
       
  1043             {
       
  1044             CHsContentInfo& info = iWidgetsList->WidgetData(i).HsContentInfo();
       
  1045             if ( info.CanBeAdded() ) 
       
  1046                 {
       
  1047                 hsContentFull = EFalse;
       
  1048                 break;
       
  1049                 }
       
  1050             }
       
  1051         
  1065         
  1052         // deactivate wm if there's not enough space to add widget to hs.
  1066         if ( data && !data->IsUninstalling() )
  1053         if ( !data->HsContentInfo().CanBeAdded() && !hsContentFull )
  1067             {
  1054             {
  1068             // set add to homescreen to be executed later
  1055             iWmPlugin.ExecuteCommandL();
  1069             iWmPlugin.SetPostponedCommandL(
  1056             }
  1070                         CWmPlugin::EAddToHomescreen,
  1057         else
  1071                         data->HsContentInfo() );
  1058             {
  1072 
  1059             iWmPlugin.CloseView();
  1073             iWmPlugin.CloseView();
  1060             }
  1074             }
  1061         }
  1075         }
  1062     }
  1076     }
  1063 
  1077 
  1087 
  1101 
  1088 // ---------------------------------------------------------------------------
  1102 // ---------------------------------------------------------------------------
  1089 // CWmMainContainer::ActivateFindPaneL
  1103 // CWmMainContainer::ActivateFindPaneL
  1090 // ---------------------------------------------------------------------------
  1104 // ---------------------------------------------------------------------------
  1091 //
  1105 //
  1092 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdabtive )
  1106 void CWmMainContainer::ActivateFindPaneL( TBool aActivateAdaptive )
  1093     {
  1107     {
  1094     if ( iFindbox && !iFindPaneIsVisible &&
  1108     if ( iFindbox && !iFindPaneIsVisible &&
  1095             iWidgetsList->Model()->NumberOfItems() > KMinWidgets )
  1109             iWidgetsList->Model()->NumberOfItems() > KMinWidgets )
  1096         {
  1110         {
       
  1111         // reset focus
       
  1112         ResetFocus();
       
  1113         
  1097         // set column filter flag
  1114         // set column filter flag
  1098         TBitFlags32 bitFlag;
  1115         TBitFlags32 bitFlag;
  1099         bitFlag.ClearAll(); // clear all columns
  1116         bitFlag.ClearAll(); // clear all columns
  1100         bitFlag.Assign( 1,1 ); // turn on column at index one
  1117         bitFlag.Assign( 1,1 ); // turn on column at index one
  1101         iFindbox->SetListColumnFilterFlags( bitFlag );
  1118         iFindbox->SetListColumnFilterFlags( bitFlag );
  1120         iFindbox->MakeVisible( ETrue );
  1137         iFindbox->MakeVisible( ETrue );
  1121         
  1138         
  1122         // layout listbox and findbox
  1139         // layout listbox and findbox
  1123         LayoutControls();        
  1140         LayoutControls();        
  1124         
  1141         
  1125         if ( aActivateAdabtive )
  1142         if ( aActivateAdaptive )
  1126             {
  1143             {
  1127             iFindbox->ShowAdaptiveSearchGrid();
  1144             iFindbox->ShowAdaptiveSearchGrid();
  1128             }
  1145             }
  1129         iFindbox->SetFocus( ETrue );
  1146         iFindbox->SetFocus( ETrue );
  1130         iWidgetsList->SetFindPaneIsVisible( ETrue );
  1147         iWidgetsList->SetFindPaneIsVisible( ETrue );
  1160         if ( m && m->Filter() )
  1177         if ( m && m->Filter() )
  1161             {
  1178             {
  1162             m->Filter()->ResetFilteringL();
  1179             m->Filter()->ResetFilteringL();
  1163             m->RemoveFilter();
  1180             m->RemoveFilter();
  1164             }
  1181             }
  1165 
  1182         
  1166         iFindbox->MakeVisible( EFalse );
  1183         ResetFocus();
  1167         iFindbox->SetFocus( EFalse );
  1184 
  1168         iFindPaneIsVisible = EFalse;
  1185         iFindbox->MakeVisible( EFalse );        
  1169         iWidgetsList->SetFindPaneIsVisible( EFalse );
  1186         iFindPaneIsVisible = EFalse;        
       
  1187         iWidgetsList->SetFindPaneIsVisible( EFalse );       
  1170         
  1188         
  1171         LayoutControls();
  1189         LayoutControls();
  1172 
  1190 
  1173         // set soft key set
  1191         // set soft key set
  1174         CEikButtonGroupContainer* cbaGroup =
  1192         CEikButtonGroupContainer* cbaGroup =
  1405 // CWmMainContainer::ProcessForegroundEvent
  1423 // CWmMainContainer::ProcessForegroundEvent
  1406 // ----------------------------------------------------
  1424 // ----------------------------------------------------
  1407 //
  1425 //
  1408 void CWmMainContainer::ProcessForegroundEvent( TBool aForeground )
  1426 void CWmMainContainer::ProcessForegroundEvent( TBool aForeground )
  1409     {
  1427     {
  1410     if ( aForeground )
  1428     if ( iFindbox && iFindPaneIsVisible && 
       
  1429         iFindbox->IsFocused() )
       
  1430         {
       
  1431         // keep focus & do nothing 
       
  1432         }
       
  1433     else if ( aForeground )
  1411         {
  1434         {
  1412         // set init state when wm comes to foreground.
  1435         // set init state when wm comes to foreground.
  1413 		// remove focus from all controls when activating view.
  1436 		// remove focus from all controls when activating view.
  1414         CCoeControl* control = NULL;
  1437         ResetFocus( EDrawNow );
  1415         CCoeControlArray::TCursor cursor = Components().Begin();
  1438         }
  1416         while( ( control = cursor.Control<CCoeControl>() ) != NULL )
  1439     }
  1417             {
  1440 
  1418             if( control->IsVisible() && control->IsFocused() )
  1441 // ----------------------------------------------------
  1419                 {
  1442 // CWmMainContainer::ResetFocus
  1420                 control->SetFocus( EFalse, EDrawNow );
  1443 // ----------------------------------------------------
  1421                 }
  1444 //
  1422             cursor.Next();
  1445 void CWmMainContainer::ResetFocus( TDrawNow aDrawNow )
  1423             }
  1446     {
  1424         UpdateFocusMode();
  1447     CCoeControl* control = NULL;
  1425         }
  1448     CCoeControlArray::TCursor cursor = Components().Begin();
       
  1449     while( ( control = cursor.Control<CCoeControl>() ) != NULL )
       
  1450         {
       
  1451         if( control->IsVisible() && control->IsFocused() )
       
  1452             {
       
  1453             control->SetFocus( EFalse, aDrawNow );
       
  1454             }
       
  1455         cursor.Next();
       
  1456         }
       
  1457     UpdateFocusMode();
  1426     }
  1458     }
  1427 
  1459 
  1428 // ----------------------------------------------------
  1460 // ----------------------------------------------------
  1429 // CWmMainContainer::WmListBox
  1461 // CWmMainContainer::WmListBox
  1430 // ----------------------------------------------------
  1462 // ----------------------------------------------------