|
1 /* |
|
2 * Copyright (c) 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 "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: Fetches a brand icon and its bitmask. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <AknsUtils.h> |
|
22 |
|
23 #include "clogsextbrandfetcher.h" |
|
24 #include "mlogsextbrandfetcherobserver.h" |
|
25 #include "logsextconsts.h" |
|
26 #include "tlogsextutil.h" |
|
27 #include "simpledebug.h" |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // ConstructL |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 void CLogsExtBrandFetcher::ConstructL() |
|
34 { |
|
35 } |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // NewL |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CLogsExtBrandFetcher* CLogsExtBrandFetcher::NewL( |
|
43 const TUint32 aServiceId, |
|
44 MLogsExtBrandFetcherObserver& aObserver) |
|
45 { |
|
46 _LOGP("CLogsExtBrandFetcher::NewL() begin %d" , aServiceId) |
|
47 CLogsExtBrandFetcher* self = CLogsExtBrandFetcher::NewLC( aServiceId, |
|
48 aObserver ); |
|
49 CleanupStack::Pop( self ); |
|
50 _LOG("CLogsExtBrandFetcher::NewL() end" ) |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // NewLC |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CLogsExtBrandFetcher* CLogsExtBrandFetcher::NewLC( |
|
60 const TUint32 aServiceId, |
|
61 MLogsExtBrandFetcherObserver& aObserver ) |
|
62 { |
|
63 _LOG("CLogsExtBrandFetcher::NewLC() begin" ) |
|
64 CLogsExtBrandFetcher* self = |
|
65 new( ELeave ) CLogsExtBrandFetcher( aServiceId, aObserver ); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(); |
|
68 _LOG("CLogsExtBrandFetcher::NewLC() end" ) |
|
69 return self; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // Constructor |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CLogsExtBrandFetcher::CLogsExtBrandFetcher( |
|
77 const TUint32 aServiceId, |
|
78 MLogsExtBrandFetcherObserver& aObserver ) : |
|
79 iServiceId( aServiceId ), |
|
80 iObserver( &aObserver ) |
|
81 { |
|
82 _LOG("CLogsExtBrandFetcher::CLogsExtBrandFetcher()" ) |
|
83 } |
|
84 |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // Destructor |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 CLogsExtBrandFetcher::~CLogsExtBrandFetcher() |
|
91 { |
|
92 _LOG("CLogsExtBrandFetcher::~CLogsExtBrandFetcher() begin" ) |
|
93 _LOG("CLogsExtBrandFetcher::~CLogsExtBrandFetcher() end" ) |
|
94 } |
|
95 |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // Fetches the icon bitmaps from the branding server. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CLogsExtBrandFetcher::Fetch() |
|
102 { |
|
103 _LOG("CLogsExtBrandFetcher::Fetch begin" ) |
|
104 |
|
105 TRAPD( error, GetBitmapsFromBrandServerL() ); |
|
106 |
|
107 _LOG("CLogsExtBrandFetcher::Fetch end" ) |
|
108 return error; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // Fetches the brand icon's bitmap and bitmapmask from the Branding server |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void CLogsExtBrandFetcher::GetBitmapsFromBrandServerL() |
|
117 { |
|
118 _LOG("CLogsExtBrandFetcher::GetBitmapsFromBrandServerL() begin" ) |
|
119 |
|
120 // we need to get the bitmap file from where we can load the bitmap |
|
121 RFile bitmapFile; |
|
122 TInt bitmapId, bitmapMaskId; |
|
123 CleanupClosePushL( bitmapFile ); |
|
124 TLogsExtUtil::GetFileHandleL( iServiceId, |
|
125 KBrandedBitmapItemId, |
|
126 bitmapFile, |
|
127 bitmapId, |
|
128 bitmapMaskId ); |
|
129 CleanupStack::Pop( &bitmapFile ); |
|
130 |
|
131 //ownership of the file handle is transferred to the observer |
|
132 iObserver->BrandIconFetchDoneL( iServiceId, |
|
133 bitmapFile, |
|
134 bitmapId, |
|
135 bitmapMaskId ); |
|
136 |
|
137 _LOG("CLogsExtBrandFetcher::GetBitmapsFromBrandServerL(): end") |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // Returns the service id. |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 TUint32 CLogsExtBrandFetcher::ServiceId() |
|
146 { |
|
147 _LOGP("CLogsExtBrandFetcher::ServiceId %d" , iServiceId) |
|
148 return iServiceId; |
|
149 } |
|
150 |