1 /* |
|
2 * Copyright (c) 2002 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 |
|
19 #ifndef _AUTOLOCKMODELPS_H__ |
|
20 #define _AUTOLOCKMODELPS_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <aknappui.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 class CUserActivityManager; |
|
27 class CAutolockCenRepI; |
|
28 class CAutolockAppUi; |
|
29 class CLockObserver; |
|
30 |
|
31 class CAutoLockModel : public CBase |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Creates instance of the CAutoLockModel class. |
|
36 * |
|
37 * @param aAppUi (pointer to autolock appui) |
|
38 * @return Returns the instance just created. |
|
39 */ |
|
40 static CAutoLockModel* NewL(CAutolockAppUi* aAppUi, TBool aLocked ); |
|
41 /** |
|
42 * Symbian OS constructor. |
|
43 */ |
|
44 void ConstructL( TBool aLocked ); |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CAutoLockModel(); |
|
49 public: |
|
50 /** |
|
51 * Gets new autolock period and starts monitoring user activity |
|
52 */ |
|
53 void ResetInactivityTimeout(); |
|
54 /** |
|
55 * Brings autolock app to foreground and locks the system |
|
56 */ |
|
57 void LockSystemL(TInt aAutolockState = 0); |
|
58 /** |
|
59 * Sets device lock value in SharedData and in SystemAgent |
|
60 * |
|
61 * @param: aLocked (decice lock on/off) |
|
62 */ |
|
63 void SetLockedL(TInt aAutolockState = 0); |
|
64 private: |
|
65 /** |
|
66 * C++ default constructor. |
|
67 * |
|
68 * @param aAppUi (pointer to autolock appui) |
|
69 */ |
|
70 CAutoLockModel(CAutolockAppUi* aAppUi); |
|
71 private: |
|
72 /** |
|
73 * Return current autolock period |
|
74 * |
|
75 * @return TInt (autolock period in minutes) |
|
76 */ |
|
77 TInt AutoLockTimeout(); |
|
78 /** |
|
79 * Handles Active event. Called by ActivityManager |
|
80 * |
|
81 * @param aPtr |
|
82 * @return KErNone |
|
83 */ |
|
84 static TInt HandleActiveEventL(TAny* aPtr); |
|
85 /** |
|
86 * Handles Inactive event. Called by ActivityManager |
|
87 * |
|
88 * @param aPtr (pointer to CAutoLockModel) |
|
89 * @return KErNone |
|
90 */ |
|
91 static TInt HandleInactiveEventL(TAny* aPtr); |
|
92 /** |
|
93 * Starts monitoring user activity |
|
94 */ |
|
95 void StartActivityMonitoringL(); |
|
96 /** |
|
97 * Stop monitoring user activity. |
|
98 */ |
|
99 void StopActivityMonitoring(); |
|
100 /** |
|
101 * Initializes activymanager |
|
102 */ |
|
103 void SetActivityManagerL(); |
|
104 /** |
|
105 * UnInitializes activymanager |
|
106 */ |
|
107 void CancelActivityManager(); |
|
108 private: //data |
|
109 CUserActivityManager* iActivityManager; |
|
110 CAutolockAppUi* iAppUi; //not owned! |
|
111 CAutolockCenRepI* iCenRepI; |
|
112 CLockObserver* iLockObserver; |
|
113 TBool iMonitoring; |
|
114 RProperty iProperty; |
|
115 }; |
|
116 #endif |
|
117 // END OF FILE |
|