|
1 /* |
|
2 * Copyright (c) 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: This file defines class CFSNotificationHandlerNotifierInitiator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __FSNOTIFICATIONHANDLERNOTIFIERINITIATOR_H__ |
|
20 #define __FSNOTIFICATIONHANDLERNOTIFIERINITIATOR_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 |
|
25 #include <barsc.h> |
|
26 //<cmail> |
|
27 #include "CFSMailCommon.h" |
|
28 |
|
29 #include "fsmailserverconst.h" |
|
30 //</cmail> |
|
31 |
|
32 class MFSNotificationHandlerNotifierInitiatorObserver; |
|
33 class MFSNotificationHandlerMgr; |
|
34 class MFSMailExceptionEventCallback; |
|
35 class CAknQueryDialog; |
|
36 |
|
37 /** |
|
38 * Active object that handles asynchronous usage of |
|
39 * FreestyleEmailNotifier. |
|
40 * |
|
41 * @code |
|
42 * ?good_class_usage_example(s) |
|
43 * @endcode |
|
44 * |
|
45 * @lib ?library |
|
46 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
47 */ |
|
48 class CFSNotificationHandlerNotifierInitiator : public CActive |
|
49 { |
|
50 public: |
|
51 |
|
52 static CFSNotificationHandlerNotifierInitiator* NewL( |
|
53 MFSNotificationHandlerNotifierInitiatorObserver& aOwner, |
|
54 MFSNotificationHandlerMgr& aNotificationHandlerMgr ); |
|
55 static CFSNotificationHandlerNotifierInitiator* NewLC( |
|
56 MFSNotificationHandlerNotifierInitiatorObserver& aOwner, |
|
57 MFSNotificationHandlerMgr& aNotificationHandlerMgr); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CFSNotificationHandlerNotifierInitiator(); |
|
63 |
|
64 |
|
65 /** |
|
66 * Sets mailbox id that this notification is related to. |
|
67 * |
|
68 * @since S60 ?S60_version |
|
69 * @param aNewMailBoxId Mailbox id that the message is related to. |
|
70 */ |
|
71 void SetMailBoxId( TFSMailMsgId aNewMailBoxId ); |
|
72 |
|
73 /** |
|
74 * Gets mailbox id that this notification is related to. |
|
75 * |
|
76 * @since S60 ?S60_version |
|
77 * @return Mailbox id that the message is related to. NULL if not set. |
|
78 */ |
|
79 TFSMailMsgId MailBoxId() const; |
|
80 |
|
81 /** |
|
82 * Sets message type that this notification is related to. |
|
83 * This function is valid only in case of message query. |
|
84 * |
|
85 * @since S60 ?S60_version |
|
86 * @param aMessageType Message type that the message is related to. |
|
87 */ |
|
88 void SetMessageType( TFsEmailNotifierSystemMessageType aMessageType ); |
|
89 |
|
90 /** |
|
91 * Gets message type that this notification is related to. |
|
92 * This function is valid only in case of message query. |
|
93 * |
|
94 * @since S60 ?S60_version |
|
95 * @return Message type that the message is related to. Negative if not set. |
|
96 */ |
|
97 TFsEmailNotifierSystemMessageType MessageType() const; |
|
98 |
|
99 /** |
|
100 * Callback for the response. |
|
101 * |
|
102 * @since S60 ?S60_version |
|
103 * @param aCallback Callback for the response. |
|
104 */ |
|
105 void SetCallback( MFSMailExceptionEventCallback* aCallback ); |
|
106 |
|
107 /** |
|
108 * Callback for the response. |
|
109 * |
|
110 * @since S60 ?S60_version |
|
111 * @return Callback for the response. NULL if not set. |
|
112 */ |
|
113 MFSMailExceptionEventCallback* Callback() const; |
|
114 |
|
115 |
|
116 /** |
|
117 * Shows a custom error note of type EFsEmailNotifErrCustom. |
|
118 * No output is available through this service. |
|
119 * KUidFsEmailNotifierMessageQuery plugin is used to show |
|
120 * this notification. |
|
121 * |
|
122 * @since S60 ?S60_version |
|
123 * @param aMailboxName Mailbox name that the message concerns. |
|
124 * @param aMessageType Type of the message to show. |
|
125 */ |
|
126 void RequestMessageQueryL( |
|
127 TDesC& aMailboxName, |
|
128 TFsEmailNotifierSystemMessageType aMessageType, |
|
129 const TDesC& aCustomMessageText = KNullDesC ); |
|
130 |
|
131 /** |
|
132 * Shows an authentication query. |
|
133 * KUidFsEmailNotifierAuthentication plugin is used to show |
|
134 * the query. |
|
135 * |
|
136 * @since S60 ?S60_version |
|
137 * @param aMailboxName Mailbox name that the message concerns. |
|
138 */ |
|
139 void RequestAuthenticationL( TDesC& aMailboxName ); |
|
140 |
|
141 /** |
|
142 * Function to read user input given in last authentication |
|
143 * request. |
|
144 * |
|
145 * @since S60 ?S60_version |
|
146 * @param aPassword User input for password. |
|
147 */ |
|
148 void GetLastAuthenticationOutput( |
|
149 TBuf<KFsEmailNotifierPasswordMaxLength>& aPassword ) const; |
|
150 |
|
151 /** |
|
152 * Function to read user response in last query. |
|
153 * |
|
154 * @since S60 ?S60_version |
|
155 * @return ETrue if user selected OK, Continue, etc. (LSK) |
|
156 * EFalse if user selected Cancel (RSK) |
|
157 */ |
|
158 TBool GetLastResponse() const; |
|
159 |
|
160 protected: |
|
161 |
|
162 /** |
|
163 * Constructor. |
|
164 * |
|
165 * @since S60 ?S60_version |
|
166 * @param aOwner Owner and manager of this initiator. |
|
167 */ |
|
168 CFSNotificationHandlerNotifierInitiator( |
|
169 MFSNotificationHandlerNotifierInitiatorObserver& aOwner, |
|
170 MFSNotificationHandlerMgr& aNotificationHandlerMgr ); |
|
171 |
|
172 void ConstructL(); |
|
173 |
|
174 // from base class CActive |
|
175 virtual void DoCancel(); |
|
176 virtual void RunL(); |
|
177 |
|
178 private: |
|
179 |
|
180 void BeforeDialog(); |
|
181 void AfterDialog(); |
|
182 |
|
183 |
|
184 private: // data |
|
185 |
|
186 /** |
|
187 * Input/output buffer for authentication. |
|
188 */ |
|
189 TBuf<KFsEmailNotifierPasswordMaxLength> iPassword; |
|
190 |
|
191 /** |
|
192 * ETrue if user pressed LSK (OK, Login, etc.), EFalse if RSK (Cancel). |
|
193 */ |
|
194 TBool iLogin; |
|
195 |
|
196 /** |
|
197 * Owner and user of this class. |
|
198 */ |
|
199 MFSNotificationHandlerNotifierInitiatorObserver& iOwner; |
|
200 |
|
201 /** |
|
202 * Owner and manager of the instance of this handler class. |
|
203 */ |
|
204 MFSNotificationHandlerMgr& iNotificationHandlerMgr; |
|
205 |
|
206 /** |
|
207 * Handle to a session with the extended notifier server. |
|
208 */ |
|
209 RNotifier iNotifier; |
|
210 |
|
211 /** |
|
212 * Id of the mailbox that this notifier is related to. NULL if not set. |
|
213 */ |
|
214 TFSMailMsgId iMailBoxId; |
|
215 |
|
216 /** |
|
217 * Message type that this notifier is related to. Negative if not set. |
|
218 */ |
|
219 TFsEmailNotifierSystemMessageType iMessageType; |
|
220 |
|
221 /** |
|
222 * Callback function for the respoonse. NULL if not set. |
|
223 */ |
|
224 MFSMailExceptionEventCallback* iCallback; |
|
225 |
|
226 //CAknQueryDialog* iDialog; |
|
227 |
|
228 }; |
|
229 |
|
230 |
|
231 #endif //__FSNOTIFICATIONHANDLERNOTIFIERINITIATOR_H__ |