wvuing/IMPSConnectionUI/OperationStepSrc/CCnUiAppExitLogoutUiCntrlStep.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Application exit logout UI control.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <E32std.h>
       
    20 #include <CIMPSSAPSettings.h>
       
    21 #include <CPEngNWSessionSlotID2.h>
       
    22 
       
    23 #include "CCnUiAppExitLogoutUiCntrlStep.h"
       
    24 #include "CCnUiConnCloser.h"
       
    25 
       
    26 #include "MCnUiUiControlContext.h"
       
    27 #include "MCnUiUiFacade.h"
       
    28 #include "MCnUiClientPlugin.h"
       
    29 #include "MCnUiSignaller.h"
       
    30 #include "MCnUiConnectionHandler.h"
       
    31 #include "MCnUiConnModeHandler.h"
       
    32 
       
    33 #include "CnUiErrors.h"
       
    34 
       
    35 
       
    36 
       
    37 // ================= MEMBER FUNCTIONS =======================
       
    38 // Two-phased constructor.
       
    39 CCnUiAppExitLogoutUiCntrlStep* CCnUiAppExitLogoutUiCntrlStep::NewLC(
       
    40     MCnUiUiControlContext& aCCntxt,
       
    41     CIMPSSAPSettings& aLogoutSap,
       
    42     TIMPSExitType aExitType,
       
    43     const CPEngNWSessionSlotID2& aNWSessionSlotID )
       
    44     {
       
    45     CCnUiAppExitLogoutUiCntrlStep* self = new ( ELeave ) CCnUiAppExitLogoutUiCntrlStep( aCCntxt,
       
    46             aLogoutSap,
       
    47             aExitType );
       
    48     CleanupStack::PushL( self );
       
    49     self->ConstructL( aNWSessionSlotID );
       
    50     return self;
       
    51     }
       
    52 
       
    53 
       
    54 // Destructor
       
    55 CCnUiAppExitLogoutUiCntrlStep::~CCnUiAppExitLogoutUiCntrlStep()
       
    56     {
       
    57     }
       
    58 
       
    59 // C++ default constructor can NOT contain any code, that
       
    60 // might leave.
       
    61 //
       
    62 CCnUiAppExitLogoutUiCntrlStep::CCnUiAppExitLogoutUiCntrlStep( MCnUiUiControlContext& aCCntxt,
       
    63                                                               CIMPSSAPSettings& aLogoutSap,
       
    64                                                               TIMPSExitType aExitType )
       
    65         : CCnUiLogoutUiCntrlStep( aCCntxt, aLogoutSap ),
       
    66         iExitType( aExitType )
       
    67     {
       
    68     }
       
    69 
       
    70 
       
    71 // Symbian OS default constructor can leave.
       
    72 void CCnUiAppExitLogoutUiCntrlStep::ConstructL( const CPEngNWSessionSlotID2& aNWSessionSlotID )
       
    73     {
       
    74     CCnUiLogoutUiCntrlStep::ConstructL( aNWSessionSlotID );
       
    75     }
       
    76 
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CCnUiAppExitLogoutUiCntrlStep::HandleCompleteL()
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TCnUiHandleCompleteStatus CCnUiAppExitLogoutUiCntrlStep::HandleCompleteL()
       
    83     {
       
    84     if ( iExitType == EIMPSNormalExit )
       
    85         {
       
    86         //Let the base class issue the connection restore if needed.
       
    87         return CCnUiLogoutUiCntrlStep::HandleCompleteL();
       
    88         }
       
    89 
       
    90     //in other cases the reconnection is not done
       
    91     return ECnUiStepContinueTeardown;
       
    92     }
       
    93 
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CCnUiAppExitLogoutUiCntrlStep::UndoStepL()
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CCnUiAppExitLogoutUiCntrlStep::UndoStepL()
       
   100     {
       
   101     //nothing to undo
       
   102     }
       
   103 
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CCnUiAppExitLogoutUiCntrlStep::DoInitLogoutStepL()
       
   107 // Template method
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TInt CCnUiAppExitLogoutUiCntrlStep::DoInitLogoutStepL( TIMPSConnectionClient& aClient )
       
   111     {
       
   112 
       
   113     const TIMPSConnectionClient clientId = iCCntxt.ControlledClient();
       
   114 
       
   115     //what is the current client current login mode??
       
   116     //if it is something different than manual, then logout isn't needed
       
   117     MCnUiClientPlugin& cPlugin = iCCntxt.ClientPluginL( clientId, *iNWSessionSlotID );
       
   118     if ( cPlugin.CurrentConnectionModeSettingL() != ECnUiCMManual )
       
   119         {
       
   120         return KErrNone;    //breaks away from RunStepL() with KErrNone
       
   121         }
       
   122 
       
   123 
       
   124     //Let first the base class to do its initializations & checks
       
   125     //base will initialize the aClient properly to current client if logout is really needed
       
   126     TInt baseInitStatus = CCnUiLogoutUiCntrlStep::DoInitLogoutStepL( aClient );
       
   127     if ( baseInitStatus != ECnUiLogoutInitContinue )
       
   128         {
       
   129         //base class init wants to break here
       
   130         //(there isn't no need for logout or it can't be issued)
       
   131         return baseInitStatus;
       
   132         }
       
   133 
       
   134 
       
   135 
       
   136     //Exit is needed
       
   137     //If this normal exit case, ask confirmation from user
       
   138     if ( iExitType == EIMPSNormalExit )
       
   139         {
       
   140         if ( !iCCntxt.Ui().ConfirmationQueryL( ECnUiCloseConnectionToNetwork ) )
       
   141             {
       
   142             //User declined the logout
       
   143             return KErrCancel;
       
   144             }
       
   145         }
       
   146 
       
   147     //In other cases the logout can be carried on.
       
   148     //Because the base class didn't wan't to break,
       
   149     //it initialized the contexts properly.
       
   150     return ECnUiLogoutInitContinue;
       
   151     }
       
   152 
       
   153 
       
   154 //  End of File