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