25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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: Implementation of CWsfIconArrayCreator.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// EXTERNAL INCLUDES
|
|
19 |
#include <AknIconArray.h>
|
|
20 |
#include <AknIconUtils.h>
|
|
21 |
#include <AknsUtils.h>
|
|
22 |
#include <eikenv.h>
|
|
23 |
#include <AknsConstants.h>
|
|
24 |
#include <wsficons.mbg>
|
|
25 |
#include <gulicon.h>
|
|
26 |
|
|
27 |
// INTERNAL INCLUDES
|
|
28 |
#include "wsfaiplugincommon.h"
|
|
29 |
#include "wsficonarraycreator.h"
|
|
30 |
|
|
31 |
|
|
32 |
// LOCAL DEFINITIONS
|
|
33 |
const TInt KAIShortcutPluginGranularity = 10;
|
|
34 |
#ifdef _DEBUG
|
|
35 |
_LIT( KIconArrayCreatorPanic, "CWsfIconArrayCreator" );
|
|
36 |
#define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \
|
|
37 |
User::Panic( KIconArrayCreatorPanic, __LINE__) )
|
|
38 |
#else
|
|
39 |
#define _ASS_D( cond ) {}
|
|
40 |
#endif //_DEBUG
|
|
41 |
|
|
42 |
// --------------------------------------------------------------------------
|
|
43 |
// CleanUpResetAndDestroy
|
|
44 |
// --------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
void CleanUpResetAndDestroy(TAny* aArray)
|
|
47 |
{
|
|
48 |
if(aArray)
|
|
49 |
{
|
|
50 |
CArrayPtrFlat<CBase>* array=(CArrayPtrFlat<CBase>*)aArray;
|
|
51 |
array->ResetAndDestroy();
|
|
52 |
delete array;
|
|
53 |
}
|
|
54 |
}
|
|
55 |
|
|
56 |
// --------------------------------------------------------------------------
|
|
57 |
// LoadIconLC
|
|
58 |
// --------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
CGulIcon* LoadIconLC( const TInt aIconId, const TFileName aBitmapFile )
|
|
61 |
{
|
|
62 |
CGulIcon* icon = CGulIcon::NewLC();
|
|
63 |
CFbsBitmap* bitmap;
|
|
64 |
CFbsBitmap* mask;
|
|
65 |
|
|
66 |
// Creates bitmap an icon.
|
|
67 |
AknIconUtils::CreateIconL( bitmap,
|
|
68 |
mask,
|
|
69 |
aBitmapFile,
|
|
70 |
aIconId,
|
|
71 |
aIconId+1 );
|
|
72 |
|
|
73 |
icon->SetBitmap( bitmap );
|
|
74 |
icon->SetMask( mask );
|
|
75 |
return icon;
|
|
76 |
}
|
|
77 |
|
|
78 |
// --------------------------------------------------------------------------
|
|
79 |
// LoadSkinnableIconLC
|
|
80 |
// --------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
CGulIcon* LoadSkinnableIconLC( const TAknsItemID aAknItemId,
|
|
83 |
const TInt aIconId,
|
|
84 |
const TFileName aBitmapFile )
|
|
85 |
{
|
|
86 |
CGulIcon* icon = CGulIcon::NewLC();
|
|
87 |
CFbsBitmap* bitmap;
|
|
88 |
CFbsBitmap* mask;
|
|
89 |
|
|
90 |
// Creates bitmap an icon.
|
|
91 |
AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
|
|
92 |
aAknItemId,
|
|
93 |
bitmap,
|
|
94 |
mask,
|
|
95 |
aBitmapFile,
|
|
96 |
aIconId,
|
|
97 |
aIconId + 1 );
|
|
98 |
|
|
99 |
icon->SetBitmap(bitmap);
|
|
100 |
icon->SetMask(mask);
|
|
101 |
return icon;
|
|
102 |
}
|
|
103 |
|
|
104 |
// ---------------------------------------------------------
|
|
105 |
// LoadSkinnableBlackIconLC
|
|
106 |
// ---------------------------------------------------------
|
|
107 |
//
|
|
108 |
CGulIcon* LoadSkinnableBlackIconLC( const TAknsItemID aAknItemId,
|
|
109 |
const TInt aIconId,
|
|
110 |
const TFileName aBitmapFile )
|
|
111 |
{
|
|
112 |
CGulIcon* icon = CGulIcon::NewLC();
|
|
113 |
CFbsBitmap* bitmap;
|
|
114 |
CFbsBitmap* mask;
|
|
115 |
|
|
116 |
// Creates bitmap an icon.
|
|
117 |
AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
|
|
118 |
aAknItemId,
|
|
119 |
KAknsIIDQsnIconColors,
|
|
120 |
EAknsCIQsnIconColorsCG13,
|
|
121 |
bitmap,
|
|
122 |
mask,
|
|
123 |
aBitmapFile,
|
|
124 |
aIconId,
|
|
125 |
aIconId+1,
|
|
126 |
KRgbBlack );
|
|
127 |
|
|
128 |
icon->SetBitmap( bitmap );
|
|
129 |
icon->SetMask( mask );
|
|
130 |
return icon;
|
|
131 |
}
|
|
132 |
|
|
133 |
// --------------------------------------------------------------------------
|
|
134 |
// CWsfIconArrayCreator::CreateArrayL
|
|
135 |
// --------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
CAknIconArray* CWsfIconArrayCreator::CreateArrayL()
|
|
138 |
{
|
|
139 |
// Used bitmap file name
|
|
140 |
TFileName bitmapFileName;
|
|
141 |
bitmapFileName.Append( KDC_APP_BITMAP_DIR );
|
|
142 |
bitmapFileName.Append( KBitmapFile );
|
|
143 |
|
|
144 |
CAknIconArray* icons = new(ELeave) CAknIconArray(
|
|
145 |
KAIShortcutPluginGranularity );
|
|
146 |
|
|
147 |
CleanupStack::PushL( TCleanupItem( CleanUpResetAndDestroy,icons) );
|
|
148 |
|
|
149 |
//ESecureNetworkIcon
|
|
150 |
icons->InsertL( ESecureNetworkIcon, LoadSkinnableBlackIconLC(
|
|
151 |
KAknsIIDQgnIndiWlanSecureNetworkAdd,
|
|
152 |
EMbmWsficonsQgn_indi_wlan_secure_network_add,
|
|
153 |
bitmapFileName ) );
|
|
154 |
|
|
155 |
CleanupStack::Pop(); /*icon*/
|
|
156 |
|
|
157 |
//ENoSignalIcon
|
|
158 |
icons->InsertL( ENoSignalIcon, LoadIconLC(
|
|
159 |
EMbmWsficonsEmpty13x13,
|
|
160 |
bitmapFileName ) );
|
|
161 |
CleanupStack::Pop(); /*icon*/
|
|
162 |
|
|
163 |
//EPoorSignal
|
|
164 |
icons->InsertL( EPoorSignal, LoadSkinnableBlackIconLC(
|
|
165 |
KAknsIIDQgnIndiWlanSignalLowAdd,
|
|
166 |
EMbmWsficonsQgn_indi_wlan_signal_low_add,
|
|
167 |
bitmapFileName ) );
|
|
168 |
|
|
169 |
CleanupStack::Pop(); /*icon*/
|
|
170 |
|
|
171 |
//EAverageSignal
|
|
172 |
icons->InsertL( EAverageSignal, LoadSkinnableBlackIconLC(
|
|
173 |
KAknsIIDQgnIndiWlanSignalMedAdd,
|
|
174 |
EMbmWsficonsQgn_indi_wlan_signal_med_add,
|
|
175 |
bitmapFileName ) );
|
|
176 |
CleanupStack::Pop(); /*icon*/
|
|
177 |
|
|
178 |
//EExcelentSignal
|
|
179 |
icons->InsertL( EExcelentSignal, LoadSkinnableBlackIconLC(
|
|
180 |
KAknsIIDQgnIndiWlanSignalGoodAdd ,
|
|
181 |
EMbmWsficonsQgn_indi_wlan_signal_good_add,
|
|
182 |
bitmapFileName ) );
|
|
183 |
CleanupStack::Pop(); /*icon*/
|
|
184 |
|
|
185 |
//EConnectedNWIcon
|
|
186 |
icons->InsertL( EConnectedNWIcon,
|
|
187 |
LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn,
|
|
188 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on,
|
|
189 |
bitmapFileName ) );
|
|
190 |
|
|
191 |
CleanupStack::Pop(); /*icon*/
|
|
192 |
|
|
193 |
//EKnownNWIcon
|
|
194 |
icons->InsertL( EKnownNWIcon, LoadSkinnableIconLC(
|
|
195 |
KAknsIIDQgnIndiWlanSnifferPluginOn,
|
|
196 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on,
|
|
197 |
bitmapFileName ) );
|
|
198 |
CleanupStack::Pop(); /*icon*/
|
|
199 |
|
|
200 |
//ETransparentIcon
|
|
201 |
icons->InsertL( ETransparentIcon, LoadIconLC(
|
|
202 |
EMbmWsficonsQgn_prop_empty,
|
|
203 |
bitmapFileName ) );
|
|
204 |
CleanupStack::Pop(); /*icon*/
|
|
205 |
|
|
206 |
//EWlanOnIcon
|
|
207 |
icons->InsertL( EWlanOnIcon, LoadSkinnableIconLC(
|
|
208 |
KAknsIIDQgnIndiWlanSnifferPluginOn,
|
|
209 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on,
|
|
210 |
bitmapFileName ) );
|
|
211 |
CleanupStack::Pop(); /*icon*/
|
|
212 |
|
|
213 |
icons->InsertL( EWlanOnIcon_0, LoadSkinnableIconLC(
|
|
214 |
KAknsIIDQgnIndiWlanSnifferPluginOn0,
|
|
215 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0,
|
|
216 |
bitmapFileName ) );
|
|
217 |
CleanupStack::Pop(); /*icon*/
|
|
218 |
|
|
219 |
icons->InsertL( EWlanOnIcon_1, LoadSkinnableIconLC(
|
|
220 |
KAknsIIDQgnIndiWlanSnifferPluginOn1,
|
|
221 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1,
|
|
222 |
bitmapFileName ) );
|
|
223 |
CleanupStack::Pop(); /*icon*/
|
|
224 |
|
|
225 |
//ETransparentIcon
|
|
226 |
icons->InsertL( EWlanOffIcon, LoadSkinnableIconLC(
|
|
227 |
KAknsIIDQgnIndiWlanSnifferPluginOff,
|
|
228 |
EMbmWsficonsQgn_indi_wlan_sniffer_plugin_off,
|
|
229 |
bitmapFileName ) );
|
|
230 |
CleanupStack::Pop();
|
|
231 |
|
|
232 |
icons->InsertL( EWlanNaviBarIcon, LoadSkinnableIconLC(
|
|
233 |
KAknsIIDQgnMenuWlanSniffer,
|
|
234 |
EMbmWsficonsQgn_menu_wlan_sniffer,
|
|
235 |
bitmapFileName ) );
|
|
236 |
|
|
237 |
CleanupStack::Pop(); /*icon*/
|
|
238 |
CleanupStack::Pop( icons );
|
|
239 |
|
|
240 |
return icons;
|
|
241 |
}
|
|
242 |
|
|
243 |
// --------------------------------------------------------------------------
|
|
244 |
// CWsfIconArrayCreator::GetIconLC
|
|
245 |
// --------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
CGulIcon* CWsfIconArrayCreator::GetIconLC( TInt aIconId )
|
|
248 |
{
|
|
249 |
// Used bitmap file name
|
|
250 |
TFileName bitmapFileName;
|
|
251 |
bitmapFileName.Append( KDC_APP_BITMAP_DIR );
|
|
252 |
bitmapFileName.Append( KBitmapFile );
|
|
253 |
TAknsItemID localAknItemId( KAknsIIDQgnMenuWlanSniffer );
|
|
254 |
TInt iconId( EMbmWsficonsQgn_menu_wlan_sniffer );
|
|
255 |
|
|
256 |
switch( aIconId )
|
|
257 |
{
|
|
258 |
case ESecureNetworkIcon:
|
|
259 |
{
|
|
260 |
localAknItemId = KAknsIIDQgnIndiWlanSecureNetworkAdd;
|
|
261 |
iconId = EMbmWsficonsQgn_indi_wlan_secure_network_add;
|
|
262 |
break;
|
|
263 |
}
|
|
264 |
|
|
265 |
case ENoSignalIcon:
|
|
266 |
return LoadIconLC( EMbmWsficonsEmpty13x13, bitmapFileName );
|
|
267 |
|
|
268 |
case EPoorSignal:
|
|
269 |
{
|
|
270 |
localAknItemId = KAknsIIDQgnIndiWlanSignalLowAdd;
|
|
271 |
iconId = EMbmWsficonsQgn_indi_wlan_signal_low_add;
|
|
272 |
break;
|
|
273 |
}
|
|
274 |
|
|
275 |
case EAverageSignal:
|
|
276 |
{
|
|
277 |
localAknItemId = KAknsIIDQgnIndiWlanSignalMedAdd;
|
|
278 |
iconId = EMbmWsficonsQgn_indi_wlan_signal_med_add;
|
|
279 |
break;
|
|
280 |
}
|
|
281 |
|
|
282 |
case EExcelentSignal:
|
|
283 |
{
|
|
284 |
localAknItemId = KAknsIIDQgnIndiWlanSignalGoodAdd;
|
|
285 |
iconId = EMbmWsficonsQgn_indi_wlan_signal_good_add;
|
|
286 |
break;
|
|
287 |
}
|
|
288 |
|
|
289 |
case EConnectedNWIcon:
|
|
290 |
{
|
|
291 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn;
|
|
292 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on;
|
|
293 |
break;
|
|
294 |
}
|
|
295 |
|
|
296 |
case EKnownNWIcon:
|
|
297 |
{
|
|
298 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn;
|
|
299 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on;
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
|
|
303 |
case ETransparentIcon:
|
|
304 |
return LoadIconLC( EMbmWsficonsQgn_prop_empty, bitmapFileName );
|
|
305 |
|
|
306 |
case EWlanOnIcon:
|
|
307 |
{
|
|
308 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn;
|
|
309 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on;
|
|
310 |
break;
|
|
311 |
}
|
|
312 |
|
|
313 |
case EWlanOnIcon_0:
|
|
314 |
{
|
|
315 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn0;
|
|
316 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0;
|
|
317 |
break;
|
|
318 |
}
|
|
319 |
|
|
320 |
case EWlanOnIcon_1:
|
|
321 |
{
|
|
322 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOn1;
|
|
323 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1;
|
|
324 |
break;
|
|
325 |
}
|
|
326 |
|
|
327 |
case EWlanOffIcon:
|
|
328 |
{
|
|
329 |
localAknItemId = KAknsIIDQgnIndiWlanSnifferPluginOff;
|
|
330 |
iconId = EMbmWsficonsQgn_indi_wlan_sniffer_plugin_off;
|
|
331 |
break;
|
|
332 |
}
|
|
333 |
|
|
334 |
case EWlanNaviBarIcon:
|
|
335 |
{
|
|
336 |
localAknItemId = KAknsIIDQgnMenuWlanSniffer;
|
|
337 |
iconId = EMbmWsficonsQgn_menu_wlan_sniffer;
|
|
338 |
break;
|
|
339 |
}
|
|
340 |
default:
|
|
341 |
{
|
|
342 |
_ASS_D( 0 );
|
|
343 |
}
|
|
344 |
}
|
|
345 |
|
|
346 |
switch( aIconId )
|
|
347 |
{
|
|
348 |
case ESecureNetworkIcon:
|
|
349 |
case EPoorSignal:
|
|
350 |
case EAverageSignal:
|
|
351 |
case EExcelentSignal:
|
|
352 |
{
|
|
353 |
return LoadSkinnableBlackIconLC( localAknItemId,
|
|
354 |
iconId,
|
|
355 |
bitmapFileName );
|
|
356 |
}
|
|
357 |
default:
|
|
358 |
{
|
|
359 |
break;
|
|
360 |
}
|
|
361 |
}
|
|
362 |
return LoadSkinnableIconLC( localAknItemId,
|
|
363 |
iconId,
|
|
364 |
bitmapFileName );
|
|
365 |
}
|
|
366 |
|