1 /* |
|
2 * Copyright (c) 2005-2006 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: Keylock |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAISCUTKEYLOCK_H |
|
20 #define CAISCUTKEYLOCK_H |
|
21 |
|
22 #include <aknkeylock.h> |
|
23 #include "caiscuttarget.h" |
|
24 |
|
25 /** |
|
26 * Takes care of locking the keypad. |
|
27 * |
|
28 * @since S60 v3.2 |
|
29 */ |
|
30 class CAiScutTargetKeyLock : public CAiScutTarget |
|
31 { |
|
32 public: // Constructors and destructor |
|
33 |
|
34 /** |
|
35 * Two-phased constructor. |
|
36 * @param |
|
37 * @return new instance. |
|
38 */ |
|
39 static CAiScutTargetKeyLock* NewL( |
|
40 CAiScutEngine& aEngine, TShortcutType aType, const TDesC& aTarget); |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CAiScutTargetKeyLock(); |
|
46 |
|
47 /** |
|
48 * Returns the shortcut definition string |
|
49 * |
|
50 * @since S60 v3.2 |
|
51 * @return Shortcut definition string |
|
52 */ |
|
53 TPtrC Definition() const; |
|
54 |
|
55 /** |
|
56 * Returns the shortcut target caption. |
|
57 * Caption can be either a descriptor or a resource id. |
|
58 * If the return value has a non-zero value, it is the resource id. |
|
59 * Zero indicates that the descriptor reference parameter is used. |
|
60 * Default implementation returns KErrNotSupported; |
|
61 * |
|
62 * Getting the target caption and icon utilizes the "lazy evaluation" idiom |
|
63 * which means they are created only when they are first needed. This is because |
|
64 * there are (atleast) two scenarios where they are never needed: |
|
65 * 1. The active theme does not support shortcut captions or icons. |
|
66 * 2. Shortcuts launched using LaunchByValue are never published. |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 * @param aDes On return, the descriptor if used |
|
70 * @return The resource id or zero to indicate that the descriptor is used. |
|
71 */ |
|
72 TInt GetCaption(TPtrC& aDes, TAiScutAppTitleType aTitleType) const; |
|
73 |
|
74 /** |
|
75 * Returns the shortcut target icon. |
|
76 * Icon can be either an icon pointer or a resource id. |
|
77 * If the return value has a non-zero value, it is the resource id. |
|
78 * Zero indicates that the icon pointer is used. |
|
79 * Default implementation returns KErrNotSupported; |
|
80 * |
|
81 * Uses the "lazy evaluation" idiom to get the icon. See Caption() |
|
82 * |
|
83 * @since S60 v3.2 |
|
84 * @param aIcon On return, the icon pointer if used |
|
85 * @return The resource id or zero to indicate that the icon pointer is used. |
|
86 */ |
|
87 TInt GetIcon(CGulIcon*& aIcon) const; |
|
88 |
|
89 /** |
|
90 * Checks if the shortcut target is accessible |
|
91 * |
|
92 * @since S60 v3.2 |
|
93 * @param aCheckType Specifies which kind of shortcuts should check its access |
|
94 * @return ETrue if accessible, EFalse if not |
|
95 */ |
|
96 TBool IsAccessibleL(TInt aCheckType); |
|
97 |
|
98 /** |
|
99 * Launches the shortcut |
|
100 * |
|
101 * @since S60 v3.2 |
|
102 */ |
|
103 void LaunchL(); |
|
104 |
|
105 /** |
|
106 * Return application uid this target launches. |
|
107 * |
|
108 * @since S60 v3.2 |
|
109 */ |
|
110 TUid AppUid() const; |
|
111 |
|
112 private: // New methods |
|
113 |
|
114 /** |
|
115 * Enables keylock. |
|
116 */ |
|
117 void EnableKeyLock(); |
|
118 |
|
119 /** |
|
120 * Checks if keylock is enabled. |
|
121 */ |
|
122 TBool IsKeyLockEnabled(); |
|
123 |
|
124 /** |
|
125 * C++ default constructor. |
|
126 */ |
|
127 CAiScutTargetKeyLock(CAiScutEngine& aEngine, TShortcutType aType); |
|
128 |
|
129 /** |
|
130 * By default Symbian OS constructor is private. |
|
131 */ |
|
132 void ConstructL(const TDesC& aTarget); |
|
133 |
|
134 private: // Data |
|
135 |
|
136 /** |
|
137 * Keylock |
|
138 */ |
|
139 RAknKeylock2 iKeyLock; |
|
140 |
|
141 /** |
|
142 * Holds the shortcut definition string |
|
143 * Owned. |
|
144 */ |
|
145 HBufC* iDefinition; |
|
146 |
|
147 }; |
|
148 |
|
149 #endif // CAIKEYLOCK_H |
|
150 |
|
151 // End of File. |
|