1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Bio control for Provisioning documents. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CWPBIOCONTROL_H |
|
21 #define CWPBIOCONTROL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <msgbiocontrol.h> // for CMsgBioControl |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CWPEngine; |
|
28 class CWPNameValue; |
|
29 class CWPPushMessage; |
|
30 class CRichBio; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Bio control for OMA Provisioning messages. |
|
36 * @since 2.0 |
|
37 */ |
|
38 class CWPBioControl: public CMsgBioControl |
|
39 { |
|
40 public: // Constructor and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aObserver Reference to the Bio control observer. |
|
45 * @param aSession Reference to Message Server session. |
|
46 * @param aId Id of the message. |
|
47 * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. |
|
48 * @param aFileName The newly created object. |
|
49 * @param aFile file handle to provisioning content. |
|
50 */ |
|
51 IMPORT_C static CWPBioControl* NewL( MMsgBioControlObserver& aObserver, |
|
52 CMsvSession* aSession, |
|
53 TMsvId aId, |
|
54 TMsgBioMode aEditorOrViewerMode, |
|
55 const RFile* aFile ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CWPBioControl(); |
|
61 |
|
62 public: // From MMsgBioControl |
|
63 |
|
64 /** |
|
65 * Calculates and sets size for a Bio control according to aSize. |
|
66 * This function might become deprecated. The SetSizeL() function will |
|
67 * be the replacement. |
|
68 * The height of the Bio control may be less or more than requested by |
|
69 * aSize, but the width must be exactly the same. If width of the Bio |
|
70 * control is not the same as given by aSize, the width must be reset |
|
71 * back to requested one. The aSize is set to the new size. |
|
72 * @param aSize Size. |
|
73 */ |
|
74 void SetAndGetSizeL( TSize& aSize ); |
|
75 |
|
76 /** |
|
77 * This is called by the container to allow the Bio control to add |
|
78 * a menu item command. The command ID's should start from the value |
|
79 * returned by the MMsgBioControlObserver::FirstFreeCommand(). |
|
80 * @param aMenuPane Reference to the applications menu which will be |
|
81 * modified. |
|
82 */ |
|
83 void SetMenuCommandSetL( CEikMenuPane& aMenuPane ); |
|
84 |
|
85 /** |
|
86 * The command handler. The Bio Control should only handle its own |
|
87 * commands that it has set using the function SetMenuCommandSetL(). |
|
88 * @param aCommand ID of command to be handled. |
|
89 * @return If the command is handled, it returns ETrue, and vice versa |
|
90 */ |
|
91 TBool HandleBioCommandL( TInt aCommand ); |
|
92 |
|
93 /** |
|
94 * Returns a rectangle slice of the bio controls viewing area. |
|
95 * It is used by the CMsgEditorView class for scrolling the screen. |
|
96 * The position is given relative to the bio controls top left |
|
97 * corner. |
|
98 * @return TRect |
|
99 */ |
|
100 TRect CurrentLineRect() const; |
|
101 |
|
102 /** |
|
103 * Used by the body container for managing focus and scrolling. |
|
104 * @param aDirection The direction to be checked. |
|
105 * @return ETrue if focus change is possible, and vice versa. |
|
106 */ |
|
107 TBool IsFocusChangePossible( TMsgFocusDirection aDirection ) const; |
|
108 |
|
109 /** |
|
110 * Returns the header text. |
|
111 * @return The header text. |
|
112 */ |
|
113 HBufC* HeaderTextL() const; |
|
114 |
|
115 /** |
|
116 * The application can get the option menu permissions using this |
|
117 * function. |
|
118 * @return The option menu permission flags. If the flag is off it |
|
119 * means that the option menu command is not recommended with this |
|
120 * Bio Control. |
|
121 */ |
|
122 TUint32 OptionMenuPermissionsL() const; |
|
123 |
|
124 /** |
|
125 * Gives the height of the text in pixels. |
|
126 * It is used by the scrolling framework. |
|
127 * @return Height of the text in pixels. |
|
128 */ |
|
129 TInt VirtualHeight(); |
|
130 |
|
131 /** |
|
132 * Gives the cursor position in pixels. |
|
133 * It is used by the scrolling framework. |
|
134 * @return Cursor position in pixels. |
|
135 */ |
|
136 TInt VirtualVisibleTop(); |
|
137 |
|
138 /** |
|
139 * Tells whether the cursor is in the topmost or bottom position. |
|
140 * It is used by the scrolling framework. |
|
141 * @param aLocation Specifies either top or bottom. |
|
142 * @return ETrue if the cursor is in the part specified by aLocation. |
|
143 */ |
|
144 TBool IsCursorLocation( TMsgCursorLocation aLocation ) const; |
|
145 |
|
146 |
|
147 public: // From CCoeControl |
|
148 |
|
149 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
150 TEventCode aType ); |
|
151 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
152 |
|
153 protected: // From CCoeControl |
|
154 |
|
155 TInt CountComponentControls() const; |
|
156 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
157 void SizeChanged(); |
|
158 void FocusChanged( TDrawNow aDrawNow ); |
|
159 void SetContainerWindowL( const CCoeControl& aContainer ); |
|
160 /** |
|
161 * SetCenrepKeyL |
|
162 * Set the Cenrep key. |
|
163 * @param aValue Cenrep Value. |
|
164 * @return void |
|
165 **/ |
|
166 void SetCenrepKeyL(const TDesC8& aValue); |
|
167 |
|
168 private: // Constructors |
|
169 |
|
170 /** |
|
171 * Constructor is prohibited. |
|
172 * @param aObserver Reference to the Bio control observer. |
|
173 * @param aSession Reference to Message Server session. |
|
174 * @param aId Id of the message in Message Server. |
|
175 * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. |
|
176 * @param aFileName The newly created object. |
|
177 * @param aFile file handle to provisioning content. |
|
178 */ |
|
179 CWPBioControl( MMsgBioControlObserver& aObserver, |
|
180 CMsvSession* aSession, |
|
181 TMsvId aId, |
|
182 TMsgBioMode aEditorOrViewerMode, |
|
183 const RFile* aFile ); |
|
184 |
|
185 /** |
|
186 * By default Symbian OS constructor is private. |
|
187 */ |
|
188 void ConstructL(); |
|
189 |
|
190 private: // New functions |
|
191 |
|
192 /** |
|
193 * Restores the message from messaging store. |
|
194 */ |
|
195 void RestoreMsgL(); |
|
196 |
|
197 /** |
|
198 * Adds the message summaries to the richbio. |
|
199 */ |
|
200 void AddItemsL(); |
|
201 |
|
202 /** |
|
203 * Collects the summary items from engine and |
|
204 * sorts them. |
|
205 * @return Array with summary items |
|
206 */ |
|
207 RPointerArray<CWPNameValue>* CollectItemsLC() const; |
|
208 |
|
209 /** |
|
210 * Collates items with same title and adds |
|
211 * them to the rich bio. |
|
212 * @param aItems The items to be collated |
|
213 */ |
|
214 void CollateAndAddItemsL( RPointerArray<CWPNameValue>& aItems ); |
|
215 |
|
216 /** |
|
217 * Save the settings. |
|
218 */ |
|
219 void SaveSettingsL(); |
|
220 |
|
221 /** |
|
222 * Save the message again. |
|
223 */ |
|
224 void SaveMessageL(); |
|
225 |
|
226 /** |
|
227 * Do the actual saving. |
|
228 */ |
|
229 void DoSaveL(); |
|
230 |
|
231 /** |
|
232 * Try to authenticate a message. |
|
233 * @param aMessage The message to authenticate |
|
234 */ |
|
235 void AuthenticateL( CWPPushMessage& aMessage ); |
|
236 |
|
237 /** |
|
238 * ResetAndDestroy() cleanup for an RPointerArray<CMsgNameValue>. |
|
239 * @param aAny Array |
|
240 */ |
|
241 static void Cleanup( TAny* aAny ); |
|
242 |
|
243 /** |
|
244 * Comparator for two string pairs. Compares the names of the pairs. |
|
245 * @param aImpl1 First string pair to compare |
|
246 * @param aImpl2 Second string pair to compare |
|
247 */ |
|
248 static TInt Compare( const CWPNameValue& aImpl1, |
|
249 const CWPNameValue& aImpl2 ); |
|
250 private: |
|
251 void ErrorNoteL(const TDesC& aText); |
|
252 void ErrorNoteL(TInt aStringResource); |
|
253 void ConfirmationNoteL(const TDesC& aText); |
|
254 void ConfirmationNoteL(TInt aStringResource); |
|
255 void InformationNoteL(const TDesC& aText); |
|
256 void InformationNoteL(TInt aStringResource); |
|
257 |
|
258 private: //Data |
|
259 enum TMenuCommands |
|
260 { |
|
261 ECmdSaveSettings |
|
262 }; |
|
263 |
|
264 /// Pointer to richbio control. Owns. |
|
265 CRichBio* iRichBio; |
|
266 |
|
267 /// Provisioning engine. Owns. |
|
268 CWPEngine* iEngine; |
|
269 |
|
270 /// The message being handled. Owns. |
|
271 CWPPushMessage* iMessage; |
|
272 }; |
|
273 |
|
274 #endif // CWPBIOCONTROL_H |
|
275 |
|
276 // End of File |
|