os/graphics/windowing/windowserverplugins/openwfc/src/openwfcjob.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserverplugins/openwfc/src/openwfcjob.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,86 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "openwfcjob.h"
    1.20 +#include "openwfcjobmanager.h"
    1.21 +
    1.22 +TOpenWfcJob::TOpenWfcJob(COpenWfcJobManger& aJobManager):
    1.23 +iJobManager(aJobManager),
    1.24 +iJobId(EInvalidJobId), 
    1.25 +iCallingThread(KNullThreadId),
    1.26 +iCompleteRequest(NULL)
    1.27 +	{
    1.28 +	
    1.29 +	}
    1.30 +
    1.31 +void TOpenWfcJob::Set(EOpenWfcJobId aJob,
    1.32 +		              TThreadId aThreadId,
    1.33 +		              TRequestStatus* aRequest)
    1.34 +	{
    1.35 +	iJobId = aJob; 
    1.36 +	iCallingThread = aThreadId;
    1.37 +	iCompleteRequest =aRequest;
    1.38 +    JQLOG(("** TOpenWfcJob::Sett() : iCompleteRequest(0x%x) iJobId(%d)", aRequest, aJob));
    1.39 +	}
    1.40 +
    1.41 +
    1.42 +void TOpenWfcJob::Reset()
    1.43 +	{
    1.44 +	iJobId = EInvalidJobId; 
    1.45 +	iCallingThread = KNullThreadId;
    1.46 +	iCompleteRequest =NULL;
    1.47 +	}
    1.48 +
    1.49 +TOpenWfcJob::~TOpenWfcJob()
    1.50 +	{
    1.51 +	}
    1.52 +
    1.53 +
    1.54 +void TOpenWfcJob::Run()
    1.55 +	{
    1.56 +	switch (iJobId)
    1.57 +		{
    1.58 +		case EComposeJobId:
    1.59 +            JQLOG(("** LAUNCH * TOpenWfcJob::Run EComposeJobId"));
    1.60 +			iJobManager.DoComposeJob(*this);
    1.61 +			break;
    1.62 +		case EPauseCompositionJobId:
    1.63 +            JQLOG(("** LAUNCH * TOpenWfcJob::Run EPauseCompositionJobId"));
    1.64 +			iJobManager.DoPauseCompositionJob(*this);
    1.65 +			break;
    1.66 +		case EResumeCompositionJobId:
    1.67 +            JQLOG(("** LAUNCH * TOpenWfcJob::Run EResumeCompositionJobId"));
    1.68 +			iJobManager.DoResumeCompositionJob(*this);
    1.69 +			break;
    1.70 +		default:
    1.71 +		    JQLOG(("** ERROR * TOpenWfcJob::Run jobId(%d)", iJobId));
    1.72 +			break;
    1.73 +		}
    1.74 +	}
    1.75 +
    1.76 +void TOpenWfcJob::CompleteRequest(TInt aResult)
    1.77 +    {
    1.78 +    if (iCompleteRequest)
    1.79 +        {
    1.80 +        RThread thread;
    1.81 +        
    1.82 +        if (thread.Open(iCallingThread) == KErrNone)
    1.83 +            {
    1.84 +            JQLOG(("** TOpenWfcJob::CompleteRequest(): CompleteReq(0x%x))", iCompleteRequest));
    1.85 +            thread.RequestComplete(iCompleteRequest, aResult);
    1.86 +            thread.Close();
    1.87 +            }
    1.88 +        }
    1.89 +    }