imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp
changeset 29 4bdfb6b5c9b4
parent 14 2edacbf5d3f9
child 39 1a8af2cd6858
equal deleted inserted replaced
25:cb86b71cae0a 29:4bdfb6b5c9b4
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 
    20 
    21 #include "tmshutdownobserver.h"
    21 #include "tmshutdownobserver.h"
    22 #include "thumbnailmanagerconstants.h"
    22 #include "thumbnailmanagerconstants.h"
       
    23 #include "thumbnaillog.h"
    23 
    24 
    24 // ---------------------------------------------------------------------------
    25 // ---------------------------------------------------------------------------
    25 // CTMShutdownObserver::NewL()
    26 // CTMShutdownObserver::NewL()
    26 // ---------------------------------------------------------------------------
    27 // ---------------------------------------------------------------------------
    27 //
    28 //
    58 // CTMShutdownObserver::ConstructL()
    59 // CTMShutdownObserver::ConstructL()
    59 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    60 //
    61 //
    61 void CTMShutdownObserver::ConstructL()
    62 void CTMShutdownObserver::ConstructL()
    62     { 
    63     { 
       
    64     TN_DEBUG1( "CTMShutdownObserver::ConstructL()" );
    63     // define P&S property types
    65     // define P&S property types
    64     if (iDefineKey)
    66     if (iDefineKey)
    65         {
    67         {
       
    68         TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" );
    66         RProperty::Define(iKeyCategory,iPropertyKey,
    69         RProperty::Define(iKeyCategory,iPropertyKey,
    67                           RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
    70                           RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
    68         }
    71         }
    69     
    72     
    70     // attach to the property
    73     // attach to the property
    71     TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
    74     TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
       
    75     TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err );
    72     User::LeaveIfError(err);
    76     User::LeaveIfError(err);
    73     
    77     
    74     // wait for the previously attached property to be updated
    78     // wait for the previously attached property to be updated
    75     iProperty.Subscribe(iStatus);
    79     iProperty.Subscribe(iStatus);
       
    80     TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" );
    76     SetActive();
    81     SetActive();
    77     }
    82     }
    78 
    83 
    79 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    80 // CTMShutdownObserver::~CTMShutdownObserver()
    85 // CTMShutdownObserver::~CTMShutdownObserver()
    81 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    82 //
    87 //
    83 CTMShutdownObserver::~CTMShutdownObserver()
    88 CTMShutdownObserver::~CTMShutdownObserver()
    84     {
    89     {
       
    90     TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" );
    85     Cancel();
    91     Cancel();
    86     iProperty.Close();
    92     iProperty.Close();
    87     }
    93     }
    88 
    94 
    89 // ---------------------------------------------------------------------------
    95 // ---------------------------------------------------------------------------
    90 // CTMShutdownObserver::RunL()
    96 // CTMShutdownObserver::RunL()
    91 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
    92 //
    98 //
    93 void CTMShutdownObserver::RunL()
    99 void CTMShutdownObserver::RunL()
    94     {
   100     {
       
   101     TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() );
    95     // resubscribe before processing new value to prevent missing updates
   102     // resubscribe before processing new value to prevent missing updates
    96     iProperty.Subscribe(iStatus);
   103     iProperty.Subscribe(iStatus);
    97     SetActive();
   104     SetActive();
    98     
   105     
    99     // retrieve the value
   106     // retrieve the value
   100     TInt value = 0;
   107     TInt value = 0;
   101     iProperty.Get(value);
   108     TInt err = iProperty.Get(value);
       
   109     
       
   110     TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err );
   102 
   111 
   103     // observer callback
   112     // observer callback
   104     if (value)
   113     if (value)
   105         {
   114         {
   106         iObserver.ShutdownNotification();
   115         iObserver.ShutdownNotification();
   111 // CTMShutdownObserver::DoCancel()
   120 // CTMShutdownObserver::DoCancel()
   112 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------
   113 //
   122 //
   114 void CTMShutdownObserver::DoCancel()
   123 void CTMShutdownObserver::DoCancel()
   115     {
   124     {
       
   125     TN_DEBUG1( "CTMShutdownObserver::DoCancel()" );
   116     iProperty.Cancel();
   126     iProperty.Cancel();
   117     }
   127     }
   118 
   128 
   119 // End of file
   129 // End of file