startupservices/Startup/src/StartupAppUi.cpp
branchRCL_3
changeset 20 c2c61fdca848
parent 19 924385140d98
equal deleted inserted replaced
19:924385140d98 20:c2c61fdca848
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2008 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".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // SYSTEM INCLUDES
    19 // SYSTEM INCLUDES
    20 #include <StringLoader.h>
    20 #include <StringLoader.h>
    21 
    21 #include <AknGlobalNote.h>          //used for Selftest failed note
       
    22 #include <aknPopup.h>
       
    23 #include <aknlists.h>
       
    24 #include <aknSDData.h>
       
    25 #include <badesca.h>
       
    26 #include <tzlocalizationdatatypes.h>
       
    27 #include <tzlocalizer.h>
       
    28 #include <tz.h>
    22 #include <featmgr.h>                // Feature Manager
    29 #include <featmgr.h>                // Feature Manager
    23 #include <centralrepository.h>
    30 #include <centralrepository.h>
    24 #include <startup.rsg>
    31 #include <startup.rsg>
    25 #include <starterdomaincrkeys.h>
    32 #include <starterdomaincrkeys.h>
    26 #include "startupappprivatepskeys.h"
    33 #include "startupappprivatepskeys.h"
    27 #include <startupdomainpskeys.h>
    34 #include <startupdomainpskeys.h>
    28 #include <startupdomaincrkeys.h>
    35 #include <startupdomaincrkeys.h>
    29 #include <CoreApplicationUIsSDKCRKeys.h>
    36 #include <CoreApplicationUIsSDKCRKeys.h>
    30 #include <starterclient.h>
    37 #include <starterclient.h>
    31 #include <hbdevicemessageboxsymbian.h>
    38 #include "StartupWelcomeCrKeys.h"
    32 #include "sanimstartupctrl.h"
    39 
    33 #include <apgtask.h>
    40 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
       
    41 // Transition effects
       
    42 #include <gfxtranseffect/gfxtranseffect.h>
       
    43 #include <akntranseffect.h>
       
    44 #endif
       
    45 
       
    46 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    47   #include "sanimstartupctrl.h"
       
    48 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    49   #include <akndef.h>                 // For layout change event definitions
       
    50   #include <AknSoundSystem.h>
       
    51 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    34 
    52 
    35 // USER INCLUDES
    53 // USER INCLUDES
    36 #include "StartupAppUi.h"
    54 #include "StartupAppUi.h"
    37 #include "StartupApplication.h"
    55 #include "StartupApplication.h"
    38 
    56 #include "StartupUserWelcomeNote.h"
       
    57 #include "StartupQueryDialog.h"     //used for Startup own Time and Date queries
       
    58 #include "StartupPopupList.h"       //used for Startup own City and Country queries
       
    59 #include "StartupMediatorObserver.h"
    39 #include "StartupPubSubObserver.h"
    60 #include "StartupPubSubObserver.h"
    40 #include "startupanimationwrapper.h"
    61 
    41 #include "startupview.h"
    62 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
    42   
    63   #include "startupanimationwrapper.h"
    43 #include <eikenv.h>
    64   #include "startupview.h"
    44 
    65 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
    45 
    66   #include "StartupDocument.h"
       
    67   #include "StartupOperatorAnimation.h"
       
    68   #include "StartupTone.h"
       
    69   #include "StartupWelcomeAnimation.h"
       
    70 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    71 
       
    72 
       
    73 // CONSTANTS
       
    74 const TInt KUserWelcomeNoteShowPeriodTime = 3000000; // 3 sec
       
    75 
       
    76 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    77   const TInt KOneMilliSecondInMicroSeconds = 1000;
       
    78   const TInt KMaxToneInitWait = 200; // 200 ms
       
    79 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    80 
       
    81 static const TInt KMaxCityLength(120);
       
    82 static const TInt KMaxCountryLength(120);
       
    83 
       
    84 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
    46 static const CSAnimStartupCtrl::TAnimationParams KStartupAnimationParams =
    85 static const CSAnimStartupCtrl::TAnimationParams KStartupAnimationParams =
    47     {
    86     {
    48     KCRUidStartupConf,
    87     KCRUidStartupConf,
    49     KStartupAnimationPath,
    88     KStartupAnimationPath,
    50     KStartupAnimationFrameDelay,
    89     KStartupAnimationFrameDelay,
    51     KStartupAnimationScaling,
    90     KStartupAnimationScaling,
    52     KStartupTonePath,
    91     KStartupTonePath,
    53     KStartupToneVolume
    92     KStartupToneVolume
    54     };
    93     };
    55 
    94 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
    95 
       
    96 _LIT(KEmpty, " ");
       
    97 
       
    98 // Default date and time value is used if cenrep string is not valid
       
    99 // Default date is 01.01.2007 and default time is 09:00 AM
       
   100 _LIT( KDefaultDateTimeValue, "20070000:090000" ); // YYYYMMDD:HHMMSS
       
   101 
       
   102 static const TInt KTimeFormatLength(16); // "20070000:090000."
    56 
   103 
    57 _LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData);
   104 _LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData);
    58 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
   105 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
    59 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
   106 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
    60 
   107 
    61 // ======== LOCAL FUNCTIONS ==================================================
   108 // ======== LOCAL FUNCTIONS ==================================================
    62 
   109 
       
   110 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
    63 namespace
   111 namespace
    64     {
   112     {
    65     TInt AnimationFinishedFunc( TAny* aPtr )
   113     TInt AnimationFinishedFunc( TAny* aPtr )
    66         {
   114         {
    67         static_cast<CStartupAppUi*>( aPtr )->AnimationFinished();
   115         static_cast<CStartupAppUi*>( aPtr )->AnimationFinished();
    68         return KErrNone;
   116         return KErrNone;
    69         }
   117         }
    70     }
   118     }
    71 
   119 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    72 
   120 
    73 
   121 
    74 // ================= MEMBER FUNCTIONS ========================================
   122 // ================= MEMBER FUNCTIONS ========================================
    75 //
   123 //
    76 // ---------------------------------------------------------------------------
   124 // ---------------------------------------------------------------------------
    77 // CStartupAppUi::CStartupAppUi()
   125 // CStartupAppUi::CStartupAppUi()
    78 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
    79 CStartupAppUi::CStartupAppUi() :
   127 CStartupAppUi::CStartupAppUi() :
    80    iInternalState( EStartupStartingUp ),
   128     iUserWelcomeNote( NULL ),
    81 
   129 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   130     iStartupTone( NULL ),
       
   131     iOpStartupTone( NULL ),
       
   132     iToneInitWaitTime( 0 ),
       
   133     iAnimation( EFalse ),
       
   134 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   135     iInternalState( EStartupStartingUp ),
       
   136 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   137     iSplashScreenShouldBeRemoved( EFalse ),
       
   138 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    82     iStartupFirstBootAndRTCCheckAlreadyCalled( EFalse ),
   139     iStartupFirstBootAndRTCCheckAlreadyCalled( EFalse ),
    83     iChargingOrAlarmBoot( EFalse ),
   140     iChargingOrAlarmBoot( EFalse ),
    84     iFirstBoot( ETrue ),
   141     iFirstBoot( ETrue ),
    85     iCleanBoot( EStartupNormalBoot ),
   142     iCleanBoot( EStartupNormalBoot ),
    86     iOfflineModeSupported( EFalse ),
   143     iOfflineModeSupported( EFalse ),
    87     iOfflineModeQueryShown( EFalse ),
   144     iOfflineModeQueryShown( EFalse ),
    88     iCriticalBlockEnded( EFalse ),
   145     iCriticalBlockEnded( EFalse ),
    89     iSwStateFatalStartupError( EFalse ),
   146     iSwStateFatalStartupError( EFalse ),
    90     iStartupWaitingShowStartupAnimation( EFalse ),
   147     iStartupWaitingShowStartupAnimation( EFalse ),
    91     iSimSupported( ETrue )
   148     iSimSupported( ETrue ),
    92 
   149     iStartupMediatorObserver( NULL ),
       
   150     iCoverUISupported( EFalse ),
       
   151     iCounryListIndex( 0 )
       
   152     , iTime( 0 )
       
   153 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   154     , iTouchScreenCalibSupport( EFalse )
       
   155     , iTouchScreenCalibrationDone( EFalse )
       
   156 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    93     {
   157     {
    94     TRACES("CStartupAppUi::CStartupAppUi");
   158     TRACES("CStartupAppUi::CStartupAppUi");
    95     }
   159     }
    96 
   160 
    97 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
    98 // CStartupAppUi::ConstructL()
   162 // CStartupAppUi::ConstructL()
    99 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
   100 void CStartupAppUi::ConstructL()
   164 void CStartupAppUi::ConstructL()
   101     {
   165     {
   102     RThread thread; //increase the thread priority to smooth the animation
       
   103     thread.SetPriority(EPriorityAbsoluteForeground);
       
   104     thread.Close();
       
   105     TRACES("CStartupAppUi::ConstructL()");
   166     TRACES("CStartupAppUi::ConstructL()");
   106     TInt flags = EStandardApp;
   167     TInt flags = EStandardApp|EAknEnableSkin|EAknEnableMSK ;
   107    BaseConstructL( flags );
   168 
   108         
   169     BaseConstructL(flags);
       
   170 
       
   171     iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort |
       
   172                                    CAknAppUiBase::EDisableSendKeyLong );
       
   173 
       
   174 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   109     iMainView = CStartupView::NewL( ApplicationRect() );
   175     iMainView = CStartupView::NewL( ApplicationRect() );
   110     
       
   111    
       
   112     iAnimation = CStartupAnimationWrapper::NewL( *iMainView );
   176     iAnimation = CStartupAnimationWrapper::NewL( *iMainView );
   113 
   177 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   114 
   178 
   115     TInt err = RProperty::Define( KPSUidStartupApp,
   179     TInt err = RProperty::Define( KPSUidStartupApp,
   116                                   KPSStartupAppState,
   180                                   KPSStartupAppState,
   117                                   RProperty::EInt,
   181                                   RProperty::EInt,
   118                                   KReadDeviceDataPolicy,
   182                                   KReadDeviceDataPolicy,
   133         TRACES1("CStartupAppUi::ConstructL(): KPSStartupAppState set err %d", err);
   197         TRACES1("CStartupAppUi::ConstructL(): KPSStartupAppState set err %d", err);
   134         }
   198         }
   135 
   199 
   136     iStartupPubSubObserver = CStartupPubSubObserver::NewL( this );
   200     iStartupPubSubObserver = CStartupPubSubObserver::NewL( this );
   137 
   201 
   138 
   202 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   139 
   203     err = RProperty::Define( KPSUidStartup,
   140 
   204                              KStartupBootIntoOffline,
       
   205                              RProperty::EInt,
       
   206                              KReadDeviceDataPolicy,
       
   207                              KWriteDeviceDataPolicy );
       
   208 
       
   209     if( KErrNone != err &&
       
   210         KErrAlreadyExists != err )
       
   211         {
       
   212         TRACES1("CStartupAppUi::ConstructL(): KStartupBootIntoOffline define err %d", err);
       
   213         }
       
   214 
       
   215     err = RProperty::Define( KPSUidStartup,
       
   216                              KStartupSecurityCodeQueryStatus,
       
   217                              RProperty::EInt,
       
   218                              KReadDeviceDataPolicy,
       
   219                              KWriteDeviceDataPolicy );
       
   220     if( KErrNone != err &&
       
   221         KErrAlreadyExists != err )
       
   222         {
       
   223         TRACES1("CStartupAppUi::ConstructL(): KStartupSecurityCodeQueryStatus define err %d", err);
       
   224         }
       
   225     err = RProperty::Define( KPSUidStartup,
       
   226                              KStartupCleanBoot,
       
   227                              RProperty::EInt,
       
   228                              KReadDeviceDataPolicy,
       
   229                              KWriteDeviceDataPolicy );
       
   230     if( KErrNone != err &&
       
   231         KErrAlreadyExists != err )
       
   232         {
       
   233         TRACES1("CStartupAppUi::ConstructL(): KStartupCleanBoot define err %d", err);
       
   234         }
       
   235 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   236 
       
   237 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   141     err = RProperty::Define( KPSUidStartup,
   238     err = RProperty::Define( KPSUidStartup,
   142                              KPSStartupUiPhase,
   239                              KPSStartupUiPhase,
   143                              RProperty::EInt, 
   240                              RProperty::EInt, 
   144                              KAlwaysPassPolicy,
   241                              KAlwaysPassPolicy,
   145                              KWriteDeviceDataPolicy );
   242                              KWriteDeviceDataPolicy );
   149         {
   246         {
   150         TRACES1("CStartupAppUi::ConstructL(): KPSStartupUiPhase define err %d", err);       
   247         TRACES1("CStartupAppUi::ConstructL(): KPSStartupUiPhase define err %d", err);       
   151         }
   248         }
   152     
   249     
   153     UpdateStartupUiPhase( EStartupUiPhaseUninitialized );
   250     UpdateStartupUiPhase( EStartupUiPhaseUninitialized );
   154 
   251 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   155 
   252 
   156     FeatureManager::InitializeLibL();
   253     FeatureManager::InitializeLibL();
   157     if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
   254     if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
   158         {
   255         {
   159         iOfflineModeSupported = ETrue;
   256         iOfflineModeSupported = ETrue;
   160         }
   257         }
   161     if ( !FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   258     if ( !FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   162         {
   259         {
   163         iSimSupported = EFalse;
   260         iSimSupported = EFalse;
   164         }
   261         }
   165     
   262     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
       
   263         {
       
   264         iCoverUISupported = ETrue;
       
   265         }
   166 
   266 
   167     TRACES1("CStartupAppUi::ConstructL(): Offline mode supported: %d", iOfflineModeSupported );
   267     TRACES1("CStartupAppUi::ConstructL(): Offline mode supported: %d", iOfflineModeSupported );
   168     TRACES1("CStartupAppUi::ConstructL(): SIM card supported:     %d", iSimSupported );
   268     TRACES1("CStartupAppUi::ConstructL(): SIM card supported:     %d", iSimSupported );
   169     
   269     TRACES1("CStartupAppUi::ConstructL(): CoverUI supported:      %d", iCoverUISupported );
       
   270 
       
   271 #if defined (RD_SCALABLE_UI_V2) && !defined(RD_STARTUP_ANIMATION_CUSTOMIZATION)
       
   272     if ( FeatureManager::FeatureSupported(KFeatureIdPenSupport) &&
       
   273          FeatureManager::FeatureSupported(KFeatureIdPenSupportCalibration) )
       
   274         {
       
   275         iTouchScreenCalibSupport = ETrue;
       
   276         }
       
   277 #endif // RD_SCALABLE_UI_V2 && !RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   278 
       
   279     if (iCoverUISupported)
       
   280         {
       
   281         iStartupMediatorObserver = CStartupMediatorObserver::NewL( this );
       
   282         }
   170 
   283 
   171     iFirstBoot = FirstBoot();
   284     iFirstBoot = FirstBoot();
   172     TRACES1("CStartupAppUi::ConstructL(): First boot:             %d", iFirstBoot );
   285     TRACES1("CStartupAppUi::ConstructL(): First boot:             %d", iFirstBoot );
   173 
   286 
   174 
   287 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   175     CEikonEnv* eikEnv = CEikonEnv::Static();
   288     iWelcomeAnimation = CStartupWelcomeAnimation::NewL( this, ClientRect());
       
   289     AddToStackL( iWelcomeAnimation );
       
   290 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   176 
   291 
   177     // Set Startup application to be system application
   292     // Set Startup application to be system application
   178     eikEnv->SetSystem( ETrue );
   293     iEikonEnv->SetSystem( ETrue );
   179 
   294 
   180     eikEnv->RootWin().SetOrdinalPosition(0,0);
   295     iEikonEnv->RootWin().SetOrdinalPosition(0,0);
   181 
   296 
   182     // Disable priority changes of window server
   297     // Disable priority changes of window server
   183     eikEnv->WsSession().ComputeMode(
   298     iEikonEnv->WsSession().ComputeMode(
   184         RWsSession::EPriorityControlDisabled );
   299         RWsSession::EPriorityControlDisabled );
   185    iNoteTimer = CPeriodic::NewL( EPriorityNormal );
   300 
   186 
   301     iNoteTimer = CPeriodic::NewL( EPriorityNormal );
       
   302 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   303     iAnimTimer = CPeriodic::NewL( EPriorityNormal );
       
   304 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   187     iExitTimer = CPeriodic::NewL( EPriorityNormal );
   305     iExitTimer = CPeriodic::NewL( EPriorityNormal );
   188 
   306 
       
   307 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   308     TRACES("CStartupAppUi::ConstructL(): StartupTone: Initialising");
       
   309     iStartupTone = CStartupTone::NewL( this, EStartupTone );
       
   310     TRACES("CStartupAppUi::ConstructL(): StartupTone: Initialised");
       
   311 
       
   312     TRACES("CStartupAppUi::ConstructL(): Operator StartupTone: Initialising");
       
   313     iOpStartupTone = CStartupTone::NewL( this, EStartupOpTone );
       
   314     TRACES("CStartupAppUi::ConstructL(): Operator StartupTone: Initialised");
       
   315 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   189 
   316 
   190     if ( iSwStateFatalStartupError )
   317     if ( iSwStateFatalStartupError )
   191         {
   318         {
   192         TRACES("CStartupAppUi::ConstructL(): ESWStateFatalStartupError");
   319         TRACES("CStartupAppUi::ConstructL(): ESWStateFatalStartupError");
   193         DoNextStartupPhaseL( EStartupSystemFatalError );
   320         DoNextStartupPhaseL( EStartupSystemFatalError );
   205 // ---------------------------------------------------------------------------
   332 // ---------------------------------------------------------------------------
   206 CStartupAppUi::~CStartupAppUi()
   333 CStartupAppUi::~CStartupAppUi()
   207     {
   334     {
   208     TRACES("CStartupAppUi::~CStartupAppUi()");
   335     TRACES("CStartupAppUi::~CStartupAppUi()");
   209 
   336 
       
   337 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   338     if (iWelcomeAnimation)
       
   339         {
       
   340         RemoveFromStack( iWelcomeAnimation );
       
   341         delete iWelcomeAnimation;
       
   342         }
       
   343 
       
   344     if (iOperatorAnimation)
       
   345         {
       
   346         RemoveFromStack( iOperatorAnimation);
       
   347         delete iOperatorAnimation;
       
   348         }
       
   349 
       
   350     if (iUserWelcomeNote)
       
   351         {
       
   352         RemoveFromStack( iUserWelcomeNote );
       
   353         delete iUserWelcomeNote;
       
   354         iUserWelcomeNote = NULL;
       
   355         }
       
   356 
       
   357     if (iStartupPubSubObserver)
       
   358         {
       
   359         delete iStartupPubSubObserver;
       
   360         }
       
   361     if (iStartupMediatorObserver)
       
   362         {
       
   363         delete iStartupMediatorObserver;
       
   364         }
       
   365     if (iStartupTone)
       
   366         {
       
   367         delete iStartupTone;
       
   368         }
       
   369     if (iOpStartupTone)
       
   370         {
       
   371         delete iOpStartupTone;
       
   372         }
       
   373 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   210 
   374 
   211     if( iExitTimer )
   375     if( iExitTimer )
   212         {
   376         {
   213         iExitTimer->Cancel();
   377         iExitTimer->Cancel();
   214         delete iExitTimer;
   378         delete iExitTimer;
   215         }
   379         }
   216 
   380 
   217 
   381 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   382     if( iAnimTimer )
       
   383         {
       
   384         iAnimTimer->Cancel();
       
   385         delete iAnimTimer;
       
   386         }
       
   387 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   218 
   388 
   219     if( iNoteTimer )
   389     if( iNoteTimer )
   220         {
   390         {
   221         iNoteTimer->Cancel();
   391         iNoteTimer->Cancel();
   222         delete iNoteTimer;
   392         delete iNoteTimer;
   223         }
   393         }
   224 
   394 
   225 
   395 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   226  
   396     delete iUserWelcomeNote;
   227     delete iAnimation;
   397     delete iAnimation;
   228     delete iStartupPubSubObserver;
   398     delete iStartupPubSubObserver;
   229    
   399     delete iStartupMediatorObserver;
   230     delete iMainView;
   400     delete iMainView;
   231 
   401 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   232 
   402 
   233     FeatureManager::UnInitializeLib();
   403     FeatureManager::UnInitializeLib();
   234 
   404 
   235     TRACES("CStartupAppUi::~CStartupAppUi(): End");
   405     TRACES("CStartupAppUi::~CStartupAppUi(): End");
   236     }
   406     }
   240 // ---------------------------------------------------------------------------
   410 // ---------------------------------------------------------------------------
   241 void CStartupAppUi::PrepareToExit()
   411 void CStartupAppUi::PrepareToExit()
   242     {
   412     {
   243     TRACES("CStartupAppUi::PrepareToExit()");
   413     TRACES("CStartupAppUi::PrepareToExit()");
   244 
   414 
   245 
   415 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
   246 
   416     // Start the custom exit effect at boot time.
   247  
   417     // Note: Not allowed to call GfxTransEffect::EndFullScreen() as AVKON takes care of that when
   248 	CEikAppUi::PrepareToExit();
   418     // EApplicationExit context is used!
   249 
   419 
       
   420 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   421     if ( !( iAnimation->WasCancelled() ) )
       
   422 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   423     if( !iWelcomeAnimation->IsAnimationCancelled() )
       
   424 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   425         {
       
   426         TRACES("CStartupAppUi::PrepareToExit(): Starting transition effect");
       
   427 
       
   428         GfxTransEffect::BeginFullScreen( AknTransEffect::EApplicationExit, TRect(),
       
   429             AknTransEffect::EParameterType,
       
   430             AknTransEffect::GfxTransParam( KUidStartUp, AknTransEffect::TParameter::EAllowAtBoot ) );
       
   431         }
       
   432 #endif
       
   433 
       
   434     CEikAppUi::PrepareToExit();
   250 #ifndef RD_BOOT_CUSTOMIZABLE_AI
   435 #ifndef RD_BOOT_CUSTOMIZABLE_AI
   251     if( !iChargingOrAlarmBoot )
   436     if( !iChargingOrAlarmBoot )
   252         {
   437         {
   253         TRACES("CStartupAppUi::PrepareToExit(): NOT Charger/alarm boot");
   438         TRACES("CStartupAppUi::PrepareToExit(): NOT Charger/alarm boot");
   254 
   439 
   287     TRACES("CStartupAppUi::DoExitApplication()");
   472     TRACES("CStartupAppUi::DoExitApplication()");
   288     STATIC_CAST( CStartupAppUi*, aObject )->ExitApplication(); // cast, and call non-static function
   473     STATIC_CAST( CStartupAppUi*, aObject )->ExitApplication(); // cast, and call non-static function
   289     TRACES("CStartupAppUi::DoExitApplication(): End");
   474     TRACES("CStartupAppUi::DoExitApplication(): End");
   290     return KErrNone;
   475     return KErrNone;
   291     }
   476     }
   292 
       
   293 
   477 
   294 // ---------------------------------------------------------------------------
   478 // ---------------------------------------------------------------------------
   295 // CStartupAppUi::HandleKeyEventL
   479 // CStartupAppUi::HandleKeyEventL
   296 // ---------------------------------------------------------------------------
   480 // ---------------------------------------------------------------------------
   297 TKeyResponse CStartupAppUi::HandleKeyEventL(
   481 TKeyResponse CStartupAppUi::HandleKeyEventL(
   327             TRACES("CStartupAppUi::HandleKeyEventL(): First key event comes from Offline Mode Query");
   511             TRACES("CStartupAppUi::HandleKeyEventL(): First key event comes from Offline Mode Query");
   328             // first key event comes from Offline Mode Query
   512             // first key event comes from Offline Mode Query
   329             iOfflineModeQueryShown = EFalse;
   513             iOfflineModeQueryShown = EFalse;
   330             response = EKeyWasConsumed;
   514             response = EKeyWasConsumed;
   331             }
   515             }
   332 		
   516         else if ( iUserWelcomeNote )
       
   517             {
       
   518             TRACES("CStartupAppUi::HandleKeyEventL(): This key event is used to stop UserWelcomeAnimation");
       
   519             //this is used to stop User Welcome note showing
       
   520             StopTimingL();
       
   521             response = EKeyWasConsumed;
       
   522             }
   333         else if ( ( iInternalState == EStartupShowingWelcomeAnimation ||
   523         else if ( ( iInternalState == EStartupShowingWelcomeAnimation ||
   334                     iInternalState == EStartupShowingOperatorAnimation ) &&
   524                     iInternalState == EStartupShowingOperatorAnimation ) &&
   335                    !( iAnimation->WasCancelled() ) )
   525                    !( iAnimation->WasCancelled() ) )
   336             {
   526             {
   337             TRACES("CStartupAppUi::HandleKeyEventL(): This key event is used to cancel animations");
   527             TRACES("CStartupAppUi::HandleKeyEventL(): This key event is used to cancel animations");
   343 
   533 
   344     TRACES1("CStartupAppUi::HandleKeyEventL(): End, return %d", response);
   534     TRACES1("CStartupAppUi::HandleKeyEventL(): End, return %d", response);
   345     return response;
   535     return response;
   346     }
   536     }
   347 
   537 
   348 /*
   538 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   349  * Qt Support Not available..
       
   350 // ---------------------------------------------------------------------------
   539 // ---------------------------------------------------------------------------
   351 // CStartupAppUi::HandleResourceChangeL
   540 // CStartupAppUi::HandleResourceChangeL
   352 //
   541 //
   353 // ---------------------------------------------------------------------------
   542 // ---------------------------------------------------------------------------
   354 //
   543 //
   355 void CStartupAppUi::HandleResourceChangeL( TInt aType )
   544 void CStartupAppUi::HandleResourceChangeL( TInt aType )
   356     {
   545     {
   357     TRACES("CStartupAppUi::HandleResourceChangeL()");
   546     TRACES("CStartupAppUi::HandleResourceChangeL()");
   358     TRACES1("CStartupAppUi::HandleResourceChangeL Type: %d", aType);
   547     TRACES1("CStartupAppUi::HandleResourceChangeL Type: %d", aType);
   359   
   548 
   360     
       
   361      * No equivalent in Qt. 
       
   362     CAknAppUi::HandleResourceChangeL( aType );
   549     CAknAppUi::HandleResourceChangeL( aType );
   363 
   550 
   364     if ( aType == KEikDynamicLayoutVariantSwitch )
   551     if ( aType == KEikDynamicLayoutVariantSwitch )
   365         {
   552         {
   366         iMainView->SetRect( ApplicationRect() );
   553         iMainView->SetRect( ApplicationRect() );
   367         }
   554         }
   368      
   555 
   369     TRACES("CStartupAppUi::HandleResourceChangeL(): End");
   556     TRACES("CStartupAppUi::HandleResourceChangeL(): End");
   370     }
   557     }
   371 
   558 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   372 */
       
   373 
   559 
   374 
   560 
   375 // ---------------------------------------------------------------------------
   561 // ---------------------------------------------------------------------------
   376 // CStartupAppUi::HandleCommandL(TInt aCommand)
   562 // CStartupAppUi::HandleCommandL(TInt aCommand)
   377 // ---------------------------------------------------------------------------
   563 // ---------------------------------------------------------------------------
   381     switch (aCommand)
   567     switch (aCommand)
   382         {
   568         {
   383         case EEikCmdExit:
   569         case EEikCmdExit:
   384             {
   570             {
   385             TRACES("CStartupAppUi::HandleCommandL(): EEikCmdExit");
   571             TRACES("CStartupAppUi::HandleCommandL(): EEikCmdExit");
   386 
   572             Exit();
   387 			Exit();
       
   388             }
   573             }
   389             break;
   574             break;
   390         default:
   575         default:
   391             break;
   576             break;
   392         }//End of switch-clause
   577         }//End of switch-clause
   397 // CStartupAppUi::DoStartupStartPartL()
   582 // CStartupAppUi::DoStartupStartPartL()
   398 // ---------------------------------------------------------------------------
   583 // ---------------------------------------------------------------------------
   399 void CStartupAppUi::DoStartupStartPartL()
   584 void CStartupAppUi::DoStartupStartPartL()
   400     {
   585     {
   401     TRACES("CStartupAppUi::DoStartupStartPartL()");
   586     TRACES("CStartupAppUi::DoStartupStartPartL()");
   402 
   587 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   403     TryPreLoadAnimation();
   588     TryPreLoadAnimation();
   404 
   589 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   405     DoNextStartupPhaseL( EStartupWaitingCriticalBlock );
   590     DoNextStartupPhaseL( EStartupWaitingCriticalBlock );
   406     TRACES("CStartupAppUi::DoStartupStartPartL(): End");
   591     TRACES("CStartupAppUi::DoStartupStartPartL(): End");
   407     }
   592     }
   408 
   593 
       
   594 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   409 // ---------------------------------------------------------------------------
   595 // ---------------------------------------------------------------------------
   410 // CStartupAppUi::TryPreLoadAnimation()
   596 // CStartupAppUi::TryPreLoadAnimation()
   411 // ---------------------------------------------------------------------------
   597 // ---------------------------------------------------------------------------
   412 void CStartupAppUi::TryPreLoadAnimation()
   598 void CStartupAppUi::TryPreLoadAnimation()
   413     {
   599     {
   434            mode == EStartupModeNormal ) || // Not going to charging or alarm mode
   620            mode == EStartupModeNormal ) || // Not going to charging or alarm mode
   435          state == ESwStateSecurityCheck ) )
   621          state == ESwStateSecurityCheck ) )
   436         {
   622         {
   437         iAnimation->PreLoad(
   623         iAnimation->PreLoad(
   438             ClientRect(),
   624             ClientRect(),
   439 			*iMainView,
   625             *iMainView,
   440             KStartupAnimationParams,
   626             KStartupAnimationParams,
   441             ETrue,
   627             ETrue,
   442             SecondaryDisplay::EStartWelcomeAnimation );
   628             SecondaryDisplay::EStartWelcomeAnimation );
   443         }
   629         }
   444 
   630 
   445     TRACES("CStartupAppUi::TryPreLoadAnimation(): End");
   631     TRACES("CStartupAppUi::TryPreLoadAnimation(): End");
   446     }
   632     }
   447 
   633 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   448 
   634 
   449 
   635 
   450 // ---------------------------------------------------------------------------
   636 // ---------------------------------------------------------------------------
   451 // CStartupAppUi::DoStartupShowWelcomeAnimationL()
   637 // CStartupAppUi::DoStartupShowWelcomeAnimationL()
   452 // ---------------------------------------------------------------------------
   638 // ---------------------------------------------------------------------------
   457         {
   643         {
   458         //skip the welcome animation and user welcome note and continue with
   644         //skip the welcome animation and user welcome note and continue with
   459         //the same way like in the end of ShowUserWelcomeNoteL()
   645         //the same way like in the end of ShowUserWelcomeNoteL()
   460         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Skip the animation and UWN because it's hidden reset");
   646         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Skip the animation and UWN because it's hidden reset");
   461         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   647         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   462 
   648 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   649         iWelcomeAnimation->RemoveSplashScreen();
       
   650 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   463         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   651         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   464 
   652 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   465         }
   653         return;
   466 
   654 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   655         }
       
   656 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   467     else
   657     else
   468         {
   658         {
   469         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Show animation");
   659         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Show animation");
   470 
   660 
   471         iAnimation->Play(
   661         iAnimation->Play(
   472             ClientRect(),
   662             ClientRect(),
   473 			*iMainView,
   663             *iMainView,
   474             KStartupAnimationParams,
   664             KStartupAnimationParams,
   475             ETrue,
   665             ETrue,
   476             SecondaryDisplay::EStartWelcomeAnimation,
   666             SecondaryDisplay::EStartWelcomeAnimation,
   477             TCallBack( AnimationFinishedFunc, this ) );
   667             TCallBack( AnimationFinishedFunc, this ) );
   478         }
   668         }
   479 
   669 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   670 
       
   671     TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Play startup tone.");
       
   672 
       
   673     // Play startup tone
       
   674     if (iStartupTone->Play() != KErrNone)
       
   675         {
       
   676         // Play startup beep.
       
   677         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Play startup beep");
       
   678         static_cast<CAknAppUi*>(iEikonEnv->
       
   679                                 EikAppUi())->
       
   680                                 KeySounds()->
       
   681                                 PlaySound( EAvkonSIDPowerOnTone );
       
   682         }
       
   683     iWelcomeAnimation->SetAnimationShowing(ETrue);
       
   684     ShowWelcomeAnimationL();
       
   685 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   480 
   686 
   481     TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): End");
   687     TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): End");
   482     }
   688     }
   483 
   689 
   484 // ---------------------------------------------------------------------------
   690 // ---------------------------------------------------------------------------
   492         //skip the operator animation and user welcome note and continue with
   698         //skip the operator animation and user welcome note and continue with
   493         //the same way like in the end of ShowUserWelcomeNoteL()
   699         //the same way like in the end of ShowUserWelcomeNoteL()
   494         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Skip the animation and UWN because it's hidden reset");
   700         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Skip the animation and UWN because it's hidden reset");
   495         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   701         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   496         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   702         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   497 
   703 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   498         }
   704         return;
   499 
   705 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   706         }
       
   707 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   500     else
   708     else
   501         {
   709         {
   502         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Show animation");
   710         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Show animation");
   503 
   711 
   504         CSAnimStartupCtrl::TAnimationParams params;
   712         CSAnimStartupCtrl::TAnimationParams params;
   508         params.iEnableScalingKey = KStartupOperatorAnimationScaling;
   716         params.iEnableScalingKey = KStartupOperatorAnimationScaling;
   509         params.iTonePathKey = KStartupOperatorTonePath;
   717         params.iTonePathKey = KStartupOperatorTonePath;
   510         params.iVolumeKey = KStartupOperatorToneVolume;
   718         params.iVolumeKey = KStartupOperatorToneVolume;
   511         iAnimation->Play(
   719         iAnimation->Play(
   512             ClientRect(),
   720             ClientRect(),
   513 	
       
   514             *iMainView,
   721             *iMainView,
   515             params,
   722             params,
   516             EFalse,
   723             EFalse,
   517             SecondaryDisplay::EStartOperatorAnimation,
   724             SecondaryDisplay::EStartOperatorAnimation,
   518             TCallBack( AnimationFinishedFunc, this ) );
   725             TCallBack( AnimationFinishedFunc, this ) );
   519         }
   726         }
   520 
   727 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   728     if ( iOperatorAnimation->ShowingTime() )
       
   729         {
       
   730         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Operator animation time defined properly");
       
   731         iOperatorAnimation->SetAnimationShowing(ETrue);
       
   732         iOpStartupTone->Play();
       
   733         ShowOperatorAnimationL();
       
   734         }
       
   735     else
       
   736         {
       
   737         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Operator animation not defined. Skip it.");
       
   738         iOperatorAnimation->SetAnimationShowing(EFalse);
       
   739         DoNextStartupPhaseL( EStartupShowingUserWelcomeNote );
       
   740         }
       
   741 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   521 
   742 
   522     TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): End");
   743     TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): End");
   523     }
   744     }
   524 
   745 
       
   746 // ---------------------------------------------------------------------------
       
   747 // CStartupAppUi::DoStartupShowUserWelcomeNoteL()
       
   748 // ---------------------------------------------------------------------------
       
   749 void CStartupAppUi::DoStartupShowUserWelcomeNoteL()
       
   750     {
       
   751     TRACES("CStartupAppUi::DoStartupShowUserWelcomeNoteL()");
       
   752     ShowUserWelcomeNoteL();
       
   753     TRACES("CStartupAppUi::DoStartupShowUserWelcomeNoteL(): End");
       
   754     }
       
   755 
       
   756 // ---------------------------------------------------------------------------
       
   757 // CStartupAppUi::StartupQueriesEnabled()
       
   758 // ---------------------------------------------------------------------------
       
   759 TBool CStartupAppUi::StartupQueriesEnabled()
       
   760     {
       
   761     TRACES("CStartupAppUi::StartupQueriesEnabled()");
       
   762 
       
   763     TInt value( EStartupQueriesEnabled );
       
   764     CRepository* repository(NULL);
       
   765 
       
   766     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
       
   767     if ( err == KErrNone )
       
   768         {
       
   769         err = repository->Get( KStartupQueries, value );
       
   770         }
       
   771     delete repository;
       
   772 
       
   773     TRACES1("CStartupAppUi::StartupQueriesEnabled(): returns %d", value);
       
   774     return value;
       
   775     }
   525 
   776 
   526 // ---------------------------------------------------------------------------
   777 // ---------------------------------------------------------------------------
   527 // CStartupAppUi::PredictiveTimeEnabled()
   778 // CStartupAppUi::PredictiveTimeEnabled()
   528 // ---------------------------------------------------------------------------
   779 // ---------------------------------------------------------------------------
   529 TBool CStartupAppUi::PredictiveTimeEnabled()
   780 TBool CStartupAppUi::PredictiveTimeEnabled()
   549 // ---------------------------------------------------------------------------
   800 // ---------------------------------------------------------------------------
   550 void CStartupAppUi::DoStartupFirstBootAndRTCCheckL()
   801 void CStartupAppUi::DoStartupFirstBootAndRTCCheckL()
   551     {
   802     {
   552     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL()");
   803     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL()");
   553 
   804 
   554 
   805 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   555     RProperty::Set( KPSUidStartup, KStartupCleanBoot, iCleanBoot );
   806     RProperty::Set( KPSUidStartup, KStartupCleanBoot, iCleanBoot );
   556     RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   807     RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   557 
   808 
       
   809     delete iUserWelcomeNote;
       
   810     iUserWelcomeNote = NULL;
   558     iMainView->DrawDeferred();
   811     iMainView->DrawDeferred();
   559 
   812 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   560 
   813 
   561     // When Predictive Time and Country Selection is enabled, no queries are
   814     // When Predictive Time and Country Selection is enabled, no queries are
   562     // shown to user during first boot. Instead, Clock application gets the
   815     // shown to user during first boot. Instead, Clock application gets the
   563     // time and location from the network and marks the first boot as done.
   816     // time and location from the network and marks the first boot as done.
   564     if( !PredictiveTimeEnabled() )
   817     if( !PredictiveTimeEnabled() )
   565         {
   818         {
   566         if( iFirstBoot && !HiddenReset() ) //&& StartupQueriesEnabled() )
   819         if( iFirstBoot && !HiddenReset() && StartupQueriesEnabled() )
   567             {
   820             {
   568             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot. Show city, time and date queries.");
   821             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot. Show city, time and date queries.");
   569 		    TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Mark first boot");
   822     
       
   823     
       
   824 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   825             iWelcomeAnimation->UpdateDrawInfo( EStartupDICityTimeDateQueries );
       
   826             iWelcomeAnimation->DrawNow();
       
   827     
       
   828             if (iOperatorAnimation)
       
   829                 {
       
   830                 RemoveFromStack( iOperatorAnimation );
       
   831                 delete iOperatorAnimation;
       
   832                 iOperatorAnimation = NULL;
       
   833                 }
       
   834             if (iUserWelcomeNote)
       
   835                 {
       
   836                 RemoveFromStack( iUserWelcomeNote );
       
   837                 delete iUserWelcomeNote;
       
   838                 iUserWelcomeNote = NULL;
       
   839                 }
       
   840 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   841             
       
   842             ShowStartupQueriesL();
       
   843             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Mark first boot");
   570             MarkFirstBoot();    
   844             MarkFirstBoot();    
   571                 
   845                 
   572             }
   846             }
   573 		else if( !RTCStatus() && !HiddenReset() ) // && StartupQueriesEnabled())
   847         else if( !RTCStatus() && !HiddenReset() && StartupQueriesEnabled())
   574             {
   848             {
   575             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): No first boot but RTCStatus is corrupted. Ask time and date");
   849             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): No first boot but RTCStatus is corrupted. Ask time and date");
   576 		     }
   850     #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   577 		if( iFirstBoot )  // && !StartupQueriesEnabled() )
   851             iWelcomeAnimation->UpdateDrawInfo( EStartupDICityTimeDateQueries );
       
   852             if (iUserWelcomeNote)
       
   853                 {
       
   854                 RemoveFromStack( iUserWelcomeNote );
       
   855                 delete iUserWelcomeNote;
       
   856                 iUserWelcomeNote = NULL;
       
   857                 }
       
   858     #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   859     
       
   860             ShowStartupQueriesL(); // Not first boot, so skips Country/City query
       
   861             }
       
   862         if( iFirstBoot && !StartupQueriesEnabled() )
   578             {
   863             {
   579             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot ongoing and queries are disabled.");
   864             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot ongoing and queries are disabled.");
   580             MarkFirstBoot();
   865             MarkFirstBoot();
   581             }
   866             }
   582         }
   867         }
   583 	else
       
   584 		{
       
   585 		// Temporary fix for the defect VEZI-7YDEAR , as clock is not yet supported.
       
   586 		TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): if PredictiveTimeEnabled is set");
       
   587 		if( iFirstBoot && !HiddenReset() )
       
   588 		    {
       
   589             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Mark first boot");
       
   590             MarkFirstBoot();
       
   591 			}
       
   592 		// End of temporary fix.
       
   593 		}
       
   594 
   868 
   595     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Setting KPSStartupAppState = EStartupAppStateFinished");
   869     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Setting KPSStartupAppState = EStartupAppStateFinished");
   596     TInt err = RProperty::Set( KPSUidStartupApp, KPSStartupAppState, EStartupAppStateFinished );
   870     TInt err = RProperty::Set( KPSUidStartupApp, KPSStartupAppState, EStartupAppStateFinished );
   597     if( KErrNone != err )
   871     if( KErrNone != err )
   598         {
   872         {
   599         TRACES1("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): KPSStartupAppState set err %d"
   873         TRACES1("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): KPSStartupAppState set err %d"
   600                 , err);
   874                 , err);
   601         }
   875         }
   602 
   876 
   603     DoNextStartupPhaseL( EStartupStartupOK );
   877     DoNextStartupPhaseL( EStartupWaitingCUIStartupReady );
   604     }
   878     }
   605 
   879 
   606 
   880 // ---------------------------------------------------------------------------
   607 
   881 // CStartupAppUi::ShowStartupQueriesL()
       
   882 // ---------------------------------------------------------------------------
       
   883 void CStartupAppUi::ShowStartupQueriesL()
       
   884     {
       
   885     TRACES("CStartupAppUi::ShowStartupQueriesL()");
       
   886 
       
   887     TBool citysaved(EFalse);
       
   888     TBool timesaved(EFalse);
       
   889     TBool datesaved(EFalse);
       
   890 
       
   891     // Get default time ( to be used only in date query )
       
   892     GetDefaultTimeAndDate( iTime );
       
   893 
       
   894     // Show Country, Date and Time queries ( with possibility to go back ).
       
   895     // Country query is shown only in the first boot.
       
   896 
       
   897     while (!timesaved)
       
   898         {
       
   899         while (!datesaved)
       
   900             {
       
   901             while (!citysaved && iFirstBoot)
       
   902                 {
       
   903                 // 1. Select time zone
       
   904                 ShowCountryAndCityListsL();
       
   905                 citysaved = ETrue;
       
   906                 TRACES1("CStartupAppUi::ShowStartupQueriesL(): citysaved = %d", citysaved );
       
   907                 }
       
   908             // 2. Set date
       
   909             datesaved = ShowDateQueryL();
       
   910             TRACES1("CStartupAppUi::ShowStartupQueriesL(): datesaved = %d", datesaved );
       
   911             if (!datesaved)
       
   912                 {
       
   913                 citysaved = EFalse;
       
   914                 }
       
   915             }
       
   916         // 3. Set time
       
   917         timesaved = ShowTimeQueryL();
       
   918         TRACES1("CStartupAppUi::ShowStartupQueriesL(): timesaved = %d", timesaved );
       
   919         if (!timesaved)
       
   920             {
       
   921             datesaved = EFalse;
       
   922             }
       
   923         }
       
   924 
       
   925     // All the queries completed.
       
   926 
       
   927     TRACES("CStartupAppUi::ShowStartupQueriesL() - END");
       
   928     }
   608 
   929 
   609 // ---------------------------------------------------------------------------
   930 // ---------------------------------------------------------------------------
   610 // CStartupAppUi::DoStartupEndPart()
   931 // CStartupAppUi::DoStartupEndPart()
   611 // ---------------------------------------------------------------------------
   932 // ---------------------------------------------------------------------------
   612 void CStartupAppUi::DoStartupEndPart()
   933 void CStartupAppUi::DoStartupEndPart()
   613     {
   934     {
   614     TRACES("CStartupAppUi::DoStartupEndPart()");
   935     TRACES("CStartupAppUi::DoStartupEndPart()");
   615     TRACES("CStartupAppUi::DoStartupEndPart(): STARTUP OK");
   936     TRACES("CStartupAppUi::DoStartupEndPart(): STARTUP OK");
       
   937 
       
   938 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   939     RProperty::Set( KPSUidStartup, KStartupCleanBoot, iCleanBoot );
       
   940 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   941 
       
   942 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION    
       
   943     TBool fTUDone = ETrue;
       
   944     TRAP_IGNORE(IsFTUAvailableL(fTUDone));
   616     
   945     
   617     TBool ftuenabled=EFalse;
   946     if(fTUDone)
   618     TInt err=KErrNone;
   947     	{
   619 #ifndef __WINSCW__
   948     	UpdateStartupUiPhase( EStartupUiPhaseAllDone );
   620     TRAP(err,
   949     	}
   621             TInt enabled=0;
   950 	else
   622             //open cenrep;
   951         {
   623             CRepository *cenrep=CRepository::NewLC(KCRUidStartupConf);
   952         UpdateStartupUiPhase(EStartupUiPhaseAllDone+1);
   624             //check if ftu is enabled or not
   953         }
   625             User::LeaveIfError(cenrep->Get(KFtuStartupEnabled,enabled));
   954 
   626             ftuenabled=!!enabled; //make sure we only have a boolean value here
   955     //UpdateStartupUiPhase( EStartupUiPhaseAllDone );
   627             CleanupStack::PopAndDestroy(cenrep);
   956     
   628             );
   957     
   629 #endif     
   958 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   630     if(!ftuenabled)
       
   631         {
       
   632         UpdateStartupUiPhase( EStartupUiPhaseAllDone );
       
   633         }
       
   634 
   959 
   635     TRACES("CStartupAppUi::DoStartupEndPart(): Exit application.");
   960     TRACES("CStartupAppUi::DoStartupEndPart(): Exit application.");
   636     iExitTimer->Start( 100000, 100000, TCallBack( DoExitApplication, this ) );
   961     iExitTimer->Start( 100000, 100000, TCallBack( DoExitApplication, this ) );
   637     TRACES("CStartupAppUi::DoStartupEndPart(): DoExitApplication-timer called.");
   962     TRACES("CStartupAppUi::DoStartupEndPart(): DoExitApplication-timer called.");
   638     TRACES("CStartupAppUi::DoStartupEndPart(): End");
   963     TRACES("CStartupAppUi::DoStartupEndPart(): End");
   639     }
   964     }
       
   965 
       
   966 void CStartupAppUi::IsFTUAvailableL(TBool& aFTUAvailable)
       
   967     {
       
   968     	//From Startupwelcomecrkeys.h
       
   969     	CRepository* repo = CRepository::NewLC(KCRUidWelcome6);
       
   970 			repo->Get(KPhoneActicationCompleted, aFTUAvailable);
       
   971 			CleanupStack::PopAndDestroy(repo);
       
   972     }
       
   973 
       
   974 
       
   975 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   976 // ---------------------------------------------------------------------------
       
   977 // CStartupAppUi::ContinueStartupAfterToneL()
       
   978 // ---------------------------------------------------------------------------
       
   979 void CStartupAppUi::ContinueStartupAfterToneL(TToneType aToneType)
       
   980     {
       
   981     TRACES("CStartupAppUi::ContinueStartupAfterToneL()");
       
   982 
       
   983     if (aToneType == EStartupTone)
       
   984         {
       
   985         TRACES("CStartupAppUi::ContinueStartupAfterToneL(): Tone type EStartupTone");
       
   986         DoNextStartupPhaseL( EStartupWaitingCUIOperatorAnim );
       
   987         }
       
   988     else if (aToneType == EStartupOpTone)
       
   989         {
       
   990         TRACES("CStartupAppUi::ContinueStartupAfterToneL(): Tone type EStartupOpTone");
       
   991         DoNextStartupPhaseL( EStartupShowingUserWelcomeNote );
       
   992         }
       
   993     else
       
   994         {
       
   995         TRACES("CStartupAppUi::ContinueStartupAfterToneL(): Tone interrupted");
       
   996         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
   997         }
       
   998     TRACES("CStartupAppUi::ContinueStartupAfterToneL(): End");
       
   999     }
       
  1000 
       
  1001 // ---------------------------------------------------------------------------
       
  1002 // CStartupAppUi::BringToForeground()
       
  1003 // ---------------------------------------------------------------------------
       
  1004 void CStartupAppUi::BringToForeground()
       
  1005     {
       
  1006     TRACES("CStartupAppUi::BringToForeground()");
       
  1007     if ((iInternalState != EStartupWaitingTouchScreenCalib) ||
       
  1008         (iTouchScreenCalibrationDone))
       
  1009         {
       
  1010         TRACES("CStartupAppUi::BringToForeground(): Bring to foreground");
       
  1011         TApaTask self(iCoeEnv->WsSession());
       
  1012         self.SetWgId(iCoeEnv->RootWin().Identifier());
       
  1013         self.BringToForeground();
       
  1014         }
       
  1015     TRACES("CStartupAppUi::BringToForeground(): End");
       
  1016     }
       
  1017 
       
  1018 // ---------------------------------------------------------------------------
       
  1019 // CStartupAppUi::SendToBackground()
       
  1020 // ---------------------------------------------------------------------------
       
  1021 void CStartupAppUi::SendToBackground()
       
  1022     {
       
  1023     TRACES("CStartupAppUi::SendToBackground()");
       
  1024     TApaTask self(iCoeEnv->WsSession());
       
  1025     self.SetWgId(iCoeEnv->RootWin().Identifier());
       
  1026     self.SendToBackground();
       
  1027     TRACES("CStartupAppUi::SendToBackground(): End");
       
  1028     }
       
  1029 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   640 
  1030 
   641 // ---------------------------------------------------------------------------
  1031 // ---------------------------------------------------------------------------
   642 // CStartupAppUi::StopTimingL()
  1032 // CStartupAppUi::StopTimingL()
   643 // ---------------------------------------------------------------------------
  1033 // ---------------------------------------------------------------------------
   644 void CStartupAppUi::StopTimingL()
  1034 void CStartupAppUi::StopTimingL()
   651             //telling that timer has expired in appui so that
  1041             //telling that timer has expired in appui so that
   652             //key pressed are not handled any more...
  1042             //key pressed are not handled any more...
   653             TRACES("CStartupAppUi::StopTimingL(): Stopping UWN");
  1043             TRACES("CStartupAppUi::StopTimingL(): Stopping UWN");
   654             iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
  1044             iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
   655             iNoteTimer->Cancel();
  1045             iNoteTimer->Cancel();
   656 
  1046 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   657             UpdateStartupUiPhase( EStartupUiPhaseUserWelcomeDone );
  1047             UpdateStartupUiPhase( EStartupUiPhaseUserWelcomeDone );
   658             DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
  1048             DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   659 
  1049 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1050        iUserWelcomeNote->CancelNoteCancelTimer();
       
  1051             iWelcomeAnimation->UpdateDrawInfo( EStartupDIWelcomeNoteEnd );
       
  1052             iWelcomeAnimation->DrawNow();
       
  1053             iUserWelcomeNote->SetUserWelcomeNoteShowing(EFalse);
       
  1054             TRACES("CStartupAppUi::StopTimingL(): UWN stopped");
       
  1055 
       
  1056             if (iStartupTone->Playing())
       
  1057                 {
       
  1058                 TRACES("CStartupAppUi::StopTimingL(): Startup tone playing. Cannot continue to next phase");
       
  1059                 iStartupTone->StartupWaiting(ETrue);
       
  1060                 }
       
  1061             else
       
  1062                 {
       
  1063                 DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
  1064                 }
       
  1065             }
       
  1066         else if (iInternalState == EStartupShowingOperatorAnimation)  // EStartupShowingOperatorAnimation
       
  1067             {
       
  1068             TRACES("CStartupAppUi::StopTimingL(): Stopping animation");
       
  1069             iAnimTimer->Cancel();
       
  1070             iWelcomeAnimation->CancelAnimCancelTimer();
       
  1071             iOperatorAnimation->UpdateDrawInfo( EStartupDIOperatorAnimEnd );
       
  1072             iOperatorAnimation->SetAnimationShowing(EFalse);
       
  1073             TRACES("CStartupAppUi::StopTimingL(): operator animation showing stopped");
       
  1074             if ( iOperatorAnimation->IsAnimationCancelled())
       
  1075                 {
       
  1076                 TRACES("CStartupAppUi::StopTimingL(): Animation is cancelled by user and therefore UWN is not shown");
       
  1077                 StopOperatorTone();
       
  1078                 iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
       
  1079                 DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
  1080                 }
       
  1081             else
       
  1082                 {
       
  1083                 // If tone is still playing wait until it completes.
       
  1084                 if (iOpStartupTone->Playing())
       
  1085                     {
       
  1086                     TRACES("CStartupAppUi::StopTimingL(): Operator startup tone is still playing. Wait until it completes.");
       
  1087                     iOpStartupTone->StartupWaiting(ETrue);
       
  1088                     }
       
  1089                 else
       
  1090                     {
       
  1091                     TRACES("CStartupAppUi::StopTimingL(): Lets display UWN");
       
  1092                     DoNextStartupPhaseL( EStartupShowingUserWelcomeNote );
       
  1093                     }
       
  1094                 }
       
  1095             TRACES("CStartupAppUi::StopTimingL(): Operator Animation stopped");
       
  1096             }
       
  1097         else // EStartupShowingWelcomeAnimation
       
  1098             {
       
  1099             TRACES("CStartupAppUi::StopTimingL(): Stopping animation");
       
  1100             iAnimTimer->Cancel();
       
  1101             iWelcomeAnimation->CancelAnimCancelTimer();
       
  1102             iWelcomeAnimation->UpdateDrawInfo( EStartupDIWelcomeAnimEnd );
       
  1103             iWelcomeAnimation->SetAnimationShowing(EFalse);
       
  1104             TRACES("CStartupAppUi::StopTimingL(): Welcome animation showing stopped");
       
  1105 
       
  1106             if ( iWelcomeAnimation->IsAnimationCancelled())
       
  1107                 {
       
  1108                 TRACES("CStartupAppUi::StopTimingL(): Animation is cancelled by user and therefore operator animation and UWN is not shown");
       
  1109                 StopStartupTone();
       
  1110                 iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
       
  1111                 DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
  1112                 }
       
  1113             else
       
  1114                 {
       
  1115                 if (iStartupTone->Playing())
       
  1116                     {
       
  1117                     // If tone is still playing wait until it completes.
       
  1118                     iStartupTone->StartupWaiting(ETrue);
       
  1119                     }
       
  1120                 else
       
  1121                     {
       
  1122                     DoNextStartupPhaseL( EStartupWaitingCUIOperatorAnim );
       
  1123                     }
       
  1124                 }
       
  1125             TRACES("CStartupAppUi::StopTimingL(): Animation stopped");
       
  1126 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   660             }
  1127             }
   661         }
  1128         }
   662 
  1129 
   663     TRACES("CStartupAppUi::StopTimingL(): End");
  1130     TRACES("CStartupAppUi::StopTimingL(): End");
   664     }
  1131     }
   672     iExitTimer->Cancel();
  1139     iExitTimer->Cancel();
   673     Exit();
  1140     Exit();
   674     TRACES("CStartupAppUi::ExitApplication(): End");
  1141     TRACES("CStartupAppUi::ExitApplication(): End");
   675     }
  1142     }
   676 
  1143 
       
  1144 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1145 // ---------------------------------------------------------------------------
       
  1146 // CStartupAppUi::ShowWelcomeAnimationL()
       
  1147 // ---------------------------------------------------------------------------
       
  1148 void CStartupAppUi::ShowWelcomeAnimationL()
       
  1149     {
       
  1150     TRACES("CStartupAppUi::ShowWelcomeAnimationL()");
       
  1151     __ASSERT_DEBUG( iWelcomeAnimation , PANIC( EStartupPanicClassMemberVariableIsNull ) );
       
  1152     TInt showtime = iWelcomeAnimation->ShowingTime();
       
  1153     iAnimation = ETrue;
       
  1154     TRACES("CStartupAppUi::ShowWelcomeAnimationL(): Animation timer started");
       
  1155     iAnimTimer->Start(
       
  1156             showtime*KOneMilliSecondInMicroSeconds,
       
  1157             showtime*KOneMilliSecondInMicroSeconds,
       
  1158             TCallBack( DoStopTimingL, this ) );
       
  1159     iWelcomeAnimation->StartL();
       
  1160     TRACES("CStartupAppUi::ShowWelcomeAnimationL(): End");
       
  1161     }
       
  1162 
       
  1163 // ---------------------------------------------------------------------------
       
  1164 // CStartupAppUi::ShowOperatorAnimationL()
       
  1165 // ---------------------------------------------------------------------------
       
  1166 void CStartupAppUi::ShowOperatorAnimationL()
       
  1167     {
       
  1168     TRACES("CStartupAppUi::ShowOperatorAnimationL()");
       
  1169     __ASSERT_DEBUG( iOperatorAnimation , PANIC( EStartupPanicClassMemberVariableIsNull ) );
       
  1170     TInt showtime = iOperatorAnimation->ShowingTime();
       
  1171     iAnimation = ETrue;
       
  1172     TRACES("CStartupAppUi::ShowWelcomeAnimationL(): Operator Animation timer started");
       
  1173     iAnimTimer->Start(
       
  1174         showtime*KOneMilliSecondInMicroSeconds,
       
  1175         showtime*KOneMilliSecondInMicroSeconds,
       
  1176         TCallBack( DoStopTimingL, this ) );
       
  1177     iOperatorAnimation->StartL();
       
  1178     TRACES("CStartupAppUi::ShowOperatorAnimationL(): End");
       
  1179     }
       
  1180 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1181 
       
  1182 // ---------------------------------------------------------------------------
       
  1183 // CStartupAppUi::ShowUserWelcomeNoteL()
       
  1184 // ---------------------------------------------------------------------------
       
  1185 void CStartupAppUi::ShowUserWelcomeNoteL()
       
  1186     {
       
  1187     TRACES("CStartupAppUi::ShowUserWelcomeNoteL()");
       
  1188 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1189     iUserWelcomeNote = CStartupUserWelcomeNote::NewL( *this, ClientRect(), *iMainView );
       
  1190     TStartupNoteTypeInformation type = iUserWelcomeNote->NoteTypeInformation();
       
  1191 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1192     __ASSERT_DEBUG( iUserWelcomeNote , PANIC( EStartupPanicClassMemberVariableIsNull ) );
       
  1193     TStartupNoteTypeInformation type;
       
  1194     type = iUserWelcomeNote->NoteTypeInformation();
       
  1195 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1196     if( type == EStartupImage )
       
  1197         {
       
  1198         // UserWelcomeNote type is EStartupImage
       
  1199         // This type of note is shown fixed (KUserWelcomeNoteShowPeriodTime) time
       
  1200         TRACES("CStartupAppUi::ShowUserWelcomeNoteL(): UWNTimer started (graphic)");
       
  1201 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1202         iAnimation = EFalse;
       
  1203 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1204         iNoteTimer->Start(
       
  1205             KUserWelcomeNoteShowPeriodTime,
       
  1206             KUserWelcomeNoteShowPeriodTime,
       
  1207             TCallBack( DoStopTimingL, this ) );
       
  1208 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1209         iUserWelcomeNote->StartL();
       
  1210 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1211         }
       
  1212 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1213     else if ( type == EStartupText )
       
  1214         {
       
  1215         TRACES("CStartupAppUi::ShowUserWelcomeNoteL(): Text UWN");
       
  1216 
       
  1217         iUserWelcomeNote->StartL();
       
  1218         
       
  1219         UpdateStartupUiPhase( EStartupUiPhaseUserWelcomeDone );
       
  1220                 
       
  1221         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
  1222         }
       
  1223     else
       
  1224         {
       
  1225         TRACES("CStartupAppUi::ShowUserWelcomeNoteL(): No UWN");
       
  1226 
       
  1227         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
       
  1228 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1229     else
       
  1230         {
       
  1231         //if User Welcome Note type is ETextWelcomeNote nothing to do here,
       
  1232         //because it is implemented with Avkon globalnote
       
  1233         //or if type is EDefaultWelcomeNote no User Welcome Note is shown.
       
  1234         TRACES("CStartupAppUi::ShowUserWelcomeNoteL(): No UWN to show or UWN is text");
       
  1235         }
       
  1236     //invoke welcome note container to show note
       
  1237     iUserWelcomeNote->StartL();
       
  1238 
       
  1239     if( type == EStartupText || type == EStartupNoNote)
       
  1240         {
       
  1241         //this is called already here because timer not activated in text uwn case
       
  1242         //and so DoStopTimingL() is never called and should be called here.
       
  1243         StopTimingL();
       
  1244 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1245         }
       
  1246 
       
  1247     TRACES("CStartupAppUi::ShowUserWelcomeNoteL(): End");
       
  1248     }
       
  1249 
       
  1250 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1251 // ---------------------------------------------------------------------------
       
  1252 // CStartupAppUi::WaitingTouchScreenCalibL()
       
  1253 // ---------------------------------------------------------------------------
       
  1254 void CStartupAppUi::WaitingTouchScreenCalibL()
       
  1255     {
       
  1256     TRACES("CStartupAppUi::WaitingTouchScreenCalibL()");
       
  1257 #ifdef RD_SCALABLE_UI_V2
       
  1258 
       
  1259     if( iFirstBoot && iTouchScreenCalibSupport )
       
  1260         {
       
  1261         if (iTouchScreenCalibrationDone)
       
  1262             {
       
  1263             TRACES("CStartupAppUi::WaitingTouchScreenCalibL(): Calibration already done. Continue boot up");
       
  1264             DoNextStartupPhaseL( EStartupOfflineModeQuery );
       
  1265             }
       
  1266         else
       
  1267             {
       
  1268             SendToBackground();
       
  1269 
       
  1270             iWelcomeAnimation->UpdateDrawInfo( EStartupDITouchScreenCalib );
       
  1271             iWelcomeAnimation->DrawNow();
       
  1272             TRACES("CStartupAppUi::WaitingTouchScreenCalibL(): Startup sequence halted until Touch Screen Calibration is done");
       
  1273             }
       
  1274         }
       
  1275     else
       
  1276         {
       
  1277         TRACES("CStartupAppUi::WaitingTouchScreenCalibL(): Not first boot or calibration not supported. Continue boot up");
       
  1278         DoNextStartupPhaseL( EStartupOfflineModeQuery );
       
  1279         }
       
  1280 
       
  1281 #else // !RD_SCALABLE_UI_V2
       
  1282     TRACES("CStartupAppUi::WaitingTouchScreenCalibL(): Calibration not supported. Continue boot up");
       
  1283     DoNextStartupPhaseL( EStartupOfflineModeQuery );
       
  1284 
       
  1285 #endif // RD_SCALABLE_UI_V2
       
  1286     TRACES("CStartupAppUi::WaitingTouchScreenCalibL(): End");
       
  1287     }
       
  1288 
       
  1289 #ifdef RD_SCALABLE_UI_V2
       
  1290 // ---------------------------------------------------------------------------
       
  1291 // CStartupAppUi::TouchScreenCalibrationDoneL()
       
  1292 // ---------------------------------------------------------------------------
       
  1293 void CStartupAppUi::TouchScreenCalibrationDoneL()
       
  1294     {
       
  1295     TRACES("CStartupAppUi::TouchScreenCalibrationDoneL()");
       
  1296     if (iInternalState == EStartupWaitingTouchScreenCalib)
       
  1297         {
       
  1298         iTouchScreenCalibrationDone = ETrue;
       
  1299         BringToForeground();
       
  1300         DoNextStartupPhaseL( EStartupOfflineModeQuery );
       
  1301         }
       
  1302     else
       
  1303         {
       
  1304         iTouchScreenCalibrationDone = ETrue;
       
  1305         }
       
  1306     TRACES("CStartupAppUi::TouchScreenCalibrationDoneL(): End");
       
  1307     }
       
  1308 #endif // RD_SCALABLE_UI_V2
       
  1309 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1310 
       
  1311 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1312 // ---------------------------------------------------------------------------
       
  1313 // CStartupAppUi::CoverUIWelcomeAnimationSyncOKL()
       
  1314 // ---------------------------------------------------------------------------
       
  1315 void CStartupAppUi::CoverUIWelcomeAnimationSyncOKL()
       
  1316     {
       
  1317     TRACES("CStartupAppUi::CoverUIWelcomeAnimationSyncOKL()");
       
  1318     DoNextStartupPhaseL( EStartupWaitingStartupTone );
       
  1319     TRACES("CStartupAppUi::CoverUIWelcomeAnimationSyncOKL(): End");
       
  1320     }
       
  1321 
       
  1322 // ---------------------------------------------------------------------------
       
  1323 // CStartupAppUi::WaitingCoverUIWelcomeAnimationSyncL()
       
  1324 // ---------------------------------------------------------------------------
       
  1325 void CStartupAppUi::WaitingCoverUIWelcomeAnimationSyncL()
       
  1326     {
       
  1327     TRACES("CStartupAppUi::WaitingCoverUIWelcomeAnimationSyncL()");
       
  1328     if (iCoverUISupported)
       
  1329         {
       
  1330         iStartupMediatorObserver->IssueCommand(SecondaryDisplay::ECmdStartupSync,
       
  1331                                                SecondaryDisplay::EStartWelcomeAnimation);
       
  1332         }
       
  1333     else
       
  1334         {
       
  1335         DoNextStartupPhaseL( EStartupWaitingStartupTone );
       
  1336         }
       
  1337     TRACES("CStartupAppUi::WaitingCoverUIWelcomeAnimationSyncL(): End");
       
  1338     }
       
  1339 
       
  1340 // ---------------------------------------------------------------------------
       
  1341 // CStartupAppUi::CoverUIOperatorAnimationSyncOKL()
       
  1342 // ---------------------------------------------------------------------------
       
  1343 void CStartupAppUi::CoverUIOperatorAnimationSyncOKL()
       
  1344     {
       
  1345     TRACES("CStartupAppUi::CoverUIOperatorAnimationSyncOKL()");
       
  1346     DoNextStartupPhaseL( EStartupShowingOperatorAnimation );
       
  1347     TRACES("CStartupAppUi::CoverUIOperatorAnimationSyncOKL(): End");
       
  1348     }
       
  1349 
       
  1350 // ---------------------------------------------------------------------------
       
  1351 // CStartupAppUi::WaitingCoverUIOperatorAnimationSyncL()
       
  1352 // ---------------------------------------------------------------------------
       
  1353 void CStartupAppUi::WaitingCoverUIOperatorAnimationSyncL()
       
  1354     {
       
  1355     TRACES("CStartupAppUi::WaitingCoverUIOperatorAnimationSyncL()");
       
  1356     if (iCoverUISupported)
       
  1357         {
       
  1358         if (iOperatorAnimation->ShowingTime())
       
  1359             {
       
  1360             iStartupMediatorObserver->IssueCommand(SecondaryDisplay::ECmdStartupSync,
       
  1361                                                    SecondaryDisplay::EStartOperatorAnimation );
       
  1362             }
       
  1363         else
       
  1364             {
       
  1365             DoNextStartupPhaseL( EStartupShowingOperatorAnimation );
       
  1366             }
       
  1367         }
       
  1368     else
       
  1369         {
       
  1370         DoNextStartupPhaseL( EStartupShowingOperatorAnimation );
       
  1371         }
       
  1372     TRACES("CStartupAppUi::WaitingCoverUIOperatorAnimationSyncL(): End");
       
  1373     }
       
  1374 
       
  1375 // ---------------------------------------------------------------------------
       
  1376 // CStartupAppUi::WaitingStartupToneL()
       
  1377 // ---------------------------------------------------------------------------
       
  1378 void CStartupAppUi::WaitingStartupToneL()
       
  1379     {
       
  1380     if( iStartupTone->ToneFound() && !iStartupTone->AudioReady() )
       
  1381         {
       
  1382         TRACES("CStartupAppUi::WaitingStartupToneL(): Startup tone found but not ready. Waiting tone to init");
       
  1383         iToneInitTimer = CPeriodic::NewL( EPriorityNormal );
       
  1384         iToneInitTimer->Start( KOneMilliSecondInMicroSeconds,
       
  1385                                KOneMilliSecondInMicroSeconds,
       
  1386                                TCallBack( ToneInitTimerTimeoutL, this ) );
       
  1387         }
       
  1388     else
       
  1389         {
       
  1390         TRACES("CStartupAppUi::WaitingStartupToneL(): Audio ready");
       
  1391         DoNextStartupPhaseL( EStartupShowingWelcomeAnimation );
       
  1392         }
       
  1393     }
       
  1394 
       
  1395 // ---------------------------------------------------------------------------
       
  1396 // CStartupAppUi::ToneInitTimerTimeoutL()
       
  1397 // ---------------------------------------------------------------------------
       
  1398 TInt CStartupAppUi::ToneInitTimerTimeoutL(TAny* aObject)
       
  1399     {
       
  1400     STATIC_CAST( CStartupAppUi*, aObject )->StartupToneWaitStatusL(); // cast, and call non-static function
       
  1401     return KErrNone;
       
  1402     }
       
  1403 
       
  1404 // ---------------------------------------------------------------------------
       
  1405 // CStartupAppUi::StartupToneWaitStatusL()
       
  1406 // ---------------------------------------------------------------------------
       
  1407 void CStartupAppUi::StartupToneWaitStatusL()
       
  1408     {
       
  1409     iToneInitWaitTime++;
       
  1410     TRACES1("CStartupAppUi::StartupToneWaitStatusL(): Total tone init wait time = %d ms", iToneInitWaitTime );
       
  1411     TBool audioReady = iStartupTone->AudioReady();
       
  1412     if ( audioReady || (iToneInitWaitTime>=KMaxToneInitWait) )
       
  1413         {
       
  1414         iToneInitTimer->Cancel();
       
  1415         delete iToneInitTimer;
       
  1416         iToneInitTimer = NULL;
       
  1417 
       
  1418         TRACES1("CStartupAppUi::StartupToneWaitStatusL(): AudioReady: %d, proceed", audioReady );
       
  1419         DoNextStartupPhaseL( EStartupShowingWelcomeAnimation );
       
  1420         }
       
  1421     }
       
  1422 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1423 
       
  1424 // ---------------------------------------------------------------------------
       
  1425 // CStartupAppUi::CoverUIStartupReadySyncOKL()
       
  1426 // ---------------------------------------------------------------------------
       
  1427 void CStartupAppUi::CoverUIStartupReadySyncOKL()
       
  1428     {
       
  1429     TRACES("CStartupAppUi::CoverUIStartupReadySyncOKL()");
       
  1430     DoNextStartupPhaseL( EStartupStartupOK );
       
  1431     TRACES("CStartupAppUi::CoverUIStartupReadySyncOKL(): End");
       
  1432     }
       
  1433 
       
  1434 // ---------------------------------------------------------------------------
       
  1435 // CStartupAppUi::WaitingCoverUIStartupReadySyncL()
       
  1436 // ---------------------------------------------------------------------------
       
  1437 void CStartupAppUi::WaitingCoverUIStartupReadySyncL()
       
  1438     {
       
  1439     TRACES("CStartupAppUi::WaitingCoverUIStartupReadySyncL()");
       
  1440     if (iCoverUISupported)
       
  1441         {
       
  1442         iStartupMediatorObserver->IssueCommand(SecondaryDisplay::ECmdStartupSync,
       
  1443                                                SecondaryDisplay::EStartStartupReady);
       
  1444         }
       
  1445     else
       
  1446         {
       
  1447         DoNextStartupPhaseL( EStartupStartupOK );
       
  1448         }
       
  1449     TRACES("CStartupAppUi::WaitingCoverUIStartupReadySyncL(): End");
       
  1450     }
       
  1451 
       
  1452 // ---------------------------------------------------------------------------
       
  1453 // CStartupAppUi::RaiseCoverUIEvent()
       
  1454 // ---------------------------------------------------------------------------
       
  1455 void CStartupAppUi::RaiseCoverUIEvent( TUid aCategory,
       
  1456                                        TInt aEventId,
       
  1457                                        const TDesC8& aData )
       
  1458     {
       
  1459     TRACES("CStartupAppUi::RaiseCoverUIEvent()");
       
  1460     if (iCoverUISupported)
       
  1461         {
       
  1462         iStartupMediatorObserver->RaiseEvent( aCategory,
       
  1463                                               aEventId,
       
  1464                                               aData );
       
  1465         }
       
  1466     TRACES("CStartupAppUi::RaiseCoverUIEvent(): End");
       
  1467     }
       
  1468 
   677 // ---------------------------------------------------------------------------
  1469 // ---------------------------------------------------------------------------
   678 // CStartupAppUi::SetCriticalBlockEndedL()
  1470 // CStartupAppUi::SetCriticalBlockEndedL()
   679 // ---------------------------------------------------------------------------
  1471 // ---------------------------------------------------------------------------
   680 void CStartupAppUi::SetCriticalBlockEndedL()
  1472 void CStartupAppUi::SetCriticalBlockEndedL()
   681     {
  1473     {
   696     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL()");
  1488     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL()");
   697 
  1489 
   698     if( iCriticalBlockEnded )
  1490     if( iCriticalBlockEnded )
   699         {
  1491         {
   700         TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): CriticalBlock has ended. Continue.");
  1492         TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): CriticalBlock has ended. Continue.");
   701 
  1493 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   702         DoNextStartupPhaseL( EStartupOfflineModeQuery );
  1494         DoNextStartupPhaseL( EStartupOfflineModeQuery );
       
  1495 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1496         DoNextStartupPhaseL( EStartupWaitingTouchScreenCalib );
       
  1497 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   703         }
  1498         }
   704     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): End");
  1499     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): End");
   705     }
  1500     }
   706 
  1501 
   707 // ---------------------------------------------------------------------------
  1502 // ---------------------------------------------------------------------------
   742     iCriticalBlockEnded = ETrue;
  1537     iCriticalBlockEnded = ETrue;
   743     if ( iInternalState == EStartupWaitingCriticalBlock )
  1538     if ( iInternalState == EStartupWaitingCriticalBlock )
   744         {
  1539         {
   745         TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): Entered emergency calls only state.");
  1540         TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): Entered emergency calls only state.");
   746 
  1541 
   747         DoNextStartupPhaseL( EStartupStartupOK );
  1542         DoNextStartupPhaseL( EStartupWaitingCUIStartupReady );
   748         }
  1543         }
   749     TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): End");
  1544     TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): End");
   750     }
  1545     }
   751 
  1546 
   752 // ---------------------------------------------------------------------------
  1547 // ---------------------------------------------------------------------------
   764         DoNextStartupPhaseL( EStartupSystemFatalError );
  1559         DoNextStartupPhaseL( EStartupSystemFatalError );
   765         }
  1560         }
   766 
  1561 
   767     TRACES("CStartupAppUi::SwStateFatalStartupErrorL(): End");
  1562     TRACES("CStartupAppUi::SwStateFatalStartupErrorL(): End");
   768     }
  1563     }
       
  1564 
       
  1565 
       
  1566 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1567 // ---------------------------------------------------------------------------
       
  1568 // CStartupAppUi::GetOfflineModeQueryShown()
       
  1569 // ---------------------------------------------------------------------------
       
  1570 TBool CStartupAppUi::GetOfflineModeQueryShown()
       
  1571     {
       
  1572     TRACES1("CStartupAppUi::GetOfflineModeQueryShown(): iOfflineModeQueryShown == %d ", iOfflineModeQueryShown );
       
  1573     return iOfflineModeQueryShown;
       
  1574     }
       
  1575 
       
  1576 // ---------------------------------------------------------------------------
       
  1577 // CStartupAppUi::SetOfflineModeQueryShown()
       
  1578 // ---------------------------------------------------------------------------
       
  1579 void CStartupAppUi::SetOfflineModeQueryShown(TBool aValue)
       
  1580     {
       
  1581     TRACES1("CStartupAppUi::SetOfflineModeQueryShown(): iOfflineModeQueryShown == %d ", iOfflineModeQueryShown );
       
  1582     iOfflineModeQueryShown = aValue;
       
  1583     }
       
  1584 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1585 
   769 // ----------------------------------------------------------------------------
  1586 // ----------------------------------------------------------------------------
   770 // CStartAppUi::DosInOfflineModeL()
  1587 // CStartAppUi::DosInOfflineModeL()
   771 // ----------------------------------------------------------------------------
  1588 // ----------------------------------------------------------------------------
   772 
  1589 
   773 TBool CStartupAppUi::DosInOfflineModeL()
  1590 TBool CStartupAppUi::DosInOfflineModeL()
   846             reply = 1;
  1663             reply = 1;
   847             }
  1664             }
   848         else if ( iOfflineModeSupported && DosInOfflineModeL() )
  1665         else if ( iOfflineModeSupported && DosInOfflineModeL() )
   849             {
  1666             {
   850             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline mode query needed");
  1667             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline mode query needed");
       
  1668 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   851             RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
  1669             RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   852             iAnimation->BringToForeground();
  1670             iAnimation->BringToForeground();
   853             iMainView->DrawDeferred();
  1671             iMainView->DrawDeferred();
       
  1672 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1673             iWelcomeAnimation->UpdateDrawInfo( EStartupDIQueriesOn );
       
  1674             iWelcomeAnimation->DrawNow();
       
  1675 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   854             iOfflineModeQueryShown = ETrue;
  1676             iOfflineModeQueryShown = ETrue;
   855             CHbDeviceMessageBoxSymbian *aMessageBox = NULL;
  1677             CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( CAknQueryDialog::ENoTone );
   856         	aMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EQuestion);
  1678             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Publish dialog for Secondary UI");
   857        	 	_LIT(KText, "Continue using phone in Offline mode?");
  1679             dlg->PublishDialogL(SecondaryDisplay::ECmdShowOfflineQuery,
   858         	aMessageBox->SetTextL(KText);
  1680                                 SecondaryDisplay::KCatStartup);
   859         	_LIT(KAcceptText, "Yes");
  1681             if ( dlg->ExecuteLD( R_STARTUP_OFFLINE_MODE_QUERY ) )
   860         	aMessageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAcceptText);
       
   861         	_LIT(KRejectText, "No");
       
   862         	aMessageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KRejectText);
       
   863         	//aMessageBox->SetDismissPolicy(HbPopup::NoDismiss);
       
   864         	//define the selection button to hold user's option choice
       
   865         	CHbDeviceMessageBoxSymbian::TButtonId selection;
       
   866         	selection = aMessageBox->ExecL();
       
   867             if ( selection == CHbDeviceMessageBoxSymbian::EAcceptButton )
       
   868                 {
  1682                 {
   869                 TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline Mode query: YES -> Boot to Offline");
  1683                 TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline Mode query: YES -> Boot to Offline");
   870                 reply = 1;
  1684                 reply = 1;
   871                 }
  1685                 }
   872             else
  1686             else
   896 
  1710 
   897     if( KErrNone != err )
  1711     if( KErrNone != err )
   898         {
  1712         {
   899         TRACES1("CStartupAppUi::ShowOfflineModeQueryL(): KStartupBootIntoOffline set err %d", err);
  1713         TRACES1("CStartupAppUi::ShowOfflineModeQueryL(): KStartupBootIntoOffline set err %d", err);
   900         }
  1714         }
   901    
  1715 
   902     TRACES("CStartupAppUi::ShowOfflineModeQueryL(): End");
  1716     TRACES("CStartupAppUi::ShowOfflineModeQueryL(): End");
   903     }
  1717     }
   904 
  1718 
   905 // ---------------------------------------------------------------------------
  1719 // ---------------------------------------------------------------------------
   906 // CStartupAppUi::CancelAnimation(...)
  1720 // CStartupAppUi::CancelAnimation(...)
   907 // ---------------------------------------------------------------------------
  1721 // ---------------------------------------------------------------------------
   908 void CStartupAppUi::CancelAnimation()
  1722 void CStartupAppUi::CancelAnimation()
   909     {
  1723     {
   910     TRACES("CStartupAppUi::CancelAnimation()");
  1724     TRACES("CStartupAppUi::CancelAnimation()");
   911 
  1725 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   912     iAnimation->Cancel();
  1726     iAnimation->Cancel();
   913 
  1727 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1728     iWelcomeAnimation->CancelAnimation();
       
  1729 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   914     TRACES("CStartupAppUi::CancelAnimation(): End");
  1730     TRACES("CStartupAppUi::CancelAnimation(): End");
   915     }
  1731     }
   916 
  1732 
   917 
  1733 // ---------------------------------------------------------------------------
       
  1734 // CStartupAppUi::ShowCountryAndCityListsL()
       
  1735 // ---------------------------------------------------------------------------
       
  1736 void CStartupAppUi::ShowCountryAndCityListsL()
       
  1737     {
       
  1738     TRACES("CStartupAppUi::ShowCountryAndCityListsL()");
       
  1739 
       
  1740     TInt cityselected( EFalse );
       
  1741     while ( !cityselected )
       
  1742         {
       
  1743         TRACES1("CStartupAppUi::ShowCountryAndCityListsL(): City item to focus: %d", iCounryListIndex);
       
  1744         TInt cityGroupId = ShowCountryListL();
       
  1745         TRACES1("CStartupAppUi::ShowCountryAndCityListsL(): City group id: %d", cityGroupId);
       
  1746         if ( cityGroupId != KErrCancel )
       
  1747             {
       
  1748             cityselected = ShowCityListL(cityGroupId);
       
  1749             }
       
  1750         else
       
  1751             {
       
  1752             cityselected = ETrue;
       
  1753             }
       
  1754         }
       
  1755     TRACES("CStartupAppUi::ShowCountryAndCityListsL(): End");
       
  1756     }
       
  1757 
       
  1758 // ---------------------------------------------------------------------------
       
  1759 // CStartupAppUi::ShowCountryListL()
       
  1760 // ---------------------------------------------------------------------------
       
  1761 TInt CStartupAppUi::ShowCountryListL()
       
  1762     {
       
  1763     TRACES("CStartupAppUi::ShowCountryListL()");
       
  1764 
       
  1765     CAknSinglePopupMenuStyleListBox* listBox =
       
  1766         new(ELeave) CAknSinglePopupMenuStyleListBox;
       
  1767     CleanupStack::PushL(listBox);
       
  1768 
       
  1769     CStartupPopupList* popupList = CStartupPopupList::NewL(listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
       
  1770                                                            AknPopupLayouts::EMenuGraphicHeadingWindow );
       
  1771 
       
  1772     CleanupStack::PushL(popupList);
       
  1773 
       
  1774     listBox->ConstructL(popupList, EAknListBoxSelectionList | EAknListBoxScrollBarSizeExcluded);
       
  1775     listBox->CreateScrollBarFrameL( ETrue );
       
  1776     listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
       
  1777                                                         CEikScrollBarFrame::EAuto );
       
  1778 
       
  1779     listBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
       
  1780 
       
  1781     CDesCArrayFlat *items = new(ELeave)CDesCArrayFlat(1);
       
  1782 
       
  1783     CleanupStack::PushL(items);
       
  1784 
       
  1785     CTzLocalizer* tzLocalizer = CTzLocalizer::NewL();
       
  1786     CleanupStack::PushL(tzLocalizer);
       
  1787 
       
  1788     CTzLocalizedCityGroupArray* countryList;
       
  1789     countryList = tzLocalizer->GetAllCityGroupsL(CTzLocalizer::ETzAlphaNameAscending);
       
  1790     CleanupStack::PushL(countryList);
       
  1791 
       
  1792     TRACES("CStartupAppUi::ShowCountryListL(): Create list of cities");
       
  1793     for(TInt i = 0; i <countryList->Count(); i++)
       
  1794         {
       
  1795         CTzLocalizedCityGroup& cityGroup = countryList->At(i);
       
  1796 
       
  1797         // Check if the country name is blank.
       
  1798         // If it is blank, ignore it. Empty name shouldn't be shown in the list.
       
  1799         if(cityGroup.Name().Compare(KEmpty) != 0)
       
  1800             {
       
  1801             TBuf<KMaxCountryLength> countryitem;
       
  1802             countryitem.Insert(0,cityGroup.Name());
       
  1803             TRACES1("CStartupAppUi::ShowCountryListL(): Create country to list: %S", &countryitem);
       
  1804             items->AppendL(countryitem);
       
  1805             }
       
  1806         }
       
  1807 
       
  1808     CleanupStack::PopAndDestroy( countryList );
       
  1809 
       
  1810     CTextListBoxModel* model=listBox->Model();
       
  1811     model->SetItemTextArray(items);
       
  1812     model->SetOwnershipType(ELbmOwnsItemArray);
       
  1813 
       
  1814     TRACES("CStartupAppUi::ShowCountryListL(): Set title");
       
  1815     // Set title
       
  1816     HBufC* title = StringLoader::LoadLC( R_QTN_SU_SELECT_COUNTRY );
       
  1817     popupList->SetTitleL(title->Des());
       
  1818     CleanupStack::PopAndDestroy( title );
       
  1819 
       
  1820     popupList->EnableAdaptiveFind();
       
  1821     listBox->SetCurrentItemIndex(iCounryListIndex);
       
  1822 
       
  1823     TInt cityGroupId;
       
  1824 
       
  1825     if (iCoverUISupported)
       
  1826         {
       
  1827         TRACES("CStartupAppUi::ShowCountryListL(): Publish country list for Secondary UI");
       
  1828         TPckgBuf<TInt> data( SecondaryDisplay::EShowCountryQuery );
       
  1829         iStartupMediatorObserver->RaiseEvent( SecondaryDisplay::KCatStartup,
       
  1830                                               SecondaryDisplay::EMsgStartupEvent,
       
  1831                                               data );
       
  1832         }
       
  1833 
       
  1834     TRACES("CStartupAppUi::ShowCountryListL(): Show the list");
       
  1835     if (popupList->ExecuteLD())
       
  1836         {
       
  1837         iCounryListIndex = listBox->CurrentItemIndex();
       
  1838         TRACES1("CStartupAppUi::ShowCountryListL(): CurrentItemIndex: %d", iCounryListIndex);
       
  1839         TPtrC countryName = listBox->Model()->ItemText(iCounryListIndex);
       
  1840 
       
  1841         CTzLocalizedCityGroup* tzLocalizedCityGroup = tzLocalizer->FindCityGroupByNameL(countryName);
       
  1842         CleanupStack::PushL(tzLocalizedCityGroup);
       
  1843 
       
  1844         cityGroupId = tzLocalizedCityGroup->Id();
       
  1845         CleanupStack::PopAndDestroy( tzLocalizedCityGroup );
       
  1846 
       
  1847         TRACES1("CStartupAppUi::ShowCountryListL(): Selected country %S", &countryName);
       
  1848         }
       
  1849     else
       
  1850         {
       
  1851         TRACES("CStartupAppUi::ShowCountryListL(): Country list cancelled");
       
  1852         cityGroupId = KErrCancel;
       
  1853         }
       
  1854 
       
  1855     CleanupStack::PopAndDestroy( tzLocalizer );
       
  1856     CleanupStack::Pop( items );
       
  1857     CleanupStack::Pop( popupList );
       
  1858     CleanupStack::PopAndDestroy( listBox ); 
       
  1859 
       
  1860     TRACES1("CStartupAppUi::ShowCountryListL(): End. Return city group id: %d", cityGroupId);
       
  1861     return cityGroupId;
       
  1862     }
       
  1863 
       
  1864 // ---------------------------------------------------------------------------
       
  1865 // CStartupAppUi::ShowCityListL()
       
  1866 // ---------------------------------------------------------------------------
       
  1867 TBool CStartupAppUi::ShowCityListL(TUint8 cityGroupId)
       
  1868     {
       
  1869     TRACES("CStartupAppUi::ShowCityListL()");
       
  1870 
       
  1871     TBool retval( ETrue );
       
  1872 
       
  1873     CTzLocalizer* tzLocalizer = CTzLocalizer::NewL();
       
  1874     CleanupStack::PushL(tzLocalizer);
       
  1875 
       
  1876     CTzLocalizedCityArray* cityList;
       
  1877 
       
  1878     TRACES1("CStartupAppUi::ShowCityListL(): Create list of cities in group %d", cityGroupId);
       
  1879 
       
  1880     cityList = tzLocalizer->GetCitiesInGroupL(cityGroupId,//cityGroup.Id(),
       
  1881                                                   CTzLocalizer::ETzAlphaNameAscending );
       
  1882     CleanupStack::PushL(cityList);
       
  1883 
       
  1884     if ( cityList->Count() == 1 )
       
  1885         {
       
  1886         TRACES("CStartupAppUi::ShowCityListL(): Only one city in citygroup. This can be selected automatically.");
       
  1887 
       
  1888         CTzLocalizedCity& city = cityList->At(0);
       
  1889 
       
  1890         CTzLocalizedCity* tzLocalizedCity = tzLocalizer->FindCityByNameL(city.Name());
       
  1891         CleanupStack::PushL(tzLocalizedCity);
       
  1892 
       
  1893         TInt timeZoneId = tzLocalizedCity->TimeZoneId();
       
  1894 
       
  1895         tzLocalizer->SetTimeZoneL(timeZoneId);
       
  1896         tzLocalizer->SetFrequentlyUsedZoneL(*tzLocalizedCity, CTzLocalizedTimeZone::ECurrentZone);
       
  1897 
       
  1898         CleanupStack::PopAndDestroy( tzLocalizedCity );
       
  1899         CleanupStack::PopAndDestroy( cityList );
       
  1900         CleanupStack::PopAndDestroy( tzLocalizer );
       
  1901 
       
  1902         TRACES1("CStartupAppUi::ShowCityListL(): End, returns %d", retval);
       
  1903         return retval;
       
  1904         }
       
  1905 
       
  1906     CAknSinglePopupMenuStyleListBox* listBox =
       
  1907         new(ELeave) CAknSinglePopupMenuStyleListBox;
       
  1908     CleanupStack::PushL(listBox);
       
  1909 
       
  1910     CStartupPopupList* popupList = CStartupPopupList::NewL(listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
       
  1911                                                            AknPopupLayouts::EMenuGraphicHeadingWindow );
       
  1912 
       
  1913     CleanupStack::PushL(popupList);
       
  1914 
       
  1915     CDesCArrayFlat *items = new(ELeave)CDesCArrayFlat(1);
       
  1916 
       
  1917     CleanupStack::PushL(items);
       
  1918 
       
  1919     for(TInt j = 0; j < cityList->Count(); j++)
       
  1920         {
       
  1921         CTzLocalizedCity& city = cityList->At(j);
       
  1922 
       
  1923         // Check if the city name is blank.
       
  1924         // If it is blank, ignore it. Empty name shouldn't be shown in the list.
       
  1925         if(city.Name().Compare(KEmpty) != 0)
       
  1926             {
       
  1927             TBuf<KMaxCityLength> homecityitem;
       
  1928             homecityitem.Insert(0,city.Name());
       
  1929             TRACES1("CStartupAppUi::ShowCityListL(): Create to list: %S", &homecityitem);
       
  1930             items->AppendL(homecityitem);
       
  1931             }
       
  1932         }
       
  1933 
       
  1934     listBox->ConstructL(popupList, EAknListBoxSelectionList | EAknListBoxScrollBarSizeExcluded);
       
  1935     listBox->CreateScrollBarFrameL( ETrue );
       
  1936     listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
       
  1937                                                         CEikScrollBarFrame::EAuto );
       
  1938 
       
  1939     listBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
       
  1940 
       
  1941     CTextListBoxModel* model=listBox->Model();
       
  1942     model->SetItemTextArray(items);
       
  1943     model->SetOwnershipType(ELbmOwnsItemArray);
       
  1944 
       
  1945     TRACES("CStartupAppUi::ShowCityListL(): Set title");
       
  1946     // Set title
       
  1947     HBufC* title = StringLoader::LoadLC( R_QTN_SU_SELECT_CITY );
       
  1948     popupList->SetTitleL(title->Des());
       
  1949     CleanupStack::PopAndDestroy(title);
       
  1950 
       
  1951     popupList->EnableAdaptiveFind();
       
  1952 
       
  1953     if (iCoverUISupported)
       
  1954         {
       
  1955         TRACES("CStartupAppUi::ShowCountryListL(): Publish city list for Secondary UI");
       
  1956         TPckgBuf<TInt> data( SecondaryDisplay::EShowCityQuery );
       
  1957         iStartupMediatorObserver->RaiseEvent( SecondaryDisplay::KCatStartup,
       
  1958                                               SecondaryDisplay::EMsgStartupEvent,
       
  1959                                               data );
       
  1960         }
       
  1961 
       
  1962     TRACES("CStartupAppUi::ShowCityListL(): Show the list");
       
  1963     if (popupList->ExecuteLD())
       
  1964         {
       
  1965         TInt index(listBox->CurrentItemIndex());
       
  1966         TRACES1("CStartupAppUi::ShowCityListL(): CurrentItemIndex: %d", index);
       
  1967         TPtrC cityName = listBox->Model()->ItemText(index);
       
  1968 
       
  1969         CTzLocalizedCity* tzLocalizedCity = tzLocalizer->FindCityByNameL(cityName);
       
  1970         CleanupStack::PushL(tzLocalizedCity);
       
  1971 
       
  1972         TInt timeZoneId = tzLocalizedCity->TimeZoneId();
       
  1973 
       
  1974         tzLocalizer->SetTimeZoneL(timeZoneId);
       
  1975         tzLocalizer->SetFrequentlyUsedZoneL(*tzLocalizedCity, CTzLocalizedTimeZone::ECurrentZone);
       
  1976 
       
  1977         CleanupStack::PopAndDestroy(tzLocalizedCity);
       
  1978 
       
  1979         TRACES1("CStartupAppUi::ShowCityListL(): Selected city    %S", &cityName);
       
  1980         }
       
  1981     else
       
  1982         {
       
  1983         TRACES("CStartupAppUi::ShowCityListL(): City list cancelled");
       
  1984         retval = EFalse;
       
  1985         }
       
  1986 
       
  1987     CleanupStack::Pop(items);
       
  1988     CleanupStack::Pop(popupList);
       
  1989     CleanupStack::PopAndDestroy(listBox);
       
  1990     CleanupStack::PopAndDestroy(cityList);
       
  1991     CleanupStack::PopAndDestroy(tzLocalizer);
       
  1992 
       
  1993 
       
  1994     TRACES("CStartupAppUi::ShowCityListL(): Home city selected");
       
  1995     TRACES1("CStartupAppUi::ShowCityListL(): End, return %d", retval);
       
  1996     return retval;
       
  1997     }
       
  1998 
       
  1999 // ---------------------------------------------------------------------------
       
  2000 // CStartupAppUi::ShowTimeQueryL()
       
  2001 // ---------------------------------------------------------------------------
       
  2002 TBool CStartupAppUi::ShowTimeQueryL()
       
  2003     {
       
  2004     TRACES("CStartupAppUi::ShowTimeQueryL()");
       
  2005 
       
  2006     TTime time;
       
  2007     GetDefaultTimeAndDate( time );
       
  2008 
       
  2009     CStartupQueryDialog* dlg = new (ELeave) CStartupQueryDialog(time, CAknQueryDialog::ENoTone);
       
  2010     TRACES("CStartupAppUi::ShowTimeQueryL(): Publish dialog for Secondary UI");
       
  2011     dlg->PublishDialogL(SecondaryDisplay::ECmdShowTimeQuery, SecondaryDisplay::KCatStartup);
       
  2012     if( dlg->ExecuteLD( R_STARTUP_TIME_SETTING_QUERY ) )
       
  2013         {
       
  2014         TTime current;
       
  2015         current.HomeTime();
       
  2016         TDateTime cTime = current.DateTime();
       
  2017         TDateTime atime = time.DateTime();
       
  2018         atime.SetYear(cTime.Year());
       
  2019         atime.SetMonth(cTime.Month());
       
  2020         atime.SetDay(cTime.Day());
       
  2021         time = atime;
       
  2022 
       
  2023         RTz rtz;
       
  2024         User::LeaveIfError(rtz.Connect());
       
  2025         User::LeaveIfError(rtz.SetHomeTime(time));
       
  2026         rtz.Close();
       
  2027 
       
  2028         TRACES("CStartupAppUi::ShowTimeQueryL(): End, return ETrue");
       
  2029         return ETrue;
       
  2030         }
       
  2031     else
       
  2032         {
       
  2033         //in case of poweroff key was pressed and shutdown is occuring
       
  2034         TRACES("CStartupAppUi::ShowTimeQueryL(): End, return EFalse");
       
  2035         return EFalse;
       
  2036         }
       
  2037     }
       
  2038 
       
  2039 // ---------------------------------------------------------------------------
       
  2040 // CStartupAppUi::ShowDateQueryL()
       
  2041 // ---------------------------------------------------------------------------
       
  2042 TBool CStartupAppUi::ShowDateQueryL()
       
  2043     {
       
  2044     TRACES("CStartupAppUi::ShowDateQueryL()");
       
  2045 
       
  2046 
       
  2047     CStartupQueryDialog* dlg = new (ELeave) CStartupQueryDialog(iTime, CAknQueryDialog::ENoTone);
       
  2048     TRACES("CStartupAppUi::ShowDateQueryL(): Publish dialog for Secondary UI");
       
  2049     dlg->PublishDialogL(SecondaryDisplay::ECmdShowDateQuery, SecondaryDisplay::KCatStartup);
       
  2050 
       
  2051     TInt query( R_STARTUP_DATE_SETTING_QUERY_NOBACK );
       
  2052     if ( iFirstBoot ) 
       
  2053         {
       
  2054         query = R_STARTUP_DATE_SETTING_QUERY;
       
  2055         }
       
  2056 
       
  2057     if( dlg->ExecuteLD( query ) )
       
  2058         {
       
  2059         TTime current;
       
  2060         current.HomeTime();
       
  2061         TDateTime cTime = current.DateTime();
       
  2062         TDateTime atime = iTime.DateTime();
       
  2063         atime.SetHour(cTime.Hour());
       
  2064         atime.SetMinute(cTime.Minute());
       
  2065         atime.SetSecond(cTime.Second());
       
  2066         atime.SetMicroSecond(cTime.MicroSecond());
       
  2067         iTime = atime;
       
  2068 
       
  2069         RTz rtz;
       
  2070         User::LeaveIfError(rtz.Connect());
       
  2071         User::LeaveIfError(rtz.SetHomeTime(iTime));
       
  2072         rtz.Close();
       
  2073 
       
  2074         TRACES("CStartupAppUi::ShowDateQueryL(): End, return ETrue");
       
  2075         return ETrue;
       
  2076         }
       
  2077     else
       
  2078         {
       
  2079         // Back key pressed. ( Or poweroff key was pressed and shutdown is occuring )
       
  2080         TRACES("CStartupAppUi::ShowDateQueryL(): End, return EFalse");
       
  2081         return EFalse;
       
  2082         }
       
  2083     }
       
  2084 
       
  2085 // ---------------------------------------------------------------------------
       
  2086 // CStartupAppUi::GetDefaultTimeAndDate()
       
  2087 // ---------------------------------------------------------------------------
       
  2088 void CStartupAppUi::GetDefaultTimeAndDate( TTime& aTime )
       
  2089     {
       
  2090     TRACES("CStartupAppUi::GetDefaultTimeAndDate(): Get Time and Date from CenRep");
       
  2091 
       
  2092     CRepository* repository(NULL);
       
  2093 
       
  2094     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
       
  2095     if ( !err )
       
  2096         {
       
  2097         TBuf<KTimeFormatLength> buf;
       
  2098         err = repository->Get( KStartupDefaultTime, buf );
       
  2099         if( !err )
       
  2100             {
       
  2101             err = aTime.Set(buf); // returns error if cenrep time format not valid
       
  2102             }
       
  2103         }
       
  2104 
       
  2105     if ( err )
       
  2106         {
       
  2107         TRACES("CStartupAppUi::GetDefaultTimeAndDate(): Failed to get valid data from CenRep. Using default");
       
  2108         aTime.Set(KDefaultDateTimeValue);
       
  2109         }
       
  2110 
       
  2111     delete repository;
       
  2112     TRACES("CStartupAppUi::GetDefaultTimeAndDate(): End");
       
  2113     }
   918 
  2114 
   919 // ---------------------------------------------------------------------------
  2115 // ---------------------------------------------------------------------------
   920 // CStartupAppUi::FirstBoot()
  2116 // CStartupAppUi::FirstBoot()
   921 // ---------------------------------------------------------------------------
  2117 // ---------------------------------------------------------------------------
   922 TBool CStartupAppUi::FirstBoot()
  2118 TBool CStartupAppUi::FirstBoot()
  1014     delete repository;
  2210     delete repository;
  1015     TRACES("CStartupAppUi::MarkFirstBoot(): End");
  2211     TRACES("CStartupAppUi::MarkFirstBoot(): End");
  1016     }
  2212     }
  1017 
  2213 
  1018 
  2214 
  1019 
  2215 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1020 // ---------------------------------------------------------------------------
  2216 // ---------------------------------------------------------------------------
  1021 // CStartupAppUi::AnimationFinished()
  2217 // CStartupAppUi::AnimationFinished()
  1022 // ---------------------------------------------------------------------------
  2218 // ---------------------------------------------------------------------------
  1023 void CStartupAppUi::AnimationFinished()
  2219 void CStartupAppUi::AnimationFinished()
  1024     {
  2220     {
  1056         {
  2252         {
  1057         TRAP(err, DoNextStartupPhaseL( EStartupShowingOperatorAnimation ));
  2253         TRAP(err, DoNextStartupPhaseL( EStartupShowingOperatorAnimation ));
  1058         }
  2254         }
  1059     else if ( iInternalState == EStartupShowingOperatorAnimation )
  2255     else if ( iInternalState == EStartupShowingOperatorAnimation )
  1060         {
  2256         {
  1061         TRAP(err, DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck));
  2257         TRAP(err, DoNextStartupPhaseL( EStartupShowingUserWelcomeNote ));
  1062         }
  2258         }
  1063 
  2259 
  1064     if ( err != KErrNone )
  2260     if ( err != KErrNone )
  1065         {
  2261         {
  1066         TRAP_IGNORE( DoNextStartupPhaseL(EStartupSystemFatalError) );
  2262         TRAP_IGNORE( DoNextStartupPhaseL(EStartupSystemFatalError) );
  1067         }
  2263         }
  1068 
  2264 
  1069     TRACES("CStartupAppUi::AnimationFinished(): End");
  2265     TRACES("CStartupAppUi::AnimationFinished(): End");
  1070     }
  2266     }
       
  2267 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2268 // ---------------------------------------------------------------------------
       
  2269 // CStartupAppUi::StopStartupTone()
       
  2270 // ---------------------------------------------------------------------------
       
  2271 void CStartupAppUi::StopStartupTone()
       
  2272     {
       
  2273     TRACES("CStartupAppUi::StopStartupTone()");
       
  2274     if ((iStartupTone) && (iStartupTone->Playing()))
       
  2275         {
       
  2276         iStartupTone->Stop();
       
  2277         }
       
  2278     TRACES("CStartupAppUi::StopStartupTone(): End");
       
  2279     }
       
  2280 
       
  2281 // ---------------------------------------------------------------------------
       
  2282 // CStartupAppUi::StopOperatorTone()
       
  2283 // ---------------------------------------------------------------------------
       
  2284 void CStartupAppUi::StopOperatorTone()
       
  2285     {
       
  2286     TRACES("CStartupAppUi::StopOperatorTone()");
       
  2287     if ((iOpStartupTone) && (iOpStartupTone->Playing()))
       
  2288         {
       
  2289         iOpStartupTone->Stop();
       
  2290         }
       
  2291     TRACES("CStartupAppUi::StopOperatorTone(): End");
       
  2292     }
       
  2293 
       
  2294 // ---------------------------------------------------------------------------
       
  2295 // CStartupAppUi::StartupTonePlaying()
       
  2296 // ---------------------------------------------------------------------------
       
  2297 TBool CStartupAppUi::StartupTonePlaying()
       
  2298     {
       
  2299     TRACES("CStartupAppUi::StartupTonePlaying()");
       
  2300     return iStartupTone->Playing();
       
  2301     }
       
  2302 
       
  2303 // ---------------------------------------------------------------------------
       
  2304 // CStartupAppUi::OperatorTonePlaying()
       
  2305 // ---------------------------------------------------------------------------
       
  2306 TBool CStartupAppUi::OperatorTonePlaying()
       
  2307     {
       
  2308     TRACES("CStartupAppUi::OperatorTonePlaying()");
       
  2309     return iOpStartupTone->Playing();
       
  2310     }
       
  2311 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1071 
  2312 
  1072 // ---------------------------------------------------------------------------
  2313 // ---------------------------------------------------------------------------
  1073 // CStartupAppUi::SetCleanBoot()
  2314 // CStartupAppUi::SetCleanBoot()
  1074 // ---------------------------------------------------------------------------
  2315 // ---------------------------------------------------------------------------
  1075 void CStartupAppUi::SetCleanBoot()
  2316 void CStartupAppUi::SetCleanBoot()
  1086     {
  2327     {
  1087     TRACES("CStartupAppUi::SimSupported()");
  2328     TRACES("CStartupAppUi::SimSupported()");
  1088     return iSimSupported;
  2329     return iSimSupported;
  1089     }
  2330     }
  1090 
  2331 
  1091 
  2332 // ----------------------------------------------------------------------------
       
  2333 // CStartupAppUi::CoverUISupported()
       
  2334 // ----------------------------------------------------------------------------
       
  2335 TBool CStartupAppUi::CoverUISupported()
       
  2336     {
       
  2337     TRACES("CStartupAppUi::CoverUISupported()");
       
  2338     return iCoverUISupported;
       
  2339     }
  1092 
  2340 
  1093 // ---------------------------------------------------------------------------
  2341 // ---------------------------------------------------------------------------
  1094 // CStartupAppUi::DoNextStartupPhaseL( TStartupInternalState toState )
  2342 // CStartupAppUi::DoNextStartupPhaseL( TStartupInternalState toState )
  1095 // State#                                Possible next states
  2343 // State#                                Possible next states
  1096 
  2344 
  1098 // 0    EStartupStartingUp               1, 18
  2346 // 0    EStartupStartingUp               1, 18
  1099 // 1    EStartupWaitingCriticalBlock     5, 18
  2347 // 1    EStartupWaitingCriticalBlock     5, 18
  1100 // 5    EStartupWaitingTouchScreenCalib
  2348 // 5    EStartupWaitingTouchScreenCalib
  1101 // 6    EStartupWaitingPhoneLightIdle    8, 18
  2349 // 6    EStartupWaitingPhoneLightIdle    8, 18
  1102 // 8    EStartupOfflineModeQuery         9, 18
  2350 // 8    EStartupOfflineModeQuery         9, 18
  1103 // 9    EStartupWaitingCUIWelcomeAnim    10, 18 Removed
  2351 // 9    EStartupWaitingCUIWelcomeAnim    10, 18
  1104 // 10   EStartupWaitingStartupTone       11, 18
  2352 // 10   EStartupWaitingStartupTone       11, 18
  1105 // 11   EStartupShowingWelcomeAnimation  12, 14, 18
  2353 // 11   EStartupShowingWelcomeAnimation  12, 14, 18
  1106 // 12   EStartupWaitingCUIOperatorAnim   13, 18
  2354 // 12   EStartupWaitingCUIOperatorAnim   13, 18
  1107 // 13   EStartupShowingOperatorAnimation 14, 14, 18
  2355 // 13   EStartupShowingOperatorAnimation 14, 14, 18
  1108 // 14   EStartupShowingUserWelcomeNote   15, 18 Removed
  2356 // 14   EStartupShowingUserWelcomeNote   15, 18
  1109 // 15   EStartupFirstBootAndRTCCheck     16, 18
  2357 // 15   EStartupFirstBootAndRTCCheck     16, 18
  1110 // 16   EStartupWaitingCUIStartupReady   17, 18 Removed
  2358 // 16   EStartupWaitingCUIStartupReady   17, 18
  1111 // 17   EStartupStartupOK                -
  2359 // 17   EStartupStartupOK                -
  1112 // 18   EStartupSystemFatalError         -
  2360 // 18   EStartupSystemFatalError         -
  1113 
  2361 
  1114 // ---------------------------------------------------------------------------
  2362 // ---------------------------------------------------------------------------
  1115 
  2363 
  1141             break;
  2389             break;
  1142         case EStartupWaitingCriticalBlock:
  2390         case EStartupWaitingCriticalBlock:
  1143             {
  2391             {
  1144             switch( toState )
  2392             switch( toState )
  1145                 {
  2393                 {
  1146                 case EStartupStartupOK:
  2394                 case EStartupWaitingCUIStartupReady:
  1147                     iInternalState = EStartupStartupOK;
  2395                     iInternalState = EStartupWaitingCUIStartupReady;
  1148                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupStartupOK");
  2396                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingCUIStartupReady");
  1149                     DoStartupEndPart();
  2397                     WaitingCoverUIStartupReadySyncL();
  1150                     break;
  2398                     break;
  1151 
  2399 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2400                 case EStartupWaitingTouchScreenCalib:
       
  2401                     iInternalState = EStartupWaitingTouchScreenCalib;
       
  2402                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingTouchScreenCalib");
       
  2403                     WaitingTouchScreenCalibL();
       
  2404                     break;
       
  2405                 case EStartupSystemFatalError:
       
  2406                     SystemFatalErrorL();
       
  2407                     break;
       
  2408                 default:
       
  2409                     __ASSERT_DEBUG(
       
  2410                         EFalse,
       
  2411                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2412                     break;
       
  2413                 }
       
  2414             }
       
  2415             break;
       
  2416         case EStartupWaitingTouchScreenCalib:
       
  2417             {
       
  2418             switch( toState )
       
  2419                 {
       
  2420 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1152                 case EStartupOfflineModeQuery:
  2421                 case EStartupOfflineModeQuery:
  1153                     iInternalState = EStartupOfflineModeQuery;
  2422                     iInternalState = EStartupOfflineModeQuery;
  1154                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupOfflineModeQuery");
  2423                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupOfflineModeQuery");
  1155                     ShowOfflineModeQueryL();
  2424                     ShowOfflineModeQueryL();
  1156 
  2425 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1157                     DoNextStartupPhaseL( EStartupWaitingShowStartupAnimation );
  2426                     DoNextStartupPhaseL( EStartupWaitingShowStartupAnimation );
       
  2427 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2428                     DoNextStartupPhaseL( EStartupWaitingCUIWelcomeAnim );
       
  2429 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1158                     break;
  2430                     break;
  1159                 case EStartupSystemFatalError:
  2431                 case EStartupSystemFatalError:
  1160                     SystemFatalErrorL();
  2432                     SystemFatalErrorL();
  1161                     break;
  2433                     break;
  1162                 default:
  2434                 default:
  1169             break;
  2441             break;
  1170         case EStartupOfflineModeQuery:
  2442         case EStartupOfflineModeQuery:
  1171             {
  2443             {
  1172             switch( toState )
  2444             switch( toState )
  1173                 {
  2445                 {
  1174 
  2446 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1175                 case EStartupWaitingShowStartupAnimation:
  2447                 case EStartupWaitingShowStartupAnimation:
  1176                     iInternalState = EStartupWaitingShowStartupAnimation;
  2448                     iInternalState = EStartupWaitingShowStartupAnimation;
  1177                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingShowStartupAnimation");
  2449                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingShowStartupAnimation");
  1178                     WaitingStartupAnimationStartL();
  2450                     WaitingStartupAnimationStartL();
  1179                     break;
  2451                     break;
  1180               case EStartupSystemFatalError:
  2452 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2453                 case EStartupWaitingCUIWelcomeAnim:
       
  2454                     iInternalState = EStartupWaitingCUIWelcomeAnim;
       
  2455                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingCUIWelcomeAnim");
       
  2456                     WaitingCoverUIWelcomeAnimationSyncL();
       
  2457                     break;
       
  2458 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2459                 case EStartupSystemFatalError:
  1181                     SystemFatalErrorL();
  2460                     SystemFatalErrorL();
  1182                     break;
  2461                     break;
  1183                 default:
  2462                 default:
  1184                     __ASSERT_DEBUG(
  2463                     __ASSERT_DEBUG(
  1185                         EFalse,
  2464                         EFalse,
  1186                         PANIC( EStartupInvalidInternalStateChange ) );
  2465                         PANIC( EStartupInvalidInternalStateChange ) );
  1187                     break;
  2466                     break;
  1188                 }
  2467                 }
  1189             }
  2468             }
  1190             break;
  2469             break;
       
  2470 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2471         case EStartupWaitingCUIWelcomeAnim:
       
  2472             {
       
  2473             switch( toState )
       
  2474                 {
       
  2475                 case EStartupWaitingStartupTone:
       
  2476                     iInternalState = EStartupWaitingStartupTone;
       
  2477                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingStartupTone");
       
  2478                     WaitingStartupToneL();
       
  2479                     break;
       
  2480                 case EStartupSystemFatalError:
       
  2481                     SystemFatalErrorL();
       
  2482                     break;
       
  2483                 default:
       
  2484                     __ASSERT_DEBUG( EFalse,
       
  2485                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2486                     break;
       
  2487                 }
       
  2488             }
       
  2489             break;
       
  2490         case EStartupWaitingStartupTone:
       
  2491             {
       
  2492             switch( toState )
       
  2493                 {
       
  2494                 case EStartupShowingWelcomeAnimation:
       
  2495                     iInternalState = EStartupShowingWelcomeAnimation;
       
  2496                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupShowingWelcomeAnimation");
       
  2497                     iWelcomeAnimation->UpdateDrawInfo( EStartupDIWelcomeAnimStart );
       
  2498                     iWelcomeAnimation->DrawNow();
       
  2499                     DoStartupShowWelcomeAnimationL();
       
  2500                     iWelcomeAnimation->UpdateDrawInfo( EStartupDIWelcomeAnimEnd );
       
  2501                     iWelcomeAnimation->DrawNow();
       
  2502                     break;
       
  2503                 case EStartupSystemFatalError:
       
  2504                     SystemFatalErrorL();
       
  2505                     break;
       
  2506                 default:
       
  2507                     __ASSERT_DEBUG( EFalse,
       
  2508                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2509                     break;
       
  2510                 }
       
  2511             }
       
  2512             break;
       
  2513 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1191         case EStartupWaitingShowStartupAnimation:
  2514         case EStartupWaitingShowStartupAnimation:
  1192             {
  2515             {
  1193             switch( toState )
  2516             switch( toState )
  1194                 {
  2517                 {
  1195                 case EStartupShowingWelcomeAnimation:
  2518                 case EStartupShowingWelcomeAnimation:
  1210             break;
  2533             break;
  1211         case EStartupShowingWelcomeAnimation:
  2534         case EStartupShowingWelcomeAnimation:
  1212             {
  2535             {
  1213             switch( toState )
  2536             switch( toState )
  1214                 {
  2537                 {
  1215 
  2538 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1216                 case EStartupShowingOperatorAnimation:
  2539                 case EStartupShowingOperatorAnimation:
  1217                     iInternalState = EStartupShowingOperatorAnimation;
  2540                     iInternalState = EStartupShowingOperatorAnimation;
  1218                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingOperatorAnimation");
  2541                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingOperatorAnimation");
  1219                     DoStartupShowOperatorAnimationL();
  2542                     DoStartupShowOperatorAnimationL();
       
  2543 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2544                 case EStartupWaitingCUIOperatorAnim:
       
  2545                     iOperatorAnimation = CStartupOperatorAnimation::NewL( this, ClientRect());
       
  2546                     AddToStackL( iOperatorAnimation);
       
  2547                     iInternalState = EStartupWaitingCUIOperatorAnim;
       
  2548                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupWaitingCUIOperatorAnim");
       
  2549                     WaitingCoverUIOperatorAnimationSyncL();
       
  2550 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1220                     break;
  2551                     break;
  1221                 case EStartupFirstBootAndRTCCheck:
  2552                 case EStartupFirstBootAndRTCCheck:
  1222                     iInternalState = EStartupFirstBootAndRTCCheck;
  2553                     iInternalState = EStartupFirstBootAndRTCCheck;
  1223                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  2554                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  1224                     DoStartupFirstBootAndRTCCheckL();
  2555                     DoStartupFirstBootAndRTCCheckL();
  1231                         PANIC( EStartupInvalidInternalStateChange ) );
  2562                         PANIC( EStartupInvalidInternalStateChange ) );
  1232                     break;
  2563                     break;
  1233                 }
  2564                 }
  1234             }
  2565             }
  1235             break;
  2566             break;
  1236         case EStartupShowingOperatorAnimation:
  2567 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2568         case EStartupWaitingCUIOperatorAnim:
  1237             {
  2569             {
  1238             switch( toState )
  2570             switch( toState )
  1239                 {
  2571                 {
  1240                 
  2572                 case EStartupShowingOperatorAnimation:
  1241                  
  2573                     iInternalState = EStartupShowingOperatorAnimation;
       
  2574                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingOperatorAnimation");
       
  2575                     iOperatorAnimation->UpdateDrawInfo( EStartupDIOperatorAnimStart );
       
  2576                     DoStartupShowOperatorAnimationL();
       
  2577                     break;
       
  2578                 case EStartupSystemFatalError:
       
  2579                     SystemFatalErrorL();
       
  2580                     break;
       
  2581                 default:
       
  2582                     __ASSERT_DEBUG( EFalse,
       
  2583                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2584                     break;
       
  2585                 }
       
  2586             }
       
  2587             break;
       
  2588 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2589         case EStartupShowingOperatorAnimation:
       
  2590             {
       
  2591             switch( toState )
       
  2592                 {
       
  2593                 case EStartupShowingUserWelcomeNote:
       
  2594 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2595                     iUserWelcomeNote = CStartupUserWelcomeNote::NewL( *this, ClientRect());
       
  2596                     AddToStackL( iUserWelcomeNote );
       
  2597 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2598                     iInternalState = EStartupShowingUserWelcomeNote;
       
  2599                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingUserWelcomeNote");
       
  2600 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2601                     iWelcomeAnimation->UpdateDrawInfo( EStartupDIWelcomeNoteStart );
       
  2602                     iUserWelcomeNote->SetUserWelcomeNoteShowing(ETrue);
       
  2603 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2604                     DoStartupShowUserWelcomeNoteL();
       
  2605                     break;
  1242                 case EStartupFirstBootAndRTCCheck:
  2606                 case EStartupFirstBootAndRTCCheck:
  1243                     iInternalState = EStartupFirstBootAndRTCCheck;
  2607                     iInternalState = EStartupFirstBootAndRTCCheck;
  1244                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  2608                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  1245                     DoStartupFirstBootAndRTCCheckL();
  2609                     DoStartupFirstBootAndRTCCheckL();
  1246                     break;
  2610                     break;
  1252                         PANIC( EStartupInvalidInternalStateChange ) );
  2616                         PANIC( EStartupInvalidInternalStateChange ) );
  1253                     break;
  2617                     break;
  1254                 }
  2618                 }
  1255             }
  2619             }
  1256             break;
  2620             break;
  1257       
  2621         case EStartupShowingUserWelcomeNote:
       
  2622             {
       
  2623             switch( toState )
       
  2624                 {
       
  2625                 case EStartupFirstBootAndRTCCheck:
       
  2626                     iInternalState = EStartupFirstBootAndRTCCheck;
       
  2627                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
       
  2628                     DoStartupFirstBootAndRTCCheckL();
       
  2629                     break;
       
  2630                 case EStartupSystemFatalError:
       
  2631                     SystemFatalErrorL();
       
  2632                     break;
       
  2633                 default:
       
  2634                     __ASSERT_DEBUG( EFalse,
       
  2635                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2636                     break;
       
  2637                 }
       
  2638             }
       
  2639             break;
  1258         case EStartupFirstBootAndRTCCheck:
  2640         case EStartupFirstBootAndRTCCheck:
       
  2641             {
       
  2642             switch( toState )
       
  2643                 {
       
  2644                 case EStartupWaitingCUIStartupReady:
       
  2645                     iInternalState = EStartupWaitingCUIStartupReady;
       
  2646                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingCUIStartupReady");
       
  2647                     WaitingCoverUIStartupReadySyncL();
       
  2648                     break;
       
  2649                 case EStartupSystemFatalError:
       
  2650                     SystemFatalErrorL();
       
  2651                     break;
       
  2652                 default:
       
  2653                     __ASSERT_DEBUG( EFalse,
       
  2654                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2655                     break;
       
  2656                 }
       
  2657             }
       
  2658             break;
       
  2659         case EStartupWaitingCUIStartupReady:
  1259             {
  2660             {
  1260             switch( toState )
  2661             switch( toState )
  1261                 {
  2662                 {
  1262                 case EStartupStartupOK:
  2663                 case EStartupStartupOK:
  1263                         iInternalState = EStartupStartupOK;
  2664                     iInternalState = EStartupStartupOK;
  1264                         TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupInvokeAndWaitForFtu");
  2665                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupStartupOK");
  1265                         DoStartupEndPart();
  2666                     DoStartupEndPart();
  1266                     break;
  2667                     break;
  1267                 case EStartupSystemFatalError:
  2668                 case EStartupSystemFatalError:
  1268                     SystemFatalErrorL();
  2669                     SystemFatalErrorL();
  1269                     break;
  2670                     break;
  1270                 default:
  2671                 default:
  1280                 {
  2681                 {
  1281                 case EStartupStartingUp:
  2682                 case EStartupStartingUp:
  1282                 case EStartupOfflineModeQuery:
  2683                 case EStartupOfflineModeQuery:
  1283                 case EStartupShowingWelcomeAnimation:
  2684                 case EStartupShowingWelcomeAnimation:
  1284                 case EStartupShowingOperatorAnimation:
  2685                 case EStartupShowingOperatorAnimation:
       
  2686                 case EStartupShowingUserWelcomeNote:
  1285                 case EStartupFirstBootAndRTCCheck:
  2687                 case EStartupFirstBootAndRTCCheck:
  1286                 case EStartupWaitingCUIStartupReady:
  2688                 case EStartupWaitingCUIStartupReady:
  1287                 case EStartupStartupOK:
  2689                 case EStartupStartupOK:
  1288                 case EStartupSystemFatalError:
  2690                 case EStartupSystemFatalError:
  1289                     //no need to continue, because state is
  2691                     //no need to continue, because state is
  1335         }
  2737         }
  1336     TRACES1( "CStartupAppUi::SimStatusChangedReset(): End, return %d", ret_val );
  2738     TRACES1( "CStartupAppUi::SimStatusChangedReset(): End, return %d", ret_val );
  1337     return ret_val;
  2739     return ret_val;
  1338     }
  2740     }
  1339 
  2741 
  1340 
  2742 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1341 // ---------------------------------------------------------------------------
  2743 // ---------------------------------------------------------------------------
  1342 // CStartupAppUi::UpdateStartupUiPhase()
  2744 // CStartupAppUi::UpdateStartupUiPhase()
  1343 // ---------------------------------------------------------------------------
  2745 // ---------------------------------------------------------------------------
  1344 void CStartupAppUi::UpdateStartupUiPhase( TInt aValue )
  2746 void CStartupAppUi::UpdateStartupUiPhase( TInt aValue )
  1345     {
  2747     {
  1350     if( KErrNone != err )
  2752     if( KErrNone != err )
  1351         {
  2753         {
  1352         TRACES1("CStartupAppUi::UpdateStartupUiPhase(): KPSStartupUiPhase set err %d", err);
  2754         TRACES1("CStartupAppUi::UpdateStartupUiPhase(): KPSStartupUiPhase set err %d", err);
  1353         }                          
  2755         }                          
  1354     }
  2756     }
  1355 
  2757 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1356 // End of file
  2758 // End of file