sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "openwfcjob.h" sl@0: #include "openwfcjobmanager.h" sl@0: sl@0: TOpenWfcJob::TOpenWfcJob(COpenWfcJobManger& aJobManager): sl@0: iJobManager(aJobManager), sl@0: iJobId(EInvalidJobId), sl@0: iCallingThread(KNullThreadId), sl@0: iCompleteRequest(NULL) sl@0: { sl@0: sl@0: } sl@0: sl@0: void TOpenWfcJob::Set(EOpenWfcJobId aJob, sl@0: TThreadId aThreadId, sl@0: TRequestStatus* aRequest) sl@0: { sl@0: iJobId = aJob; sl@0: iCallingThread = aThreadId; sl@0: iCompleteRequest =aRequest; sl@0: JQLOG(("** TOpenWfcJob::Sett() : iCompleteRequest(0x%x) iJobId(%d)", aRequest, aJob)); sl@0: } sl@0: sl@0: sl@0: void TOpenWfcJob::Reset() sl@0: { sl@0: iJobId = EInvalidJobId; sl@0: iCallingThread = KNullThreadId; sl@0: iCompleteRequest =NULL; sl@0: } sl@0: sl@0: TOpenWfcJob::~TOpenWfcJob() sl@0: { sl@0: } sl@0: sl@0: sl@0: void TOpenWfcJob::Run() sl@0: { sl@0: switch (iJobId) sl@0: { sl@0: case EComposeJobId: sl@0: JQLOG(("** LAUNCH * TOpenWfcJob::Run EComposeJobId")); sl@0: iJobManager.DoComposeJob(*this); sl@0: break; sl@0: case EPauseCompositionJobId: sl@0: JQLOG(("** LAUNCH * TOpenWfcJob::Run EPauseCompositionJobId")); sl@0: iJobManager.DoPauseCompositionJob(*this); sl@0: break; sl@0: case EResumeCompositionJobId: sl@0: JQLOG(("** LAUNCH * TOpenWfcJob::Run EResumeCompositionJobId")); sl@0: iJobManager.DoResumeCompositionJob(*this); sl@0: break; sl@0: default: sl@0: JQLOG(("** ERROR * TOpenWfcJob::Run jobId(%d)", iJobId)); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: void TOpenWfcJob::CompleteRequest(TInt aResult) sl@0: { sl@0: if (iCompleteRequest) sl@0: { sl@0: RThread thread; sl@0: sl@0: if (thread.Open(iCallingThread) == KErrNone) sl@0: { sl@0: JQLOG(("** TOpenWfcJob::CompleteRequest(): CompleteReq(0x%x))", iCompleteRequest)); sl@0: thread.RequestComplete(iCompleteRequest, aResult); sl@0: thread.Close(); sl@0: } sl@0: } sl@0: }