|
1 /* |
|
2 * Copyright (c) 2002-2007 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 #ifndef __AKNNOTIFIERCONTROLLERPLUGIN_H__ |
|
19 #define __AKNNOTIFIERCONTROLLERPLUGIN_H__ |
|
20 |
|
21 #include <AknNotifierControllerUtilities.h> |
|
22 #include <AknNotifierWrapper.h> |
|
23 #include <aknkeylock.h> |
|
24 |
|
25 enum TKeyLockStatus |
|
26 { |
|
27 EKeyLockStopNotifications = 1, |
|
28 EKeyLockAllowNotifications = 2, |
|
29 EKeyLockEnabled = 3, |
|
30 EKeyLockDisabled = 4, |
|
31 EKeyLockCancelNotification = 5, |
|
32 EKeyLockOffered = 6, |
|
33 EHideSoftNotifications = 7, |
|
34 EShowSoftNotifications = 8 |
|
35 }; |
|
36 |
|
37 // MAknKeyLockObserver |
|
38 // Notifier must derive from this in order to reveive notfication as to when |
|
39 // the keylock status has changed |
|
40 class MAknKeyLockObserver |
|
41 { |
|
42 public: |
|
43 virtual void KeyLockStatusChange(TKeyLockStatus aStatus) = 0; |
|
44 }; |
|
45 |
|
46 |
|
47 // MAknKeyLockController |
|
48 // The MAknKeyLockController is used by notifier in order to control the keylock mechanism |
|
49 class MAknKeyLockController |
|
50 { |
|
51 public: |
|
52 virtual TBool IsKeyLockEnabled() = 0; |
|
53 virtual TBool AllowNotifications() = 0; |
|
54 virtual void UnlockKeys() = 0; |
|
55 virtual void LockKeys(TBool aAutoLockOn = EFalse) = 0; |
|
56 virtual void AddObserverL(MAknKeyLockObserver* aObserver) = 0; |
|
57 virtual void RemoveObserver(MAknKeyLockObserver* aObserver) = 0; |
|
58 }; |
|
59 |
|
60 class CAknNotifierController: public CBase, public MAknKeyLockController |
|
61 { |
|
62 public: |
|
63 IMPORT_C void RegisterNotifierControllerPlugin(CAknNotifierWrapper* aMe, TBool aUnregister = EFalse); |
|
64 IMPORT_C void RegisterPreloadPluginL(CAknCommonNotifierWrapper* aNotifier); |
|
65 void NotifyAppServers(TInt aCmd); |
|
66 |
|
67 public: |
|
68 static CAknNotifierController* NewL(); |
|
69 ~CAknNotifierController(); |
|
70 // From MAknKeyLockObserver |
|
71 TBool IsKeyLockEnabled(); |
|
72 TBool AllowNotifications(); |
|
73 void UnlockKeys(); |
|
74 void LockKeys(TBool aAutoLockOn = EFalse); |
|
75 void AddObserverL(MAknKeyLockObserver* aObserver); |
|
76 void RemoveObserver(MAknKeyLockObserver* aObserver); |
|
77 void DoAllowNotifications(); |
|
78 void DoStopNotifications(); |
|
79 void DoCancelAllNotificatons(); |
|
80 |
|
81 private: |
|
82 CAknNotifierController(); |
|
83 void ConstructL(); |
|
84 |
|
85 void NotifyStatusChange(TKeyLockStatus aStatus); |
|
86 |
|
87 TInt FindNotifierWrapperIndex(CAknNotifierWrapper* aPtr); |
|
88 |
|
89 TBool KeylockReady(); |
|
90 |
|
91 private: |
|
92 CArrayPtrFlat<MAknKeyLockObserver>* iObserverList; |
|
93 TBool iAllowNotifications; |
|
94 CAknNotifierControllerUtility* iController; |
|
95 TInt iResourceFileOffset; |
|
96 CArrayPtrFlat<CAknNotifierWrapper>* iRegisteredList; |
|
97 RAknKeylock2 iKeylock; |
|
98 |
|
99 public: |
|
100 RPointerArray<CAknCommonNotifierWrapper> iPreloadList; |
|
101 }; |
|
102 |
|
103 #endif // AKNNOTIFIERCONTROLLERPLUGIN |