imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp
changeset 25 cb86b71cae0a
parent 17 ffa62e555b02
child 29 4bdfb6b5c9b4
equal deleted inserted replaced
22:a67f74060682 25:cb86b71cae0a
    23 // ---------------------------------------------------------------------------
    23 // ---------------------------------------------------------------------------
    24 //
    24 //
    25 CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
    25 CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
    26     {
    26     {
    27     TN_DEBUG1( "CTMActivityManager::NewL()");
    27     TN_DEBUG1( "CTMActivityManager::NewL()");
       
    28     
    28     CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
    29     CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
    29     CleanupStack::PushL(self);
    30     CleanupStack::PushL(self);
    30     self->ConstructL();
    31     self->ConstructL();
    31     CleanupStack::Pop(self);
    32     CleanupStack::Pop(self);
    32     return self;
    33     return self;
    38 //
    39 //
    39 CTMActivityManager::CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout)
    40 CTMActivityManager::CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout)
    40 : CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
    41 : CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
    41     {
    42     {
    42     TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
    43     TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
       
    44     
    43     CActiveScheduler::Add(this);
    45     CActiveScheduler::Add(this);
    44     }
    46     }
    45 
    47 
    46 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    47 // CTMActivityManager::~CTMActivityManager()
    49 // CTMActivityManager::~CTMActivityManager()
    48 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
    49 //
    51 //
    50 CTMActivityManager::~CTMActivityManager()
    52 CTMActivityManager::~CTMActivityManager()
    51     {
    53     {
    52     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
    54     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
       
    55     
    53 #ifdef MONITOR_LIGHTS
    56 #ifdef MONITOR_LIGHTS
    54     delete iLight;
    57     delete iLight;
    55     iLight = NULL;
    58     iLight = NULL;
    56 #endif
    59 #endif
       
    60     
    57     Cancel();
    61     Cancel();
    58     iTimer.Close();
    62     iTimer.Close();
    59     }
    63     }
    60  
    64  
    61 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    64 //
    68 //
    65 void CTMActivityManager::ConstructL()
    69 void CTMActivityManager::ConstructL()
    66     {
    70     {
    67     TN_DEBUG1( "CTMActivityManager::ConstructL()");
    71     TN_DEBUG1( "CTMActivityManager::ConstructL()");
       
    72     
    68     iTimer.CreateLocal();
    73     iTimer.CreateLocal();
    69     iWatch = ENone;
    74     iWatch = ENone;
    70     }
    75     }
    71 
    76 
    72 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    74 // ---------------------------------------------------------------------------
    79 // ---------------------------------------------------------------------------
    75 //
    80 //
    76 void CTMActivityManager::SetTimeout(TInt aTimeout)
    81 void CTMActivityManager::SetTimeout(TInt aTimeout)
    77     {
    82     {
    78     TN_DEBUG1( "CTMActivityManager::SetTimeout()");
    83     TN_DEBUG1( "CTMActivityManager::SetTimeout()");
       
    84     
    79     iTimeout = aTimeout;
    85     iTimeout = aTimeout;
    80     Reset();
    86     Reset();
    81     }
    87     }
    82 
    88 
    83 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    86 //
    92 //
    87 void CTMActivityManager::Reset()
    93 void CTMActivityManager::Reset()
    88     {
    94     {
    89     TN_DEBUG1( "CTMActivityManager::Reset()");
    95     TN_DEBUG1( "CTMActivityManager::Reset()");
       
    96 
    90 #ifdef MONITOR_LIGHTS
    97 #ifdef MONITOR_LIGHTS
    91     delete iLight;
    98     delete iLight;
    92     iLight = NULL;
    99     iLight = NULL;
    93 #endif
   100 #endif
       
   101     
    94     Cancel();
   102     Cancel();
    95     Start();
   103     Start();
    96     }
   104     }
    97  
   105  
    98 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
    99 // CTMActivityManager::DoCancel()
   107 // CTMActivityManager::DoCancel()
   100 // ---------------------------------------------------------------------------
   108 // ---------------------------------------------------------------------------
   101 void CTMActivityManager::DoCancel()
   109 void CTMActivityManager::DoCancel()
   102     {
   110     {
   103     TN_DEBUG1( "CTMActivityManager::DoCancel()");
   111     TN_DEBUG1( "CTMActivityManager::DoCancel()");
       
   112     
       
   113 #ifdef MONITOR_LIGHTS
       
   114     delete iLight;
       
   115     iLight = NULL;
       
   116 #endif
       
   117     
   104     iTimer.Cancel();
   118     iTimer.Cancel();
   105     iWatch = ENone;
   119     iWatch = ENone;
   106     }
   120     }
   107 
   121 
   108 // ---------------------------------------------------------------------------
   122 // ---------------------------------------------------------------------------
   277 // -----------------------------------------------------------------------------
   291 // -----------------------------------------------------------------------------
   278 //
   292 //
   279 void CTMActivityManager::NotifyObserver()
   293 void CTMActivityManager::NotifyObserver()
   280     {
   294     {
   281     TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
   295     TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
       
   296     
   282     TBool status = IsInactive();
   297     TBool status = IsInactive();
   283     
   298     
   284     if( iPreviousStatus != status )
   299     if( iPreviousStatus != status )
   285         {
   300         {
   286         iPreviousStatus = status; 
   301         iPreviousStatus = status;