phonebookui/Phonebook2/UIControls/src/CPbk2PredictiveSearchSettingItem.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 *       Provides methods for predictive search settings item.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbk2PredictiveSearchSettingItem.h"   // This class
       
    22 #include "Phonebook2PrivateCRKeys.h"
       
    23 
       
    24 #include <centralrepository.h>
       
    25 
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 CPbk2PredictiveSearchSettingItem::CPbk2PredictiveSearchSettingItem(     
       
    30         TInt aResourceId, 
       
    31         TInt& aValue) : 
       
    32         CAknBinaryPopupSettingItem( aResourceId, aValue )
       
    33     {
       
    34     }
       
    35 
       
    36 void CPbk2PredictiveSearchSettingItem::StoreL()
       
    37     {
       
    38     CAknEnumeratedTextPopupSettingItem::StoreL();
       
    39     TInt value = ExternalValue();
       
    40     SetPredictiveSearchModeL( value );
       
    41     }
       
    42 
       
    43 void CPbk2PredictiveSearchSettingItem::SetPredictiveSearchModeL( TBool aPredictiveMode )
       
    44     {
       
    45     CRepository* rep = CRepository::NewL(TUid::Uid(KCRUidPhonebook));
       
    46 
       
    47     TInt err( rep->Set( KPhonebookPredictiveSearchEnablerFlags, aPredictiveMode ) );            
       
    48     if ( err )
       
    49         {
       
    50         rep->Create( KPhonebookPredictiveSearchEnablerFlags, aPredictiveMode );
       
    51         }
       
    52     
       
    53     delete rep;
       
    54     }
       
    55 
       
    56 //  End of File