|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of policymanagement components |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef POLICTY_ENGINE_UI_HEADER_ |
|
21 #define POLICTY_ENGINE_UI_HEADER_ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <eiknotapi.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 _LIT8( KUserAcceptMark, "A"); |
|
30 _LIT8( KUserDenyMark, "D"); |
|
31 const TUint KDelimeterChar = '|'; |
|
32 |
|
33 enum TUserResponse |
|
34 { |
|
35 EUserAccept, |
|
36 EUserDeny, |
|
37 }; |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 class CCoeEnv; |
|
42 class CPolicyEngineUi; |
|
43 |
|
44 |
|
45 class CPolicyEngineNotifier : public CBase, public MEikSrvNotifierBase2 |
|
46 { |
|
47 public: |
|
48 |
|
49 CPolicyEngineNotifier(); |
|
50 ~CPolicyEngineNotifier(); |
|
51 static CPolicyEngineNotifier* NewL(); |
|
52 void ConstructL(); |
|
53 |
|
54 void Complete( TUserResponse aResponse); |
|
55 |
|
56 public: //From MEikSrvNotifierBase2 |
|
57 |
|
58 void Release(); |
|
59 TNotifierInfo RegisterL(); |
|
60 TNotifierInfo Info() const; |
|
61 TPtrC8 StartL(const TDesC8& aBuffer); |
|
62 void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
63 void Cancel(); |
|
64 TPtrC8 UpdateL(const TDesC8& aBuffer); |
|
65 |
|
66 private: |
|
67 CPolicyEngineUi * iPolicyEngineUi; |
|
68 |
|
69 /** |
|
70 * refers connections is intialized or not |
|
71 */ |
|
72 TNotifierInfo iInfo; ///< Notifier info |
|
73 |
|
74 TInt iReplySlot; |
|
75 RMessagePtr2 iMessage; |
|
76 }; |
|
77 |
|
78 |
|
79 |
|
80 /** |
|
81 * This class provides a wrapper for some common dialogs for the policy engine |
|
82 * |
|
83 * @lib policyengineui.lib |
|
84 */ |
|
85 class CPolicyEngineUi : public CActive |
|
86 { |
|
87 public: // Constructors and destructor |
|
88 |
|
89 /** |
|
90 * Constructor. |
|
91 */ |
|
92 CPolicyEngineUi(); |
|
93 |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 */ |
|
97 static CPolicyEngineUi* NewL(); |
|
98 |
|
99 /** |
|
100 * Destructor. |
|
101 */ |
|
102 virtual ~CPolicyEngineUi(); |
|
103 |
|
104 void ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* iNotifier); |
|
105 |
|
106 void RunL(); |
|
107 void DoCancel(); |
|
108 |
|
109 public: |
|
110 |
|
111 /** |
|
112 * Execute corporate policy question chain, which user deny or accept. One response generated. |
|
113 * @param aCorporate - Corparate name used in queries |
|
114 * @param aRandomPart - Random part of certificate, which user must know. |
|
115 * @return TUserResponse - Response value for user |
|
116 */ |
|
117 |
|
118 TUserResponse ShowCorporateConfirmationDialogL( const TDesC8& aCorporate, |
|
119 const TDesC8& aRandomPart); |
|
120 private: |
|
121 |
|
122 //private enums |
|
123 enum TDialog |
|
124 { |
|
125 EControl = 0, |
|
126 EQuestion, |
|
127 ERemove, |
|
128 EDenied, |
|
129 EUnMatch |
|
130 }; |
|
131 |
|
132 enum TDlgResp |
|
133 { |
|
134 EOkResp, |
|
135 ECancelResp |
|
136 }; |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * Two-phased constructor. |
|
142 */ |
|
143 void ConstructL(); |
|
144 |
|
145 |
|
146 TInt ShowDialogL( const TDialog& aDialog); |
|
147 TDlgResp ShowConfirmationQueryL( const TDesC& aText, const TBool& aWithCancel ); |
|
148 TDlgResp ShowPossessionMessageQueryL(); |
|
149 TDlgResp DataQueryL( const TDesC& aText, TDes& aInput ); |
|
150 |
|
151 private: // Data |
|
152 |
|
153 HBufC * iCorporate; |
|
154 HBufC * iRandomPart; |
|
155 TInt iState; |
|
156 CPolicyEngineNotifier * iNotifier; |
|
157 |
|
158 TInt iResourceFileOffset; |
|
159 CCoeEnv* iCoeEnv; // not owned |
|
160 }; |
|
161 |
|
162 |
|
163 #endif // POLICTY_ENGINE_UI_HEADER_ |
|
164 |
|
165 // End of File |