author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:43:49 +0300 | |
branch | RCL_3 |
changeset 72 | 4b59561a31c0 |
parent 61 | 269724087bed |
permissions | -rw-r--r-- |
56 | 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: This is the implementation of device list container. It contains |
|
15 |
* all necessary AVKON components and handles user inputs |
|
16 |
* for paired and blocked devices view. |
|
17 |
* |
|
18 |
*/ |
|
19 |
||
20 |
||
21 |
#include <btui.mbg> // Compiled resource ids |
|
22 |
#include <BtuiViewResources.rsg> |
|
23 |
#include <AknsUtils.h> // For Extended skinning icons |
|
24 |
#include <gulicon.h> |
|
25 |
#include <AknUtils.h> // For char filter |
|
26 |
#include <aknlists.h> |
|
27 |
#include <avkon.mbg> // AVKON icons |
|
28 |
#include <csxhelp/bt.hlp.hrh> // Help IDs |
|
29 |
||
30 |
#include "BTUIDeviceContainer.h" |
|
31 |
#include "BTUIListedDevicesView.h" |
|
32 |
#include "debug.h" |
|
33 |
#include "btui.h" // Global declarations |
|
34 |
||
35 |
const TInt KBTNumberOfIcons = 14; // Number of class of device icons + extra one DEV_STATUS_AUTHORIZED |
|
36 |
||
37 |
_LIT( DEV_TYPE_COMPUTER,"0\t"); |
|
38 |
_LIT( DEV_TYPE_PHONE,"1\t"); |
|
39 |
_LIT( DEV_TYPE_AUDIO,"2\t"); |
|
40 |
_LIT( DEV_TYPE_DEFAULT,"3\t"); |
|
41 |
_LIT( DEV_TYPE_KEYBOARD,"4\t"); |
|
42 |
_LIT( DEV_TYPE_MOUSE,"5\t"); |
|
43 |
_LIT( DEV_TYPE_PRINTER,"6\t"); |
|
44 |
_LIT( DEV_TYPE_CARKIT,"7\t"); |
|
45 |
_LIT( DEV_TYPE_AUDIO_CONNECT,"8\t"); |
|
46 |
_LIT( DEV_TYPE_COMPUTER_CONNECT,"9\t"); |
|
47 |
_LIT( DEV_TYPE_KEYBOARD_CONNECT,"10\t"); |
|
48 |
_LIT( DEV_TYPE_CARKIT_CONNECT,"11\t"); |
|
49 |
_LIT( DEV_TYPE_MOUSE_CONNECT,"12\t"); |
|
50 |
||
51 |
_LIT(DEV_STATUS_NORMAL, "\t" ); // blocked in blocked devices view, paired in pairred devices view |
|
52 |
_LIT(DEV_STATUS_AUTHORIZED, "\t13" ); // autorized in paired devices view |
|
53 |
||
54 |
||
55 |
||
56 |
// ================= MEMBER FUNCTIONS ======================= |
|
57 |
||
58 |
// --------------------------------------------------------- |
|
59 |
// CBTUiDeviceContainer::ConstructL |
|
60 |
// --------------------------------------------------------- |
|
61 |
void CBTUiDeviceContainer::ConstructL(const TRect& aRect, |
|
62 |
CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup) |
|
63 |
{ |
|
64 |
TRACE_FUNC_ENTRY |
|
65 |
||
66 |
CreateWindowL(); |
|
67 |
||
68 |
iView = aView; |
|
69 |
iGroup = aGroup; |
|
70 |
// Create new list for other paired bt-devices |
|
71 |
// |
|
72 |
iDeviceList = new (ELeave) CAknSingleGraphicStyleListBox; |
|
73 |
iDeviceList->SetContainerWindowL(*this); |
|
74 |
iDeviceList->ConstructL(this, EAknListBoxSelectionList); |
|
75 |
||
76 |
iDeviceList->SetListBoxObserver( this ); |
|
77 |
||
78 |
// Set the empty text at basis of the list |
|
79 |
iDeviceList->View()->SetListEmptyTextL( KNullDesC ); |
|
80 |
||
81 |
// Set up filenames for Btui and Avkon bitmaps |
|
82 |
TFileName bmpFilename; |
|
83 |
bmpFilename += KBitmapFileDrive; |
|
84 |
bmpFilename += KDC_APP_BITMAP_DIR; |
|
85 |
bmpFilename += KBtuiBmpFileName; |
|
86 |
||
87 |
// The avkon bitmap we will get from AknIconUtils::AvkonIconFileName() |
|
88 |
TFileName avkonbmpFilename = AknIconUtils::AvkonIconFileName(); |
|
89 |
||
90 |
// Setup graphic items list for BT devices listbox |
|
91 |
CAknIconArray* iconList = new(ELeave) CAknIconArray(KBTNumberOfIcons); |
|
92 |
CleanupStack::PushL( iconList ); |
|
93 |
||
94 |
||
95 |
CreateAndAppendIconL( KAknsIIDQgnPropBtComputer, |
|
96 |
avkonbmpFilename, |
|
97 |
EMbmAvkonQgn_prop_bt_computer, |
|
98 |
EMbmAvkonQgn_prop_bt_computer_mask, |
|
99 |
iconList); |
|
100 |
||
101 |
CreateAndAppendIconL( KAknsIIDQgnPropBtPhone, |
|
102 |
avkonbmpFilename, |
|
103 |
EMbmAvkonQgn_prop_bt_phone, |
|
104 |
EMbmAvkonQgn_prop_bt_phone_mask, |
|
105 |
iconList); |
|
106 |
||
107 |
CreateAndAppendIconL( KAknsIIDQgnPropBtAudio, |
|
108 |
avkonbmpFilename, |
|
109 |
EMbmAvkonQgn_prop_bt_audio, |
|
110 |
EMbmAvkonQgn_prop_bt_audio_mask, |
|
111 |
iconList); |
|
112 |
||
113 |
CreateAndAppendIconL( KAknsIIDQgnPropBtMisc, |
|
114 |
avkonbmpFilename, |
|
115 |
EMbmAvkonQgn_prop_bt_misc, |
|
116 |
EMbmAvkonQgn_prop_bt_misc_mask, |
|
117 |
iconList); |
|
118 |
||
119 |
CreateAndAppendIconL( KAknsIIDQgnPropBtKeyboard, |
|
120 |
avkonbmpFilename, |
|
121 |
EMbmAvkonQgn_prop_bt_keyboard, |
|
122 |
EMbmAvkonQgn_prop_bt_keyboard_mask, |
|
123 |
iconList); |
|
124 |
||
125 |
CreateAndAppendIconL( KAknsIIDQgnPropBtMouse, |
|
126 |
avkonbmpFilename, |
|
127 |
EMbmAvkonQgn_prop_bt_mouse, |
|
128 |
EMbmAvkonQgn_prop_bt_mouse_mask, |
|
129 |
iconList); |
|
130 |
||
131 |
CreateAndAppendIconL( KAknsIIDQgnPropBtPrinter, |
|
132 |
avkonbmpFilename, |
|
133 |
EMbmAvkonQgn_prop_bt_printer, |
|
134 |
EMbmAvkonQgn_prop_bt_printer_mask, |
|
135 |
iconList); |
|
136 |
||
137 |
CreateAndAppendIconL( KAknsIIDQgnPropBtCarKit, |
|
138 |
avkonbmpFilename, |
|
139 |
EMbmAvkonQgn_prop_bt_carkit, |
|
140 |
EMbmAvkonQgn_prop_bt_carkit_mask, |
|
141 |
iconList); |
|
142 |
||
143 |
CreateAndAppendIconL( KAknsIIDQgnPropBtAudioConnect, |
|
144 |
bmpFilename, |
|
145 |
EMbmBtuiQgn_prop_bt_audio_connect, |
|
146 |
EMbmBtuiQgn_prop_bt_audio_connect_mask, |
|
147 |
iconList); |
|
148 |
||
149 |
CreateAndAppendIconL( KAknsIIDQgnPropBtComputerConnect, |
|
150 |
bmpFilename, |
|
151 |
EMbmBtuiQgn_prop_bt_computer_connect, |
|
152 |
EMbmBtuiQgn_prop_bt_computer_connect_mask, |
|
153 |
iconList); |
|
154 |
||
155 |
CreateAndAppendIconL( KAknsIIDQgnPropBtKeyboardConnect, |
|
156 |
bmpFilename, |
|
157 |
EMbmBtuiQgn_prop_bt_keyboard_connect, |
|
158 |
EMbmBtuiQgn_prop_bt_keyboard_connect_mask, |
|
159 |
iconList); |
|
160 |
||
161 |
CreateAndAppendIconL( KAknsIIDQgnPropBtCarKitConnect, |
|
162 |
bmpFilename, |
|
163 |
EMbmBtuiQgn_prop_bt_car_kit_connect, |
|
164 |
EMbmBtuiQgn_prop_bt_car_kit_connect_mask, |
|
165 |
iconList); |
|
166 |
||
167 |
CreateAndAppendIconL( KAknsIIDQgnPropBtMouseConnect, |
|
168 |
bmpFilename, |
|
169 |
EMbmBtuiQgn_prop_bt_mouse_connect, |
|
170 |
EMbmBtuiQgn_prop_bt_mouse_connect_mask, |
|
171 |
iconList); |
|
172 |
||
173 |
CFbsBitmap* bitmap = NULL; |
|
174 |
CFbsBitmap* mask = NULL; |
|
175 |
AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), |
|
176 |
KAknsIIDQgnIndiBtTrustedAdd, |
|
177 |
KAknsIIDQsnIconColors, |
|
178 |
EAknsCIQsnIconColorsCG13, |
|
179 |
bitmap, mask, |
|
180 |
avkonbmpFilename, |
|
181 |
EMbmAvkonQgn_indi_bt_trusted_add, |
|
182 |
EMbmAvkonQgn_indi_bt_trusted_add_mask, |
|
183 |
KRgbBlack); |
|
184 |
CGulIcon* icon = CGulIcon::NewL(bitmap, mask); |
|
185 |
||
186 |
CleanupStack::Pop(mask); |
|
187 |
CleanupStack::Pop(bitmap); |
|
188 |
||
189 |
CleanupStack::PushL(icon); |
|
190 |
iconList->AppendL( icon ); |
|
191 |
CleanupStack::Pop(icon); |
|
192 |
||
193 |
||
194 |
// Transfer iconlist ownership to the listbox |
|
195 |
iDeviceList->ItemDrawer()->ColumnData()->SetIconArray(iconList); |
|
196 |
CleanupStack::Pop(iconList); |
|
197 |
||
198 |
// Create scrollbars |
|
199 |
iDeviceList->CreateScrollBarFrameL(ETrue); |
|
200 |
iDeviceList->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
201 |
CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); |
|
202 |
||
203 |
SetRect(aRect); |
|
204 |
ActivateL(); |
|
205 |
||
206 |
TRACE_FUNC_EXIT |
|
207 |
} |
|
208 |
||
209 |
// --------------------------------------------------------- |
|
210 |
// CBTUiDeviceContainer::NewL |
|
211 |
// --------------------------------------------------------- |
|
212 |
CBTUiDeviceContainer* CBTUiDeviceContainer::NewL(const TRect& aRect, |
|
213 |
CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup, MObjectProvider* aParent) |
|
214 |
{ |
|
215 |
CBTUiDeviceContainer* self = new (ELeave) CBTUiDeviceContainer(); |
|
216 |
self->SetMopParent(aParent); |
|
217 |
CleanupStack::PushL(self); |
|
218 |
self->ConstructL(aRect, aView, aGroup); |
|
219 |
CleanupStack::Pop(self); |
|
220 |
return self; |
|
221 |
} |
|
222 |
// --------------------------------------------------------- |
|
223 |
// destructor |
|
224 |
// --------------------------------------------------------- |
|
225 |
||
226 |
CBTUiDeviceContainer::~CBTUiDeviceContainer() |
|
227 |
{ |
|
228 |
TRACE_FUNC_ENTRY |
|
229 |
delete iDeviceList; |
|
230 |
TRACE_FUNC_EXIT |
|
231 |
} |
|
232 |
||
233 |
// --------------------------------------------------------- |
|
234 |
// CBTUiDeviceContainer::RefreshDeviceListL |
|
235 |
// This function will refresh only the changed parts of the |
|
236 |
// screen, if any. |
|
237 |
// --------------------------------------------------------- |
|
238 |
void CBTUiDeviceContainer::RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt selectedItem) |
|
239 |
{ |
|
240 |
TRACE_FUNC_ENTRY |
|
241 |
||
242 |
MDesCArray* itemTextArray = iDeviceList->Model()->ItemTextArray(); |
|
243 |
CDesCArray* itemArray = (CDesCArray*) itemTextArray; |
|
244 |
TBool removal=EFalse; |
|
245 |
TBool addition=EFalse; |
|
246 |
TInt previouslySelected=CurrentItemIndex(); |
|
247 |
TBTDeviceName listItem; |
|
248 |
TInt deviceCount = aDeviceArray->Count(); |
|
249 |
TInt i = 0; |
|
250 |
for( ; i < deviceCount; i++) |
|
251 |
{ |
|
252 |
TBTDevice device = *(*aDeviceArray)[i]; |
|
253 |
CreateListItemL(device, listItem); |
|
254 |
if(itemArray->Count()<=i) |
|
255 |
{ |
|
256 |
itemArray->AppendL(listItem); |
|
257 |
addition=ETrue; |
|
258 |
} |
|
259 |
else |
|
260 |
if(listItem != (*itemArray)[i] ) |
|
261 |
{ |
|
262 |
itemArray->Delete(i); |
|
263 |
itemArray->InsertL(i,listItem); |
|
264 |
||
265 |
removal=ETrue; |
|
266 |
addition=ETrue; |
|
267 |
} |
|
268 |
||
269 |
} |
|
270 |
if(itemArray->Count()-i>=0) |
|
271 |
{ |
|
272 |
itemArray->Delete(i,itemArray->Count()-i); |
|
273 |
removal=ETrue; |
|
274 |
} |
|
275 |
||
276 |
||
277 |
if(removal) |
|
278 |
iDeviceList->HandleItemRemovalL(); |
|
279 |
if(addition) |
|
280 |
iDeviceList->HandleItemAdditionL(); |
|
281 |
||
282 |
if(deviceCount >0 ) |
|
283 |
iDeviceList->SetCurrentItemIndex( Max(selectedItem,0 )) ; |
|
284 |
else |
|
285 |
{ |
|
286 |
HBufC* devEmptyText = NULL; |
|
287 |
if(iGroup ==EGroupPaired) |
|
288 |
{ |
|
289 |
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_PAIRED_DEVICES); |
|
290 |
} |
|
291 |
else |
|
292 |
{ |
|
293 |
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_BLOCKED_DEVICES); |
|
294 |
} |
|
295 |
iDeviceList->View()->SetListEmptyTextL(*devEmptyText ); |
|
296 |
CleanupStack::PopAndDestroy(devEmptyText); |
|
297 |
} |
|
298 |
||
299 |
if(addition | removal | previouslySelected!=selectedItem) |
|
300 |
iDeviceList->DrawDeferred(); |
|
301 |
TRACE_FUNC_EXIT |
|
302 |
} |
|
303 |
||
304 |
// --------------------------------------------------------- |
|
305 |
// CBTUiDeviceContainer::CountItems |
|
306 |
// --------------------------------------------------------- |
|
307 |
TInt CBTUiDeviceContainer::CountItems() |
|
308 |
{ |
|
309 |
return iDeviceList->Model()->ItemTextArray()->MdcaCount(); |
|
310 |
} |
|
311 |
||
312 |
// --------------------------------------------------------- |
|
313 |
// CBTUiDeviceContainer::CreateListItemL |
|
314 |
// --------------------------------------------------------- |
|
315 |
void CBTUiDeviceContainer::CreateListItemL(const TBTDevice& aDevice, TBTDeviceName& aListItem) |
|
316 |
{ |
|
317 |
TRACE_FUNC_ENTRY |
|
318 |
aListItem.Zero(); // may not needed |
|
319 |
||
320 |
TInt iconIndex = (TInt)(aDevice.iType); |
|
321 |
||
322 |
switch( iconIndex) |
|
323 |
{ |
|
324 |
case EDeviceComputer: |
|
325 |
if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) |
|
326 |
{ |
|
327 |
aListItem.Append(DEV_TYPE_COMPUTER_CONNECT); |
|
328 |
} |
|
329 |
else |
|
330 |
{ |
|
331 |
aListItem.Append(DEV_TYPE_COMPUTER); |
|
332 |
} |
|
333 |
break; |
|
334 |
||
335 |
case EDevicePhone: |
|
336 |
aListItem.Append(DEV_TYPE_PHONE); |
|
337 |
break; |
|
338 |
||
339 |
case EDeviceAudio: |
|
340 |
if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) |
|
341 |
{ |
|
342 |
aListItem.Append(DEV_TYPE_AUDIO_CONNECT); |
|
343 |
} |
|
344 |
else |
|
345 |
{ |
|
346 |
aListItem.Append(DEV_TYPE_AUDIO); |
|
347 |
} |
|
348 |
break ; |
|
349 |
case EDeviceCarkit: |
|
350 |
if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) |
|
351 |
{ |
|
352 |
aListItem.Append(DEV_TYPE_CARKIT_CONNECT); |
|
353 |
} |
|
354 |
else |
|
355 |
{ |
|
356 |
aListItem.Append(DEV_TYPE_CARKIT); |
|
357 |
} |
|
358 |
break ; |
|
359 |
||
360 |
case EDevicePrinter: |
|
361 |
aListItem.Append(DEV_TYPE_PRINTER); |
|
362 |
break; |
|
363 |
||
364 |
case EDeviceKeyboard: |
|
365 |
||
366 |
if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) |
|
367 |
{ |
|
368 |
aListItem.Append(DEV_TYPE_KEYBOARD_CONNECT); |
|
369 |
} |
|
370 |
else |
|
371 |
{ |
|
372 |
aListItem.Append(DEV_TYPE_KEYBOARD); |
|
373 |
} |
|
374 |
break ; |
|
375 |
||
376 |
case EDeviceMice: |
|
377 |
||
378 |
if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) |
|
379 |
{ |
|
380 |
aListItem.Append(DEV_TYPE_MOUSE_CONNECT); |
|
381 |
} |
|
382 |
else |
|
383 |
{ |
|
384 |
aListItem.Append(DEV_TYPE_MOUSE); |
|
385 |
} |
|
386 |
break; |
|
387 |
||
388 |
case EDeviceDefault: |
|
389 |
aListItem.Append(DEV_TYPE_DEFAULT); |
|
390 |
break; |
|
391 |
||
392 |
default: |
|
393 |
aListItem.Append('\t'); |
|
394 |
break; |
|
395 |
} |
|
396 |
||
397 |
aListItem.Append(aDevice.iName); |
|
398 |
||
399 |
if((aDevice.iStatus & EStatusTrusted) == EStatusTrusted && iGroup ==EGroupPaired ) |
|
400 |
{ |
|
401 |
aListItem.Append(DEV_STATUS_AUTHORIZED); |
|
402 |
} |
|
403 |
else |
|
404 |
{ |
|
405 |
aListItem.Append( DEV_STATUS_NORMAL ); |
|
406 |
} |
|
407 |
TRACE_FUNC_EXIT |
|
408 |
} |
|
409 |
||
410 |
||
411 |
// --------------------------------------------------------- |
|
412 |
// From CCoeControl |
|
413 |
// CBTUiDeviceContainer::OfferKeyEventL |
|
414 |
// --------------------------------------------------------- |
|
415 |
TKeyResponse CBTUiDeviceContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
416 |
TEventCode aType) |
|
417 |
{ |
|
418 |
TRACE_FUNC_ENTRY |
|
419 |
// Inform model where we are now |
|
420 |
TInt bItemIndex = CurrentItemIndex(); |
|
421 |
||
422 |
// Shortcut for deleting a device |
|
423 |
if ((aKeyEvent.iCode == EKeyBackspace) && (bItemIndex >= 0)) |
|
424 |
{ |
|
425 |
iView->HandleCommandL( EBTUICmdDelete ); |
|
426 |
return EKeyWasConsumed; |
|
427 |
} |
|
428 |
||
72
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
429 |
// Show popup commands window if selection or enter key is pressed. |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
430 |
// It should not go to here, unless | EAknEnableMSK is not set |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
431 |
if ((aKeyEvent.iCode == EKeyDevice3) || (aKeyEvent.iCode == EKeyEnter)) |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
432 |
{ |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
433 |
iView->ProcessCommandL(EAknSoftkeyContextOptions); |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
434 |
return EKeyWasConsumed; |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
435 |
} |
4b59561a31c0
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
61
diff
changeset
|
436 |
|
56 | 437 |
if ((aKeyEvent.iCode != EKeyLeftArrow) && |
438 |
(aKeyEvent.iCode != EKeyRightArrow)) |
|
439 |
{ |
|
440 |
TRACE_FUNC_EXIT |
|
441 |
return iDeviceList->OfferKeyEventL(aKeyEvent, aType); |
|
442 |
} |
|
443 |
else |
|
444 |
{ |
|
445 |
// BTRegistry operations are not done in atomic way |
|
446 |
// so we cannot allow them to be interrupted |
|
447 |
if(iView->DeviceChangeInProgress()) |
|
448 |
return EKeyWasConsumed; |
|
449 |
||
450 |
TRACE_FUNC_EXIT |
|
451 |
return EKeyWasNotConsumed; |
|
452 |
} |
|
453 |
} |
|
454 |
||
455 |
// ---------------------------------------------------- |
|
456 |
// CBTUiDeviceContainer::CreateAndAppendIconL |
|
457 |
// ---------------------------------------------------- |
|
458 |
void CBTUiDeviceContainer::CreateAndAppendIconL( |
|
459 |
const TAknsItemID& aID, |
|
460 |
const TDesC& aFileName, |
|
461 |
const TInt aBitmapId, |
|
462 |
const TInt aMaskId, |
|
463 |
CAknIconArray* aIconList) |
|
464 |
{ |
|
465 |
TRACE_FUNC_ENTRY |
|
466 |
||
467 |
CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), |
|
468 |
aID, aFileName, aBitmapId, aMaskId); |
|
469 |
||
470 |
CleanupStack::PushL(icon); |
|
471 |
aIconList->AppendL(icon); |
|
472 |
CleanupStack::Pop(icon); |
|
473 |
} |
|
474 |
||
475 |
// --------------------------------------------------------- |
|
476 |
// From CCoeControl |
|
477 |
// CBTUiDeviceContainer::GetHelpContext |
|
478 |
// --------------------------------------------------------- |
|
479 |
void CBTUiDeviceContainer::GetHelpContext(TCoeHelpContext& aContext) const |
|
480 |
{ |
|
481 |
TRACE_FUNC_ENTRY |
|
482 |
#ifdef __SERIES60_HELP |
|
483 |
||
484 |
aContext.iMajor = KBtuiUid3; |
|
485 |
if( iGroup ==EGroupPaired) |
|
486 |
aContext.iContext = KBT_HLP_PAIRED; |
|
487 |
else |
|
488 |
aContext.iContext = KBT_HLP_BLOCKED ; |
|
489 |
#else |
|
490 |
#endif |
|
491 |
} |
|
492 |
||
493 |
// --------------------------------------------------------- |
|
494 |
// From CCoeControl |
|
495 |
// CBTUiDeviceContainer::SizeChanged |
|
496 |
// Called by framework when the view size is changed |
|
497 |
// --------------------------------------------------------- |
|
498 |
void CBTUiDeviceContainer::SizeChanged() |
|
499 |
{ |
|
500 |
TRACE_FUNC_ENTRY |
|
501 |
iDeviceList->SetRect(Rect()); // Mandatory, otherwise not drawn |
|
502 |
} |
|
503 |
||
504 |
// --------------------------------------------------------- |
|
505 |
// From CCoeControl |
|
506 |
// CBTUiDeviceContainer::CountComponentControls |
|
507 |
// --------------------------------------------------------- |
|
508 |
TInt CBTUiDeviceContainer::CountComponentControls() const |
|
509 |
{ |
|
510 |
TRACE_FUNC_ENTRY |
|
511 |
// return number of controls inside this container |
|
512 |
return 1; |
|
513 |
} |
|
514 |
||
515 |
// --------------------------------------------------------- |
|
516 |
// From CCoeControl |
|
517 |
// CBTUiDeviceContainer::ComponentControl |
|
518 |
// --------------------------------------------------------- |
|
519 |
CCoeControl* CBTUiDeviceContainer::ComponentControl(TInt aIndex) const |
|
520 |
{ |
|
521 |
TRACE_FUNC_ENTRY |
|
522 |
if(aIndex == 0) |
|
523 |
{ |
|
524 |
return iDeviceList ; |
|
525 |
} |
|
526 |
else |
|
527 |
{ |
|
528 |
return NULL; |
|
529 |
} |
|
530 |
} |
|
531 |
||
532 |
// ---------------------------------------------------- |
|
533 |
// CBTUiDeviceContainer::CurrentItemIndex |
|
534 |
// ---------------------------------------------------- |
|
535 |
TInt CBTUiDeviceContainer::CurrentItemIndex() |
|
536 |
{ |
|
537 |
TRACE_FUNC_ENTRY |
|
538 |
||
539 |
return iDeviceList->CurrentItemIndex(); |
|
540 |
} |
|
541 |
||
542 |
// --------------------------------------------------------- |
|
543 |
// From CCoeControl |
|
544 |
// CBTUiDeviceContainer::Draw |
|
545 |
// --------------------------------------------------------- |
|
546 |
void CBTUiDeviceContainer::Draw( const TRect& /* aRect */ ) const |
|
547 |
{ |
|
548 |
} |
|
549 |
||
550 |
// --------------------------------------------------------- |
|
551 |
// From MCoeControlObserver |
|
552 |
// CBTUiDeviceContainer::HandleControlEventL |
|
553 |
// --------------------------------------------------------- |
|
554 |
void CBTUiDeviceContainer::HandleControlEventL( CCoeControl* /* aControl */, TCoeEvent /* aEventType */ ) |
|
555 |
{ |
|
556 |
TRACE_FUNC_ENTRY |
|
557 |
} |
|
558 |
||
559 |
// --------------------------------------------------------- |
|
560 |
// From CCoeControl |
|
561 |
// CBTUiDeviceContainer::HandleResourceChange |
|
562 |
// --------------------------------------------------------- |
|
563 |
void CBTUiDeviceContainer::HandleResourceChange( TInt aType ) |
|
564 |
{ |
|
565 |
TRACE_FUNC_ENTRY |
|
566 |
CCoeControl::HandleResourceChange(aType); |
|
567 |
TRAP_IGNORE(HandleResourceChangeL(aType)); |
|
568 |
TRACE_FUNC_EXIT |
|
569 |
} |
|
570 |
||
571 |
// --------------------------------------------------------- |
|
572 |
// Internal Leave function |
|
573 |
// CBTUiDeviceContainer::HandleResourceChangeL |
|
574 |
// --------------------------------------------------------- |
|
575 |
void CBTUiDeviceContainer::HandleResourceChangeL( TInt aType ) |
|
576 |
{ |
|
577 |
TRACE_FUNC_ENTRY |
|
578 |
||
579 |
//Handle change in layout orientation |
|
580 |
if (aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange ) |
|
581 |
{ |
|
582 |
TRect mainPaneRect; |
|
583 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
584 |
||
585 |
// Because the trailing icons are not changed properly after theme is changed. |
|
586 |
// we refresh those icons in the iconlist from iDeviceList manually. |
|
587 |
||
588 |
// Get iconlist from listbox |
|
589 |
CAknIconArray* iconList = static_cast<CAknIconArray*>(iDeviceList->ItemDrawer()->ColumnData()->IconArray()); |
|
590 |
||
591 |
CleanupStack::PushL( iconList ); |
|
592 |
// remove the last two icons which will not be updated properly by theme changing. |
|
593 |
iconList->Delete(KBTNumberOfIcons-1); |
|
594 |
||
595 |
// The avkon bitmap we will get from AknIconUtils::AvkonIconFileName() |
|
596 |
TFileName avkonbmpFilename = AknIconUtils::AvkonIconFileName(); |
|
597 |
||
598 |
||
599 |
||
600 |
CFbsBitmap* bitmap = NULL; |
|
601 |
CFbsBitmap* mask = NULL; |
|
602 |
AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), |
|
603 |
KAknsIIDQgnIndiBtTrustedAdd, |
|
604 |
KAknsIIDQsnIconColors, |
|
605 |
EAknsCIQsnIconColorsCG13, |
|
606 |
bitmap, mask, |
|
607 |
avkonbmpFilename, |
|
608 |
EMbmAvkonQgn_indi_bt_trusted_add, |
|
609 |
EMbmAvkonQgn_indi_bt_trusted_add_mask, |
|
610 |
KRgbBlack); |
|
611 |
||
612 |
||
613 |
CGulIcon* icon = CGulIcon::NewL(bitmap, mask); |
|
614 |
||
615 |
CleanupStack::Pop(2); // bitmap, mask; |
|
616 |
||
617 |
CleanupStack::PushL(icon); |
|
618 |
||
619 |
iconList->AppendL( icon ); |
|
620 |
CleanupStack::Pop(icon); |
|
621 |
||
622 |
||
623 |
// Transfer iconlist ownership back to the listbox |
|
624 |
iDeviceList->ItemDrawer()->ColumnData()->SetIconArray(iconList); |
|
625 |
CleanupStack::Pop(iconList); |
|
626 |
||
627 |
SetRect(mainPaneRect); |
|
628 |
DrawDeferred(); |
|
629 |
} |
|
630 |
TRACE_FUNC_EXIT |
|
631 |
} |
|
632 |
||
633 |
// --------------------------------------------------------- |
|
634 |
// From CCoeControl |
|
635 |
// CBTUiDeviceContainer::FocusChanged |
|
636 |
// --------------------------------------------------------- |
|
637 |
void CBTUiDeviceContainer::FocusChanged(TDrawNow /*aDrawNow*/) |
|
638 |
{ |
|
639 |
TRACE_FUNC_ENTRY |
|
640 |
iDeviceList->SetFocus(IsFocused()); |
|
641 |
TRACE_FUNC_EXIT |
|
642 |
} |
|
643 |
// --------------------------------------------------------- |
|
644 |
// From CCoeControl |
|
645 |
// CBTUiDeviceContainer::HandleListBoxEventL |
|
646 |
// |
|
647 |
// Handle touch screen singleclick as MSK devent to paired view or |
|
648 |
// as delete key event to blocked devices view. |
|
649 |
// --------------------------------------------------------- |
|
650 |
// |
|
651 |
void CBTUiDeviceContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) |
|
652 |
{ |
|
653 |
TRACE_FUNC_ENTRY |
|
654 |
// this is no longer called, unless MSK is disabled. |
|
655 |
// if msk is not disabled, then |
|
656 |
// BTMainView::HandleCommand(EBTUICmdMSK) is called instead |
|
657 |
if( aEventType == EEventEnterKeyPressed |
|
658 |
|| aEventType == EEventItemSingleClicked) // Selection key pressed, or item clicked |
|
659 |
{ |
|
660 |
// msk open context options in paired devices view. |
|
661 |
// it will unblock the selected blocked device in blocked devices view. |
|
662 |
if(iGroup==EGroupPaired) |
|
663 |
{ |
|
664 |
iView->ProcessCommandL( EAknSoftkeyContextOptions); |
|
665 |
} |
|
666 |
else |
|
667 |
{ |
|
668 |
iView->ProcessCommandL( EBTUICmdUnblock); |
|
669 |
} |
|
670 |
||
671 |
} |
|
672 |
TRACE_FUNC_EXIT |
|
673 |
} |