phonebookui/Phonebook2/Presentation/src/CPbk2StoreConfigurationMonitor.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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: 
       
    15 *     Phonebook 2 contact store configuration monitor.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbk2StoreConfigurationMonitor.h"
       
    22 
       
    23 // From Phonebook 2
       
    24 #include <Phonebook2InternalCRKeys.h>
       
    25 #include <MPbk2StoreConfigurationObserver.h>
       
    26 
       
    27 // From System
       
    28 #include <centralrepository.h>
       
    29 
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 
       
    33 // --------------------------------------------------------------------------
       
    34 // CPbk2StoreConfigurationMonitor::CPbk2StoreConfigurationMonitor
       
    35 // --------------------------------------------------------------------------
       
    36 //
       
    37 CPbk2StoreConfigurationMonitor::CPbk2StoreConfigurationMonitor(
       
    38         CRepository& aRepository,
       
    39         MPbk2StoreConfigurationObserver& aObserver) :
       
    40     CActive(EPriorityStandard),
       
    41     iRepository(aRepository),
       
    42     iObserver(aObserver)
       
    43     {
       
    44     CActiveScheduler::Add(this);
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 // CPbk2StoreConfigurationMonitor::~CPbk2StoreConfigurationMonitor
       
    49 // --------------------------------------------------------------------------
       
    50 //
       
    51 CPbk2StoreConfigurationMonitor::~CPbk2StoreConfigurationMonitor()
       
    52     {
       
    53     Cancel();
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------
       
    57 // CPbk2StoreConfigurationMonitor::NewL
       
    58 // --------------------------------------------------------------------------
       
    59 //
       
    60 CPbk2StoreConfigurationMonitor* CPbk2StoreConfigurationMonitor::NewL(
       
    61         CRepository& aRepository,
       
    62         MPbk2StoreConfigurationObserver& aObserver)
       
    63     {
       
    64     CPbk2StoreConfigurationMonitor* self =
       
    65         new(ELeave) CPbk2StoreConfigurationMonitor(aRepository, aObserver);
       
    66     CleanupStack::PushL(self);
       
    67     self->ConstructL();
       
    68     CleanupStack::Pop(self);
       
    69     return self;
       
    70     }
       
    71 
       
    72 // --------------------------------------------------------------------------
       
    73 // CPbk2StoreConfigurationMonitor::ConstructL
       
    74 // --------------------------------------------------------------------------
       
    75 //
       
    76 inline void CPbk2StoreConfigurationMonitor::ConstructL()
       
    77     {
       
    78     RenewRequestL();
       
    79     }
       
    80     
       
    81 // --------------------------------------------------------------------------
       
    82 // CPbk2StoreConfigurationMonitor::RenewRequestL
       
    83 // --------------------------------------------------------------------------
       
    84 //
       
    85 void CPbk2StoreConfigurationMonitor::RenewRequestL()
       
    86     {
       
    87     User::LeaveIfError(iRepository.NotifyRequest(
       
    88         KPhonebookCurrentConfigurationPartialKey,
       
    89         KPhonebookCurrentConfigurationMask, iStatus));
       
    90     SetActive();
       
    91     }
       
    92 
       
    93 // --------------------------------------------------------------------------
       
    94 // CPbk2StoreConfigurationMonitor::RunL
       
    95 // --------------------------------------------------------------------------
       
    96 //
       
    97 void CPbk2StoreConfigurationMonitor::RunL()
       
    98     {
       
    99     RenewRequestL();
       
   100     iObserver.ConfigurationChanged();
       
   101     }
       
   102     
       
   103 // --------------------------------------------------------------------------
       
   104 // CPbk2StoreConfigurationMonitor::DoCancel
       
   105 // --------------------------------------------------------------------------
       
   106 //
       
   107 void CPbk2StoreConfigurationMonitor::DoCancel()
       
   108     {
       
   109     iRepository.NotifyCancelAll();
       
   110     }
       
   111 
       
   112 // End of File