20 #define __CREATORENGINE_H__ |
20 #define __CREATORENGINE_H__ |
21 |
21 |
22 // INCLUDES |
22 // INCLUDES |
23 #include <e32std.h> |
23 #include <e32std.h> |
24 #include <e32base.h> |
24 #include <e32base.h> |
25 #include <f32file.h> |
25 #include <e32hal.h> |
26 #include <W32STD.H> |
26 #include <s32file.h> |
|
27 #include <s32mem.h> |
|
28 #include <w32std.h> |
27 |
29 |
28 //#include <aknenv.h> |
30 //#include <aknenv.h> |
29 #include <coeutils.h> |
31 #include <coeutils.h> |
30 #include <apparc.h> |
32 #include <apparc.h> |
31 #include <eikenv.h> |
33 #include <eikenv.h> |
32 //#include <aknprogressdialog.h> |
|
33 //#include <eikprogi.h> |
34 //#include <eikprogi.h> |
34 #include <bautils.h> |
35 #include <bautils.h> |
35 #include <commdb.h> |
36 #include <commdb.h> |
36 #include <imageconversion.h> //TFrameInfo |
37 #include <imageconversion.h> //TFrameInfo |
37 |
38 |
38 #include "creator.hrh" |
39 #include "creator.hrh" |
39 #include "creator_std.h" |
40 #include "creator_std.h" |
40 #include "creator_scriptentry.h" |
|
41 #include "creator_modulebase.h" |
|
42 #include "creator_browser.h" |
|
43 #include "creator_calendar.h" |
|
44 #include "creator_phonebookbase.h" |
|
45 #include "creator_note.h" |
|
46 #include "creator_log.h" |
|
47 #include "creator_connectionmethodbase.h" |
|
48 #include "creator_mailbox.h" |
|
49 //#include "creator_imps.h" |
|
50 #include "creator_message.h" |
|
51 #include "creator_landmark.h" |
|
52 #include "creator_randomdataparser.h" |
41 #include "creator_randomdataparser.h" |
53 |
42 |
54 //class CCreatorAppUi; |
43 //class CCreatorAppUi; |
55 class TCommand; |
44 class TCommand; |
56 class CCreatorBrowser; |
45 class CCreatorBrowser; |
57 class CCreatorCalendarBase; |
46 class CCreatorCalendarBase; |
58 class CCreatorNotepad; |
47 class CCreatorNotepad; |
59 class CCreatorLogs; |
48 class CCreatorLogs; |
60 class CCreatorAccessPoints; |
49 //class CCreatorAccessPoints; |
61 class CCreatorMailboxes; |
50 class CCreatorMailboxes; |
62 class CCreatorIMPS; |
51 class CCreatorIMPS; |
63 class CCreatorFiles; |
52 class CCreatorFiles; |
64 class CCreatorMessages; |
53 class CCreatorMessages; |
65 class CCreatorLandmarks; |
54 class CCreatorLandmarks; |
|
55 class MCreatorModuleBase; |
|
56 class CCreatorPhonebookBase; |
|
57 class CCreatorModuleBaseParameters; |
|
58 //class CCreatorConnectionSettingsBase; |
66 class CDictionaryFileStore; |
59 class CDictionaryFileStore; |
67 class CImageDecoder; |
60 class CImageDecoder; |
68 class CFbsBitmap; |
61 class CFbsBitmap; |
69 class CBitmapScaler; |
62 class CBitmapScaler; |
70 |
63 class CCommandParser; |
71 class EngineWrapper; |
64 class EngineWrapper; |
72 class CCreatorCmdScriptRun; |
65 class CCreatorCmdScriptRun; |
73 |
66 |
74 static const TUid KUidCreatorApp = {0x20011383}; |
67 static const TUid KUidCreatorApp = {0x20011383}; |
75 |
68 |
83 R_ATTACHMENT_MULTI_SELECTION_QUERY, |
76 R_ATTACHMENT_MULTI_SELECTION_QUERY, |
84 R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY, |
77 R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY, |
85 R_ATTACHMENT_SINGLE_SELECTION_QUERY |
78 R_ATTACHMENT_SINGLE_SELECTION_QUERY |
86 }; |
79 }; |
87 |
80 |
|
81 /* |
|
82 * Interface for UI dialogs |
|
83 */ |
|
84 class MUIObserver |
|
85 { |
|
86 public: |
|
87 /** |
|
88 * Called when some dialog in UI is closed |
|
89 * |
|
90 * @since S60 10.1 |
|
91 * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
92 * @param aUserData number that was passed to UI before dialog was opened |
|
93 * @return None. |
|
94 */ |
|
95 virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) = 0; |
|
96 |
|
97 }; |
|
98 |
|
99 /* |
|
100 * Interface for CCommandParser |
|
101 */ |
|
102 class MCommandParserObserver |
|
103 { |
|
104 public: |
|
105 /** |
|
106 * Called when CCommandParser user has choosen script file |
|
107 * |
|
108 * @since S60 10.1 |
|
109 * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
110 * @param aFileName filename chosen by user |
|
111 * @return None. |
|
112 */ |
|
113 virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0; |
|
114 |
|
115 /** |
|
116 * Called when CCommandParser user has choosen random data file |
|
117 * |
|
118 * @since S60 10.1 |
|
119 * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
120 * @param aFileName filename chosen by user |
|
121 * @return None. |
|
122 */ |
|
123 virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0; |
|
124 }; |
|
125 |
88 /** |
126 /** |
89 * Device memory information |
127 * Device memory information |
90 */ |
128 */ |
91 class TMemoryDetails |
129 class TMemoryDetails |
92 { |
130 { |
93 public: |
131 public: |
94 TBuf<16> iCFree; |
132 |
95 TBuf<16> iDFree; |
133 TBuf<16> iFree; |
96 TBuf<16> iEFree; |
134 TBuf<16> iSize; |
97 TBuf<16> iHFree; |
135 TChar iDriveLetter; |
98 TBuf<16> iCSize; |
136 |
99 TBuf<16> iDSize; |
137 TBuf<16> iRamFree; |
|
138 TBuf<16> iRomFree; |
|
139 |
100 TBool iENotAvailable; |
140 TBool iENotAvailable; |
101 TBuf<16> iESize; |
141 |
102 TBuf<16> iHSize; |
142 TBuf<16> iRamSize; |
|
143 TBuf<16> iRomSize; |
103 }; |
144 }; |
104 // Common constant for undefined integer value: |
145 // Common constant for undefined integer value: |
105 const TInt KUndef = KErrNotFound; |
146 const TInt KUndef = KErrNotFound; |
106 |
147 |
107 class CCreatorEngine : public CActive |
148 class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver |
108 { |
149 { |
|
150 enum ECreatorEngineState{ |
|
151 ECreatorEngineDeleteAllEntries, |
|
152 ECreatorEngineDeleteAllCreatorEntries, |
|
153 }; |
109 public: |
154 public: |
110 |
155 |
111 enum TRandomStringType |
156 enum TRandomStringType |
112 { |
157 { |
113 EFirstName = 0, |
158 EFirstName = 0, |
211 void Init(); |
257 void Init(); |
212 void RunL(); |
258 void RunL(); |
213 TInt RunError(TInt aError); |
259 TInt RunError(TInt aError); |
214 void DoCancel(); |
260 void DoCancel(); |
215 |
261 |
216 void ExecuteFirstCommandL(const TDesC& aText); |
|
217 void ExecuteCommand(); |
262 void ExecuteCommand(); |
218 void StartEnginesL(); |
263 void StartEnginesL(); |
219 void ShutDownEnginesL(); |
|
220 void CheckForMoreCommandsL(); |
264 void CheckForMoreCommandsL(); |
221 |
265 |
222 TBool IsDeleteCommand( TInt aCommand ); |
266 TBool IsDeleteCommand( TInt aCommand ); |
223 |
267 |
224 TInt ReadRandomDataL(const TRandomStringType aRandomStringType, |
268 TInt ReadRandomDataL(const TRandomStringType aRandomStringType, |
226 const TDesC& aFilename, |
270 const TDesC& aFilename, |
227 const CCreatorRandomDataParser::TRandomDataType aRandomDataType); |
271 const CCreatorRandomDataParser::TRandomDataType aRandomDataType); |
228 void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName ); |
272 void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName ); |
229 void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize ); |
273 void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize ); |
230 |
274 |
|
275 public: // from MUIObserver |
|
276 /** |
|
277 * Called when some dialog in UI is closed |
|
278 * |
|
279 * @since S60 10.1 |
|
280 * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
281 * @param aUserData number that was passed to UI before dialog was opened |
|
282 * @return ?description |
|
283 */ |
|
284 virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); |
|
285 |
|
286 public: // from MCommandParserObserver |
|
287 /** |
|
288 * Called when CCommandParser user has choosen script file |
|
289 * |
|
290 * @since S60 10.1 |
|
291 * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
292 * @param aFileName filename chosen by user |
|
293 * @return None. |
|
294 */ |
|
295 virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC); |
|
296 |
|
297 /** |
|
298 * Called when CCommandParser user has choosen random data file |
|
299 * |
|
300 * @since S60 10.1 |
|
301 * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed |
|
302 * @param aFileName filename chosen by user |
|
303 * @return None. |
|
304 */ |
|
305 virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC); |
|
306 |
231 public: |
307 public: |
232 void ExecuteOptionsMenuCommandL(TInt aCommand); |
308 void ExecuteOptionsMenuCommandL(TInt aCommand); |
233 void RunScriptL(); |
309 void RunScriptL(); |
234 TInt RunScriptL(const TDesC& aScriptFile); |
310 TInt RunScriptL(const TDesC& aScriptFile); |
235 |
311 void ShutDownEnginesL(); |
|
312 void ExecuteFirstCommandL(const TDesC& aText); |
|
313 |
236 void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1); |
314 void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1); |
237 TInt CommandArrayCount(); |
315 TInt CommandArrayCount(); |
238 |
316 |
239 TPtrC TestDataPathL(enum TTestDataPath aTestDataPath); |
317 TPtrC TestDataPathL(enum TTestDataPath aTestDataPath); |
240 TPtrC RandomSoundFileL(); // Returns temporary path, which will be removed on shutdown |
318 TPtrC RandomSoundFileL(); // Returns temporary path, which will be removed on shutdown |
278 const TDesC& domain, |
356 const TDesC& domain, |
279 const TDesC& country) const; |
357 const TDesC& country) const; |
280 |
358 |
281 void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath); |
359 void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath); |
282 |
360 |
283 TBool GetRandomDataFilenameL(TDes& aFilename); |
361 TBool GetRandomDataL(); |
284 TBool GetRandomDataFromFileL(const TDesC& aFilename); |
362 TBool GetRandomDataFromFileL(const TDesC& aFilename); |
285 void CancelComplete(); |
363 void CancelComplete(); |
286 CDictionaryFileStore* FileStoreLC(); |
364 CDictionaryFileStore* FileStoreLC(); |
287 void ReadEntryIdsFromStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid ); |
365 void ReadEntryIdsFromStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid ); |
288 void WriteEntryIdsToStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid ); |
366 void WriteEntryIdsToStoreL( RArray<TInt>& aEntryIds, const TUid aModuleUid ); |
289 void ReadEntryIdsFromStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid ); |
367 void ReadEntryIdsFromStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid ); |
290 void WriteEntryIdsToStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid ); |
368 void WriteEntryIdsToStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid ); |
291 void RemoveStoreL( const TUid aModuleUid ); |
369 void RemoveStoreL( const TUid aModuleUid ); |
292 void ProgressDialogCancelledL(); |
370 void ProgressDialogCancelledL(); |
|
371 |
|
372 void SortCommands(); |
293 |
373 |
294 private: |
374 private: |
295 // needed by the engine itself |
375 // needed by the engine itself |
296 RTimer iTimer; |
376 RTimer iTimer; |
297 CEikonEnv* iEnv; |
377 CEikonEnv* iEnv; |
298 //CCreatorAppUi* iAppUi; |
378 //CCreatorAppUi* iAppUi; |
299 TInt iCurrentEntry; |
379 TInt iCurrentEntry; |
300 TInt iEntriesToBeCreated; |
|
301 TInt iFailedCommands; |
380 TInt iFailedCommands; |
302 |
381 |
303 CDesCArrayFlat* iSoundFileArray; |
382 CDesCArrayFlat* iSoundFileArray; |
304 CDesCArrayFlat* iPictureFileArray; |
383 CDesCArrayFlat* iPictureFileArray; |
305 CCommandArray* iCommandArray; |
384 CCommandArray* iCommandArray; |
329 CCreatorBrowser* iBrowser; |
408 CCreatorBrowser* iBrowser; |
330 CCreatorCalendarBase* iCalendar; |
409 CCreatorCalendarBase* iCalendar; |
331 CCreatorPhonebookBase* iPhonebook; |
410 CCreatorPhonebookBase* iPhonebook; |
332 CCreatorNotepad* iNotepad; |
411 CCreatorNotepad* iNotepad; |
333 CCreatorLogs* iLogs; |
412 CCreatorLogs* iLogs; |
334 CCreatorConnectionSettingsBase* iAccessPoints; |
413 // CCreatorConnectionSettingsBase* iAccessPoints; |
335 CCreatorMailboxes* iMailboxes; |
414 CCreatorMailboxes* iMailboxes; |
336 CCreatorIMPS* iIMPS; |
415 CCreatorIMPS* iIMPS; |
337 CCreatorFiles* iFiles; |
416 CCreatorFiles* iFiles; |
338 CCreatorMessages* iMessages; |
417 CCreatorMessages* iMessages; |
339 CCreatorLandmarks* iLandmarks; |
418 CCreatorLandmarks* iLandmarks; |
340 CCreatorCmdScriptRun* iCmdScriptRun; |
419 CCreatorCmdScriptRun* iCmdScriptRun; |
|
420 CCommandParser* iCommandParser; |
341 |
421 |
342 // options menu command home module |
422 // options menu command home module |
343 MCreatorModuleBase* iUsedOptionsMenuModule; |
423 MCreatorModuleBase* iUsedOptionsMenuModule; |
344 |
424 |
345 HBufC* iTempPath; |
425 HBufC* iTempPath; |
357 CFrameImageData* iFrameImageData; |
437 CFrameImageData* iFrameImageData; |
358 CBitmapScaler* iScaler; |
438 CBitmapScaler* iScaler; |
359 |
439 |
360 EngineWrapper* iEngineWrapper; // Enginewrapper that is used for communicating between QT and Symbian |
440 EngineWrapper* iEngineWrapper; // Enginewrapper that is used for communicating between QT and Symbian |
361 TMemoryDetails iMemoryDetails; |
441 TMemoryDetails iMemoryDetails; |
|
442 |
|
443 RPointerArray<TMemoryDetails> iMemoryDetailsList; |
|
444 |
362 TInt iResourceFileId; |
445 TInt iResourceFileId; |
363 |
446 |
364 HBufC* iCommandLineScriptName; |
447 HBufC* iCommandLineScriptName; |
365 HBufC* iCommandLineRandomDataFileName; |
448 HBufC* iCommandLineRandomDataFileName; |
366 }; |
449 }; |