messagingfw/senduiservices/watcher/src/senduipropertyobserver.cpp
branchRCL_3
changeset 22 d2c4c66342f3
parent 21 e5b3a2155e1a
child 23 d51193d814ea
equal deleted inserted replaced
21:e5b3a2155e1a 22:d2c4c66342f3
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Launches SendUi Service Resolver in the event of:
       
    15 *                - refresh request.
       
    16 *                - MTM amount has changed since previous boot
       
    17 *                - Phone language has change since previous boot
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 #include "senduipropertyobserver.h"
       
    28 #include "senduiproperty.h"
       
    29 #include "senduiwatcher.h"
       
    30 
       
    31 // ======== LOCAL FUNCTIONS ========
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // NewL
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CSendUiPropertyObserver* CSendUiPropertyObserver::NewL( CSendUiWatcher* aWatcher )
       
    38     {
       
    39     CSendUiPropertyObserver* self = new ( ELeave ) CSendUiPropertyObserver( aWatcher );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop( self );
       
    43     return self;
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // NewL
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CSendUiPropertyObserver::~CSendUiPropertyObserver()
       
    51     {
       
    52     iPropertyUpdateRequest.Close();
       
    53     Cancel();
       
    54     }
       
    55 // ---------------------------------------------------------------------------
       
    56 // ConstructL
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 void CSendUiPropertyObserver::ConstructL()
       
    60     {
       
    61     CActiveScheduler::Add( this );
       
    62     
       
    63     User::LeaveIfError( 
       
    64         iPropertyUpdateRequest.Attach( KPSUidSendUiProperty, KSendUiUpdateRequest ) );
       
    65 
       
    66     iPropertyUpdateRequest.Subscribe( iStatus );
       
    67 
       
    68     SetActive();
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Constructor
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 CSendUiPropertyObserver::CSendUiPropertyObserver( CSendUiWatcher* aParent )
       
    76     : CActive( CActive::EPriorityStandard ),
       
    77     iParent( aParent )
       
    78     {
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // From class CActive
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CSendUiPropertyObserver::DoCancel()
       
    86     {
       
    87     iPropertyUpdateRequest.Close();
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // From class CActive
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CSendUiPropertyObserver::RunL()
       
    95     {
       
    96     TInt value;
       
    97     if ( ( iPropertyUpdateRequest.Get(value) ) != KErrNotFound 
       
    98         && value == KSendUiUpdateRequested )
       
    99         {
       
   100             iParent->HandleUpdateServicesL( );
       
   101         }
       
   102     iPropertyUpdateRequest.Subscribe( iStatus );
       
   103     SetActive();
       
   104     }
       
   105 
       
   106 // end of file