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 #include "cpdisplaymodel_p.h" |
|
19 #include <qglobal.h> |
|
20 #include <e32base.h> |
|
21 #include <hal.h> |
|
22 #include <centralrepository.h> |
|
23 #include <settingsinternalcrkeys.h> // KCRUidSecuritySettings |
|
24 #include <hwrmlightdomaincrkeys.h> // KCRUidLightSettings |
|
25 #include <featmgr.h> |
|
26 |
|
27 CpDisplayModelPrivate::CpDisplayModelPrivate() |
|
28 { |
|
29 mLightCenRep = CRepository::NewL( KCRUidLightSettings ); |
|
30 mSecurityCenRep = CRepository::NewL( KCRUidSecuritySettings ); |
|
31 } |
|
32 |
|
33 CpDisplayModelPrivate::~CpDisplayModelPrivate() |
|
34 { |
|
35 delete mLightCenRep; |
|
36 mLightCenRep = 0; |
|
37 |
|
38 delete mSecurityCenRep; |
|
39 mSecurityCenRep = 0; |
|
40 } |
|
41 |
|
42 bool CpDisplayModelPrivate::isKeyguardSupported() |
|
43 { |
|
44 return true; |
|
45 } |
|
46 |
|
47 int CpDisplayModelPrivate::keyguard() |
|
48 { |
|
49 int period = 0; |
|
50 |
|
51 if ( mSecurityCenRep-> |
|
52 Get( KSettingsAutomaticKeyguardTime, period ) != KErrNone ){ |
|
53 period = 60; |
|
54 mSecurityCenRep->Set( KSettingsAutomaticKeyguardTime, period ); |
|
55 } |
|
56 |
|
57 return period/5; |
|
58 } |
|
59 |
|
60 void CpDisplayModelPrivate::setKeyguard(int value) |
|
61 { |
|
62 value *= 5; |
|
63 mSecurityCenRep->Set( KSettingsAutomaticKeyguardTime, value ); |
|
64 } |
|
65 |
|
66 bool CpDisplayModelPrivate::isBacklightSupported() |
|
67 { |
|
68 return true; |
|
69 } |
|
70 |
|
71 int CpDisplayModelPrivate::backlight() |
|
72 { |
|
73 int time = 0; |
|
74 mLightCenRep->Get( KDisplayLightsTimeout, time ); |
|
75 return time/5; |
|
76 } |
|
77 |
|
78 void CpDisplayModelPrivate::setBacklight(int value) |
|
79 { |
|
80 value *=5; |
|
81 mLightCenRep->Set( KDisplayLightsTimeout, value ); |
|
82 } |
|
83 |
|
84 bool CpDisplayModelPrivate::isBrightnessSupported() |
|
85 { |
|
86 if ( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl ) ){ |
|
87 return true; |
|
88 } else { |
|
89 return false; |
|
90 } |
|
91 } |
|
92 |
|
93 int CpDisplayModelPrivate::brightness() |
|
94 { |
|
95 int time = 0; |
|
96 mLightCenRep->Get( KLightIntensity, time ); |
|
97 return time; |
|
98 } |
|
99 |
|
100 void CpDisplayModelPrivate::setBrightness(int value) |
|
101 { |
|
102 mLightCenRep->Set( KLightIntensity, value ); |
|
103 } |
|
104 |
|
105 // End of the file |
|