|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Class header for CAknSoftNotificationSubject. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __AKNSOFTNOTIFICATIONPLUGIN_H__ |
|
19 #define __AKNSOFTNOTIFICATIONPLUGIN_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <eiknotapi.h> |
|
25 #include <eikcmobs.h> |
|
26 #include <aknnotedialog.h> |
|
27 #include <aknstaticnotedialog.h> |
|
28 #include <AknNotifyStd.h> |
|
29 #include <AknMediatorFacade.h> // Not the best for the purpose but will do just fine. |
|
30 #include <SecondaryDisplay/AknSecondaryDisplayDefs.h> |
|
31 #include <AknNotify.h> |
|
32 #include "AknSystemPopup.h" |
|
33 #include "AknGroupedNotifierNote.h" |
|
34 #include "AknNotifierControllerPlugin.h" |
|
35 #include "aknprivatesoftnotificationparameters.h" |
|
36 #include "aknmessagereaderlongpressdetector.h" // MAknGroupedNoteObserver |
|
37 |
|
38 class CAknSmsViewerLauncher; |
|
39 class RDesReadStream; |
|
40 class CAknSoftNotificationSubject; |
|
41 class CAknDynamicSoftNoteEventManager; |
|
42 |
|
43 class TSoftNoteEntry |
|
44 { |
|
45 public: |
|
46 TSoftNoteEntry() : iType(ENoSoftNotification), iId(0), iCount(0), iCustomId(0) {}; |
|
47 TAknSoftNotificationType iType; |
|
48 TInt iId; |
|
49 TInt iCount; |
|
50 TInt iCustomId; |
|
51 }; |
|
52 |
|
53 // Stack entry for Custom Soft Notifications. |
|
54 class CCustomNotifParams; |
|
55 |
|
56 NONSHARABLE_CLASS(AknSoftNoteSDObserver) : public MAknDialogMediatorObserver |
|
57 { |
|
58 public: |
|
59 TAknDialogMediatorObserverCommand MediatorCommandL( TUid, TUid, TInt, const TDesC8& aData ); |
|
60 void NotifyMediatorExit(){} |
|
61 void SetSoftNotificationSubject( CAknSoftNotificationSubject* aSubject ); |
|
62 private: |
|
63 CAknSoftNotificationSubject* iSubject; |
|
64 }; |
|
65 |
|
66 /** |
|
67 * Soft notification plugin to EikSrv. |
|
68 */ |
|
69 NONSHARABLE_CLASS(CAknSoftNotificationSubject) : |
|
70 public CBase, |
|
71 public MEikSrvNotifierBase2, |
|
72 public MAknGroupedNotifierNoteObserver, |
|
73 public MAknKeyLockObserver, |
|
74 public MSoftNotificationObserver, |
|
75 public MAknMessageNotifierObserver |
|
76 { |
|
77 public: // Constructors and destructor |
|
78 static CAknSoftNotificationSubject* NewL( |
|
79 MAknKeyLockController* aKeyLockObserver, |
|
80 CAknGlobalNoteSubject* aGlobalNoteController); |
|
81 |
|
82 public: // Functions from base classes |
|
83 /** |
|
84 * From MAknKeyLockController |
|
85 * Called when the status of keylock changes. |
|
86 * |
|
87 * @param aStatus the new status of the keylock. |
|
88 */ |
|
89 virtual void KeyLockStatusChange(TKeyLockStatus aStatus); |
|
90 |
|
91 /** |
|
92 * From MEikSrvNotifierBase. |
|
93 * Method to release the EikSrv plugin |
|
94 */ |
|
95 void Release(); |
|
96 |
|
97 /** |
|
98 * From MEikSrvNotifierBase. |
|
99 * Method for registering the EikSrv plugin. |
|
100 * |
|
101 * @return TNotifierInfo Struct containing the plugin priorities etc. |
|
102 */ |
|
103 TNotifierInfo RegisterL(); |
|
104 |
|
105 /** |
|
106 * From MEikSrvNotifierBase. |
|
107 * Method for getting the notifier info. |
|
108 * |
|
109 * @return TNotifierInfo Struct containing the plugin priorities etc. |
|
110 */ |
|
111 TNotifierInfo Info() const; |
|
112 |
|
113 /** |
|
114 * From MEikSrvNotifierBase. |
|
115 * Method for starting the plugin. Synchronous version. |
|
116 * |
|
117 * @param aBuffer Buffer containing the parameters for the plugin, packaged in |
|
118 * TPckg<SAknSoftNotificationParams>. |
|
119 * @return This method will return KNullDesC. |
|
120 */ |
|
121 TPtrC8 StartL(const TDesC8& aBuffer); |
|
122 |
|
123 /** |
|
124 * From MEikSrvNotifierBase. |
|
125 * Method for starting the plugin. Asynchronous version. |
|
126 * |
|
127 * @param aBuffer Buffer containing parameters for the plugin, packaged in |
|
128 * TPckg<SAknSoftNotificationParams>. |
|
129 * @param aReplySlot Return value of any type. Not used in this case. |
|
130 * @param aMessage RMessage to notify that the execution has ended. |
|
131 */ |
|
132 void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
133 |
|
134 /** |
|
135 * From MEikSrvNotifierBase. |
|
136 * Method for cancelling the plugin execution. |
|
137 */ |
|
138 void Cancel(); |
|
139 |
|
140 /** |
|
141 * From MEikSrvNotifierBase. |
|
142 * Method for updating the plugin while execution is in progress. |
|
143 * |
|
144 * @param aBuffer Buffer containing parameters for the plugin, packaged in |
|
145 * TPckg<SAknSoftNotificationParams>. |
|
146 * @return This method will return KNullDesC. |
|
147 */ |
|
148 TPtrC8 UpdateL(const TDesC8& aBuffer); |
|
149 |
|
150 /** |
|
151 * From MEikSrvNotifierBase. |
|
152 * This method is not used but is required because of pure virtuality in base class. |
|
153 * |
|
154 * @param aBuffer Buffer containing parameters for this plugin. |
|
155 */ |
|
156 void HandleMessageL(const TDesC8& aBuffer); |
|
157 |
|
158 /** |
|
159 * From MAknGroupedNotifierNoteObserver. |
|
160 * Called when user has pressed a key in the grouped soft notification dialog. |
|
161 * |
|
162 * @param aCommandId The id of the button the user pressed. |
|
163 * @param aSelectedItem The item that was selected when the user pressed a key. |
|
164 */ |
|
165 void GroupedNoteCompletedL(TInt aCommandId, TAknGroupedNotifierItem aSelectedItem = EMaxItem); |
|
166 |
|
167 /** |
|
168 * From MAknGroupedNotifierNoteObserver. |
|
169 * Support for adding new items to grouped form. |
|
170 * |
|
171 * @since S60 3.0 |
|
172 * @param aText Array into which add new texts (item amount cannot be changed after this). |
|
173 * @param aOrder KeyArray for list to manage its entries, which must be uniqued (at a time) |
|
174 * and these must not collide with fixed values defined in |
|
175 * TAknGroupedNotifierItem. |
|
176 */ |
|
177 void AddItemsL(CDesCArray& aTexts, CArrayFix<TInt>& aOrder); |
|
178 |
|
179 /** |
|
180 * From MAknGroupedNotifierNoteObserver. |
|
181 * Custom soft notifications may have custom softkeys. This method returns the softkeys |
|
182 * and the accept softkey id for the given custom notification. |
|
183 * |
|
184 * @since S60 3.1 |
|
185 * @param aCustomItem A custom notification for which to search softkeys. |
|
186 * @param aSoftkeyResourceId On return, the softkeys resource identifier. |
|
187 * @param aAcceptKeyId On return, the key that is used to accept the grouped notifier item, |
|
188 * i.e. to launch the handler application. |
|
189 * @param aLeftSoftkey Custom text for left softkey. |
|
190 * @param aRightSoftkey Custom text for right softkey. |
|
191 */ |
|
192 void SoftkeysForCustomItem(TAknGroupedNotifierItem aCustomItem, TInt& aSoftkeyResourceId, |
|
193 TInt& aAcceptKeyId, TDes& aLeftSoftkey, TDes& aRightSoftkey); |
|
194 |
|
195 // From MSoftNotificationObserver |
|
196 void SoftNoteCompleted(TInt aId, TInt aCommand); |
|
197 TBool ShowSoftNoteL(TInt aPriority, const TDesC& aText); |
|
198 TBool CancelSoftNote(TInt aPriority); |
|
199 |
|
200 public: // from MAknMessageNotifierObserver |
|
201 |
|
202 /** |
|
203 * From MAknMessageNotifierObserver. |
|
204 * |
|
205 * @return true if shown notifier is a message or a email |
|
206 */ |
|
207 TBool MessageNotifierShown(); |
|
208 |
|
209 /** |
|
210 * From MAknMessageNotifierObserver. |
|
211 * |
|
212 * @return CEikButtonGroupContainer of the grouped note |
|
213 */ |
|
214 CEikButtonGroupContainer* ButtonGroupContainer(); |
|
215 |
|
216 private: |
|
217 void ConstructL(); |
|
218 |
|
219 ~CAknSoftNotificationSubject(); |
|
220 |
|
221 /** |
|
222 * The constructor is private. |
|
223 */ |
|
224 CAknSoftNotificationSubject( |
|
225 MAknKeyLockController* aKeyLockObserver, |
|
226 CAknGlobalNoteSubject* aGlobalNoteController); |
|
227 |
|
228 void HandleNotifierMessageL(const TDesC8& aBuffer, TInt& aNoteId ); |
|
229 |
|
230 /** |
|
231 * The following method is called after the notifier has been started to reflect the changes |
|
232 * to the UI mechanism. The parameter aType is the most recently requested soft notification |
|
233 * type. |
|
234 */ |
|
235 void UpdateNoteL(TAknSoftNotificationType aType, const TDesC& aText, TInt aCount, TInt aCountChanged); |
|
236 |
|
237 void DisplayUngroupedNotifierL( |
|
238 TAknSoftNotificationType aType, |
|
239 const TDesC& aText, |
|
240 TInt aCount = 0); |
|
241 |
|
242 void RemoveByType(TAknSoftNotificationType aType, TInt aId = 0); |
|
243 |
|
244 TAknSoftNotificationType TypeFromId(TInt aId); |
|
245 void CompleteId(TInt aId); |
|
246 void ScheduleGroupedNotifierL(); |
|
247 void DoSoftNoteCompletedL(TInt aId, TInt aCommand); |
|
248 |
|
249 /** |
|
250 * A helper method to show the grouped soft notification dialog. |
|
251 */ |
|
252 void ShowGroupedNotificationL(); |
|
253 |
|
254 /** |
|
255 * Helper method to find out if a grouped soft notification should be formed. |
|
256 */ |
|
257 TBool IsGroupedFormed(); |
|
258 |
|
259 void LaunchSelectNetworkAppL(); |
|
260 void LaunchUSSDAppL(); |
|
261 void LaunchMissedCallsAppL(); |
|
262 void LaunchNewMessagesAppL(); |
|
263 void LaunchNewMailAppL(); |
|
264 void LaunchNewCbsAppL(); |
|
265 void LaunchNewVoiceMailAppL(TInt aType); |
|
266 |
|
267 void LaunchViewL( |
|
268 const TVwsViewId& aViewId, |
|
269 TUid aCustomMessageId, |
|
270 const TDesC8& aCustomMessage); |
|
271 |
|
272 void SaveSoftNotificationsL(); |
|
273 void SaveNoteL(RWriteStream& aFile, TSoftNoteEntry& aEntry); |
|
274 |
|
275 void LoadAndQueueSoftNotesL(); |
|
276 void LoadAndQueueNoteL(RReadStream& aStream); |
|
277 |
|
278 void ClearAllNotes(); |
|
279 |
|
280 /** |
|
281 * Method for resetting user inactivity timers (e.g. screen saver timer). |
|
282 */ |
|
283 void ReportUserActivity(); |
|
284 |
|
285 TBool CheckIfAlreadyExists(TAknSoftNotificationType aType); |
|
286 |
|
287 TBool AutoLockEnabled(); |
|
288 |
|
289 void SetNcnFlag(TBool aValue); |
|
290 static TInt HandleNcnFlagStateChange(TAny *aPtr); |
|
291 |
|
292 void HandleCustomNoteCompletedL(CCustomNotifParams* aParams, TInt aCommand); |
|
293 |
|
294 /** |
|
295 * Called when custom note has been canceled by the user. |
|
296 * |
|
297 * @param aParams Custom notification data. |
|
298 * @param aCommand Command that canceled the notification. |
|
299 */ |
|
300 void HandleCustomNoteCanceledL( CCustomNotifParams* aParams, TInt aCommand ); |
|
301 |
|
302 private: // Data |
|
303 TNotifierInfo iInfo; |
|
304 MAknKeyLockController* iKeyLockController; |
|
305 CAknGlobalNoteSubject* iGlobalNoteController; |
|
306 |
|
307 // The array keeps track of unselected soft notifications in priority order. |
|
308 TInt iSoftNotificationAmounts[EMaxSoftNotification]; |
|
309 |
|
310 CArrayFixFlat<TSoftNoteEntry>* iSoftNoteEntryList; |
|
311 TAknSoftNotificationType iLatestType; |
|
312 |
|
313 CAknGroupedNotifierNote* iGroupedNote; |
|
314 CAknSmsViewerLauncher* iSmsViewer; |
|
315 |
|
316 /// Some of the data of CCustomNotifParams is referred from |
|
317 /// CAknGlobalNoteSubject. Make sure the source is not deleted before |
|
318 /// referrer is removed. |
|
319 CCustomNotifParams* iCustomNoteParamsStack; |
|
320 |
|
321 friend class AknSoftNoteSDObserver; |
|
322 |
|
323 private: // New member functions. |
|
324 CCustomNotifParams* SeekCustomNoteForId(TInt aID, TBool aSeekByGNoteId = EFalse); |
|
325 void AddNewCustomNoteL(RDesReadStream& readStream, TInt aCount, TBool aNewNote = EFalse ); |
|
326 void AddNewCustomNoteL(RReadStream& readStream, TInt aCount, TBool aNewNote = EFalse ); |
|
327 void RemoveCustomNoteForId(TInt aID, TBool aSeekByGNoteId = EFalse); |
|
328 void LaunchNewIMAppL(); |
|
329 |
|
330 /** |
|
331 * Load unique identifier from persistent store. |
|
332 */ |
|
333 void LoadUniqueIdL(); |
|
334 /** |
|
335 * Save unique identifier to persistent store. |
|
336 */ |
|
337 void StoreUniqueIdL(); |
|
338 /** |
|
339 * Increases unique identifier counter and finds next free identifier. |
|
340 * @return Next free unique identifier. |
|
341 */ |
|
342 TInt GenerateUniqueId(); |
|
343 /** |
|
344 * Write response from given parameters. |
|
345 * @param aResponse Response buffer to write into. |
|
346 * @param aNoteId Notification id to write. |
|
347 */ |
|
348 void WriteResponse( TDes8& aResponse, TInt aNoteId ) const; |
|
349 |
|
350 private: // New member data. |
|
351 TBool iNotificationsSaved; |
|
352 CIdle* iIdle; |
|
353 static TInt SetIdleStateFalse(TAny* aThis); |
|
354 TBool iKeysLocked; |
|
355 |
|
356 public: // To allow static method above access this. |
|
357 TBool iIdleStateActive; |
|
358 |
|
359 private: |
|
360 CAknMediatorFacade* iCoverClient; |
|
361 AknSoftNoteSDObserver iObsStub; |
|
362 /// Unique dynamic soft notification counter. |
|
363 TInt iUniqueIdCounter; |
|
364 /// Dynamic soft notification response buffer. Space for TInt (32bit). |
|
365 TBuf8<4> iResponseMsg; |
|
366 /// Not own. Dynamic soft notification event manager. |
|
367 CAknDynamicSoftNoteEventManager* iDynamicSoftNoteManager; |
|
368 /// Own. Central Repository to read messaging settings. |
|
369 CRepository* iMessagingRepository; |
|
370 }; |
|
371 |
|
372 #endif // __AKNSOFTNOTIFICATIONPLUGIN_H__ |
|
373 |
|
374 // End of File |