gssettingsuis/Gs/GSPowerSavingQueryPlugin/Src/GSPowerSavingQueryPluginModel.cpp
branchRCL_3
changeset 54 7e0eff37aedb
parent 0 8c5d936e5675
equal deleted inserted replaced
53:8ee96d21d9bf 54:7e0eff37aedb
       
     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:  Model for Power saving query plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "GSPowerSavingQueryPluginModel.h"
       
    21 #include <settingsinternalcrkeys.h>
       
    22 #include <centralrepository.h>
       
    23 #include "GSPowerSavingQueryPlugin.hrh"
       
    24 #include "GsLogger.h"
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES  
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // LOCAL CONSTANTS AND MACROS
       
    35 
       
    36 // MODULE DATA STRUCTURES
       
    37 
       
    38 // LOCAL FUNCTION PROTOTYPES
       
    39 
       
    40 // ============================= LOCAL FUNCTIONS ==============================
       
    41 
       
    42 // ========================= MEMBER FUNCTIONS =================================
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CGSPowerSavingQueryPluginModel::NewL
       
    46 // 
       
    47 // Symbian OS two-phased constructor
       
    48 // ----------------------------------------------------------------------------
       
    49 //
       
    50 CGSPowerSavingQueryPluginModel* CGSPowerSavingQueryPluginModel::NewL()
       
    51     {
       
    52     CGSPowerSavingQueryPluginModel* self = 
       
    53                    new( ELeave ) CGSPowerSavingQueryPluginModel();
       
    54     
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL();
       
    57 
       
    58     CleanupStack::Pop( self );
       
    59     return self;
       
    60     }
       
    61 
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // CGSPowerSavingQueryPluginModel::CGSPowerSavingQueryPluginModel
       
    65 // 
       
    66 // 
       
    67 // C++ default constructor can NOT contain any code, that might leave.
       
    68 // ----------------------------------------------------------------------------
       
    69 //
       
    70 CGSPowerSavingQueryPluginModel::CGSPowerSavingQueryPluginModel()
       
    71     {
       
    72     
       
    73     }
       
    74 
       
    75 
       
    76 // ----------------------------------------------------------------------------
       
    77 // CGSPowerSavingQueryPluginModel::ConstructL
       
    78 // 
       
    79 // Symbian OS default constructor can leave.
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 void CGSPowerSavingQueryPluginModel::ConstructL()
       
    83     {
       
    84     __GSLOGSTRING("[CGSPowerSavingQueryPluginModel]-->CGSPowerSavingQueryPluginModel::ConstructL");
       
    85     
       
    86     iDeviceManagementRepository = 
       
    87                CRepository::NewL( KCRUidDeviceManagementSettings );
       
    88     
       
    89     __GSLOGSTRING("[CGSPowerSavingQueryPluginModel]<--CGSPowerSavingQueryPluginModel::ConstructL");
       
    90     }
       
    91 
       
    92 
       
    93 // ----------------------------------------------------------------------------
       
    94 // CGSPowerSavingQueryPluginModel::~CGSPowerSavingQueryPluginModel
       
    95 // 
       
    96 // Destructor
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 CGSPowerSavingQueryPluginModel::~CGSPowerSavingQueryPluginModel()
       
   100     {
       
   101     delete iDeviceManagementRepository;
       
   102     }
       
   103 
       
   104 // ----------------------------------------------------------------------------
       
   105 // CGSPowerSavingQueryPluginModel::PowerSavingQueryEnabled();
       
   106 // 
       
   107 // Reads power saving query value from central repository
       
   108 // ----------------------------------------------------------------------------
       
   109 //
       
   110 TInt CGSPowerSavingQueryPluginModel::PowerSavingQueryEnabled()
       
   111     {
       
   112     TInt queryValue( EGSPowerSavingQueryOff );
       
   113     iDeviceManagementRepository->Get( KSettingsPowerSavingQuery, queryValue );
       
   114     return queryValue;
       
   115     }
       
   116 
       
   117 
       
   118 // ----------------------------------------------------------------------------
       
   119 // CGSPowerSavingQueryPluginModel::EnablePowerSavingQuery
       
   120 // 
       
   121 // Writes power saving query value to central repository
       
   122 // ----------------------------------------------------------------------------
       
   123 //
       
   124 TBool CGSPowerSavingQueryPluginModel::EnablePowerSavingQuery(  TInt aQueryValue )
       
   125     {
       
   126     return iDeviceManagementRepository->Set( KSettingsPowerSavingQuery, 
       
   127               aQueryValue );    
       
   128     }
       
   129   
       
   130 // End of File