gssettingsuis/Gs/GSFramework/src/GSParentPlugin.cpp
changeset 18 e3554c9069b6
parent 2 051d34a3f367
equal deleted inserted replaced
4:3f8368f032cf 18:e3554c9069b6
    33 #include    <akntitle.h>
    33 #include    <akntitle.h>
    34 #include    <aknViewAppUi.h>
    34 #include    <aknViewAppUi.h>
    35 #include    <bautils.h>
    35 #include    <bautils.h>
    36 #include    <eikmenup.h>
    36 #include    <eikmenup.h>
    37 #include    <eikbtgpc.h>
    37 #include    <eikbtgpc.h>
    38 #include    <hlplch.h>
       
    39 #include    <StringLoader.h>
    38 #include    <StringLoader.h>
    40 #include	  <layoutmetadata.cdl.h>
    39 
    41 // Middle Softkey control ID.
    40 // Middle Softkey control ID.
    42 const TInt KGSMSKControlID = 3;
    41 const TInt KGSMSKControlID = 3;
    43 const TInt KGSMSKLength = 256;
    42 const TInt KGSMSKLength = 256;
    44 const TInt KGSPluginArrayInitSize = 10;
    43 const TInt KGSPluginArrayInitSize = 10;
    45 
    44 
   212         TBuf<1> empty( KEmptyText );
   211         TBuf<1> empty( KEmptyText );
   213         iContainer->SetListBoxEmptyTextL( empty );
   212         iContainer->SetListBoxEmptyTextL( empty );
   214     
   213     
   215         // Update listbox from already existing iPluginArray:
   214         // Update listbox from already existing iPluginArray:
   216         iContainer->UpdateListBoxL();
   215         iContainer->UpdateListBoxL();
   217 		if (position.Count() > 0)
   216         iAppUi->AddToViewStackL( *this, iContainer );
   218 			{
   217         if( iTopPluginUid != KGSNoneSelected )
   219 			if (iScreenMode == Layout_Meta_Data::IsLandscapeOrientation())
   218             {
   220 				{
   219             iContainer->SetTopItem( iTopPluginUid );
   221 				iContainer->SetPosition(position, EFalse);
   220             }
   222 				}
   221         if( iSelectedPluginUid != KGSNoneSelected )
   223 			else
   222             {
   224 				{
   223             iContainer->SetSelectedItem( iSelectedPluginUid );
   225 				iContainer->SetPosition(position, ETrue);
   224             }
   226 				}
   225         }
   227 			}
   226 
   228 		iAppUi->AddToViewStackL(*this, iContainer);
       
   229     // Navigating to parent view will reset all child plugin selected indexes:
   227     // Navigating to parent view will reset all child plugin selected indexes:
   230     for( TInt i = 0; i < iPluginArray->Count(); i++ )
   228     for( TInt i = 0; i < iPluginArray->Count(); i++ )
   231         {
   229         {
   232         CGSPluginInterface* plugin = iPluginArray->operator[]( i );
   230         CGSPluginInterface* plugin = iPluginArray->operator[]( i );
   233         plugin->ResetSelectedItemIndex();
   231         plugin->ResetSelectedItemIndex();
   236     iMskCommandId = EAknSoftkeyOpen;
   234     iMskCommandId = EAknSoftkeyOpen;
   237 
   235 
   238     SetMiddleSoftKeyLabelL( R_QTN_MSK_OPEN, EAknSoftkeyOpen );
   236     SetMiddleSoftKeyLabelL( R_QTN_MSK_OPEN, EAknSoftkeyOpen );
   239     CheckMiddleSoftkeyLabelL();
   237     CheckMiddleSoftkeyLabelL();
   240 
   238 
   241 		// If this view was launched from external source, use "exit" as RSK
   239 	// If this view was launched from external source, use "exit" as RSK
   242 		if (iPrevViewId.iAppUid != KUidGS)
   240 	if ( iPrevViewId.iAppUid != KUidGS )
       
   241 		{
       
   242 		CEikButtonGroupContainer* cbaGroup = Cba();
       
   243 		if(cbaGroup)
   243 			{
   244 			{
   244 			CEikButtonGroupContainer* cbaGroup = Cba();
   245 			HBufC* rightSKText = StringLoader::LoadLC (R_GS_PARENTPLUGIN_CBA_EXIT);
   245 			if (cbaGroup)
   246 			TPtr rskPtr = rightSKText->Des();
   246 				{
   247 			cbaGroup->SetCommandL(2,EAknSoftkeyExit,*rightSKText);
   247 				HBufC* rightSKText = StringLoader::LoadLC(
   248 			CleanupStack::PopAndDestroy(rightSKText);
   248 						R_GS_PARENTPLUGIN_CBA_EXIT);
       
   249 				TPtr rskPtr = rightSKText->Des();
       
   250 				cbaGroup->SetCommandL(2, EAknSoftkeyExit, *rightSKText);
       
   251 				CleanupStack::PopAndDestroy(rightSKText);
       
   252 				}
       
   253 			}
   249 			}
   254 
       
   255 		}
   250 		}
       
   251 
   256 	}
   252 	}
   257 
   253 
   258 // ---------------------------------------------------------------------------
   254 // ---------------------------------------------------------------------------
   259 // CGSParentPlugin::DoDeactivate()
   255 // CGSParentPlugin::DoDeactivate()
   260 //
   256 //
   266     
   262     
   267     iPluginLoader->RequestPriority( CActive::EPriorityLow );
   263     iPluginLoader->RequestPriority( CActive::EPriorityLow );
   268     
   264     
   269     if ( iContainer )
   265     if ( iContainer )
   270         {
   266         {
   271 		if (position.Count() > 0)
   267         CGSPluginInterface* selectedPlugin = iContainer->SelectedPlugin();
   272 			{
   268         if( selectedPlugin )
   273 			position.Reset();
   269             {
   274 			}
   270             iSelectedPluginUid = selectedPlugin->Id();
   275 		TRAPD(err, iContainer->GetPositionL(position));
   271             }
   276 		iScreenMode = Layout_Meta_Data::IsLandscapeOrientation();
   272         else
   277 
   273             {
   278 		iAppUi->RemoveFromViewStack(*this, iContainer);
   274             iSelectedPluginUid = KGSNoneSelected;
       
   275             }
       
   276 
       
   277         CGSPluginInterface* topPlugin = iContainer->TopPlugin();
       
   278         if ( topPlugin )
       
   279             {
       
   280             iTopPluginUid = topPlugin->Id();
       
   281             }
       
   282         else
       
   283             {
       
   284             iTopPluginUid = KGSNoneSelected;
       
   285             }
       
   286         iAppUi->RemoveFromViewStack( *this, iContainer );
   279         delete iContainer;
   287         delete iContainer;
   280         iContainer = NULL;
   288         iContainer = NULL;
   281         }
   289         }
   282     __GSLOGSTRING( "[CGSParentPlugin::DoDeactivate] Done" );
   290     __GSLOGSTRING( "[CGSParentPlugin::DoDeactivate] Done" );
   283     }
   291     }
   365         case EGSMSKCmdAppChange:
   373         case EGSMSKCmdAppChange:
   366             iContainer->HandleSelectionKeyL();
   374             iContainer->HandleSelectionKeyL();
   367             break;
   375             break;
   368         case EAknCmdHelp:
   376         case EAknCmdHelp:
   369             {
   377             {
   370             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   371                 {
       
   372                 HlpLauncher::LaunchHelpApplicationL(
       
   373                     iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
       
   374                 }
       
   375             break;
   378             break;
   376             }
   379             }
   377         default:
   380         default:
   378             iAppUi->HandleCommandL( aCommand );
   381             iAppUi->HandleCommandL( aCommand );
   379             break;
   382             break;