phonebookui/Phonebook2/Application/src/CPbk2StartupMonitor.cpp
branchRCL_3
changeset 9 0d28c1c5b6dd
parent 0 e686773b3f54
equal deleted inserted replaced
8:5586b4d2ec3e 9:0d28c1c5b6dd
   106         /**
   106         /**
   107          * Restart monitor. 
   107          * Restart monitor. 
   108          */
   108          */
   109         void Restart();
   109         void Restart();
   110         
   110         
       
   111         /**
       
   112          * Disables wait note if waiter is started.
       
   113          */
       
   114         void DisableWaitNote();
       
   115         
   111     private: // From CTimer
   116     private: // From CTimer
   112         void RunL();
   117         void RunL();
   113         TInt RunError(
   118         TInt RunError(
   114                 TInt aError );
   119                 TInt aError );
   115 
   120 
   124     private: // Data
   129     private: // Data
   125         /// Own: Decorator for the process
   130         /// Own: Decorator for the process
   126         MPbk2ProcessDecorator* iDecorator;
   131         MPbk2ProcessDecorator* iDecorator;
   127         /// Is decorator launched
   132         /// Is decorator launched
   128         TBool iStarted;
   133         TBool iStarted;
       
   134         /// Own: There are exception that even if monitor is started
       
   135         /// wait note should not be displayed.
       
   136         TBool iDisplayWaitNote;
   129     };
   137     };
   130 
   138 
   131 // --------------------------------------------------------------------------
   139 // --------------------------------------------------------------------------
   132 // CPbk2StartupMonitor::CPbk2StartupWaiter::CPbk2StartupWaiter
   140 // CPbk2StartupMonitor::CPbk2StartupWaiter::CPbk2StartupWaiter
   133 // EPriorityHigh because the timer must not be delayed due to other
   141 // EPriorityHigh because the timer must not be delayed due to other
   163     // be visible at least 1,5 seconds. In our case the operation starts
   171     // be visible at least 1,5 seconds. In our case the operation starts
   164     // when the first view is launched i.e. the view's DoActivateL notifies
   172     // when the first view is launched i.e. the view's DoActivateL notifies
   165     // the start up monitor.
   173     // the start up monitor.
   166     // Wait KOneSecond and then launch the wait note without delay.
   174     // Wait KOneSecond and then launch the wait note without delay.
   167     After( TTimeIntervalMicroSeconds32( KOneSecond ) );
   175     After( TTimeIntervalMicroSeconds32( KOneSecond ) );
       
   176     iDisplayWaitNote = ETrue;
   168     }
   177     }
   169 
   178 
   170 // --------------------------------------------------------------------------
   179 // --------------------------------------------------------------------------
   171 // CPbk2StartupMonitor::CPbk2StartupWaiter::NewL
   180 // CPbk2StartupMonitor::CPbk2StartupWaiter::NewL
   172 // --------------------------------------------------------------------------
   181 // --------------------------------------------------------------------------
   191     Cancel();
   200     Cancel();
   192     if ( iDecorator )
   201     if ( iDecorator )
   193         {
   202         {
   194         iDecorator->ProcessStopped();
   203         iDecorator->ProcessStopped();
   195         }
   204         }
       
   205     iDisplayWaitNote = ETrue;
   196     }
   206     }
   197 
   207 
   198 // --------------------------------------------------------------------------
   208 // --------------------------------------------------------------------------
   199 // CPbk2StartupMonitor::CPbk2StartupWaiter::Restart
   209 // CPbk2StartupMonitor::CPbk2StartupWaiter::Restart
   200 // --------------------------------------------------------------------------
   210 // --------------------------------------------------------------------------
   201 //
   211 //
   202 void CPbk2StartupMonitor::CPbk2StartupWaiter::Restart()
   212 void CPbk2StartupMonitor::CPbk2StartupWaiter::Restart()
   203     {
   213     {
   204     Cancel();
   214     Cancel();
   205     After( TTimeIntervalMicroSeconds32( KOneSecond ) );
   215     After( TTimeIntervalMicroSeconds32( KOneSecond ) );
       
   216     }
       
   217 
       
   218 // --------------------------------------------------------------------------
       
   219 // CPbk2StartupMonitor::CPbk2StartupWaiter::DisableWaitNote
       
   220 // --------------------------------------------------------------------------
       
   221 //
       
   222 void CPbk2StartupMonitor::CPbk2StartupWaiter::DisableWaitNote()
       
   223     {
       
   224     iDisplayWaitNote = EFalse;
   206     }
   225     }
   207 
   226 
   208 // --------------------------------------------------------------------------
   227 // --------------------------------------------------------------------------
   209 // CPbk2StartupMonitor::CPbk2StartupWaiter::RunL
   228 // CPbk2StartupMonitor::CPbk2StartupWaiter::RunL
   210 // --------------------------------------------------------------------------
   229 // --------------------------------------------------------------------------
   216     	{
   235     	{
   217 		iDecorator = Pbk2ProcessDecoratorFactory::CreateWaitNoteDecoratorL
   236 		iDecorator = Pbk2ProcessDecoratorFactory::CreateWaitNoteDecoratorL
   218 				( R_QTN_FDN_READING_MEMORY_WAIT_NOTE, EFalse );
   237 				( R_QTN_FDN_READING_MEMORY_WAIT_NOTE, EFalse );
   219 		iDecorator->SetObserver(*this);
   238 		iDecorator->SetObserver(*this);
   220     	}
   239     	}
   221     if( !iStarted ) // don't start twice
   240     if( !iStarted && iDisplayWaitNote ) // don't start twice
   222     	{
   241     	{
   223 		const TInt dummy = 0; // wait note doesn't care about amount
   242 		const TInt dummy = 0; // wait note doesn't care about amount
   224 		iDecorator->ProcessStartedL(dummy);
   243 		iDecorator->ProcessStartedL(dummy);
   225 		iStarted = ETrue;
   244 		iStarted = ETrue;
   226     	}
   245     	}
       
   246     iDisplayWaitNote = ETrue;
   227     }
   247     }
   228 
   248 
   229 // --------------------------------------------------------------------------
   249 // --------------------------------------------------------------------------
   230 // CPbk2StartupMonitor::CPbk2StartupWaiter::RunError
   250 // CPbk2StartupMonitor::CPbk2StartupWaiter::RunError
   231 // --------------------------------------------------------------------------
   251 // --------------------------------------------------------------------------
   232 //
   252 //
   233 TInt CPbk2StartupMonitor::CPbk2StartupWaiter::RunError( TInt aError )
   253 TInt CPbk2StartupMonitor::CPbk2StartupWaiter::RunError( TInt aError )
   234     {
   254     {
   235     CCoeEnv::Static()->HandleError(aError);
   255     CCoeEnv::Static()->HandleError(aError);
   236     iStarted = EFalse;
   256     iStarted = EFalse;
       
   257     iDisplayWaitNote = ETrue;
   237     if (iDecorator)
   258     if (iDecorator)
   238         {
   259         {
   239         iDecorator->ProcessStopped();
   260         iDecorator->ProcessStopped();
   240         }
   261         }
   241     return KErrNone;
   262     return KErrNone;
   832         }
   853         }
   833     
   854     
   834     return nativePhoneBookView;
   855     return nativePhoneBookView;
   835     }
   856     }
   836 
   857 
       
   858 // --------------------------------------------------------------------------
       
   859 // CPbk2StartupMonitor::Extension
       
   860 // --------------------------------------------------------------------------
       
   861 //
       
   862 TAny* CPbk2StartupMonitor::StartupMonitorExtension( TUid aExtensionUid )
       
   863     {
       
   864     if( aExtensionUid == KPbk2StartupMonitorExtensionUid )
       
   865         {
       
   866         return static_cast<MPbk2StartupMonitorExtension*>( this );
       
   867         }
       
   868     return NULL;
       
   869     }
       
   870 
       
   871 // --------------------------------------------------------------------------
       
   872 // CPbk2StartupMonitor::DisableWaitNote
       
   873 // --------------------------------------------------------------------------
       
   874 //
       
   875 void  CPbk2StartupMonitor::DisableMonitoring()
       
   876     {
       
   877     iWaiter->DisableWaitNote();
       
   878     }
       
   879 
   837 // End of File
   880 // End of File