|
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 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 // INCLUDE FILES |
|
27 #include <akninputblock.h> |
|
28 #include <bldvariant.hrh> |
|
29 #include <gulicon.h> |
|
30 #include <akncontext.h> |
|
31 #include <akntitle.h> |
|
32 #include <AknQueryDialog.h> |
|
33 #include <aknlists.h> |
|
34 #include <bautils.h> |
|
35 #include <aknnotedialog.h> |
|
36 #include <aknnotecontrol.h> |
|
37 #include <aknnotewrappers.h> |
|
38 #include <sysutil.h> |
|
39 #include <ErrorUI.h> |
|
40 #include <vmnumber.h> |
|
41 #include <centralrepository.h> |
|
42 #include <SettingsInternalCRKeys.h> |
|
43 #include <SpeeddialPrivateCRKeys.h> |
|
44 |
|
45 |
|
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 |
|
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 "SpdiaGridVPbk.h" |
|
64 #include "SpdiaGridDlgVPbk.h" |
|
65 #include "SpdiaIndexDataVPbk.h" |
|
66 #include "SpdiaControl.hrh" |
|
67 #include "Speeddial.laf" |
|
68 #include "SpdiaPanic.h" |
|
69 |
|
70 #include "speeddialprivate.h" |
|
71 #include <CVPbkFieldTypeRefsList.h> |
|
72 #include <MPbk2FieldPropertyArray.h> |
|
73 #include <TPbk2IconId.h> |
|
74 #include <MVPbkContactOperationBase.h> |
|
75 #include <Pbk2FieldPropertiesFactory.h> |
|
76 #include <MPbk2FieldProperty.h> |
|
77 #include <CVPbkSpeedDialAttribute.h> |
|
78 #include <MVPbkContactFieldTextData.h> |
|
79 #include <MVPbkContactFieldUriData.h> |
|
80 #include <CVPbkContactFieldIterator.h> |
|
81 #include <CPbk2IconFactory.h> |
|
82 #include <CPbk2SortOrderManager.h> |
|
83 #include <MPbk2ContactNameFormatter.h> |
|
84 #include <Pbk2ContactNameFormatterFactory.h> |
|
85 #include <CVPbkFieldTypeSelector.h> |
|
86 #include <VPbkContactViewFilterBuilder.h> |
|
87 #include <CVPbkContactStoreUriArray.h> |
|
88 #include <TVPbkContactStoreUriPtr.h> |
|
89 #include <CVPbkContactLinkArray.h> |
|
90 #include <MVPbkContactStoreList.h> |
|
91 #include <MVPbkContactStore.h> |
|
92 #include <MVPbkContactLink.h> |
|
93 #include <CVPbkContactLinkArray.h> |
|
94 #include <MVPbkContactStoreProperties.h> |
|
95 #include <voicemailboxdomaincrkeys.h> |
|
96 #include <AiwGenericParam.h> |
|
97 #include <AiwServiceHandler.h> |
|
98 #include <telvmbxsettingscrkeys.h> |
|
99 |
|
100 #include <VPbkEng.rsg> |
|
101 #include <AiwContactAssignDataTypes.h> |
|
102 |
|
103 #include "SpdiaContainer.h" |
|
104 |
|
105 // LOCAL CONSTANTS AND MACROS |
|
106 //This order is based on 'Standard field ids' (PbkFields.hrh) |
|
107 |
|
108 const TUint KFieldIds[] = |
|
109 { |
|
110 R_VPBK_FIELD_TYPE_LANDPHONEHOME, |
|
111 R_VPBK_FIELD_TYPE_MOBILEPHONEHOME, |
|
112 R_VPBK_FIELD_TYPE_VIDEONUMBERHOME, |
|
113 R_VPBK_FIELD_TYPE_FAXNUMBERHOME, |
|
114 R_VPBK_FIELD_TYPE_VOIPHOME, |
|
115 R_VPBK_FIELD_TYPE_LANDPHONEWORK, |
|
116 R_VPBK_FIELD_TYPE_MOBILEPHONEWORK, |
|
117 R_VPBK_FIELD_TYPE_VIDEONUMBERWORK, |
|
118 R_VPBK_FIELD_TYPE_FAXNUMBERWORK, |
|
119 R_VPBK_FIELD_TYPE_VOIPWORK, |
|
120 R_VPBK_FIELD_TYPE_LANDPHONEGEN, |
|
121 R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, |
|
122 R_VPBK_FIELD_TYPE_VIDEONUMBERGEN, |
|
123 R_VPBK_FIELD_TYPE_FAXNUMBERGEN, |
|
124 R_VPBK_FIELD_TYPE_VOIPGEN, |
|
125 R_VPBK_FIELD_TYPE_POC, |
|
126 R_VPBK_FIELD_TYPE_SWIS, |
|
127 R_VPBK_FIELD_TYPE_PAGERNUMBER, |
|
128 R_VPBK_FIELD_TYPE_ASSTPHONE, |
|
129 R_VPBK_FIELD_TYPE_CARPHONE, |
|
130 R_VPBK_FIELD_TYPE_IMPP |
|
131 }; |
|
132 |
|
133 |
|
134 |
|
135 const TInt KCellRowCount(3); |
|
136 const TInt KCellColCount(3); |
|
137 const TInt KMaxIndex(8); |
|
138 const TInt KVoiceMail(0); |
|
139 |
|
140 |
|
141 const TInt KLayoutCount(5); |
|
142 const TInt KNullIndexData(-1); |
|
143 const TInt32 KVmbxUid(0x100058F5) ; |
|
144 const TInt KOperatorNameLength(100); |
|
145 const TInt KContactFormattingFlags = MPbk2ContactNameFormatter::EPreserveLeadingSpaces | MPbk2ContactNameFormatter::EReplaceNonGraphicChars; |
|
146 |
|
147 _LIT(KNullCell, "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%d\t"); |
|
148 _LIT(KDesTab, "\t"); |
|
149 _LIT(KDesTab2, "\t\t"); |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // CSpeedDialPrivate::NewL() |
|
156 // --------------------------------------------------------- |
|
157 // |
|
158 |
|
159 |
|
160 EXPORT_C CSpeedDialPrivate* CSpeedDialPrivate::NewL(CVPbkContactManager* aContactManager ) |
|
161 { |
|
162 CSpeedDialPrivate* self = new(ELeave) CSpeedDialPrivate(aContactManager); |
|
163 CleanupStack::PushL(self); |
|
164 self->ConstructL(); |
|
165 CleanupStack::Pop(); // self |
|
166 return self; |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // CSpdiaControl::CSpdiaControl |
|
171 // |
|
172 // --------------------------------------------------------- |
|
173 // |
|
174 |
|
175 CSpeedDialPrivate::CSpeedDialPrivate(CVPbkContactManager* aContactManager): |
|
176 iShadowLayout(NULL), |
|
177 iBgContext(NULL), |
|
178 iCurrentIndex( -1 ), |
|
179 iDialSkinBmp(NULL), |
|
180 iSkinIcons(NULL), |
|
181 iContactManager(aContactManager), |
|
182 iImageManager(NULL), |
|
183 iContactLink(NULL), |
|
184 iContact(NULL), |
|
185 iContactLinkArray(NULL), |
|
186 iSpeedDial(NULL), |
|
187 iUpdateFlag(EFalse), |
|
188 iSdmArray(NULL), |
|
189 iWait(NULL), |
|
190 iVideoMail(0), |
|
191 iMail(NULL), |
|
192 iFetchmail(EFalse), |
|
193 iServiceHandler(NULL), |
|
194 iCancelFlag(0), |
|
195 iRemoveConfirmQueryDialog( NULL ) |
|
196 /*iOperationComplete(EFalse),*/ |
|
197 { |
|
198 |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------- |
|
202 // CSpeedDialPrivate::ConstructL |
|
203 // |
|
204 // --------------------------------------------------------- |
|
205 // |
|
206 void CSpeedDialPrivate::ConstructL() |
|
207 { |
|
208 TInt tmp = 1; |
|
209 |
|
210 _LIT(KMbmFileName, "Z:spdctrl.mbm"); |
|
211 _LIT(KRscFileName, "Z:spdctrl.rsc" ); |
|
212 |
|
213 TParse* fpMbm = new(ELeave) TParse (); |
|
214 fpMbm->Set (KMbmFileName, &KDC_APP_BITMAP_DIR, NULL); |
|
215 iBmpPath.Copy(fpMbm ->FullName()); |
|
216 delete fpMbm; |
|
217 fpMbm=NULL; |
|
218 |
|
219 TParse* fpRsc = new(ELeave) TParse (); |
|
220 fpRsc->Set (KRscFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
221 |
|
222 TBuf<254> rscPath; |
|
223 rscPath.Copy(fpRsc ->FullName()); |
|
224 |
|
225 delete fpRsc; |
|
226 fpRsc=NULL; |
|
227 |
|
228 CRepository* repository = CRepository::NewLC(KCRUidSpeedDialLV); |
|
229 repository->Get( KSpeedDialLVFlags, tmp ); |
|
230 |
|
231 iBooleanVarForAddingDialogVariation = ( tmp == 1); |
|
232 |
|
233 CleanupStack::PopAndDestroy(); // pop-destroy repository |
|
234 |
|
235 |
|
236 TFileName fileName(rscPath); |
|
237 BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName); |
|
238 iFileOffset = iCoeEnv->AddResourceFileL(fileName); |
|
239 |
|
240 iSdmCount = KCellRowCount * KCellColCount; |
|
241 iGridUsed = EGridNoUse; |
|
242 |
|
243 iIconArray = new (ELeave)CAknIconArray(iSdmCount); |
|
244 iSdmArray = new (ELeave) CArrayFixFlat<TSpdiaIndexDataVPbk>(iSdmCount); |
|
245 TSpdiaIndexDataVPbk spDialData; |
|
246 iSdmArray->AppendL(spDialData, iSdmCount); |
|
247 |
|
248 iDialSkinBmp = new (ELeave)RArray<TAknsItemID>(KArraySize); |
|
249 iSkinIcons = new (ELeave)RArray<TAknsItemID>(KArraySize); |
|
250 iShadowLayout = new (ELeave) CArrayFixFlat<TAknLayoutRect> (KLayoutCount); |
|
251 for (TInt i(0); i < KLayoutCount; ++i) |
|
252 { |
|
253 TAknLayoutRect rect; |
|
254 iShadowLayout->AppendL(rect); |
|
255 } |
|
256 |
|
257 |
|
258 iSpeedDial = CVPbkSpeedDialAttribute::NewL(); |
|
259 |
|
260 iAttributeManager = &(iContactManager->ContactAttributeManagerL()); |
|
261 |
|
262 iThumbNailFieldType = iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_THUMBNAILPIC ); |
|
263 iImageManager = CPbk2ImageManager::NewL(*iContactManager); |
|
264 iContactLinkArray = NULL; |
|
265 iServiceHandler = CAiwServiceHandler::NewL(); |
|
266 iServiceHandler->AttachL( R_SPEEDDIAL_EMAIL_SELECTION_INTEREST ); |
|
267 iServiceHandler->AttachL( R_SPDIA_SINGLE_ASSIGN_INTEREST ); |
|
268 iWait = new( ELeave )CActiveSchedulerWait(); |
|
269 |
|
270 |
|
271 iError = KErrNone; |
|
272 |
|
273 MVPbkContactStoreList& storeList = iContactManager->ContactStoresL(); |
|
274 for(TInt count=0;count<storeList.Count();++count) |
|
275 { |
|
276 iOperationComplete = EFalse; |
|
277 storeList.At(count).OpenL(*this); |
|
278 while(!iOperationComplete) |
|
279 { |
|
280 Wait(); |
|
281 } |
|
282 } |
|
283 |
|
284 |
|
285 InitIndexDataL(); |
|
286 |
|
287 iState = STATE_IDLE; |
|
288 |
|
289 InitializeArray(); |
|
290 |
|
291 // create skin context |
|
292 // Size is set in SizeChanged() |
|
293 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
294 KAknsIIDQsnBgAreaMainQdial, |
|
295 TRect(0,0,0,0), |
|
296 EFalse ); |
|
297 iPopupDialog = EFalse; |
|
298 |
|
299 ivmbxvariation = CRepository::NewL( KCRUidVideoMailbox ); |
|
300 ivmbxvariation->Get( KVideoMbxSupport, iVmbxsupported ); |
|
301 |
|
302 |
|
303 CRepository* vmbxkey2 = CRepository::NewL( KCRUidTelVideoMailbox ); |
|
304 vmbxkey2->Get( KTelVideoMbxKey, iVmbxkeypos ); |
|
305 delete vmbxkey2; |
|
306 vmbxkey2 = NULL ; |
|
307 // Initialize the bmp arrays |
|
308 InitBmpArray(); |
|
309 //#ifndef VIDEOMAILBOX_HIDDEN//its shown |
|
310 if(iVmbxsupported) |
|
311 { |
|
312 iType = EVmbx; |
|
313 } |
|
314 |
|
315 else |
|
316 iType = EVmbx; |
|
317 iShowAssignCalled = EFalse; |
|
318 |
|
319 } |
|
320 |
|
321 |
|
322 // --------------------------------------------------------- |
|
323 // CSpeedDialPrivate::InitBmpArray |
|
324 // |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void CSpeedDialPrivate::InitBmpArray() |
|
328 { |
|
329 TInt i(0); |
|
330 |
|
331 // Possible values for iVmbxkeypos are 1 & 2 |
|
332 (iVmbxkeypos > 1) ? iVideoMail = 1 : iVideoMail = 0; |
|
333 |
|
334 // Initialize grid bitmaps |
|
335 for (i = 0; i < 9; i++ ) |
|
336 { |
|
337 // EMbmSpdctrlQgn_graf_quick_one |
|
338 if (0 == i) |
|
339 { |
|
340 |
|
341 #ifdef __SCALABLE_ICONS |
|
342 iDialBmp[0] = EMbmSpdctrlQgn_menu_smsvo; |
|
343 iDialBmpMask[0] = EMbmSpdctrlQgn_menu_smsvo_mask; |
|
344 |
|
345 iDialHindiBmp[0] = EMbmSpdctrlQgn_menu_smsvo; |
|
346 iDialHindiBmpMask[0] = EMbmSpdctrlQgn_menu_smsvo_mask; |
|
347 #else |
|
348 iDialBmp[0] = EMbmSpdctrlQgn_menu_smsvo_lst; |
|
349 iDialBmp[0] = EMbmSpdctrlQgn_menu_smsvo_lst_mask; |
|
350 |
|
351 iDialHindiBmp[0] = EMbmSpdctrlQgn_menu_smsvo_lst; |
|
352 iDialHindiBmpMask[0] = EMbmSpdctrlQgn_menu_smsvo_lst_mask; |
|
353 #endif |
|
354 |
|
355 continue; |
|
356 } |
|
357 |
|
358 // EMbmSpdctrlQgn_graf_quick_two |
|
359 if (1 == i) |
|
360 { |
|
361 // If Video Mailbox is via key2, then update with corresponding icons |
|
362 // in the 2nd location of the grid. |
|
363 if ((0 < iVideoMail) &&(iVmbxsupported)) |
|
364 { |
|
365 iDialBmp[1] = EMbmSpdctrlQgn_prop_video_mb; |
|
366 iDialBmpMask[1] = EMbmSpdctrlQgn_prop_video_mb_mask; |
|
367 |
|
368 iDialHindiBmp[1] = EMbmSpdctrlQgn_prop_video_mb; |
|
369 iDialHindiBmpMask[1] = EMbmSpdctrlQgn_prop_video_mb_mask; |
|
370 } |
|
371 // (else) VideoMailbox is via key 0 |
|
372 else |
|
373 { |
|
374 iDialBmp[1] = EMbmSpdctrlQgn_graf_quick_two; |
|
375 iDialBmpMask[1] = EMbmSpdctrlQgn_graf_quick_two_mask; |
|
376 |
|
377 iDialHindiBmp[1] = EMbmSpdctrlQgn_graf_deva_quick_two; |
|
378 iDialHindiBmpMask[1] = EMbmSpdctrlQgn_graf_deva_quick_two_mask; |
|
379 } |
|
380 |
|
381 continue; |
|
382 } |
|
383 |
|
384 iDialBmp[i] = EMbmSpdctrlQgn_menu_smsvo + (2 * i); |
|
385 iDialBmpMask[i] = EMbmSpdctrlQgn_menu_smsvo + (2 * i) + 1; |
|
386 |
|
387 iDialHindiBmp[i] = EMbmSpdctrlQgn_graf_deva_quick_one + (2 * i); |
|
388 iDialHindiBmpMask[i]= EMbmSpdctrlQgn_graf_deva_quick_one + (2 * i) + 1; |
|
389 } |
|
390 |
|
391 } |
|
392 |
|
393 // --------------------------------------------------------- |
|
394 // CSpeedDialPrivate::~CSpeedDialPrivate |
|
395 // |
|
396 // --------------------------------------------------------- |
|
397 // |
|
398 EXPORT_C CSpeedDialPrivate::~CSpeedDialPrivate() |
|
399 { |
|
400 |
|
401 //delete iThumbFactory; |
|
402 delete iShadowLayout; |
|
403 |
|
404 if (iGridUsed == EGridNoUse) |
|
405 { |
|
406 if (iIconArray) |
|
407 { |
|
408 iIconArray->ResetAndDestroy(); |
|
409 delete iIconArray; |
|
410 } |
|
411 } |
|
412 |
|
413 ResetArray(); |
|
414 delete iSdmArray; |
|
415 |
|
416 |
|
417 if (iCoeEnv != NULL) |
|
418 { |
|
419 iCoeEnv->DeleteResourceFile(iFileOffset); |
|
420 } |
|
421 delete iBgContext; |
|
422 |
|
423 if(iDialSkinBmp != NULL) |
|
424 { |
|
425 iDialSkinBmp->Close(); |
|
426 delete iDialSkinBmp; |
|
427 } |
|
428 |
|
429 |
|
430 if(iSkinIcons != NULL) |
|
431 { |
|
432 iSkinIcons->Close(); |
|
433 delete iSkinIcons; |
|
434 } |
|
435 |
|
436 TRAP_IGNORE( |
|
437 { |
|
438 MVPbkContactStoreList& storeList = iContactManager->ContactStoresL(); |
|
439 |
|
440 for(TInt count=0;count<storeList.Count();++count) |
|
441 { |
|
442 storeList.At(count).Close(*this); |
|
443 } |
|
444 } |
|
445 ); |
|
446 |
|
447 delete iImageManager; |
|
448 delete iWait; |
|
449 delete iContact; |
|
450 delete iContactLinkArray; |
|
451 delete iSpeedDial; |
|
452 delete iQueryDialog; |
|
453 delete ivmbxvariation; |
|
454 if ( iServiceHandler ) |
|
455 { |
|
456 delete iServiceHandler; |
|
457 iServiceHandler = NULL; |
|
458 } |
|
459 if ( iRemoveConfirmQueryDialog ) |
|
460 { |
|
461 delete iRemoveConfirmQueryDialog; |
|
462 iRemoveConfirmQueryDialog = NULL; |
|
463 } |
|
464 } |
|
465 |
|
466 // --------------------------------------------------------- |
|
467 // CSpeedDialPrivate::InitializeArray |
|
468 // |
|
469 // --------------------------------------------------------- |
|
470 // |
|
471 void CSpeedDialPrivate::InitializeArray() |
|
472 { |
|
473 iDialSkinBmp->Append(KAknsIIDQgnMenuSmsvoLst); |
|
474 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickTwo); |
|
475 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickThree); |
|
476 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickFour); |
|
477 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickFive); |
|
478 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickSix); |
|
479 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickSeven); |
|
480 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickEight); |
|
481 iDialSkinBmp->Append(KAknsIIDQgnGrafQuickNine); |
|
482 |
|
483 iSkinIcons->Append(KAknsIIDQgnPropNrtypPhone); |
|
484 iSkinIcons->Append(KAknsIIDQgnPropNrtypHome); |
|
485 iSkinIcons->Append(KAknsIIDQgnPropNrtypWork); |
|
486 iSkinIcons->Append(KAknsIIDQgnPropNrtypMobile); |
|
487 iSkinIcons->Append(KAknsIIDQgnPropNrtypVideo); |
|
488 iSkinIcons->Append(KAknsIIDQgnPropNrtypFax); |
|
489 iSkinIcons->Append(KAknsIIDQgnPropNrtypPager); |
|
490 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
491 { |
|
492 iSkinIcons->Append( KAknsIIDQgnPropNrtypVoip ); |
|
493 } |
|
494 iSkinIcons->Append(KAknsIIDQgnPropNrtypEmail); |
|
495 iSkinIcons->Append(KAknsIIDQgnPropNrtypAddress); |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------- |
|
499 // CSpeedDialPrivate::ResetArray |
|
500 // |
|
501 // --------------------------------------------------------- |
|
502 // |
|
503 void CSpeedDialPrivate::ResetArray() |
|
504 { |
|
505 TInt index(0); |
|
506 if(iSdmArray!= NULL) |
|
507 { |
|
508 |
|
509 |
|
510 for (index = 0; index < iSdmArray->Count(); index++) |
|
511 { |
|
512 (*iSdmArray)[index].Reset(); |
|
513 (*iSdmArray)[index].SetIndex(index); |
|
514 } |
|
515 } |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------- |
|
519 // CSpeedDialPrivate::CreateFieldIconsL |
|
520 // |
|
521 // --------------------------------------------------------- |
|
522 // |
|
523 void CSpeedDialPrivate::CreateFieldIconsL(CArrayPtrFlat<CGulIcon>* aArray) |
|
524 { |
|
525 TInt arraySize = sizeof KFieldIds / sizeof KFieldIds[0]; |
|
526 TInt count =0; |
|
527 const MVPbkFieldType* fieldType = NULL; |
|
528 CGulIcon* icon = NULL; |
|
529 |
|
530 CVPbkFieldTypeRefsList* fieldTypeList = CVPbkFieldTypeRefsList::NewL(); |
|
531 CPbk2IconFactory* pbk2IconFactory = CPbk2IconFactory::NewL(); |
|
532 |
|
533 |
|
534 for(count =0; count < arraySize; ++count) |
|
535 { |
|
536 fieldType = iContactManager->FieldTypes().Find( KFieldIds[count] ); |
|
537 fieldTypeList->AppendL(*fieldType); |
|
538 } |
|
539 |
|
540 MPbk2FieldPropertyArray* aPropertyArray = Pbk2FieldPropertiesFactory::CreateLC(*fieldTypeList,&iContactManager->FsSession() ); |
|
541 |
|
542 for(count =0; count < aPropertyArray->Count(); ++ count) |
|
543 { |
|
544 icon = pbk2IconFactory->CreateIconL(aPropertyArray->At(count).IconId()); |
|
545 aArray->AppendL(icon); |
|
546 } |
|
547 |
|
548 CleanupStack::PopAndDestroy(aPropertyArray); |
|
549 |
|
550 delete fieldTypeList; |
|
551 delete pbk2IconFactory; |
|
552 |
|
553 |
|
554 } |
|
555 // --------------------------------------------------------- |
|
556 // CSpeedDialPrivate::VoiceMailL |
|
557 // |
|
558 // --------------------------------------------------------- |
|
559 // |
|
560 EXPORT_C TBool CSpeedDialPrivate::VoiceMailL(TDes& aNumber) |
|
561 { |
|
562 TBool result(ETrue); |
|
563 |
|
564 RVmbxNumber vmbx; |
|
565 CleanupClosePushL(vmbx); // So that Close() is called if a leave happens. |
|
566 if (vmbx.Open() == KErrNone) |
|
567 { |
|
568 TInt err2 = vmbx.GetVideoMbxNumber( aNumber ); |
|
569 |
|
570 |
|
571 if( iVmbxsupported ) |
|
572 { |
|
573 TInt err1 = vmbx.GetVmbxNumber( aNumber ); |
|
574 TInt err2 = vmbx.GetVideoMbxNumber( aNumber ); |
|
575 |
|
576 if ( ( err1 == KErrNotFound || err1 == KErrNotSupported ) && |
|
577 ( err2 == KErrNotFound || err2 == KErrNotSupported )) |
|
578 { |
|
579 iType = vmbx.SelectTypeL( EVmbxDefine ); |
|
580 } |
|
581 else |
|
582 { |
|
583 iType = vmbx.SelectTypeL( EVmbxCall ); |
|
584 } |
|
585 |
|
586 if( iType == EVmbxIP && !vmbx.IsVoIPProfilesFound() ) |
|
587 { |
|
588 TInt err(vmbx.GetVmbxAddressL(aNumber)); |
|
589 if (err != KErrNone) |
|
590 { |
|
591 aNumber.Zero(); |
|
592 if (err != KErrNotFound || |
|
593 !vmbx.QueryAddressL(EVmbxNotDefinedQuery, aNumber)) |
|
594 { |
|
595 result = EFalse; |
|
596 } |
|
597 } |
|
598 } |
|
599 else if( iType == EVmbxVideo ) |
|
600 { |
|
601 TInt err(vmbx.GetVideoMbxNumber(aNumber)); |
|
602 if (err != KErrNone) |
|
603 { |
|
604 aNumber.Zero(); |
|
605 if (err != KErrNotFound ||!vmbx.QueryVideoMbxNumberL(EVmbxNotDefinedQuery, aNumber)) |
|
606 { |
|
607 result = EFalse; |
|
608 } |
|
609 } |
|
610 } |
|
611 else if(iType ==EVmbx) |
|
612 { |
|
613 TInt err(vmbx.GetVmbxNumber(aNumber)); |
|
614 if (err != KErrNone) |
|
615 { |
|
616 aNumber.Zero(); |
|
617 if (err != KErrNotFound || |
|
618 !vmbx.QueryNumberL(EVmbxNotDefinedQuery, aNumber)) |
|
619 { |
|
620 result = EFalse; |
|
621 } |
|
622 } |
|
623 } |
|
624 else |
|
625 { |
|
626 result = EFalse; |
|
627 } |
|
628 } |
|
629 else |
|
630 { |
|
631 ExVoiceMailL(aNumber); |
|
632 |
|
633 } |
|
634 |
|
635 } |
|
636 CleanupStack::PopAndDestroy(); // It will call vmbx.Close() |
|
637 return result; |
|
638 } |
|
639 |
|
640 // --------------------------------------------------------- |
|
641 // CSpeedDialPrivate::ExVoiceMailL |
|
642 // |
|
643 // --------------------------------------------------------- |
|
644 // |
|
645 EXPORT_C TBool CSpeedDialPrivate::ExVoiceMailL(TDes& aNumber) |
|
646 { |
|
647 TBool result(ETrue); |
|
648 RVmbxNumber vmbx; |
|
649 CleanupClosePushL(vmbx); // So that Close() is called if a leave happens. |
|
650 |
|
651 if (vmbx.Open() == KErrNone) |
|
652 { |
|
653 |
|
654 |
|
655 if( !vmbx.IsVoIPProfilesFound() && vmbx.SelectTypeL( EVmbxCall ) ) |
|
656 { |
|
657 iType = ETrue; |
|
658 TInt err(vmbx.GetVmbxAddressL(aNumber)); |
|
659 if (err != KErrNone) |
|
660 { |
|
661 if (err != KErrNotFound || |
|
662 !vmbx.QueryAddressL(EVmbxNotDefinedQuery, aNumber)) |
|
663 { |
|
664 result = EFalse; |
|
665 } |
|
666 } |
|
667 } |
|
668 else |
|
669 { |
|
670 iType = EFalse; |
|
671 TInt err(vmbx.GetVmbxNumber(aNumber)); |
|
672 if (err != KErrNone) |
|
673 { |
|
674 if (err != KErrNotFound || |
|
675 !vmbx.QueryNumberL(EVmbxNotDefinedQuery, aNumber)) |
|
676 { |
|
677 result = EFalse; |
|
678 } |
|
679 } |
|
680 } |
|
681 |
|
682 } |
|
683 CleanupStack::PopAndDestroy(); // It will call vmbx.Close() |
|
684 return result; |
|
685 } |
|
686 |
|
687 |
|
688 // --------------------------------------------------------- |
|
689 // CSpeedDialPrivate::ExVideoMailL |
|
690 // |
|
691 // --------------------------------------------------------- |
|
692 // |
|
693 |
|
694 EXPORT_C TBool CSpeedDialPrivate::ExVideoMailL(TDes& aNumber) |
|
695 { |
|
696 //TInt iVmbxsupported(0); |
|
697 |
|
698 TBool result(ETrue); |
|
699 |
|
700 |
|
701 RVmbxNumber vmbx; |
|
702 CleanupClosePushL(vmbx); // So that Close() is called if a leave happens. |
|
703 |
|
704 if(vmbx.Open() == KErrNone) |
|
705 { |
|
706 |
|
707 |
|
708 // if(vmbx.SelectTypeL( EVmbxCall )) |
|
709 { |
|
710 |
|
711 |
|
712 iType = EVmbxVideo; |
|
713 |
|
714 TInt err2 = vmbx.GetVideoMbxNumber( aNumber ); |
|
715 |
|
716 |
|
717 //#ifndef VIDEOMAILBOX_HIDDEN |
|
718 //ivmbxvariation->Get( KVideoMbxSupport, vmbxsupported ); |
|
719 if(iVmbxsupported) |
|
720 { |
|
721 |
|
722 |
|
723 if (err2 == KErrNotFound) |
|
724 { |
|
725 |
|
726 aNumber.Zero(); |
|
727 if (err2 != KErrNotFound ||!vmbx.QueryVideoMbxNumberL(EVmbxNotDefinedQuery, aNumber)) |
|
728 { |
|
729 result = EFalse; |
|
730 } |
|
731 } |
|
732 else |
|
733 { |
|
734 result = ETrue; |
|
735 } |
|
736 } |
|
737 else |
|
738 //Number is present and can be called |
|
739 if(err2 != KErrNotFound) |
|
740 { |
|
741 result = ETrue; |
|
742 } |
|
743 else |
|
744 { |
|
745 result = EFalse; |
|
746 } |
|
747 |
|
748 |
|
749 } |
|
750 } |
|
751 CleanupStack::PopAndDestroy(); // It will call vmbx.Close() |
|
752 return result; |
|
753 } |
|
754 // CSpeedDialPrivate::Index |
|
755 // |
|
756 // --------------------------------------------------------- |
|
757 // |
|
758 EXPORT_C TInt CSpeedDialPrivate::Index(TInt aDial) const |
|
759 { |
|
760 return (aDial - 1); |
|
761 } |
|
762 |
|
763 // --------------------------------------------------------- |
|
764 // CSpeedDialPrivate::IconArray |
|
765 // An interface for accessing index data array. |
|
766 // --------------------------------------------------------- |
|
767 // |
|
768 EXPORT_C CArrayPtr<CGulIcon>* CSpeedDialPrivate::IconArray() const |
|
769 { |
|
770 return iIconArray; |
|
771 } |
|
772 |
|
773 // --------------------------------------------------------- |
|
774 // CSpeedDialPrivate::Contact |
|
775 // --------------------------------------------------------- |
|
776 // |
|
777 |
|
778 EXPORT_C MVPbkStoreContact* CSpeedDialPrivate::Contact(TInt aIndex) |
|
779 { |
|
780 return (*iSdmArray)[aIndex].Contact(); |
|
781 } |
|
782 |
|
783 // --------------------------------------------------------- |
|
784 // CSpeedDialPrivate::Number |
|
785 // An interface for accessing index data array |
|
786 // --------------------------------------------------------- |
|
787 // |
|
788 EXPORT_C TInt CSpeedDialPrivate::Number(TInt aIndex) const |
|
789 { |
|
790 return (aIndex + 1); |
|
791 } |
|
792 |
|
793 // --------------------------------------------------------- |
|
794 // CSpeedDialPrivate::PhoneNumber |
|
795 // An interface for accessing index data array. |
|
796 // --------------------------------------------------------- |
|
797 // |
|
798 EXPORT_C const TDesC& CSpeedDialPrivate::PhoneNumber(TInt aIndex) const |
|
799 { |
|
800 return (*iSdmArray)[aIndex].PhoneNumber(); |
|
801 } |
|
802 |
|
803 // --------------------------------------------------------- |
|
804 // CSpeedDialPrivate::ThumbIndex |
|
805 // An interface for accessing index data array. |
|
806 // --------------------------------------------------------- |
|
807 // |
|
808 EXPORT_C TInt CSpeedDialPrivate::ThumbIndex(TInt aIndex) const |
|
809 { |
|
810 return (*iSdmArray)[aIndex].ThumbIndex(); |
|
811 } |
|
812 |
|
813 // --------------------------------------------------------- |
|
814 // CSpeedDialPrivate::CreateGridDataL |
|
815 // |
|
816 // --------------------------------------------------------- |
|
817 // |
|
818 EXPORT_C TBool CSpeedDialPrivate::CreateGridDataL( |
|
819 CAknGrid* aGrid, TBool aIndex ) |
|
820 { |
|
821 iGrid = aGrid; |
|
822 if ( iGridUsed == EGridNoUse ) |
|
823 { |
|
824 iGridUsed = EGridUse; |
|
825 } |
|
826 |
|
827 // The specified index is updated. |
|
828 if ( ( aIndex >= 0 ) && ( aIndex <= KMaxIndex ) ) |
|
829 { |
|
830 return UpdateIndexDataL( aIndex ); |
|
831 } |
|
832 |
|
833 CDesCArray* array = STATIC_CAST( CDesCArray*, aGrid->Model()->ItemTextArray() ); |
|
834 if ( aIndex == KNullIndexData ) |
|
835 { |
|
836 InitIndexDataL(); |
|
837 } |
|
838 TInt thumbCount = SetIconArrayL( iIconArray ); |
|
839 if ( thumbCount > 0 ) |
|
840 { |
|
841 SetOperationsL(); |
|
842 } |
|
843 |
|
844 TKeyArrayFix key( TSpdiaIndexDataVPbk::OffsetValue( TSpdiaIndexDataVPbk::EIndex ), ECmpTInt ); |
|
845 iSdmArray->Sort( key ); |
|
846 |
|
847 CFormattedCellListBoxData* list = aGrid->ItemDrawer()->FormattedCellData(); |
|
848 if ( list->IconArray() == NULL ) |
|
849 { |
|
850 aGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL( iIconArray ); |
|
851 } |
|
852 |
|
853 if ( thumbCount == 0 || State() != STATE_ASSIGN ) |
|
854 { |
|
855 // fill number icon, avoid flicker |
|
856 array->Reset(); |
|
857 SetItemDataL( *array ); |
|
858 if ( thumbCount == 0 ) |
|
859 DrawNow(); |
|
860 } |
|
861 return ETrue; |
|
862 |
|
863 } |
|
864 |
|
865 // --------------------------------------------------------- |
|
866 // CSpdiaContainer::SetLayout |
|
867 // |
|
868 // --------------------------------------------------------- |
|
869 // |
|
870 EXPORT_C void CSpeedDialPrivate::SetLayout(const TRect& aRect) |
|
871 { |
|
872 //Scalable UI. |
|
873 if(AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
874 { |
|
875 TRect mainPaneRect ; |
|
876 TRect statusPaneRect; |
|
877 TAknLayoutRect mainQdialRect; |
|
878 TAknLayoutRect gridQdialPaneRect; |
|
879 TAknLayoutRect cellQdialPaneRect; |
|
880 TAknWindowLineLayout cellQdialPane; |
|
881 TInt varient =0; |
|
882 |
|
883 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
884 { |
|
885 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
886 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
887 mainPaneRect.iTl = statusPaneRect.iTl; |
|
888 mainPaneRect.iBr.iY = mainPaneRect.iBr.iY - statusPaneRect.iTl.iY; |
|
889 varient =1; |
|
890 } |
|
891 else |
|
892 { |
|
893 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
894 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
895 mainPaneRect.iTl= statusPaneRect.iTl; |
|
896 } |
|
897 |
|
898 SetRect(mainPaneRect); |
|
899 |
|
900 mainQdialRect.LayoutRect(mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane().LayoutLine()); |
|
901 gridQdialPaneRect.LayoutRect(mainQdialRect.Rect(),AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine()); |
|
902 cellQdialPaneRect.LayoutRect(gridQdialPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(0,0).LayoutLine()); |
|
903 cellQdialPane = AknLayoutScalable_Apps::cell_qdial_pane_g4(varient).LayoutLine(); |
|
904 |
|
905 TInt Cnt = 0; |
|
906 |
|
907 for(TInt rowSize=0;rowSize < 3; rowSize++) |
|
908 { |
|
909 for(TInt column=0;column < 3; column++) |
|
910 { |
|
911 icellLayout[Cnt].LayoutRect(gridQdialPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(column,rowSize).LayoutLine()); |
|
912 Cnt ++ ; |
|
913 } |
|
914 |
|
915 } |
|
916 |
|
917 |
|
918 (*iShadowLayout)[CSpdiaGridVPbk::EtnCIF].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane); |
|
919 |
|
920 (*iShadowLayout)[CSpdiaGridVPbk::EtnVGA90].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane); |
|
921 |
|
922 (*iShadowLayout)[CSpdiaGridVPbk::EtnVGA].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane); |
|
923 |
|
924 (*iShadowLayout)[CSpdiaGridVPbk::EtnCOM].LayoutRect(cellQdialPaneRect.Rect(),cellQdialPane); |
|
925 |
|
926 |
|
927 } |
|
928 else |
|
929 { |
|
930 TAknWindowLineLayout lScr = AknLayout::screen(); |
|
931 TAknWindowLineLayout lCtrlPane = AknLayout::control_pane(TRect( TPoint(lScr.il, lScr.it), TSize(lScr.iW, lScr.iH) )); |
|
932 SetRect(TRect( TPoint(lScr.il, lScr.it), TSize(lScr.iW, lScr.iH - lCtrlPane.iH) ) ); |
|
933 |
|
934 (*iShadowLayout)[CSpdiaGridVPbk::EtnCIF90].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_1()); |
|
935 (*iShadowLayout)[CSpdiaGridVPbk::EtnCIF].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_4()); |
|
936 (*iShadowLayout)[CSpdiaGridVPbk::EtnVGA90].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_7()); |
|
937 (*iShadowLayout)[CSpdiaGridVPbk::EtnVGA].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_10()); |
|
938 (*iShadowLayout)[CSpdiaGridVPbk::EtnCOM].LayoutRect(aRect,AppLayout::Cell_pane_elements__qdial__Line_13()); |
|
939 } |
|
940 } |
|
941 |
|
942 |
|
943 // --------------------------------------------------------- |
|
944 // CSpeedDialPrivate::VMBoxPosition |
|
945 // |
|
946 // --------------------------------------------------------- |
|
947 // |
|
948 EXPORT_C TInt CSpeedDialPrivate::VMBoxPosition() const |
|
949 { |
|
950 return KVoiceMail; |
|
951 } |
|
952 |
|
953 // --------------------------------------------------------- |
|
954 // CSpeedDialPrivate::VdoMBoxPosition |
|
955 // |
|
956 // --------------------------------------------------------- |
|
957 // |
|
958 EXPORT_C TInt CSpeedDialPrivate::VdoMBoxPosition() const |
|
959 { |
|
960 if ( !iVmbxsupported ) |
|
961 { |
|
962 // Video Mailbox feature is disabled |
|
963 return KErrNone; |
|
964 } |
|
965 |
|
966 if ( iVmbxkeypos ) |
|
967 { |
|
968 return iVmbxkeypos - 1; |
|
969 } |
|
970 |
|
971 return KErrNone; |
|
972 } |
|
973 //CSpeedDialPrivate::SpdIconIndex |
|
974 // An interface for accessing index data array. |
|
975 // --------------------------------------------------------- |
|
976 // |
|
977 EXPORT_C TInt CSpeedDialPrivate::SpdIconIndex(TInt aIndex) const |
|
978 { |
|
979 return (*iSdmArray)[aIndex].IconIndex(); |
|
980 } |
|
981 |
|
982 |
|
983 // --------------------------------------------------------- |
|
984 // CSpeedDialPrivate::DeleteIconArray |
|
985 // Deletes the old icons. |
|
986 // --------------------------------------------------------- |
|
987 EXPORT_C void CSpeedDialPrivate::DeleteIconArray() |
|
988 { |
|
989 if(iIconArray) |
|
990 { |
|
991 iIconArray->ResetAndDestroy(); |
|
992 delete iIconArray; |
|
993 iIconArray = NULL; |
|
994 } |
|
995 } |
|
996 |
|
997 // --------------------------------------------------------- |
|
998 // CSpeedDialPrivate::ReloadIconArray |
|
999 // Reloads the new skin icons. |
|
1000 // --------------------------------------------------------- |
|
1001 EXPORT_C void CSpeedDialPrivate::ReloadIconArray() |
|
1002 { |
|
1003 TRAPD(err, |
|
1004 { |
|
1005 if (iGrid) |
|
1006 { |
|
1007 if(NULL == iIconArray) |
|
1008 { |
|
1009 iIconArray = new (ELeave)CAknIconArray(iSdmCount); |
|
1010 } |
|
1011 |
|
1012 if ( SetIconArrayL( iIconArray ) > 0 ) |
|
1013 { |
|
1014 SetOperationsL(); |
|
1015 } |
|
1016 |
|
1017 iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL( iIconArray ); |
|
1018 } |
|
1019 }); |
|
1020 |
|
1021 //Just to avoid warning.. |
|
1022 if(err) |
|
1023 { |
|
1024 |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 // --------------------------------------------------------- |
|
1029 // CSpeedDialPrivate::SetIconArrayL |
|
1030 // |
|
1031 // --------------------------------------------------------- |
|
1032 TInt CSpeedDialPrivate::SetIconArrayL(CArrayPtrFlat<CGulIcon>* aArray) |
|
1033 { |
|
1034 CFbsBitmap* bitmap,*mask; |
|
1035 bitmap = NULL; |
|
1036 mask= NULL; |
|
1037 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
1038 |
|
1039 if ( aArray != NULL ) |
|
1040 { |
|
1041 aArray->ResetAndDestroy(); |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 return 0; |
|
1046 } |
|
1047 |
|
1048 TInt existThumb(0); |
|
1049 for (TInt index(0); index < iSdmArray->Count(); index++) |
|
1050 { |
|
1051 if(index == 0) |
|
1052 { |
|
1053 TUid uidVmbx; |
|
1054 uidVmbx.iUid =KVmbxUid; |
|
1055 AknsUtils::CreateAppIconLC( skinInstance,uidVmbx, EAknsAppIconTypeContext,bitmap ,mask); |
|
1056 CleanupStack::Pop(2); |
|
1057 } |
|
1058 else |
|
1059 { |
|
1060 if(User::Language() == ELangHindi) |
|
1061 { |
|
1062 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,iDialHindiBmp[index], iDialHindiBmpMask[index] ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,iDialBmp[index], iDialBmpMask[index] ); |
|
1067 } |
|
1068 } |
|
1069 CGulIcon* icon = CGulIcon::NewL(bitmap,mask); |
|
1070 CleanupStack::PushL(icon); |
|
1071 aArray->AppendL(icon); |
|
1072 |
|
1073 if (CreateIndexIconL(index, |
|
1074 (*iSdmArray)[index], existThumb > 0? EFalse: ETrue)) |
|
1075 { |
|
1076 ++existThumb; |
|
1077 } |
|
1078 CleanupStack::Pop(); // icon |
|
1079 } |
|
1080 |
|
1081 CreateFieldIconsL(aArray); |
|
1082 |
|
1083 return existThumb; |
|
1084 } |
|
1085 |
|
1086 |
|
1087 // --------------------------------------------------------- |
|
1088 // CSpeedDialPrivate::VoiceMailTypeL |
|
1089 // |
|
1090 // --------------------------------------------------------- |
|
1091 // |
|
1092 EXPORT_C TInt CSpeedDialPrivate::VoiceMailType() |
|
1093 { |
|
1094 return iType; |
|
1095 } |
|
1096 |
|
1097 // --------------------------------------------------------- |
|
1098 // CSpeedDialPrivate::GetSpdCtrlLastError() |
|
1099 // retuns last error |
|
1100 // --------------------------------------------------------- |
|
1101 // |
|
1102 EXPORT_C TInt CSpeedDialPrivate::GetSpdCtrlLastError() |
|
1103 { |
|
1104 return iError; |
|
1105 } |
|
1106 |
|
1107 // --------------------------------------------------------- |
|
1108 // CSpdiaContainer::Draw |
|
1109 // |
|
1110 // --------------------------------------------------------- |
|
1111 // |
|
1112 void CSpeedDialPrivate::Draw(const TRect& /*aRect*/) const |
|
1113 { |
|
1114 CWindowGc& gc = SystemGc(); |
|
1115 AknsDrawUtils::Background( |
|
1116 AknsUtils::SkinInstance(), |
|
1117 AknsDrawUtils::ControlContext(this), |
|
1118 this, |
|
1119 gc, |
|
1120 Rect() ); |
|
1121 } |
|
1122 |
|
1123 // --------------------------------------------------------- |
|
1124 // CSpeedDialPrivate::SizeChanged() |
|
1125 // |
|
1126 // --------------------------------------------------------- |
|
1127 // |
|
1128 void CSpeedDialPrivate::SizeChanged() |
|
1129 { |
|
1130 iBgContext->SetRect( Rect() ); |
|
1131 } |
|
1132 |
|
1133 // --------------------------------------------------------- |
|
1134 // CSpeedDialPrivate::MopSupplyObject() |
|
1135 // Pass skin information if need. |
|
1136 // --------------------------------------------------------- |
|
1137 // |
|
1138 TTypeUid::Ptr CSpeedDialPrivate::MopSupplyObject(TTypeUid aId) |
|
1139 { |
|
1140 if(aId.iUid == MAknsControlContext::ETypeId) |
|
1141 { |
|
1142 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
1143 } |
|
1144 return CCoeControl::MopSupplyObject( aId ); |
|
1145 } |
|
1146 |
|
1147 // --------------------------------------------------------- |
|
1148 // CSpeedDialPrivate::NumberType |
|
1149 // An interface for accessing phone number type. |
|
1150 // Number types are defined in PbkFields.hrh. |
|
1151 // --------------------------------------------------------- |
|
1152 // |
|
1153 EXPORT_C TInt CSpeedDialPrivate::NumberType(TInt aIndex) const |
|
1154 { |
|
1155 TInt retVal = ESpDialPbkFieldIdNone; |
|
1156 TInt fieldId = -1; |
|
1157 MVPbkStoreContactField* field = (*iSdmArray)[aIndex].Field(); |
|
1158 |
|
1159 if(field) |
|
1160 { |
|
1161 fieldId = field->BestMatchingFieldType()->FieldTypeResId(); |
|
1162 |
|
1163 switch(fieldId) |
|
1164 { |
|
1165 case R_VPBK_FIELD_TYPE_VIDEONUMBERHOME: |
|
1166 case R_VPBK_FIELD_TYPE_VIDEONUMBERWORK: |
|
1167 case R_VPBK_FIELD_TYPE_VIDEONUMBERGEN: |
|
1168 retVal = ESpDialPbkFieldIdPhoneNumberVideo; |
|
1169 break; |
|
1170 case R_VPBK_FIELD_TYPE_VOIPHOME: |
|
1171 case R_VPBK_FIELD_TYPE_VOIPWORK: |
|
1172 case R_VPBK_FIELD_TYPE_VOIPGEN: |
|
1173 case R_VPBK_FIELD_TYPE_IMPP: |
|
1174 retVal = ESpDialPbkFieldIdVOIP; |
|
1175 break; |
|
1176 default: |
|
1177 retVal = ESpDialPbkFieldIdPhoneGeneral; |
|
1178 } |
|
1179 } |
|
1180 return retVal; |
|
1181 } |
|
1182 |
|
1183 // --------------------------------------------------------- |
|
1184 // CSpeedDialPrivate::DrawShadow |
|
1185 // |
|
1186 // --------------------------------------------------------- |
|
1187 // |
|
1188 void CSpeedDialPrivate::DrawShadow(CWindowGc& aGc) const |
|
1189 { |
|
1190 //TSize size(cell_spdia_item_w, cell_spdia_item_h); |
|
1191 //Scalable UI. |
|
1192 TAknWindowLineLayout area; |
|
1193 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1194 { |
|
1195 area = AknLayoutScalable_Apps::cell_qdial_pane(0,0).LayoutLine(); |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 area = AppLayout::cell_qdial_pane(0,0); |
|
1200 } |
|
1201 |
|
1202 TSize size(area.iW, area.iH); |
|
1203 aGc.SetPenColor(AKN_LAF_COLOR(SDM_TN_SHADOW_COROL)); |
|
1204 TInt count(iSdmArray->Count()); |
|
1205 //TRect rect(TPoint(spdia_main_pane_grid_l, spdia_main_pane_grid_t), size); |
|
1206 //Scalable UI |
|
1207 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1208 { |
|
1209 area = AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine(); |
|
1210 } |
|
1211 else |
|
1212 { |
|
1213 area = AppLayout::Speed_Dial_descendants_Line_1(); |
|
1214 } |
|
1215 TRect rect(TPoint(area.il, area.it), size); |
|
1216 for (TInt i(0); i < count; ++i) |
|
1217 { |
|
1218 if (ThumbIndex(i) >= 0) |
|
1219 { |
|
1220 TInt type(ThumbType(i)); |
|
1221 TRect rc((*iShadowLayout)[type].Rect()); |
|
1222 if (type == CSpdiaGridVPbk::EtnCOM) |
|
1223 { |
|
1224 TSize image(ThumbSize(i)); |
|
1225 image.iWidth = Min(image.iWidth, rc.Width()); |
|
1226 image.iHeight = Min(image.iHeight, rc.Height()); |
|
1227 rc = TRect(TPoint(0,0), image); |
|
1228 // Correct the x and y to the accurate values. |
|
1229 TInt x(Max(0, (size.iWidth - image.iWidth) / 2) + 3); |
|
1230 TInt y(Max(0, (size.iHeight - image.iHeight) / 2) - 2); |
|
1231 rc.Move(x, y); |
|
1232 } |
|
1233 rc.Move(rect.iTl.iX, rect.iTl.iY); |
|
1234 aGc.DrawRect(rc); |
|
1235 } |
|
1236 rect.Move(size.iWidth, 0); |
|
1237 if (((i + 1)/ KCellColCount) * KCellRowCount == i + 1) |
|
1238 { |
|
1239 rect.Move(-(KCellColCount * size.iWidth), size.iHeight); |
|
1240 } |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 // --------------------------------------------------------- |
|
1245 // CSpeedDialPrivate::CheckingIfPopUpNeededL |
|
1246 // Internal rutine to check if pop up has to be shown |
|
1247 // to enable the One-Key-Dialling setting. |
|
1248 // --------------------------------------------------------- |
|
1249 // |
|
1250 |
|
1251 EXPORT_C TBool CSpeedDialPrivate::CheckingIfPopUpNeededL() |
|
1252 { |
|
1253 TBool gridEmpty( ETrue ); |
|
1254 TInt gridIndex( 1 ); |
|
1255 TInt value; |
|
1256 TBool result( ETrue ); |
|
1257 |
|
1258 CRepository* repository = CRepository::NewL( KCRUidTelephonySettings ); |
|
1259 repository->Get( KSettingsOneKeyDialling, value ); |
|
1260 |
|
1261 if ( value == 0 ) |
|
1262 { |
|
1263 while ( ( gridIndex < 9 ) && gridEmpty ) |
|
1264 { |
|
1265 if ( ( *iSdmArray )[ gridIndex ].Contact() != NULL ) |
|
1266 { |
|
1267 gridEmpty = EFalse; |
|
1268 } |
|
1269 ++gridIndex; |
|
1270 } |
|
1271 result = gridEmpty; |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 result = EFalse; |
|
1276 } |
|
1277 delete repository; |
|
1278 return result; |
|
1279 } |
|
1280 |
|
1281 // --------------------------------------------------------- |
|
1282 // CSpeedDialPrivate::Pbk2ImageGetComplete |
|
1283 // |
|
1284 // --------------------------------------------------------- |
|
1285 // |
|
1286 void CSpeedDialPrivate::Pbk2ImageGetComplete |
|
1287 (MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap) |
|
1288 { |
|
1289 TRAP_IGNORE(Pbk2ImageGetCompleteL(aOperation, aBitmap)); |
|
1290 } |
|
1291 |
|
1292 // --------------------------------------------------------- |
|
1293 // CSpeedDialPrivate::Pbk2ImageGetCompleteL |
|
1294 // |
|
1295 // --------------------------------------------------------- |
|
1296 // |
|
1297 void CSpeedDialPrivate::Pbk2ImageGetCompleteL |
|
1298 (MPbk2ImageOperation& aOperation, CFbsBitmap* aBitmap) |
|
1299 { |
|
1300 |
|
1301 //for async call |
|
1302 TInt index(HasImageOperation(aOperation)); |
|
1303 |
|
1304 if (index != KNullIndexData) |
|
1305 { |
|
1306 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
1307 { |
|
1308 CAknIcon* icon = CAknIcon::NewL(); |
|
1309 icon->SetBitmap(aBitmap); |
|
1310 |
|
1311 // create mask |
|
1312 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
|
1313 |
|
1314 TSize size = aBitmap->SizeInPixels(); |
|
1315 mask->Create(size,EGray2); |
|
1316 |
|
1317 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
1318 CleanupStack::PushL( fbsBitGc ); |
|
1319 CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( mask ); |
|
1320 CleanupStack::PushL( bmpDevice ); |
|
1321 bmpDevice->Resize( size ); |
|
1322 fbsBitGc->Activate( bmpDevice ); |
|
1323 |
|
1324 fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
1325 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1326 |
|
1327 fbsBitGc->SetBrushColor(KRgbBlack); |
|
1328 fbsBitGc->DrawRect( TRect( size ) ); |
|
1329 |
|
1330 CleanupStack::PopAndDestroy( 2, fbsBitGc ); // bmpDevice and fbsBitGc |
|
1331 |
|
1332 icon->SetMask(mask); |
|
1333 |
|
1334 // this creates both scalable icon and mask |
|
1335 CAknIcon* scaledIcon = AknIconUtils::CreateIconL(icon); |
|
1336 |
|
1337 TSize thumbnailSize = GetThumbnailSize(); |
|
1338 |
|
1339 AknIconUtils::SetSize(scaledIcon->Bitmap(),thumbnailSize,EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1340 AknIconUtils::SetSize(scaledIcon->Mask(),thumbnailSize,EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1341 |
|
1342 CFbsBitmap* bmp = new (ELeave) CFbsBitmap(); |
|
1343 CFbsBitmap* msk = new (ELeave) CFbsBitmap(); |
|
1344 TInt err = msk->Duplicate( scaledIcon->Mask()->Handle() ); |
|
1345 TInt err1 = bmp->Duplicate( scaledIcon->Bitmap()->Handle() ); |
|
1346 |
|
1347 delete ( *iIconArray )[index]; |
|
1348 ( *iIconArray )[index] = NULL; |
|
1349 ( *iIconArray )[index] = CGulIcon::NewL( bmp, msk ); |
|
1350 // set the text array of grid |
|
1351 ( *iSdmArray )[index].SetThumbIndex( index, bmp ); |
|
1352 delete scaledIcon; |
|
1353 } |
|
1354 |
|
1355 else |
|
1356 { |
|
1357 // set the scaled bitmap to the array of icons |
|
1358 delete ( *iIconArray )[index]; |
|
1359 ( *iIconArray )[index] = NULL; |
|
1360 ( *iIconArray )[index] = CGulIcon::NewL( aBitmap ); |
|
1361 // set the text array of grid |
|
1362 ( *iSdmArray )[index].SetThumbIndex( index, aBitmap ); |
|
1363 } |
|
1364 |
|
1365 if ( ( *iSdmArray )[index].LastThumb() ) |
|
1366 { |
|
1367 CDesCArray* array = STATIC_CAST( CDesCArray*, iGrid->Model()->ItemTextArray() ); |
|
1368 array->Reset(); |
|
1369 SetItemDataL( *array ); |
|
1370 DrawNow(); |
|
1371 } |
|
1372 delete &aOperation; |
|
1373 ( *iSdmArray )[index].SetImageOperation( NULL ); |
|
1374 } |
|
1375 |
|
1376 iOperationComplete = ETrue; |
|
1377 Release(); |
|
1378 } |
|
1379 |
|
1380 |
|
1381 // --------------------------------------------------------- |
|
1382 // CSpeedDialPrivate::Pbk2ImageGetFailed |
|
1383 // |
|
1384 // --------------------------------------------------------- |
|
1385 // |
|
1386 void CSpeedDialPrivate::Pbk2ImageGetFailed |
|
1387 ( MPbk2ImageOperation& aOperation, |
|
1388 TInt aError ) |
|
1389 { |
|
1390 iError = aError; |
|
1391 TInt index( HasImageOperation( aOperation ) ); |
|
1392 if ( index != KNullIndexData ) |
|
1393 { |
|
1394 delete &aOperation; |
|
1395 ( *iSdmArray )[index].SetImageOperation( NULL ); |
|
1396 if ( ( *iSdmArray )[index].LastThumb() ) |
|
1397 { |
|
1398 CDesCArray* array = STATIC_CAST( CDesCArray*, iGrid->Model()->ItemTextArray() ); |
|
1399 array->Reset(); |
|
1400 TRAP_IGNORE( SetItemDataL( *array ) ); |
|
1401 DrawNow(); |
|
1402 } |
|
1403 } |
|
1404 iOperationComplete = ETrue; |
|
1405 Release(); |
|
1406 } |
|
1407 |
|
1408 |
|
1409 // --------------------------------------------------------- |
|
1410 // CSpeedDialPrivate::HasImageOperation |
|
1411 // |
|
1412 // --------------------------------------------------------- |
|
1413 // |
|
1414 TInt CSpeedDialPrivate::HasImageOperation(MPbk2ImageOperation& aOperation) |
|
1415 { |
|
1416 TInt index = KNullIndexData; |
|
1417 for(TInt count =0; count < iSdmArray->Count() && index == KNullIndexData; ++count) |
|
1418 { |
|
1419 if ((*iSdmArray)[count].ImageOperation() == &aOperation) |
|
1420 { |
|
1421 index = count; |
|
1422 } |
|
1423 } |
|
1424 return index; |
|
1425 } |
|
1426 |
|
1427 // --------------------------------------------------------- |
|
1428 // CSpeedDialPrivate::SetDetails |
|
1429 // |
|
1430 // --------------------------------------------------------- |
|
1431 // |
|
1432 void CSpeedDialPrivate::SetDetails(TInt aIndex) |
|
1433 { |
|
1434 MVPbkStoreContactField* field = (*iSdmArray)[aIndex].Field(); |
|
1435 |
|
1436 if(field != NULL) |
|
1437 { |
|
1438 HBufC* number = NULL; |
|
1439 TRAP_IGNORE( |
|
1440 { |
|
1441 TVPbkFieldStorageType dataType = field->FieldData().DataType(); |
|
1442 |
|
1443 switch( dataType ) |
|
1444 { |
|
1445 case EVPbkFieldStorageTypeText: |
|
1446 { |
|
1447 const MVPbkContactFieldTextData& data = MVPbkContactFieldTextData::Cast( field->FieldData() ); |
|
1448 number = data.Text().AllocLC(); |
|
1449 break; |
|
1450 } |
|
1451 case EVPbkFieldStorageTypeUri: |
|
1452 { |
|
1453 const MVPbkContactFieldUriData& data = MVPbkContactFieldUriData::Cast( field->FieldData() ); |
|
1454 number = data.Text().AllocLC(); |
|
1455 break; |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 if (number != NULL) |
|
1460 { |
|
1461 //store the phone numbers in a array and cast those to TPhCltTelephoneNumber. |
|
1462 (*iSdmArray)[aIndex].SetPhoneNumber(*number); |
|
1463 CleanupStack::PopAndDestroy( number ); |
|
1464 } |
|
1465 |
|
1466 //Push |
|
1467 const MVPbkFieldType* fieldType = field->BestMatchingFieldType(); |
|
1468 TInt iconindex = FindIconIndex(fieldType->FieldTypeResId()); |
|
1469 (*iSdmArray)[aIndex].SetIconIndex(iconindex); |
|
1470 |
|
1471 //No need to fetch thumbnail now...will be updated while grid is |
|
1472 // drawn |
|
1473 (*iSdmArray)[aIndex].SetThumbIndex(-1,NULL); |
|
1474 } |
|
1475 ); |
|
1476 } |
|
1477 |
|
1478 } |
|
1479 // --------------------------------------------------------- |
|
1480 // CSpeedDialPrivate::AttributeOperationComplete |
|
1481 // |
|
1482 // --------------------------------------------------------- |
|
1483 // |
|
1484 |
|
1485 void CSpeedDialPrivate::AttributeOperationComplete( MVPbkContactOperationBase& aOperation) |
|
1486 { |
|
1487 |
|
1488 TInt index = HasOperation(&aOperation); |
|
1489 |
|
1490 //for async call |
|
1491 if (index != KNullIndexData) |
|
1492 { |
|
1493 TSpdiaIndexDataVPbk::TOperation operation = (*iSdmArray)[index].Operation(); |
|
1494 //MVPbkStoreContactField* field = (*iSdmArray)[index].Field(); |
|
1495 |
|
1496 switch(operation) |
|
1497 { |
|
1498 case TSpdiaIndexDataVPbk::OPERATION_ASSIGN: |
|
1499 |
|
1500 TRAPD(err, |
|
1501 { |
|
1502 |
|
1503 HBufC* prompt = StringLoader::LoadLC(R_SPDIA_TEXT_KEY_ASSIGNED, index+1, iCoeEnv); |
|
1504 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote(); |
|
1505 note->ExecuteLD(*prompt); |
|
1506 |
|
1507 CleanupStack::PopAndDestroy(prompt); |
|
1508 }); |
|
1509 if(err == KErrNone) |
|
1510 { |
|
1511 SetDetails(index); |
|
1512 } |
|
1513 |
|
1514 break; |
|
1515 |
|
1516 case TSpdiaIndexDataVPbk::OPERATION_REMOVE: |
|
1517 (*iSdmArray)[index].Reset(); |
|
1518 |
|
1519 break; |
|
1520 |
|
1521 case TSpdiaIndexDataVPbk::OPERATION_NONE: |
|
1522 |
|
1523 //Error Handling |
|
1524 |
|
1525 break; |
|
1526 |
|
1527 |
|
1528 } |
|
1529 |
|
1530 iOperationComplete = ETrue; |
|
1531 Release(); |
|
1532 |
|
1533 } |
|
1534 |
|
1535 // CleanupStack::PopAndDestroy(); |
|
1536 } |
|
1537 |
|
1538 // --------------------------------------------------------- |
|
1539 // CSpeedDialPrivate::AttributeOperationFailed |
|
1540 // |
|
1541 // --------------------------------------------------------- |
|
1542 // |
|
1543 void CSpeedDialPrivate::AttributeOperationFailed(MVPbkContactOperationBase& aOperation, TInt aError) |
|
1544 { |
|
1545 |
|
1546 TInt index(HasOperation(&aOperation)); |
|
1547 |
|
1548 if (index != KNullIndexData) |
|
1549 { |
|
1550 TSpdiaIndexDataVPbk::TOperation operation = (*iSdmArray)[index].Operation(); |
|
1551 |
|
1552 switch(operation) |
|
1553 { |
|
1554 case TSpdiaIndexDataVPbk::OPERATION_ASSIGN: |
|
1555 (*iSdmArray)[index].Reset(); |
|
1556 break; |
|
1557 |
|
1558 case TSpdiaIndexDataVPbk::OPERATION_REMOVE: |
|
1559 (*iSdmArray)[index].Reset(); |
|
1560 break; |
|
1561 |
|
1562 default: |
|
1563 delete &aOperation; |
|
1564 } |
|
1565 iError = aError; |
|
1566 iOperationComplete = ETrue; |
|
1567 Release(); |
|
1568 |
|
1569 } |
|
1570 |
|
1571 |
|
1572 } |
|
1573 |
|
1574 |
|
1575 // --------------------------------------------------------- |
|
1576 // CSpeedDialPrivate::HasOperation |
|
1577 // |
|
1578 // --------------------------------------------------------- |
|
1579 // |
|
1580 TInt CSpeedDialPrivate::HasOperation(MVPbkContactOperationBase* aContactOpertion) |
|
1581 { |
|
1582 TInt i=0, index = KNullIndexData; |
|
1583 for(i=0;i<iSdmArray->Count() && index == KNullIndexData;++i) |
|
1584 { |
|
1585 if ((*iSdmArray)[i].HasOperation(aContactOpertion)) |
|
1586 { |
|
1587 index =i; |
|
1588 } |
|
1589 } |
|
1590 |
|
1591 return index; |
|
1592 } |
|
1593 |
|
1594 |
|
1595 // --------------------------------------------------------- |
|
1596 // CSpeedDialPrivate::EMail |
|
1597 // |
|
1598 // --------------------------------------------------------- |
|
1599 // |
|
1600 EXPORT_C HBufC* CSpeedDialPrivate::EMail( MVPbkStoreContact* aContact ) |
|
1601 { |
|
1602 |
|
1603 TUint fetchFlags = 0; |
|
1604 iMail = NULL; |
|
1605 iFetchmail = ETrue; |
|
1606 // Set service data |
|
1607 TAiwSingleItemSelectionDataV3 data; |
|
1608 |
|
1609 data.SetFlags(fetchFlags); |
|
1610 data.SetCommAddressSelectType(EAiwCommEmailEditor); |
|
1611 TRAP_IGNORE( |
|
1612 { |
|
1613 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
1614 inParamList.AppendL(TAiwGenericParam(EGenericParamContactSelectionData, |
|
1615 TAiwVariant(TAiwSingleItemSelectionDataV3Pckg(data)))); |
|
1616 |
|
1617 MVPbkContactLinkArray* linkArray = NULL; |
|
1618 CVPbkContactLinkArray* array = CVPbkContactLinkArray::NewLC(); |
|
1619 MVPbkContactLink* ContactLink = aContact->CreateLinkLC(); |
|
1620 CleanupStack::Pop(); |
|
1621 array->AppendL(ContactLink); |
|
1622 linkArray = array; |
|
1623 |
|
1624 HBufC8* PackLink = linkArray->PackLC(); |
|
1625 inParamList.AppendL(TAiwGenericParam(EGenericParamContactLinkArray, |
|
1626 TAiwVariant(*PackLink))); |
|
1627 CleanupStack::PopAndDestroy();//PackLink |
|
1628 CleanupStack::PopAndDestroy();//linkArray |
|
1629 CAiwGenericParamList& outParamList = iServiceHandler->OutParamListL(); |
|
1630 iServiceHandler->ExecuteServiceCmdL(KAiwCmdSelect, inParamList, |
|
1631 outParamList, 0, this); |
|
1632 } |
|
1633 ); |
|
1634 iOperationComplete = EFalse; |
|
1635 // Wait till the contact is selected |
|
1636 while ( !iOperationComplete ) |
|
1637 { |
|
1638 Wait(); |
|
1639 } |
|
1640 iFetchmail = EFalse; |
|
1641 return iMail; |
|
1642 } |
|
1643 |
|
1644 // --------------------------------------------------------- |
|
1645 // CSpeedDialPrivate::SetSpeedDialIndexL |
|
1646 // |
|
1647 // --------------------------------------------------------- |
|
1648 // |
|
1649 void CSpeedDialPrivate::SetSpeedDialIndexL(MVPbkStoreContact* aContact) |
|
1650 { |
|
1651 TInt count =0; |
|
1652 TInt index = KNullIndexData; |
|
1653 |
|
1654 // Do a linear search to find which is the speeddial index |
|
1655 // stored in this field. |
|
1656 for(count =0; count<KArraySize && index ==KNullIndexData; ++count) |
|
1657 { |
|
1658 // Compare with every speeddial attribute |
|
1659 iSpeedDial->SetIndex(count+1); |
|
1660 |
|
1661 //If the index is not assigned already.. |
|
1662 if((*iSdmArray)[count].Contact() == NULL) |
|
1663 { |
|
1664 MVPbkStoreContactFieldCollection* fieldCollection = iAttributeManager->FindFieldsWithAttributeLC( |
|
1665 *(iSpeedDial), *aContact); |
|
1666 if(fieldCollection && (fieldCollection->FieldCount() > 0)) |
|
1667 { |
|
1668 index = count; |
|
1669 |
|
1670 MVPbkStoreContactField& field = fieldCollection->FieldAt(0); |
|
1671 |
|
1672 (*iSdmArray)[index].SetContactLink(field.CreateLinkLC()); |
|
1673 (*iSdmArray)[index].SetContact(aContact); |
|
1674 CleanupStack::Pop(); |
|
1675 |
|
1676 TVPbkFieldStorageType dataType = field.FieldData().DataType(); |
|
1677 HBufC* number = NULL; |
|
1678 switch( dataType ) |
|
1679 { |
|
1680 case EVPbkFieldStorageTypeText: |
|
1681 { |
|
1682 const MVPbkContactFieldTextData& data = MVPbkContactFieldTextData::Cast( field.FieldData() ); |
|
1683 number = data.Text().AllocLC(); |
|
1684 break; |
|
1685 } |
|
1686 case EVPbkFieldStorageTypeUri: |
|
1687 { |
|
1688 const MVPbkContactFieldUriData& data = MVPbkContactFieldUriData::Cast( field.FieldData() ); |
|
1689 number = data.Text().AllocLC(); |
|
1690 break; |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 if ( number != NULL ) |
|
1695 { |
|
1696 TPhCltTelephoneNumber phonenumber(*number); |
|
1697 phonenumber.Trim(); |
|
1698 CleanupStack::PopAndDestroy( number ); |
|
1699 //store the phone numbers in a array and cast those to TPhCltTelephoneNumber. |
|
1700 if(phonenumber.Length() > 0) |
|
1701 { |
|
1702 (*iSdmArray)[index].SetPhoneNumber(phonenumber); |
|
1703 } |
|
1704 } |
|
1705 else |
|
1706 { |
|
1707 //Remove SpeedDial |
|
1708 } |
|
1709 } |
|
1710 |
|
1711 CleanupStack::PopAndDestroy(); // Pop and Destroy FieldCollection |
|
1712 |
|
1713 } |
|
1714 } |
|
1715 //Delete if we are not using that contact.. |
|
1716 if(KNullIndexData == index) |
|
1717 { |
|
1718 delete aContact; |
|
1719 } |
|
1720 |
|
1721 } |
|
1722 |
|
1723 // --------------------------------------------------------- |
|
1724 // CSpeedDialPrivate::VPbkSingleContactOperationComplete() |
|
1725 // |
|
1726 // --------------------------------------------------------- |
|
1727 void CSpeedDialPrivate::VPbkSingleContactOperationComplete( MVPbkContactOperationBase& aOperation, |
|
1728 MVPbkStoreContact* aContact) |
|
1729 { |
|
1730 |
|
1731 if (iState == STATE_INITIAL) |
|
1732 { |
|
1733 TRAP_IGNORE(SetSpeedDialIndexL(aContact)); |
|
1734 iRetrieveComplete = ETrue; |
|
1735 Release(); |
|
1736 } |
|
1737 else if(iState == STATE_CONTACTCHANGE) |
|
1738 { |
|
1739 iContact = aContact; |
|
1740 iRetrieveComplete = ETrue; |
|
1741 Release(); |
|
1742 } |
|
1743 else |
|
1744 { |
|
1745 |
|
1746 TInt index = HasOperation(&aOperation); |
|
1747 |
|
1748 if (index != KNullIndexData) |
|
1749 { |
|
1750 TSpdiaIndexDataVPbk::TOperation operation = (*iSdmArray)[index].Operation(); |
|
1751 if(TSpdiaIndexDataVPbk::OPERATION_ASSIGN == operation) |
|
1752 { |
|
1753 |
|
1754 // Store the contact and field in corresponding index |
|
1755 (*iSdmArray)[index].SetContact(aContact); |
|
1756 (*iSdmArray)[index].SetContactLink(iContactLink); |
|
1757 iRetrieveComplete = ETrue; |
|
1758 Release(); |
|
1759 |
|
1760 } |
|
1761 else if(TSpdiaIndexDataVPbk::OPERATION_ASSIGN_CONTACT == operation) |
|
1762 { |
|
1763 iSpeedDial->SetIndex(index + 1); |
|
1764 TRAP_IGNORE( |
|
1765 { |
|
1766 MVPbkStoreContactFieldCollection* fieldCollection = iAttributeManager->FindFieldsWithAttributeLC( *( iSpeedDial ), *aContact ); |
|
1767 if ( fieldCollection && ( fieldCollection->FieldCount() > 0 ) ) |
|
1768 { |
|
1769 // update speeddial information |
|
1770 MVPbkStoreContactField& field = fieldCollection->FieldAt( 0 ); |
|
1771 ( *iSdmArray )[ index ].SetContactLink( field.CreateLinkLC() ); |
|
1772 ( *iSdmArray )[ index ].SetContact( aContact ); |
|
1773 CleanupStack::Pop(); |
|
1774 SetDetails( index ); |
|
1775 } |
|
1776 |
|
1777 CleanupStack::PopAndDestroy(); // Pop and Destroy FieldCollection |
|
1778 } |
|
1779 ) |
|
1780 iRetrieveComplete = ETrue; |
|
1781 Release(); |
|
1782 } |
|
1783 //delete &aOperation; |
|
1784 } |
|
1785 } |
|
1786 } |
|
1787 |
|
1788 // --------------------------------------------------------- |
|
1789 // CSpeedDialPrivate::VPbkSingleContactOperationFailed() |
|
1790 // |
|
1791 // --------------------------------------------------------- |
|
1792 void CSpeedDialPrivate::VPbkSingleContactOperationFailed( |
|
1793 MVPbkContactOperationBase& /*aOperation*/, |
|
1794 TInt aError) |
|
1795 { |
|
1796 iError = aError; |
|
1797 iRetrieveComplete = ETrue; |
|
1798 Release(); |
|
1799 |
|
1800 } |
|
1801 |
|
1802 // --------------------------------------------------------- |
|
1803 // CSpeedDialPrivate::ShowAssignL() |
|
1804 // |
|
1805 // --------------------------------------------------------- |
|
1806 TBool CSpeedDialPrivate::ShowAssignL( MVPbkContactLink& aContactLink, TInt& aIndex ) |
|
1807 { |
|
1808 TBool aReturn (EFalse); |
|
1809 |
|
1810 TRAPD(err,iGridDlg = CSpdiaGridDlgVPbk::NewL(aIndex, *this)); |
|
1811 |
|
1812 // Execute the CPbkFetchEntryDlg dialog |
|
1813 TInt result(ETrue); |
|
1814 |
|
1815 if(err == KErrNone) |
|
1816 { |
|
1817 TRAPD(error, result = iGridDlg->ExecuteLD(R_SPDIA_GRID_DIALOG)); |
|
1818 iGridDlg = NULL; |
|
1819 iIconArray = NULL; |
|
1820 // Check errors |
|
1821 User::LeaveIfError(error); |
|
1822 } |
|
1823 |
|
1824 |
|
1825 |
|
1826 TBool popUp = ETrue; |
|
1827 |
|
1828 if (iBooleanVarForAddingDialogVariation) |
|
1829 { |
|
1830 if(!CheckingIfPopUpNeededL()) |
|
1831 popUp = EFalse; |
|
1832 } |
|
1833 if (popUp && result && !CheckSpaceBelowCriticalLevelL()) |
|
1834 { |
|
1835 //for contact link |
|
1836 TUint assignFlags = 0; |
|
1837 ExecuteSingleEntryAssignL(aIndex-1,AiwContactAssign:: TAiwContactAttributeAssignDataV1().SetFlags(assignFlags));//amit |
|
1838 aReturn = ETrue; |
|
1839 //return aReturn; |
|
1840 // for contact link |
|
1841 |
|
1842 if((*iSdmArray)[aIndex-1].Contact() != NULL) |
|
1843 { |
|
1844 result = RemoveSpeedDialL(aIndex-1); |
|
1845 } |
|
1846 |
|
1847 //If removal was successful |
|
1848 if(result != EFalse) |
|
1849 { |
|
1850 iRetrieveComplete = EFalse; |
|
1851 if(iContactLink) |
|
1852 { |
|
1853 delete iContactLink; |
|
1854 iContactLink= NULL; |
|
1855 } |
|
1856 iContactLink = aContactLink.CloneLC(); |
|
1857 CleanupStack::Pop(); |
|
1858 |
|
1859 MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( aContactLink, (*this )); |
|
1860 |
|
1861 if(operation) |
|
1862 { |
|
1863 (*iSdmArray)[aIndex-1].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_ASSIGN); |
|
1864 |
|
1865 while (!iRetrieveComplete) |
|
1866 { |
|
1867 Wait(); |
|
1868 } |
|
1869 //If retrieval is successful |
|
1870 if(iError == KErrNone) |
|
1871 { |
|
1872 AssignSpeedDialL(aIndex-1); |
|
1873 aReturn = ETrue; |
|
1874 } |
|
1875 else |
|
1876 { |
|
1877 delete iContactLink; |
|
1878 } |
|
1879 |
|
1880 } |
|
1881 } |
|
1882 |
|
1883 iContactLink = NULL; |
|
1884 } |
|
1885 |
|
1886 return aReturn; |
|
1887 } |
|
1888 |
|
1889 // --------------------------------------------------------- |
|
1890 // CSpeedDialPrivate::ShowAssignL() |
|
1891 // |
|
1892 // --------------------------------------------------------- |
|
1893 TBool CSpeedDialPrivate::ShowAssignL( TInt aIndex, MVPbkContactLink*& aContactLink ) |
|
1894 { |
|
1895 |
|
1896 // Have to display the title of SpeedDial when called |
|
1897 // from SpeedDial application...May be that function can be moved to |
|
1898 // speed dial application... |
|
1899 |
|
1900 TBool result = ETrue; |
|
1901 HBufC* prompt = NULL; |
|
1902 TBuf<KOperatorNameLength> operatorName; |
|
1903 |
|
1904 aIndex = aIndex-1; |
|
1905 if (iBooleanVarForAddingDialogVariation ) |
|
1906 { |
|
1907 if(iPopupDialog) |
|
1908 { |
|
1909 if(!CheckingIfPopUpNeededL()) |
|
1910 result = EFalse; |
|
1911 } |
|
1912 } |
|
1913 |
|
1914 if ( !CheckSpaceBelowCriticalLevelL() ) |
|
1915 { |
|
1916 if ( iGridUsed == EGridNoUse && (*iSdmArray)[aIndex].Contact() == NULL ) |
|
1917 { |
|
1918 iQueryDialog = CAknQueryDialog::NewL(CAknQueryDialog::ENoTone); |
|
1919 TBool resDialog(EFalse); |
|
1920 TRAPD(error, |
|
1921 resDialog = iQueryDialog->ExecuteLD(R_SPDIA_QUERY_ASSIGN) ); |
|
1922 iQueryDialog = NULL; |
|
1923 User::LeaveIfError(error); |
|
1924 if (!resDialog) |
|
1925 { |
|
1926 result = EFalse; |
|
1927 } |
|
1928 } |
|
1929 |
|
1930 if ( result && (*iSdmArray)[aIndex].Contact() != NULL ) |
|
1931 { |
|
1932 //if(iGridUsed == EGridNoUse)//because grid will be used if you want to replace or change |
|
1933 if ( iGridUsed == EGridUse ) |
|
1934 { |
|
1935 MakeVisible( ETrue ); |
|
1936 result = ETrue; |
|
1937 MakeVisible( EFalse ); |
|
1938 } |
|
1939 } |
|
1940 |
|
1941 if(result) |
|
1942 { |
|
1943 TUint assignFlags = 0; |
|
1944 //assignFlags |= (AiwContactAssign::EUseProviderTitle);//|AiwContactAssign::EDoNotOpenEditor); |
|
1945 CAknTitlePane* title = NULL; |
|
1946 CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
1947 title = STATIC_CAST(CAknTitlePane*, sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle) ) ); |
|
1948 prompt = StringLoader::LoadLC(R_QTN_SPDIA_TITLE, iCoeEnv); |
|
1949 operatorName.Copy(*title->Text()); |
|
1950 title->SetTextL(*prompt); |
|
1951 title->MakeVisible(ETrue); |
|
1952 CleanupStack::PopAndDestroy(prompt); |
|
1953 |
|
1954 ExecuteSingleEntryAssignL(aIndex,AiwContactAssign:: TAiwContactAttributeAssignDataV1().SetFlags(assignFlags)); |
|
1955 |
|
1956 if ( iCancelFlag ) |
|
1957 { |
|
1958 iCancelFlag = EFalse; |
|
1959 return result; |
|
1960 } |
|
1961 |
|
1962 if ( iError == KErrNone && iContactLink != NULL ) |
|
1963 { |
|
1964 (*iSdmArray)[aIndex].Reset(); |
|
1965 //Retrieve Contact and assign fields to the index.. |
|
1966 iRetrieveComplete = EFalse; |
|
1967 MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( *iContactLink, (*this )); |
|
1968 |
|
1969 if(operation) |
|
1970 { |
|
1971 (*iSdmArray)[aIndex].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_ASSIGN_CONTACT); |
|
1972 |
|
1973 while (!iRetrieveComplete) |
|
1974 { |
|
1975 Wait(); |
|
1976 } |
|
1977 if ( iError == KErrNone ) |
|
1978 { |
|
1979 result = ETrue; |
|
1980 } |
|
1981 else |
|
1982 { |
|
1983 //We are taking a copy of contact links.. |
|
1984 //If we can't store it, delete the link.. |
|
1985 delete iContactLink; |
|
1986 iContactLink = NULL; |
|
1987 result = EFalse; |
|
1988 } |
|
1989 } |
|
1990 } |
|
1991 |
|
1992 else if( iError == KErrInUse ) |
|
1993 { |
|
1994 ShowNoteL( R_QTN_SPDIA_CONTACT_IN_USE ); |
|
1995 } |
|
1996 |
|
1997 if(iContactLink != NULL) |
|
1998 { |
|
1999 aContactLink = iContactLink->CloneLC(); |
|
2000 CleanupStack::Pop(); |
|
2001 delete iContactLink; |
|
2002 } |
|
2003 else |
|
2004 { |
|
2005 aContactLink = CONST_CAST(MVPbkContactLink*, iContactLink); |
|
2006 } |
|
2007 iContactLink = NULL; |
|
2008 |
|
2009 title->SetTextL( operatorName ); |
|
2010 } |
|
2011 } |
|
2012 |
|
2013 return result; |
|
2014 |
|
2015 } |
|
2016 |
|
2017 // --------------------------------------------------------- |
|
2018 // CSpeedDialPrivate::ShowRemoveL |
|
2019 // |
|
2020 // --------------------------------------------------------- |
|
2021 // |
|
2022 TBool CSpeedDialPrivate::ShowRemoveL( TInt aIndex ) |
|
2023 { |
|
2024 |
|
2025 TBool aReturn = EFalse; |
|
2026 |
|
2027 if ( (*iSdmArray)[aIndex].Contact()!= NULL ) |
|
2028 { |
|
2029 iState = STATE_REMOVE; |
|
2030 if((*iSdmArray)[aIndex].Field() != NULL) |
|
2031 { |
|
2032 iOperationComplete = EFalse; |
|
2033 iSpeedDial->SetIndex(aIndex+1); |
|
2034 (*iSdmArray)[aIndex].Contact()->LockL(*(this)); |
|
2035 |
|
2036 while(!iOperationComplete) |
|
2037 { |
|
2038 Wait(); |
|
2039 } |
|
2040 |
|
2041 if(iError == KErrNone) |
|
2042 { |
|
2043 |
|
2044 MVPbkStoreContactField* field = (*iSdmArray)[aIndex].Field(); |
|
2045 TPtrC label = field->FieldLabel(); |
|
2046 iOperationComplete = EFalse; |
|
2047 MVPbkContactOperationBase* operation = NULL; |
|
2048 operation = iAttributeManager->RemoveFieldAttributeL( |
|
2049 *field, *iSpeedDial, (*this)); |
|
2050 if(operation) |
|
2051 { |
|
2052 (*iSdmArray)[aIndex].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_REMOVE); |
|
2053 |
|
2054 while(!iOperationComplete) |
|
2055 { |
|
2056 Wait(); |
|
2057 } |
|
2058 |
|
2059 } |
|
2060 |
|
2061 //If there are no errors |
|
2062 if(iError == KErrNone) |
|
2063 { |
|
2064 aReturn = ETrue; |
|
2065 } |
|
2066 } |
|
2067 else if( iError == KErrInUse ) |
|
2068 { |
|
2069 // Prompt information note when contact is in use |
|
2070 ShowNoteL( R_QTN_SPDIA_CONTACT_IN_USE ); |
|
2071 } |
|
2072 } |
|
2073 } |
|
2074 |
|
2075 return aReturn; |
|
2076 } |
|
2077 |
|
2078 // --------------------------------------------------------- |
|
2079 // CSpeedDialPrivate::ShowAssign |
|
2080 // Function called when assigning speed dial from phone book |
|
2081 // application |
|
2082 // --------------------------------------------------------- |
|
2083 // |
|
2084 EXPORT_C TInt CSpeedDialPrivate::ShowAssign( MVPbkContactLink& aContactLink, TInt& aIndex ) |
|
2085 { |
|
2086 iError = KErrNone; |
|
2087 iCurrentIndex = aIndex - 1; |
|
2088 |
|
2089 TRAPD( err, ShowAssignL( aContactLink, aIndex ) ); |
|
2090 |
|
2091 if ( err ) |
|
2092 { |
|
2093 iError = err; |
|
2094 } |
|
2095 |
|
2096 iCurrentIndex = -1; |
|
2097 return iError; |
|
2098 } |
|
2099 |
|
2100 // --------------------------------------------------------- |
|
2101 // CSpdiaContainer::ShowAssignL |
|
2102 // Function called when assigning speed dial from SpeedDial and Telephony |
|
2103 // application |
|
2104 // --------------------------------------------------------- |
|
2105 // |
|
2106 |
|
2107 EXPORT_C TInt CSpeedDialPrivate::ShowAssign( TInt aIndex, MVPbkContactLink*& aContactLink ) |
|
2108 { |
|
2109 iError = KErrNone; |
|
2110 if ( !iShowAssignCalled ) |
|
2111 { |
|
2112 iShowAssignCalled = ETrue; |
|
2113 iCurrentIndex = aIndex - 1; |
|
2114 |
|
2115 TRAPD( err, ShowAssignL( aIndex, aContactLink ) ); |
|
2116 |
|
2117 if ( err ) |
|
2118 { |
|
2119 iError = err; |
|
2120 } |
|
2121 iCurrentIndex = -1; |
|
2122 iShowAssignCalled = EFalse; |
|
2123 } |
|
2124 |
|
2125 return iError; |
|
2126 } |
|
2127 |
|
2128 EXPORT_C TInt CSpeedDialPrivate::ShowRemove( TInt aIndex ) |
|
2129 { |
|
2130 iError = KErrNone; |
|
2131 |
|
2132 iCurrentIndex = aIndex; |
|
2133 TInt reValue = ETrue; |
|
2134 TRAP_IGNORE( reValue = ShowRemoveL( aIndex ) ); |
|
2135 |
|
2136 iCurrentIndex = -1; |
|
2137 return reValue; |
|
2138 } |
|
2139 |
|
2140 |
|
2141 // -------------------------------------------------------------------------- |
|
2142 // CSpeedDialPrivate::StoreReady |
|
2143 // |
|
2144 // -------------------------------------------------------------------------- |
|
2145 // |
|
2146 void CSpeedDialPrivate::StoreReady(MVPbkContactStore& /*aContactStore*/) |
|
2147 { |
|
2148 iOperationComplete = ETrue; |
|
2149 Release(); |
|
2150 } |
|
2151 |
|
2152 // -------------------------------------------------------------------------- |
|
2153 // CSpeedDialPrivate::StoreUnavailable |
|
2154 // |
|
2155 // -------------------------------------------------------------------------- |
|
2156 // |
|
2157 void CSpeedDialPrivate::StoreUnavailable |
|
2158 (MVPbkContactStore& /*aContactStore*/, TInt /*aReason*/) |
|
2159 { |
|
2160 iOperationComplete = ETrue; |
|
2161 Release(); |
|
2162 |
|
2163 //iError = aReason; |
|
2164 } |
|
2165 |
|
2166 // -------------------------------------------------------------------------- |
|
2167 // CSpeedDialPrivate::SetState |
|
2168 // |
|
2169 // -------------------------------------------------------------------------- |
|
2170 // |
|
2171 EXPORT_C void CSpeedDialPrivate::SetState(eSpeedDialState aState) |
|
2172 { |
|
2173 iState = aState; |
|
2174 } |
|
2175 |
|
2176 // -------------------------------------------------------------------------- |
|
2177 // CSpeedDialPrivate::State |
|
2178 // |
|
2179 // -------------------------------------------------------------------------- |
|
2180 // |
|
2181 EXPORT_C CSpeedDialPrivate::eSpeedDialState CSpeedDialPrivate::State() |
|
2182 { |
|
2183 return iState; |
|
2184 } |
|
2185 |
|
2186 // -------------------------------------------------------------------------- |
|
2187 // CSpeedDialPrivate::GridStatus |
|
2188 // |
|
2189 // -------------------------------------------------------------------------- |
|
2190 // |
|
2191 EXPORT_C CSpeedDialPrivate::TGridUse CSpeedDialPrivate::GridStatus() |
|
2192 { |
|
2193 return iGridUsed; |
|
2194 } |
|
2195 |
|
2196 // -------------------------------------------------------------------------- |
|
2197 // CSpeedDialPrivate::SetGridStatus |
|
2198 // |
|
2199 // -------------------------------------------------------------------------- |
|
2200 // |
|
2201 EXPORT_C void CSpeedDialPrivate::SetGridStatus(TGridUse aStatus) |
|
2202 { |
|
2203 iGridUsed = aStatus; |
|
2204 } |
|
2205 |
|
2206 // -------------------------------------------------------------------------- |
|
2207 // CSpeedDialPrivate::HandleStoreEventL |
|
2208 // |
|
2209 // -------------------------------------------------------------------------- |
|
2210 // |
|
2211 void CSpeedDialPrivate::HandleStoreEventL( |
|
2212 MVPbkContactStore& aContactStore, |
|
2213 TVPbkContactStoreEvent aStoreEvent) |
|
2214 { |
|
2215 |
|
2216 MVPbkContactStore* storeInList = iContactManager->ContactStoresL().Find(aContactStore.StoreProperties().Uri()); |
|
2217 |
|
2218 if (storeInList !=NULL) |
|
2219 { |
|
2220 switch(aStoreEvent.iEventType) |
|
2221 { |
|
2222 |
|
2223 case TVPbkContactStoreEvent::EContactChanged: |
|
2224 case TVPbkContactStoreEvent::EContactDeleted: |
|
2225 |
|
2226 if ( iState == STATE_IDLE /*&& iUpdateFlag == EFalse*/ ) |
|
2227 { |
|
2228 |
|
2229 TInt findResult = 0; |
|
2230 findResult = FindInSpeedDialContacts(aStoreEvent.iContactLink); |
|
2231 |
|
2232 if(findResult != EFalse) |
|
2233 { |
|
2234 if (iGridUsed != EGridUse) |
|
2235 { |
|
2236 if ( iRemoveConfirmQueryDialog |
|
2237 && aStoreEvent.iEventType == TVPbkContactStoreEvent:: EContactChanged |
|
2238 && iCurrentIndex == findResult ) |
|
2239 { |
|
2240 delete iRemoveConfirmQueryDialog; |
|
2241 iRemoveConfirmQueryDialog = NULL; |
|
2242 } |
|
2243 iUpdateFlag = ETrue; |
|
2244 // if CSpeedDialPrivate object is constructed by dialer, the value of iGrid is NULL |
|
2245 if ( iGrid ) |
|
2246 { |
|
2247 CreateDataL( *iGrid ); |
|
2248 } |
|
2249 // If the view number note popped up and the customer delete the image of contact |
|
2250 // refresh the note dialog. |
|
2251 if ( iRefreshObserver && iCurrentIndex == findResult ) |
|
2252 { |
|
2253 iRefreshObserver->RefreshDialog(); |
|
2254 iUpdateFlag = ETrue; |
|
2255 } |
|
2256 } |
|
2257 } |
|
2258 else |
|
2259 { |
|
2260 if(CheckContactAssignedFromPhoneBookL(aStoreEvent.iContactLink)) |
|
2261 { |
|
2262 if (iGridUsed != EGridUse) |
|
2263 { |
|
2264 iUpdateFlag = ETrue; |
|
2265 // if CSpeedDialPrivate object is constructed by dialer, the value of iGrid is NULL |
|
2266 if ( iGrid ) |
|
2267 { |
|
2268 CreateDataL( *iGrid ); |
|
2269 } |
|
2270 } |
|
2271 } |
|
2272 |
|
2273 } |
|
2274 } |
|
2275 break; |
|
2276 |
|
2277 default: |
|
2278 break; |
|
2279 } |
|
2280 |
|
2281 } |
|
2282 |
|
2283 } |
|
2284 |
|
2285 // -------------------------------------------------------------------------- |
|
2286 // CSpeedDialPrivate::SetUpdateFlag |
|
2287 // |
|
2288 // -------------------------------------------------------------------------- |
|
2289 // |
|
2290 EXPORT_C void CSpeedDialPrivate::SetUpdateFlag(TBool aFlag) |
|
2291 { |
|
2292 iUpdateFlag = aFlag; |
|
2293 } |
|
2294 |
|
2295 // -------------------------------------------------------------------------- |
|
2296 // CSpeedDialPrivate::UpdateFlag |
|
2297 // |
|
2298 // -------------------------------------------------------------------------- |
|
2299 // |
|
2300 |
|
2301 EXPORT_C TBool CSpeedDialPrivate::UpdateFlag() |
|
2302 { |
|
2303 return iUpdateFlag; |
|
2304 } |
|
2305 |
|
2306 // -------------------------------------------------------------------------- |
|
2307 // CSpeedDialPrivate::FindInSpeedDialContacts |
|
2308 // |
|
2309 // -------------------------------------------------------------------------- |
|
2310 // |
|
2311 |
|
2312 TInt CSpeedDialPrivate::FindInSpeedDialContacts(MVPbkContactLink* aContactLink) |
|
2313 { |
|
2314 // TBool found = EFalse; |
|
2315 TInt found = 0; |
|
2316 MVPbkStoreContact* contact = NULL; |
|
2317 for ( TInt count = 0; count < iSdmArray->Count() && found != iCurrentIndex; ++count ) |
|
2318 { |
|
2319 contact = ( *iSdmArray )[count].Contact(); |
|
2320 |
|
2321 if ( contact != NULL && aContactLink->RefersTo( *contact ) ) |
|
2322 { |
|
2323 found = iSdmArray->Count(); |
|
2324 // if the changed contact is the one which is focused in Speeddial, |
|
2325 // then the note can be removed |
|
2326 if ( count == iCurrentIndex ) |
|
2327 { |
|
2328 found = iCurrentIndex; |
|
2329 } |
|
2330 } |
|
2331 } |
|
2332 return found; |
|
2333 } |
|
2334 |
|
2335 // -------------------------------------------------------------------------- |
|
2336 // CSpeedDialPrivate::CheckContactAssignedFromPhoneBookL |
|
2337 // |
|
2338 // -------------------------------------------------------------------------- |
|
2339 // |
|
2340 TBool CSpeedDialPrivate::CheckContactAssignedFromPhoneBookL(MVPbkContactLink* aContactLink) |
|
2341 { |
|
2342 TBool aReturn = EFalse; |
|
2343 iRetrieveComplete = EFalse; |
|
2344 MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( *aContactLink, |
|
2345 (*this )); |
|
2346 //Save the old state |
|
2347 eSpeedDialState oldState = iState; |
|
2348 |
|
2349 iState = STATE_CONTACTCHANGE; |
|
2350 if(operation != NULL) |
|
2351 { |
|
2352 while(!iRetrieveComplete) |
|
2353 { |
|
2354 Wait(); |
|
2355 } |
|
2356 |
|
2357 delete operation; |
|
2358 if(iContact != NULL) |
|
2359 { |
|
2360 aReturn = iAttributeManager->HasContactAttributeL( |
|
2361 CVPbkSpeedDialAttribute::Uid(),*iContact); |
|
2362 delete iContact; |
|
2363 iContact = NULL; |
|
2364 } |
|
2365 } |
|
2366 |
|
2367 //Restore the old state |
|
2368 iState = oldState; |
|
2369 return aReturn; |
|
2370 |
|
2371 } |
|
2372 |
|
2373 |
|
2374 // -------------------------------------------------------------------------- |
|
2375 // CSpeedDialPrivate::ExecuteSingleEntryAssignL |
|
2376 // |
|
2377 // -------------------------------------------------------------------------- |
|
2378 // |
|
2379 void CSpeedDialPrivate::ExecuteSingleEntryAssignL(TInt aIndex, |
|
2380 AiwContactAssign::TAiwContactAttributeAssignDataV1 aData) |
|
2381 { |
|
2382 iState = STATE_ASSIGN; |
|
2383 |
|
2384 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
2385 |
|
2386 const TAiwVariant speedDialVariant( aIndex + 1 ); |
|
2387 /* |
|
2388 TGenericParamId genericParam = |
|
2389 TGenericParamId( EGenericParamSpeedDialIndex );*/ |
|
2390 //For the time being..phone book ui lib is compiled with this value... |
|
2391 TGenericParamId genericParam = |
|
2392 TGenericParamId( EGenericParamSpeedDialIndex ); |
|
2393 |
|
2394 inParamList.AppendL(TAiwGenericParam( |
|
2395 genericParam, |
|
2396 speedDialVariant |
|
2397 ) ); |
|
2398 |
|
2399 inParamList.AppendL( TAiwGenericParam( EGenericParamContactAssignData, |
|
2400 TAiwVariant( AiwContactAssign::TAiwContactAttributeAssignDataV1Pckg( aData ) ) ) ); |
|
2401 |
|
2402 |
|
2403 iOperationComplete = EFalse; |
|
2404 iContactLink = NULL; |
|
2405 iServiceHandler->ExecuteServiceCmdL( |
|
2406 KAiwCmdAssign, |
|
2407 inParamList, |
|
2408 iServiceHandler->OutParamListL(), |
|
2409 0, |
|
2410 this ); |
|
2411 |
|
2412 // Wait till the contact is selected |
|
2413 while ( !iOperationComplete ) |
|
2414 { |
|
2415 Wait(); |
|
2416 } |
|
2417 |
|
2418 // CleanupStack::PopAndDestroy(); |
|
2419 //iServiceHandler = NULL; |
|
2420 } |
|
2421 |
|
2422 // -------------------------------------------------------------------------- |
|
2423 // CSpeedDialPrivate::ExecuteSingleEntryFetchL |
|
2424 // |
|
2425 // -------------------------------------------------------------------------- |
|
2426 // |
|
2427 void CSpeedDialPrivate::ExecuteSingleEntryFetchL(TInt aIndex, |
|
2428 TAiwSingleEntrySelectionDataV2 aData, |
|
2429 const TDesC& aUri1) |
|
2430 { |
|
2431 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL(); |
|
2432 |
|
2433 serviceHandler->AttachL(R_SPDIA_SINGLE_ENTRY_FETCH_INTEREST); |
|
2434 |
|
2435 CleanupStack::PushL(serviceHandler); |
|
2436 |
|
2437 CAiwGenericParamList& inParamList = serviceHandler->InParamListL(); |
|
2438 inParamList.AppendL( |
|
2439 TAiwGenericParam( |
|
2440 EGenericParamContactSelectionData, |
|
2441 TAiwVariant(TAiwSingleEntrySelectionDataV2Pckg(aData)))); |
|
2442 |
|
2443 CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewL(); |
|
2444 CleanupStack::PushL(uriArray); |
|
2445 if (aUri1.Length() > 0) |
|
2446 { |
|
2447 uriArray->AppendL(aUri1); |
|
2448 } |
|
2449 |
|
2450 HBufC8* packedUris = uriArray->PackLC(); |
|
2451 if (uriArray->Count() > 0) |
|
2452 { |
|
2453 inParamList.AppendL( |
|
2454 TAiwGenericParam( |
|
2455 EGenericParamContactStoreUriArray, |
|
2456 TAiwVariant(*packedUris))); |
|
2457 } |
|
2458 |
|
2459 iOperationComplete = EFalse; |
|
2460 iContactLink = NULL; |
|
2461 serviceHandler->ExecuteServiceCmdL( |
|
2462 KAiwCmdSelect, |
|
2463 inParamList, |
|
2464 serviceHandler->OutParamListL(), |
|
2465 0, |
|
2466 this); |
|
2467 CleanupStack::PopAndDestroy(2); // packedUris, uriArray, service handler |
|
2468 |
|
2469 //Wait till the contact is selected |
|
2470 while (!iOperationComplete) |
|
2471 { |
|
2472 Wait(); |
|
2473 } |
|
2474 |
|
2475 CleanupStack::PopAndDestroy(serviceHandler); |
|
2476 |
|
2477 if(iContactLink && !CheckSpaceBelowCriticalLevelL()) |
|
2478 { |
|
2479 iRetrieveComplete = EFalse; |
|
2480 |
|
2481 MVPbkContactOperationBase* operation = iContactManager->RetrieveContactL( *iContactLink, (*this )); |
|
2482 |
|
2483 if(operation) |
|
2484 { |
|
2485 (*iSdmArray)[aIndex].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_ASSIGN); |
|
2486 |
|
2487 while (!iRetrieveComplete) |
|
2488 { |
|
2489 Wait(); |
|
2490 } |
|
2491 |
|
2492 ShowRemove(aIndex); |
|
2493 if(iError == 0) |
|
2494 { |
|
2495 |
|
2496 } |
|
2497 } |
|
2498 |
|
2499 } |
|
2500 } |
|
2501 |
|
2502 // -------------------------------------------------------------------------- |
|
2503 // CSpeedDialPrivate::HandleNotifyL |
|
2504 // |
|
2505 // -------------------------------------------------------------------------- |
|
2506 // |
|
2507 TInt CSpeedDialPrivate::HandleNotifyL( |
|
2508 TInt aCmdId, |
|
2509 TInt aEventId, |
|
2510 CAiwGenericParamList& aEventParamList, |
|
2511 const CAiwGenericParamList& /*aInParamList*/) |
|
2512 { |
|
2513 TInt result = 0; |
|
2514 iContactLink = NULL; |
|
2515 |
|
2516 if ((aCmdId == KAiwCmdSelect) || (aCmdId == KAiwCmdAssign)) |
|
2517 { |
|
2518 if (aEventId == KAiwEventCompleted) |
|
2519 { |
|
2520 TInt index = 0; |
|
2521 const TAiwGenericParam* param = |
|
2522 aEventParamList.FindFirst(index, EGenericParamContactLinkArray); |
|
2523 if ( !iFetchmail && param) |
|
2524 { |
|
2525 TPtrC8 contactLinks = param->Value().AsData(); |
|
2526 CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC( |
|
2527 contactLinks,iContactManager->ContactStoresL()); |
|
2528 |
|
2529 if(links->Count() > 0) |
|
2530 { |
|
2531 if(iContactLink) |
|
2532 { |
|
2533 delete iContactLink; |
|
2534 iContactLink= NULL; |
|
2535 } |
|
2536 |
|
2537 iContactLink = links->At(0).CloneLC(); |
|
2538 CleanupStack::Pop(); |
|
2539 } |
|
2540 |
|
2541 CleanupStack::PopAndDestroy(links); |
|
2542 } |
|
2543 |
|
2544 index = 1; |
|
2545 const TAiwGenericParam* paramMail = |
|
2546 aEventParamList.FindFirst(index, EGenericParamContactFieldData); |
|
2547 if ( iFetchmail && paramMail ) |
|
2548 { |
|
2549 TInt length = paramMail->Value().AsDes().Length(); |
|
2550 iMail = HBufC::NewL(length); |
|
2551 iMail->Des().Append(paramMail->Value().AsDes()); |
|
2552 } |
|
2553 iOperationComplete = ETrue; |
|
2554 Release(); |
|
2555 |
|
2556 } |
|
2557 else if (aEventId == KAiwEventCanceled) |
|
2558 { |
|
2559 iError = KErrCancel; |
|
2560 iOperationComplete = ETrue; |
|
2561 Release(); |
|
2562 } |
|
2563 else if (aEventId == KAiwEventError) |
|
2564 { |
|
2565 iError = KErrInUse; |
|
2566 iOperationComplete = ETrue; |
|
2567 Release(); |
|
2568 } |
|
2569 else if(aEventId == KAiwEventQueryExit) |
|
2570 { |
|
2571 iError = KLeaveExit; |
|
2572 iOperationComplete = ETrue; |
|
2573 Release(); |
|
2574 result = 1; |
|
2575 } |
|
2576 } |
|
2577 |
|
2578 return result; |
|
2579 } |
|
2580 |
|
2581 // -------------------------------------------------------------------------- |
|
2582 // CSpeedDialPrivate::ContactOperationCompleted |
|
2583 // |
|
2584 // -------------------------------------------------------------------------- |
|
2585 // |
|
2586 void CSpeedDialPrivate::ContactOperationCompleted(TContactOpResult /*aResult*/) |
|
2587 { |
|
2588 iOperationComplete = ETrue; |
|
2589 Release(); |
|
2590 |
|
2591 } |
|
2592 |
|
2593 // -------------------------------------------------------------------------- |
|
2594 // CSpeedDialPrivate::ContactOperationFailed |
|
2595 // |
|
2596 // -------------------------------------------------------------------------- |
|
2597 // |
|
2598 void CSpeedDialPrivate::ContactOperationFailed(TContactOp /*aOpCode*/, TInt aErrorCode, |
|
2599 TBool /*aErrorNotified*/) |
|
2600 { |
|
2601 iError = aErrorCode; |
|
2602 iOperationComplete = ETrue; |
|
2603 Release(); |
|
2604 } |
|
2605 |
|
2606 // --------------------------------------------------------- |
|
2607 // CSpeedDialPrivate::InitIndexDataL |
|
2608 // The SDM control data is initialized. |
|
2609 // --------------------------------------------------------- |
|
2610 // |
|
2611 void CSpeedDialPrivate::InitIndexDataL() |
|
2612 { |
|
2613 // The dialog of grid is not closed. |
|
2614 if (iIconArray != NULL) |
|
2615 { |
|
2616 iError = KErrNone; |
|
2617 ResetArray(); |
|
2618 //State set to identify the source of call during callback. |
|
2619 |
|
2620 //Save the old state |
|
2621 eSpeedDialState oldState = iState; |
|
2622 |
|
2623 iState = STATE_INITIAL; |
|
2624 iOperationComplete = EFalse; |
|
2625 |
|
2626 /*Delete already fetched contacts if any */ |
|
2627 if(iContactLinkArray != NULL) |
|
2628 { |
|
2629 delete iContactLinkArray; |
|
2630 iContactLinkArray = NULL; |
|
2631 } |
|
2632 //Fetch all contacts for which speed dial attribute is set. |
|
2633 iFetchAll = EFalse; |
|
2634 iSpeedDial->SetIndex(CVPbkSpeedDialAttribute::KSpeedDialIndexNotDefined); |
|
2635 // iSpeedDial->SetIndex(2); |
|
2636 MVPbkContactOperationBase* findOperation = iAttributeManager->ListContactsL(*iSpeedDial,(*this)); |
|
2637 |
|
2638 while(findOperation != NULL && !iFetchAll) |
|
2639 { |
|
2640 //Wait till every contactlink is fetched and set. |
|
2641 Wait(); |
|
2642 } |
|
2643 //Delete the handle |
|
2644 delete findOperation; |
|
2645 |
|
2646 MVPbkContactOperationBase* retrieveOperation = NULL; |
|
2647 for(TInt count =0; iContactLinkArray && count < iContactLinkArray->Count();++count) |
|
2648 { |
|
2649 iRetrieveComplete = EFalse; |
|
2650 iContactLink = &(iContactLinkArray->At(count)); |
|
2651 retrieveOperation = iContactManager->RetrieveContactL(iContactLinkArray->At(count),(*this )); |
|
2652 while(retrieveOperation != NULL && !iRetrieveComplete) |
|
2653 { |
|
2654 //Wait till the contact is fetched and its speed dial |
|
2655 //index is initialized. |
|
2656 Wait(); |
|
2657 } |
|
2658 //Delete the handle received |
|
2659 delete retrieveOperation; |
|
2660 |
|
2661 } |
|
2662 // Undo this reset |
|
2663 // Just for debugging... |
|
2664 if(iError != KErrNone) |
|
2665 { |
|
2666 iError = KErrNone; |
|
2667 } |
|
2668 //Reset the state |
|
2669 iState = oldState; |
|
2670 |
|
2671 } |
|
2672 } |
|
2673 |
|
2674 // --------------------------------------------------------- |
|
2675 // CSpeedDialPrivate::FindCompleteL |
|
2676 // . |
|
2677 // --------------------------------------------------------- |
|
2678 // |
|
2679 void CSpeedDialPrivate::FindCompleteL(MVPbkContactLinkArray* aResults) |
|
2680 { |
|
2681 |
|
2682 iContactLinkArray = aResults; |
|
2683 iFetchAll = ETrue; |
|
2684 Release(); |
|
2685 |
|
2686 |
|
2687 } |
|
2688 |
|
2689 // --------------------------------------------------------- |
|
2690 // CSpeedDialPrivate::FindFailed |
|
2691 // |
|
2692 // --------------------------------------------------------- |
|
2693 // |
|
2694 void CSpeedDialPrivate::FindFailed(TInt aError) |
|
2695 { |
|
2696 iError = aError; |
|
2697 iFetchAll = ETrue; |
|
2698 Release(); |
|
2699 } |
|
2700 // --------------------------------------------------------- |
|
2701 // CSpdiaContainer::CreateItemDescriptorL |
|
2702 // |
|
2703 // --------------------------------------------------------- |
|
2704 // |
|
2705 HBufC* CSpeedDialPrivate::CreateItemDescriptorLC(const TSpdiaIndexDataVPbk& aSdmData) |
|
2706 { |
|
2707 HBufC* des = HBufC::NewLC(KApaMaxAppCaption); |
|
2708 TPtr ptr(des->Des()); |
|
2709 |
|
2710 // thumb type |
|
2711 TInt type(CSpdiaGridVPbk::EText); |
|
2712 if (aSdmData.ThumbIndex() >= 0) |
|
2713 { |
|
2714 type = ConvThumbType(aSdmData.ThumbSize()); |
|
2715 } |
|
2716 |
|
2717 // Text |
|
2718 if ( type == CSpdiaGridVPbk::EText ) |
|
2719 { |
|
2720 // number type icon is missing |
|
2721 TBuf<KPhCltNameBufferLength> iconInfo; |
|
2722 iconInfo.Append( KDesTab ); // 1 |
|
2723 if ( aSdmData.IconIndex() >= 0 ) |
|
2724 { |
|
2725 iconInfo.AppendNum( aSdmData.IconIndex() ); |
|
2726 } |
|
2727 AppendTextL( aSdmData, ptr ); // 2,3,4 |
|
2728 ptr.Insert( 0, iconInfo ); |
|
2729 } |
|
2730 else |
|
2731 { |
|
2732 // icon + text + text + text |
|
2733 ptr.Append(KDesTab2); // 1, 2 |
|
2734 ptr.Append(KDesTab2); // 2 |
|
2735 } |
|
2736 |
|
2737 // thumbnail 5-14 |
|
2738 for (TInt i(CSpdiaGridVPbk::EtnCIF90); i <= CSpdiaGridVPbk::EtnCOM; ++i) |
|
2739 { |
|
2740 AppendThumbnail(aSdmData, ptr, (type == i? ETrue: EFalse)); |
|
2741 } |
|
2742 |
|
2743 // number |
|
2744 ptr.Append(KDesTab); // 15 |
|
2745 // check |
|
2746 ptr.Append(KDesTab); // 16 |
|
2747 |
|
2748 return des; |
|
2749 } |
|
2750 |
|
2751 |
|
2752 // --------------------------------------------------------- |
|
2753 // CSpeedDialPrivate::CreateDataL |
|
2754 // Set grid used flag and calls CreateDataL. |
|
2755 // --------------------------------------------------------- |
|
2756 // |
|
2757 TBool CSpeedDialPrivate::CreateDataL(const CAknGrid& aGrid) |
|
2758 { |
|
2759 TGridUse oldStatus; |
|
2760 |
|
2761 TBool result; |
|
2762 |
|
2763 oldStatus = iGridUsed; |
|
2764 |
|
2765 iGridUsed = EGridUseAndUpdate; |
|
2766 |
|
2767 result = CreateGridDataL(CONST_CAST(CAknGrid*, &aGrid), KNullIndexData); |
|
2768 |
|
2769 iGridUsed = oldStatus; |
|
2770 |
|
2771 return result; |
|
2772 } |
|
2773 |
|
2774 |
|
2775 // --------------------------------------------------------- |
|
2776 // CSpeedDialPrivate::AppendTextL |
|
2777 // output Text1\tText2\tText3\t |
|
2778 // --------------------------------------------------------- |
|
2779 // |
|
2780 void CSpeedDialPrivate::AppendTextL(const TSpdiaIndexDataVPbk& aSdmData, TPtr& aText) |
|
2781 { |
|
2782 |
|
2783 if (aSdmData.Contact() == NULL) |
|
2784 { |
|
2785 aText.Append(KDesTab2); |
|
2786 aText.Append(KDesTab2); |
|
2787 } |
|
2788 else |
|
2789 { |
|
2790 // Test application name formatting logic is that take last name and |
|
2791 // first name and combine them using space as a separator. If either of |
|
2792 // them exists use company name. If there are still no name use "Unnamed" |
|
2793 |
|
2794 // Get field types from the master field type list |
|
2795 const MVPbkFieldType* lastNameType = |
|
2796 iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_LASTNAME ); |
|
2797 const MVPbkFieldType* firstNameType = |
|
2798 iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_FIRSTNAME ); |
|
2799 const MVPbkFieldType* companyNameType = |
|
2800 iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_COMPANYNAME ); |
|
2801 |
|
2802 CDesCArrayFlat* bufs = new( ELeave ) CDesCArrayFlat( 2 ); |
|
2803 CleanupStack::PushL( bufs ); |
|
2804 |
|
2805 // Non-graphical characters are replaced with space |
|
2806 const TText KReplaceChar = ' '; |
|
2807 |
|
2808 // Contact should have only one last name field |
|
2809 CVPbkBaseContactFieldTypeIterator* itr = |
|
2810 CVPbkBaseContactFieldTypeIterator::NewLC( *lastNameType, |
|
2811 aSdmData.Contact()->Fields() ); |
|
2812 while ( itr->HasNext() ) |
|
2813 { |
|
2814 const MVPbkBaseContactField* field = itr->Next(); |
|
2815 // last name field is text data |
|
2816 const MVPbkContactFieldTextData& data = |
|
2817 MVPbkContactFieldTextData::Cast( field->FieldData() ); |
|
2818 HBufC* lastName = data.Text().AllocLC(); |
|
2819 |
|
2820 TPtr lName(NULL, 0); |
|
2821 lName.Set( lastName->Des() ); |
|
2822 ReplaceNonGraphicCharacters( lName, KReplaceChar ); |
|
2823 |
|
2824 const TInt len = lName.Length(); |
|
2825 if (0 < len) |
|
2826 { |
|
2827 bufs->AppendL( lName); |
|
2828 } |
|
2829 |
|
2830 CleanupStack::PopAndDestroy( lastName ); |
|
2831 } |
|
2832 CleanupStack::PopAndDestroy( itr ); |
|
2833 |
|
2834 // Contact should have only one first name field |
|
2835 itr = CVPbkBaseContactFieldTypeIterator::NewLC( *firstNameType, |
|
2836 aSdmData.Contact()->Fields() ); |
|
2837 while ( itr->HasNext() ) |
|
2838 { |
|
2839 const MVPbkBaseContactField* field = itr->Next(); |
|
2840 // last name field is text data |
|
2841 const MVPbkContactFieldTextData& data = |
|
2842 MVPbkContactFieldTextData::Cast( field->FieldData() ); |
|
2843 |
|
2844 HBufC* firstName = data.Text().AllocLC(); |
|
2845 |
|
2846 TPtr fName(NULL, 0); |
|
2847 fName.Set( firstName->Des() ); |
|
2848 ReplaceNonGraphicCharacters( fName, KReplaceChar ); |
|
2849 |
|
2850 const TInt len = fName.Length(); |
|
2851 if (0 < len) |
|
2852 { |
|
2853 bufs->AppendL( fName); |
|
2854 } |
|
2855 |
|
2856 CleanupStack::PopAndDestroy( firstName ); |
|
2857 } |
|
2858 CleanupStack::PopAndDestroy( itr ); |
|
2859 |
|
2860 // No last and first name try company name |
|
2861 if ( bufs->Count() == 0 ) |
|
2862 { |
|
2863 // Contact should have only one company name field |
|
2864 itr = CVPbkBaseContactFieldTypeIterator::NewLC( *companyNameType, |
|
2865 aSdmData.Contact()->Fields() ); |
|
2866 while ( itr->HasNext() ) |
|
2867 { |
|
2868 const MVPbkBaseContactField* field = itr->Next(); |
|
2869 // last name field is text data |
|
2870 const MVPbkContactFieldTextData& data = |
|
2871 MVPbkContactFieldTextData::Cast( field->FieldData() ); |
|
2872 HBufC* companyName = data.Text().AllocLC(); |
|
2873 bufs->AppendL( *companyName ); |
|
2874 CleanupStack::PopAndDestroy( companyName ); |
|
2875 } |
|
2876 CleanupStack::PopAndDestroy( itr ); |
|
2877 } |
|
2878 |
|
2879 aText.Append(KDesTab); |
|
2880 // If still no name use phone number |
|
2881 if ( bufs->Count() == 0 ) |
|
2882 { |
|
2883 aText.Append(aSdmData.PhoneNumber()); |
|
2884 aText.Append(KDesTab); |
|
2885 } |
|
2886 else |
|
2887 { |
|
2888 for ( TInt i = 0; i < bufs->Count(); ++i ) |
|
2889 { |
|
2890 aText.Append( (*bufs)[i] ); |
|
2891 aText.Append(KDesTab); |
|
2892 } |
|
2893 |
|
2894 } |
|
2895 |
|
2896 aText.Append(KDesTab); |
|
2897 CleanupStack::PopAndDestroy( bufs ); |
|
2898 } |
|
2899 |
|
2900 AknTextUtils::DisplayTextLanguageSpecificNumberConversion (aText); |
|
2901 } |
|
2902 |
|
2903 |
|
2904 // --------------------------------------------------------- |
|
2905 // CSpdiaContainer::SetOperationsL |
|
2906 // |
|
2907 // --------------------------------------------------------- |
|
2908 // |
|
2909 void CSpeedDialPrivate::SetOperationsL() |
|
2910 { |
|
2911 for (TInt index(iSdmArray->Count() -1); index > 0; --index) |
|
2912 { |
|
2913 TSpdiaIndexDataVPbk& data = (*iSdmArray)[index]; |
|
2914 |
|
2915 if (data.ThumbIndex() >=0) |
|
2916 { |
|
2917 iOperationComplete = EFalse; |
|
2918 data.SetImageOperation( |
|
2919 iImageManager->GetImageAsyncL(NULL,*(data.Contact()),*iThumbNailFieldType,(*this) ) ); |
|
2920 while ( !iOperationComplete ) |
|
2921 { |
|
2922 Wait(); |
|
2923 } |
|
2924 } |
|
2925 } |
|
2926 } |
|
2927 |
|
2928 // --------------------------------------------------------- |
|
2929 // CSpdiaContainer::UpdateIndexDataL |
|
2930 // |
|
2931 // --------------------------------------------------------- |
|
2932 // |
|
2933 |
|
2934 TBool CSpeedDialPrivate::UpdateIndexDataL(TInt aIndex) |
|
2935 { |
|
2936 CFbsBitmap* bitmap,*mask; |
|
2937 bitmap = NULL; |
|
2938 mask= NULL; |
|
2939 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
2940 |
|
2941 |
|
2942 TSpdiaIndexDataVPbk& data = (*iSdmArray)[aIndex]; |
|
2943 delete (*iIconArray)[aIndex]; |
|
2944 (*iIconArray)[aIndex] = NULL; |
|
2945 TFileName bmpPath(iBmpPath); |
|
2946 |
|
2947 if( User::Language() == ELangHindi ) |
|
2948 { |
|
2949 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[aIndex],bitmap,mask,bmpPath,iDialHindiBmp[aIndex], iDialHindiBmpMask[aIndex] ); |
|
2950 } |
|
2951 else |
|
2952 { |
|
2953 AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[aIndex],bitmap,mask,bmpPath,iDialBmp[aIndex], iDialBmpMask[aIndex] ); |
|
2954 } |
|
2955 (*iIconArray)[aIndex] = CGulIcon::NewL(bitmap,mask); |
|
2956 |
|
2957 |
|
2958 |
|
2959 MVPbkStoreContact* aContact = data.Contact(); |
|
2960 |
|
2961 data.ResetThumbIndex(); |
|
2962 if (CreateIndexIconL(aIndex, data, ETrue)) |
|
2963 { |
|
2964 |
|
2965 if (iImageManager) |
|
2966 { |
|
2967 data.SetImageOperation( iImageManager->GetImageAsyncL(NULL,*aContact,*iThumbNailFieldType,(*this) ) ); |
|
2968 } |
|
2969 } |
|
2970 else |
|
2971 { |
|
2972 ChangeIndexDataL(aIndex, data); |
|
2973 iGrid->DrawNow(); |
|
2974 } |
|
2975 return ETrue; |
|
2976 } |
|
2977 |
|
2978 |
|
2979 // --------------------------------------------------------- |
|
2980 // CSpdiaContainer::CreateIndexIconL |
|
2981 // |
|
2982 // --------------------------------------------------------- |
|
2983 // |
|
2984 TBool CSpeedDialPrivate::CreateIndexIconL(TInt aIndex, |
|
2985 TSpdiaIndexDataVPbk& aSdmData, TBool aSetUpdateThumb) |
|
2986 { |
|
2987 TBool existThumb(EFalse); |
|
2988 |
|
2989 if (aSdmData.Contact() != NULL) |
|
2990 { |
|
2991 TInt fieldId = -1; |
|
2992 |
|
2993 MVPbkStoreContactField* field = (*iSdmArray)[aIndex].Field(); |
|
2994 if(field) |
|
2995 { |
|
2996 fieldId = field->BestMatchingFieldType()->FieldTypeResId(); |
|
2997 } |
|
2998 aSdmData.SetIconIndex(FindIconIndex(fieldId)); |
|
2999 |
|
3000 // check for the functionality, why he is checking has thumbnail before adding |
|
3001 |
|
3002 if (iImageManager->HasImage(*aSdmData.Contact(),*iThumbNailFieldType)) |
|
3003 { |
|
3004 existThumb = ETrue; |
|
3005 if (aSetUpdateThumb) |
|
3006 { |
|
3007 aSdmData.SetLastThumb(ETrue); |
|
3008 } |
|
3009 aSdmData.SetThumbIndex(aIndex, NULL); |
|
3010 } |
|
3011 else |
|
3012 { |
|
3013 aSdmData.SetThumbIndex(-1, NULL); |
|
3014 } |
|
3015 |
|
3016 } |
|
3017 |
|
3018 return existThumb; |
|
3019 } |
|
3020 |
|
3021 // --------------------------------------------------------- |
|
3022 // CSpdiaContainer::ChangeIndexDataL |
|
3023 // |
|
3024 // --------------------------------------------------------- |
|
3025 // |
|
3026 void CSpeedDialPrivate::ChangeIndexDataL( |
|
3027 TInt aIndex, |
|
3028 const TSpdiaIndexDataVPbk& aSdmData ) |
|
3029 { |
|
3030 CDesCArray* array = STATIC_CAST(CDesCArray*, |
|
3031 iGrid->Model()->ItemTextArray()); |
|
3032 HBufC* des = ItemDescriptorLC(aIndex, aSdmData); |
|
3033 array->Delete(aIndex); |
|
3034 array->InsertL(aIndex, *des); |
|
3035 CleanupStack::PopAndDestroy(); // des |
|
3036 } |
|
3037 |
|
3038 |
|
3039 // --------------------------------------------------------- |
|
3040 // CSpeedDialPrivate::FindIconIndex |
|
3041 // |
|
3042 // --------------------------------------------------------- |
|
3043 // |
|
3044 |
|
3045 TInt CSpeedDialPrivate::FindIconIndex(TInt aId) const |
|
3046 { |
|
3047 TInt index(KNullIndexData); |
|
3048 for (TInt n(0); index == KNullIndexData && n < (sizeof KFieldIds/sizeof KFieldIds[0]); ++n) |
|
3049 { |
|
3050 if ((TUint)aId == KFieldIds[n] ) |
|
3051 { |
|
3052 index = n + iSdmCount; |
|
3053 } |
|
3054 } |
|
3055 return index; |
|
3056 } |
|
3057 |
|
3058 |
|
3059 // --------------------------------------------------------- |
|
3060 // CSpdiaContainer::ItemDescriptorL |
|
3061 // |
|
3062 // --------------------------------------------------------- |
|
3063 // |
|
3064 HBufC* CSpeedDialPrivate::ItemDescriptorLC(TInt aIndex, |
|
3065 const TSpdiaIndexDataVPbk& aSdmData) |
|
3066 { |
|
3067 HBufC* des = NULL; |
|
3068 if (aSdmData.Contact() != NULL) |
|
3069 { |
|
3070 des = CreateItemDescriptorLC(aSdmData); |
|
3071 } |
|
3072 else |
|
3073 { |
|
3074 des = HBufC::NewLC(KNullCell.iTypeLength); |
|
3075 des->Des().Format(KNullCell, aIndex); |
|
3076 } |
|
3077 return des; |
|
3078 } |
|
3079 |
|
3080 // --------------------------------------------------------- |
|
3081 // CSpdiaContainer::SetItemDataL |
|
3082 // |
|
3083 // --------------------------------------------------------- |
|
3084 // |
|
3085 void CSpeedDialPrivate::SetItemDataL(CDesCArray& aArray) |
|
3086 { |
|
3087 for (TInt loop(0); loop < iSdmCount; loop++) |
|
3088 { |
|
3089 TSpdiaIndexDataVPbk& data = (*iSdmArray)[loop]; |
|
3090 |
|
3091 aArray.AppendL(ItemDescriptorLC(loop, data)->Des()); |
|
3092 CleanupStack::PopAndDestroy(); // des |
|
3093 } |
|
3094 } |
|
3095 |
|
3096 TBool CSpeedDialPrivate::CheckSpaceBelowCriticalLevelL() |
|
3097 { |
|
3098 TBool retcode(EFalse); |
|
3099 |
|
3100 if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iCoeEnv->FsSession()))) |
|
3101 { |
|
3102 CErrorUI* errorUi = CErrorUI::NewLC(); |
|
3103 errorUi->ShowGlobalErrorNoteL(KErrDiskFull); |
|
3104 CleanupStack::PopAndDestroy(); // errorUi |
|
3105 retcode = ETrue; |
|
3106 } |
|
3107 return retcode; |
|
3108 } |
|
3109 |
|
3110 // --------------------------------------------------------- |
|
3111 // CSpeedDialPrivate::GetThumbnailSize() |
|
3112 // Gets actual size of thumbnial to be drawn |
|
3113 // --------------------------------------------------------- |
|
3114 // |
|
3115 TSize CSpeedDialPrivate::GetThumbnailSize() |
|
3116 { |
|
3117 TRect mainPaneRect ; |
|
3118 TRect statusPaneRect; |
|
3119 TInt varient =0; |
|
3120 |
|
3121 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
3122 { |
|
3123 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
3124 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
3125 mainPaneRect.iTl = statusPaneRect.iTl; |
|
3126 mainPaneRect.iBr.iY = mainPaneRect.iBr.iY - statusPaneRect.iTl.iY; |
|
3127 varient =1; |
|
3128 } |
|
3129 else |
|
3130 { |
|
3131 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
3132 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
3133 mainPaneRect.iTl= statusPaneRect.iTl; |
|
3134 } |
|
3135 |
|
3136 TAknLayoutRect mainGridPaneRect; |
|
3137 TAknLayoutRect gridPaneRect; |
|
3138 TAknLayoutRect cellPaneRect; |
|
3139 TAknLayoutRect thumbPaneRect; |
|
3140 |
|
3141 mainGridPaneRect.LayoutRect(mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane());//main grid pane |
|
3142 gridPaneRect.LayoutRect(mainGridPaneRect.Rect(),AknLayoutScalable_Apps::grid_qdial_pane());//main grid pane |
|
3143 cellPaneRect.LayoutRect(gridPaneRect.Rect(),AknLayoutScalable_Apps::cell_qdial_pane(0,0)); |
|
3144 thumbPaneRect.LayoutRect(cellPaneRect.Rect(),AknLayoutScalable_Apps::thumbnail_qdial_pane(varient)); |
|
3145 |
|
3146 return thumbPaneRect.Rect().Size(); |
|
3147 |
|
3148 } |
|
3149 |
|
3150 |
|
3151 // --------------------------------------------------------- |
|
3152 // CSpeedDialPrivate::ThumbType |
|
3153 // An interface for accessing index data array. |
|
3154 // --------------------------------------------------------- |
|
3155 // |
|
3156 TInt CSpeedDialPrivate::ThumbType(TInt aIndex) const |
|
3157 { |
|
3158 return ConvThumbType((*iSdmArray)[aIndex].ThumbSize()); |
|
3159 } |
|
3160 |
|
3161 // --------------------------------------------------------- |
|
3162 // CSpeedDialPrivate::ThumbSize |
|
3163 // An interface for accessing index data array. |
|
3164 // --------------------------------------------------------- |
|
3165 // |
|
3166 TSize CSpeedDialPrivate::ThumbSize(TInt aIndex) const |
|
3167 { |
|
3168 return (*iSdmArray)[aIndex].ThumbSize(); |
|
3169 } |
|
3170 |
|
3171 // --------------------------------------------------------- |
|
3172 // CSpdiaContainer::ConvThumbType |
|
3173 // Returns |
|
3174 // EtnVGA : 640 x 480 40 x 30 VGA |
|
3175 // EtnVGA90: 480 x 640 30 x 40 VGA turned |
|
3176 // EtnCIF : 352 x 288 44 x 36 CIF |
|
3177 // EtnCIF90: 288 x 352 36 x 44 CIF turned |
|
3178 // EtnCOM : othre |
|
3179 // --------------------------------------------------------- |
|
3180 // |
|
3181 TInt CSpeedDialPrivate::ConvThumbType(const TSize& aSize) const |
|
3182 { |
|
3183 // Scalable UI |
|
3184 TAknWindowLineLayout vga; |
|
3185 TAknWindowLineLayout cif; |
|
3186 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
3187 { |
|
3188 vga = AknLayoutScalable_Apps::popup_phob_thumbnail_window_g2().LayoutLine(); |
|
3189 cif = AknLayoutScalable_Apps::popup_phob_thumbnail_window_g1().LayoutLine();//image |
|
3190 |
|
3191 } |
|
3192 else |
|
3193 { |
|
3194 vga = AppLayout::Thumbnail_pop_up_window_elements_Line_1(); |
|
3195 cif = AppLayout::Thumbnail_pop_up_window_elements_Line_3(); |
|
3196 |
|
3197 } |
|
3198 TInt type(CSpdiaGridVPbk::EtnCOM); |
|
3199 |
|
3200 if (aSize.iWidth == cif.iH//SDM_TN_CIF_HEIGHT |
|
3201 && aSize.iHeight == cif.iW)// SDM_TN_CIF_WIDTH) |
|
3202 { |
|
3203 type = CSpdiaGridVPbk::EtnCIF90; |
|
3204 } |
|
3205 else if (aSize.iWidth == cif.iW &&//SDM_TN_CIF_WIDTH && |
|
3206 aSize.iHeight == cif.iH)//SDM_TN_CIF_HEIGHT) |
|
3207 { |
|
3208 type = CSpdiaGridVPbk::EtnCIF; |
|
3209 } |
|
3210 else if (aSize.iWidth == vga.iH &&//SDM_TN_VGA_HEIGHT && |
|
3211 aSize.iHeight == vga.iW )//SDM_TN_VGA_WIDTH) |
|
3212 { |
|
3213 type = CSpdiaGridVPbk::EtnVGA90; |
|
3214 } |
|
3215 else if (aSize.iWidth == vga.iW &&//SDM_TN_VGA_WIDTH && |
|
3216 aSize.iHeight == vga.iH)//SDM_TN_VGA_HEIGHT) |
|
3217 { |
|
3218 type = CSpdiaGridVPbk::EtnVGA; |
|
3219 } |
|
3220 |
|
3221 return type; |
|
3222 } |
|
3223 |
|
3224 // --------------------------------------------------------- |
|
3225 // CSpdiaContainer::AppendThumbnail |
|
3226 // output \tThumbnail\ticon |
|
3227 // --------------------------------------------------------- |
|
3228 // |
|
3229 void CSpeedDialPrivate::AppendThumbnail( |
|
3230 const TSpdiaIndexDataVPbk& aSdmData, |
|
3231 TPtr& aText, |
|
3232 TBool aFixedLocation ) |
|
3233 { |
|
3234 if (!aFixedLocation) |
|
3235 { |
|
3236 aText.Append(KDesTab2); |
|
3237 return; |
|
3238 } |
|
3239 |
|
3240 aText.Append(KDesTab); |
|
3241 if ( aSdmData.ThumbIndex() >= 0 && aSdmData.ThumbSize().iWidth > 0 ) |
|
3242 { |
|
3243 aText.AppendNum(aSdmData.ThumbIndex()); |
|
3244 } |
|
3245 |
|
3246 aText.Append(KDesTab); |
|
3247 if (aSdmData.IconIndex() >= 0) |
|
3248 { |
|
3249 aText.AppendNum(aSdmData.IconIndex()); |
|
3250 } |
|
3251 } |
|
3252 |
|
3253 |
|
3254 |
|
3255 |
|
3256 |
|
3257 // --------------------------------------------------------- |
|
3258 // CSpeedDialPrivate::AssignSpeedDial |
|
3259 // |
|
3260 // --------------------------------------------------------- |
|
3261 // |
|
3262 |
|
3263 TBool CSpeedDialPrivate::AssignSpeedDialL(TInt aIndex) |
|
3264 { |
|
3265 TBool aReturn (EFalse); |
|
3266 |
|
3267 MVPbkContactOperationBase* operation = NULL; |
|
3268 |
|
3269 iSpeedDial->SetIndex(aIndex+1); |
|
3270 |
|
3271 iOperationComplete = EFalse; |
|
3272 (*iSdmArray)[aIndex].Contact()->LockL(*this); |
|
3273 |
|
3274 while(!iOperationComplete) |
|
3275 { |
|
3276 Wait(); |
|
3277 } |
|
3278 if(iError == KErrNone) |
|
3279 { |
|
3280 |
|
3281 MVPbkStoreContactField* field = (*iSdmArray)[aIndex].Field(); |
|
3282 iOperationComplete = EFalse; |
|
3283 |
|
3284 if( field != NULL) |
|
3285 { |
|
3286 operation = iAttributeManager->SetFieldAttributeL( *field, *iSpeedDial, ( *this ) ); |
|
3287 } |
|
3288 |
|
3289 if(operation != NULL) |
|
3290 { |
|
3291 (*iSdmArray)[aIndex].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_ASSIGN); |
|
3292 while(!iOperationComplete) |
|
3293 { |
|
3294 Wait(); |
|
3295 } |
|
3296 |
|
3297 } |
|
3298 if(iError == KErrNone) |
|
3299 { |
|
3300 aReturn = ETrue; |
|
3301 } |
|
3302 } |
|
3303 |
|
3304 return aReturn; |
|
3305 } |
|
3306 |
|
3307 |
|
3308 |
|
3309 // --------------------------------------------------------- |
|
3310 // CSpeedDialPrivate::RemoveSpeedDial |
|
3311 // |
|
3312 // --------------------------------------------------------- |
|
3313 // |
|
3314 |
|
3315 TBool CSpeedDialPrivate::RemoveSpeedDialL(TInt aIndex) |
|
3316 { |
|
3317 TBool aReturn (EFalse); |
|
3318 |
|
3319 if((*iSdmArray)[aIndex].Field() != NULL) |
|
3320 { |
|
3321 iError = KErrNone; |
|
3322 |
|
3323 iOperationComplete = EFalse; |
|
3324 iSpeedDial->SetIndex(aIndex+1); |
|
3325 (*iSdmArray)[aIndex].Contact()->LockL(*this); |
|
3326 |
|
3327 while(!iOperationComplete) |
|
3328 { |
|
3329 Wait(); |
|
3330 } |
|
3331 |
|
3332 if(iError == KErrNone) |
|
3333 { |
|
3334 iOperationComplete = EFalse; |
|
3335 MVPbkContactOperationBase* operation = iAttributeManager->RemoveFieldAttributeL( |
|
3336 *((*iSdmArray)[aIndex].Field()), *iSpeedDial, (*this)); |
|
3337 |
|
3338 if(operation) |
|
3339 { |
|
3340 |
|
3341 (*iSdmArray)[aIndex].SetOperation(operation,TSpdiaIndexDataVPbk::OPERATION_REMOVE); |
|
3342 |
|
3343 while(!iOperationComplete) |
|
3344 { |
|
3345 Wait(); |
|
3346 } |
|
3347 |
|
3348 } |
|
3349 |
|
3350 if(iError == KErrNone) |
|
3351 { |
|
3352 aReturn = ETrue; |
|
3353 } |
|
3354 } |
|
3355 } |
|
3356 |
|
3357 return aReturn; |
|
3358 } |
|
3359 |
|
3360 // --------------------------------------------------------- |
|
3361 // CSpeedDialPrivate::ContactTitleL |
|
3362 // |
|
3363 // --------------------------------------------------------- |
|
3364 // |
|
3365 |
|
3366 EXPORT_C HBufC* CSpeedDialPrivate::ContactTitleL( MVPbkBaseContact* aContact, TBool aUnnamed ) |
|
3367 { |
|
3368 |
|
3369 |
|
3370 HBufC* title = NULL; |
|
3371 |
|
3372 if (aContact != NULL) |
|
3373 { |
|
3374 CPbk2SortOrderManager* sortOrderManager = CPbk2SortOrderManager::NewL( iContactManager->FieldTypes() ); |
|
3375 |
|
3376 MPbk2ContactNameFormatter* nameFormatter = Pbk2ContactNameFormatterFactory::CreateL( |
|
3377 iContactManager->FieldTypes(), |
|
3378 *sortOrderManager ); |
|
3379 title = nameFormatter->GetContactTitleOrNullL( aContact->Fields(), KContactFormattingFlags ); |
|
3380 |
|
3381 if (title == NULL && aUnnamed) |
|
3382 { |
|
3383 title = nameFormatter->UnnamedText().AllocL(); |
|
3384 } |
|
3385 |
|
3386 delete sortOrderManager; |
|
3387 delete nameFormatter; |
|
3388 } |
|
3389 |
|
3390 return title; |
|
3391 |
|
3392 } |
|
3393 |
|
3394 // --------------------------------------------------------- |
|
3395 // CSpeedDialPrivate::Release |
|
3396 // |
|
3397 // --------------------------------------------------------- |
|
3398 // |
|
3399 void CSpeedDialPrivate::Release( ) |
|
3400 { |
|
3401 |
|
3402 |
|
3403 if( iWait->IsStarted() ) |
|
3404 { |
|
3405 iWait->AsyncStop(); |
|
3406 } |
|
3407 } |
|
3408 |
|
3409 // --------------------------------------------------------- |
|
3410 // CSpeedDialPrivate::Wait |
|
3411 // |
|
3412 // --------------------------------------------------------- |
|
3413 // |
|
3414 void CSpeedDialPrivate::Wait() |
|
3415 { |
|
3416 if( !(iWait->IsStarted()) ) |
|
3417 iWait->Start(); |
|
3418 |
|
3419 } |
|
3420 |
|
3421 // --------------------------------------------------------- |
|
3422 // CSpeedDialPrivate::Cancel |
|
3423 // To cancel the aiw event |
|
3424 // --------------------------------------------------------- |
|
3425 // |
|
3426 TBool CSpeedDialPrivate::Cancel() |
|
3427 { |
|
3428 if(!iOperationComplete) |
|
3429 { |
|
3430 iOperationComplete = ETrue; |
|
3431 } |
|
3432 if(iQueryDialog) |
|
3433 { |
|
3434 delete iQueryDialog; |
|
3435 iQueryDialog = NULL; |
|
3436 } |
|
3437 if ( iServiceHandler ) |
|
3438 { |
|
3439 TRAP_IGNORE( |
|
3440 { |
|
3441 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
3442 CAiwGenericParamList& outParamList = iServiceHandler->OutParamListL(); |
|
3443 iServiceHandler->ExecuteServiceCmdL( |
|
3444 KAiwCmdAssign, |
|
3445 inParamList, |
|
3446 outParamList, |
|
3447 KAiwOptCancel, NULL ); |
|
3448 } |
|
3449 ) |
|
3450 } |
|
3451 |
|
3452 Release(); |
|
3453 iCancelFlag = ETrue; |
|
3454 return ETrue; |
|
3455 } |
|
3456 |
|
3457 // --------------------------------------------------------- |
|
3458 // CSpeedDialPrivate::GetWait |
|
3459 // Monitor iWait |
|
3460 // --------------------------------------------------------- |
|
3461 // |
|
3462 EXPORT_C CActiveSchedulerWait* CSpeedDialPrivate::GetWait() |
|
3463 { |
|
3464 return iWait; |
|
3465 } |
|
3466 |
|
3467 // --------------------------------------------------------- |
|
3468 // CSpeedDialPrivate::ReplaceNonGraphicCharacters |
|
3469 // To replace nongraphic characters (e.g.:- newline) |
|
3470 // --------------------------------------------------------- |
|
3471 // |
|
3472 void CSpeedDialPrivate::ReplaceNonGraphicCharacters( TDes& aText, TText aChar ) |
|
3473 { |
|
3474 const TInt len = aText.Length(); |
|
3475 |
|
3476 const TUint KPbkZWSCharacter = 0x200B; |
|
3477 const TUint KPbkZWNJCharacter = 0x200C; |
|
3478 |
|
3479 // Zero Width Space character |
|
3480 const TChar zwsChar( KPbkZWSCharacter ); |
|
3481 // Zero Width Non-Joiner character |
|
3482 const TChar zwnjChar( KPbkZWNJCharacter ); |
|
3483 |
|
3484 for ( TInt i=0; i < len; ++i ) |
|
3485 { |
|
3486 if ( !TChar(aText[i]).IsGraph() && |
|
3487 ( (zwsChar != aText[i]) && (zwnjChar != aText[i]) ) ) |
|
3488 { |
|
3489 // If non-graphic char is specified in ZWSCharacter, |
|
3490 // it will not be replaced. Otherwise replace non-graphic |
|
3491 // character with aChar. |
|
3492 aText[i] = aChar; |
|
3493 } |
|
3494 } |
|
3495 |
|
3496 aText.Trim(); |
|
3497 } |
|
3498 |
|
3499 // --------------------------------------------------------- |
|
3500 // CSpeedDialPrivate::SetRefreshObserver |
|
3501 // Set refresh observer. |
|
3502 // --------------------------------------------------------- |
|
3503 // |
|
3504 EXPORT_C void CSpeedDialPrivate::SetRefreshObserver( MRefreshObserver* aObserver ) |
|
3505 { |
|
3506 iRefreshObserver = aObserver; |
|
3507 } |
|
3508 |
|
3509 // --------------------------------------------------------- |
|
3510 // CSpeedDialPrivate::SetCurrentGridIndex |
|
3511 // set the currentindex |
|
3512 // --------------------------------------------------------- |
|
3513 // |
|
3514 EXPORT_C void CSpeedDialPrivate::SetCurrentGridIndex( TInt aCurrentGridIndex ) |
|
3515 { |
|
3516 iCurrentIndex = aCurrentGridIndex; |
|
3517 } |
|
3518 |
|
3519 |
|
3520 // --------------------------------------------------------- |
|
3521 // CSpeedDialPrivate::SetGridDataAsNull |
|
3522 // Set iGrid and iIconArray as Null |
|
3523 // --------------------------------------------------------- |
|
3524 // |
|
3525 EXPORT_C void CSpeedDialPrivate::SetGridDataAsNull() |
|
3526 { |
|
3527 iGrid = NULL; |
|
3528 iIconArray = NULL; |
|
3529 } |
|
3530 // --------------------------------------------------------- |
|
3531 // CSpeedDialPrivate::SetCurrentGridIndex |
|
3532 // set the currentindex |
|
3533 // --------------------------------------------------------- |
|
3534 // |
|
3535 void CSpeedDialPrivate::ShowNoteL( TInt aResourceId ) |
|
3536 { |
|
3537 HBufC* prompt = StringLoader::LoadLC( aResourceId ); |
|
3538 CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( EFalse ); |
|
3539 dlg->ExecuteLD( *prompt ); |
|
3540 CleanupStack::PopAndDestroy(); // prompt |
|
3541 } |
|
3542 // End of the file |
|
3543 |