|
1 /* |
|
2 * Copyright (c) 2002-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: Grouped notifier note for soft notifications. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __AKNGROUPEDNOTIFIERNOTE_H__ |
|
19 #define __AKNGROUPEDNOTIFIERNOTE_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <aknstaticnotedialog.h> |
|
25 #include <eikcmobs.h> // for MEikCommandObserver |
|
26 #include <AknQueryDialog.h> |
|
27 #include <aknlistquerydialog.h> |
|
28 #include "AknSystemPopup.h" // for MAknKeyLockObserver |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MAknKeyLockController; |
|
32 class MAknKeyLockObserver; |
|
33 |
|
34 // DATA TYPES |
|
35 enum TAknGroupedNotifierItem |
|
36 { |
|
37 EMissedCalls = 0, |
|
38 ENewMessages, |
|
39 ENewChatMsgs, |
|
40 ENewMails, |
|
41 EMaxItem |
|
42 }; |
|
43 |
|
44 // CONSTANTS |
|
45 const TInt KAknMaxGroupedNoteItemTextLength = 50; |
|
46 |
|
47 // CLASS DECLARATIONS |
|
48 |
|
49 /** |
|
50 * Mixin class for the grouped soft notification dialog callback. |
|
51 * |
|
52 * @lib aknoldstylenotif.lib |
|
53 */ |
|
54 class MAknGroupedNotifierNoteObserver |
|
55 { |
|
56 public: |
|
57 /** |
|
58 * This method is called when the note is completed (either by accepting or discarding |
|
59 * the note). |
|
60 * |
|
61 * @param aCommandId The id of the button the user pressed. |
|
62 * @param aSelectedItem The selected item enum when the note has been accepted or EMaxItem |
|
63 * if it has been discarded |
|
64 */ |
|
65 virtual void GroupedNoteCompletedL( |
|
66 TInt aCommandId, |
|
67 TAknGroupedNotifierItem aSelectedItem = EMaxItem) = 0; |
|
68 |
|
69 /** |
|
70 * Support for adding new items to grouped form. |
|
71 * |
|
72 * @param aTexts Array into which add new texts. |
|
73 * @param aOrder Key array for list to manage its entries. |
|
74 */ |
|
75 virtual void AddItemsL( |
|
76 CDesCArray& aTexts, |
|
77 CArrayFix<TInt>& aOrder) = 0; |
|
78 |
|
79 /** |
|
80 * Custom soft notifications may have custom softkeys. This method returns the softkeys |
|
81 * and the accept softkey id for the given custom notification. |
|
82 * |
|
83 * @since S60 3.1 |
|
84 * @param aCustomItem A custom notification for which to search softkeys. |
|
85 * @param aSoftkeyResourceId On return, the softkeys resource identifier. |
|
86 * @param aAcceptKeyId On return, the key that is used to accept the grouped notifier item, |
|
87 * i.e. to launch the handler application. |
|
88 * @param aLeftSoftkey Custom text for left softkey. |
|
89 * @param aRightSoftkey Custom text for right softkey. |
|
90 */ |
|
91 virtual void SoftkeysForCustomItem( |
|
92 TAknGroupedNotifierItem aCustomItem, |
|
93 TInt& aSoftkeyResourceId, |
|
94 TInt& aAcceptKeyId, |
|
95 TDes& aLeftSoftkey, |
|
96 TDes& aRightSoftkey) = 0; |
|
97 }; |
|
98 |
|
99 /** |
|
100 * Grouped soft notification dialog. |
|
101 * |
|
102 * @lib aknoldstylenotif.lib |
|
103 */ |
|
104 NONSHARABLE_CLASS(CAknGroupedNotifierNote) : public CAknListQueryDialog, public MDesCArray |
|
105 { |
|
106 public: // Constructors and destructor |
|
107 /** |
|
108 * C++ default constructor. |
|
109 */ |
|
110 CAknGroupedNotifierNote(); |
|
111 |
|
112 /** |
|
113 * Destructor. |
|
114 */ |
|
115 virtual ~CAknGroupedNotifierNote(); |
|
116 |
|
117 public: // New functions |
|
118 /** |
|
119 * Construct method. |
|
120 * |
|
121 * @param aNoteObserver The observer to call after the notifier is completed. |
|
122 */ |
|
123 void ConstructL(MAknGroupedNotifierNoteObserver* aNoteObserver); |
|
124 |
|
125 /** |
|
126 * This method is for setting the number of a certain item - for example, to set the number |
|
127 * of missed calls to 7. If an item count is set to 0, the note should check if the list |
|
128 * has less than two items left and if so call the NotifierItemCounteLessThanTwo()-method. |
|
129 |
|
130 * @param aItem Missed calls, new messages, new mail or new chat messages. |
|
131 * @param aAmount The amount of items specified by aItem. |
|
132 * @param aHighlight ETrue to set the item highlighted. |
|
133 */ |
|
134 void SetItemAmountL(TAknGroupedNotifierItem aItem, TInt aAmount, TBool aHighlight = EFalse); |
|
135 |
|
136 public: // Functions from base classes. |
|
137 /** |
|
138 * From CEikDialog. |
|
139 * This function is called by the dialog framework before the dialog is sized and laid out. |
|
140 */ |
|
141 void PreLayoutDynInitL(); |
|
142 |
|
143 /** |
|
144 * From CEikDialog. |
|
145 * This function is called by the dialog framework after the dialog has been sized and laid |
|
146 * out, but before it has been activated. |
|
147 */ |
|
148 void PostLayoutDynInitL(); |
|
149 |
|
150 /** |
|
151 * From CCoeControl. |
|
152 * Method to be called by framework when keypress occurs |
|
153 * |
|
154 * @param aKeyEvent The key pressed. |
|
155 * @param aType Type of key pressed (EEventKeyUp or EEventKeyDown for instance). |
|
156 * @return EKeyWasNotConsumed or EKeyWasConsumed depending whether key was processed or not. |
|
157 */ |
|
158 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
159 |
|
160 /** |
|
161 * From MDesCArray. |
|
162 * Gives number of items inside an array. |
|
163 * |
|
164 * @return Number of items. |
|
165 */ |
|
166 TInt MdcaCount() const; |
|
167 |
|
168 /** |
|
169 * From MDesCArray. |
|
170 * Returns a string from index. |
|
171 * |
|
172 * @param aIndex The string to be returned. |
|
173 * @return The string. |
|
174 */ |
|
175 TPtrC MdcaPoint(TInt aIndex) const; |
|
176 |
|
177 /** |
|
178 * From CAknListQueryDialog. |
|
179 * Handle pointer event. |
|
180 */ |
|
181 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
182 |
|
183 protected: // Functions from base classes. |
|
184 /** |
|
185 * From CEikDialog. |
|
186 * Method to be called when the user presses a softkey. |
|
187 * |
|
188 * @param aButtonId The id of the softkey that the user just pressed. |
|
189 * @return ETrue if exit is to be performed, EFalse if not. |
|
190 */ |
|
191 TBool OkToExitL(TInt aButtonId); |
|
192 |
|
193 /** |
|
194 * From CCoeControl. |
|
195 * Sets the control to be ready for drawing. |
|
196 */ |
|
197 void ActivateL(); |
|
198 |
|
199 /** |
|
200 * From CCoeControl |
|
201 * Event handling section e.g for Listbox events. |
|
202 * @param aControl Pointer to a control. |
|
203 * @param aEventType The event type. |
|
204 */ |
|
205 void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); |
|
206 |
|
207 private: |
|
208 enum TNoteAction |
|
209 { |
|
210 EDoNothing = 0, |
|
211 ELaunchItemHandler, |
|
212 EExitNote |
|
213 }; |
|
214 |
|
215 private: |
|
216 TBool AutoLockEnabled(); |
|
217 |
|
218 // Methods to handle order of items. |
|
219 void RemoveType(TAknGroupedNotifierItem aItem); |
|
220 void InsertType(TAknGroupedNotifierItem aItem); |
|
221 |
|
222 // Sets the correct softkeys depending on the focused item. |
|
223 void UpdateSoftkeysL(); |
|
224 |
|
225 /** |
|
226 * From MEikCommandObserver - this method is called by framework when a command is issued. |
|
227 */ |
|
228 virtual void ProcessCommandL(TInt aCommandId); |
|
229 |
|
230 virtual void CEikDialog_Reserved_1(); |
|
231 virtual void CEikDialog_Reserved_2(); |
|
232 virtual void CAknDialog_Reserved(); |
|
233 virtual void CAknQueryDialog_Reserved(); |
|
234 |
|
235 private: // Data |
|
236 MAknGroupedNotifierNoteObserver* iNoteObserver; |
|
237 TInt iCount[EMaxItem]; // how many calls etc. |
|
238 CArrayFix<TInt> *iOrder; // which order are these. (ownership) |
|
239 CDesCArray *iTexts; // (ownership) |
|
240 CDesCArray *iTextsPlural; // (ownership) |
|
241 __MUTABLE TBuf<KAknMaxGroupedNoteItemTextLength> iBuffer; |
|
242 TInt iSelectedItem; |
|
243 TInt iHighlightedItem; |
|
244 |
|
245 // Dynamic softkeys for currently focused custom grouped notifier item. |
|
246 TInt iCustomNoteSoftkeys; |
|
247 |
|
248 // Accept softkey for currently focused custom grouped notifier item. |
|
249 TInt iCustomNoteAcceptKeyId; |
|
250 |
|
251 // Whether custom softkeys were used on previously focused notifier item |
|
252 TBool iCustomNoteSoftkeysAssigned; |
|
253 |
|
254 TInt iAutoLockStatus; |
|
255 }; |
|
256 |
|
257 #endif // __AKNGROUPEDNOTIFIERNOTE_H__ |
|
258 |
|
259 // End of File |