|
1 /* |
|
2 * Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class is the observer of thumbanil generation |
|
15 * * |
|
16 */ |
|
17 |
|
18 #include<Liwcommon.h> |
|
19 #include "serviceerrno.h" |
|
20 #include "mgservicethumbnailobserver.h" |
|
21 #include"mginterface.h" |
|
22 _LIT8(KResponse,"ReturnValue"); |
|
23 _LIT8(KErrorCode,"ErrorCode"); |
|
24 |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CServiceThumbanilObserver::NewL |
|
28 // Returns the instance of CServiceThumbanilObserver. |
|
29 // ----------------------------------------------------------------------------- |
|
30 CServiceThumbnailObserver* CServiceThumbnailObserver::NewL( MLiwNotifyCallback* aCallBack ) |
|
31 { |
|
32 CServiceThumbnailObserver* self = new( ELeave ) CServiceThumbnailObserver(aCallBack); |
|
33 return self; |
|
34 } |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CServiceThumbanilObserver::~CServiceThumbnailObserver |
|
37 // Destructor |
|
38 // ----------------------------------------------------------------------------- |
|
39 CServiceThumbnailObserver::~CServiceThumbnailObserver() |
|
40 { |
|
41 iCallBack = NULL; |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CServiceThumbnailObserver::ThumbnailReady |
|
46 // This method is called when thumbnail gets generated |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 void CServiceThumbnailObserver::ThumbnailReady(TInt aError, TDesC& aThumbnailURL,TInt32 aTransactionID) |
|
50 |
|
51 { |
|
52 CLiwGenericParamList* input = NULL; |
|
53 CLiwGenericParamList* output = CLiwGenericParamList::NewLC(); |
|
54 |
|
55 output->Reset(); |
|
56 |
|
57 TInt sapiErr = SErrNone; |
|
58 if (aError) |
|
59 { |
|
60 sapiErr = CMgInterface::SapiError( aError ); |
|
61 } |
|
62 |
|
63 |
|
64 |
|
65 output->AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)sapiErr))); |
|
66 |
|
67 output->AppendL( TLiwGenericParam ( KResponse, TLiwVariant ( aThumbnailURL ) ) ); |
|
68 |
|
69 TRAP_IGNORE(iCallBack->HandleNotifyL ( aTransactionID, KLiwEventCompleted, *output,*input )); |
|
70 |
|
71 |
|
72 CleanupStack::PopAndDestroy( output ); |
|
73 delete this; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CServiceThumbnailObserver::ThumbnailRequestCancel |
|
78 // Callback method gets called when thumbnail request is canceled |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 |
|
82 void CServiceThumbnailObserver::ThumbnailRequestCancel(TInt aError,TInt32 aTransactionID) |
|
83 { |
|
84 CLiwGenericParamList* input = NULL; |
|
85 CLiwGenericParamList* output = CLiwGenericParamList::NewLC(); |
|
86 |
|
87 output->Reset(); |
|
88 |
|
89 output->AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SErrNone))); |
|
90 output->AppendL( TLiwGenericParam ( KResponse, TLiwVariant ( aError ) ) ); |
|
91 |
|
92 TRAP_IGNORE(iCallBack->HandleNotifyL ( aTransactionID, KLiwEventCanceled, *output,*input )); |
|
93 |
|
94 |
|
95 CleanupStack::PopAndDestroy( output ); |
|
96 delete this; |
|
97 } |
|
98 |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CServiceThumbnailObserver::CServiceThumbnailObserver |
|
102 // Constructor |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 CServiceThumbnailObserver::CServiceThumbnailObserver( MLiwNotifyCallback* aCallBack ) |
|
106 { |
|
107 iCallBack = aCallBack; |
|
108 |
|
109 } |