vpnui/vpnmanagementui/src/vpnmanagementuipolicycontainer.cpp
changeset 0 33413c0669b9
child 22 9f4e37332ce5
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Policy view container
       
    15 *
       
    16 */
       
    17 
       
    18 #include <eikclbd.h>
       
    19 #include <AknIconArray.h>
       
    20 #include <AknQueryDialog.h>
       
    21 #include <aknnotewrappers.h>
       
    22 #include <sysutil.h>
       
    23 #include <ErrorUI.h>
       
    24 #include <vpnmanagementuirsc.rsg>
       
    25 #include "vpnuiloader.h"
       
    26 #include "vpnmanagementuipolicycontainer.h"
       
    27 #include "vpnmanagementui.hrh"
       
    28 
       
    29 
       
    30 #ifdef __SERIES60_HELP
       
    31 #include <csxhelp/vpn.hlp.hrh> // for help context of VPN Management UI
       
    32 #endif //__SERIES60_HELP
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // CVpnManagementUiPolicyContainer::CVpnManagementUiPolicyContainer(
       
    38 // CVpnManagementUiPolicyView& aParent, CVpnUiLoader& aLoader)
       
    39 // Constructor with parent
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 CVpnManagementUiPolicyContainer::CVpnManagementUiPolicyContainer(
       
    43     CVpnManagementUiPolicyView& aParent, CVpnUiLoader& aLoader ) : 
       
    44     iParent ( aParent ), iLoader ( aLoader )
       
    45     {
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CVpnManagementUiPolicyContainer::~CVpnManagementUiPolicyContainer()
       
    50 // Destructor
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CVpnManagementUiPolicyContainer::~CVpnManagementUiPolicyContainer()
       
    54     {
       
    55 	delete iListBox;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CVpnManagementUiPolicyContainer::ConstructL(
       
    60 // const TRect& aRect, TInt& aCurrentPosition, TInt& aTopItem)
       
    61 // EPOC two phased constructor
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 void CVpnManagementUiPolicyContainer::ConstructL(
       
    65     const TRect& aRect, TInt& /*aCurrentPosition*/, TInt& /*aTopItem*/ )
       
    66     {
       
    67 	CreateWindowL();
       
    68     CreateListBoxL();
       
    69     
       
    70     //Initialization
       
    71     iShowWaitNote = EFalse;
       
    72     
       
    73     ShowPoliciesL();
       
    74 	SetRect( aRect );
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CVpnManagementUiPolicyContainer::ActivateL()
       
    79 // called after the dialog is shown
       
    80 // used to handle empty list - query
       
    81 // ---------------------------------------------------------
       
    82 //
       
    83 void CVpnManagementUiPolicyContainer::ActivateL()
       
    84     {
       
    85     CCoeControl::ActivateL();
       
    86     // put empty list checking & required actions here.
       
    87     /*** NSSM support is discontinued.
       
    88          Code is kept in comments temporarily because similar UI functionality
       
    89          might be needed for another purpose.
       
    90     if (!iLoader.iBackFromServerDefinition)
       
    91         {
       
    92         PoliciesListEmptyL();
       
    93         }
       
    94     if (iLoader.iNewServerDefinition)
       
    95         {//Synchronise server query
       
    96             HBufC* temp;
       
    97             temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER );
       
    98             CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
       
    99             TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
       
   100             CleanupStack::PopAndDestroy();  // temp
       
   101             if ( retval )
       
   102                 {
       
   103                 //Show wait dialog
       
   104                 //ShowWaitNoteL(); called now from NotifyStepChangedL
       
   105                 iShowWaitNote = ETrue;
       
   106                 // Get selection neme for connecting via note
       
   107                 // and save it to the member variable of iLoader
       
   108                 iLoader.GetSelectionNameL( iLoader.iSelectionName );
       
   109                 
       
   110                 //Save server index for Connecting via note
       
   111                 iLoader.iCurrentServerIndex = 0;
       
   112                 //Synchronise server
       
   113                 iLoader.AcuApiWrapperL().SynchroniseServerL(0,this);
       
   114    
       
   115                 //Set iNewServerDefinition to false, because 
       
   116                 //we are now synchronised server
       
   117                 iLoader.iNewServerDefinition = EFalse;
       
   118                 }
       
   119         } ***/
       
   120     }
       
   121 
       
   122 void CVpnManagementUiPolicyContainer::PoliciesListEmptyL()
       
   123     {
       
   124     if (iListItemCount == 0)
       
   125         {
       
   126         //Set iNewServerDefinition to false, because
       
   127         //we don't want to show note
       
   128         //"new server defined synchronise now"
       
   129         iLoader.iNewServerDefinition = EFalse;
       
   130         // no policies installed, confirmation query
       
   131         HBufC* temp;
       
   132         temp = StringLoader::LoadLC( R_VPN_QUEST_DL_POLICIES_NOW );
       
   133         CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
       
   134         TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
       
   135         CleanupStack::PopAndDestroy();  // temp
       
   136         if ( retval )
       
   137             { // start policy install procedure
       
   138             InstallPoliciesL();
       
   139             }
       
   140         }
       
   141     }
       
   142 
       
   143 void CVpnManagementUiPolicyContainer::InstallPoliciesL()
       
   144     {
       
   145     /*** NSSM support is discontinued.
       
   146          Code is kept in comments temporarily because similar UI functionality
       
   147          might be needed for another purpose.
       
   148     CArrayFix<TAcuApiServerListElem>* serverList = iLoader.AcuApiWrapperL().ServerListL();
       
   149     TInt serverCount = serverList->Count();
       
   150 
       
   151     //if policy servers defined show policy server list query
       
   152     if (serverCount > 0 )
       
   153         {
       
   154         TInt index = 0;
       
   155 	    CDesCArrayFlat *array = new(ELeave) CDesCArrayFlat(1);
       
   156 	    CleanupStack::PushL(array);
       
   157    
       
   158         for (TInt i = 0; i < serverCount; ++i)
       
   159             {
       
   160             TBuf<KAcuMaxServerNameLocalLth+2> serverName;
       
   161             serverName.Append(serverList->At(i).iServerNameLocal);
       
   162             array->AppendL(serverName);
       
   163             }
       
   164 	    CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog(&index);
       
   165 	    dlg->PrepareLC( R_LIST_QUERY );
       
   166 	    dlg->SetItemTextArray(array);
       
   167 	    dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
       
   168 
       
   169 	    TInt queryOk = dlg->RunLD();
       
   170         if(queryOk == EAknSoftkeyOk || queryOk == EAknSoftkeySelect)
       
   171             {
       
   172             TBool selectionExists = iLoader.SelectionExistsL( index );
       
   173             
       
   174             if( selectionExists )
       
   175                 {
       
   176                 //Save server index for Connecting via note
       
   177                 iLoader.iCurrentServerIndex = index;
       
   178                 //Show wait dialog 
       
   179                 iShowWaitNote = ETrue;
       
   180                 // Get selection neme for connecting via note
       
   181                 // and save it to the member variable of iLoader
       
   182                 iLoader.GetSelectionNameL( iLoader.iSelectionName );
       
   183                
       
   184                 iLoader.AcuApiWrapperL().SynchroniseServerL( index, this );
       
   185                 }
       
   186             }
       
   187         CleanupStack::PopAndDestroy(); // array
       
   188 
       
   189         }
       
   190     else
       
   191         { ***/
       
   192         //No policy servers defined show define new policy
       
   193         //server conrirmation query
       
   194         HBufC* temp;
       
   195         temp = StringLoader::LoadLC( R_VPN_QUEST_DEFINE_NEW_SERVER );
       
   196         CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
       
   197         TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
       
   198         CleanupStack::PopAndDestroy();  // temp
       
   199         if ( retval )
       
   200             {
       
   201             if (!SysUtil::FFSSpaceBelowCriticalLevelL(0, 0))
       
   202     	        {
       
   203 	            iLoader.iBackFromServerDefinition = ETrue;
       
   204 	            iLoader.ChangeViewL(KChangeViewSettings);
       
   205 	            }
       
   206 	        else
       
   207 		        {
       
   208 		    	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
       
   209 		        errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
       
   210 		        CleanupStack::PopAndDestroy();  // errorUi
       
   211 		        }
       
   212             }
       
   213         // }
       
   214     }
       
   215 
       
   216 void CVpnManagementUiPolicyContainer::SynchroniseServerL()
       
   217     {
       
   218 /*NOT USED ANYMORE
       
   219     //Conrirmation query
       
   220     HBufC* temp;
       
   221     temp = StringLoader::LoadLC( R_VPN_QUEST_SYNCHRONISE_SERVER );
       
   222     CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
       
   223     TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
       
   224     CleanupStack::PopAndDestroy();  // temp
       
   225     if ( retval )
       
   226         {
       
   227         TInt currentPosition = iListBox->CurrentItemIndex();
       
   228         iLoader.iAcuApiWrapper->SynchroniseServer(currentPosition, this);
       
   229         }
       
   230 */    
       
   231     }
       
   232 // ---------------------------------------------------------
       
   233 // CVpnManagementUiPolicyContainer::SizeChanged()
       
   234 // Called by framework when the view size is changed
       
   235 // ---------------------------------------------------------
       
   236 //
       
   237 void CVpnManagementUiPolicyContainer::SizeChanged()
       
   238     {
       
   239     iListBox->SetRect(Rect());
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CVpnManagementUiPolicyContainer::FocusChanged(TDrawNow aDrawNow)
       
   244 // ---------------------------------------------------------
       
   245 //
       
   246 void CVpnManagementUiPolicyContainer::FocusChanged(TDrawNow aDrawNow)
       
   247 	{
       
   248 	if ( iListBox ) 
       
   249 		{
       
   250 		iListBox->SetFocus( IsFocused(), aDrawNow );
       
   251 		}
       
   252 	}
       
   253 
       
   254 // ---------------------------------------------------------
       
   255 // CVpnManagementUiPolicyContainer::HandleResourceChangeL
       
   256 // ---------------------------------------------------------
       
   257 //
       
   258 
       
   259 void CVpnManagementUiPolicyContainer::HandleResourceChange( TInt aType )
       
   260     {
       
   261     CCoeControl::HandleResourceChange(aType); 
       
   262      
       
   263     //Handle change in layout orientation
       
   264     if (aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange )
       
   265         {
       
   266         iListBox->HandleResourceChange(aType);
       
   267         TRect mainPaneRect;
       
   268         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
       
   269         SetRect(mainPaneRect);
       
   270 		DrawNow();
       
   271 		}
       
   272     }    
       
   273     
       
   274 // ---------------------------------------------------------
       
   275 // CVpnManagementUiPolicyContainer::HandleListBoxEventL(
       
   276 // CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
       
   277 // ---------------------------------------------------------
       
   278 //
       
   279 void CVpnManagementUiPolicyContainer::HandleListBoxEventL(
       
   280     CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
       
   281 	{
       
   282     switch(aEventType)
       
   283         {
       
   284         case EEventEnterKeyPressed: 
       
   285         case EEventItemSingleClicked:
       
   286             iParent.HandleCommandL(EVpnUiCmdPolicyDetails);        
       
   287             break;
       
   288         default:  
       
   289             //Do nothing          
       
   290             break;
       
   291         }        
       
   292 	}
       
   293 enum { EListBoxControl, ENumberOfControls };
       
   294 
       
   295 // ---------------------------------------------------------
       
   296 // CVpnManagementUiPolicyContainer::CountComponentControls() const
       
   297 // ---------------------------------------------------------
       
   298 //
       
   299 TInt CVpnManagementUiPolicyContainer::CountComponentControls() const
       
   300     {
       
   301 	// return number of controls inside this container
       
   302     return ENumberOfControls; // return nbr of controls inside this container
       
   303     }
       
   304 
       
   305 // ---------------------------------------------------------
       
   306 // CVpnManagementUiPolicyContainer::ComponentControl(TInt aIndex) const
       
   307 // ---------------------------------------------------------
       
   308 //
       
   309 CCoeControl* CVpnManagementUiPolicyContainer::ComponentControl(TInt aIndex) const
       
   310     {
       
   311     switch ( aIndex )
       
   312         {
       
   313         case 0:
       
   314 			return iListBox;
       
   315         default:
       
   316             return NULL;
       
   317         }
       
   318     }
       
   319 
       
   320 // ---------------------------------------------------------
       
   321 // CVpnManagementUiPolicyContainer::HandleControlEventL(
       
   322 //    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
       
   323 // Cannot be changed to non-leaving function. 
       
   324 // L-function is required by the class definition, even if empty.
       
   325 // ---------------------------------------------------------
       
   326 //
       
   327 void CVpnManagementUiPolicyContainer::HandleControlEventL(
       
   328     CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
       
   329     {
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------
       
   333 // CVpnManagementUiPolicyContainer::OfferKeyEventL(
       
   334 // const TKeyEvent& aKeyEvent, TEventCode aType)
       
   335 // Handles the key events OK button, arrow keys, delete key.
       
   336 // OK button functionality is different depending on the number of marked items
       
   337 // in the list; zero marked -> show details view, one or more marked -> show
       
   338 // OKOptions list, list empty -> OK inactive.
       
   339 // Delete active only if list not empty.
       
   340 // ---------------------------------------------------------
       
   341 //
       
   342 TKeyResponse CVpnManagementUiPolicyContainer::OfferKeyEventL(
       
   343     const TKeyEvent& aKeyEvent, TEventCode aType)
       
   344 	{
       
   345 
       
   346     // If operation is currenly onway, do not continue.
       
   347 	TKeyResponse retval = EKeyWasNotConsumed;
       
   348 	if ( aType==EEventKey )
       
   349 		{
       
   350 		if ( (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) && // select or enter
       
   351             iListBox->CurrentItemIndex() > -1) //This is for empty list
       
   352             {
       
   353 	        // Selection key pressed.
       
   354             iParent.PolicyDetailsL(iListBox->CurrentItemIndex());
       
   355 
       
   356 			retval = EKeyWasConsumed;	
       
   357 			}
       
   358 
       
   359 		else if ( aKeyEvent.iCode == EKeyDelete 
       
   360                   || aKeyEvent.iCode == EKeyBackspace )
       
   361 			{
       
   362 			if ( iListBox->CurrentItemIndex() > -1 )
       
   363 				{
       
   364 				iParent.HandleCommandL( EVpnUiCmdDeletePolicy );
       
   365 				retval = EKeyWasConsumed; 
       
   366 				}
       
   367 			}
       
   368 		else
       
   369 			{
       
   370 			retval = iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   371 			}
       
   372 		}
       
   373 	else
       
   374 		{
       
   375 		retval = iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   376 		}
       
   377 
       
   378 
       
   379     return retval;
       
   380 	}
       
   381 
       
   382 // ---------------------------------------------------------
       
   383 // CVpnManagementUiPolicyContainer::CreateListBoxL()
       
   384 // Creates listbox, sets empty listbox text.
       
   385 // ---------------------------------------------------------
       
   386 //
       
   387 void CVpnManagementUiPolicyContainer::CreateListBoxL()
       
   388 	{
       
   389 
       
   390 	iListBox = new( ELeave ) CAknSingleStyleListBox;
       
   391 	iListBox->SetContainerWindowL( *this );
       
   392 	iListBox->ConstructL( this, EAknListBoxMarkableList ); 
       
   393 	iListBox->CreateScrollBarFrameL( ETrue );
       
   394 	iListBox->ScrollBarFrame()->
       
   395         SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto );
       
   396 	iListBox->SetListBoxObserver(this);
       
   397 
       
   398 	HBufC* stringHolder = StringLoader::LoadLC( R_VPN_POLICIES_EMPTY );
       
   399 	iListBox->View()->SetListEmptyTextL( *stringHolder );
       
   400 	CleanupStack::PopAndDestroy();  // stringHolder
       
   401 
       
   402 	}
       
   403 
       
   404 // ---------------------------------------------------------
       
   405 // CVpnManagementUiPolicyContainer::DrawListBoxL(TInt aCurrentPosition, TInt aTopItem)
       
   406 // Draws listbox, fetches graphic icons for markable list
       
   407 // ---------------------------------------------------------
       
   408 //
       
   409 void CVpnManagementUiPolicyContainer::DrawListBoxL( 
       
   410     TInt aCurrentPosition, TInt aTopItem )
       
   411 	{
       
   412 
       
   413 	if (aCurrentPosition >= 0)
       
   414 		{
       
   415 		iListBox->SetTopItemIndex( aTopItem );
       
   416 		iListBox->SetCurrentItemIndex( aCurrentPosition );
       
   417 		}
       
   418 	ActivateL();
       
   419 	DrawNow();
       
   420 	}
       
   421 
       
   422 // ---------------------------------------------------------
       
   423 // CVpnManagementUiPolicyContainer::UpdateListBoxL(TInt& aCurrentPosition)
       
   424 // Updates listbox after deletion, sets No VPN policies text 
       
   425 // if deleted policy was a last one.
       
   426 // ---------------------------------------------------------
       
   427 //
       
   428 void CVpnManagementUiPolicyContainer::UpdateListBoxL( TInt& aCurrentPosition )
       
   429 	{ 
       
   430 	MDesCArray* itemList = iListBox->Model()->ItemTextArray();
       
   431 	CDesCArray* itemArray = ( CDesCArray* )itemList;
       
   432 
       
   433     itemArray->Delete(aCurrentPosition);
       
   434     itemArray->Compress();
       
   435 
       
   436     iListBox->HandleItemRemovalL();
       
   437     if(aCurrentPosition > 0)
       
   438         {
       
   439         iListBox->SetCurrentItemIndexAndDraw(aCurrentPosition-1);
       
   440         }
       
   441     if(aCurrentPosition == 0 )
       
   442         {
       
   443         if (iListItemCount > 1 )
       
   444             {
       
   445             iListBox->SetCurrentItemIndexAndDraw(aCurrentPosition);
       
   446             }
       
   447         else
       
   448             {
       
   449             HBufC* stringHolder = StringLoader::LoadLC( R_VPN_POLICIES_EMPTY );
       
   450 	        iListBox->View()->SetListEmptyTextL( *stringHolder );
       
   451 	        CleanupStack::PopAndDestroy();  // stringHolder
       
   452             }
       
   453         }
       
   454     iListItemCount = iListItemCount -1;
       
   455     iParent.SetMiddleSoftKeyL(ETrue);
       
   456     DrawNow();
       
   457 	}
       
   458 
       
   459 void CVpnManagementUiPolicyContainer::ShowPoliciesL() 
       
   460     {
       
   461     CArrayFixFlat<TVpnPolicyInfo>* policyList = 
       
   462         iLoader.VpnApiWrapperL().PolicyListL();
       
   463 
       
   464    	CDesCArrayFlat* itemTextArray = 
       
   465    	    static_cast<CDesCArrayFlat*>(iListBox->Model()->ItemTextArray());
       
   466 
       
   467 	itemTextArray->Reset();
       
   468 	iListBox->Reset();
       
   469 
       
   470     iListItemCount = policyList->Count();
       
   471 
       
   472     for (TInt i = 0; i < iListItemCount; ++i)
       
   473         {
       
   474         TBuf<KMaxNameLength+2> policyName;
       
   475         policyName.Append(_L("\t"));
       
   476         policyName.Append(policyList->At(i).iName);
       
   477         itemTextArray->AppendL(policyName);
       
   478         }
       
   479 
       
   480 	iListBox->HandleItemAdditionL();
       
   481     }
       
   482 
       
   483 // ---------------------------------------------------------
       
   484 // CVpnManagementUiPolicyContainer:::UpdatePolicy
       
   485 // ---------------------------------------------------------
       
   486 //
       
   487 void CVpnManagementUiPolicyContainer::UpdatePolicyL(TVpnPolicyId /* aPolicyId */)
       
   488     {
       
   489     /*** NSSM support is discontinued.
       
   490              Code is kept in comments temporarily because similar UI functionality
       
   491              might be needed for another purpose.
       
   492     TBool selectionExists = iLoader.SelectionExistsL( 0 );
       
   493             
       
   494     if( selectionExists )
       
   495         {
       
   496         // Get selection name for connecting via note
       
   497         // and save it to the member variable of iLoader
       
   498         iLoader.GetSelectionNameL( iLoader.iSelectionName );
       
   499                
       
   500         iLoader.ShowWaitNoteL();
       
   501         TAcuContentId contentId;
       
   502         contentId.iContentId = aPolicyId;
       
   503         iLoader.AcuApiWrapperL().UpdatePolicyL( contentId, this );
       
   504         } ***/
       
   505     }
       
   506 
       
   507 
       
   508 void CVpnManagementUiPolicyContainer::NotifyUpdatePolicyCompleteL(
       
   509     TInt aResult)
       
   510     {
       
   511     if ( iLoader.iWaitDialog ) 
       
   512         {
       
   513         iLoader.DeleteWaitNoteL();//iWaitDialog->ProcessFinishedL(); // deletes the wait dialog
       
   514         }
       
   515 
       
   516     if (aResult == KErrNone)
       
   517         {
       
   518         //Confirmation note
       
   519         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_UPDATE_COMPLETE );
       
   520         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
       
   521         note->ExecuteLD( *string );
       
   522         CleanupStack::PopAndDestroy( string );
       
   523         }
       
   524     /*** NSSM support is discontinued.
       
   525          Code is kept in comments temporarily because similar UI functionality
       
   526          might be needed for another purpose.
       
   527     else if (aResult == KAcuErrServerCertExpiredByPkiService)
       
   528         {
       
   529         //Show an information note
       
   530         HBufC* noteText;
       
   531         noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED );
       
   532         CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue);
       
   533         note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
       
   534         note->ExecuteLD(noteText->Des());
       
   535         CleanupStack::PopAndDestroy();  // noteText
       
   536         } ***/
       
   537     else if (aResult == KErrDiskFull)
       
   538     	{
       
   539     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
       
   540         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
       
   541         CleanupStack::PopAndDestroy();  // errorUi
       
   542     	}    
       
   543     else if (aResult == KErrCancel)
       
   544         {
       
   545         // No operation, i.e. don't show anything
       
   546         }
       
   547     else
       
   548         {
       
   549         //Show an information note
       
   550         HBufC* noteText;
       
   551         noteText = StringLoader::LoadLC( R_VPN_INFO_POLICY_DL_ERROR );
       
   552         CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue);
       
   553         note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
       
   554         note->ExecuteLD(noteText->Des());
       
   555         CleanupStack::PopAndDestroy();  // noteText
       
   556         }
       
   557     }
       
   558 
       
   559 void CVpnManagementUiPolicyContainer::NotifySynchroniseServerCompleteL(TInt aResult)
       
   560     {
       
   561     //CloseWaitDialog();
       
   562 
       
   563     if ( iLoader.iWaitDialog ) 
       
   564         {
       
   565         iLoader.DeleteWaitNoteL();//iWaitDialog->ProcessFinishedL(); // deletes the wait dialog
       
   566         }
       
   567 
       
   568     if (aResult == KErrNone)
       
   569         {
       
   570         //Confirmation note
       
   571         HBufC* string = StringLoader::LoadLC( R_VPN_CONF_POLICY_SERVER_SYNC_OK );
       
   572         CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
       
   573         note->ExecuteLD( *string );
       
   574         CleanupStack::PopAndDestroy( string );
       
   575         }
       
   576     /*** NSSM support is discontinued.
       
   577          Code is kept in comments temporarily because similar UI functionality
       
   578          might be needed for another purpose.
       
   579     else if (aResult == KAcuErrServerCertExpiredByPkiService)
       
   580         {
       
   581         //Show an information note
       
   582         HBufC* noteText;
       
   583         noteText = StringLoader::LoadLC( R_VPN_INFO_SERVER_CERT_EXPIRED );
       
   584         CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue);
       
   585         note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
       
   586         note->ExecuteLD(noteText->Des());
       
   587         CleanupStack::PopAndDestroy();  // noteText
       
   588         } ***/
       
   589     else if (aResult == KErrDiskFull)
       
   590     	{
       
   591     	CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
       
   592         errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
       
   593         CleanupStack::PopAndDestroy();  // errorUi
       
   594     	}
       
   595     else if (aResult == KErrCancel)
       
   596         {
       
   597         // No operation, i.e. don't show anything
       
   598         }
       
   599     else
       
   600         {
       
   601         //Show an information note
       
   602         HBufC* noteText;
       
   603         noteText = StringLoader::LoadLC( R_VPN_INFO_POLICY_SERVER_SYNC_ERROR );
       
   604         CAknInformationNote* note = new(ELeave)CAknInformationNote(ETrue);
       
   605         note->SetTimeout(CAknNoteDialog::ELongTimeout); //3sec
       
   606         note->ExecuteLD(noteText->Des());
       
   607         CleanupStack::PopAndDestroy();  // noteText
       
   608         }
       
   609 
       
   610     ShowPoliciesL();
       
   611     iParent.SetMiddleSoftKeyL(ETrue);
       
   612     }
       
   613 
       
   614 
       
   615 void CVpnManagementUiPolicyContainer::NotifyStepChangedL(TInt /*aResult*/)
       
   616     {
       
   617     if (iShowWaitNote)
       
   618         {
       
   619         iLoader.ShowWaitNoteL();
       
   620         iShowWaitNote = EFalse;
       
   621         }
       
   622     if ( iLoader.iWaitDialog ) 
       
   623         {
       
   624         iLoader.SetTextL();
       
   625         }
       
   626     }
       
   627 
       
   628 // ---------------------------------------------------------
       
   629 // CVpnManagementUiPolicyContainer::GetHelpContext
       
   630 // This function is called when Help application is launched.  
       
   631 // (other items were commented in a header).
       
   632 // ---------------------------------------------------------
       
   633 //
       
   634 #ifdef __SERIES60_HELP
       
   635 void CVpnManagementUiPolicyContainer::GetHelpContext( 
       
   636     TCoeHelpContext& aContext ) const
       
   637     {
       
   638 	aContext.iMajor = KUidVpnManagementUi;
       
   639     aContext.iContext = KSET_HLP_VPN_POLICY_VIEW;
       
   640     }
       
   641 #endif //__SERIES60_HELP
       
   642 
       
   643 // End of File