vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp
branchRCL_3
changeset 49 5960d2d03390
parent 41 e06095241a65
equal deleted inserted replaced
46:29c8f9bc68e1 49:5960d2d03390
    71     if ((iListItemCount == 0) && (!iLoader.iBackFromServerDefinition))
    71     if ((iListItemCount == 0) && (!iLoader.iBackFromServerDefinition))
    72         {
    72         {
    73         iLoader.iShowDefineQuery = ETrue;
    73         iLoader.iShowDefineQuery = ETrue;
    74         }
    74         }
    75     iLoader.iBackFromServerDefinition = EFalse;
    75     iLoader.iBackFromServerDefinition = EFalse;
    76 
    76     iShowWaitNote = EFalse;
    77 	SetRect( aRect );
    77 	SetRect( aRect );
    78     }
    78     }
    79 
    79 
    80 // ---------------------------------------------------------
    80 // ---------------------------------------------------------
    81 // CVpnManagementUiServerContainer::ActivateL()
    81 // CVpnManagementUiServerContainer::ActivateL()
   110 				iLoader.iShowDefineQuery = EFalse;
   110 				iLoader.iShowDefineQuery = EFalse;
   111 				iLoader.iNewServerDefinition = EFalse;
   111 				iLoader.iNewServerDefinition = EFalse;
   112 	            }
   112 	            }
   113             }
   113             }
   114         }
   114         }
       
   115     /*** NSSM support is discontinued.
       
   116          Code is kept in comments temporarily because similar UI functionality
       
   117          might be needed for another purpose.
       
   118     if (iLoader.iNewServerDefinition)
       
   119         {//Synchronise server query
       
   120             HBufC* temp;
       
   121             temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER );
       
   122             CAknQueryDialog* query = CAknQueryDialog::NewL( 
       
   123                 CAknQueryDialog::EConfirmationTone );
       
   124             TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
       
   125             CleanupStack::PopAndDestroy();  // temp
       
   126             if ( retval )
       
   127                 {
       
   128                 //Show wait dialog 
       
   129                 //Save server index for Connecting via note
       
   130 		        iLoader.iCurrentServerIndex = iLoader.AcuApiWrapperL().GetLastCreatedServerIndexL(); 
       
   131                 //ShowWaitNoteL();
       
   132                 iShowWaitNote = ETrue;
       
   133                 // Get selection name for connecting via note
       
   134                 // and save it to the member variable of iLoader
       
   135                 iLoader.GetSelectionNameL( iLoader.iSelectionName );
       
   136                 
       
   137                 //Synchronise server
       
   138                 iLoader.AcuApiWrapperL().SynchroniseLastCreatedServerL(this);
   115    
   139    
       
   140                 //Set iNewServerDefinition to false, because 
       
   141                 //we are now synchronised server
       
   142                 iLoader.iNewServerDefinition = EFalse;
       
   143                 }
       
   144         } ***/
   116     }
   145     }
   117 
   146 
   118 
   147 
   119 // ---------------------------------------------------------
   148 // ---------------------------------------------------------
   120 // CVpnManagementUiServerContainer::SizeChanged()
   149 // CVpnManagementUiServerContainer::SizeChanged()
   272     if (aCurrentPosition >= 0)
   301     if (aCurrentPosition >= 0)
   273 		{
   302 		{
   274 		iListBox->SetTopItemIndex( aTopItem );
   303 		iListBox->SetTopItemIndex( aTopItem );
   275 		iListBox->SetCurrentItemIndex( aCurrentPosition );
   304 		iListBox->SetCurrentItemIndex( aCurrentPosition );
   276 		}
   305 		}
       
   306     /*** NSSM support is discontinued.
       
   307          Code is kept in comments temporarily because similar UI functionality
       
   308          might be needed for another purpose.
       
   309     if(iLoader.iNewServerDefinition)
       
   310         {
       
   311         iListBox->SetCurrentItemIndex(iLoader.AcuApiWrapperL().GetLastCreatedServerIndexL());
       
   312         } ***/
   277     
   313     
   278 	ActivateL();
   314 	ActivateL();
   279 	DrawNow();
   315 	DrawNow();
   280 	}
   316 	}
   281 
   317 
   316 	}
   352 	}
   317 
   353 
   318 
   354 
   319 void CVpnManagementUiServerContainer::ShowServersL() 
   355 void CVpnManagementUiServerContainer::ShowServersL() 
   320     {
   356     {
   321   
   357     /*** NSSM support is discontinued.
   322     TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
   358          Code is kept in comments temporarily because similar UI functionality
       
   359          might be needed for another purpose.
       
   360     CArrayFix<TAcuApiServerListElem>* serverList = iLoader.AcuApiWrapperL().ServerListL();
   323 
   361 
   324    	CDesCArrayFlat* itemTextArray = static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
   362    	CDesCArrayFlat* itemTextArray = static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
   325 
   363 
   326 	itemTextArray->Reset();
   364 	itemTextArray->Reset();
   327 	iListBox->Reset();
   365 	iListBox->Reset();
   328 
   366 
   329     if ( serverList.iServerUrl.Length()>0 )
   367     iListItemCount = serverList->Count();
   330        {
   368 
   331         iListItemCount = 1;
   369     for (TInt i = 0; i < iListItemCount; ++i)
   332         TBuf<KMaxProvisionServerNameLength+2> serverName;
   370         {
       
   371         TBuf<KAcuMaxServerNameLocalLth+2> serverName;
   333         serverName.Append(_L("\t"));
   372         serverName.Append(_L("\t"));
   334         serverName.Append(serverList.iServerNameLocal);
   373         serverName.Append(serverList->At(i).iServerNameLocal);
   335         itemTextArray->AppendL(serverName);
   374         itemTextArray->AppendL(serverName);
   336        }
   375        }
   337 
   376 
       
   377 
   338 	iListBox->HandleItemAdditionL();
   378 	iListBox->HandleItemAdditionL();
   339 	
   379 	***/
   340     }
   380     }
   341 
   381 
   342 
   382 
   343 void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */)
   383 void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */)
   344     {
   384     {
   345   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n")));
   385   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n")));
   346   
   386 
   347   	TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
   387     /*** NSSM support is discontinued.
   348   	TBuf<KMaxProvisionServerNameLength> serverName;
   388          Code is kept in comments temporarily because similar UI functionality
   349   	serverName.Append(serverList.iServerNameLocal);
   389          might be needed for another purpose.
   350 
   390 
   351   	HBufC* temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER, serverName );
   391     TBuf<KAcuMaxServerNameLocalLth> serverName;
   352     
   392     serverName.Append(
       
   393         iLoader.AcuApiWrapperL().ServerListL()->At(aIndex).iServerNameLocal);
       
   394    	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL - server name %S\n"), &serverName));
       
   395     HBufC* temp;
       
   396 
       
   397     TAcuServerId serverId;
       
   398     serverId = iLoader.AcuApiWrapperL().ServerListL()->At(aIndex).iServerId;
       
   399 
       
   400     //Get server policy count from vpnapiext
       
   401     TInt policyCount = 0;
       
   402     TInt ret = iLoader.VpnApiWrapperL().GetServerPolicyCount(
       
   403         serverId, policyCount);
       
   404 
       
   405   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL - server policy count %d\n"), policyCount));
       
   406 
       
   407     if ((ret== KErrNone) && (policyCount > 0)) //at least one policy related to given ACU server is found
       
   408         {
       
   409         // policies related to the server, confirmation query
       
   410         temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER_ASSOCIATED );
       
   411         }
       
   412     else
       
   413         {
       
   414         // no policies related to the server, confirmation query
       
   415         temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER, serverName );
       
   416         }
       
   417 
   353     CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   418     CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   354     TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
   419     TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
   355     CleanupStack::PopAndDestroy();  // temp
   420     CleanupStack::PopAndDestroy();  // temp
   356     if ( retval )
   421     if ( retval )
   357         {
   422         {
   358         TInt ret = iLoader.VpnApiWrapperL().DeleteServer();
   423         TInt ret = iLoader.AcuApiWrapperL().DeleteServer(aIndex);
   359         TInt ind = 0;
       
   360         if(ret == KErrNone)
   424         if(ret == KErrNone)
   361             {
   425             {
   362             //Update listbox
   426             //Update listbox
   363             UpdateListBoxL( ind );
   427             UpdateListBoxL( aIndex );
   364             
       
   365             //Update iServerList
   428             //Update iServerList
   366             iLoader.VpnApiWrapperL().ServerListL();
   429             iLoader.AcuApiWrapperL().ServerListL();
   367             
   430             
   368             //Set iNewServerDefinition to false
   431             //Set iNewServerDefinition to false
   369             iLoader.iNewServerDefinition = EFalse;
   432             iLoader.iNewServerDefinition = EFalse;
   370             }
   433             }
   371         else if (ret == KErrServerBusy)
   434         else if (ret == KErrServerBusy)
   377             note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
   440             note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
   378             note->ExecuteLD(noteText->Des());
   441             note->ExecuteLD(noteText->Des());
   379             CleanupStack::PopAndDestroy();  // noteText
   442             CleanupStack::PopAndDestroy();  // noteText
   380             }
   443             }
   381         }
   444         }
   382   
   445     ***/
   383     }
   446     }
   384 
   447 
   385 void CVpnManagementUiServerContainer::SynchroniseServerL()
   448 void CVpnManagementUiServerContainer::SynchroniseServerL(TInt /* aIndex */)
   386     {
   449     {
   387   	LOG_("CVpnManagementUiServerContainer::SynchroniseServerL");
   450   	LOG_("CVpnManagementUiServerContainer::SynchroniseServerL");
   388 
   451 
       
   452     /*** NSSM support is discontinued.
       
   453          Code is kept in comments temporarily because similar UI functionality
       
   454          might be needed for another purpose.
       
   455 
       
   456     TBool selectionExists = iLoader.SelectionExistsL( aIndex );
       
   457     if( selectionExists )
       
   458         {
       
   459         //Save server index for Connecting via note
       
   460         iLoader.iCurrentServerIndex = aIndex;
   389         // Get selection name for connecting via note
   461         // Get selection name for connecting via note
   390         // and save it to the member variable of iLoader
   462         // and save it to the member variable of iLoader
   391         iLoader.GetSelectionNameL( iLoader.iSelectionName );
   463         iLoader.GetSelectionNameL( iLoader.iSelectionName );
   392         //Show wait dialog 
   464         //Show wait dialog 
   393         iLoader.ShowWaitNoteL();
   465         iLoader.ShowWaitNoteL();
   394 
   466 
   395         iLoader.VpnApiWrapperL().SynchroniseServerL( this );
   467         iLoader.AcuApiWrapperL().SynchroniseServerL( aIndex,this );
   396         
       
   397         
       
   398         //Set iNewServerDefinition to false, because when
   468         //Set iNewServerDefinition to false, because when
   399         //we go to the policy view we don't want to show note
   469         //we go to the policy view we don't want to show note
   400         //"new server defined synchronise now"
   470         //"new server defined synchronise now"
   401         iLoader.iNewServerDefinition = EFalse;
   471         iLoader.iNewServerDefinition = EFalse;
   402 
   472         } ***/
   403     }
   473     }
   404 
   474 
   405 
   475 
       
   476 void CVpnManagementUiServerContainer::NotifyUpdatePolicyCompleteL(TInt /*aResult*/)
       
   477     {
       
   478     }
   406 
   479 
   407 void CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL(TInt aResult)
   480 void CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL(TInt aResult)
   408     {
   481     {
   409    	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL - Result %d\n"), aResult));
   482    	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL - Result %d\n"), aResult));
   410 
   483 
   411     if ( iLoader.iWaitDialog ) 
   484     if ( iLoader.iWaitDialog ) 
   412         {
   485         {
   413         iLoader.DeleteWaitNoteL();//// deletes the wait dialog
   486         iLoader.DeleteWaitNoteL();//->iWaitDialog->ProcessFinishedL(); // deletes the wait dialog
   414         }
   487         }
   415 
   488 
   416 
   489 
   417     if (aResult == KErrNone)
   490     if (aResult == KErrNone)
   418         {
   491         {
   420         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK );
   493         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK );
   421         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
   494         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
   422         note->ExecuteLD( *string );
   495         note->ExecuteLD( *string );
   423         CleanupStack::PopAndDestroy( string );
   496         CleanupStack::PopAndDestroy( string );
   424         }
   497         }
   425  
   498     /*** NSSM support is discontinued.
       
   499          Code is kept in comments temporarily because similar UI functionality
       
   500          might be needed for another purpose.
       
   501     else if (aResult == KAcuErrServerCertExpiredByPkiService)
       
   502         {
       
   503         //Show an information note
       
   504         HBufC* noteText;
       
   505         noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED );
       
   506         CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue);
       
   507         note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
       
   508         note->ExecuteLD(noteText->Des());
       
   509         CleanupStack::PopAndDestroy();  // noteText
       
   510         } ***/
   426     else if (aResult == KErrDiskFull)
   511     else if (aResult == KErrDiskFull)
   427     	{
   512     	{
   428     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
   513     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
   429         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
   514         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
   430         CleanupStack::PopAndDestroy();  // errorUi
   515         CleanupStack::PopAndDestroy();  // errorUi
   443         note->ExecuteLD(noteText->Des());
   528         note->ExecuteLD(noteText->Des());
   444         CleanupStack::PopAndDestroy();  // noteText
   529         CleanupStack::PopAndDestroy();  // noteText
   445         }
   530         }
   446 
   531 
   447     iParent.SetMiddleSoftKeyL(ETrue);
   532     iParent.SetMiddleSoftKeyL(ETrue);
   448 
   533     }
       
   534 
       
   535 void CVpnManagementUiServerContainer::NotifyStepChangedL(TInt /*aResult*/)
       
   536     {
       
   537     if (iShowWaitNote)
       
   538         {
       
   539         iLoader.ShowWaitNoteL();
       
   540         iShowWaitNote = EFalse;
       
   541         }
       
   542     if ( iLoader.iWaitDialog ) 
       
   543         {
       
   544         iLoader.SetTextL();
       
   545         }
   449     }
   546     }
   450 
   547 
   451 
   548 
   452 void CVpnManagementUiServerContainer::HandleListBoxEventL (CEikListBox* /*aListBox*/, 
   549 void CVpnManagementUiServerContainer::HandleListBoxEventL (CEikListBox* /*aListBox*/, 
   453                                                            TListBoxEvent aEventType)
   550                                                            TListBoxEvent aEventType)