email/imum/Utils/Src/IMSWizardLauncher.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 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: 
       
    15 *       Class implementation file
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "IMSWizardLauncher.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CIMSWizardLauncher::CIMSWizardLauncher( CIMSSettingsWizard& aWizard,
       
    31 										CIMSSettingsUi& aSettingsUi,
       
    32 										TInt aPriority )
       
    33     : CActive( aPriority ),
       
    34       iWizard( aWizard ),
       
    35       iSettingsUi ( aSettingsUi )
       
    36     {
       
    37     CActiveScheduler::Add( this );
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CIMSWizardLauncher* CIMSWizardLauncher::NewL(
       
    45     CIMSSettingsWizard& aWizard,
       
    46     CIMSSettingsUi& aSettingsUi
       
    47      )
       
    48     {
       
    49     CIMSWizardLauncher* self =
       
    50         new ( ELeave ) CIMSWizardLauncher( aWizard, aSettingsUi );
       
    51     CleanupStack::PushL( self );
       
    52     self->StartLauncher();
       
    53     CleanupStack::Pop( self );
       
    54 
       
    55     return self;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CIMSWizardLauncher::~CIMSWizardLauncher()
       
    63     {
       
    64     if ( IsActive() )
       
    65         {
       
    66         Cancel();
       
    67         }
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // Starts active object and completes the request to make activescheduler to call
       
    72 // the RunL-function immediately
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CIMSWizardLauncher::StartLauncher()
       
    76     {
       
    77     iWizard.WizRunStart();
       
    78 
       
    79     iStatus = KRequestPending;
       
    80     TRequestStatus* status = &iStatus;
       
    81     User::RequestComplete( status, KErrNone );
       
    82     SetActive();
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // From class CActive.
       
    87 // Not needed
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CIMSWizardLauncher::DoCancel()
       
    91     {
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // From class CActive.
       
    96 // Starts the email wizard to skip the info screen in the beginning
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CIMSWizardLauncher::RunL()
       
   100     {
       
   101     TBool stepsLeft = iWizard.WizRunStepL();
       
   102 
       
   103     if( stepsLeft )
       
   104     	{
       
   105         iStatus = KRequestPending;
       
   106         TRequestStatus* status = &iStatus;
       
   107         User::RequestComplete(status, KErrNone);
       
   108         SetActive();
       
   109     	}
       
   110     else
       
   111     	{
       
   112 	    iSettingsUi.DoQuitL();
       
   113 		}
       
   114     }
       
   115 
       
   116 //End of file