coreapplicationuis/Rfs/src/rfsHandler.cpp
branchRCL_3
changeset 62 924385140d98
parent 0 2e3d3ce01487
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    37 #include <starterclient.h>
    37 #include <starterclient.h>
    38 #include <syslangutil.h>            // default language
    38 #include <syslangutil.h>            // default language
    39 
    39 
    40 #include <secui.h>                  // security UI
    40 #include <secui.h>                  // security UI
    41 #include <secuisecurityhandler.h>
    41 #include <secuisecurityhandler.h>
    42 
    42 #include <StringLoader.h>
    43 #include <aknnotewrappers.h>
       
    44 #include <AknQueryDialog.h>
       
    45 
       
    46 #include <hal.h>
    43 #include <hal.h>
    47 #include <centralrepository.h>
    44 #include <centralrepository.h>
    48 #include <CommonEngineDomainCRKeys.h>
    45 #include <CommonEngineDomainCRKeys.h>
    49 
    46 
    50 #include <data_caging_path_literals.hrh>
    47 #include <data_caging_path_literals.hrh>
    51 
    48 
    52 #include "CleanupResetPointer.h"
    49 #include "CleanupResetPointer.h"
    53 #include <AknWaitDialog.h>
       
    54 #include <pdpcontextmanagerpskeys.h>
    50 #include <pdpcontextmanagerpskeys.h>
    55 #include <pdpcontextmanagerinternalcrkeys.h>
    51 #include <pdpcontextmanagerinternalcrkeys.h>
    56 #include "rfsConnectionObserver.h"
    52 #include "rfsConnectionObserver.h"
    57 #include "rfsHandler.h"
    53 #include "rfsHandler.h"
    58 #include "rfsClient.h"
    54 #include "rfsClient.h"
    59 #include "RfsTraces.h"
    55 #include "RfsTraces.h"
       
    56 #include <hbdevicemessageboxsymbian.h>
    60 
    57 
    61 
    58 
    62 _LIT( KRfsResourceFileName, "Z:rfs.rsc");
    59 _LIT( KRfsResourceFileName, "Z:rfs.rsc");
       
    60 _LIT(KYes,"yes");
       
    61 _LIT(KNo,"No");
    63 
    62 
    64 // CONSTANTS
    63 // CONSTANTS
    65 const TInt KPhoneIndex = 0;
    64 const TInt KPhoneIndex = 0;
    66 const TInt KRfsHandlerActivated             = 0x0001;
    65 const TInt KRfsHandlerActivated             = 0x0001;
    67 const TInt KRfsHandlerPhoneModuleLoaded     = 0x0002;
    66 const TInt KRfsHandlerPhoneModuleLoaded     = 0x0002;
   185             }
   184             }
   186         RStarterSession startersession;
   185         RStarterSession startersession;
   187         if( startersession.Connect() == KErrNone )
   186         if( startersession.Connect() == KErrNone )
   188             {
   187             {
   189 			// Displays information note to the user telling that the device will restart
   188 			// Displays information note to the user telling that the device will restart
   190             HBufC* prompt = iEnv->AllocReadResourceLC( R_DEVICE_RESTART );
   189             HBufC* prompt = StringLoader::LoadLC( R_DEVICE_RESTART );
   191             CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
   190                  
   192             note->ExecuteLD( *prompt );
   191           CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
   193             CleanupStack::PopAndDestroy( prompt );
   192                 CleanupStack::PushL(note);
   194 			
   193                 note->SetTextL(*prompt);
       
   194                 //could have used show() but it is aynchronous and execution proceeds before note is seen so have used synchronous API exec()
       
   195                 note->ExecL();
       
   196                 CleanupStack::PopAndDestroy(note);
       
   197                 CleanupStack::PopAndDestroy( prompt );
       
   198                 	
       
   199                 	              
       
   200                
       
   201                 
   195             if (aType == ERfsNormal ) startersession.Reset( RStarterSession::ENormalRFSReset );
   202             if (aType == ERfsNormal ) startersession.Reset( RStarterSession::ENormalRFSReset );
   196             else if (aType == ERfsDeep ) startersession.Reset( RStarterSession::EDeepRFSReset );
   203             else if (aType == ERfsDeep ) startersession.Reset( RStarterSession::EDeepRFSReset );
   197             else startersession.Reset( RStarterSession::EUnknownReset );
   204             else startersession.Reset( RStarterSession::EUnknownReset );
   198             startersession.Close();
   205             startersession.Close();
   199             }
   206             }
   236 // CRfsHandler::Cancel()
   243 // CRfsHandler::Cancel()
   237 // -----------------------------------------------------------------------------
   244 // -----------------------------------------------------------------------------
   238 EXPORT_C void CRfsHandler::Cancel()
   245 EXPORT_C void CRfsHandler::Cancel()
   239     {
   246     {
   240     TRACES("CRfsHandler::Cancel()");
   247     TRACES("CRfsHandler::Cancel()");
   241 
   248     
   242     // delete confirmation query
   249      
   243     delete iQuery;
   250      // delete security handler
   244     iQuery = NULL;
       
   245 
       
   246     // delete security handler
       
   247     if ( iSecurityHandler )
   251     if ( iSecurityHandler )
   248         {
   252         {
   249         iSecurityHandler->CancelSecCodeQuery();
   253         iSecurityHandler->CancelSecCodeQuery();
   250 
   254 
   251         delete iSecurityHandler;
   255         delete iSecurityHandler;
   324 // CRfsHandler::AskConfirmationL()
   328 // CRfsHandler::AskConfirmationL()
   325 // -----------------------------------------------------------------------------
   329 // -----------------------------------------------------------------------------
   326 TBool CRfsHandler::AskConfirmationL( const TBool& aThisDestroyed, TRfsType aType )
   330 TBool CRfsHandler::AskConfirmationL( const TBool& aThisDestroyed, TRfsType aType )
   327     {
   331     {
   328     TRACES("CRfsHandler::AskConfirmationL()");
   332     TRACES("CRfsHandler::AskConfirmationL()");
   329     CleanupResetPointerPushL( iQuery );
   333      
   330 
   334    
   331     // Show the confirmation query.
       
   332 
       
   333     iQuery = CAknQueryDialog::NewL(); // no tone as default
       
   334 
       
   335     TInt resourceId = ( aType == ERfsNormal ) ? R_CONFIRM_RFS : R_CONFIRM_DEEP_RFS;
   335     TInt resourceId = ( aType == ERfsNormal ) ? R_CONFIRM_RFS : R_CONFIRM_DEEP_RFS;
   336     //iQuery->SetSize();
   336     HBufC* query = iEnv->AllocReadResourceLC( resourceId );
   337     //iQuery->pref
   337          
   338     
   338    // Show the confirmation query.
   339     TBool ret = iQuery->ExecuteLD( resourceId );
   339           
   340 
   340    CHbDeviceMessageBoxSymbian::TButtonId selection = CHbDeviceMessageBoxSymbian::QuestionL(*query, KYes, KNo);
   341     if ( aThisDestroyed )
   341     TBool ret;    
   342         {
   342     if (selection == CHbDeviceMessageBoxSymbian::EAcceptButton) // user pressed yes
   343         // this object was destroyed
   343         {
   344         ret = EFalse;
   344         ret=ETrue;
   345         // remove cleanup item
   345         }
   346         CleanupStack::Pop();
   346     else
   347         }
   347         {
   348     else
   348         ret=EFalse;
   349         {
   349         }  
   350         // NULLs iQuery
   350     CleanupStack::PopAndDestroy(query);
   351         CleanupStack::PopAndDestroy();
   351     return ret;  
   352         }
   352     
   353 
       
   354     return ret;
       
   355     }
   353     }
   356 
   354 
   357 // -----------------------------------------------------------------------------
   355 // -----------------------------------------------------------------------------
   358 // CRfsHandler::DoCleanup()
   356 // CRfsHandler::DoCleanup()
   359 // -----------------------------------------------------------------------------
   357 // -----------------------------------------------------------------------------
   439         ( wlanState == EPSWlanIndicatorActive || wlanState == EPSWlanIndicatorActiveSecure ))
   437         ( wlanState == EPSWlanIndicatorActive || wlanState == EPSWlanIndicatorActiveSecure ))
   440 #endif //__WINS__
   438 #endif //__WINS__
   441         {
   439         {
   442         HBufC* prompt = iEnv->AllocReadResourceLC( R_ACTIVE_CALLS );
   440         HBufC* prompt = iEnv->AllocReadResourceLC( R_ACTIVE_CALLS );
   443 
   441 
   444         CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
   442            CHbDeviceMessageBoxSymbian* note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
   445 
   443                 CleanupStack::PushL(note);
   446         note->ExecuteLD( *prompt );
   444                         note->SetTextL(*prompt);
   447 
   445                         note->ShowL();
   448         CleanupStack::PopAndDestroy( prompt );
   446                          CleanupStack::PopAndDestroy( note );
       
   447                         CleanupStack::PopAndDestroy( prompt );
       
   448                
   449         return ETrue;
   449         return ETrue;
   450         }
   450         }
   451 
   451 
   452     return EFalse;
   452     return EFalse;
   453 	}
   453 	}