vpnui/vpnmanagementui/src/vpnmanagementuiservercontainer.cpp
branchRCL_3
changeset 38 9f4e37332ce5
parent 0 33413c0669b9
equal deleted inserted replaced
32:352850cbed81 38:9f4e37332ce5
    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     iShowWaitNote = EFalse;
    76 
    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);
       
   139    
   115    
   140                 //Set iNewServerDefinition to false, because 
       
   141                 //we are now synchronised server
       
   142                 iLoader.iNewServerDefinition = EFalse;
       
   143                 }
       
   144         } ***/
       
   145     }
   116     }
   146 
   117 
   147 
   118 
   148 // ---------------------------------------------------------
   119 // ---------------------------------------------------------
   149 // CVpnManagementUiServerContainer::SizeChanged()
   120 // CVpnManagementUiServerContainer::SizeChanged()
   301     if (aCurrentPosition >= 0)
   272     if (aCurrentPosition >= 0)
   302 		{
   273 		{
   303 		iListBox->SetTopItemIndex( aTopItem );
   274 		iListBox->SetTopItemIndex( aTopItem );
   304 		iListBox->SetCurrentItemIndex( aCurrentPosition );
   275 		iListBox->SetCurrentItemIndex( aCurrentPosition );
   305 		}
   276 		}
   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         } ***/
       
   313     
   277     
   314 	ActivateL();
   278 	ActivateL();
   315 	DrawNow();
   279 	DrawNow();
   316 	}
   280 	}
   317 
   281 
   352 	}
   316 	}
   353 
   317 
   354 
   318 
   355 void CVpnManagementUiServerContainer::ShowServersL() 
   319 void CVpnManagementUiServerContainer::ShowServersL() 
   356     {
   320     {
   357     /*** NSSM support is discontinued.
   321   
   358          Code is kept in comments temporarily because similar UI functionality
   322     TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
   359          might be needed for another purpose.
       
   360     CArrayFix<TAcuApiServerListElem>* serverList = iLoader.AcuApiWrapperL().ServerListL();
       
   361 
   323 
   362    	CDesCArrayFlat* itemTextArray = static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
   324    	CDesCArrayFlat* itemTextArray = static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
   363 
   325 
   364 	itemTextArray->Reset();
   326 	itemTextArray->Reset();
   365 	iListBox->Reset();
   327 	iListBox->Reset();
   366 
   328 
   367     iListItemCount = serverList->Count();
   329     if ( serverList.iServerUrl.Length()>0 )
   368 
   330        {
   369     for (TInt i = 0; i < iListItemCount; ++i)
   331         iListItemCount = 1;
   370         {
   332         TBuf<KMaxProvisionServerNameLength+2> serverName;
   371         TBuf<KAcuMaxServerNameLocalLth+2> serverName;
       
   372         serverName.Append(_L("\t"));
   333         serverName.Append(_L("\t"));
   373         serverName.Append(serverList->At(i).iServerNameLocal);
   334         serverName.Append(serverList.iServerNameLocal);
   374         itemTextArray->AppendL(serverName);
   335         itemTextArray->AppendL(serverName);
   375        }
   336        }
   376 
   337 
   377 
       
   378 	iListBox->HandleItemAdditionL();
   338 	iListBox->HandleItemAdditionL();
   379 	***/
   339 	
   380     }
   340     }
   381 
   341 
   382 
   342 
   383 void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */)
   343 void CVpnManagementUiServerContainer::DeleteServerL(TInt /* aIndex */)
   384     {
   344     {
   385   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n")));
   345   	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::DeleteServerL\n")));
   386 
   346   
   387     /*** NSSM support is discontinued.
   347   	TAgileProvisionApiServerListElem& serverList = iLoader.VpnApiWrapperL().ServerListL();
   388          Code is kept in comments temporarily because similar UI functionality
   348   	TBuf<KMaxProvisionServerNameLength> serverName;
   389          might be needed for another purpose.
   349   	serverName.Append(serverList.iServerNameLocal);
   390 
   350 
   391     TBuf<KAcuMaxServerNameLocalLth> serverName;
   351   	HBufC* temp = StringLoader::LoadLC( R_VPN_QUEST_DELETE_SERVER, serverName );
   392     serverName.Append(
   352     
   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 
       
   418     CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   353     CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
   419     TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
   354     TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
   420     CleanupStack::PopAndDestroy();  // temp
   355     CleanupStack::PopAndDestroy();  // temp
   421     if ( retval )
   356     if ( retval )
   422         {
   357         {
   423         TInt ret = iLoader.AcuApiWrapperL().DeleteServer(aIndex);
   358         TInt ret = iLoader.VpnApiWrapperL().DeleteServer();
       
   359         TInt ind = 0;
   424         if(ret == KErrNone)
   360         if(ret == KErrNone)
   425             {
   361             {
   426             //Update listbox
   362             //Update listbox
   427             UpdateListBoxL( aIndex );
   363             UpdateListBoxL( ind );
       
   364             
   428             //Update iServerList
   365             //Update iServerList
   429             iLoader.AcuApiWrapperL().ServerListL();
   366             iLoader.VpnApiWrapperL().ServerListL();
   430             
   367             
   431             //Set iNewServerDefinition to false
   368             //Set iNewServerDefinition to false
   432             iLoader.iNewServerDefinition = EFalse;
   369             iLoader.iNewServerDefinition = EFalse;
   433             }
   370             }
   434         else if (ret == KErrServerBusy)
   371         else if (ret == KErrServerBusy)
   440             note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
   377             note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
   441             note->ExecuteLD(noteText->Des());
   378             note->ExecuteLD(noteText->Des());
   442             CleanupStack::PopAndDestroy();  // noteText
   379             CleanupStack::PopAndDestroy();  // noteText
   443             }
   380             }
   444         }
   381         }
   445     ***/
   382   
   446     }
   383     }
   447 
   384 
   448 void CVpnManagementUiServerContainer::SynchroniseServerL(TInt /* aIndex */)
   385 void CVpnManagementUiServerContainer::SynchroniseServerL()
   449     {
   386     {
   450   	LOG_("CVpnManagementUiServerContainer::SynchroniseServerL");
   387   	LOG_("CVpnManagementUiServerContainer::SynchroniseServerL");
   451 
   388 
   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;
       
   461         // Get selection name for connecting via note
   389         // Get selection name for connecting via note
   462         // and save it to the member variable of iLoader
   390         // and save it to the member variable of iLoader
   463         iLoader.GetSelectionNameL( iLoader.iSelectionName );
   391         iLoader.GetSelectionNameL( iLoader.iSelectionName );
   464         //Show wait dialog 
   392         //Show wait dialog 
   465         iLoader.ShowWaitNoteL();
   393         iLoader.ShowWaitNoteL();
   466 
   394 
   467         iLoader.AcuApiWrapperL().SynchroniseServerL( aIndex,this );
   395         iLoader.VpnApiWrapperL().SynchroniseServerL( this );
       
   396         
       
   397         
   468         //Set iNewServerDefinition to false, because when
   398         //Set iNewServerDefinition to false, because when
   469         //we go to the policy view we don't want to show note
   399         //we go to the policy view we don't want to show note
   470         //"new server defined synchronise now"
   400         //"new server defined synchronise now"
   471         iLoader.iNewServerDefinition = EFalse;
   401         iLoader.iNewServerDefinition = EFalse;
   472         } ***/
   402 
   473     }
   403     }
   474 
   404 
   475 
   405 
   476 void CVpnManagementUiServerContainer::NotifyUpdatePolicyCompleteL(TInt /*aResult*/)
       
   477     {
       
   478     }
       
   479 
   406 
   480 void CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL(TInt aResult)
   407 void CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL(TInt aResult)
   481     {
   408     {
   482    	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL - Result %d\n"), aResult));
   409    	LOG(Log::Printf(_L("CVpnManagementUiServerContainer::NotifySynchroniseServerCompleteL - Result %d\n"), aResult));
   483 
   410 
   484     if ( iLoader.iWaitDialog ) 
   411     if ( iLoader.iWaitDialog ) 
   485         {
   412         {
   486         iLoader.DeleteWaitNoteL();//->iWaitDialog->ProcessFinishedL(); // deletes the wait dialog
   413         iLoader.DeleteWaitNoteL();//// deletes the wait dialog
   487         }
   414         }
   488 
   415 
   489 
   416 
   490     if (aResult == KErrNone)
   417     if (aResult == KErrNone)
   491         {
   418         {
   493         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK );
   420         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK );
   494         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
   421         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
   495         note->ExecuteLD( *string );
   422         note->ExecuteLD( *string );
   496         CleanupStack::PopAndDestroy( string );
   423         CleanupStack::PopAndDestroy( string );
   497         }
   424         }
   498     /*** NSSM support is discontinued.
   425  
   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         } ***/
       
   511     else if (aResult == KErrDiskFull)
   426     else if (aResult == KErrDiskFull)
   512     	{
   427     	{
   513     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
   428     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
   514         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
   429         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
   515         CleanupStack::PopAndDestroy();  // errorUi
   430         CleanupStack::PopAndDestroy();  // errorUi
   528         note->ExecuteLD(noteText->Des());
   443         note->ExecuteLD(noteText->Des());
   529         CleanupStack::PopAndDestroy();  // noteText
   444         CleanupStack::PopAndDestroy();  // noteText
   530         }
   445         }
   531 
   446 
   532     iParent.SetMiddleSoftKeyL(ETrue);
   447     iParent.SetMiddleSoftKeyL(ETrue);
   533     }
   448 
   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         }
       
   546     }
   449     }
   547 
   450 
   548 
   451 
   549 void CVpnManagementUiServerContainer::HandleListBoxEventL (CEikListBox* /*aListBox*/, 
   452 void CVpnManagementUiServerContainer::HandleListBoxEventL (CEikListBox* /*aListBox*/, 
   550                                                            TListBoxEvent aEventType)
   453                                                            TListBoxEvent aEventType)