|
1 /* |
|
2 * Copyright (c) 2002 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: A utility that provides services to both the Speeddial and |
|
15 * PhoneBook applications for getting and setting speeddial |
|
16 * number configuration. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <bldvariant.hrh> |
|
23 #include <gulicon.h> |
|
24 #include <akncontext.h> |
|
25 #include <akntitle.h> |
|
26 #include <AknQueryDialog.h> |
|
27 #include <aknlists.h> |
|
28 #include <bautils.h> |
|
29 #include <aknnotedialog.h> |
|
30 #include <aknnotecontrol.h> |
|
31 #include <aknnotewrappers.h> |
|
32 #include <sysutil.h> |
|
33 #include <ErrorUI.h> |
|
34 #include <vmnumber.h> |
|
35 #include <centralrepository.h> |
|
36 #include <settingsinternalcrkeys.h> |
|
37 #include <SpeeddialPrivateCRKeys.h> |
|
38 #include <telvmbxsettingscrkeys.h> |
|
39 #include <voicemailboxdomaincrkeys.h> |
|
40 #include <CPbkContactEngine.h> // Phonebook Engine |
|
41 #include <CPbkContactItem.h> // Phonebook Contact |
|
42 #include <CPbkFieldInfo.h> // Phonebook Field |
|
43 #include <CPbkSingleItemFetchDlg.h> // Phonebook Single Entry Fetch API |
|
44 #include <CPbkContactChangeNotifier.h> |
|
45 #include <RPbkViewResourceFile.h> // Phonebook view dll resource file loader |
|
46 #include <StringLoader.h> |
|
47 #include <SpdCtrl.rsg> |
|
48 #include <spdctrl.mbg> |
|
49 #include <avkon.mbg> |
|
50 #include <gdi.h> |
|
51 #include <AknIconArray.h> |
|
52 #include <CPbkThumbnailManager.h> |
|
53 #include <aknlayoutscalable_apps.cdl.h> |
|
54 #include <layoutmetadata.cdl.h> |
|
55 #include <AknsBasicBackgroundControlContext.h> |
|
56 #include <AknsDrawUtils.h> |
|
57 #include <AknsUtils.h> |
|
58 #include <AknIconUtils.h> |
|
59 #include <applayout.cdl.h> |
|
60 #include <data_caging_path_literals.hrh> |
|
61 #include <f32file.h> |
|
62 #include <featmgr.h> |
|
63 #include "SpdiaGrid.h" |
|
64 #include "SpdiaGridDlg.h" |
|
65 #include "SpdiaIndexData.h" |
|
66 #include "SpdiaControl.h" |
|
67 #include "SpdiaControl.hrh" |
|
68 #include "Speeddial.laf" |
|
69 #include "SpdiaPanic.h" |
|
70 #include <settingsinternalcrkeys.h> |
|
71 #include "speeddial.hrh" |
|
72 |
|
73 #include <aknViewAppUi.h> |
|
74 #include <aknnavi.h> |
|
75 #include <aknnavide.h> |
|
76 |
|
77 // const TUint KShortcutKey0('0'); // not referenced |
|
78 const TInt KDialBmpCount = 9; |
|
79 const TInt KDialHindiBmpCount = 9; |
|
80 |
|
81 const TUint KDialBmp[KDialBmpCount] = |
|
82 { |
|
83 //EMbmSpdctrlQgn_graf_quick_one, |
|
84 #ifdef __SCALABLE_ICONS |
|
85 EMbmSpdctrlQgn_menu_smsvo, |
|
86 #else |
|
87 EMbmSpdctrlQgn_menu_smsvo_lst, |
|
88 #endif |
|
89 EMbmSpdctrlQgn_graf_quick_two, |
|
90 EMbmSpdctrlQgn_graf_quick_three, |
|
91 EMbmSpdctrlQgn_graf_quick_four, |
|
92 EMbmSpdctrlQgn_graf_quick_five, |
|
93 EMbmSpdctrlQgn_graf_quick_six, |
|
94 EMbmSpdctrlQgn_graf_quick_seven, |
|
95 EMbmSpdctrlQgn_graf_quick_eight, |
|
96 EMbmSpdctrlQgn_graf_quick_nine |
|
97 }; |
|
98 |
|
99 const TUint KDialBmpMask[KDialBmpCount] = |
|
100 { |
|
101 //EMbmSpdctrlQgn_graf_quick_one_mask_soft, |
|
102 #ifdef __SCALABLE_ICONS |
|
103 EMbmSpdctrlQgn_menu_smsvo_mask, |
|
104 #else |
|
105 EMbmSpdctrlQgn_menu_smsvo_lst_mask, |
|
106 #endif |
|
107 EMbmSpdctrlQgn_graf_quick_two_mask, |
|
108 EMbmSpdctrlQgn_graf_quick_three_mask, |
|
109 EMbmSpdctrlQgn_graf_quick_four_mask, |
|
110 EMbmSpdctrlQgn_graf_quick_five_mask, |
|
111 EMbmSpdctrlQgn_graf_quick_six_mask, |
|
112 EMbmSpdctrlQgn_graf_quick_seven_mask, |
|
113 EMbmSpdctrlQgn_graf_quick_eight_mask, |
|
114 EMbmSpdctrlQgn_graf_quick_nine_mask |
|
115 }; |
|
116 |
|
117 const TUint KDialHindiBmp[KDialHindiBmpCount] = |
|
118 { |
|
119 //EMbmSpdctrlQgn_graf_quick_one, |
|
120 #ifdef __SCALABLE_ICONS |
|
121 EMbmSpdctrlQgn_menu_smsvo, |
|
122 #else |
|
123 EMbmSpdctrlQgn_menu_smsvo_lst, |
|
124 #endif |
|
125 EMbmSpdctrlQgn_graf_deva_quick_two, |
|
126 EMbmSpdctrlQgn_graf_deva_quick_three, |
|
127 EMbmSpdctrlQgn_graf_deva_quick_four, |
|
128 EMbmSpdctrlQgn_graf_deva_quick_five, |
|
129 EMbmSpdctrlQgn_graf_deva_quick_six, |
|
130 EMbmSpdctrlQgn_graf_deva_quick_seven, |
|
131 EMbmSpdctrlQgn_graf_deva_quick_eight, |
|
132 EMbmSpdctrlQgn_graf_deva_quick_nine |
|
133 }; |
|
134 |
|
135 const TUint KDialHindiBmpMask[KDialHindiBmpCount] = |
|
136 { |
|
137 //EMbmSpdctrlQgn_graf_quick_one, |
|
138 #ifdef __SCALABLE_ICONS |
|
139 EMbmSpdctrlQgn_menu_smsvo_mask, |
|
140 #else |
|
141 EMbmSpdctrlQgn_menu_smsvo_lst_mask, |
|
142 #endif |
|
143 EMbmSpdctrlQgn_graf_deva_quick_two_mask, |
|
144 EMbmSpdctrlQgn_graf_deva_quick_three_mask, |
|
145 EMbmSpdctrlQgn_graf_deva_quick_four_mask, |
|
146 EMbmSpdctrlQgn_graf_deva_quick_five_mask, |
|
147 EMbmSpdctrlQgn_graf_deva_quick_six_mask, |
|
148 EMbmSpdctrlQgn_graf_deva_quick_seven_mask, |
|
149 EMbmSpdctrlQgn_graf_deva_quick_eight_mask, |
|
150 EMbmSpdctrlQgn_graf_deva_quick_nine_mask |
|
151 }; |
|
152 |
|
153 const TInt KCellRowCount(3); |
|
154 const TInt KCellColCount(3); |
|
155 const TInt KVoiceMail(0); |
|
156 const TInt KLayoutCount(5); |
|
157 const TInt KNullIndexData(-1); |
|
158 const TInt32 KVmbxUid(0x100058F5) ; |
|
159 const TInt KOperatorNameLength(100); |
|
160 const TInt KIconsCount(15); |
|
161 const TInt KIconsIdCount(15); |
|
162 const TInt KIconsMaskCount(15); |
|
163 |
|
164 _LIT(KNullCell, "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%d\t"); |
|
165 _LIT(KDesTab, "\t"); |
|
166 _LIT(KDesTab2, "\t\t"); |
|
167 |
|
168 /// Unnamed namespace for local definitions |
|
169 namespace { |
|
170 |
|
171 CPbkContactItem* OpenContactL( |
|
172 CPbkContactEngine* aEngine, |
|
173 TContactItemId aId ) |
|
174 { |
|
175 CPbkContactItem* item = NULL; |
|
176 TRAPD(err, item = aEngine->OpenContactL(aId)); |
|
177 if (err != KErrNone) |
|
178 { |
|
179 CCoeEnv::Static()->HandleError(err); |
|
180 } |
|
181 User::LeaveIfError(err); |
|
182 |
|
183 return item; |
|
184 } |
|
185 |
|
186 } /// namespace |
|
187 |
|
188 |
|
189 // --------------------------------------------------------- |
|
190 // E32Dll(TDllReason) |
|
191 // Entry point function for Symbian dll |
|
192 // Returns: KErrNone: No error |
|
193 // --------------------------------------------------------- |
|
194 // |
|
195 |
|
196 |
|
197 |
|
198 // ================= MEMBER FUNCTIONS ======================= |
|
199 |
|
200 // --------------------------------------------------------- |
|
201 // CSpdiaControl::NewL |
|
202 // |
|
203 // --------------------------------------------------------- |
|
204 // |
|
205 EXPORT_C CSpdiaControl* CSpdiaControl::NewL() |
|
206 { |
|
207 CSpdiaControl* self = new(ELeave) CSpdiaControl(); |
|
208 CleanupStack::PushL(self); |
|
209 self->ConstructL(); |
|
210 CleanupStack::Pop(); // self |
|
211 return self; |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------- |
|
215 // CSpdiaControl::NewL |
|
216 // |
|
217 // --------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C CSpdiaControl* CSpdiaControl::NewL(CPbkContactEngine& aPbkEngine) |
|
220 { |
|
221 CSpdiaControl* self = new(ELeave) CSpdiaControl(&aPbkEngine); |
|
222 CleanupStack::PushL(self); |
|
223 self->ConstructL(); |
|
224 CleanupStack::Pop(); // self |
|
225 return self; |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------- |
|
229 // CSpdiaControl::AssignDialNumberL |
|
230 // Function called when assigning a speed dial |
|
231 // from the Idle state. |
|
232 // --------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C TBool CSpdiaControl::AssignDialNumberL( |
|
235 TInt aLocation, CEikStatusPane* /*aStatusPane*/) |
|
236 { |
|
237 TBool result(EFalse); |
|
238 TInt index(Index(aLocation)); |
|
239 |
|
240 TInt vmbxSupport = 0; |
|
241 CRepository* vmbxSupported = CRepository::NewL( KCRUidVideoMailbox ); |
|
242 vmbxSupported->Get( KVideoMbxSupport, vmbxSupport ); |
|
243 delete vmbxSupported; |
|
244 |
|
245 TInt vmbxPos; |
|
246 CRepository* vmbxKey2 = CRepository::NewL( KCRUidTelVideoMailbox ); |
|
247 vmbxKey2->Get( KTelVideoMbxKey, vmbxPos ); |
|
248 delete vmbxKey2; |
|
249 TInt vdoIndex( Index( vmbxPos ) ); |
|
250 |
|
251 if ( index != VMBoxPosition() && |
|
252 ( !vmbxSupport || index != vdoIndex ) && |
|
253 ( aLocation > 0 && aLocation <= iSdmCount) ) |
|
254 { |
|
255 result = ETrue; |
|
256 if (ContactId(index) == KNullContactId) |
|
257 { |
|
258 // Assign it now? |
|
259 iQueryDialog = CAknQueryDialog::NewL(CAknQueryDialog::ENoTone); |
|
260 TBool resDialog(EFalse); |
|
261 TRAPD(error, |
|
262 resDialog = iQueryDialog->ExecuteLD(R_SPDIA_QUERY_ASSIGN) ); |
|
263 iQueryDialog = NULL; |
|
264 User::LeaveIfError(error); |
|
265 if (!resDialog) |
|
266 { |
|
267 result = EFalse; |
|
268 } |
|
269 } |
|
270 |
|
271 if (result) |
|
272 { |
|
273 iPopupDialog = ETrue; |
|
274 |
|
275 result = AssignDialIndexL(index); |
|
276 |
|
277 |
|
278 } |
|
279 iPopupDialog = EFalse; |
|
280 } |
|
281 return result; |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------- |
|
285 // CSpdiaControl::ExecuteLD |
|
286 // |
|
287 // --------------------------------------------------------- |
|
288 // |
|
289 EXPORT_C TInt CSpdiaControl::ExecuteLD( |
|
290 TContactItemId aId, TInt aFieldIdx) |
|
291 { |
|
292 // Live up to the "D" |
|
293 CleanupStack::PushL(this); |
|
294 |
|
295 // Check if the item is available now, otherwise leave happens |
|
296 // Open current contact now, in order to get the lock. |
|
297 CPbkContactItem* item = OpenContactL( iEngine, aId ); |
|
298 CleanupStack::PushL(item); |
|
299 |
|
300 // Create a CPbkFetchEntryDlg dialog |
|
301 TInt dial; |
|
302 iGridDlg = CSpdiaGridDlg::NewL(dial, *this); |
|
303 |
|
304 CEikAppUi* pAppUi = NULL; |
|
305 CAknNavigationDecorator *pNaviDecorator = NULL; |
|
306 CAknTitlePane* titlePane = NULL; |
|
307 HBufC* title = NULL; |
|
308 pAppUi = CEikonEnv::Static()->EikAppUi(); |
|
309 if ( pAppUi ) |
|
310 { |
|
311 CEikStatusPane* StatusPane = ((CAknAppUi*) pAppUi)->StatusPane(); |
|
312 TUid naviPaneUid; |
|
313 naviPaneUid.iUid = EEikStatusPaneUidNavi; |
|
314 CAknNavigationControlContainer*naviPane = (CAknNavigationControlContainer *) StatusPane->ControlL(naviPaneUid); |
|
315 pNaviDecorator = naviPane->Top(); |
|
316 if ( pNaviDecorator ) |
|
317 { |
|
318 pNaviDecorator->MakeVisible( EFalse ); |
|
319 pNaviDecorator->DrawNow(); |
|
320 } |
|
321 |
|
322 titlePane = STATIC_CAST(CAknTitlePane*, StatusPane->ControlL( TUid::Uid(EEikStatusPaneUidTitle) ) ); |
|
323 title = titlePane->Text()->AllocLC(); |
|
324 } |
|
325 |
|
326 // Execute the CPbkFetchEntryDlg dialog |
|
327 TInt result(ETrue); |
|
328 TRAPD(error, result = iGridDlg->ExecuteLD(R_SPDIA_GRID_DIALOG)); |
|
329 iGridDlg = NULL; |
|
330 iIconArray = NULL; |
|
331 |
|
332 if ( pNaviDecorator ) |
|
333 { |
|
334 pNaviDecorator->MakeVisible( ETrue ); |
|
335 pNaviDecorator->DrawNow(); |
|
336 } |
|
337 if ( title ) |
|
338 { |
|
339 titlePane->SetText( title ); |
|
340 CleanupStack::Pop(); // title |
|
341 titlePane->DrawNow(); |
|
342 } |
|
343 if ( pAppUi ) |
|
344 { |
|
345 CEikStatusPane* StatusPane = ( ( CAknAppUi* ) pAppUi )->StatusPane(); |
|
346 StatusPane->MakeVisible( ETrue ); |
|
347 StatusPane->DrawNow(); |
|
348 } |
|
349 |
|
350 // Check errors |
|
351 User::LeaveIfError(error); |
|
352 |
|
353 // unlock the item( contact ) so that it can be removed or assigend after back from speedial grid |
|
354 // delete item; |
|
355 iEngine->CloseContactL(aId); |
|
356 CleanupStack::PopAndDestroy(); // item |
|
357 |
|
358 if (result && !CheckSpaceBelowCriticalLevelL()) |
|
359 { |
|
360 AssignDialL(aId, aFieldIdx, dial); |
|
361 } |
|
362 |
|
363 // Cleanup and return |
|
364 CleanupStack::PopAndDestroy(); // this |
|
365 return (result); |
|
366 } |
|
367 |
|
368 // --------------------------------------------------------- |
|
369 // CSpdiaControl::Cancel |
|
370 // |
|
371 // --------------------------------------------------------- |
|
372 // |
|
373 EXPORT_C void CSpdiaControl::Cancel() |
|
374 { |
|
375 if ( iPbkSingleItem ) |
|
376 { |
|
377 delete iPbkSingleItem; |
|
378 iPbkSingleItem = NULL; |
|
379 } |
|
380 |
|
381 if ( iQueryDialog ) |
|
382 { |
|
383 delete iQueryDialog; |
|
384 iQueryDialog = NULL; |
|
385 } |
|
386 |
|
387 iSaveDlg = ETrue; |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------- |
|
391 // CSpdiaControl::DialNumberL |
|
392 // |
|
393 // --------------------------------------------------------- |
|
394 // |
|
395 EXPORT_C TBool CSpdiaControl::DialNumberL(TInt aLocation, |
|
396 TDes& aPhoneNumber, CEikStatusPane* /*aStatusPane*/) |
|
397 { |
|
398 TBool result(ETrue); |
|
399 TInt index(Index(aLocation)); |
|
400 if (index == VMBoxPosition()) |
|
401 { |
|
402 result = VoiceMailL(aPhoneNumber); |
|
403 } |
|
404 else |
|
405 { |
|
406 if (ContactId(index) == KNullContactId) |
|
407 { |
|
408 result = AssignDialNumberL(aLocation); |
|
409 } |
|
410 if (result) |
|
411 { |
|
412 aPhoneNumber = (*iSdmArray)[index].PhoneNumber(); |
|
413 } |
|
414 } |
|
415 return result; |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // CSpdiaControl::CSpdiaControl |
|
420 // |
|
421 // --------------------------------------------------------- |
|
422 // |
|
423 CSpdiaControl::CSpdiaControl() |
|
424 : iIconsCount( KIconsCount ), iIconsIdCount( KIconsIdCount ), iIconsMaskCount( KIconsMaskCount ) |
|
425 { |
|
426 if ( !( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) ) |
|
427 { |
|
428 iIconsCount -= 1; |
|
429 iIconsIdCount -= 1; |
|
430 iIconsMaskCount -= 1; |
|
431 } |
|
432 } |
|
433 // --------------------------------------------------------- |
|
434 // CSpdiaControl::InitializeArray |
|
435 // |
|
436 // --------------------------------------------------------- |
|
437 void CSpdiaControl::InitializeArray() |
|
438 { |
|
439 iDialSkinBmp->Append( KAknsIIDQgnMenuSmsvoLst ); |
|
440 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickTwo ); |
|
441 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickThree ); |
|
442 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickFour ); |
|
443 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickFive ); |
|
444 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickSix ); |
|
445 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickSeven ); |
|
446 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickEight ); |
|
447 iDialSkinBmp->Append( KAknsIIDQgnGrafQuickNine ); |
|
448 |
|
449 iSkinIcons->Append( KAknsIIDQgnPropNrtypPhone ); |
|
450 iSkinIcons->Append( KAknsIIDQgnPropNrtypHome ); |
|
451 iSkinIcons->Append( KAknsIIDQgnPropNrtypWork ); |
|
452 iSkinIcons->Append( KAknsIIDQgnPropNrtypMobile ); |
|
453 iSkinIcons->Append( KAknsIIDQgnPropNrtypVideo ); |
|
454 iSkinIcons->Append( KAknsIIDQgnPropNrtypFax ); |
|
455 iSkinIcons->Append( KAknsIIDQgnPropNrtypPager ); |
|
456 iSkinIcons->Append( KAknsIIDQgnPropNrtypCar ); |
|
457 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
458 { |
|
459 iSkinIcons->Append( KAknsIIDQgnPropNrtypVoip ); |
|
460 iSkinIcons->Append( KAknsIIDQgnPropNrtypSwis ); |
|
461 iSkinIcons->Append( KAknsIIDQgnPropNrtypSip ); |
|
462 } |
|
463 iSkinIcons->Append( KAknsIIDQgnPropNrtypAssistant ); |
|
464 iSkinIcons->Append( KAknsIIDQgnPropEmpty ); |
|
465 iSkinIcons->Append( KAknsIIDQgnPropNrtypEmail ); |
|
466 iSkinIcons->Append( KAknsIIDQgnPropNrtypAddress ); |
|
467 |
|
468 // LOCAL CONSTANTS AND MACROS |
|
469 //This order is based on 'Standard field ids' (PbkFields.hrh) |
|
470 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_phone ); |
|
471 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_home ); |
|
472 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_work ); |
|
473 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_mobile ); |
|
474 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_video ); |
|
475 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_fax ); |
|
476 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_pager ); |
|
477 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_car ); |
|
478 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
479 { |
|
480 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_voip ); |
|
481 iIcons->Append( EMbmAvkonQgn_prop_empty ); |
|
482 iIcons->Append( EMbmAvkonQgn_prop_empty ); |
|
483 } |
|
484 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_assistant ); |
|
485 iIcons->Append( EMbmAvkonQgn_prop_empty ); |
|
486 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_email ); |
|
487 iIcons->Append( EMbmAvkonQgn_prop_nrtyp_address ); |
|
488 |
|
489 iIconsId->Append( EPbkqgn_prop_nrtyp_phone ); |
|
490 iIconsId->Append( EPbkqgn_prop_nrtyp_home ); |
|
491 iIconsId->Append( EPbkqgn_prop_nrtyp_work ); |
|
492 iIconsId->Append( EPbkqgn_prop_nrtyp_mobile ); |
|
493 iIconsId->Append( EPbkqgn_prop_nrtyp_video ); |
|
494 iIconsId->Append( EPbkqgn_prop_nrtyp_fax ); |
|
495 iIconsId->Append( EPbkqgn_prop_nrtyp_pager ); |
|
496 iIconsId->Append( EPbkqgn_prop_nrtyp_car ); |
|
497 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
498 { |
|
499 iIconsId->Append( EPbkqgn_prop_nrtyp_voip ); |
|
500 iIconsId->Append( EPbkqgn_prop_nrtyp_swis ); |
|
501 iIconsId->Append( EPbkqgn_prop_nrtyp_sip ); |
|
502 } |
|
503 iIconsId->Append( EPbkqgn_prop_nrtyp_assistant ); |
|
504 iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); |
|
505 iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); |
|
506 iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); |
|
507 |
|
508 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_phone_mask ); |
|
509 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_home_mask ); |
|
510 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_work_mask ); |
|
511 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_mobile_mask ); |
|
512 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_video_mask ); |
|
513 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_fax_mask ); |
|
514 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_pager_mask ); |
|
515 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_car_mask ); |
|
516 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
517 { |
|
518 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_voip_mask ); |
|
519 iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); |
|
520 iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); |
|
521 } |
|
522 iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_assistant_mask ); |
|
523 iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); |
|
524 iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); |
|
525 iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); |
|
526 } |
|
527 // --------------------------------------------------------- |
|
528 // CSpdiaControl::CSpdiaControl |
|
529 // |
|
530 // --------------------------------------------------------- |
|
531 // |
|
532 CSpdiaControl::CSpdiaControl( CPbkContactEngine* aPbkEngine ) |
|
533 : iEngine( aPbkEngine ), iExEngine( ETrue ), iFocusedGrid( KNullIndexData ), |
|
534 iIconsCount( KIconsCount ), iIconsIdCount( KIconsIdCount ), iIconsMaskCount( KIconsMaskCount ) |
|
535 { |
|
536 } |
|
537 |
|
538 // --------------------------------------------------------- |
|
539 // CSpdiaControl::~CSpdiaControl |
|
540 // |
|
541 // --------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C CSpdiaControl::~CSpdiaControl() |
|
544 { |
|
545 //delete iThumbFactory; |
|
546 delete iManager; |
|
547 delete iShadowLayout; |
|
548 |
|
549 delete iPbkNotifier; |
|
550 if ( iGridUsed == EGridNoUse ) |
|
551 { |
|
552 if ( iIconArray ) |
|
553 { |
|
554 iIconArray->ResetAndDestroy(); |
|
555 delete iIconArray; |
|
556 } |
|
557 } |
|
558 if (!iExEngine) |
|
559 { |
|
560 delete iEngine; |
|
561 } |
|
562 |
|
563 ResetArray(); |
|
564 delete iSdmArray; |
|
565 |
|
566 delete iPbkSingleItem; |
|
567 delete iQueryDialog; |
|
568 |
|
569 if (iPbkResourceFile != NULL) |
|
570 { |
|
571 iPbkResourceFile->Close(); |
|
572 } |
|
573 delete iPbkResourceFile; |
|
574 |
|
575 if (iCoeEnv != NULL) |
|
576 { |
|
577 iCoeEnv->DeleteResourceFile(iFileOffset); |
|
578 } |
|
579 delete iBgContext; |
|
580 |
|
581 if ( iDialSkinBmp != NULL ) |
|
582 { |
|
583 iDialSkinBmp->Close(); |
|
584 } |
|
585 delete iDialSkinBmp; |
|
586 |
|
587 if ( iSkinIcons != NULL ) |
|
588 { |
|
589 iSkinIcons->Close(); |
|
590 } |
|
591 delete iSkinIcons; |
|
592 if ( iIcons != NULL ) |
|
593 { |
|
594 iIcons->Close(); |
|
595 } |
|
596 delete iIcons; |
|
597 |
|
598 if ( iIconsId != NULL ) |
|
599 { |
|
600 iIconsId->Close(); |
|
601 } |
|
602 delete iIconsId; |
|
603 |
|
604 if ( iIconsMask != NULL ) |
|
605 { |
|
606 iIconsMask->Close(); |
|
607 } |
|
608 delete iIconsMask; |
|
609 } |
|
610 |
|
611 // --------------------------------------------------------- |
|
612 // CSpdiaControl::VoiceMailL |
|
613 // |
|
614 // --------------------------------------------------------- |
|
615 // |
|
616 EXPORT_C TBool CSpdiaControl::VoiceMailL(TDes& aNumber) |
|
617 { |
|
618 TBool result(ETrue); |
|
619 |
|
620 RVmbxNumber vmbx; |
|
621 CleanupClosePushL(vmbx); // So that Close() is called if a leave happens. |
|
622 if ( vmbx.Open() == KErrNone ) |
|
623 { |
|
624 TInt err1 = vmbx.GetVmbxNumber( aNumber ); |
|
625 TInt err2 = vmbx.GetVideoMbxNumber( aNumber ); |
|
626 |
|
627 if ( ( err1 == KErrNotFound || err1 == KErrNotSupported ) && |
|
628 ( err2 == KErrNotFound || err2 == KErrNotSupported )) |
|
629 { |
|
630 iType = vmbx.SelectTypeL( EVmbxDefine ); |
|
631 } |
|
632 else |
|
633 { |
|
634 iType = vmbx.SelectTypeL( EVmbxCall ); |
|
635 } |
|
636 |
|
637 if( iType == EVmbxIP && !vmbx.IsVoIPProfilesFound() ) |
|
638 { |
|
639 TInt err( vmbx.GetVmbxAddressL( aNumber ) ); |
|
640 if ( err != KErrNone ) |
|
641 { |
|
642 aNumber.Zero(); |
|
643 if (err != KErrNotFound || !vmbx.QueryAddressL( EVmbxNotDefinedQuery, aNumber ) ) |
|
644 { |
|
645 result = EFalse; |
|
646 } |
|
647 } |
|
648 } |
|
649 else if( iType == EVmbxVideo ) |
|
650 { |
|
651 TInt err( vmbx.GetVideoMbxNumber( aNumber ) ); |
|
652 if ( err != KErrNone ) |
|
653 { |
|
654 aNumber.Zero(); |
|
655 if ( err != KErrNotFound ||!vmbx.QueryVideoMbxNumberL( EVmbxNotDefinedQuery, aNumber) ) |
|
656 { |
|
657 result = EFalse; |
|
658 } |
|
659 } |
|
660 } |
|
661 else if ( iType ==EVmbx ) |
|
662 { |
|
663 TInt err( vmbx.GetVmbxNumber( aNumber ) ); |
|
664 if ( err != KErrNone ) |
|
665 { |
|
666 aNumber.Zero(); |
|
667 if (err != KErrNotFound || !vmbx.QueryNumberL( EVmbxNotDefinedQuery, aNumber ) ) |
|
668 { |
|
669 result = EFalse; |
|
670 } |
|
671 } |
|
672 } |
|
673 else |
|
674 { |
|
675 result = EFalse; |
|
676 } |
|
677 } |
|
678 CleanupStack::PopAndDestroy(); // It will call vmbx.Close() |
|
679 return result; |
|
680 } |
|
681 |
|
682 // --------------------------------------------------------- |
|
683 // CSpdiaControl::PbkEngine |
|
684 // phone book engine pointer |
|
685 // --------------------------------------------------------- |
|
686 // |
|
687 EXPORT_C CPbkContactEngine* CSpdiaControl::PbkEngine() const |
|
688 { |
|
689 return iEngine; |
|
690 } |
|
691 |
|
692 // --------------------------------------------------------- |
|
693 // CSpdiaControl::Index |
|
694 // |
|
695 // --------------------------------------------------------- |
|
696 // |
|
697 EXPORT_C TInt CSpdiaControl::Index(TInt aDial) const |
|
698 { |
|
699 return ( aDial - 1 ); |
|
700 } |
|
701 |
|
702 // --------------------------------------------------------- |
|
703 // CSpdiaControl::Number |
|
704 // An interface for accessing index data array |
|
705 // --------------------------------------------------------- |
|
706 // |
|
707 EXPORT_C TInt CSpdiaControl::Number(TInt aIndex) const |
|
708 { |
|
709 return (*iSdmArray)[aIndex].Number(); |
|
710 } |
|
711 |
|
712 // --------------------------------------------------------- |
|
713 // CSpdiaControl::ContactId |
|
714 // An interface for accessing index data array |
|
715 // --------------------------------------------------------- |
|
716 // |
|
717 EXPORT_C TContactItemId CSpdiaControl::ContactId(TInt aIndex) const |
|
718 { |
|
719 return (*iSdmArray)[aIndex].ContactId(); |
|
720 } |
|
721 |
|
722 // --------------------------------------------------------- |
|
723 // CSpdiaControl::PhoneDialNumber |
|
724 // An interface for accessing index data array. |
|
725 // --------------------------------------------------------- |
|
726 // |
|
727 EXPORT_C const TDesC& CSpdiaControl::PhoneDialNumber(TInt aDial) const |
|
728 { |
|
729 return (*iSdmArray)[Index(aDial)].TelNumber(); |
|
730 } |
|
731 |
|
732 // --------------------------------------------------------- |
|
733 // CSpdiaControl::PhoneNumber |
|
734 // An interface for accessing index data array. |
|
735 // --------------------------------------------------------- |
|
736 // |
|
737 EXPORT_C const TDesC& CSpdiaControl::PhoneNumber(TInt aIndex) const |
|
738 { |
|
739 return (*iSdmArray)[aIndex].PhoneNumber(); |
|
740 } |
|
741 |
|
742 // --------------------------------------------------------- |
|
743 // CSpdiaControl::ContactTitleL |
|
744 // phone book access |
|
745 // --------------------------------------------------------- |
|
746 EXPORT_C HBufC* CSpdiaControl::ContactTitleL(TContactItemId aCid, TBool aUnnamed) |
|
747 { |
|
748 HBufC* title = NULL; |
|
749 if (aCid != KNullContactId) |
|
750 { |
|
751 CPbkContactItem* item = |
|
752 iEngine->ReadContactLC(aCid); |
|
753 if ((title = item->GetContactTitleOrNullL()) == NULL && aUnnamed) |
|
754 { |
|
755 title = iEngine->UnnamedTitle().AllocL(); |
|
756 } |
|
757 CleanupStack::PopAndDestroy(); // item |
|
758 } |
|
759 |
|
760 return title; |
|
761 } |
|
762 |
|
763 // --------------------------------------------------------- |
|
764 // CSpdiaControl::ThumbIndex |
|
765 // An interface for accessing index data array. |
|
766 // --------------------------------------------------------- |
|
767 // |
|
768 EXPORT_C TInt CSpdiaControl::ThumbIndex(TInt aIndex) const |
|
769 { |
|
770 return (*iSdmArray)[aIndex].ThumbIndex(); |
|
771 } |
|
772 |
|
773 // --------------------------------------------------------- |
|
774 // CSpdiaControl::IconIndex |
|
775 // An interface for accessing index data array. |
|
776 // --------------------------------------------------------- |
|
777 // |
|
778 EXPORT_C TInt CSpdiaControl::IconIndex(TInt aIndex) const |
|
779 { |
|
780 TInt index = (*iSdmArray)[aIndex].IconIndex(); |
|
781 if (index >= 0) |
|
782 { |
|
783 return ( *iIconsMask )[index - iSdmCount]; |
|
784 } |
|
785 return index; |
|
786 } |
|
787 |
|
788 // --------------------------------------------------------- |
|
789 // CSpdiaControl::NumberType |
|
790 // An interface for accessing phone number type. |
|
791 // Number types are defined in PbkFields.hrh. |
|
792 // --------------------------------------------------------- |
|
793 // |
|
794 EXPORT_C TInt CSpdiaControl::NumberType(TInt aIndex) const |
|
795 { |
|
796 return (*iSdmArray)[aIndex].FieldId(); |
|
797 } |
|
798 |
|
799 // --------------------------------------------------------- |
|
800 // CSpdiaControl::IconArray |
|
801 // An interface for accessing index data array. |
|
802 // --------------------------------------------------------- |
|
803 // |
|
804 EXPORT_C CArrayPtr<CGulIcon>* CSpdiaControl::IconArray() const |
|
805 { |
|
806 return iIconArray; |
|
807 } |
|
808 |
|
809 // --------------------------------------------------------- |
|
810 // CSpdiaControl::CreateGridDataL |
|
811 // |
|
812 // --------------------------------------------------------- |
|
813 // |
|
814 EXPORT_C TBool CSpdiaControl::CreateGridDataL( |
|
815 CAknGrid* aGrid, TBool aIndex) |
|
816 { |
|
817 iGrid = aGrid; |
|
818 if (iGridUsed == EGridNoUse) |
|
819 { |
|
820 iGridUsed = EGridUse; |
|
821 } |
|
822 |
|
823 // The specified index is updated. |
|
824 if (aIndex >= 0) |
|
825 { |
|
826 return UpdateIndexDataL(aIndex); |
|
827 } |
|
828 |
|
829 // All items are updated. |
|
830 CDesCArray* array = |
|
831 STATIC_CAST(CDesCArray*, aGrid->Model()->ItemTextArray()); |
|
832 array->Reset(); |
|
833 InitIndexDataL(); |
|
834 if (SetIconArrayL(iIconArray) > 0) |
|
835 { |
|
836 SetOperationsL(); |
|
837 } |
|
838 |
|
839 TKeyArrayFix key(TSpdiaIndexData::OffsetValue( |
|
840 TSpdiaIndexData::EIndex), ECmpTInt); |
|
841 iSdmArray->Sort(key); |
|
842 |
|
843 TRAPD(err, SetItemDataL(*array)); |
|
844 if (err) |
|
845 { |
|
846 array->Reset(); |
|
847 User::Leave(err); |
|
848 } |
|
849 |
|
850 CFormattedCellListBoxData* list = aGrid->ItemDrawer()->FormattedCellData(); |
|
851 if (list->IconArray() == NULL) |
|
852 { |
|
853 aGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL(iIconArray); |
|
854 } |
|
855 |
|
856 return ETrue; |
|
857 } |
|
858 |
|
859 // --------------------------------------------------------- |
|
860 // CSpdiaControl::CheckingIfPopUpNeeded |
|
861 // Internal rutine to check if pop up has to be shown |
|
862 // to enable the One-Key-Dialling setting. |
|
863 // --------------------------------------------------------- |
|
864 // |
|
865 |
|
866 EXPORT_C TBool CSpdiaControl::CheckingIfPopUpNeeded() |
|
867 { |
|
868 TBool result(ETrue); |
|
869 TRAP_IGNORE(result = CheckingIfPopUpNeededL()); |
|
870 |
|
871 return result; |
|
872 } |
|
873 |
|
874 // --------------------------------------------------------- |
|
875 // CSpdiaControl::CheckingIfPopUpNeededL |
|
876 // Internal rutine to check if pop up has to be shown |
|
877 // to enable the One-Key-Dialling setting. |
|
878 // --------------------------------------------------------- |
|
879 // |
|
880 |
|
881 TBool CSpdiaControl::CheckingIfPopUpNeededL() |
|
882 { |
|
883 TBool gridEmpty( ETrue ); |
|
884 TInt gridIndex( 1 ); |
|
885 TInt value; |
|
886 TBool result( ETrue ); |
|
887 |
|
888 CRepository* repository = CRepository::NewL( KCRUidTelephonySettings ); |
|
889 repository->Get( KSettingsOneKeyDialling, value ); |
|
890 |
|
891 if ( value == 0 ) |
|
892 { |
|
893 while ( ( gridIndex < 9 ) && gridEmpty ) |
|
894 { |
|
895 if ( CSpdiaControl::ContactId( gridIndex ) != KNullContactId ) |
|
896 { |
|
897 gridEmpty=EFalse; |
|
898 } |
|
899 ++gridIndex; |
|
900 } |
|
901 if ( gridEmpty ) |
|
902 { |
|
903 iSaveDlg = EFalse; |
|
904 if( iSaveDlg ) |
|
905 { |
|
906 delete repository; |
|
907 return EFalse; |
|
908 } |
|
909 |
|
910 repository->Set( KSettingsOneKeyDialling, 1 ); |
|
911 } |
|
912 } |
|
913 delete repository; |
|
914 return result; |
|
915 } |
|
916 |
|
917 // --------------------------------------------------------- |
|
918 // CSpdiaControl::AssignDialIndexL |
|
919 // Function called when the access is done through |
|
920 // the speed dial application. |
|
921 // --------------------------------------------------------- |
|
922 // |
|
923 EXPORT_C TBool CSpdiaControl::AssignDialIndexL(TInt aIndex) |
|
924 { |
|
925 TBool result(EFalse); |
|
926 HBufC* prompt = NULL; |
|
927 TBuf<KOperatorNameLength> operatorName; |
|
928 CAknTitlePane* title = NULL; |
|
929 |
|
930 if (iBooleanVarForAddingDialogVariation) |
|
931 { |
|
932 if(iPopupDialog) |
|
933 { |
|
934 if(!CSpdiaControl::CheckingIfPopUpNeeded()) |
|
935 return result; |
|
936 } |
|
937 } |
|
938 else |
|
939 { // do nothing |
|
940 } |
|
941 |
|
942 if(iPopupDialog) |
|
943 { |
|
944 CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
945 title = STATIC_CAST(CAknTitlePane*, sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle) ) ); |
|
946 prompt = StringLoader::LoadLC(R_QTN_SPDIA_TITLE, iCoeEnv); |
|
947 operatorName.Copy(*title->Text()); |
|
948 title->SetTextL(*prompt); |
|
949 title->MakeVisible(ETrue); |
|
950 CleanupStack::PopAndDestroy(prompt); |
|
951 } |
|
952 // Contact id before selection is saved. |
|
953 TContactItemId id(ContactId(aIndex)); |
|
954 CContactDatabase::TContactViewFilter filter( CContactDatabase::EPhonable ); |
|
955 |
|
956 // No filtering if VoIP is supported. |
|
957 TInt VoIPSupported( 0 ); |
|
958 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
959 { |
|
960 CRepository* voiprepository = CRepository::NewL( KCRUidTelephonySettings ); |
|
961 voiprepository->Get( KDynamicVoIP, VoIPSupported ); |
|
962 delete voiprepository; |
|
963 |
|
964 if ( 0 < VoIPSupported ) |
|
965 { |
|
966 filter = CContactDatabase::EUnfiltered; |
|
967 } |
|
968 } |
|
969 |
|
970 CContactViewBase& filteredView = iEngine->FilteredContactsViewL( filter ); |
|
971 |
|
972 CPbkSingleItemFetchDlg::TParams params; |
|
973 // The array of fieldId to display is made. |
|
974 CPbkFieldIdArray* fieldIds = new (ELeave) CPbkFieldIdArray(); |
|
975 CleanupStack::PushL(fieldIds); |
|
976 fieldIds->AppendL(EPbkFieldIdPhoneNumberStandard); |
|
977 fieldIds->AppendL(EPbkFieldIdPhoneNumberHome); |
|
978 fieldIds->AppendL(EPbkFieldIdPhoneNumberWork); |
|
979 fieldIds->AppendL(EPbkFieldIdPhoneNumberMobile); |
|
980 fieldIds->AppendL(EPbkFieldIdAssistantNumber);//changed |
|
981 fieldIds->AppendL(EPbkFieldIdCarNumber);//changed |
|
982 fieldIds->AppendL(EPbkFieldIdPhoneNumberVideo); |
|
983 fieldIds->AppendL(EPbkFieldIdFaxNumber); |
|
984 fieldIds->AppendL(EPbkFieldIdPagerNumber); |
|
985 if ( VoIPSupported ) |
|
986 { |
|
987 fieldIds->AppendL(EPbkFieldIdVOIP); |
|
988 } |
|
989 params.iFieldIdArray = fieldIds; |
|
990 params.iContactView = &filteredView; |
|
991 iPbkSingleItem = CPbkSingleItemFetchDlg::NewL(params, *iEngine); |
|
992 |
|
993 TRAPD(error, result = iPbkSingleItem->ExecuteLD()); |
|
994 iPbkSingleItem = NULL; |
|
995 User::LeaveIfError(error); |
|
996 |
|
997 CleanupStack::PushL(params.iContactItem); |
|
998 if (result && params.iContactItem != NULL) |
|
999 { |
|
1000 result = ETrue; |
|
1001 // It is already assigned from other applications. |
|
1002 if (id == KNullContactId && ContactId(aIndex) != KNullContactId) |
|
1003 { |
|
1004 id = ContactId(aIndex); |
|
1005 } |
|
1006 |
|
1007 if (result && !CheckSpaceBelowCriticalLevelL()) |
|
1008 { |
|
1009 if (id != KNullContactId) |
|
1010 { |
|
1011 RemoveDialIndexL(aIndex, EFalse); |
|
1012 (*iSdmArray)[aIndex].SetContactId(KNullContactId); |
|
1013 } |
|
1014 |
|
1015 CPbkContactItem* item = |
|
1016 iEngine->OpenContactL(params.iContactItem->Id()); |
|
1017 CleanupStack::PushL(item); |
|
1018 |
|
1019 TPhCltTelephoneNumber phonenumber; |
|
1020 params.iContactItemField->GetTextL(phonenumber); |
|
1021 CPbkFieldInfo& info = params.iContactItemField->FieldInfo(); |
|
1022 |
|
1023 CPbkFieldArray& array = item->CardFields(); |
|
1024 for (TInt index(0); index < array.Count(); ++index) |
|
1025 { |
|
1026 if (array[index].ItemField().Id() == |
|
1027 params.iContactItemField->ItemField().Id()) |
|
1028 { |
|
1029 iEngine->SetFieldAsSpeedDialL(*item, |
|
1030 index, (*iSdmArray)[aIndex].Number()); |
|
1031 (*iSdmArray)[aIndex].SetContactId(params.iContactItem->Id()); |
|
1032 (*iSdmArray)[aIndex].SetPhoneNumber(phonenumber); |
|
1033 (*iSdmArray)[aIndex].SetIconIndex(FindIconIndex(info.IconId())); |
|
1034 (*iSdmArray)[aIndex].SetThumbIndex(aIndex, NULL); |
|
1035 index = array.Count(); |
|
1036 } |
|
1037 } |
|
1038 iEngine->CloseContactL(params.iContactItem->Id()); |
|
1039 CleanupStack::PopAndDestroy(); // item |
|
1040 } |
|
1041 } |
|
1042 CleanupStack::PopAndDestroy(2); // params.iContactItem, fieldIds |
|
1043 if(iPopupDialog) |
|
1044 { |
|
1045 title->SetTextL(operatorName); |
|
1046 } |
|
1047 return result; |
|
1048 } |
|
1049 |
|
1050 // --------------------------------------------------------- |
|
1051 // CSpdiaControl::RemoveDialIndexL |
|
1052 // phone book access |
|
1053 // --------------------------------------------------------- |
|
1054 // |
|
1055 EXPORT_C TBool CSpdiaControl::RemoveDialIndexL(TInt aIndex, TBool aConfirmation) |
|
1056 { |
|
1057 TBool release(ETrue); |
|
1058 |
|
1059 if (release) |
|
1060 { |
|
1061 TContactItemId cid((*iSdmArray)[aIndex].ContactId()); |
|
1062 TInt pos((*iSdmArray)[aIndex].Number()); |
|
1063 release = EFalse; |
|
1064 if (cid != KNullContactId && (aIndex >= 0 && aIndex < iSdmCount)) |
|
1065 { |
|
1066 iEngine->RemoveSpeedDialFieldL(cid, pos); |
|
1067 (*iSdmArray)[aIndex].SetContactId(KNullContactId); |
|
1068 release = ETrue; |
|
1069 } |
|
1070 } |
|
1071 return release; |
|
1072 } |
|
1073 |
|
1074 // --------------------------------------------------------- |
|
1075 // deprecated |
|
1076 // |
|
1077 // --------------------------------------------------------- |
|
1078 // |
|
1079 EXPORT_C TBool CSpdiaControl::AssignNumberL(TInt /*aIndex*/, |
|
1080 CEikStatusPane* /*aStatusPane*/, |
|
1081 CCoeControl* /*aContainer*/, |
|
1082 TBool /*aConfirmation*/) |
|
1083 { |
|
1084 __ASSERT_DEBUG(0, Panic(ESdmPanicNotSupported)); |
|
1085 return EFalse; |
|
1086 } |
|
1087 |
|
1088 EXPORT_C void CSpdiaControl::ApplyCellSpdiaPaneStyleL( |
|
1089 CAknGrid& /*aListBox*/, TSize& /*aSize*/) |
|
1090 { |
|
1091 __ASSERT_DEBUG(0, Panic(ESdmPanicNotSupported)); |
|
1092 } |
|
1093 |
|
1094 EXPORT_C void CSpdiaControl::DrawShadow( |
|
1095 CWindowGc& /*aGc*/, |
|
1096 const TSize& /*aSize*/ ) |
|
1097 { |
|
1098 __ASSERT_DEBUG(0, Panic(ESdmPanicNotSupported)); |
|
1099 } |
|
1100 |
|
1101 // --------------------------------------------------------- |
|
1102 // CSpdiaContainer::SetLayout |
|
1103 // |
|
1104 // --------------------------------------------------------- |
|
1105 // |
|
1106 EXPORT_C void CSpdiaControl::SetLayout(const TRect& aRect) |
|
1107 { |
|
1108 //Scalable UI. |
|
1109 if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1110 { |
|
1111 TRect mainPaneRect ; |
|
1112 TRect statusPaneRect; |
|
1113 TAknLayoutRect mainQdialRect; |
|
1114 TAknLayoutRect gridQdialPaneRect; |
|
1115 TAknLayoutRect cellQdialPaneRect; |
|
1116 TAknWindowLineLayout cellQdialPane; |
|
1117 TInt varient =0; |
|
1118 |
|
1119 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1120 { |
|
1121 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
1122 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
1123 mainPaneRect.iTl = statusPaneRect.iTl; |
|
1124 mainPaneRect.iBr.iY = mainPaneRect.iBr.iY - statusPaneRect.iTl.iY; |
|
1125 varient =1; |
|
1126 if ( AknLayoutUtils::PenEnabled() ) |
|
1127 { |
|
1128 mainPaneRect.iTl -= statusPaneRect.iTl; |
|
1129 mainPaneRect.iBr.iY +=statusPaneRect.iTl.iY; |
|
1130 } |
|
1131 } |
|
1132 else |
|
1133 { |
|
1134 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
1135 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
1136 mainPaneRect.iTl= statusPaneRect.iTl; |
|
1137 if ( AknLayoutUtils::PenEnabled() ) |
|
1138 { |
|
1139 mainPaneRect.iTl -= statusPaneRect.iTl; |
|
1140 } |
|
1141 } |
|
1142 |
|
1143 SetRect( mainPaneRect ); |
|
1144 |
|
1145 mainQdialRect.LayoutRect(mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane().LayoutLine()); |
|
1146 gridQdialPaneRect.LayoutRect(mainQdialRect.Rect(),AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine()); |
|
1147 cellQdialPaneRect.LayoutRect(gridQdialPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(0,0).LayoutLine()); |
|
1148 cellQdialPane = AknLayoutScalable_Apps::cell_qdial_pane_g4(varient).LayoutLine(); |
|
1149 |
|
1150 TInt Cnt = 0; |
|
1151 |
|
1152 for(TInt rowSize=0;rowSize < 3; rowSize++) |
|
1153 { |
|
1154 for(TInt column=0;column < 3; column++) |
|
1155 { |
|
1156 icellLayout[Cnt].LayoutRect(gridQdialPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(column,rowSize).LayoutLine()); |
|
1157 Cnt ++ ; |
|
1158 } |
|
1159 } |
|
1160 |
|
1161 |
|
1162 (*iShadowLayout)[CSpdiaGrid::EtnCIF].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane |
|
1163 /*sdm_tn_shadow_cif_c, |
|
1164 sdm_tn_shadow_cif_l, |
|
1165 sdm_tn_shadow_cif_t, |
|
1166 sdm_tn_shadow_cif_r, |
|
1167 sdm_tn_shadow_cif_b, |
|
1168 sdm_tn_shadow_cif_w, |
|
1169 sdm_tn_shadow_cif_h*/); |
|
1170 |
|
1171 (*iShadowLayout)[CSpdiaGrid::EtnVGA90].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane |
|
1172 /*sdm_tn_shadow_vga90_c, |
|
1173 sdm_tn_shadow_vga90_l, |
|
1174 sdm_tn_shadow_vga90_t, |
|
1175 sdm_tn_shadow_vga90_r, |
|
1176 sdm_tn_shadow_vga90_b, |
|
1177 sdm_tn_shadow_vga90_w, |
|
1178 sdm_tn_shadow_vga90_h*/); |
|
1179 |
|
1180 (*iShadowLayout)[CSpdiaGrid::EtnVGA].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane |
|
1181 /*sdm_tn_shadow_vga_c, |
|
1182 sdm_tn_shadow_vga_l, |
|
1183 sdm_tn_shadow_vga_t, |
|
1184 sdm_tn_shadow_vga_r, |
|
1185 sdm_tn_shadow_vga_b, |
|
1186 sdm_tn_shadow_vga_w, |
|
1187 sdm_tn_shadow_vga_h*/); |
|
1188 |
|
1189 (*iShadowLayout)[CSpdiaGrid::EtnCOM].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane |
|
1190 /*sdm_tn_shadow_com_c, |
|
1191 sdm_tn_shadow_com_l, |
|
1192 sdm_tn_shadow_com_t, |
|
1193 sdm_tn_shadow_com_r, |
|
1194 sdm_tn_shadow_com_b, |
|
1195 sdm_tn_shadow_com_w, |
|
1196 sdm_tn_shadow_com_h*/); |
|
1197 } |
|
1198 else |
|
1199 { |
|
1200 TAknWindowLineLayout lScr = AknLayout::screen(); |
|
1201 TAknWindowLineLayout lCtrlPane = AknLayout::control_pane(TRect( TPoint(lScr.il, lScr.it), TSize(lScr.iW, lScr.iH) )); |
|
1202 SetRect(TRect( TPoint(lScr.il, lScr.it), TSize(lScr.iW, lScr.iH - lCtrlPane.iH) ) ); |
|
1203 |
|
1204 (*iShadowLayout)[CSpdiaGrid::EtnCIF90].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_1() |
|
1205 /*sdm_tn_shadow_cif90_c, |
|
1206 sdm_tn_shadow_cif90_l, |
|
1207 sdm_tn_shadow_cif90_t, |
|
1208 sdm_tn_shadow_cif90_r, |
|
1209 sdm_tn_shadow_cif90_b, |
|
1210 sdm_tn_shadow_cif90_w, |
|
1211 sdm_tn_shadow_cif90_h*/); |
|
1212 (*iShadowLayout)[CSpdiaGrid::EtnCIF].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_4() |
|
1213 /*sdm_tn_shadow_cif_c, |
|
1214 sdm_tn_shadow_cif_l, |
|
1215 sdm_tn_shadow_cif_t, |
|
1216 sdm_tn_shadow_cif_r, |
|
1217 sdm_tn_shadow_cif_b, |
|
1218 sdm_tn_shadow_cif_w, |
|
1219 sdm_tn_shadow_cif_h*/); |
|
1220 (*iShadowLayout)[CSpdiaGrid::EtnVGA90].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_7() |
|
1221 /*sdm_tn_shadow_vga90_c, |
|
1222 sdm_tn_shadow_vga90_l, |
|
1223 sdm_tn_shadow_vga90_t, |
|
1224 sdm_tn_shadow_vga90_r, |
|
1225 sdm_tn_shadow_vga90_b, |
|
1226 sdm_tn_shadow_vga90_w, |
|
1227 sdm_tn_shadow_vga90_h*/); |
|
1228 (*iShadowLayout)[CSpdiaGrid::EtnVGA].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_10() |
|
1229 /*sdm_tn_shadow_vga_c, |
|
1230 sdm_tn_shadow_vga_l, |
|
1231 sdm_tn_shadow_vga_t, |
|
1232 sdm_tn_shadow_vga_r, |
|
1233 sdm_tn_shadow_vga_b, |
|
1234 sdm_tn_shadow_vga_w, |
|
1235 sdm_tn_shadow_vga_h*/); |
|
1236 (*iShadowLayout)[CSpdiaGrid::EtnCOM].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_13() |
|
1237 /*sdm_tn_shadow_com_c, |
|
1238 sdm_tn_shadow_com_l, |
|
1239 sdm_tn_shadow_com_t, |
|
1240 sdm_tn_shadow_com_r, |
|
1241 sdm_tn_shadow_com_b, |
|
1242 sdm_tn_shadow_com_w, |
|
1243 sdm_tn_shadow_com_h*/); |
|
1244 } |
|
1245 } |
|
1246 |
|
1247 // --------------------------------------------------------- |
|
1248 // deprecated |
|
1249 // |
|
1250 // --------------------------------------------------------- |
|
1251 // |
|
1252 EXPORT_C TInt CSpdiaControl::Size() const |
|
1253 { |
|
1254 __ASSERT_DEBUG(0, Panic(ESdmPanicNotSupported)); |
|
1255 return KCellRowCount; |
|
1256 } |
|
1257 |
|
1258 // --------------------------------------------------------- |
|
1259 // CSpdiaControl::VMBoxPosition |
|
1260 // |
|
1261 // --------------------------------------------------------- |
|
1262 // |
|
1263 EXPORT_C TInt CSpdiaControl::VMBoxPosition() const |
|
1264 { |
|
1265 return KVoiceMail; |
|
1266 } |
|
1267 |
|
1268 // --------------------------------------------------------- |
|
1269 // CSpdiaControl::SpdIconIndex |
|
1270 // An interface for accessing index data array. |
|
1271 // --------------------------------------------------------- |
|
1272 // |
|
1273 EXPORT_C TInt CSpdiaControl::SpdIconIndex(TInt aIndex) const |
|
1274 { |
|
1275 return (*iSdmArray)[aIndex].IconIndex(); |
|
1276 } |
|
1277 |
|
1278 // --------------------------------------------------------- |
|
1279 // CSpdiaControl::CreateDataL |
|
1280 // Set grid used flag and calls CreateDataL. |
|
1281 // --------------------------------------------------------- |
|
1282 // |
|
1283 TBool CSpdiaControl::CreateDataL(const CAknGrid& aGrid) |
|
1284 { |
|
1285 iGridUsed = EGridUseAndUpdate; |
|
1286 |
|
1287 return CreateGridDataL(CONST_CAST(CAknGrid*, &aGrid), KNullIndexData); |
|
1288 } |
|
1289 |
|
1290 // --------------------------------------------------------- |
|
1291 // CSpdiaControl::PbkThumbnailGetComplete |
|
1292 // |
|
1293 // --------------------------------------------------------- |
|
1294 // |
|
1295 void CSpdiaControl::PbkThumbnailGetComplete |
|
1296 (MPbkThumbnailOperation& aOperation, CFbsBitmap* aBitmap) |
|
1297 { |
|
1298 TRAP_IGNORE(PbkThumbnailGetCompleteL(aOperation, aBitmap )); |
|
1299 } |
|
1300 |
|
1301 // --------------------------------------------------------- |
|
1302 // CSpdiaControl::PbkThumbnailGetCompleteL |
|
1303 // |
|
1304 // --------------------------------------------------------- |
|
1305 // |
|
1306 void CSpdiaControl::PbkThumbnailGetCompleteL |
|
1307 (MPbkThumbnailOperation& aOperation, CFbsBitmap* aBitmap) |
|
1308 { |
|
1309 TInt index(HasOperation(aOperation)); |
|
1310 if ( index != KNullIndexData ) |
|
1311 { |
|
1312 if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1313 { |
|
1314 CAknIcon* icon = CAknIcon::NewL(); |
|
1315 icon->SetBitmap(aBitmap); |
|
1316 |
|
1317 // create mask |
|
1318 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
|
1319 |
|
1320 TSize size = aBitmap->SizeInPixels(); |
|
1321 mask->Create(size,EGray2); |
|
1322 |
|
1323 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
1324 CleanupStack::PushL( fbsBitGc ); |
|
1325 CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( mask ); |
|
1326 CleanupStack::PushL( bmpDevice ); |
|
1327 bmpDevice->Resize( size ); |
|
1328 fbsBitGc->Activate( bmpDevice ); |
|
1329 |
|
1330 fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
1331 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1332 |
|
1333 fbsBitGc->SetBrushColor(KRgbBlack); |
|
1334 fbsBitGc->DrawRect( TRect( size ) ); |
|
1335 |
|
1336 CleanupStack::PopAndDestroy( 2, fbsBitGc ); // bmpDevice and fbsBitGc |
|
1337 |
|
1338 icon->SetMask(mask); |
|
1339 |
|
1340 // this creates both scalable icon and mask |
|
1341 CAknIcon* scaledIcon = AknIconUtils::CreateIconL(icon); |
|
1342 |
|
1343 TSize thumbnailSize = GetThumbnailSize(); |
|
1344 |
|
1345 AknIconUtils::SetSize(scaledIcon->Bitmap(),thumbnailSize,EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1346 AknIconUtils::SetSize(scaledIcon->Mask(),thumbnailSize,EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1347 |
|
1348 CFbsBitmap* bmp = new (ELeave) CFbsBitmap(); |
|
1349 CFbsBitmap* msk = new (ELeave) CFbsBitmap(); |
|
1350 TInt err = msk->Duplicate( scaledIcon->Mask()->Handle() ); |
|
1351 TInt err1 = bmp->Duplicate( scaledIcon->Bitmap()->Handle() ); |
|
1352 |
|
1353 |
|
1354 delete (*iIconArray)[index]; |
|
1355 (*iIconArray)[index] = NULL; |
|
1356 (*iIconArray)[index] = CGulIcon::NewL(bmp,msk); |
|
1357 // set the text array of grid |
|
1358 (*iSdmArray)[index].SetThumbIndex(index,bmp); |
|
1359 ChangeIndexDataL(index, (*iSdmArray)[index]); |
|
1360 if ((*iSdmArray)[index].LastThumb()) |
|
1361 { |
|
1362 DrawNow(); |
|
1363 iGrid->DrawNow(); |
|
1364 } |
|
1365 delete scaledIcon; |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 // set the scaled bitmap to the array of icons |
|
1370 delete (*iIconArray)[index]; |
|
1371 (*iIconArray)[index] = NULL; |
|
1372 (*iIconArray)[index] = CGulIcon::NewL(aBitmap); |
|
1373 // set the text array of grid |
|
1374 (*iSdmArray)[index].SetThumbIndex(index, aBitmap); |
|
1375 ChangeIndexDataL(index, (*iSdmArray)[index]); |
|
1376 if ((*iSdmArray)[index].LastThumb()) |
|
1377 { |
|
1378 DrawNow(); |
|
1379 iGrid->DrawNow(); |
|
1380 } |
|
1381 } |
|
1382 delete &aOperation; |
|
1383 (*iSdmArray)[index].SetOperation(NULL); |
|
1384 delete (*iSdmArray)[index].ContactItem(); |
|
1385 (*iSdmArray)[index].SetContactItem(NULL); |
|
1386 } |
|
1387 } |
|
1388 |
|
1389 // --------------------------------------------------------- |
|
1390 // CSpdiaControl::PbkThumbnailGetFailed |
|
1391 // |
|
1392 // --------------------------------------------------------- |
|
1393 // |
|
1394 void CSpdiaControl::PbkThumbnailGetFailed |
|
1395 (MPbkThumbnailOperation& aOperation, |
|
1396 TInt /*aError*/) |
|
1397 { |
|
1398 TInt index(HasOperation(aOperation)); |
|
1399 if (index != KNullIndexData) |
|
1400 { |
|
1401 delete &aOperation; |
|
1402 (*iSdmArray)[index].SetOperation(NULL); |
|
1403 delete (*iSdmArray)[index].ContactItem(); |
|
1404 (*iSdmArray)[index].SetContactItem(NULL); |
|
1405 } |
|
1406 } |
|
1407 |
|
1408 // --------------------------------------------------------- |
|
1409 // CSpdiaContainer::Draw |
|
1410 // |
|
1411 // --------------------------------------------------------- |
|
1412 // |
|
1413 void CSpdiaControl::Draw(const TRect& /*aRect*/) const |
|
1414 { |
|
1415 CWindowGc& gc = SystemGc(); |
|
1416 // gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1417 // gc.Clear(); |
|
1418 |
|
1419 AknsDrawUtils::Background( |
|
1420 AknsUtils::SkinInstance(), |
|
1421 AknsDrawUtils::ControlContext(this), |
|
1422 this, |
|
1423 gc, |
|
1424 Rect() ); |
|
1425 |
|
1426 DrawShadow(gc); |
|
1427 } |
|
1428 |
|
1429 // --------------------------------------------------------- |
|
1430 // CSpdiaContainer::HandleDatabaseEventL |
|
1431 // Handles an database event of type aEventType. |
|
1432 // --------------------------------------------------------- |
|
1433 // |
|
1434 void CSpdiaControl::HandleDatabaseEventL( |
|
1435 TContactDbObserverEvent /*aEvent*/) |
|
1436 { |
|
1437 // An update flag will be updated if the grid is used. |
|
1438 // Other than this, index data is updated. |
|
1439 if (iGridUsed != EGridUse) |
|
1440 { |
|
1441 InitIndexDataL(); |
|
1442 if ( iGridDlg ) |
|
1443 { |
|
1444 CreateGridDataL( ( CAknGrid* )iGrid , KNullIndexData ); |
|
1445 iGrid->DrawNow(); |
|
1446 |
|
1447 // The grid from 2 to 9 has the possibility to show the dialog, |
|
1448 // and the related index is the value from 1 to 8. |
|
1449 if ( iFocusedGrid != KNullIndexData |
|
1450 && ( iFocusedGrid >= 1 && iFocusedGrid < 9 ) |
|
1451 && iQueryDialog ) |
|
1452 { |
|
1453 TContactItemId id( ( *iSdmArray )[iFocusedGrid].ContactId() ); |
|
1454 if ( id == KNullContactId ) |
|
1455 { |
|
1456 delete iQueryDialog; |
|
1457 iQueryDialog = NULL; |
|
1458 } |
|
1459 } |
|
1460 } |
|
1461 } |
|
1462 } |
|
1463 |
|
1464 // --------------------------------------------------------- |
|
1465 // CSpdiaControl::ConstructL |
|
1466 // |
|
1467 // --------------------------------------------------------- |
|
1468 // |
|
1469 void CSpdiaControl::ConstructL() |
|
1470 { |
|
1471 TInt tmp = 1; |
|
1472 |
|
1473 _LIT(KMbmFileName, "Z:spdctrl.mbm"); |
|
1474 _LIT(KRscFileName, "Z:spdctrl.rsc" ); |
|
1475 |
|
1476 TParse* fpMbm = new(ELeave) TParse (); |
|
1477 fpMbm->Set (KMbmFileName, &KDC_APP_BITMAP_DIR, NULL); |
|
1478 iBmpPath.Copy(fpMbm ->FullName()); |
|
1479 delete fpMbm; |
|
1480 fpMbm=NULL; |
|
1481 |
|
1482 TParse* fpRsc = new(ELeave) TParse (); |
|
1483 fpRsc->Set (KRscFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
1484 iRscPath.Copy(fpRsc ->FullName()); |
|
1485 delete fpRsc; |
|
1486 fpRsc=NULL; |
|
1487 |
|
1488 CRepository* repository = CRepository::NewLC(KCRUidSpeedDialLV); |
|
1489 repository->Get( KSpeedDialLVFlags, tmp ); |
|
1490 |
|
1491 //variable that will be used to variate the code. |
|
1492 // if 0 release is 2.1 and code shouldnt be used |
|
1493 // if 1 release is 2.x (where x:5, 6, ... )and the dialog should be used. |
|
1494 |
|
1495 iBooleanVarForAddingDialogVariation = ( tmp == 1); |
|
1496 |
|
1497 CleanupStack::PopAndDestroy(); |
|
1498 |
|
1499 if (iEngine == NULL) |
|
1500 { |
|
1501 TRAPD(error,iEngine = CPbkContactEngine::NewL()); |
|
1502 iError = error; |
|
1503 if(error !=KErrNone) |
|
1504 { |
|
1505 delete iEngine ; |
|
1506 iEngine = NULL; |
|
1507 return ; |
|
1508 } |
|
1509 } |
|
1510 |
|
1511 if ( iEngine ) |
|
1512 { |
|
1513 iPbkNotifier = iEngine->CreateContactChangeNotifierL(this); |
|
1514 } |
|
1515 iPbkResourceFile = new (ELeave) RPbkViewResourceFile(*iCoeEnv); |
|
1516 if (!iPbkResourceFile->IsOpen()) |
|
1517 { |
|
1518 iPbkResourceFile->OpenL(); |
|
1519 } |
|
1520 |
|
1521 TFileName fileName(iRscPath); |
|
1522 BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName); |
|
1523 iFileOffset = iCoeEnv->AddResourceFileL(fileName); |
|
1524 |
|
1525 iSdmCount = KCellRowCount * KCellColCount; |
|
1526 iGridUsed = EGridNoUse; |
|
1527 |
|
1528 iIconArray = new (ELeave)CAknIconArray(iSdmCount); |
|
1529 iSdmArray = new (ELeave) CArrayFixFlat<TSpdiaIndexData> (iSdmCount); |
|
1530 |
|
1531 iDialSkinBmp = new (ELeave)RArray<TAknsItemID>(KArraySize); |
|
1532 iSkinIcons = new (ELeave)RArray<TAknsItemID>(iIconsIdCount); |
|
1533 iIcons = new (ELeave)RArray<TInt>(iIconsCount); |
|
1534 iIconsId = new (ELeave)RArray<TInt>(iIconsIdCount); |
|
1535 iIconsMask = new (ELeave)RArray<TInt>(iIconsMaskCount); |
|
1536 iShadowLayout = new (ELeave) CArrayFixFlat<TAknLayoutRect> (KLayoutCount); |
|
1537 for (TInt i(0); i < KLayoutCount; ++i) |
|
1538 { |
|
1539 TAknLayoutRect rect; |
|
1540 iShadowLayout->AppendL(rect); |
|
1541 } |
|
1542 |
|
1543 InitIndexDataL(); |
|
1544 InitializeArray(); |
|
1545 |
|
1546 // create skin context |
|
1547 // Size is set in SizeChanged() |
|
1548 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
1549 KAknsIIDQsnBgAreaMainQdial, |
|
1550 TRect(0,0,0,0), |
|
1551 EFalse ); |
|
1552 iPopupDialog = EFalse; |
|
1553 |
|
1554 iType = EVmbx; |
|
1555 } |
|
1556 |
|
1557 // --------------------------------------------------------- |
|
1558 // CSpdiaControl::InitIndexDataL |
|
1559 // The SDM control data is initialized. |
|
1560 // --------------------------------------------------------- |
|
1561 // |
|
1562 void CSpdiaControl::InitIndexDataL() |
|
1563 { |
|
1564 // The dialog of grid is not closed. |
|
1565 if (iIconArray != NULL) |
|
1566 { |
|
1567 ResetArray(); |
|
1568 iSdmArray->Reset(); |
|
1569 for (TInt i(0); i < iSdmCount; ++i) |
|
1570 { |
|
1571 TSpdiaIndexData data; |
|
1572 SetIndexDataL(i, data); |
|
1573 iSdmArray->AppendL(data); |
|
1574 } |
|
1575 } |
|
1576 } |
|
1577 |
|
1578 // --------------------------------------------------------- |
|
1579 // CSpdiaControl::ThumbType |
|
1580 // An interface for accessing index data array. |
|
1581 // --------------------------------------------------------- |
|
1582 // |
|
1583 TInt CSpdiaControl::ThumbType(TInt aIndex) const |
|
1584 { |
|
1585 return ConvThumbType((*iSdmArray)[aIndex].ThumbSize()); |
|
1586 } |
|
1587 |
|
1588 // --------------------------------------------------------- |
|
1589 // CSpdiaControl::ThumbType |
|
1590 // An interface for accessing index data array. |
|
1591 // --------------------------------------------------------- |
|
1592 // |
|
1593 TSize CSpdiaControl::ThumbSize(TInt aIndex) const |
|
1594 { |
|
1595 return (*iSdmArray)[aIndex].ThumbSize(); |
|
1596 } |
|
1597 |
|
1598 |
|
1599 // --------------------------------------------------------- |
|
1600 // CSpdiaControl::IconPositionL |
|
1601 // phone book access |
|
1602 // --------------------------------------------------------- |
|
1603 // |
|
1604 TInt CSpdiaControl::IconPositionL(const CPbkContactItem& aItem, TInt aDial, TInt& aFieldId) |
|
1605 { |
|
1606 TInt index(KNullIndexData); |
|
1607 CPbkFieldArray& fields = aItem.CardFields(); |
|
1608 for (TInt fieldIdx(0); index == KNullIndexData && |
|
1609 fieldIdx < fields.Count(); ++fieldIdx) |
|
1610 { |
|
1611 TPbkContactItemField& field = fields[fieldIdx]; |
|
1612 CArrayFix<TInt>* array = field.SpeedDialIndexesL(); |
|
1613 if (array) |
|
1614 { |
|
1615 for (TInt i(0); index < 0 && i < array->Count(); ++i) |
|
1616 { |
|
1617 if (aDial == (*array)[i]) |
|
1618 { |
|
1619 index = FindIconIndex(field.FieldInfo().IconId()); |
|
1620 aFieldId = field.FieldInfo().FieldId(); |
|
1621 } |
|
1622 } |
|
1623 delete array; |
|
1624 } |
|
1625 } |
|
1626 return index; |
|
1627 } |
|
1628 |
|
1629 // --------------------------------------------------------- |
|
1630 // CSpdiaControl::FindIconIndex |
|
1631 // |
|
1632 // --------------------------------------------------------- |
|
1633 // |
|
1634 TInt CSpdiaControl::FindIconIndex(TInt aId) const |
|
1635 { |
|
1636 TInt index(KNullIndexData); |
|
1637 for (TInt n(0); index == KNullIndexData && n < iIconsIdCount; ++n) |
|
1638 { |
|
1639 if ( ( *iIconsId )[n] == ( TUint )aId ) |
|
1640 { |
|
1641 index = n + iSdmCount; |
|
1642 } |
|
1643 } |
|
1644 return index; |
|
1645 } |
|
1646 |
|
1647 // --------------------------------------------------------- |
|
1648 // CSpdiaControl::DeleteIconArray |
|
1649 // Deletes the old icons. |
|
1650 // --------------------------------------------------------- |
|
1651 EXPORT_C void CSpdiaControl::DeleteIconArray() |
|
1652 { |
|
1653 if( iIconArray ) |
|
1654 { |
|
1655 iIconArray->ResetAndDestroy(); |
|
1656 delete iIconArray; |
|
1657 iIconArray = NULL; |
|
1658 } |
|
1659 } |
|
1660 |
|
1661 // --------------------------------------------------------- |
|
1662 // CSpdiaControl::ReloadIconArray |
|
1663 // Reloads the new skin icons. |
|
1664 // --------------------------------------------------------- |
|
1665 EXPORT_C void CSpdiaControl::ReloadIconArray() |
|
1666 { |
|
1667 TRAP_IGNORE(ReloadIconArrayL()); |
|
1668 } |
|
1669 // --------------------------------------------------------- |
|
1670 // CSpdiaControl::ReloadIconArrayL |
|
1671 // Reloads the new skin icons. |
|
1672 // --------------------------------------------------------- |
|
1673 void CSpdiaControl::ReloadIconArrayL() |
|
1674 { |
|
1675 if ( NULL == iIconArray ) |
|
1676 { |
|
1677 iIconArray = new (ELeave)CAknIconArray(iSdmCount); |
|
1678 } |
|
1679 SetIconArrayL(iIconArray); |
|
1680 } |
|
1681 |
|
1682 // --------------------------------------------------------- |
|
1683 // CSpdiaControl::SetIconArrayL |
|
1684 // |
|
1685 // --------------------------------------------------------- |
|
1686 // |
|
1687 TInt CSpdiaControl::SetIconArrayL(CArrayPtrFlat<CGulIcon>* aArray) |
|
1688 { |
|
1689 CFbsBitmap* bitmap,*mask; |
|
1690 bitmap = NULL; |
|
1691 mask= NULL; |
|
1692 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
1693 if (!iManager) |
|
1694 { |
|
1695 iManager = CPbkThumbnailManager::NewL(*iEngine); |
|
1696 } |
|
1697 |
|
1698 if ( aArray != NULL ) |
|
1699 { |
|
1700 aArray->ResetAndDestroy(); |
|
1701 } |
|
1702 else |
|
1703 { |
|
1704 return 0; |
|
1705 } |
|
1706 |
|
1707 TInt vmbxSupport = 0; |
|
1708 CRepository* vmbxSupported = CRepository::NewL( KCRUidVideoMailbox ); |
|
1709 vmbxSupported->Get( KVideoMbxSupport, vmbxSupport ); |
|
1710 delete vmbxSupported; |
|
1711 |
|
1712 TInt vmbxPos; |
|
1713 CRepository* vmbxKey2 = CRepository::NewL( KCRUidTelVideoMailbox ); |
|
1714 vmbxKey2->Get( KTelVideoMbxKey, vmbxPos ); |
|
1715 delete vmbxKey2; |
|
1716 TInt vdoIndex( Index( vmbxPos ) ); |
|
1717 |
|
1718 TInt existThumb(0); |
|
1719 for (TInt index(0); index < iSdmArray->Count(); index++) |
|
1720 { |
|
1721 if ( index == 0 ) |
|
1722 { |
|
1723 TUid uidVmbx; |
|
1724 uidVmbx.iUid =KVmbxUid; |
|
1725 AknsUtils::CreateAppIconLC( skinInstance,uidVmbx, EAknsAppIconTypeContext,bitmap ,mask); |
|
1726 CleanupStack::Pop(2); |
|
1727 } |
|
1728 else if ( index == 1 && ( vmbxSupport && vdoIndex == 1 ) ) |
|
1729 { |
|
1730 AknsUtils::CreateIconL( skinInstance, (*iDialSkinBmp)[index], bitmap, mask, |
|
1731 iBmpPath, EMbmSpdctrlQgn_prop_video_mb, EMbmSpdctrlQgn_prop_video_mb_mask ); |
|
1732 } |
|
1733 else |
|
1734 { |
|
1735 if( User::Language()== ELangHindi) |
|
1736 { |
|
1737 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,KDialHindiBmp[index], KDialHindiBmpMask[index] ); |
|
1738 } |
|
1739 else |
|
1740 { |
|
1741 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,KDialBmp[index], KDialBmpMask[index] ); |
|
1742 } |
|
1743 } |
|
1744 CGulIcon* icon = CGulIcon::NewL(bitmap,mask); |
|
1745 CleanupStack::PushL(icon); |
|
1746 aArray->AppendL(icon); |
|
1747 |
|
1748 if (CreateIndexIconL(index, |
|
1749 (*iSdmArray)[index], existThumb > 0? EFalse: ETrue)) |
|
1750 { |
|
1751 ++existThumb; |
|
1752 } |
|
1753 CleanupStack::Pop(); // icon |
|
1754 } |
|
1755 |
|
1756 // Add icons |
|
1757 for (TInt i(0); i < iIconsIdCount; ++i) |
|
1758 { |
|
1759 AknsUtils::CreateIconL(skinInstance, (*iSkinIcons)[i],bitmap,mask,AknIconUtils::AvkonIconFileName(),( *iIcons )[i], ( *iIconsMask )[i] ); |
|
1760 aArray->AppendL(CGulIcon::NewL(bitmap,mask)); |
|
1761 } |
|
1762 |
|
1763 return existThumb; |
|
1764 } |
|
1765 |
|
1766 // --------------------------------------------------------- |
|
1767 // CSpdiaContainer::ItemDescriptorL |
|
1768 // |
|
1769 // --------------------------------------------------------- |
|
1770 // |
|
1771 HBufC* CSpdiaControl::ItemDescriptorLC(TInt aIndex, |
|
1772 const TSpdiaIndexData& aSdmData) |
|
1773 { |
|
1774 HBufC* des = NULL; |
|
1775 if (aSdmData.ContactId() != KNullContactId) |
|
1776 { |
|
1777 des = CreateItemDescriptorLC(aSdmData); |
|
1778 } |
|
1779 else |
|
1780 { |
|
1781 des = HBufC::NewLC(KNullCell.iTypeLength); |
|
1782 des->Des().Format(KNullCell, aIndex); |
|
1783 } |
|
1784 return des; |
|
1785 } |
|
1786 |
|
1787 // --------------------------------------------------------- |
|
1788 // CSpdiaContainer::CreateItemDescriptorL |
|
1789 // |
|
1790 // --------------------------------------------------------- |
|
1791 // |
|
1792 HBufC* CSpdiaControl::CreateItemDescriptorLC(const TSpdiaIndexData& aSdmData) |
|
1793 { |
|
1794 HBufC* des = HBufC::NewLC(KApaMaxAppCaption); |
|
1795 TPtr ptr(des->Des()); |
|
1796 |
|
1797 // thumb type |
|
1798 TInt type(CSpdiaGrid::EText); |
|
1799 if (aSdmData.ThumbIndex() >= 0) |
|
1800 { |
|
1801 type = ConvThumbType(aSdmData.ThumbSize()); |
|
1802 } |
|
1803 |
|
1804 // Text |
|
1805 if (type == CSpdiaGrid::EText) |
|
1806 { |
|
1807 ptr.Append(KDesTab); // 1 |
|
1808 if (aSdmData.IconIndex() >= 0) |
|
1809 { |
|
1810 ptr.AppendNum(aSdmData.IconIndex()); |
|
1811 } |
|
1812 AppendTextL(aSdmData, ptr); // 2,3,4 |
|
1813 } |
|
1814 else |
|
1815 { |
|
1816 // icon + text + text + text |
|
1817 ptr.Append(KDesTab2); // 1, 2 |
|
1818 ptr.Append(KDesTab2); // 2 |
|
1819 } |
|
1820 |
|
1821 // thumbnail 5-14 |
|
1822 for (TInt i(CSpdiaGrid::EtnCIF90); i <= CSpdiaGrid::EtnCOM; ++i) |
|
1823 { |
|
1824 AppendThumbnail(aSdmData, ptr, (type == i? ETrue: EFalse)); |
|
1825 } |
|
1826 |
|
1827 // number |
|
1828 ptr.Append(KDesTab); // 15 |
|
1829 // check |
|
1830 ptr.Append(KDesTab); // 16 |
|
1831 |
|
1832 return des; |
|
1833 } |
|
1834 |
|
1835 // --------------------------------------------------------- |
|
1836 // CSpdiaContainer::AppendTextL |
|
1837 // output Text1\tText2\tText3\t |
|
1838 // --------------------------------------------------------- |
|
1839 // |
|
1840 void CSpdiaControl::AppendTextL(const TSpdiaIndexData& aSdmData, TPtr& aText) |
|
1841 { |
|
1842 CPbkContactItem* item = iEngine->ReadContactLC(aSdmData.ContactId()); |
|
1843 if (item == NULL) |
|
1844 { |
|
1845 aText.Append(KDesTab2); |
|
1846 aText.Append(KDesTab2); |
|
1847 } |
|
1848 else |
|
1849 { |
|
1850 TPbkContactItemField* lastNameField = |
|
1851 FindFieldL(*item, EPbkFieldIdLastName); // Last Name |
|
1852 TPbkContactItemField* firstNameField = |
|
1853 FindFieldL(*item, EPbkFieldIdFirstName); // First Name |
|
1854 TPbkContactItemField* companyNameField = |
|
1855 FindFieldL(*item, EPbkFieldIdCompanyName); |
|
1856 |
|
1857 aText.Append(KDesTab); // 2 |
|
1858 if (!lastNameField && !firstNameField && !companyNameField) |
|
1859 { |
|
1860 aText.Append(aSdmData.PhoneNumber()); |
|
1861 aText.Append(KDesTab); // 3 |
|
1862 } |
|
1863 else if (!lastNameField && !firstNameField) |
|
1864 { |
|
1865 aText.Append(companyNameField->Text()); |
|
1866 aText.Append(KDesTab); // 3 |
|
1867 } |
|
1868 else |
|
1869 { |
|
1870 if (lastNameField) |
|
1871 { |
|
1872 aText.Append(lastNameField->Text()); |
|
1873 aText.Append(KDesTab); // 3 |
|
1874 } |
|
1875 if (firstNameField) |
|
1876 { |
|
1877 aText.Append(firstNameField->Text()); |
|
1878 } |
|
1879 if (!lastNameField) |
|
1880 { |
|
1881 aText.Append(KDesTab); // 3 |
|
1882 } |
|
1883 } |
|
1884 aText.Append(KDesTab); // 4 |
|
1885 } |
|
1886 CleanupStack::PopAndDestroy(); // item |
|
1887 } |
|
1888 |
|
1889 // --------------------------------------------------------- |
|
1890 // CSpdiaContainer::FindFieldL |
|
1891 // |
|
1892 // --------------------------------------------------------- |
|
1893 // |
|
1894 TPbkContactItemField* CSpdiaControl::FindFieldL( |
|
1895 CPbkContactItem& aItem, TPbkFieldId aFieldId) |
|
1896 { |
|
1897 TPbkContactItemField* field = aItem.FindField(aFieldId); |
|
1898 if (field) |
|
1899 { |
|
1900 HBufC* buf = field->Text().AllocL(); |
|
1901 buf->Des().Trim(); |
|
1902 if (buf->Des().Length() == 0) |
|
1903 { |
|
1904 field = NULL; |
|
1905 } |
|
1906 delete buf; |
|
1907 } |
|
1908 return field; |
|
1909 } |
|
1910 // --------------------------------------------------------- |
|
1911 // CSpdiaContainer::AppendThumbnail |
|
1912 // output \tThumbnail\ticon |
|
1913 // --------------------------------------------------------- |
|
1914 // |
|
1915 void CSpdiaControl::AppendThumbnail( |
|
1916 const TSpdiaIndexData& aSdmData, |
|
1917 TPtr& aText, |
|
1918 TBool aFixedLocation ) |
|
1919 { |
|
1920 if (!aFixedLocation) |
|
1921 { |
|
1922 aText.Append(KDesTab2); |
|
1923 return; |
|
1924 } |
|
1925 |
|
1926 aText.Append(KDesTab); |
|
1927 if (aSdmData.ThumbIndex() >= 0) |
|
1928 { |
|
1929 aText.AppendNum(aSdmData.ThumbIndex()); |
|
1930 } |
|
1931 |
|
1932 aText.Append(KDesTab); |
|
1933 if (aSdmData.IconIndex() >= 0) |
|
1934 { |
|
1935 aText.AppendNum(aSdmData.IconIndex()); |
|
1936 } |
|
1937 } |
|
1938 |
|
1939 // --------------------------------------------------------- |
|
1940 // CSpdiaContainer::ConvThumbType |
|
1941 // Returns |
|
1942 // EtnVGA : 640 x 480 40 x 30 VGA |
|
1943 // EtnVGA90: 480 x 640 30 x 40 VGA turned |
|
1944 // EtnCIF : 352 x 288 44 x 36 CIF |
|
1945 // EtnCIF90: 288 x 352 36 x 44 CIF turned |
|
1946 // EtnCOM : othre |
|
1947 // --------------------------------------------------------- |
|
1948 // |
|
1949 TInt CSpdiaControl::ConvThumbType(const TSize& aSize) const |
|
1950 { |
|
1951 // Scalable UI |
|
1952 TAknWindowLineLayout vga; |
|
1953 TAknWindowLineLayout cif; |
|
1954 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1955 { |
|
1956 vga = AknLayoutScalable_Apps::popup_phob_thumbnail_window_g2().LayoutLine(); |
|
1957 cif = AknLayoutScalable_Apps::popup_phob_thumbnail_window_g1().LayoutLine();//image |
|
1958 } |
|
1959 else |
|
1960 { |
|
1961 vga = AppLayout::Thumbnail_pop_up_window_elements_Line_1(); |
|
1962 cif = AppLayout::Thumbnail_pop_up_window_elements_Line_3(); |
|
1963 } |
|
1964 TInt type(CSpdiaGrid::EtnCOM); |
|
1965 |
|
1966 if (aSize.iWidth == cif.iH//SDM_TN_CIF_HEIGHT |
|
1967 && aSize.iHeight == cif.iW)// SDM_TN_CIF_WIDTH) |
|
1968 { |
|
1969 type = CSpdiaGrid::EtnCIF90; |
|
1970 } |
|
1971 else if (aSize.iWidth == cif.iW &&//SDM_TN_CIF_WIDTH && |
|
1972 aSize.iHeight == cif.iH)//SDM_TN_CIF_HEIGHT) |
|
1973 { |
|
1974 type = CSpdiaGrid::EtnCIF; |
|
1975 } |
|
1976 else if (aSize.iWidth == vga.iH &&//SDM_TN_VGA_HEIGHT && |
|
1977 aSize.iHeight == vga.iW )//SDM_TN_VGA_WIDTH) |
|
1978 { |
|
1979 type = CSpdiaGrid::EtnVGA90; |
|
1980 } |
|
1981 else if (aSize.iWidth == vga.iW &&//SDM_TN_VGA_WIDTH && |
|
1982 aSize.iHeight == vga.iH)//SDM_TN_VGA_HEIGHT) |
|
1983 { |
|
1984 type = CSpdiaGrid::EtnVGA; |
|
1985 } |
|
1986 |
|
1987 return type; |
|
1988 } |
|
1989 |
|
1990 |
|
1991 // --------------------------------------------------------- |
|
1992 // CSpdiaContainer::SetOperationsL |
|
1993 // |
|
1994 // --------------------------------------------------------- |
|
1995 // |
|
1996 void CSpdiaControl::SetOperationsL() |
|
1997 { |
|
1998 for (TInt index(iSdmArray->Count() -1); index > 0; --index) |
|
1999 { |
|
2000 TSpdiaIndexData& data = (*iSdmArray)[index]; |
|
2001 if (data.ContactItem() != NULL) |
|
2002 { |
|
2003 data.SetOperation( |
|
2004 iManager->GetThumbnailAsyncL(*this, *data.ContactItem())); |
|
2005 } |
|
2006 } |
|
2007 } |
|
2008 |
|
2009 // --------------------------------------------------------- |
|
2010 // CSpdiaContainer::SetItemDataL |
|
2011 // |
|
2012 // --------------------------------------------------------- |
|
2013 // |
|
2014 void CSpdiaControl::SetItemDataL(CDesCArray& aArray) |
|
2015 { |
|
2016 for (TInt loop(0); loop < iSdmCount; loop++) |
|
2017 { |
|
2018 TSpdiaIndexData& data = (*iSdmArray)[loop]; |
|
2019 |
|
2020 aArray.AppendL(ItemDescriptorLC(loop, data)->Des()); |
|
2021 CleanupStack::PopAndDestroy(); // des |
|
2022 } |
|
2023 } |
|
2024 |
|
2025 |
|
2026 // --------------------------------------------------------- |
|
2027 // CSpdiaContainer::AssignDialL |
|
2028 // Function called when assigning speed dial from phone book |
|
2029 // application |
|
2030 // --------------------------------------------------------- |
|
2031 // |
|
2032 void CSpdiaControl::AssignDialL(TContactItemId aId, TInt aFieldIdx, TInt aDial) |
|
2033 { |
|
2034 if (iBooleanVarForAddingDialogVariation) |
|
2035 { |
|
2036 if(!CSpdiaControl::CheckingIfPopUpNeeded()) |
|
2037 return; |
|
2038 } |
|
2039 else |
|
2040 { // do nothing |
|
2041 } |
|
2042 |
|
2043 TInt index(Index(aDial)); |
|
2044 TPhCltTelephoneNumber phonenumber; |
|
2045 TContactItemId id(ContactId(index)); |
|
2046 |
|
2047 if (id != KNullContactId) |
|
2048 { |
|
2049 RemoveDialIndexL(index, EFalse); |
|
2050 } |
|
2051 |
|
2052 CPbkContactItem* item = OpenContactL( iEngine, aId ); |
|
2053 CleanupStack::PushL(item); |
|
2054 |
|
2055 CPbkFieldArray& fields = item->CardFields(); |
|
2056 TInt fieldCount = fields.Count(); |
|
2057 |
|
2058 if ( aFieldIdx < fieldCount ) |
|
2059 { |
|
2060 TPbkContactItemField& field = fields[aFieldIdx]; |
|
2061 field.GetTextL(phonenumber); |
|
2062 phonenumber.Trim(); |
|
2063 iEngine->SetFieldAsSpeedDialL(*item, aFieldIdx, aDial); |
|
2064 |
|
2065 iEngine->CloseContactL(aId); |
|
2066 CleanupStack::PopAndDestroy(); // item |
|
2067 |
|
2068 HBufC* prompt = |
|
2069 StringLoader::LoadLC(R_SPDIA_TEXT_KEY_ASSIGNED, aDial, iCoeEnv); |
|
2070 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote(); |
|
2071 note->ExecuteLD(*prompt); |
|
2072 CleanupStack::PopAndDestroy(); // prompt |
|
2073 } |
|
2074 else |
|
2075 { |
|
2076 iEngine->CloseContactL(aId); |
|
2077 CleanupStack::PopAndDestroy(); // item |
|
2078 } |
|
2079 } |
|
2080 |
|
2081 // --------------------------------------------------------- |
|
2082 // CCalenNoteForm::CheckSpaceBelowCriticalLevelL |
|
2083 // Checks if the Flash File System storage will fall below |
|
2084 // Critical Level. Warning will be displayed if sotrage |
|
2085 // is below Critical Level. |
|
2086 // (other items were commented in a header). |
|
2087 // --------------------------------------------------------- |
|
2088 // |
|
2089 TBool CSpdiaControl::CheckSpaceBelowCriticalLevelL() |
|
2090 { |
|
2091 TBool retcode(EFalse); |
|
2092 |
|
2093 if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iCoeEnv->FsSession()))) |
|
2094 { |
|
2095 CErrorUI* errorUi = CErrorUI::NewLC(); |
|
2096 errorUi->ShowGlobalErrorNoteL(KErrDiskFull); |
|
2097 CleanupStack::PopAndDestroy(); // errorUi |
|
2098 retcode = ETrue; |
|
2099 } |
|
2100 return retcode; |
|
2101 } |
|
2102 |
|
2103 // --------------------------------------------------------- |
|
2104 // CSpdiaContainer::HasOperation |
|
2105 // |
|
2106 // --------------------------------------------------------- |
|
2107 // |
|
2108 TInt CSpdiaControl::HasOperation(const MPbkThumbnailOperation& aOperation) |
|
2109 { |
|
2110 for (TInt index(0); index < iSdmArray->Count(); index++) |
|
2111 { |
|
2112 if ((*iSdmArray)[index].Operation() == &aOperation) |
|
2113 { |
|
2114 return index; |
|
2115 } |
|
2116 } |
|
2117 return KNullIndexData; |
|
2118 } |
|
2119 |
|
2120 // --------------------------------------------------------- |
|
2121 // CSpdiaContainer::ResetArray |
|
2122 // |
|
2123 // --------------------------------------------------------- |
|
2124 // |
|
2125 void CSpdiaControl::ResetArray() |
|
2126 { |
|
2127 if(iSdmArray!= NULL) |
|
2128 { |
|
2129 for (TInt index(0); index < iSdmArray->Count(); index++) |
|
2130 { |
|
2131 delete (*iSdmArray)[index].ContactItem(); |
|
2132 delete (*iSdmArray)[index].Operation(); |
|
2133 } |
|
2134 } |
|
2135 } |
|
2136 |
|
2137 // --------------------------------------------------------- |
|
2138 // CSpdiaContainer::UpdateIndexDataL |
|
2139 // |
|
2140 // --------------------------------------------------------- |
|
2141 // |
|
2142 TBool CSpdiaControl::UpdateIndexDataL(TInt aIndex) |
|
2143 { |
|
2144 CFbsBitmap* bitmap,*mask; |
|
2145 bitmap = NULL; |
|
2146 mask= NULL; |
|
2147 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
2148 |
|
2149 |
|
2150 TSpdiaIndexData& data = (*iSdmArray)[aIndex]; |
|
2151 delete (*iIconArray)[aIndex]; |
|
2152 (*iIconArray)[aIndex] = NULL; |
|
2153 TFileName bmpPath(iBmpPath); |
|
2154 |
|
2155 if(User::Language() == ELangHindi) |
|
2156 { |
|
2157 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[aIndex],bitmap,mask,bmpPath,KDialHindiBmp[aIndex], KDialHindiBmpMask[aIndex] ); |
|
2158 } |
|
2159 else |
|
2160 { |
|
2161 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[aIndex],bitmap,mask,bmpPath,KDialBmp[aIndex], KDialBmpMask[aIndex] ); |
|
2162 } |
|
2163 (*iIconArray)[aIndex] = CGulIcon::NewL(bitmap,mask); |
|
2164 |
|
2165 data.ResetThumbIndex(); |
|
2166 if (CreateIndexIconL(aIndex, data, ETrue)) |
|
2167 { |
|
2168 data.SetOperation( |
|
2169 iManager->GetThumbnailAsyncL(*this, *data.ContactItem())); |
|
2170 } |
|
2171 else |
|
2172 { |
|
2173 ChangeIndexDataL(aIndex, data); |
|
2174 iGrid->DrawNow(); |
|
2175 } |
|
2176 return ETrue; |
|
2177 } |
|
2178 |
|
2179 // --------------------------------------------------------- |
|
2180 // CSpdiaContainer::SetIndexDataL |
|
2181 // phone book access |
|
2182 // --------------------------------------------------------- |
|
2183 // |
|
2184 void CSpdiaControl::SetIndexDataL(TInt aIndex, TSpdiaIndexData& aSdmData) |
|
2185 { |
|
2186 TPhCltTelephoneNumber phonenumber; |
|
2187 |
|
2188 aSdmData.SetIndex(aIndex); |
|
2189 aSdmData.SetPhoneNumber(KNullDesC); |
|
2190 aSdmData.SetNumber(aIndex + 1); |
|
2191 aSdmData.SetContactId(iEngine->GetSpeedDialFieldL( |
|
2192 aIndex + 1, phonenumber)); |
|
2193 if (aSdmData.ContactId() != KNullContactId) |
|
2194 { |
|
2195 phonenumber.Trim(); |
|
2196 if (phonenumber.Length() > 0) |
|
2197 { |
|
2198 aSdmData.SetPhoneNumber(phonenumber); |
|
2199 } |
|
2200 else |
|
2201 { |
|
2202 iEngine->RemoveSpeedDialFieldL(aSdmData.ContactId(), aIndex + 1); |
|
2203 aSdmData.SetContactId(KNullContactId); |
|
2204 } |
|
2205 } |
|
2206 } |
|
2207 |
|
2208 // --------------------------------------------------------- |
|
2209 // CSpdiaContainer::ChangeIndexDataL |
|
2210 // |
|
2211 // --------------------------------------------------------- |
|
2212 // |
|
2213 void CSpdiaControl::ChangeIndexDataL( |
|
2214 TInt aIndex, |
|
2215 const TSpdiaIndexData& aSdmData ) |
|
2216 { |
|
2217 CDesCArray* array = STATIC_CAST(CDesCArray*, |
|
2218 iGrid->Model()->ItemTextArray()); |
|
2219 HBufC* des = ItemDescriptorLC(aIndex, aSdmData); |
|
2220 array->Delete(aIndex); |
|
2221 array->InsertL(aIndex, *des); |
|
2222 CleanupStack::PopAndDestroy(); // des |
|
2223 } |
|
2224 |
|
2225 // --------------------------------------------------------- |
|
2226 // CSpdiaContainer::CreateIndexIconL |
|
2227 // |
|
2228 // --------------------------------------------------------- |
|
2229 // |
|
2230 TBool CSpdiaControl::CreateIndexIconL(TInt aIndex, |
|
2231 TSpdiaIndexData& aSdmData, TBool aSetUpdateThumb) |
|
2232 { |
|
2233 TBool existThumb(EFalse); |
|
2234 |
|
2235 if (aSdmData.ContactId() != KNullContactId) |
|
2236 { |
|
2237 CPbkContactItem* item = iEngine->ReadContactL(aSdmData.ContactId()); |
|
2238 TInt fieldId(EPbkFieldIdNone); |
|
2239 aSdmData.SetIconIndex(IconPositionL(*item, aIndex + 1, fieldId)); |
|
2240 aSdmData.SetFieldId( fieldId ); // set number type |
|
2241 |
|
2242 if (iManager->HasThumbnail(*item)) |
|
2243 { |
|
2244 existThumb = ETrue; |
|
2245 aSdmData.SetContactItem(item); |
|
2246 |
|
2247 if (aSetUpdateThumb) |
|
2248 { |
|
2249 aSdmData.SetLastThumb(ETrue); |
|
2250 } |
|
2251 aSdmData.SetThumbIndex(aIndex, NULL); |
|
2252 } |
|
2253 else |
|
2254 { |
|
2255 delete item; |
|
2256 } |
|
2257 } |
|
2258 return existThumb; |
|
2259 } |
|
2260 |
|
2261 // --------------------------------------------------------- |
|
2262 // CSpdiaContainer::DrawShadow |
|
2263 // |
|
2264 // --------------------------------------------------------- |
|
2265 // |
|
2266 void CSpdiaControl::DrawShadow(CWindowGc& aGc) const |
|
2267 { |
|
2268 //TSize size(cell_spdia_item_w, cell_spdia_item_h); |
|
2269 //Scalable UI. |
|
2270 TAknWindowLineLayout area; |
|
2271 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
2272 { |
|
2273 area = AknLayoutScalable_Apps::cell_qdial_pane(0,0).LayoutLine(); |
|
2274 } |
|
2275 else |
|
2276 { |
|
2277 area = AppLayout::cell_qdial_pane(0,0); |
|
2278 } |
|
2279 |
|
2280 TSize size(area.iW, area.iH); |
|
2281 aGc.SetPenColor(AKN_LAF_COLOR(SDM_TN_SHADOW_COROL)); |
|
2282 TInt count(iSdmArray->Count()); |
|
2283 //TRect rect(TPoint(spdia_main_pane_grid_l, spdia_main_pane_grid_t), size); |
|
2284 //Scalable UI |
|
2285 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
2286 { |
|
2287 area = AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine(); |
|
2288 } |
|
2289 else |
|
2290 { |
|
2291 area = AppLayout::Speed_Dial_descendants_Line_1(); |
|
2292 } |
|
2293 TRect rect(TPoint(area.il, area.it), size); |
|
2294 for (TInt i(0); i < count; ++i) |
|
2295 { |
|
2296 if (ThumbIndex(i) >= 0) |
|
2297 { |
|
2298 TInt type(ThumbType(i)); |
|
2299 TRect rc((*iShadowLayout)[type].Rect()); |
|
2300 if (type == CSpdiaGrid::EtnCOM) |
|
2301 { |
|
2302 TSize image(ThumbSize(i)); |
|
2303 image.iWidth = Min(image.iWidth, rc.Width()); |
|
2304 image.iHeight = Min(image.iHeight, rc.Height()); |
|
2305 rc = TRect(TPoint(0,0), image); |
|
2306 TInt x(Max(0, (size.iWidth - image.iWidth) / 2) + 2); |
|
2307 TInt y(Max(0, (size.iHeight - image.iHeight) / 2) + 2); |
|
2308 rc.Move(x, y); |
|
2309 } |
|
2310 rc.Move(rect.iTl.iX, rect.iTl.iY); |
|
2311 aGc.DrawRect(rc); |
|
2312 } |
|
2313 rect.Move(size.iWidth, 0); |
|
2314 if (((i + 1)/ KCellColCount) * KCellRowCount == i + 1) |
|
2315 { |
|
2316 rect.Move(-(KCellColCount * size.iWidth), size.iHeight); |
|
2317 } |
|
2318 } |
|
2319 } |
|
2320 |
|
2321 // --------------------------------------------------------- |
|
2322 // CSpdiaControl::MopSupplyObject() |
|
2323 // Pass skin information if need. |
|
2324 // --------------------------------------------------------- |
|
2325 // |
|
2326 TTypeUid::Ptr CSpdiaControl::MopSupplyObject(TTypeUid aId) |
|
2327 { |
|
2328 if(aId.iUid == MAknsControlContext::ETypeId) |
|
2329 { |
|
2330 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
2331 } |
|
2332 return CCoeControl::MopSupplyObject( aId ); |
|
2333 } |
|
2334 |
|
2335 // --------------------------------------------------------- |
|
2336 // CSpdiaControl::SizeChanged() |
|
2337 // --------------------------------------------------------- |
|
2338 // |
|
2339 void CSpdiaControl::SizeChanged() |
|
2340 { |
|
2341 iBgContext->SetRect( Rect() ); |
|
2342 } |
|
2343 |
|
2344 |
|
2345 // --------------------------------------------------------- |
|
2346 // CSpdiaControl::VoiceMailTypeL |
|
2347 // |
|
2348 // --------------------------------------------------------- |
|
2349 // |
|
2350 EXPORT_C TInt CSpdiaControl::VoiceMailType() |
|
2351 { |
|
2352 return iType; |
|
2353 } |
|
2354 |
|
2355 // --------------------------------------------------------- |
|
2356 // CSpdiaControl::GetThumbnailSize() |
|
2357 // Gets actual size of thumbnial to be drawn |
|
2358 // --------------------------------------------------------- |
|
2359 // |
|
2360 TSize CSpdiaControl::GetThumbnailSize() |
|
2361 { |
|
2362 TRect mainPaneRect ; |
|
2363 TRect statusPaneRect; |
|
2364 TInt varient =0; |
|
2365 |
|
2366 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
2367 { |
|
2368 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
2369 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
2370 mainPaneRect.iTl = statusPaneRect.iTl; |
|
2371 mainPaneRect.iBr.iY = mainPaneRect.iBr.iY - statusPaneRect.iTl.iY; |
|
2372 varient =1; |
|
2373 } |
|
2374 else |
|
2375 { |
|
2376 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
2377 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
2378 mainPaneRect.iTl= statusPaneRect.iTl; |
|
2379 } |
|
2380 |
|
2381 TAknLayoutRect mainGridPaneRect; |
|
2382 TAknLayoutRect gridPaneRect; |
|
2383 TAknLayoutRect cellPaneRect; |
|
2384 TAknLayoutRect thumbPaneRect; |
|
2385 |
|
2386 mainGridPaneRect.LayoutRect(mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane());//main grid pane |
|
2387 gridPaneRect.LayoutRect(mainGridPaneRect.Rect(),AknLayoutScalable_Apps::grid_qdial_pane());//main grid pane |
|
2388 cellPaneRect.LayoutRect(gridPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(0,0)); |
|
2389 thumbPaneRect.LayoutRect(cellPaneRect.Rect(),AknLayoutScalable_Apps::thumbnail_qdial_pane(varient)); |
|
2390 |
|
2391 return thumbPaneRect.Rect().Size(); |
|
2392 } |
|
2393 // --------------------------------------------------------- |
|
2394 // CSpdiaControl::GetSpdCtrlLastError() |
|
2395 // retuns last error |
|
2396 // --------------------------------------------------------- |
|
2397 // |
|
2398 EXPORT_C TInt CSpdiaControl::GetSpdCtrlLastError() |
|
2399 { |
|
2400 return iError; |
|
2401 } |
|
2402 // End of File |