--- a/creator/engine/inc/creator_modulebase.h Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_modulebase.h Thu Jul 22 16:33:59 2010 +0100
@@ -16,13 +16,14 @@
*/
-
-
#ifndef __CREATOR_MODULEBASE_H__
#define __CREATOR_MODULEBASE_H__
#include <e32base.h>
+#include "engine.h"
+#include "creator_traces.h"
+
// Dictionary uids for each Creator module.
// Dictionaries are for storing item identifiers created by Creator.
// Item identifiers are for enabling deletion of only items created by Creator.
@@ -46,30 +47,102 @@
class MCreatorModuleBaseParameters;
class CCommandParser;
+_LIT(KSavingText, "Saving");
+_LIT(KDeletingText, "Deleting");
+
class MCreatorModuleBase
{
public:
private:
// constructs the module, add "iEngine = aEngine" and other construction stuff to the body
- virtual void ConstructL(CCreatorEngine* aEngine) = 0;
+ virtual void ConstructL( CCreatorEngine* aEngine ) = 0;
public:
// this one is called when user select some features directly from menu, not running a script
// should call CreateRandomData() function
// returns ETrue when success, EFalse when user has cancelled
- virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) = 0;
+ virtual TBool AskDataFromUserL( TInt aCommand ) = 0;
virtual void DeleteAllL() = 0;
virtual void DeleteAllCreatedByCreatorL() = 0;
+ };
+
+
+class CCreatorModuleBase : public CBase, public MCreatorModuleBase, public MUIObserver
+ {
public:
- CCreatorEngine* iEngine;
+ enum TCreatorModuleStatus
+ {
+ ECreatorModuleDelete = 0,
+ ECreatorModuleStart
+ };
+
+ CCreatorModuleBase()
+ {
+ iEntriesToBeCreated = 1;
+ }
+
+ virtual TBool AskDataFromUserL(TInt aCommand)
+ {
+ iCommand = aCommand;
+ return EFalse;// will finish user interaction and engine will shutdown modules
+ }
+
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL");
+
+ if( aPositiveAction == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+ const TDesC* showText = &KSavingText;
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorModuleDelete:
+ showText = &KDeletingText;
+ iEntriesToBeCreated = 1;
+ finished = ETrue;
+ break;
+ case ECreatorModuleStart:
+ finished = ETrue;
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( *showText );
+ }
+ }
-private:
-
+protected:
+ // constructs the module, add "iEngine = aEngine" and other construction stuff to the body
+ virtual void ConstructL(CCreatorEngine* aEngine)
+ {
+ iEngine = aEngine;
+ };
+
+protected:
+ CCreatorEngine* iEngine;
+ TInt iCommand;
+ TInt iEntriesToBeCreated;
+ TInt iDummy;
};
-
class MCreatorModuleBaseParameters
{
// a base class for the parameters, no default implementation
@@ -112,4 +185,4 @@
#endif // __CREATOR_MODULEBASE_H__
-
\ No newline at end of file
+