0
|
1 |
/*------------------------------------------------------------------
|
|
2 |
-
|
|
3 |
* Software Name : UserEmulator
|
|
4 |
* Version : v4.2.1309
|
|
5 |
*
|
|
6 |
* Copyright (c) 2009 France Telecom. All rights reserved.
|
|
7 |
* This software is distributed under the License
|
|
8 |
* "Eclipse Public License - v 1.0" the text of which is available
|
|
9 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
10 |
*
|
|
11 |
* Initial Contributors:
|
|
12 |
* France Telecom
|
|
13 |
*
|
|
14 |
* Contributors:
|
|
15 |
*------------------------------------------------------------------
|
|
16 |
-
|
|
17 |
* File Name: UserEmulatorScriptsView.h
|
|
18 |
*
|
|
19 |
* Created: 13/08/2009
|
|
20 |
* Author(s): Marcell Kiss, Reshma Sandeep Das
|
|
21 |
*
|
|
22 |
* Description:
|
|
23 |
* Application View class
|
|
24 |
*------------------------------------------------------------------
|
|
25 |
-
|
|
26 |
*
|
|
27 |
*/
|
|
28 |
#ifndef USEREMULATORSCRIPTSVIEW_H__
|
|
29 |
#define USEREMULATORSCRIPTSVIEW_H__
|
|
30 |
|
|
31 |
// System Includes
|
|
32 |
#include <coecntrl.h>
|
|
33 |
#include <aknlists.h>
|
|
34 |
#include <Etel3rdParty.h>
|
|
35 |
#include <MTCLREG.H>
|
|
36 |
#include <e32cmn.h>
|
|
37 |
// User Includes
|
|
38 |
#include "FolderContentsListener.h"
|
|
39 |
#include "Settings.h"
|
|
40 |
#include "ScanFolders.h"
|
|
41 |
#include "NotifyFileChange.h"
|
|
42 |
#include "Constants.h"
|
|
43 |
|
|
44 |
// Forward Declarations
|
|
45 |
class CEikEdwin;
|
|
46 |
class CEikColumnListBox;
|
|
47 |
|
|
48 |
// Constants
|
|
49 |
|
|
50 |
typedef TBuf<KBuffer512> TBigFileName;
|
|
51 |
|
|
52 |
enum TSelectStates
|
|
53 |
{
|
|
54 |
EOneItemSel = 1,
|
|
55 |
EOneItem,
|
|
56 |
EMoreItemsSel,
|
|
57 |
EMoreItems,
|
|
58 |
EMoreItemsAll,
|
|
59 |
EMoreItemsAllExc,
|
|
60 |
EMoreItemsNotAll,
|
|
61 |
EMoreItemsNotAllNotCurrent
|
|
62 |
};
|
|
63 |
|
|
64 |
const TInt KDriveSize = 2;
|
|
65 |
// Class Declarations
|
|
66 |
|
|
67 |
/**
|
|
68 |
* IMEI observer interface class
|
|
69 |
*/
|
|
70 |
class MImeiObserver
|
|
71 |
{
|
|
72 |
public:
|
|
73 |
/**
|
|
74 |
* Gets device details
|
|
75 |
* @param aIMEI Reference to a descriptor which will hold details
|
|
76 |
* @param aError not used
|
|
77 |
*/
|
|
78 |
virtual void GotIMEI(const TDesC& aIMEI,TInt aError) = 0;
|
|
79 |
};
|
|
80 |
|
|
81 |
/**
|
|
82 |
* CActive object. Reads IMEI data
|
|
83 |
*/
|
|
84 |
class CImeiReader : public CActive
|
|
85 |
{
|
|
86 |
public:
|
|
87 |
/**
|
|
88 |
* Static constructor
|
|
89 |
* @param aObserver Reference to IMEI observer
|
|
90 |
* @return CImeiReader* A pointer to the newly allocated CImeiReader class.
|
|
91 |
* NULL, if the class cannot be created
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
static CImeiReader* NewL(MImeiObserver& aObserver);
|
|
95 |
/**
|
|
96 |
* Static constructor. On return the instance is left to the CleanupStack
|
|
97 |
* @param aObserver Reference to IMEI observer
|
|
98 |
* @return CImeiReader* A pointer to the newly allocated CImeiReader class.
|
|
99 |
* NULL, if the class cannot be created
|
|
100 |
*/
|
|
101 |
static CImeiReader* NewLC(MImeiObserver& aObserver);
|
|
102 |
/**
|
|
103 |
* Destructor
|
|
104 |
*/
|
|
105 |
~CImeiReader();
|
|
106 |
|
|
107 |
protected:
|
|
108 |
/**
|
|
109 |
* Cancel function of CActive class
|
|
110 |
*/
|
|
111 |
void DoCancel();
|
|
112 |
/**
|
|
113 |
* RunL function of CActive class
|
|
114 |
*/
|
|
115 |
void RunL();
|
|
116 |
private:
|
|
117 |
/**
|
|
118 |
* Constructor
|
|
119 |
* @param aObserver Reference to IMEI observer
|
|
120 |
*
|
|
121 |
*/
|
|
122 |
CImeiReader(MImeiObserver& aObserver);
|
|
123 |
/**
|
|
124 |
* Second phase constructor
|
|
125 |
*
|
|
126 |
*/
|
|
127 |
void ConstructL();
|
|
128 |
|
|
129 |
private:
|
|
130 |
/**
|
|
131 |
* Reference to IMEI observer
|
|
132 |
*
|
|
133 |
*/
|
|
134 |
MImeiObserver& iObserver;
|
|
135 |
/**
|
|
136 |
* Reference to Telephony object
|
|
137 |
*
|
|
138 |
*/
|
|
139 |
CTelephony* iTelephony;
|
|
140 |
/**
|
|
141 |
* Define the mobile phone identity.
|
|
142 |
*/
|
|
143 |
CTelephony::TPhoneIdV1 iIdV1;
|
|
144 |
CTelephony::TPhoneIdV1Pckg iIdV1Pkg;
|
|
145 |
};
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Control class of the application
|
|
149 |
*/
|
|
150 |
class CUserEmulatorScriptsView : public CCoeControl,
|
|
151 |
public MFolderContentsListener,
|
|
152 |
public MFileChangeObserver,
|
|
153 |
public MImeiObserver
|
|
154 |
{
|
|
155 |
public:
|
|
156 |
/**
|
|
157 |
* Static constructor
|
|
158 |
* Create a CUserEmulatorScriptsView object, which will draw itself to aRect.
|
|
159 |
* @param aRect Reference. The rectangle this view will be drawn to.
|
|
160 |
* @param aSettings Reference to Settings class
|
|
161 |
* @param aEikonEnv Reference to controls environment
|
|
162 |
* @return a pointer to the created instance of CUserEmulatorScriptsView.
|
|
163 |
*/
|
|
164 |
static CUserEmulatorScriptsView* NewL(const TRect& aRect, CSettings* aSettings, CEikonEnv* aEikonEnv);
|
|
165 |
/**
|
|
166 |
* Static constructor. On return the instance is left to the CleanupStack
|
|
167 |
* @param aRect Reference. The rectangle this view will be drawn to.
|
|
168 |
* @param aSettings Reference to Settings class
|
|
169 |
* @param aEikonEnv Reference to controls environment
|
|
170 |
* @return a pointer to the created instance of CUserEmulatorScriptsView.
|
|
171 |
*/
|
|
172 |
static CUserEmulatorScriptsView* NewLC(const TRect& aRect, CSettings* aSettings, CEikonEnv* aEikonEnv);
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Virtual Destructor.
|
|
176 |
*/
|
|
177 |
virtual ~CUserEmulatorScriptsView();
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Creates a list from files in script folder
|
|
181 |
*/
|
|
182 |
void ShowScriptsL();
|
|
183 |
|
|
184 |
public:
|
|
185 |
/**
|
|
186 |
* Checks how many items are selected and the current one is selected or not
|
|
187 |
* @return Code about the result (see implementation)
|
|
188 |
*/
|
|
189 |
TInt CheckListBoxSelection();
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Gets the reference to CNotifyFileChange object
|
|
193 |
* @return CNotifyFileChange object's reference
|
|
194 |
*/
|
|
195 |
CNotifyFileChange* GetNotifyFileChange();
|
|
196 |
|
|
197 |
//From MFolderContentsListener
|
|
198 |
/**
|
|
199 |
* From FolderContentListner
|
|
200 |
* This gets called before a new folder is being scanned.
|
|
201 |
* @param aFullPath not used
|
|
202 |
* @param aIsDriveListFlag not used
|
|
203 |
*/
|
|
204 |
void FolderStarting( const TDesC & aFullPath, TBool aIsDriveListFlag );
|
|
205 |
|
|
206 |
/**
|
|
207 |
* This gets called with every entry of the currently scanned folder
|
|
208 |
* that is a folder.
|
|
209 |
* @param aEntry not used
|
|
210 |
*/
|
|
211 |
void NewFolder( const TDesC & aEntry );
|
|
212 |
|
|
213 |
/**
|
|
214 |
* This gets called with every entry of the currently scanned folder
|
|
215 |
* that is a plain file.
|
|
216 |
* @param aEntry Name of the new file appeared in the folder
|
|
217 |
*/
|
|
218 |
void NewFile( const TDesC & aEntry );
|
|
219 |
|
|
220 |
/**
|
|
221 |
* This is called after all entries of the currently scanned folder
|
|
222 |
* have been delivered. This is NOT called when a scan operation is
|
|
223 |
* aborted by starting a new scan before this got called!
|
|
224 |
*/
|
|
225 |
void FolderCompleteL();
|
|
226 |
|
|
227 |
/**
|
|
228 |
* This gets called if an unexpected error occures during scanning.
|
|
229 |
* @param aReasonCode not used
|
|
230 |
*/
|
|
231 |
void ErrorOccured( TInt aReasonCode );
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Calls ShowScriptL function because a change occured in the given folder
|
|
235 |
*/
|
|
236 |
void FileChangeEventL();
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Gets device details
|
|
240 |
* @param aIMEI Reference to a descriptor which will hold details
|
|
241 |
* @param aError error code
|
|
242 |
*/
|
|
243 |
void GotIMEI(const TDesC& aIMEI,TInt aError);
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Gets system infos
|
|
247 |
* @param aValue A flag. If it's true the system info is logged to the log file otherwise
|
|
248 |
* this function displays it
|
|
249 |
*/
|
|
250 |
void CmdGetSystemInfoL(TBool aValue);
|
|
251 |
|
|
252 |
/**
|
|
253 |
* Unmarks item(s) in script view's listbox
|
|
254 |
* @param aCommand Can be EAknUnmarkAll or EAknCmdUnmark.
|
|
255 |
*/
|
|
256 |
void UnMarkL(TInt aCommand);
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Parses and runs all selected scripts
|
|
260 |
* @param aErrcode Error code
|
|
261 |
*/
|
|
262 |
TInt RunScriptsL(TInt& aErrcode);
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Change icon of scripts
|
|
266 |
* @param aScriptStatus Status if script failed or passed, etc.
|
|
267 |
* @param aIndex Index of the script in list box
|
|
268 |
*/
|
|
269 |
void ChangeIconL(TInt aScriptStatus, TInt aIndex);
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Handles application's commands
|
|
273 |
* @param aCommand The command's code
|
|
274 |
*/
|
|
275 |
void HandleMarkCommandL(TInt aCommand);
|
|
276 |
|
|
277 |
/**
|
|
278 |
* Gets name of a script
|
|
279 |
* @param aIndex Index of the script
|
|
280 |
* @returns Script name
|
|
281 |
*/
|
|
282 |
HBufC* GetScriptNameLC(TInt aIndex);
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Gets sum of selected scripts
|
|
286 |
* @return Sum
|
|
287 |
*/
|
|
288 |
TInt GetSelectedScriptsCount();
|
|
289 |
|
|
290 |
/**
|
|
291 |
* Gets sum of all scripts
|
|
292 |
* @return Sum
|
|
293 |
*/
|
|
294 |
TInt GetScriptsCount();
|
|
295 |
|
|
296 |
/**
|
|
297 |
* Updates command button(s)
|
|
298 |
*/
|
|
299 |
void UpdateSystemCba(TBool aConnStatus);
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Gets index of the given script and mark it
|
|
303 |
* @param aScriptName Name of the script
|
|
304 |
* @return Index of the script
|
|
305 |
*/
|
|
306 |
TInt GetScriptIndexAndMarkL(const TDesC8& aScriptName);
|
|
307 |
|
|
308 |
private:
|
|
309 |
/**
|
|
310 |
* 2nd phase constructor.
|
|
311 |
* @param aRect The rectangle this view will be drawn to.
|
|
312 |
*/
|
|
313 |
void ConstructL(const TRect& aRect);
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Constructor
|
|
317 |
* @param aSettings Reference to Settings class
|
|
318 |
* @param aEikonEnv Reference to controls environment
|
|
319 |
*/
|
|
320 |
CUserEmulatorScriptsView(CSettings* aSettings, CEikonEnv* aEikonEnv);
|
|
321 |
/**
|
|
322 |
* Handles incoming pointer events (if this pointer events are enabled on device)
|
|
323 |
* @param aEvent The incoming pointer event
|
|
324 |
*/
|
|
325 |
void HandlePointerEventL( const TPointerEvent& aEvent );
|
|
326 |
/**
|
|
327 |
* Called when view is activated
|
|
328 |
* @param aPrevViewId not used
|
|
329 |
* @param aCustomMessageId not used
|
|
330 |
* @param aCustomMessage not used
|
|
331 |
*/
|
|
332 |
void DoViewActivatedL(const TVwsViewId& aPrevViewId,
|
|
333 |
TUid aCustomMessageId, const TDesC8& aCustomMessage);
|
|
334 |
/**
|
|
335 |
* Called when view is deactivated
|
|
336 |
*/
|
|
337 |
void DoViewDeactivated();
|
|
338 |
|
|
339 |
/**
|
|
340 |
* Constructs a TVwsViewId object with User Emulator's UID and EScriptsView ID
|
|
341 |
* @return Created TVwsViewId object
|
|
342 |
*/
|
|
343 |
TVwsViewId ViewId() const;
|
|
344 |
|
|
345 |
/**
|
|
346 |
* Initialises icons of list box
|
|
347 |
*/
|
|
348 |
void SetupListIconsL();
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Handles several kinds of resource change events
|
|
352 |
* E.q..: KEikDynamicLayoutVariantSwitch
|
|
353 |
*/
|
|
354 |
void HandleResourceChange(TInt aType);
|
|
355 |
|
|
356 |
/**
|
|
357 |
* Returns number of components on the control
|
|
358 |
* @return Component number
|
|
359 |
*/
|
|
360 |
TInt CountComponentControls() const;
|
|
361 |
|
|
362 |
/**
|
|
363 |
* Returns the component linked to the index
|
|
364 |
* @return CCoeControl component
|
|
365 |
*/
|
|
366 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
367 |
|
|
368 |
/**
|
|
369 |
* Make list box to redraw its items
|
|
370 |
*/
|
|
371 |
void ShowFileListL();
|
|
372 |
|
|
373 |
private: //From CCoeControl
|
|
374 |
/**
|
|
375 |
* From CCoeControl, Draw
|
|
376 |
* Draw this CUserEmulatorScriptsView to the screen.
|
|
377 |
* @param aRect the rectangle of this view that needs updating
|
|
378 |
*/
|
|
379 |
void Draw(const TRect& aRect) const;
|
|
380 |
/**
|
|
381 |
* From CoeControl, SizeChanged.
|
|
382 |
* Called by framework when the view size is changed.
|
|
383 |
*/
|
|
384 |
virtual void SizeChanged();
|
|
385 |
/**
|
|
386 |
* From CoeControl, PositionChanged.
|
|
387 |
* Called by framework when the view position is changed.
|
|
388 |
*/
|
|
389 |
virtual void PositionChanged();
|
|
390 |
/**
|
|
391 |
* From CoeControl. Handles key events.
|
|
392 |
*/
|
|
393 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
|
|
394 |
|
|
395 |
public:
|
|
396 |
/**
|
|
397 |
* Descriptor array of selected files in list box
|
|
398 |
*/
|
|
399 |
CDesCArray* iSelectedFilesArray;
|
|
400 |
/**
|
|
401 |
* Array of selected files' index
|
|
402 |
*/
|
|
403 |
const CArrayFix<TInt> *iSelectedIndexes;
|
|
404 |
/**
|
|
405 |
* Stores the result of CheckListBoxSelection function
|
|
406 |
*/
|
|
407 |
TInt iListBoxSelectionFlag;
|
|
408 |
|
|
409 |
private:
|
|
410 |
/**
|
|
411 |
* Main list box of scripts in the View
|
|
412 |
*/
|
|
413 |
CAknColumnListBox* iListBox;
|
|
414 |
/**
|
|
415 |
* Array of all files in the script folder
|
|
416 |
*/
|
|
417 |
CDesCArray* iFilesArray;
|
|
418 |
/**
|
|
419 |
* Contains the path and file name of the script to be executed.
|
|
420 |
*/
|
|
421 |
TBigFileName iFileName;
|
|
422 |
/**
|
|
423 |
* Reference to Settings object
|
|
424 |
*/
|
|
425 |
CSettings* iSettings;
|
|
426 |
/**
|
|
427 |
* Reference to ScanFolder object
|
|
428 |
*/
|
|
429 |
CScanFolders* iScanFolder;
|
|
430 |
/**
|
|
431 |
* Reference to NotifyFileChange object
|
|
432 |
*/
|
|
433 |
CNotifyFileChange* iNotifyFileChange;
|
|
434 |
/**
|
|
435 |
* Reference to device's IMEI reader object
|
|
436 |
*/
|
|
437 |
CImeiReader* iIMEIReader;
|
|
438 |
/**
|
|
439 |
* Buffer for IMEI data
|
|
440 |
*/
|
|
441 |
TBuf<KBuffer256> iImeiNo;
|
|
442 |
/**
|
|
443 |
* Reference to controls environment
|
|
444 |
*/
|
|
445 |
CEikonEnv* iEEnv;
|
|
446 |
|
|
447 |
};
|
|
448 |
|
|
449 |
#endif // USEREMULATORSCRIPTSVIEW_H__
|
|
450 |
// End of File
|