diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/TimeAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/TimeAO.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,106 @@ +/* + ============================================================================ + Name : TimeAO.cpp + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CTimeAO implementation + ============================================================================ + */ + +#include "TimeAO.h" +#include "MCountTime.h" +// --------------------------------------------------------------------------- +// CTimeAO() +// --------------------------------------------------------------------------- +// +CTimeAO::CTimeAO() : + CActive(EPriorityStandard) // Standard priority + { + } +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CTimeAO* CTimeAO::NewLC() + { + CTimeAO* self = new (ELeave) CTimeAO(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CTimeAO* CTimeAO::NewL() + { + CTimeAO* self = CTimeAO::NewLC(); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CTimeAO::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); // Add to scheduler + } +// --------------------------------------------------------------------------- +// ~CTimeAO() +// --------------------------------------------------------------------------- +// +CTimeAO::~CTimeAO() + { + Cancel(); // Cancel any request, if outstanding + iTimer.Close(); // Destroy the RTimer object + // Delete instance variables if any + } +// --------------------------------------------------------------------------- +// DoCancel() +// --------------------------------------------------------------------------- +// +void CTimeAO::DoCancel() + { + iTimer.Cancel(); + } +// --------------------------------------------------------------------------- +// StartL() +// --------------------------------------------------------------------------- +// +void CTimeAO::StartL() + { + Cancel(); // Cancel any request, just to be sure + iTimer.After(iStatus, 1000000); // Set for later + SetActive(); // Tell scheduler a request is active + } +// --------------------------------------------------------------------------- +// SetObserver() +// --------------------------------------------------------------------------- +// +void CTimeAO::SetObserver(MCountTime* aObserver) + { + iObserver = aObserver; + } +// --------------------------------------------------------------------------- +// RunL() +// --------------------------------------------------------------------------- +// +void CTimeAO::RunL() + { + + if (iObserver != NULL) + { + iObserver->Notify(); + } + } +// --------------------------------------------------------------------------- +// RunError() +// --------------------------------------------------------------------------- +// +TInt CTimeAO::RunError(TInt aError) + { + return aError; + }