startupservices/Startup/src/StartupAppUi.cpp
branchRCL_3
changeset 62 924385140d98
parent 58 0818dd463d41
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // SYSTEM INCLUDES
    19 // SYSTEM INCLUDES
    20 #include <StringLoader.h>
    20 #include <StringLoader.h>
    21 #include <AknGlobalNote.h>          //used for Selftest failed note
    21 
    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>
       
    29 #include <featmgr.h>                // Feature Manager
    22 #include <featmgr.h>                // Feature Manager
    30 #include <centralrepository.h>
    23 #include <centralrepository.h>
    31 #include <startup.rsg>
    24 #include <startup.rsg>
    32 #include <starterdomaincrkeys.h>
    25 #include <starterdomaincrkeys.h>
    33 #include "startupappprivatepskeys.h"
    26 #include "startupappprivatepskeys.h"
    34 #include <startupdomainpskeys.h>
    27 #include <startupdomainpskeys.h>
    35 #include <startupdomaincrkeys.h>
    28 #include <startupdomaincrkeys.h>
    36 #include <CoreApplicationUIsSDKCRKeys.h>
    29 #include <CoreApplicationUIsSDKCRKeys.h>
    37 #include <starterclient.h>
    30 #include <starterclient.h>
    38 #include "StartupWelcomeCrKeys.h"
    31 #include <hbdevicemessageboxsymbian.h>
    39 
    32 #include "sanimstartupctrl.h"
    40 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
    33 #include <apgtask.h>
    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
       
    52 
    34 
    53 // USER INCLUDES
    35 // USER INCLUDES
    54 #include "StartupAppUi.h"
    36 #include "StartupAppUi.h"
    55 #include "StartupApplication.h"
    37 #include "StartupApplication.h"
    56 #include "StartupUserWelcomeNote.h"
    38 
    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"
       
    60 #include "StartupPubSubObserver.h"
    39 #include "StartupPubSubObserver.h"
    61 
    40 #include "startupanimationwrapper.h"
    62 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
    41 #include "startupview.h"
    63   #include "startupanimationwrapper.h"
    42   
    64   #include "startupview.h"
    43 #include <eikenv.h>
    65 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
    44 
    66   #include "StartupDocument.h"
    45 
    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
       
    85 static const CSAnimStartupCtrl::TAnimationParams KStartupAnimationParams =
    46 static const CSAnimStartupCtrl::TAnimationParams KStartupAnimationParams =
    86     {
    47     {
    87     KCRUidStartupConf,
    48     KCRUidStartupConf,
    88     KStartupAnimationPath,
    49     KStartupAnimationPath,
    89     KStartupAnimationFrameDelay,
    50     KStartupAnimationFrameDelay,
    90     KStartupAnimationScaling,
    51     KStartupAnimationScaling,
    91     KStartupTonePath,
    52     KStartupTonePath,
    92     KStartupToneVolume
    53     KStartupToneVolume
    93     };
    54     };
    94 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    55 
    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."
       
   103 
    56 
   104 _LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData);
    57 _LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData);
   105 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
    58 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
   106 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
    59 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
   107 
    60 
   108 // ======== LOCAL FUNCTIONS ==================================================
    61 // ======== LOCAL FUNCTIONS ==================================================
   109 
    62 
   110 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   111 namespace
    63 namespace
   112     {
    64     {
   113     TInt AnimationFinishedFunc( TAny* aPtr )
    65     TInt AnimationFinishedFunc( TAny* aPtr )
   114         {
    66         {
   115         static_cast<CStartupAppUi*>( aPtr )->AnimationFinished();
    67         static_cast<CStartupAppUi*>( aPtr )->AnimationFinished();
   116         return KErrNone;
    68         return KErrNone;
   117         }
    69         }
   118     }
    70     }
   119 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
    71 
   120 
    72 
   121 
    73 
   122 // ================= MEMBER FUNCTIONS ========================================
    74 // ================= MEMBER FUNCTIONS ========================================
   123 //
    75 //
   124 // ---------------------------------------------------------------------------
    76 // ---------------------------------------------------------------------------
   125 // CStartupAppUi::CStartupAppUi()
    77 // CStartupAppUi::CStartupAppUi()
   126 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
   127 CStartupAppUi::CStartupAppUi() :
    79 CStartupAppUi::CStartupAppUi() :
   128     iUserWelcomeNote( NULL ),
    80    iInternalState( EStartupStartingUp ),
   129 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
    81 
   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
       
   139     iStartupFirstBootAndRTCCheckAlreadyCalled( EFalse ),
    82     iStartupFirstBootAndRTCCheckAlreadyCalled( EFalse ),
   140     iChargingOrAlarmBoot( EFalse ),
    83     iChargingOrAlarmBoot( EFalse ),
   141     iFirstBoot( ETrue ),
    84     iFirstBoot( ETrue ),
   142     iCleanBoot( EStartupNormalBoot ),
    85     iCleanBoot( EStartupNormalBoot ),
   143     iOfflineModeSupported( EFalse ),
    86     iOfflineModeSupported( EFalse ),
   144     iOfflineModeQueryShown( EFalse ),
    87     iOfflineModeQueryShown( EFalse ),
   145     iCriticalBlockEnded( EFalse ),
    88     iCriticalBlockEnded( EFalse ),
   146     iSwStateFatalStartupError( EFalse ),
    89     iSwStateFatalStartupError( EFalse ),
   147     iStartupWaitingShowStartupAnimation( EFalse ),
    90     iStartupWaitingShowStartupAnimation( EFalse ),
   148     iSimSupported( ETrue ),
    91     iSimSupported( ETrue )
   149     iStartupMediatorObserver( NULL ),
    92 
   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
       
   157     {
    93     {
   158     TRACES("CStartupAppUi::CStartupAppUi");
    94     TRACES("CStartupAppUi::CStartupAppUi");
   159     }
    95     }
   160 
    96 
   161 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   162 // CStartupAppUi::ConstructL()
    98 // CStartupAppUi::ConstructL()
   163 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
   164 void CStartupAppUi::ConstructL()
   100 void CStartupAppUi::ConstructL()
   165     {
   101     {
       
   102     RThread thread; //increase the thread priority to smooth the animation
       
   103     thread.SetPriority(EPriorityAbsoluteForeground);
       
   104     thread.Close();
   166     TRACES("CStartupAppUi::ConstructL()");
   105     TRACES("CStartupAppUi::ConstructL()");
   167     TInt flags = EStandardApp|EAknEnableSkin|EAknEnableMSK ;
   106     TInt flags = EStandardApp;
   168 
   107    BaseConstructL( flags );
   169     BaseConstructL(flags);
   108         
   170 
       
   171     iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort |
       
   172                                    CAknAppUiBase::EDisableSendKeyLong );
       
   173 
       
   174 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   175     iMainView = CStartupView::NewL( ApplicationRect() );
   109     iMainView = CStartupView::NewL( ApplicationRect() );
       
   110     
       
   111    
   176     iAnimation = CStartupAnimationWrapper::NewL( *iMainView );
   112     iAnimation = CStartupAnimationWrapper::NewL( *iMainView );
   177 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   113 
   178 
   114 
   179     TInt err = RProperty::Define( KPSUidStartupApp,
   115     TInt err = RProperty::Define( KPSUidStartupApp,
   180                                   KPSStartupAppState,
   116                                   KPSStartupAppState,
   181                                   RProperty::EInt,
   117                                   RProperty::EInt,
   182                                   KReadDeviceDataPolicy,
   118                                   KReadDeviceDataPolicy,
   197         TRACES1("CStartupAppUi::ConstructL(): KPSStartupAppState set err %d", err);
   133         TRACES1("CStartupAppUi::ConstructL(): KPSStartupAppState set err %d", err);
   198         }
   134         }
   199 
   135 
   200     iStartupPubSubObserver = CStartupPubSubObserver::NewL( this );
   136     iStartupPubSubObserver = CStartupPubSubObserver::NewL( this );
   201 
   137 
   202 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   138 
   203     err = RProperty::Define( KPSUidStartup,
   139 
   204                              KStartupBootIntoOffline,
   140 
   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
       
   238     err = RProperty::Define( KPSUidStartup,
   141     err = RProperty::Define( KPSUidStartup,
   239                              KPSStartupUiPhase,
   142                              KPSStartupUiPhase,
   240                              RProperty::EInt, 
   143                              RProperty::EInt, 
   241                              KAlwaysPassPolicy,
   144                              KAlwaysPassPolicy,
   242                              KWriteDeviceDataPolicy );
   145                              KWriteDeviceDataPolicy );
   246         {
   149         {
   247         TRACES1("CStartupAppUi::ConstructL(): KPSStartupUiPhase define err %d", err);       
   150         TRACES1("CStartupAppUi::ConstructL(): KPSStartupUiPhase define err %d", err);       
   248         }
   151         }
   249     
   152     
   250     UpdateStartupUiPhase( EStartupUiPhaseUninitialized );
   153     UpdateStartupUiPhase( EStartupUiPhaseUninitialized );
   251 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   154 
   252 
   155 
   253     FeatureManager::InitializeLibL();
   156     FeatureManager::InitializeLibL();
   254     if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
   157     if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
   255         {
   158         {
   256         iOfflineModeSupported = ETrue;
   159         iOfflineModeSupported = ETrue;
   257         }
   160         }
   258     if ( !FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   161     if ( !FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   259         {
   162         {
   260         iSimSupported = EFalse;
   163         iSimSupported = EFalse;
   261         }
   164         }
   262     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
   165     
   263         {
       
   264         iCoverUISupported = ETrue;
       
   265         }
       
   266 
   166 
   267     TRACES1("CStartupAppUi::ConstructL(): Offline mode supported: %d", iOfflineModeSupported );
   167     TRACES1("CStartupAppUi::ConstructL(): Offline mode supported: %d", iOfflineModeSupported );
   268     TRACES1("CStartupAppUi::ConstructL(): SIM card supported:     %d", iSimSupported );
   168     TRACES1("CStartupAppUi::ConstructL(): SIM card supported:     %d", iSimSupported );
   269     TRACES1("CStartupAppUi::ConstructL(): CoverUI supported:      %d", iCoverUISupported );
   169     
   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         }
       
   283 
   170 
   284     iFirstBoot = FirstBoot();
   171     iFirstBoot = FirstBoot();
   285     TRACES1("CStartupAppUi::ConstructL(): First boot:             %d", iFirstBoot );
   172     TRACES1("CStartupAppUi::ConstructL(): First boot:             %d", iFirstBoot );
   286 
   173 
   287 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   174 
   288     iWelcomeAnimation = CStartupWelcomeAnimation::NewL( this, ClientRect());
   175     CEikonEnv* eikEnv = CEikonEnv::Static();
   289     AddToStackL( iWelcomeAnimation );
       
   290 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   291 
   176 
   292     // Set Startup application to be system application
   177     // Set Startup application to be system application
   293     iEikonEnv->SetSystem( ETrue );
   178     eikEnv->SetSystem( ETrue );
   294 
   179 
   295     iEikonEnv->RootWin().SetOrdinalPosition(0,0);
   180     eikEnv->RootWin().SetOrdinalPosition(0,0);
   296 
   181 
   297     // Disable priority changes of window server
   182     // Disable priority changes of window server
   298     iEikonEnv->WsSession().ComputeMode(
   183     eikEnv->WsSession().ComputeMode(
   299         RWsSession::EPriorityControlDisabled );
   184         RWsSession::EPriorityControlDisabled );
   300 
   185    iNoteTimer = CPeriodic::NewL( EPriorityNormal );
   301     iNoteTimer = CPeriodic::NewL( EPriorityNormal );
   186 
   302 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   303     iAnimTimer = CPeriodic::NewL( EPriorityNormal );
       
   304 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   305     iExitTimer = CPeriodic::NewL( EPriorityNormal );
   187     iExitTimer = CPeriodic::NewL( EPriorityNormal );
   306 
   188 
   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
       
   316 
   189 
   317     if ( iSwStateFatalStartupError )
   190     if ( iSwStateFatalStartupError )
   318         {
   191         {
   319         TRACES("CStartupAppUi::ConstructL(): ESWStateFatalStartupError");
   192         TRACES("CStartupAppUi::ConstructL(): ESWStateFatalStartupError");
   320         DoNextStartupPhaseL( EStartupSystemFatalError );
   193         DoNextStartupPhaseL( EStartupSystemFatalError );
   332 // ---------------------------------------------------------------------------
   205 // ---------------------------------------------------------------------------
   333 CStartupAppUi::~CStartupAppUi()
   206 CStartupAppUi::~CStartupAppUi()
   334     {
   207     {
   335     TRACES("CStartupAppUi::~CStartupAppUi()");
   208     TRACES("CStartupAppUi::~CStartupAppUi()");
   336 
   209 
   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
       
   374 
   210 
   375     if( iExitTimer )
   211     if( iExitTimer )
   376         {
   212         {
   377         iExitTimer->Cancel();
   213         iExitTimer->Cancel();
   378         delete iExitTimer;
   214         delete iExitTimer;
   379         }
   215         }
   380 
   216 
   381 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   217 
   382     if( iAnimTimer )
       
   383         {
       
   384         iAnimTimer->Cancel();
       
   385         delete iAnimTimer;
       
   386         }
       
   387 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   388 
   218 
   389     if( iNoteTimer )
   219     if( iNoteTimer )
   390         {
   220         {
   391         iNoteTimer->Cancel();
   221         iNoteTimer->Cancel();
   392         delete iNoteTimer;
   222         delete iNoteTimer;
   393         }
   223         }
   394 
   224 
   395 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   225 
   396     delete iUserWelcomeNote;
   226  
   397     delete iAnimation;
   227     delete iAnimation;
   398     delete iStartupPubSubObserver;
   228     delete iStartupPubSubObserver;
   399     delete iStartupMediatorObserver;
   229    
   400     delete iMainView;
   230     delete iMainView;
   401 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   231 
   402 
   232 
   403     FeatureManager::UnInitializeLib();
   233     FeatureManager::UnInitializeLib();
   404 
   234 
   405     TRACES("CStartupAppUi::~CStartupAppUi(): End");
   235     TRACES("CStartupAppUi::~CStartupAppUi(): End");
   406     }
   236     }
   410 // ---------------------------------------------------------------------------
   240 // ---------------------------------------------------------------------------
   411 void CStartupAppUi::PrepareToExit()
   241 void CStartupAppUi::PrepareToExit()
   412     {
   242     {
   413     TRACES("CStartupAppUi::PrepareToExit()");
   243     TRACES("CStartupAppUi::PrepareToExit()");
   414 
   244 
   415 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
   245 
   416     // Start the custom exit effect at boot time.
   246 
   417     // Note: Not allowed to call GfxTransEffect::EndFullScreen() as AVKON takes care of that when
   247  
   418     // EApplicationExit context is used!
   248 	CEikAppUi::PrepareToExit();
   419 
   249 
   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();
       
   435 #ifndef RD_BOOT_CUSTOMIZABLE_AI
   250 #ifndef RD_BOOT_CUSTOMIZABLE_AI
   436     if( !iChargingOrAlarmBoot )
   251     if( !iChargingOrAlarmBoot )
   437         {
   252         {
   438         TRACES("CStartupAppUi::PrepareToExit(): NOT Charger/alarm boot");
   253         TRACES("CStartupAppUi::PrepareToExit(): NOT Charger/alarm boot");
   439 
   254 
   472     TRACES("CStartupAppUi::DoExitApplication()");
   287     TRACES("CStartupAppUi::DoExitApplication()");
   473     STATIC_CAST( CStartupAppUi*, aObject )->ExitApplication(); // cast, and call non-static function
   288     STATIC_CAST( CStartupAppUi*, aObject )->ExitApplication(); // cast, and call non-static function
   474     TRACES("CStartupAppUi::DoExitApplication(): End");
   289     TRACES("CStartupAppUi::DoExitApplication(): End");
   475     return KErrNone;
   290     return KErrNone;
   476     }
   291     }
       
   292 
   477 
   293 
   478 // ---------------------------------------------------------------------------
   294 // ---------------------------------------------------------------------------
   479 // CStartupAppUi::HandleKeyEventL
   295 // CStartupAppUi::HandleKeyEventL
   480 // ---------------------------------------------------------------------------
   296 // ---------------------------------------------------------------------------
   481 TKeyResponse CStartupAppUi::HandleKeyEventL(
   297 TKeyResponse CStartupAppUi::HandleKeyEventL(
   511             TRACES("CStartupAppUi::HandleKeyEventL(): First key event comes from Offline Mode Query");
   327             TRACES("CStartupAppUi::HandleKeyEventL(): First key event comes from Offline Mode Query");
   512             // first key event comes from Offline Mode Query
   328             // first key event comes from Offline Mode Query
   513             iOfflineModeQueryShown = EFalse;
   329             iOfflineModeQueryShown = EFalse;
   514             response = EKeyWasConsumed;
   330             response = EKeyWasConsumed;
   515             }
   331             }
   516         else if ( iUserWelcomeNote )
   332 		
   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             }
       
   523         else if ( ( iInternalState == EStartupShowingWelcomeAnimation ||
   333         else if ( ( iInternalState == EStartupShowingWelcomeAnimation ||
   524                     iInternalState == EStartupShowingOperatorAnimation ) &&
   334                     iInternalState == EStartupShowingOperatorAnimation ) &&
   525                    !( iAnimation->WasCancelled() ) )
   335                    !( iAnimation->WasCancelled() ) )
   526             {
   336             {
   527             TRACES("CStartupAppUi::HandleKeyEventL(): This key event is used to cancel animations");
   337             TRACES("CStartupAppUi::HandleKeyEventL(): This key event is used to cancel animations");
   533 
   343 
   534     TRACES1("CStartupAppUi::HandleKeyEventL(): End, return %d", response);
   344     TRACES1("CStartupAppUi::HandleKeyEventL(): End, return %d", response);
   535     return response;
   345     return response;
   536     }
   346     }
   537 
   347 
   538 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   348 /*
       
   349  * Qt Support Not available..
   539 // ---------------------------------------------------------------------------
   350 // ---------------------------------------------------------------------------
   540 // CStartupAppUi::HandleResourceChangeL
   351 // CStartupAppUi::HandleResourceChangeL
   541 //
   352 //
   542 // ---------------------------------------------------------------------------
   353 // ---------------------------------------------------------------------------
   543 //
   354 //
   544 void CStartupAppUi::HandleResourceChangeL( TInt aType )
   355 void CStartupAppUi::HandleResourceChangeL( TInt aType )
   545     {
   356     {
   546     TRACES("CStartupAppUi::HandleResourceChangeL()");
   357     TRACES("CStartupAppUi::HandleResourceChangeL()");
   547     TRACES1("CStartupAppUi::HandleResourceChangeL Type: %d", aType);
   358     TRACES1("CStartupAppUi::HandleResourceChangeL Type: %d", aType);
   548 
   359   
       
   360     
       
   361      * No equivalent in Qt. 
   549     CAknAppUi::HandleResourceChangeL( aType );
   362     CAknAppUi::HandleResourceChangeL( aType );
   550 
   363 
   551     if ( aType == KEikDynamicLayoutVariantSwitch )
   364     if ( aType == KEikDynamicLayoutVariantSwitch )
   552         {
   365         {
   553         iMainView->SetRect( ApplicationRect() );
   366         iMainView->SetRect( ApplicationRect() );
   554         }
   367         }
   555 
   368      
   556     TRACES("CStartupAppUi::HandleResourceChangeL(): End");
   369     TRACES("CStartupAppUi::HandleResourceChangeL(): End");
   557     }
   370     }
   558 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   371 
       
   372 */
   559 
   373 
   560 
   374 
   561 // ---------------------------------------------------------------------------
   375 // ---------------------------------------------------------------------------
   562 // CStartupAppUi::HandleCommandL(TInt aCommand)
   376 // CStartupAppUi::HandleCommandL(TInt aCommand)
   563 // ---------------------------------------------------------------------------
   377 // ---------------------------------------------------------------------------
   567     switch (aCommand)
   381     switch (aCommand)
   568         {
   382         {
   569         case EEikCmdExit:
   383         case EEikCmdExit:
   570             {
   384             {
   571             TRACES("CStartupAppUi::HandleCommandL(): EEikCmdExit");
   385             TRACES("CStartupAppUi::HandleCommandL(): EEikCmdExit");
   572             Exit();
   386 
       
   387 			Exit();
   573             }
   388             }
   574             break;
   389             break;
   575         default:
   390         default:
   576             break;
   391             break;
   577         }//End of switch-clause
   392         }//End of switch-clause
   582 // CStartupAppUi::DoStartupStartPartL()
   397 // CStartupAppUi::DoStartupStartPartL()
   583 // ---------------------------------------------------------------------------
   398 // ---------------------------------------------------------------------------
   584 void CStartupAppUi::DoStartupStartPartL()
   399 void CStartupAppUi::DoStartupStartPartL()
   585     {
   400     {
   586     TRACES("CStartupAppUi::DoStartupStartPartL()");
   401     TRACES("CStartupAppUi::DoStartupStartPartL()");
   587 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   402 
   588     TryPreLoadAnimation();
   403     TryPreLoadAnimation();
   589 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   404 
   590     DoNextStartupPhaseL( EStartupWaitingCriticalBlock );
   405     DoNextStartupPhaseL( EStartupWaitingCriticalBlock );
   591     TRACES("CStartupAppUi::DoStartupStartPartL(): End");
   406     TRACES("CStartupAppUi::DoStartupStartPartL(): End");
   592     }
   407     }
   593 
   408 
   594 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   595 // ---------------------------------------------------------------------------
   409 // ---------------------------------------------------------------------------
   596 // CStartupAppUi::TryPreLoadAnimation()
   410 // CStartupAppUi::TryPreLoadAnimation()
   597 // ---------------------------------------------------------------------------
   411 // ---------------------------------------------------------------------------
   598 void CStartupAppUi::TryPreLoadAnimation()
   412 void CStartupAppUi::TryPreLoadAnimation()
   599     {
   413     {
   620            mode == EStartupModeNormal ) || // Not going to charging or alarm mode
   434            mode == EStartupModeNormal ) || // Not going to charging or alarm mode
   621          state == ESwStateSecurityCheck ) )
   435          state == ESwStateSecurityCheck ) )
   622         {
   436         {
   623         iAnimation->PreLoad(
   437         iAnimation->PreLoad(
   624             ClientRect(),
   438             ClientRect(),
   625             *iMainView,
   439 			*iMainView,
   626             KStartupAnimationParams,
   440             KStartupAnimationParams,
   627             ETrue,
   441             ETrue,
   628             SecondaryDisplay::EStartWelcomeAnimation );
   442             SecondaryDisplay::EStartWelcomeAnimation );
   629         }
   443         }
   630 
   444 
   631     TRACES("CStartupAppUi::TryPreLoadAnimation(): End");
   445     TRACES("CStartupAppUi::TryPreLoadAnimation(): End");
   632     }
   446     }
   633 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   447 
   634 
   448 
   635 
   449 
   636 // ---------------------------------------------------------------------------
   450 // ---------------------------------------------------------------------------
   637 // CStartupAppUi::DoStartupShowWelcomeAnimationL()
   451 // CStartupAppUi::DoStartupShowWelcomeAnimationL()
   638 // ---------------------------------------------------------------------------
   452 // ---------------------------------------------------------------------------
   643         {
   457         {
   644         //skip the welcome animation and user welcome note and continue with
   458         //skip the welcome animation and user welcome note and continue with
   645         //the same way like in the end of ShowUserWelcomeNoteL()
   459         //the same way like in the end of ShowUserWelcomeNoteL()
   646         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Skip the animation and UWN because it's hidden reset");
   460         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Skip the animation and UWN because it's hidden reset");
   647         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   461         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   648 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   462 
   649         iWelcomeAnimation->RemoveSplashScreen();
       
   650 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   651         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   463         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   652 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   464 
   653         return;
   465         }
   654 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   466 
   655         }
       
   656 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   657     else
   467     else
   658         {
   468         {
   659         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Show animation");
   469         TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): Show animation");
   660 
   470 
   661         iAnimation->Play(
   471         iAnimation->Play(
   662             ClientRect(),
   472             ClientRect(),
   663             *iMainView,
   473 			*iMainView,
   664             KStartupAnimationParams,
   474             KStartupAnimationParams,
   665             ETrue,
   475             ETrue,
   666             SecondaryDisplay::EStartWelcomeAnimation,
   476             SecondaryDisplay::EStartWelcomeAnimation,
   667             TCallBack( AnimationFinishedFunc, this ) );
   477             TCallBack( AnimationFinishedFunc, this ) );
   668         }
   478         }
   669 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
   479 
   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
       
   686 
   480 
   687     TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): End");
   481     TRACES("CStartupAppUi::DoStartupShowWelcomeAnimationL(): End");
   688     }
   482     }
   689 
   483 
   690 // ---------------------------------------------------------------------------
   484 // ---------------------------------------------------------------------------
   698         //skip the operator animation and user welcome note and continue with
   492         //skip the operator animation and user welcome note and continue with
   699         //the same way like in the end of ShowUserWelcomeNoteL()
   493         //the same way like in the end of ShowUserWelcomeNoteL()
   700         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Skip the animation and UWN because it's hidden reset");
   494         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Skip the animation and UWN because it's hidden reset");
   701         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   495         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): and change internal state directly to EStartupFirstBootAndRTCCheck");
   702         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   496         DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   703 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   497 
   704         return;
   498         }
   705 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   499 
   706         }
       
   707 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   708     else
   500     else
   709         {
   501         {
   710         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Show animation");
   502         TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): Show animation");
   711 
   503 
   712         CSAnimStartupCtrl::TAnimationParams params;
   504         CSAnimStartupCtrl::TAnimationParams params;
   716         params.iEnableScalingKey = KStartupOperatorAnimationScaling;
   508         params.iEnableScalingKey = KStartupOperatorAnimationScaling;
   717         params.iTonePathKey = KStartupOperatorTonePath;
   509         params.iTonePathKey = KStartupOperatorTonePath;
   718         params.iVolumeKey = KStartupOperatorToneVolume;
   510         params.iVolumeKey = KStartupOperatorToneVolume;
   719         iAnimation->Play(
   511         iAnimation->Play(
   720             ClientRect(),
   512             ClientRect(),
       
   513 	
   721             *iMainView,
   514             *iMainView,
   722             params,
   515             params,
   723             EFalse,
   516             EFalse,
   724             SecondaryDisplay::EStartOperatorAnimation,
   517             SecondaryDisplay::EStartOperatorAnimation,
   725             TCallBack( AnimationFinishedFunc, this ) );
   518             TCallBack( AnimationFinishedFunc, this ) );
   726         }
   519         }
   727 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
   520 
   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
       
   742 
   521 
   743     TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): End");
   522     TRACES("CStartupAppUi::DoStartupShowOperatorAnimationL(): End");
   744     }
   523     }
   745 
   524 
   746 // ---------------------------------------------------------------------------
   525 
   747 // CStartupAppUi::DoStartupShowUserWelcomeNoteL()
   526 // ---------------------------------------------------------------------------
   748 // ---------------------------------------------------------------------------
   527 // CStartupAppUi::PredictiveTimeEnabled()
   749 void CStartupAppUi::DoStartupShowUserWelcomeNoteL()
   528 // ---------------------------------------------------------------------------
   750     {
   529 TBool CStartupAppUi::PredictiveTimeEnabled()
   751     TRACES("CStartupAppUi::DoStartupShowUserWelcomeNoteL()");
   530     {
   752     ShowUserWelcomeNoteL();
   531     TRACES("CStartupAppUi::PredictiveTimeEnabled()");
   753     TRACES("CStartupAppUi::DoStartupShowUserWelcomeNoteL(): End");
   532 
   754     }
   533     TInt value( EPredictiveTimeEnabled );
   755 
       
   756 // ---------------------------------------------------------------------------
       
   757 // CStartupAppUi::StartupQueriesEnabled()
       
   758 // ---------------------------------------------------------------------------
       
   759 TBool CStartupAppUi::StartupQueriesEnabled()
       
   760     {
       
   761     TRACES("CStartupAppUi::StartupQueriesEnabled()");
       
   762 
       
   763     TInt value( EStartupQueriesEnabled );
       
   764     CRepository* repository(NULL);
   534     CRepository* repository(NULL);
   765 
   535 
   766     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
   536     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
   767     if ( err == KErrNone )
   537     if ( err == KErrNone )
   768         {
   538         {
   769         err = repository->Get( KStartupQueries, value );
       
   770         }
       
   771     delete repository;
       
   772 
       
   773     TRACES1("CStartupAppUi::StartupQueriesEnabled(): returns %d", value);
       
   774     return value;
       
   775     }
       
   776 
       
   777 // ---------------------------------------------------------------------------
       
   778 // CStartupAppUi::PredictiveTimeEnabled()
       
   779 // ---------------------------------------------------------------------------
       
   780 TBool CStartupAppUi::PredictiveTimeEnabled()
       
   781     {
       
   782     TRACES("CStartupAppUi::PredictiveTimeEnabled()");
       
   783 
       
   784     TInt value( EPredictiveTimeEnabled );
       
   785     CRepository* repository(NULL);
       
   786 
       
   787     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
       
   788     if ( err == KErrNone )
       
   789         {
       
   790         err = repository->Get( KPredictiveTimeAndCountrySelection, value );
   539         err = repository->Get( KPredictiveTimeAndCountrySelection, value );
   791         }
   540         }
   792     delete repository;
   541     delete repository;
   793 
   542 
   794     TRACES1("CStartupAppUi::PredictiveTimeEnabled(): returns %d", value);
   543     TRACES1("CStartupAppUi::PredictiveTimeEnabled(): returns %d", value);
   800 // ---------------------------------------------------------------------------
   549 // ---------------------------------------------------------------------------
   801 void CStartupAppUi::DoStartupFirstBootAndRTCCheckL()
   550 void CStartupAppUi::DoStartupFirstBootAndRTCCheckL()
   802     {
   551     {
   803     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL()");
   552     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL()");
   804 
   553 
   805 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   554 
   806     RProperty::Set( KPSUidStartup, KStartupCleanBoot, iCleanBoot );
   555     RProperty::Set( KPSUidStartup, KStartupCleanBoot, iCleanBoot );
   807     RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   556     RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   808 
   557 
   809     delete iUserWelcomeNote;
       
   810     iUserWelcomeNote = NULL;
       
   811     iMainView->DrawDeferred();
   558     iMainView->DrawDeferred();
   812 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   559 
   813 
   560 
   814     // When Predictive Time and Country Selection is enabled, no queries are
   561     // When Predictive Time and Country Selection is enabled, no queries are
   815     // shown to user during first boot. Instead, Clock application gets the
   562     // shown to user during first boot. Instead, Clock application gets the
   816     // time and location from the network and marks the first boot as done.
   563     // time and location from the network and marks the first boot as done.
   817     if( !PredictiveTimeEnabled() )
   564     if( !PredictiveTimeEnabled() )
   818         {
   565         {
   819         if( iFirstBoot && !HiddenReset() && StartupQueriesEnabled() )
   566         if( iFirstBoot && !HiddenReset() ) //&& StartupQueriesEnabled() )
   820             {
   567             {
   821             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot. Show city, time and date queries.");
   568             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot. Show city, time and date queries.");
   822     
   569 		    TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Mark first boot");
   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");
       
   844             MarkFirstBoot();    
   570             MarkFirstBoot();    
   845                 
   571                 
   846             }
   572             }
   847         else if( !RTCStatus() && !HiddenReset() && StartupQueriesEnabled())
   573 		else if( !RTCStatus() && !HiddenReset() ) // && StartupQueriesEnabled())
   848             {
   574             {
   849             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): No first boot but RTCStatus is corrupted. Ask time and date");
   575             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): No first boot but RTCStatus is corrupted. Ask time and date");
   850     #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
   576 		     }
   851             iWelcomeAnimation->UpdateDrawInfo( EStartupDICityTimeDateQueries );
   577 		if( iFirstBoot )  // && !StartupQueriesEnabled() )
   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() )
       
   863             {
   578             {
   864             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot ongoing and queries are disabled.");
   579             TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): First boot ongoing and queries are disabled.");
   865             MarkFirstBoot();
   580             MarkFirstBoot();
   866             }
   581             }
   867         }
   582         }
       
   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 		}
   868 
   594 
   869     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Setting KPSStartupAppState = EStartupAppStateFinished");
   595     TRACES("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): Setting KPSStartupAppState = EStartupAppStateFinished");
   870     TInt err = RProperty::Set( KPSUidStartupApp, KPSStartupAppState, EStartupAppStateFinished );
   596     TInt err = RProperty::Set( KPSUidStartupApp, KPSStartupAppState, EStartupAppStateFinished );
   871     if( KErrNone != err )
   597     if( KErrNone != err )
   872         {
   598         {
   873         TRACES1("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): KPSStartupAppState set err %d"
   599         TRACES1("CStartupAppUi::DoStartupFirstBootAndRTCCheckL(): KPSStartupAppState set err %d"
   874                 , err);
   600                 , err);
   875         }
   601         }
   876 
   602 
   877     DoNextStartupPhaseL( EStartupWaitingCUIStartupReady );
   603     DoNextStartupPhaseL( EStartupStartupOK );
   878     }
   604     }
   879 
   605 
   880 // ---------------------------------------------------------------------------
   606 
   881 // CStartupAppUi::ShowStartupQueriesL()
   607 
   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     }
       
   929 
   608 
   930 // ---------------------------------------------------------------------------
   609 // ---------------------------------------------------------------------------
   931 // CStartupAppUi::DoStartupEndPart()
   610 // CStartupAppUi::DoStartupEndPart()
   932 // ---------------------------------------------------------------------------
   611 // ---------------------------------------------------------------------------
   933 void CStartupAppUi::DoStartupEndPart()
   612 void CStartupAppUi::DoStartupEndPart()
   934     {
   613     {
   935     TRACES("CStartupAppUi::DoStartupEndPart()");
   614     TRACES("CStartupAppUi::DoStartupEndPart()");
   936     TRACES("CStartupAppUi::DoStartupEndPart(): STARTUP OK");
   615     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));
       
   945     
   616     
   946     if(fTUDone)
   617     TBool ftuenabled=EFalse;
   947     	{
   618     TInt err=KErrNone;
   948     	UpdateStartupUiPhase( EStartupUiPhaseAllDone );
   619 #ifndef __WINSCW__
   949     	}
   620     TRAP(err,
   950 	else
   621             TInt enabled=0;
   951         {
   622             //open cenrep;
   952         UpdateStartupUiPhase(EStartupUiPhaseAllDone+1);
   623             CRepository *cenrep=CRepository::NewLC(KCRUidStartupConf);
   953         }
   624             //check if ftu is enabled or not
   954 
   625             User::LeaveIfError(cenrep->Get(KFtuStartupEnabled,enabled));
   955     //UpdateStartupUiPhase( EStartupUiPhaseAllDone );
   626             ftuenabled=!!enabled; //make sure we only have a boolean value here
   956     
   627             CleanupStack::PopAndDestroy(cenrep);
   957     
   628             );
   958 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
   629 #endif     
       
   630     if(!ftuenabled)
       
   631         {
       
   632         UpdateStartupUiPhase( EStartupUiPhaseAllDone );
       
   633         }
   959 
   634 
   960     TRACES("CStartupAppUi::DoStartupEndPart(): Exit application.");
   635     TRACES("CStartupAppUi::DoStartupEndPart(): Exit application.");
   961     iExitTimer->Start( 100000, 100000, TCallBack( DoExitApplication, this ) );
   636     iExitTimer->Start( 100000, 100000, TCallBack( DoExitApplication, this ) );
   962     TRACES("CStartupAppUi::DoStartupEndPart(): DoExitApplication-timer called.");
   637     TRACES("CStartupAppUi::DoStartupEndPart(): DoExitApplication-timer called.");
   963     TRACES("CStartupAppUi::DoStartupEndPart(): End");
   638     TRACES("CStartupAppUi::DoStartupEndPart(): End");
   964     }
   639     }
   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
       
  1030 
   640 
  1031 // ---------------------------------------------------------------------------
   641 // ---------------------------------------------------------------------------
  1032 // CStartupAppUi::StopTimingL()
   642 // CStartupAppUi::StopTimingL()
  1033 // ---------------------------------------------------------------------------
   643 // ---------------------------------------------------------------------------
  1034 void CStartupAppUi::StopTimingL()
   644 void CStartupAppUi::StopTimingL()
  1041             //telling that timer has expired in appui so that
   651             //telling that timer has expired in appui so that
  1042             //key pressed are not handled any more...
   652             //key pressed are not handled any more...
  1043             TRACES("CStartupAppUi::StopTimingL(): Stopping UWN");
   653             TRACES("CStartupAppUi::StopTimingL(): Stopping UWN");
  1044             iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
   654             iStartupFirstBootAndRTCCheckAlreadyCalled = ETrue;
  1045             iNoteTimer->Cancel();
   655             iNoteTimer->Cancel();
  1046 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   656 
  1047             UpdateStartupUiPhase( EStartupUiPhaseUserWelcomeDone );
   657             UpdateStartupUiPhase( EStartupUiPhaseUserWelcomeDone );
  1048             DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
   658             DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck );
  1049 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
   659 
  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
       
  1127             }
   660             }
  1128         }
   661         }
  1129 
   662 
  1130     TRACES("CStartupAppUi::StopTimingL(): End");
   663     TRACES("CStartupAppUi::StopTimingL(): End");
  1131     }
   664     }
  1139     iExitTimer->Cancel();
   672     iExitTimer->Cancel();
  1140     Exit();
   673     Exit();
  1141     TRACES("CStartupAppUi::ExitApplication(): End");
   674     TRACES("CStartupAppUi::ExitApplication(): End");
  1142     }
   675     }
  1143 
   676 
  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 
       
  1469 // ---------------------------------------------------------------------------
   677 // ---------------------------------------------------------------------------
  1470 // CStartupAppUi::SetCriticalBlockEndedL()
   678 // CStartupAppUi::SetCriticalBlockEndedL()
  1471 // ---------------------------------------------------------------------------
   679 // ---------------------------------------------------------------------------
  1472 void CStartupAppUi::SetCriticalBlockEndedL()
   680 void CStartupAppUi::SetCriticalBlockEndedL()
  1473     {
   681     {
  1488     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL()");
   696     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL()");
  1489 
   697 
  1490     if( iCriticalBlockEnded )
   698     if( iCriticalBlockEnded )
  1491         {
   699         {
  1492         TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): CriticalBlock has ended. Continue.");
   700         TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): CriticalBlock has ended. Continue.");
  1493 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   701 
  1494         DoNextStartupPhaseL( EStartupOfflineModeQuery );
   702         DoNextStartupPhaseL( EStartupOfflineModeQuery );
  1495 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1496         DoNextStartupPhaseL( EStartupWaitingTouchScreenCalib );
       
  1497 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1498         }
   703         }
  1499     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): End");
   704     TRACES("CStartupAppUi::WaitingCriticalBlockEndingL(): End");
  1500     }
   705     }
  1501 
   706 
  1502 // ---------------------------------------------------------------------------
   707 // ---------------------------------------------------------------------------
  1537     iCriticalBlockEnded = ETrue;
   742     iCriticalBlockEnded = ETrue;
  1538     if ( iInternalState == EStartupWaitingCriticalBlock )
   743     if ( iInternalState == EStartupWaitingCriticalBlock )
  1539         {
   744         {
  1540         TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): Entered emergency calls only state.");
   745         TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): Entered emergency calls only state.");
  1541 
   746 
  1542         DoNextStartupPhaseL( EStartupWaitingCUIStartupReady );
   747         DoNextStartupPhaseL( EStartupStartupOK );
  1543         }
   748         }
  1544     TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): End");
   749     TRACES("CStartupAppUi::SetEmergencyCallsOnlyL(): End");
  1545     }
   750     }
  1546 
   751 
  1547 // ---------------------------------------------------------------------------
   752 // ---------------------------------------------------------------------------
  1559         DoNextStartupPhaseL( EStartupSystemFatalError );
   764         DoNextStartupPhaseL( EStartupSystemFatalError );
  1560         }
   765         }
  1561 
   766 
  1562     TRACES("CStartupAppUi::SwStateFatalStartupErrorL(): End");
   767     TRACES("CStartupAppUi::SwStateFatalStartupErrorL(): End");
  1563     }
   768     }
  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 
       
  1586 // ----------------------------------------------------------------------------
   769 // ----------------------------------------------------------------------------
  1587 // CStartAppUi::DosInOfflineModeL()
   770 // CStartAppUi::DosInOfflineModeL()
  1588 // ----------------------------------------------------------------------------
   771 // ----------------------------------------------------------------------------
  1589 
   772 
  1590 TBool CStartupAppUi::DosInOfflineModeL()
   773 TBool CStartupAppUi::DosInOfflineModeL()
  1663             reply = 1;
   846             reply = 1;
  1664             }
   847             }
  1665         else if ( iOfflineModeSupported && DosInOfflineModeL() )
   848         else if ( iOfflineModeSupported && DosInOfflineModeL() )
  1666             {
   849             {
  1667             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline mode query needed");
   850             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline mode query needed");
  1668 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1669             RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
   851             RProperty::Set( KPSUidStartup, KPSSplashShutdown, ESplashShutdown );
  1670             iAnimation->BringToForeground();
   852             iAnimation->BringToForeground();
  1671             iMainView->DrawDeferred();
   853             iMainView->DrawDeferred();
  1672 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1673             iWelcomeAnimation->UpdateDrawInfo( EStartupDIQueriesOn );
       
  1674             iWelcomeAnimation->DrawNow();
       
  1675 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1676             iOfflineModeQueryShown = ETrue;
   854             iOfflineModeQueryShown = ETrue;
  1677             CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( CAknQueryDialog::ENoTone );
   855             CHbDeviceMessageBoxSymbian *aMessageBox = NULL;
  1678             TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Publish dialog for Secondary UI");
   856         	aMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EQuestion);
  1679             dlg->PublishDialogL(SecondaryDisplay::ECmdShowOfflineQuery,
   857        	 	_LIT(KText, "Continue using phone in Offline mode?");
  1680                                 SecondaryDisplay::KCatStartup);
   858         	aMessageBox->SetTextL(KText);
  1681             if ( dlg->ExecuteLD( R_STARTUP_OFFLINE_MODE_QUERY ) )
   859         	_LIT(KAcceptText, "Yes");
       
   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 )
  1682                 {
   868                 {
  1683                 TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline Mode query: YES -> Boot to Offline");
   869                 TRACES("CStartupAppUi::ShowOfflineModeQueryL(): Offline Mode query: YES -> Boot to Offline");
  1684                 reply = 1;
   870                 reply = 1;
  1685                 }
   871                 }
  1686             else
   872             else
  1710 
   896 
  1711     if( KErrNone != err )
   897     if( KErrNone != err )
  1712         {
   898         {
  1713         TRACES1("CStartupAppUi::ShowOfflineModeQueryL(): KStartupBootIntoOffline set err %d", err);
   899         TRACES1("CStartupAppUi::ShowOfflineModeQueryL(): KStartupBootIntoOffline set err %d", err);
  1714         }
   900         }
  1715 
   901    
  1716     TRACES("CStartupAppUi::ShowOfflineModeQueryL(): End");
   902     TRACES("CStartupAppUi::ShowOfflineModeQueryL(): End");
  1717     }
   903     }
  1718 
   904 
  1719 // ---------------------------------------------------------------------------
   905 // ---------------------------------------------------------------------------
  1720 // CStartupAppUi::CancelAnimation(...)
   906 // CStartupAppUi::CancelAnimation(...)
  1721 // ---------------------------------------------------------------------------
   907 // ---------------------------------------------------------------------------
  1722 void CStartupAppUi::CancelAnimation()
   908 void CStartupAppUi::CancelAnimation()
  1723     {
   909     {
  1724     TRACES("CStartupAppUi::CancelAnimation()");
   910     TRACES("CStartupAppUi::CancelAnimation()");
  1725 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   911 
  1726     iAnimation->Cancel();
   912     iAnimation->Cancel();
  1727 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
   913 
  1728     iWelcomeAnimation->CancelAnimation();
       
  1729 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  1730     TRACES("CStartupAppUi::CancelAnimation(): End");
   914     TRACES("CStartupAppUi::CancelAnimation(): End");
  1731     }
   915     }
  1732 
   916 
  1733 // ---------------------------------------------------------------------------
   917 
  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     }
       
  2114 
   918 
  2115 // ---------------------------------------------------------------------------
   919 // ---------------------------------------------------------------------------
  2116 // CStartupAppUi::FirstBoot()
   920 // CStartupAppUi::FirstBoot()
  2117 // ---------------------------------------------------------------------------
   921 // ---------------------------------------------------------------------------
  2118 TBool CStartupAppUi::FirstBoot()
   922 TBool CStartupAppUi::FirstBoot()
  2210     delete repository;
  1014     delete repository;
  2211     TRACES("CStartupAppUi::MarkFirstBoot(): End");
  1015     TRACES("CStartupAppUi::MarkFirstBoot(): End");
  2212     }
  1016     }
  2213 
  1017 
  2214 
  1018 
  2215 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1019 
  2216 // ---------------------------------------------------------------------------
  1020 // ---------------------------------------------------------------------------
  2217 // CStartupAppUi::AnimationFinished()
  1021 // CStartupAppUi::AnimationFinished()
  2218 // ---------------------------------------------------------------------------
  1022 // ---------------------------------------------------------------------------
  2219 void CStartupAppUi::AnimationFinished()
  1023 void CStartupAppUi::AnimationFinished()
  2220     {
  1024     {
  2252         {
  1056         {
  2253         TRAP(err, DoNextStartupPhaseL( EStartupShowingOperatorAnimation ));
  1057         TRAP(err, DoNextStartupPhaseL( EStartupShowingOperatorAnimation ));
  2254         }
  1058         }
  2255     else if ( iInternalState == EStartupShowingOperatorAnimation )
  1059     else if ( iInternalState == EStartupShowingOperatorAnimation )
  2256         {
  1060         {
  2257         TRAP(err, DoNextStartupPhaseL( EStartupShowingUserWelcomeNote ));
  1061         TRAP(err, DoNextStartupPhaseL( EStartupFirstBootAndRTCCheck));
  2258         }
  1062         }
  2259 
  1063 
  2260     if ( err != KErrNone )
  1064     if ( err != KErrNone )
  2261         {
  1065         {
  2262         TRAP_IGNORE( DoNextStartupPhaseL(EStartupSystemFatalError) );
  1066         TRAP_IGNORE( DoNextStartupPhaseL(EStartupSystemFatalError) );
  2263         }
  1067         }
  2264 
  1068 
  2265     TRACES("CStartupAppUi::AnimationFinished(): End");
  1069     TRACES("CStartupAppUi::AnimationFinished(): End");
  2266     }
  1070     }
  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
       
  2312 
  1071 
  2313 // ---------------------------------------------------------------------------
  1072 // ---------------------------------------------------------------------------
  2314 // CStartupAppUi::SetCleanBoot()
  1073 // CStartupAppUi::SetCleanBoot()
  2315 // ---------------------------------------------------------------------------
  1074 // ---------------------------------------------------------------------------
  2316 void CStartupAppUi::SetCleanBoot()
  1075 void CStartupAppUi::SetCleanBoot()
  2327     {
  1086     {
  2328     TRACES("CStartupAppUi::SimSupported()");
  1087     TRACES("CStartupAppUi::SimSupported()");
  2329     return iSimSupported;
  1088     return iSimSupported;
  2330     }
  1089     }
  2331 
  1090 
  2332 // ----------------------------------------------------------------------------
  1091 
  2333 // CStartupAppUi::CoverUISupported()
       
  2334 // ----------------------------------------------------------------------------
       
  2335 TBool CStartupAppUi::CoverUISupported()
       
  2336     {
       
  2337     TRACES("CStartupAppUi::CoverUISupported()");
       
  2338     return iCoverUISupported;
       
  2339     }
       
  2340 
  1092 
  2341 // ---------------------------------------------------------------------------
  1093 // ---------------------------------------------------------------------------
  2342 // CStartupAppUi::DoNextStartupPhaseL( TStartupInternalState toState )
  1094 // CStartupAppUi::DoNextStartupPhaseL( TStartupInternalState toState )
  2343 // State#                                Possible next states
  1095 // State#                                Possible next states
  2344 
  1096 
  2346 // 0    EStartupStartingUp               1, 18
  1098 // 0    EStartupStartingUp               1, 18
  2347 // 1    EStartupWaitingCriticalBlock     5, 18
  1099 // 1    EStartupWaitingCriticalBlock     5, 18
  2348 // 5    EStartupWaitingTouchScreenCalib
  1100 // 5    EStartupWaitingTouchScreenCalib
  2349 // 6    EStartupWaitingPhoneLightIdle    8, 18
  1101 // 6    EStartupWaitingPhoneLightIdle    8, 18
  2350 // 8    EStartupOfflineModeQuery         9, 18
  1102 // 8    EStartupOfflineModeQuery         9, 18
  2351 // 9    EStartupWaitingCUIWelcomeAnim    10, 18
  1103 // 9    EStartupWaitingCUIWelcomeAnim    10, 18 Removed
  2352 // 10   EStartupWaitingStartupTone       11, 18
  1104 // 10   EStartupWaitingStartupTone       11, 18
  2353 // 11   EStartupShowingWelcomeAnimation  12, 14, 18
  1105 // 11   EStartupShowingWelcomeAnimation  12, 14, 18
  2354 // 12   EStartupWaitingCUIOperatorAnim   13, 18
  1106 // 12   EStartupWaitingCUIOperatorAnim   13, 18
  2355 // 13   EStartupShowingOperatorAnimation 14, 14, 18
  1107 // 13   EStartupShowingOperatorAnimation 14, 14, 18
  2356 // 14   EStartupShowingUserWelcomeNote   15, 18
  1108 // 14   EStartupShowingUserWelcomeNote   15, 18 Removed
  2357 // 15   EStartupFirstBootAndRTCCheck     16, 18
  1109 // 15   EStartupFirstBootAndRTCCheck     16, 18
  2358 // 16   EStartupWaitingCUIStartupReady   17, 18
  1110 // 16   EStartupWaitingCUIStartupReady   17, 18 Removed
  2359 // 17   EStartupStartupOK                -
  1111 // 17   EStartupStartupOK                -
  2360 // 18   EStartupSystemFatalError         -
  1112 // 18   EStartupSystemFatalError         -
  2361 
  1113 
  2362 // ---------------------------------------------------------------------------
  1114 // ---------------------------------------------------------------------------
  2363 
  1115 
  2389             break;
  1141             break;
  2390         case EStartupWaitingCriticalBlock:
  1142         case EStartupWaitingCriticalBlock:
  2391             {
  1143             {
  2392             switch( toState )
  1144             switch( toState )
  2393                 {
  1145                 {
  2394                 case EStartupWaitingCUIStartupReady:
  1146                 case EStartupStartupOK:
  2395                     iInternalState = EStartupWaitingCUIStartupReady;
  1147                     iInternalState = EStartupStartupOK;
  2396                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingCUIStartupReady");
  1148                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupStartupOK");
  2397                     WaitingCoverUIStartupReadySyncL();
  1149                     DoStartupEndPart();
  2398                     break;
  1150                     break;
  2399 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1151 
  2400                 case EStartupWaitingTouchScreenCalib:
  1152                 case EStartupOfflineModeQuery:
  2401                     iInternalState = EStartupWaitingTouchScreenCalib;
  1153                     iInternalState = EStartupOfflineModeQuery;
  2402                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingTouchScreenCalib");
  1154                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupOfflineModeQuery");
  2403                     WaitingTouchScreenCalibL();
  1155                     ShowOfflineModeQueryL();
       
  1156 
       
  1157                     DoNextStartupPhaseL( EStartupWaitingShowStartupAnimation );
  2404                     break;
  1158                     break;
  2405                 case EStartupSystemFatalError:
  1159                 case EStartupSystemFatalError:
  2406                     SystemFatalErrorL();
  1160                     SystemFatalErrorL();
  2407                     break;
  1161                     break;
  2408                 default:
  1162                 default:
  2411                         PANIC( EStartupInvalidInternalStateChange ) );
  1165                         PANIC( EStartupInvalidInternalStateChange ) );
  2412                     break;
  1166                     break;
  2413                 }
  1167                 }
  2414             }
  1168             }
  2415             break;
  1169             break;
  2416         case EStartupWaitingTouchScreenCalib:
  1170         case EStartupOfflineModeQuery:
  2417             {
  1171             {
  2418             switch( toState )
  1172             switch( toState )
  2419                 {
  1173                 {
  2420 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1174 
  2421                 case EStartupOfflineModeQuery:
  1175                 case EStartupWaitingShowStartupAnimation:
  2422                     iInternalState = EStartupOfflineModeQuery;
  1176                     iInternalState = EStartupWaitingShowStartupAnimation;
  2423                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupOfflineModeQuery");
  1177                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingShowStartupAnimation");
  2424                     ShowOfflineModeQueryL();
  1178                     WaitingStartupAnimationStartL();
  2425 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1179                     break;
  2426                     DoNextStartupPhaseL( EStartupWaitingShowStartupAnimation );
  1180               case EStartupSystemFatalError:
  2427 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2428                     DoNextStartupPhaseL( EStartupWaitingCUIWelcomeAnim );
       
  2429 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2430                     break;
       
  2431                 case EStartupSystemFatalError:
       
  2432                     SystemFatalErrorL();
  1181                     SystemFatalErrorL();
  2433                     break;
  1182                     break;
  2434                 default:
  1183                 default:
  2435                     __ASSERT_DEBUG(
  1184                     __ASSERT_DEBUG(
  2436                         EFalse,
  1185                         EFalse,
  2437                         PANIC( EStartupInvalidInternalStateChange ) );
  1186                         PANIC( EStartupInvalidInternalStateChange ) );
  2438                     break;
  1187                     break;
  2439                 }
  1188                 }
  2440             }
  1189             }
  2441             break;
  1190             break;
  2442         case EStartupOfflineModeQuery:
       
  2443             {
       
  2444             switch( toState )
       
  2445                 {
       
  2446 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2447                 case EStartupWaitingShowStartupAnimation:
       
  2448                     iInternalState = EStartupWaitingShowStartupAnimation;
       
  2449                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupWaitingShowStartupAnimation");
       
  2450                     WaitingStartupAnimationStartL();
       
  2451                     break;
       
  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:
       
  2460                     SystemFatalErrorL();
       
  2461                     break;
       
  2462                 default:
       
  2463                     __ASSERT_DEBUG(
       
  2464                         EFalse,
       
  2465                         PANIC( EStartupInvalidInternalStateChange ) );
       
  2466                     break;
       
  2467                 }
       
  2468             }
       
  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
       
  2514         case EStartupWaitingShowStartupAnimation:
  1191         case EStartupWaitingShowStartupAnimation:
  2515             {
  1192             {
  2516             switch( toState )
  1193             switch( toState )
  2517                 {
  1194                 {
  2518                 case EStartupShowingWelcomeAnimation:
  1195                 case EStartupShowingWelcomeAnimation:
  2533             break;
  1210             break;
  2534         case EStartupShowingWelcomeAnimation:
  1211         case EStartupShowingWelcomeAnimation:
  2535             {
  1212             {
  2536             switch( toState )
  1213             switch( toState )
  2537                 {
  1214                 {
  2538 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1215 
  2539                 case EStartupShowingOperatorAnimation:
  1216                 case EStartupShowingOperatorAnimation:
  2540                     iInternalState = EStartupShowingOperatorAnimation;
  1217                     iInternalState = EStartupShowingOperatorAnimation;
  2541                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingOperatorAnimation");
  1218                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState: EStartupShowingOperatorAnimation");
  2542                     DoStartupShowOperatorAnimationL();
  1219                     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
       
  2551                     break;
  1220                     break;
  2552                 case EStartupFirstBootAndRTCCheck:
  1221                 case EStartupFirstBootAndRTCCheck:
  2553                     iInternalState = EStartupFirstBootAndRTCCheck;
  1222                     iInternalState = EStartupFirstBootAndRTCCheck;
  2554                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  1223                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  2555                     DoStartupFirstBootAndRTCCheckL();
  1224                     DoStartupFirstBootAndRTCCheckL();
  2562                         PANIC( EStartupInvalidInternalStateChange ) );
  1231                         PANIC( EStartupInvalidInternalStateChange ) );
  2563                     break;
  1232                     break;
  2564                 }
  1233                 }
  2565             }
  1234             }
  2566             break;
  1235             break;
  2567 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1236         case EStartupShowingOperatorAnimation:
  2568         case EStartupWaitingCUIOperatorAnim:
       
  2569             {
  1237             {
  2570             switch( toState )
  1238             switch( toState )
  2571                 {
  1239                 {
  2572                 case EStartupShowingOperatorAnimation:
  1240                 
  2573                     iInternalState = EStartupShowingOperatorAnimation;
  1241                  
  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;
       
  2606                 case EStartupFirstBootAndRTCCheck:
  1242                 case EStartupFirstBootAndRTCCheck:
  2607                     iInternalState = EStartupFirstBootAndRTCCheck;
  1243                     iInternalState = EStartupFirstBootAndRTCCheck;
  2608                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  1244                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupFirstBootAndRTCCheck");
  2609                     DoStartupFirstBootAndRTCCheckL();
  1245                     DoStartupFirstBootAndRTCCheckL();
  2610                     break;
  1246                     break;
  2616                         PANIC( EStartupInvalidInternalStateChange ) );
  1252                         PANIC( EStartupInvalidInternalStateChange ) );
  2617                     break;
  1253                     break;
  2618                 }
  1254                 }
  2619             }
  1255             }
  2620             break;
  1256             break;
  2621         case EStartupShowingUserWelcomeNote:
  1257       
  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;
       
  2640         case EStartupFirstBootAndRTCCheck:
  1258         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:
       
  2660             {
  1259             {
  2661             switch( toState )
  1260             switch( toState )
  2662                 {
  1261                 {
  2663                 case EStartupStartupOK:
  1262                 case EStartupStartupOK:
  2664                     iInternalState = EStartupStartupOK;
  1263                         iInternalState = EStartupStartupOK;
  2665                     TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupStartupOK");
  1264                         TRACES("CStartupAppUi::DoNextStartupPhaseL(): InternalState : EStartupInvokeAndWaitForFtu");
  2666                     DoStartupEndPart();
  1265                         DoStartupEndPart();
  2667                     break;
  1266                     break;
  2668                 case EStartupSystemFatalError:
  1267                 case EStartupSystemFatalError:
  2669                     SystemFatalErrorL();
  1268                     SystemFatalErrorL();
  2670                     break;
  1269                     break;
  2671                 default:
  1270                 default:
  2681                 {
  1280                 {
  2682                 case EStartupStartingUp:
  1281                 case EStartupStartingUp:
  2683                 case EStartupOfflineModeQuery:
  1282                 case EStartupOfflineModeQuery:
  2684                 case EStartupShowingWelcomeAnimation:
  1283                 case EStartupShowingWelcomeAnimation:
  2685                 case EStartupShowingOperatorAnimation:
  1284                 case EStartupShowingOperatorAnimation:
  2686                 case EStartupShowingUserWelcomeNote:
       
  2687                 case EStartupFirstBootAndRTCCheck:
  1285                 case EStartupFirstBootAndRTCCheck:
  2688                 case EStartupWaitingCUIStartupReady:
  1286                 case EStartupWaitingCUIStartupReady:
  2689                 case EStartupStartupOK:
  1287                 case EStartupStartupOK:
  2690                 case EStartupSystemFatalError:
  1288                 case EStartupSystemFatalError:
  2691                     //no need to continue, because state is
  1289                     //no need to continue, because state is
  2737         }
  1335         }
  2738     TRACES1( "CStartupAppUi::SimStatusChangedReset(): End, return %d", ret_val );
  1336     TRACES1( "CStartupAppUi::SimStatusChangedReset(): End, return %d", ret_val );
  2739     return ret_val;
  1337     return ret_val;
  2740     }
  1338     }
  2741 
  1339 
  2742 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
  1340 
  2743 // ---------------------------------------------------------------------------
  1341 // ---------------------------------------------------------------------------
  2744 // CStartupAppUi::UpdateStartupUiPhase()
  1342 // CStartupAppUi::UpdateStartupUiPhase()
  2745 // ---------------------------------------------------------------------------
  1343 // ---------------------------------------------------------------------------
  2746 void CStartupAppUi::UpdateStartupUiPhase( TInt aValue )
  1344 void CStartupAppUi::UpdateStartupUiPhase( TInt aValue )
  2747     {
  1345     {
  2752     if( KErrNone != err )
  1350     if( KErrNone != err )
  2753         {
  1351         {
  2754         TRACES1("CStartupAppUi::UpdateStartupUiPhase(): KPSStartupUiPhase set err %d", err);
  1352         TRACES1("CStartupAppUi::UpdateStartupUiPhase(): KPSStartupUiPhase set err %d", err);
  2755         }                          
  1353         }                          
  2756     }
  1354     }
  2757 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
  1355 
  2758 // End of file
  1356 // End of file