vpnui/vpnmanagementui/src/vpnmanagementuipolicyview.cpp
branchRCL_3
changeset 49 5960d2d03390
parent 41 e06095241a65
equal deleted inserted replaced
46:29c8f9bc68e1 49:5960d2d03390
   106     {
   106     {
   107     if ( aResourceId == R_VPNUI_POLICIES_VIEW_MENU )
   107     if ( aResourceId == R_VPNUI_POLICIES_VIEW_MENU )
   108         {
   108         {
   109         TInt currentItem = iPolicyContainer->iListBox->CurrentItemIndex();
   109         TInt currentItem = iPolicyContainer->iListBox->CurrentItemIndex();
   110 
   110 
       
   111         // the policy list is empty  all except Install and Exit is dimmed
   111         if ( currentItem == -1 )
   112         if ( currentItem == -1 )
   112             {
   113             {
   113             aMenuPane->SetItemDimmed( EVpnUiCmdPolicyDetails, ETrue );
   114             aMenuPane->SetItemDimmed( EVpnUiCmdPolicyDetails, ETrue );
   114             aMenuPane->SetItemDimmed( EVpnUiCmdDeletePolicy, ETrue );
   115             aMenuPane->SetItemDimmed( EVpnUiCmdDeletePolicy, ETrue );
   115           
   116             aMenuPane->SetItemDimmed( EVpnUiCmdUpdatePolicy, ETrue );
   116             }
   117             // NSSM support is discontinued
   117          
   118             aMenuPane->SetItemDimmed( EVpnUiCmdInstallPolicies, ETrue );
       
   119             }
       
   120         // at least one policy is installed, 
       
   121         else 
       
   122             {
       
   123             aMenuPane->SetItemDimmed( EVpnUiCmdInstallPolicies, ETrue );
       
   124             // NSSM support is discontinued
       
   125             aMenuPane->SetItemDimmed( EVpnUiCmdUpdatePolicy, ETrue );
       
   126             }
   118         }
   127         }
   119     }
   128     }
   120 
   129 
   121 // ---------------------------------------------------------
   130 // ---------------------------------------------------------
   122 // CVpnManagementUiPolicyView::Id() const
   131 // CVpnManagementUiPolicyView::Id() const
   133 // Handles Softkey and Options list commands
   142 // Handles Softkey and Options list commands
   134 // ---------------------------------------------------------
   143 // ---------------------------------------------------------
   135 //
   144 //
   136 void CVpnManagementUiPolicyView::HandleCommandL( TInt aCommand )
   145 void CVpnManagementUiPolicyView::HandleCommandL( TInt aCommand )
   137     {
   146     {
   138      switch ( aCommand )
   147     TBool ffsLow;
       
   148     switch ( aCommand )
   139         {
   149         {
   140         case EAknSoftkeyBack:
   150         case EAknSoftkeyBack:
   141             {
   151             {
   142             iLoader.ChangeViewL( KChangeViewPrevious );
   152             iLoader.ChangeViewL( KChangeViewPrevious );
   143             break;
   153             break;
   153             // Show details
   163             // Show details
   154             PolicyDetailsL(iPolicyContainer->iListBox->CurrentItemIndex());
   164             PolicyDetailsL(iPolicyContainer->iListBox->CurrentItemIndex());
   155             break;
   165             break;
   156             }
   166             }
   157 
   167 
   158      
   168         case EVpnUiCmdInstallPolicies:
       
   169             {
       
   170             ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 );
       
   171     		if(!ffsLow)
       
   172     			{
       
   173             	iPolicyContainer->InstallPoliciesL();
       
   174     			}
       
   175             break;
       
   176             }
       
   177         case EVpnUiCmdUpdatePolicy:
       
   178             {
       
   179             ffsLow = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 );
       
   180     		if(!ffsLow)
       
   181     			{
       
   182             	iCurrentPosition = iPolicyContainer->iListBox->CurrentItemIndex();
       
   183             	//Save policy index for Connecting via note
       
   184             	iLoader.iCurrentPolicyIndex = iCurrentPosition;
       
   185             	//Save update operation for Connecting via note
       
   186             	iLoader.iPolicyUpdate = ETrue;
       
   187 
       
   188             	TVpnPolicyInfo policyInfo;
       
   189             	policyInfo.iId = iLoader.VpnApiWrapperL().PolicyListL()->At(
       
   190             	    iCurrentPosition).iId;
       
   191             	iPolicyContainer->UpdatePolicyL(policyInfo.iId);
       
   192     			}
       
   193             break;
       
   194             }
       
   195 
   159         case EVpnUiCmdDeletePolicy:
   196         case EVpnUiCmdDeletePolicy:
   160             {
   197             {
   161             //confirmation query
   198             //confirmation query
   162             HBufC* temp;
   199             HBufC* temp;
   163            
   200            
   273     	{
   310     	{
   274 	    HBufC* text = HBufC::NewLC(KMaxLengthTextDetailsBody); 
   311 	    HBufC* text = HBufC::NewLC(KMaxLengthTextDetailsBody); 
   275 		ReadResourceL(*text, aResourceId);
   312 		ReadResourceL(*text, aResourceId);
   276 		cbaGroup->RemoveCommandFromStack(
   313 		cbaGroup->RemoveCommandFromStack(
   277 		    KVpnMSKControlId, EVpnUiCmdPolicyDetails);
   314 		    KVpnMSKControlId, EVpnUiCmdPolicyDetails);
       
   315 		cbaGroup->RemoveCommandFromStack(
       
   316 		    KVpnMSKControlId, EVpnUiCmdInstallPolicies);
   278 		cbaGroup->AddCommandToStackL(
   317 		cbaGroup->AddCommandToStackL(
   279 		    KVpnMSKControlId, aCommandId, text->Des());
   318 		    KVpnMSKControlId, aCommandId, text->Des());
   280 		CleanupStack::PopAndDestroy(text);
   319 		CleanupStack::PopAndDestroy(text);
   281     	}
   320     	}
   282     }
   321     }