|
1 /* |
|
2 * Copyright (c) 2005 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: CCDevEncPasswdDlg declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CDEVENCPASSWDDLG_H |
|
19 #define CDEVENCPASSWDDLG_H |
|
20 |
|
21 #include <e32base.h> // For CActive, link against: euser.lib |
|
22 #include <e32std.h> // For RTimer, link against: euser.lib |
|
23 #include <eiknotapi.h> |
|
24 #include <AknQueryDialog.h> |
|
25 #include <aknnotewrappers.h> |
|
26 |
|
27 class CDevEncPasswdDlg : public CActive, |
|
28 public MEikSrvNotifierBase2 |
|
29 { |
|
30 public: |
|
31 // Cancel and destroy |
|
32 ~CDevEncPasswdDlg(); |
|
33 |
|
34 // Two-phased constructor. |
|
35 static CDevEncPasswdDlg* NewL(); |
|
36 |
|
37 // Two-phased constructor. |
|
38 static CDevEncPasswdDlg* NewLC(); |
|
39 |
|
40 public: // Functions from MEikSrvNotifierBase2 |
|
41 /** Frees all resources owned by this notifier. |
|
42 |
|
43 This function is called by the notifier framework when all resources allocated |
|
44 by notifiers should be freed. As a minimum, this function should delete this |
|
45 object (i.e. delete this;). |
|
46 |
|
47 Note that it is important to implement this function correctly to avoid memory |
|
48 leaks. */ |
|
49 virtual void Release(); |
|
50 /** Performs any initialisation that this notifier may require. |
|
51 |
|
52 The function is called when the notifier is loaded (when the plug-in DLL is |
|
53 loaded). It is called only once. |
|
54 |
|
55 As a minimum, the function should return a TNotifierInfo instance describing |
|
56 the notifier parameters. A good implementation would be to set this into a |
|
57 data member, and then to return it. This is because the same information is |
|
58 returned by Info(). |
|
59 |
|
60 The function is safe to leave from, so it is possible, although rarely necessary, |
|
61 to allocate objects as you would normally do in a ConstructL() function as |
|
62 part of two-phase construction. |
|
63 |
|
64 @return Describes the parameters of the notifier. */ |
|
65 virtual TNotifierInfo RegisterL(); |
|
66 /** Gets the notifier parameters. |
|
67 |
|
68 This is usually the same information as returned by RegisterL() but can be |
|
69 varied at run time. |
|
70 |
|
71 @return Describes the parameters of the notifier. */ |
|
72 virtual TNotifierInfo Info() const; |
|
73 /** Starts the notifier. |
|
74 |
|
75 This is called as a result of a client-side call to RNotifier::StartNotifier(), |
|
76 which the client uses to start a notifier from which it does not expect a |
|
77 response. |
|
78 |
|
79 The function is synchronous, but it should be implemented so that it completes |
|
80 as soon as possible, allowing the notifier framework to enforce its priority |
|
81 mechanism. |
|
82 |
|
83 It is not possible to to wait for a notifier to complete before returning |
|
84 from this function unless the notifier is likely to finish implementing its |
|
85 functionality immediately. |
|
86 |
|
87 @param aBuffer Data that can be passed from the client-side. The format and |
|
88 meaning of any data is implementation dependent. |
|
89 @return A pointer descriptor representing data that may be returned. The format |
|
90 and meaning of any data is implementation dependent. */ |
|
91 virtual TPtrC8 StartL(const TDesC8& aBuffer); |
|
92 /** Starts the notifier. |
|
93 |
|
94 This is called as a result of a client-side call to the asynchronous function |
|
95 RNotifier::StartNotifierAndGetResponse(). This means that the client is waiting, |
|
96 asynchronously, for the notifier to tell the client that it has finished its |
|
97 work. |
|
98 |
|
99 It is important to return from this function as soon as possible, and derived |
|
100 classes may find it useful to take a copy of the reply-slot number and |
|
101 the RMessage object. |
|
102 |
|
103 The implementation of a derived class must make sure that Complete() is called |
|
104 on the RMessage object when the notifier is deactivated. |
|
105 |
|
106 This function may be called multiple times if more than one client starts |
|
107 the notifier. |
|
108 |
|
109 @param aBuffer Data that can be passed from the client-side. The format and |
|
110 meaning of any data is implementation dependent. |
|
111 @param aReplySlot Identifies which message argument to use for the reply. |
|
112 This message argument will refer to a modifiable descriptor, a TDes8 type, |
|
113 into which data can be returned. The format and meaning of any returned data |
|
114 is implementation dependent. |
|
115 @param aMessage Encapsulates a client request. */ |
|
116 virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
117 |
|
118 /** Cancels an active notifier. |
|
119 |
|
120 This is called as a result of a client-side call to RNotifier::CancelNotifier(). |
|
121 |
|
122 An implementation should free any relevant resources and complete any outstanding |
|
123 messages, if relevant. */ |
|
124 virtual void Cancel(); |
|
125 /** Updates a currently active notifier with new data. |
|
126 |
|
127 This is called as a result of a client-side call to RNotifier::UpdateNotifier(). |
|
128 |
|
129 @param aBuffer Data that can be passed from the client-side. The format and |
|
130 meaning of any data is implementation dependent. |
|
131 @return A pointer descriptor representing data that may be returned. The format |
|
132 and meaning of any data is implementation dependent. */ |
|
133 virtual TPtrC8 UpdateL(const TDesC8& aBuffer); |
|
134 private: |
|
135 // C++ constructor |
|
136 CDevEncPasswdDlg(); |
|
137 |
|
138 // Second-phase constructor |
|
139 void ConstructL(); |
|
140 |
|
141 private: // From CActive |
|
142 // Handle completion |
|
143 void RunL(); |
|
144 |
|
145 // How to cancel me |
|
146 void DoCancel(); |
|
147 |
|
148 // Override to handle leaves from RunL(). Default implementation causes |
|
149 // the active scheduler to panic. |
|
150 TInt RunError( TInt aError ); |
|
151 |
|
152 private: |
|
153 TNotifierInfo iInfo; |
|
154 CAknTextQueryDialog* iDlg; |
|
155 CAknErrorNote* iNote; |
|
156 RMessagePtr2 iMessage; // Received message |
|
157 TInt iReplySlot; // Reply slot |
|
158 TBool iNeedToCompleteMessage; // Flag for releasing messages |
|
159 TInt iResourceFileFlag; // Flag for eikon env. |
|
160 CEikonEnv* iEikEnv; // Local eikonenv |
|
161 RTimer iTimer; |
|
162 }; |
|
163 |
|
164 #endif // CDEVENCPASSWDDLG_H |