radioengine/settings/src/cradioapplicationsettings.cpp
branchRCL_3
changeset 19 cce62ebc198e
equal deleted inserted replaced
18:1a6714c53019 19:cce62ebc198e
       
     1 /*
       
     2 * Copyright (c) 2009 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 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <centralrepository.h>
       
    20 
       
    21 // User includes
       
    22 #include "cradiosettingsimp.h"
       
    23 #include "radiointernalcrkeys.h"
       
    24 #include "cradioapplicationsettings.h"
       
    25 #include "cradioenginelogger.h"
       
    26 
       
    27 // This has to be the last include.
       
    28 #ifdef STUB_CONSTELLATION
       
    29 #   include <RadioStubManager.h>
       
    30 #endif //STUB_CONSTELLATION
       
    31 
       
    32 // ======== MEMBER FUNCTIONS ========
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CRadioApplicationSettings* CRadioApplicationSettings::NewL()
       
    39     {
       
    40     LEVEL3( LOG_METHOD_AUTO );
       
    41     CRadioApplicationSettings* self = new ( ELeave ) CRadioApplicationSettings();
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 void CRadioApplicationSettings::ConstructL()
       
    53     {
       
    54     LEVEL2( LOG_METHOD_AUTO );
       
    55     iRepository = CRepository::NewL( KRadioCRUid );
       
    56     LOG_FORMAT( "iRepository = %i", iRepository );
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CRadioApplicationSettings::CRadioApplicationSettings()
       
    64     {
       
    65     LEVEL3( LOG_METHOD_AUTO );
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CRadioApplicationSettings::~CRadioApplicationSettings()
       
    73     {
       
    74     LEVEL3( LOG_METHOD_AUTO );
       
    75     delete iRepository;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // From class MRadioApplicationSettings.
       
    80 //
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 TBool CRadioApplicationSettings::IsFirstTimeStart()
       
    84     {
       
    85     LEVEL3( LOG_METHOD_AUTO );
       
    86     TInt startCount = 0;
       
    87     iRepository->Get( KRadioCRLaunchCount, startCount );
       
    88 
       
    89     return startCount == 0;
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // From class MRadioApplicationSettings.
       
    94 //
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CRadioApplicationSettings::SetFirstTimeStartPerformed( TBool aFirstTimeStartPerformed )
       
    98     {
       
    99     LEVEL3( LOG_METHOD_AUTO );
       
   100     iRepository->Set( KRadioCRLaunchCount, aFirstTimeStartPerformed ? 1 : 0 );
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // From class MRadioApplicationSettings.
       
   106 //
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 TInt CRadioApplicationSettings::SetUiFlags( TUint aUiFlags )
       
   110     {
       
   111     LEVEL3( LOG_METHOD_AUTO );
       
   112     return iRepository->Set( KRadioCRUiFlags, static_cast<TInt>( aUiFlags ) );
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // From class MRadioApplicationSettings.
       
   117 //
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 TUint CRadioApplicationSettings::UiFlags() const
       
   121     {
       
   122     LEVEL3( LOG_METHOD_AUTO );
       
   123     TInt uiFlags( 0 );
       
   124     iRepository->Get( KRadioCRUiFlags, uiFlags );
       
   125     return static_cast<TUint>( uiFlags );
       
   126     }