author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:56:55 +0300 | |
branch | RCL_3 |
changeset 74 | 6b5524b4f673 |
parent 68 | 9da50d567e3c |
child 85 | 38bb213f60ba |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Temporary listbox model. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <VPbkContactStoreUris.h> |
|
19 |
#include <VPbkUtils.h> |
|
20 |
#include <MVPbkBaseContactFieldCollection.h> |
|
21 |
#include <MVPbkBaseContactField.h> |
|
22 |
#include <MVPbkContactFieldTextData.h> |
|
23 |
#include <MVPbkContactFieldUriData.h> |
|
24 |
#include <MVPbkContactFieldDateTimeData.h> |
|
25 |
#include <MVPbkContactFieldData.h> |
|
26 |
#include <MVPbkContactLinkArray.h> |
|
27 |
#include <CVPbkContactManager.h> |
|
28 |
#include <MVPbkContactOperationBase.h> |
|
29 |
#include <MVPbkContactStoreProperties.h> |
|
30 |
#include <MVPbkContactStore.h> |
|
31 |
#include <MVPbkFieldType.h> |
|
32 |
#include <MVPbkStoreContact.h> |
|
33 |
#include <CVPbkTopContactManager.h> |
|
34 |
#include <MVPbkContactAttributeManager.h> |
|
35 |
#include <CVPbkSpeedDialAttribute.h> |
|
36 |
#include <CVPbkDefaultAttribute.h> |
|
37 |
#include <MVPbkStoreContactField2.h> |
|
38 |
||
39 |
#include <CPbk2StorePropertyArray.h> |
|
40 |
#include <MPbk2ContactNameFormatter.h> |
|
41 |
#include <MPbk2FieldProperty.h> |
|
42 |
#include <MPbk2FieldPropertyArray.h> |
|
43 |
#include <Pbk2FieldPropertiesFactory.h> |
|
44 |
#include <TPbk2StoreContactAnalyzer.h> |
|
45 |
||
46 |
#include "TPbk2ContactEditorParams.h" |
|
47 |
#include "CPbk2ContactEditorDlg.h" |
|
48 |
||
49 |
#include "CPbk2ServiceManager.h" |
|
50 |
#include "CPbk2FieldPropertyArray.h" |
|
51 |
#include "CPbk2PresentationContact.h" |
|
52 |
#include "CPbk2PresentationContactField.h" |
|
53 |
#include "CPbk2PresentationContactFieldCollection.h" |
|
54 |
#include "CPbk2StoreSpecificFieldPropertyArray.h" |
|
55 |
#include "CPbk2IconArray.h" |
|
56 |
#include <CPbk2UIExtensionManager.h> |
|
57 |
#include <CPbk2ApplicationServices.h> |
|
58 |
#include <Pbk2PresentationUtils.h> |
|
59 |
#include <Pbk2AddressTools.h> |
|
60 |
#include <TVPbkFieldTypeParameters.h> |
|
61 |
#include <TVPbkFieldVersitProperty.h> |
|
62 |
#include <StringLoader.h> |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
63 |
#include <featmgr.h> |
63 | 64 |
#include <TPbk2AppIconId.h> |
65 |
||
66 |
#include <aknlists.h> |
|
67 |
||
68 |
#include <avkon.rsg> |
|
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
69 |
#include <vpbkeng.rsg> |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
70 |
#include <pbk2uicontrols.rsg> |
63 | 71 |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
72 |
#include <Pbk2Config.hrh> |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
73 |
|
63 | 74 |
#include "ccappdetailsviewlistboxmodel.h" |
75 |
#include "ccappdetailsviewdefs.h" |
|
76 |
#include <ccappdetailsviewpluginrsc.rsg> |
|
77 |
#include "ccappdetailsviewplugin.h" |
|
78 |
#include "ccappdetailsviewpluginuids.hrh" |
|
79 |
#include "ccappdetailsview.hrh" |
|
80 |
||
81 |
const TInt KCacheGranularity = 4; |
|
82 |
const TInt KBufferSize = 256; |
|
83 |
||
84 |
_LIT( KCharsToReplace, "\t" ); |
|
85 |
_LIT( KReplacementChars, " " ); |
|
86 |
||
87 |
const TText KReplacedChars = ' '; |
|
88 |
||
89 |
||
90 |
// ======== LOCAL FUNCTIONS ======== |
|
91 |
||
92 |
// Utility to check file existence without BAFL |
|
93 |
inline TBool FileExists(RFs& aFs, const TDesC& aFileName) |
|
94 |
{ |
|
95 |
TEntry ignore; |
|
96 |
return (aFs.Entry(aFileName, ignore) == KErrNone); |
|
97 |
} |
|
98 |
||
99 |
// ======== MEMBER FUNCTIONS ======== |
|
100 |
||
101 |
// -------------------------------------------------------------------------- |
|
102 |
// CCCAppDetailsViewListBoxRow::CCCAppDetailsViewListBoxRow |
|
103 |
// -------------------------------------------------------------------------- |
|
104 |
// |
|
105 |
inline CCCAppDetailsViewListBoxRow::CCCAppDetailsViewListBoxRow() |
|
106 |
{ |
|
107 |
} |
|
108 |
||
109 |
// -------------------------------------------------------------------------- |
|
110 |
// CCCAppDetailsViewListBoxRow::~CCCAppDetailsViewListBoxRow |
|
111 |
// -------------------------------------------------------------------------- |
|
112 |
// |
|
113 |
CCCAppDetailsViewListBoxRow::~CCCAppDetailsViewListBoxRow() |
|
114 |
{ |
|
115 |
iColumns.ResetAndDestroy(); |
|
116 |
} |
|
117 |
||
118 |
// -------------------------------------------------------------------------- |
|
119 |
// CCCAppDetailsViewListBoxRow::NewL |
|
120 |
// -------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
CCCAppDetailsViewListBoxRow* CCCAppDetailsViewListBoxRow::NewL() |
|
123 |
{ |
|
124 |
return new(ELeave) CCCAppDetailsViewListBoxRow; |
|
125 |
} |
|
126 |
||
127 |
// -------------------------------------------------------------------------- |
|
128 |
// CCCAppDetailsViewListBoxRow::ColumnCount |
|
129 |
// -------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
TInt CCCAppDetailsViewListBoxRow::ColumnCount() const |
|
132 |
{ |
|
133 |
return iColumns.Count(); |
|
134 |
} |
|
135 |
||
136 |
// -------------------------------------------------------------------------- |
|
137 |
// CCCAppDetailsViewListBoxRow::At |
|
138 |
// -------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
TPtrC CCCAppDetailsViewListBoxRow::At(TInt aColumnIndex) const |
|
141 |
{ |
|
142 |
return *iColumns[aColumnIndex]; |
|
143 |
} |
|
144 |
||
145 |
// -------------------------------------------------------------------------- |
|
146 |
// CCCAppDetailsViewListBoxRow::AppendColumnL |
|
147 |
// -------------------------------------------------------------------------- |
|
148 |
// |
|
149 |
void CCCAppDetailsViewListBoxRow::AppendColumnL(const TDesC& aColumnText) |
|
150 |
{ |
|
151 |
HBufC* buf = aColumnText.AllocLC(); |
|
152 |
User::LeaveIfError(iColumns.Append(buf)); |
|
153 |
CleanupStack::Pop(buf); |
|
154 |
} |
|
155 |
||
156 |
// -------------------------------------------------------------------------- |
|
157 |
// CCCAppDetailsViewListBoxRow::IsClipRequired |
|
158 |
// -------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
TBool CCCAppDetailsViewListBoxRow::IsClipRequired() const |
|
161 |
{ |
|
162 |
return iClipBeginning; |
|
163 |
} |
|
164 |
||
165 |
// -------------------------------------------------------------------------- |
|
166 |
// CCCAppDetailsViewListBoxRow::SetClipRequired |
|
167 |
// -------------------------------------------------------------------------- |
|
168 |
// |
|
169 |
void CCCAppDetailsViewListBoxRow::SetClipRequired(TBool aFlag) |
|
170 |
{ |
|
171 |
iClipBeginning = aFlag; |
|
172 |
} |
|
173 |
||
174 |
// -------------------------------------------------------------------------- |
|
175 |
// CCCAppDetailsViewListBoxRow::TotalLength |
|
176 |
// -------------------------------------------------------------------------- |
|
177 |
// |
|
178 |
TInt CCCAppDetailsViewListBoxRow::TotalLength() const |
|
179 |
{ |
|
180 |
TInt result = 0; |
|
181 |
const TInt count = iColumns.Count(); |
|
182 |
for (TInt i = 0; i < count; ++i) |
|
183 |
{ |
|
184 |
result += At(i).Length(); |
|
185 |
} |
|
186 |
return result; |
|
187 |
} |
|
188 |
||
189 |
// -------------------------------------------------------------------------- |
|
190 |
// CCCAppDetailsViewListBoxRow::MaxColumnLength |
|
191 |
// -------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
TInt CCCAppDetailsViewListBoxRow::MaxColumnLength() const |
|
194 |
{ |
|
195 |
TInt result = 0; |
|
196 |
const TInt count = iColumns.Count(); |
|
197 |
for (TInt i = 0; i < count; ++i) |
|
198 |
{ |
|
199 |
result = Max(result, At(i).Length()); |
|
200 |
} |
|
201 |
return result; |
|
202 |
} |
|
203 |
||
204 |
// --------------------------------------------------------------------------- |
|
205 |
// CCCAppDetailsViewListBoxModel::NewL |
|
206 |
// --------------------------------------------------------------------------- |
|
207 |
// |
|
208 |
CCCAppDetailsViewListBoxModel* CCCAppDetailsViewListBoxModel::NewL( |
|
209 |
CCoeEnv& aCoeEnv, |
|
210 |
CEikListBox& aListBox, |
|
211 |
CPbk2ApplicationServices* aApplicationServices, |
|
212 |
CPbk2IconArray& aIconArray, |
|
213 |
CCCAppDetailsViewPlugin& aPlugin) |
|
214 |
{ |
|
215 |
CCCAppDetailsViewListBoxModel* self = |
|
216 |
new(ELeave) CCCAppDetailsViewListBoxModel( |
|
217 |
aCoeEnv, aListBox, aApplicationServices, aIconArray, |
|
218 |
aPlugin); |
|
219 |
CleanupStack::PushL(self); |
|
220 |
self->ConstructL(); |
|
221 |
CleanupStack::Pop(self); |
|
222 |
||
223 |
return self; |
|
224 |
} |
|
225 |
||
226 |
// --------------------------------------------------------------------------- |
|
227 |
// CCCAppDetailsViewListBoxModel::~CCCAppDetailsViewListBoxModel |
|
228 |
// --------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
CCCAppDetailsViewListBoxModel::~CCCAppDetailsViewListBoxModel() |
|
231 |
{ |
|
232 |
Cancel(); |
|
233 |
||
234 |
iRows.ResetAndDestroy(); |
|
235 |
delete iLineBuf; |
|
236 |
delete iColumnBuf; |
|
237 |
delete iLinks; |
|
238 |
delete iStoreContact; |
|
239 |
delete iPresentationContact; |
|
240 |
delete iSpecificFieldProperties; |
|
241 |
delete iFieldProperties; |
|
242 |
delete iRetrieveOperation; |
|
243 |
iInxToPresentationIdx.Close(); |
|
244 |
} |
|
245 |
||
246 |
// --------------------------------------------------------------------------- |
|
247 |
// CCCAppDetailsViewListBoxModel::CCCAppDetailsViewListBoxModel |
|
248 |
// --------------------------------------------------------------------------- |
|
249 |
// |
|
250 |
CCCAppDetailsViewListBoxModel::CCCAppDetailsViewListBoxModel( |
|
251 |
CCoeEnv& aCoeEnv, |
|
252 |
CEikListBox& aListBox, |
|
253 |
CPbk2ApplicationServices* aApplicationServices, |
|
254 |
CPbk2IconArray& aIconArray, |
|
255 |
CCCAppDetailsViewPlugin& aPlugin) |
|
256 |
: |
|
257 |
CActive(EPriorityStandard), |
|
258 |
iCoeEnv(aCoeEnv), |
|
259 |
iListBox(aListBox), |
|
260 |
iRows(KCacheGranularity), |
|
261 |
iAppServices(aApplicationServices), |
|
262 |
iIconArray(aIconArray), |
|
263 |
iCommand(ECCAppDetailsViewCommandNone), |
|
264 |
iIsEditingAborted(EFalse), |
|
265 |
iPlugin(aPlugin) |
|
266 |
{ |
|
267 |
CActiveScheduler::Add(this); |
|
268 |
} |
|
269 |
||
270 |
// --------------------------------------------------------------------------- |
|
271 |
// CCCAppDetailsViewListBoxModel::ConstructL |
|
272 |
// --------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
void CCCAppDetailsViewListBoxModel::ConstructL() |
|
275 |
{ |
|
276 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewListBoxModel::ConstructL()")); |
|
277 |
||
278 |
CCA_DP(KDetailsViewLogFile, CCA_L("iInitialFocusIndex = %d"), iInitialFocusIndex); |
|
279 |
||
280 |
iLineBuf = HBufC::NewL(KBufferSize); |
|
281 |
iColumnBuf = HBufC::NewL(KBufferSize); |
|
282 |
||
283 |
CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewListBoxModel::ConstructL()")); |
|
284 |
} |
|
285 |
||
286 |
// --------------------------------------------------------------------------- |
|
287 |
// CCCAppDetailsViewListBoxModel::SetLinks |
|
288 |
// --------------------------------------------------------------------------- |
|
289 |
// |
|
290 |
void CCCAppDetailsViewListBoxModel::SetLinks(MVPbkContactLinkArray* aLinks) |
|
291 |
{ |
|
292 |
delete iLinks; |
|
293 |
iLinks = aLinks; |
|
294 |
//iCurrentLink is now invalid since it points to old iLinks array |
|
295 |
iCurrentLink = NULL; |
|
296 |
||
297 |
delete iRetrieveOperation; |
|
298 |
iRetrieveOperation = NULL; |
|
299 |
||
300 |
IssueRequest(); |
|
301 |
} |
|
302 |
||
303 |
// --------------------------------------------------------------------------- |
|
304 |
// CCCAppDetailsViewListBoxModel::Links |
|
305 |
// --------------------------------------------------------------------------- |
|
306 |
// |
|
307 |
MVPbkContactLinkArray* CCCAppDetailsViewListBoxModel::Links() const |
|
308 |
{ |
|
309 |
return iLinks; |
|
310 |
} |
|
311 |
||
312 |
// --------------------------------------------------------------------------- |
|
313 |
// CCCAppDetailsViewListBoxModel::OpenEditorL |
|
314 |
// --------------------------------------------------------------------------- |
|
315 |
// |
|
316 |
void CCCAppDetailsViewListBoxModel::OpenEditorL() |
|
317 |
{ |
|
318 |
if (iStoreContact) |
|
319 |
{ |
|
320 |
iCommand = ECCAppDetailsViewCommandEdit; |
|
321 |
iStoreContact->LockL(*this); |
|
322 |
} |
|
323 |
} |
|
324 |
||
325 |
// --------------------------------------------------------------------------- |
|
326 |
// CCCAppDetailsViewListBoxModel::FocusedFieldIndex |
|
327 |
// --------------------------------------------------------------------------- |
|
328 |
// |
|
329 |
TInt CCCAppDetailsViewListBoxModel::FocusedFieldIndex() |
|
330 |
{ |
|
331 |
TInt *index = iInxToPresentationIdx.Find(iListBox.CurrentItemIndex()); |
|
332 |
||
333 |
if (index && *index >= KErrNone) |
|
334 |
{ |
|
335 |
return iPresentationContact->PresentationFields().StoreIndexOfField(*index); |
|
336 |
} |
|
337 |
else |
|
338 |
{ |
|
339 |
return KErrNotFound; |
|
340 |
} |
|
341 |
} |
|
342 |
||
343 |
// --------------------------------------------------------------------------- |
|
344 |
// CCCAppDetailsViewListBoxModel::FocusedListIndex |
|
345 |
// --------------------------------------------------------------------------- |
|
346 |
// |
|
347 |
TInt CCCAppDetailsViewListBoxModel::FocusedListIndex() |
|
348 |
{ |
|
349 |
return iListBox.CurrentItemIndex(); |
|
350 |
} |
|
351 |
||
352 |
// --------------------------------------------------------------------------- |
|
353 |
// CCCAppDetailsViewListBoxModel::SetFocusedListIndex |
|
354 |
// --------------------------------------------------------------------------- |
|
355 |
// |
|
356 |
void CCCAppDetailsViewListBoxModel::SetFocusedListIndex(TInt aIndex) |
|
357 |
{ |
|
358 |
TInt items = iListBox.Model()->NumberOfItems(); |
|
359 |
||
360 |
if (aIndex >= items) |
|
361 |
{ |
|
362 |
aIndex = items - 1; |
|
363 |
} |
|
364 |
if (aIndex < 0) |
|
365 |
{ |
|
366 |
aIndex = 0; |
|
367 |
} |
|
368 |
||
369 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewListBoxModel::SetFocusedListIndex( %d )"), aIndex); |
|
370 |
||
371 |
iListBox.SetCurrentItemIndexAndDraw(aIndex); |
|
372 |
} |
|
373 |
||
374 |
// --------------------------------------------------------------------------- |
|
375 |
// CCCAppDetailsViewListBoxModel::SetInitialFocusIndex |
|
376 |
// --------------------------------------------------------------------------- |
|
377 |
// |
|
378 |
void CCCAppDetailsViewListBoxModel::SetInitialFocusIndex(TInt aIndex) |
|
379 |
{ |
|
380 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewListBoxModel::SetInitialFocusIndex( %d )"), aIndex); |
|
381 |
||
382 |
if (aIndex >= 0) |
|
383 |
{ |
|
384 |
iInitialFocusIndex = aIndex; |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
TInt CCCAppDetailsViewListBoxModel::FindFocusListIndexByStoreIndex(TInt aIndex) |
|
389 |
{ |
|
390 |
TInt fieldIndex = iPresentationContact->PresentationFields().FieldIndexOfStoreField( aIndex ); |
|
391 |
||
392 |
TInt focusListIndex = KErrNotFound; |
|
393 |
||
394 |
TInt count = iInxToPresentationIdx.Count(); |
|
395 |
||
396 |
for ( TInt i = 0; i < count && focusListIndex == KErrNotFound; i++ ) |
|
397 |
{ |
|
398 |
TInt *index = iInxToPresentationIdx.Find( i ); |
|
399 |
if ( index && *index >= KErrNone && *index == fieldIndex ) |
|
400 |
{ |
|
401 |
focusListIndex = i; |
|
402 |
} |
|
403 |
} |
|
404 |
return focusListIndex; |
|
405 |
} |
|
406 |
||
407 |
||
408 |
// -------------------------------------------------------------------------- |
|
409 |
// CCCAppDetailsViewListBoxModel::FocusedFieldLC |
|
410 |
// -------------------------------------------------------------------------- |
|
411 |
// |
|
412 |
MVPbkBaseContactField* CCCAppDetailsViewListBoxModel::FocusedFieldLC() |
|
413 |
{ |
|
414 |
const TInt listIndex = iListBox.CurrentItemIndex(); |
|
415 |
||
416 |
if (listIndex != KErrNotFound) |
|
417 |
{ |
|
418 |
return FieldAtLC(listIndex); |
|
419 |
} |
|
420 |
||
421 |
return NULL; |
|
422 |
} |
|
423 |
||
424 |
// -------------------------------------------------------------------------- |
|
425 |
// CCCAppDetailsViewListBoxModel::StoreContact |
|
426 |
// -------------------------------------------------------------------------- |
|
427 |
// |
|
428 |
MVPbkStoreContact* CCCAppDetailsViewListBoxModel::StoreContact() |
|
429 |
{ |
|
430 |
return iStoreContact; |
|
431 |
} |
|
432 |
||
433 |
// -------------------------------------------------------------------------- |
|
434 |
// CCCAppDetailsViewListBoxModel::GetContactTitleL |
|
435 |
// -------------------------------------------------------------------------- |
|
436 |
// |
|
437 |
HBufC* CCCAppDetailsViewListBoxModel::GetContactTitleL() |
|
438 |
{ |
|
439 |
||
440 |
HBufC* title = iAppServices->NameFormatter().GetContactTitleL( |
|
441 |
iStoreContact->Fields(), |
|
442 |
MPbk2ContactNameFormatter::EPreserveLeadingSpaces | |
|
443 |
MPbk2ContactNameFormatter::EUseSeparator); |
|
444 |
||
445 |
return title; |
|
446 |
} |
|
447 |
||
448 |
// -------------------------------------------------------------------------- |
|
449 |
// CCCAppDetailsViewListBoxModel::IsFocusedFieldTypeL |
|
450 |
// -------------------------------------------------------------------------- |
|
451 |
// |
|
452 |
TBool CCCAppDetailsViewListBoxModel::IsFocusedFieldTypeL(TInt aSelectorResId) |
|
453 |
{ |
|
454 |
TBool ret = EFalse; |
|
455 |
||
456 |
MVPbkBaseContactField* field = FocusedFieldLC(); |
|
457 |
||
458 |
if (field) |
|
459 |
{ |
|
460 |
TPbk2StoreContactAnalyzer analyzer( |
|
461 |
iAppServices->ContactManager(), NULL); |
|
462 |
||
463 |
ret = analyzer.IsFieldTypeIncludedL(*field, aSelectorResId); |
|
464 |
||
465 |
CleanupStack::PopAndDestroy(field); |
|
466 |
} |
|
467 |
||
468 |
return ret; |
|
469 |
} |
|
470 |
||
471 |
// -------------------------------------------------------------------------- |
|
472 |
// CCCAppDetailsViewListBoxModel::HasContactFieldTypeL |
|
473 |
// -------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
TBool CCCAppDetailsViewListBoxModel::HasContactFieldTypeL(TInt aSelectorResId) |
|
476 |
{ |
|
477 |
TBool ret = EFalse; |
|
478 |
||
479 |
TPbk2StoreContactAnalyzer analyzer( |
|
480 |
iAppServices->ContactManager(), iStoreContact); |
|
481 |
||
482 |
ret = analyzer.HasFieldL(aSelectorResId); |
|
483 |
||
484 |
return (ret != KErrNotFound); |
|
485 |
} |
|
486 |
||
487 |
// -------------------------------------------------------------------------- |
|
488 |
// CCCAppDetailsViewListBoxModel::IsTopContact |
|
489 |
// -------------------------------------------------------------------------- |
|
490 |
// |
|
491 |
TBool CCCAppDetailsViewListBoxModel::IsTopContact() const |
|
492 |
{ |
|
493 |
return CVPbkTopContactManager::IsTopContact(*iStoreContact); |
|
494 |
} |
|
495 |
||
496 |
// -------------------------------------------------------------------------- |
|
497 |
// CCCAppDetailsViewListBoxModel::IsReadOnlyContact |
|
498 |
// -------------------------------------------------------------------------- |
|
499 |
// |
|
500 |
TBool CCCAppDetailsViewListBoxModel::IsReadOnlyContact() const |
|
501 |
{ |
|
502 |
return iStoreContact->ParentStore().StoreProperties().ReadOnly(); |
|
503 |
} |
|
504 |
||
505 |
// --------------------------------------------------------------------------- |
|
506 |
// CCCAppDetailsViewListBoxModel::IsSimContact |
|
507 |
// --------------------------------------------------------------------------- |
|
508 |
// |
|
509 |
TBool CCCAppDetailsViewListBoxModel::IsSimContact() const |
|
510 |
{ |
|
511 |
TVPbkContactStoreUriPtr adnUri(VPbkContactStoreUris::SimGlobalAdnUri()); |
|
512 |
TVPbkContactStoreUriPtr fdnUri(VPbkContactStoreUris::SimGlobalFdnUri()); |
|
513 |
||
514 |
TVPbkContactStoreUriPtr uri = |
|
515 |
iStoreContact->ParentStore().StoreProperties().Uri(); |
|
516 |
||
517 |
return ( |
|
518 |
(uri.Compare(adnUri, |
|
519 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents) == 0) |
|
520 |
|| |
|
521 |
(uri.Compare(fdnUri, |
|
522 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents) == 0) |
|
523 |
); |
|
524 |
} |
|
525 |
||
526 |
// --------------------------------------------------------------------------- |
|
527 |
// CCCAppDetailsViewListBoxModel::IsSdnContact |
|
528 |
// --------------------------------------------------------------------------- |
|
529 |
// |
|
530 |
TBool CCCAppDetailsViewListBoxModel::IsSdnContact() const |
|
531 |
{ |
|
532 |
TVPbkContactStoreUriPtr sdnUri(VPbkContactStoreUris::SimGlobalSdnUri()); |
|
533 |
||
534 |
TVPbkContactStoreUriPtr uri = |
|
535 |
iStoreContact->ParentStore().StoreProperties().Uri(); |
|
536 |
||
537 |
return (uri.Compare(sdnUri, |
|
538 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents) == 0); |
|
539 |
} |
|
540 |
||
541 |
// -------------------------------------------------------------------------- |
|
542 |
// CCCAppDetailsViewListBoxModel::HasSpeedDialL |
|
543 |
// -------------------------------------------------------------------------- |
|
544 |
// |
|
545 |
TBool CCCAppDetailsViewListBoxModel::HasSpeedDialL(TInt aIndex) |
|
546 |
{ |
|
547 |
TBool hasAttribute = EFalse; |
|
548 |
||
549 |
if (aIndex != KErrNotFound) |
|
550 |
{ |
|
551 |
const MVPbkStoreContactField& field = |
|
552 |
iStoreContact->Fields().FieldAt(aIndex); |
|
553 |
||
554 |
hasAttribute = iAppServices->ContactManager().ContactAttributeManagerL(). |
|
555 |
HasFieldAttributeL(CVPbkSpeedDialAttribute::Uid(), field); |
|
556 |
} |
|
557 |
||
558 |
return hasAttribute; |
|
559 |
} |
|
560 |
||
561 |
// -------------------------------------------------------------------------- |
|
562 |
// CCCAppDetailsViewListBoxModel::HasDefaultsL |
|
563 |
// -------------------------------------------------------------------------- |
|
564 |
// |
|
565 |
TBool CCCAppDetailsViewListBoxModel::HasDefaultsL(TInt aIndex) |
|
566 |
{ |
|
567 |
TBool hasAttribute = EFalse; |
|
568 |
||
569 |
if (aIndex != KErrNotFound) |
|
570 |
{ |
|
571 |
const MVPbkStoreContactField& field = |
|
572 |
iStoreContact->Fields().FieldAt(aIndex); |
|
573 |
||
574 |
hasAttribute = iAppServices->ContactManager().ContactAttributeManagerL(). |
|
575 |
HasFieldAttributeL(CVPbkDefaultAttribute::Uid(), field); |
|
576 |
} |
|
577 |
||
578 |
return hasAttribute; |
|
579 |
} |
|
580 |
||
581 |
// --------------------------------------------------------------------------- |
|
582 |
// CCCAppDetailsViewListBoxModel::RunL |
|
583 |
// --------------------------------------------------------------------------- |
|
584 |
// |
|
585 |
void CCCAppDetailsViewListBoxModel::RunL() |
|
586 |
{ |
|
587 |
TInt index = 0; |
|
588 |
||
589 |
if (iLinks && iCurrentLink) |
|
590 |
{ |
|
591 |
index = iLinks->Find(*iCurrentLink) + 1; |
|
592 |
} |
|
593 |
||
594 |
if (iAppServices && iLinks && index < iLinks->Count()) |
|
595 |
{ |
|
596 |
iCurrentLink = &iLinks->At(index); |
|
597 |
||
598 |
iRetrieveOperation = iAppServices->ContactManager().RetrieveContactL |
|
599 |
(*iCurrentLink, *this); |
|
600 |
} |
|
601 |
else |
|
602 |
{ |
|
603 |
iCurrentLink = NULL; |
|
604 |
} |
|
605 |
} |
|
606 |
||
607 |
// --------------------------------------------------------------------------- |
|
608 |
// CCCAppDetailsViewListBoxModel::RunError |
|
609 |
// --------------------------------------------------------------------------- |
|
610 |
// |
|
611 |
TInt CCCAppDetailsViewListBoxModel::RunError(TInt aError) |
|
612 |
{ |
|
613 |
return aError; |
|
614 |
} |
|
615 |
||
616 |
// --------------------------------------------------------------------------- |
|
617 |
// CCCAppDetailsViewListBoxModel::DoCancel |
|
618 |
// --------------------------------------------------------------------------- |
|
619 |
// |
|
620 |
void CCCAppDetailsViewListBoxModel::DoCancel() |
|
621 |
{ |
|
622 |
} |
|
623 |
||
624 |
// -------------------------------------------------------------------------- |
|
625 |
// CCCAppDetailsViewListBoxModel::ContactOperationCompleted |
|
626 |
// -------------------------------------------------------------------------- |
|
627 |
// |
|
628 |
void CCCAppDetailsViewListBoxModel::ContactOperationCompleted( |
|
629 |
TContactOpResult /*aResult*/) |
|
630 |
{ |
|
631 |
if (iCommand == ECCAppDetailsViewCommandEdit) |
|
632 |
{ |
|
633 |
// open editing dialog |
|
634 |
TRAP_IGNORE(ExecuteEditorL()); |
|
635 |
||
636 |
iCommand = ECCAppDetailsViewCommandNone; |
|
637 |
} |
|
638 |
} |
|
639 |
||
640 |
// -------------------------------------------------------------------------- |
|
641 |
// CCCAppDetailsViewListBoxModel::ContactOperationFailed |
|
642 |
// -------------------------------------------------------------------------- |
|
643 |
// |
|
644 |
void CCCAppDetailsViewListBoxModel::ContactOperationFailed( |
|
645 |
TContactOp /*aOpCode*/, |
|
646 |
TInt /*aErrorCode*/, |
|
647 |
TBool /*aErrorNotified*/) |
|
648 |
{ |
|
649 |
} |
|
650 |
||
651 |
// -------------------------------------------------------------------------- |
|
652 |
// CCCAppDetailsViewListBoxModel::ContactEditingComplete |
|
653 |
// -------------------------------------------------------------------------- |
|
654 |
// |
|
655 |
void CCCAppDetailsViewListBoxModel::ContactEditingComplete( |
|
656 |
MVPbkStoreContact* aEditedContact) |
|
657 |
{ |
|
658 |
iStoreContact = aEditedContact; |
|
659 |
} |
|
660 |
||
661 |
// -------------------------------------------------------------------------- |
|
662 |
// CCCAppDetailsViewListBoxModel::ContactEditingDeletedContact |
|
663 |
// -------------------------------------------------------------------------- |
|
664 |
// |
|
665 |
void CCCAppDetailsViewListBoxModel::ContactEditingDeletedContact( |
|
666 |
MVPbkStoreContact* aEditedContact) |
|
667 |
{ |
|
668 |
iStoreContact = aEditedContact; |
|
669 |
} |
|
670 |
||
671 |
// -------------------------------------------------------------------------- |
|
672 |
// CCCAppDetailsViewListBoxModel::ContactEditingAborted |
|
673 |
// -------------------------------------------------------------------------- |
|
674 |
// |
|
675 |
void CCCAppDetailsViewListBoxModel::ContactEditingAborted() |
|
676 |
{ |
|
677 |
iIsEditingAborted = ETrue; |
|
678 |
} |
|
679 |
||
680 |
// --------------------------------------------------------------------------- |
|
681 |
// CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationComplete |
|
682 |
// --------------------------------------------------------------------------- |
|
683 |
// |
|
684 |
void CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationComplete( |
|
685 |
MVPbkContactOperationBase& /*aOperation*/, |
|
686 |
MVPbkStoreContact* aContact) |
|
687 |
{ |
|
688 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationComplete()")); |
|
689 |
||
690 |
delete iRetrieveOperation; |
|
691 |
iRetrieveOperation = NULL; |
|
692 |
||
693 |
delete iStoreContact; |
|
694 |
iStoreContact = aContact; |
|
695 |
||
696 |
TRAP_IGNORE( |
|
697 |
CreatePresentationContactL(); |
|
698 |
AddDataL(); |
|
699 |
SetTitleL(); |
|
700 |
UpdateMSKinCbaL(); |
|
701 |
); |
|
702 |
||
703 |
// check if any item highlighted |
|
704 |
TBool highLightEnabled = iListBox.IsHighlightEnabled(); |
|
705 |
if ( !highLightEnabled ) |
|
706 |
{ |
|
707 |
SetFocusedListIndex(iInitialFocusIndex); |
|
708 |
} |
|
709 |
||
710 |
/*if (!iXspIdModifyState) |
|
711 |
{ |
|
712 |
iXspIdModifyState++; |
|
713 |
switch (iXspIdModifyState) |
|
714 |
{ |
|
715 |
case 1: |
|
716 |
aContact->LockL(*this); |
|
717 |
break; |
|
718 |
default: |
|
719 |
// Continue, the xspid is set now |
|
720 |
IssueRequest(); |
|
721 |
break; |
|
722 |
} |
|
723 |
} |
|
724 |
else*/ |
|
725 |
{ |
|
726 |
IssueRequest(); |
|
727 |
} |
|
728 |
||
729 |
CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationComplete()")); |
|
730 |
} |
|
731 |
||
732 |
// --------------------------------------------------------------------------- |
|
733 |
// CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationFailed |
|
734 |
// --------------------------------------------------------------------------- |
|
735 |
// |
|
736 |
void CCCAppDetailsViewListBoxModel::VPbkSingleContactOperationFailed( |
|
737 |
MVPbkContactOperationBase& /*aOperation*/, |
|
738 |
TInt /*aError*/) |
|
739 |
{ |
|
740 |
delete iRetrieveOperation; |
|
741 |
iRetrieveOperation = NULL; |
|
742 |
||
743 |
IssueRequest(); |
|
744 |
} |
|
745 |
||
746 |
// --------------------------------------------------------------------------- |
|
747 |
// CCCAppDetailsViewListBoxModel::MdcaCount |
|
748 |
// --------------------------------------------------------------------------- |
|
749 |
// |
|
750 |
TInt CCCAppDetailsViewListBoxModel::MdcaCount() const |
|
751 |
{ |
|
752 |
return iRows.Count(); |
|
753 |
} |
|
754 |
||
755 |
// --------------------------------------------------------------------------- |
|
756 |
// CCCAppDetailsViewListBoxModel::MdcaPoint |
|
757 |
// --------------------------------------------------------------------------- |
|
758 |
// |
|
759 |
TPtrC CCCAppDetailsViewListBoxModel::MdcaPoint(TInt aIndex) const |
|
760 |
{ |
|
761 |
const TText KSeparator = '\t'; |
|
762 |
TPtr rowText(iLineBuf->Des()); |
|
763 |
rowText.Zero(); |
|
764 |
||
765 |
const CCCAppDetailsViewListBoxRow& row = *iRows[aIndex]; |
|
766 |
const TInt columnCount = row.ColumnCount(); |
|
767 |
TInt fieldCount = iPresentationContact->PresentationFields().FieldCount(); |
|
768 |
||
769 |
for (TInt index = 0; index < columnCount; ++index) |
|
770 |
{ |
|
771 |
TPtr columnText(iColumnBuf->Des()); |
|
772 |
columnText.Copy(row.At(index)); |
|
773 |
||
774 |
// Clip the column if required |
|
775 |
if (index == EContentColumn && row.IsClipRequired() && aIndex < fieldCount) |
|
776 |
{ |
|
777 |
ClipFromBeginning(columnText, aIndex, index); |
|
778 |
} |
|
779 |
||
780 |
// Append the column and separator to the formatted row |
|
781 |
rowText.Append(columnText); |
|
782 |
rowText.Append(KSeparator); |
|
783 |
} |
|
784 |
||
785 |
return rowText; |
|
786 |
} |
|
787 |
||
788 |
// --------------------------------------------------------------------------- |
|
789 |
// CCCAppDetailsViewListBoxModel::IssueRequest |
|
790 |
// --------------------------------------------------------------------------- |
|
791 |
// |
|
792 |
void CCCAppDetailsViewListBoxModel::IssueRequest(TInt aError) |
|
793 |
{ |
|
794 |
if (IsActive()) |
|
795 |
{ |
|
796 |
return; |
|
797 |
} |
|
798 |
TRequestStatus* status = &iStatus; |
|
799 |
User::RequestComplete(status, aError); |
|
800 |
SetActive(); |
|
801 |
} |
|
802 |
||
803 |
// --------------------------------------------------------------------------- |
|
804 |
// CCCAppDetailsViewListBoxModel::CreatePresentationContactL |
|
805 |
// --------------------------------------------------------------------------- |
|
806 |
// |
|
807 |
void CCCAppDetailsViewListBoxModel::CreatePresentationContactL() |
|
808 |
{ |
|
809 |
delete iSpecificFieldProperties; |
|
810 |
iSpecificFieldProperties = NULL; |
|
811 |
delete iFieldProperties; |
|
812 |
iFieldProperties = NULL; |
|
813 |
||
814 |
RFs& fsSession(iCoeEnv.FsSession()); |
|
815 |
||
816 |
const MVPbkContactStoreProperties& storeProperties = |
|
817 |
iStoreContact->ParentStore().StoreProperties(); |
|
818 |
const MVPbkFieldTypeList& supportedFieldTypes = |
|
819 |
storeProperties.SupportedFields(); |
|
820 |
||
821 |
CPbk2ServiceManager& servMan = iAppServices->ServiceManager(); |
|
822 |
||
823 |
iFieldProperties = |
|
824 |
CPbk2FieldPropertyArray::NewL(supportedFieldTypes, fsSession, &servMan); |
|
825 |
||
826 |
// Create a field property list of the supported |
|
827 |
// field types of the used store |
|
828 |
CPbk2StorePropertyArray& pbk2StoreProperties = iAppServices->StoreProperties(); |
|
829 |
||
830 |
iSpecificFieldProperties = CPbk2StoreSpecificFieldPropertyArray::NewL( |
|
831 |
*iFieldProperties, |
|
832 |
pbk2StoreProperties, |
|
833 |
supportedFieldTypes, |
|
834 |
iStoreContact->ParentStore()); |
|
835 |
||
836 |
delete iPresentationContact; |
|
837 |
iPresentationContact = NULL; |
|
838 |
||
839 |
iPresentationContact = |
|
840 |
CPbk2PresentationContact::NewL(*iStoreContact, *iSpecificFieldProperties); |
|
841 |
} |
|
842 |
||
843 |
// -------------------------------------------------------------------------- |
|
844 |
// CCCAppDetailsViewListBoxModel::AddDataL |
|
845 |
// -------------------------------------------------------------------------- |
|
846 |
// |
|
847 |
void CCCAppDetailsViewListBoxModel::AddDataL() |
|
848 |
{ |
|
849 |
//CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewListBoxModel::AddDataL()")); |
|
850 |
||
851 |
iRows.ResetAndDestroy(); |
|
852 |
iInxToPresentationIdx.Close(); |
|
853 |
||
854 |
SetEmptyTextL(R_QTN_PHOB_NO_ITEMS); // in pbk2uicontrols.rsg |
|
855 |
||
856 |
TInt fieldCount = iPresentationContact->PresentationFields().FieldCount(); |
|
857 |
||
858 |
TBuf<KBufferSize> buffer; |
|
859 |
||
860 |
TVPbkFieldTypeParameters fieldParams; |
|
861 |
TInt listIdx = -1; |
|
862 |
||
863 |
for (TInt index = 0; index < fieldCount; index++) |
|
864 |
{ |
|
865 |
CPbk2PresentationContactField& field = |
|
866 |
iPresentationContact->PresentationFields().At(index); |
|
867 |
||
868 |
// Get master field type list and match field's type against it |
|
869 |
const MVPbkFieldType* fieldType = VPbkUtils::MatchFieldType( |
|
870 |
iAppServices->ContactManager().FieldTypes(), field); |
|
871 |
||
872 |
// TODO: what about field.IsVisibleInDetailsView() ? |
|
873 |
||
874 |
if (field.IsEditable() && fieldType && !IsHiddenField(fieldType)) |
|
875 |
{ |
|
876 |
TInt labelResId = 0; |
|
877 |
TVPbkFieldTypeName fieldTypeName = EVPbkVersitNameNone; |
|
878 |
TPbk2FieldGroupId groupId = EPbk2FieldGroupIdNone; |
|
879 |
TArray<TVPbkFieldVersitProperty> versitArr = fieldType->VersitProperties(); |
|
880 |
||
881 |
if (versitArr.Count()) |
|
882 |
{ |
|
883 |
const TVPbkFieldVersitProperty& prop = versitArr[0]; |
|
884 |
||
885 |
if (prop.Name() == EVPbkVersitNameADR) |
|
886 |
{ |
|
887 |
if (versitArr[0].Parameters().Contains(EVPbkVersitParamHOME)) |
|
888 |
{ |
|
889 |
if (fieldParams.Contains(EVPbkVersitParamHOME)) |
|
890 |
{ |
|
891 |
continue; |
|
892 |
} |
|
893 |
fieldParams.Add(EVPbkVersitParamHOME); |
|
894 |
labelResId = R_QTN_PHOB_LBL_ADDRESS_HOME; |
|
895 |
groupId = EPbk2FieldGroupIdHomeAddress; |
|
896 |
} |
|
897 |
else if (versitArr[0].Parameters().Contains(EVPbkVersitParamWORK)) |
|
898 |
{ |
|
899 |
if (fieldParams.Contains(EVPbkVersitParamWORK)) |
|
900 |
{ |
|
901 |
continue; |
|
902 |
} |
|
903 |
fieldParams.Add(EVPbkVersitParamWORK); |
|
904 |
labelResId = R_QTN_PHOB_LBL_ADDRESS_WORK; |
|
905 |
groupId = EPbk2FieldGroupIdCompanyAddress; |
|
906 |
} |
|
907 |
else |
|
908 |
{ |
|
909 |
if (fieldParams.Contains(EVPbkVersitParamPREF)) |
|
910 |
{ |
|
911 |
continue; |
|
912 |
} |
|
913 |
fieldParams.Add(EVPbkVersitParamPREF); |
|
914 |
labelResId = R_QTN_PHOB_LBL_ADDRESS; |
|
915 |
groupId = EPbk2FieldGroupIdPostalAddress; |
|
916 |
} |
|
917 |
fieldTypeName = EVPbkVersitNameADR; |
|
918 |
} |
|
919 |
} |
|
920 |
||
921 |
if (fieldTypeName == EVPbkVersitNameADR) |
|
922 |
{ |
|
923 |
HBufC* label = StringLoader::LoadLC(labelResId); |
|
924 |
CCCAppDetailsViewListBoxRow* row = CCCAppDetailsViewListBoxRow::NewL(); |
|
925 |
CleanupStack::PushL(row); |
|
926 |
||
927 |
// add icon. |
|
928 |
buffer.Zero(); |
|
929 |
TInt iconIndex = 0; |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
930 |
TInt iconId = 0; |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
931 |
// UnSync feature indicator flag and chinese flag |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
932 |
TBool supportUnSyncFeature = FeatureManager::FeatureSupported( |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
933 |
KFeatureIdFfTdUnSyncabPbfieldsInd); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
934 |
TBool supportChinese = FeatureManager::FeatureSupported(KFeatureIdChinese); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
935 |
// Valid address |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
936 |
TBool addressValidated = IsAddressValidated(groupId); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
937 |
if(supportChinese && supportUnSyncFeature) |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
938 |
{ |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
939 |
// UnSync Icon |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
940 |
iconId = EPbk2qgn_prop_phonebook2_unsync; |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
941 |
} |
63 | 942 |
else |
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
943 |
{ |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
944 |
iconId = addressValidated ? |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
945 |
EPbk2qgn_prop_locev_map : EPbk2qgn_prop_pb_no_valid_lm; |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
946 |
} |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
947 |
TPbk2IconId pbkIconId( TUid::Uid(KPbk2UID3),iconId ); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
948 |
iconIndex = iIconArray.FindIcon(pbkIconId); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
949 |
buffer.AppendNum(iconIndex); |
63 | 950 |
row->AppendColumnL(buffer); |
951 |
||
952 |
// add label. |
|
953 |
row->AppendColumnL(*label); |
|
954 |
||
955 |
RBuf text; |
|
956 |
Pbk2AddressTools::GetAddressPreviewLC(*iStoreContact, groupId, text); |
|
957 |
||
958 |
row->AppendColumnL(text); |
|
959 |
CleanupStack::PopAndDestroy(&text); |
|
960 |
||
961 |
// Expand row formatting buffer if required |
|
962 |
ExpandBuffersL(row); |
|
963 |
||
964 |
// Add the row. |
|
965 |
iRows.AppendL(row); |
|
966 |
iInxToPresentationIdx.InsertL(++listIdx, index); |
|
967 |
CleanupStack::Pop(row); |
|
968 |
CleanupStack::PopAndDestroy(label); |
|
969 |
} |
|
970 |
else |
|
971 |
{ |
|
972 |
HBufC* label = GetLabelLC(field); |
|
973 |
||
974 |
if (label->Length()) |
|
975 |
{ |
|
976 |
TBool skipThisData(EFalse); |
|
977 |
CCCAppDetailsViewListBoxRow* row = CCCAppDetailsViewListBoxRow::NewL(); |
|
978 |
CleanupStack::PushL(row); |
|
979 |
||
980 |
const MVPbkContactFieldData& fieldData = field.FieldData(); |
|
981 |
||
982 |
// add icon. |
|
983 |
buffer.Zero(); |
|
984 |
TInt iconIndex = iIconArray.FindIcon(field.FieldProperty().IconId()); |
|
985 |
buffer.AppendNum(iconIndex); |
|
986 |
row->AppendColumnL(buffer); |
|
987 |
||
988 |
// add label. |
|
989 |
row->AppendColumnL(*label); |
|
990 |
||
991 |
// Add current index to Presentation Contact index array |
|
992 |
// to estimate the text is needed to clip or not. |
|
993 |
if(!skipThisData) |
|
994 |
{ |
|
995 |
iInxToPresentationIdx.InsertL(++listIdx, index); |
|
996 |
} |
|
997 |
||
998 |
||
999 |
// add field content. |
|
1000 |
switch (fieldData.DataType()) |
|
1001 |
{ |
|
1002 |
case EVPbkFieldStorageTypeText: |
|
1003 |
{ |
|
1004 |
TBool defaultTextSet = HandleTextTypeFieldL( |
|
1005 |
index, |
|
1006 |
fieldData, |
|
1007 |
row, |
|
1008 |
fieldType->FieldTypeResId()); |
|
1009 |
//Don't show default ringtone |
|
1010 |
if (defaultTextSet && |
|
1011 |
fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_RINGTONE) |
|
1012 |
{ |
|
1013 |
skipThisData = ETrue; |
|
1014 |
} |
|
1015 |
} |
|
1016 |
break; |
|
1017 |
||
1018 |
case EVPbkFieldStorageTypeDateTime: |
|
1019 |
HandleDateTimeTypeFieldL(fieldData, row); |
|
1020 |
break; |
|
1021 |
||
1022 |
case EVPbkFieldStorageTypeUri: |
|
1023 |
HandleUriTypeFieldL(index, fieldData, row); |
|
1024 |
break; |
|
1025 |
||
1026 |
default: |
|
1027 |
break; |
|
1028 |
} |
|
1029 |
||
1030 |
AddIconsToEndL(index, row); |
|
1031 |
||
1032 |
// Expand row formatting buffer if required |
|
1033 |
ExpandBuffersL(row); |
|
1034 |
||
1035 |
// Add the row if data ok to show to user. |
|
1036 |
if(!skipThisData) |
|
1037 |
{ |
|
1038 |
iRows.AppendL(row); |
|
1039 |
CleanupStack::Pop(row); |
|
1040 |
} |
|
1041 |
else |
|
1042 |
{ |
|
1043 |
CleanupStack::PopAndDestroy(row); |
|
1044 |
} |
|
1045 |
} |
|
1046 |
||
1047 |
CleanupStack::PopAndDestroy(label); |
|
1048 |
} |
|
1049 |
} |
|
1050 |
} // for |
|
1051 |
||
1052 |
iListBox.HandleItemAdditionL(); |
|
1053 |
||
1054 |
//CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewListBoxModel::AddDataL()")); |
|
1055 |
} |
|
1056 |
||
1057 |
// -------------------------------------------------------------------------- |
|
1058 |
// CCCAppDetailsViewListBoxModel::IsAddressValidated |
|
1059 |
// -------------------------------------------------------------------------- |
|
1060 |
// |
|
1061 |
TBool CCCAppDetailsViewListBoxModel::IsAddressValidated(TInt aGroupId) |
|
1062 |
{ |
|
1063 |
CPbk2PresentationContactFieldCollection& fields = |
|
1064 |
iPresentationContact->PresentationFields(); |
|
1065 |
||
1066 |
for (TInt idx = 0; idx < fields.FieldCount(); idx++) |
|
1067 |
{ |
|
1068 |
MVPbkStoreContactField& field = fields.FieldAt(idx); |
|
1069 |
TInt countProps = |
|
1070 |
field.BestMatchingFieldType()->VersitProperties().Count(); |
|
1071 |
TArray<TVPbkFieldVersitProperty> props = |
|
1072 |
field.BestMatchingFieldType()->VersitProperties(); |
|
1073 |
||
1074 |
for (TInt idx2 = 0; idx2 < countProps; idx2++) |
|
1075 |
{ |
|
1076 |
if (props[idx2].Name() == EVPbkVersitNameGEO && |
|
1077 |
((props[idx2].Parameters().Contains(EVPbkVersitParamHOME) && |
|
1078 |
aGroupId == EPbk2FieldGroupIdHomeAddress) || |
|
1079 |
(props[idx2].Parameters().Contains(EVPbkVersitParamWORK) && |
|
1080 |
aGroupId == EPbk2FieldGroupIdCompanyAddress) || |
|
1081 |
(!props[idx2].Parameters().Contains(EVPbkVersitParamHOME) && |
|
1082 |
!props[idx2].Parameters().Contains(EVPbkVersitParamWORK) && |
|
1083 |
aGroupId == EPbk2FieldGroupIdPostalAddress))) |
|
1084 |
{ |
|
1085 |
return ETrue; |
|
1086 |
} |
|
1087 |
} |
|
1088 |
} |
|
1089 |
return EFalse; |
|
1090 |
} |
|
1091 |
||
1092 |
// -------------------------------------------------------------------------- |
|
1093 |
// CCCAppDetailsViewListBoxModel::IsHiddenField |
|
1094 |
// -------------------------------------------------------------------------- |
|
1095 |
// |
|
1096 |
TBool CCCAppDetailsViewListBoxModel::IsHiddenField( |
|
1097 |
const MVPbkFieldType* aFieldType) |
|
1098 |
{ |
|
1099 |
TInt resId = aFieldType->FieldTypeResId(); |
|
1100 |
||
1101 |
return (resId == R_VPBK_FIELD_TYPE_SYNCCLASS); |
|
1102 |
} |
|
1103 |
||
1104 |
// --------------------------------------------------------------------------- |
|
1105 |
// CCCAppDetailsViewListBoxModel::FieldAtLC |
|
1106 |
// --------------------------------------------------------------------------- |
|
1107 |
// |
|
1108 |
MVPbkBaseContactField* CCCAppDetailsViewListBoxModel::FieldAtLC(TInt aIndex) |
|
1109 |
{ |
|
1110 |
TInt *presentationIdx = iInxToPresentationIdx.Find(aIndex); |
|
1111 |
||
1112 |
if (!presentationIdx) |
|
1113 |
{ |
|
1114 |
return NULL; |
|
1115 |
} |
|
1116 |
||
1117 |
TInt index = iPresentationContact->PresentationFields().StoreIndexOfField( |
|
1118 |
*presentationIdx); |
|
1119 |
||
1120 |
if (index != KErrNotFound) |
|
1121 |
{ |
|
1122 |
// Use FieldAtLC to avoid the unvalidity of the field after new |
|
1123 |
// FieldAt call. |
|
1124 |
return iStoreContact->Fields().FieldAtLC(index); |
|
1125 |
} |
|
1126 |
||
1127 |
return NULL; |
|
1128 |
} |
|
1129 |
||
1130 |
// --------------------------------------------------------------------------- |
|
1131 |
// CCCAppDetailsViewListBoxModel::IsFieldTypeL |
|
1132 |
// --------------------------------------------------------------------------- |
|
1133 |
// |
|
1134 |
TBool CCCAppDetailsViewListBoxModel::IsFieldTypeL( |
|
1135 |
TInt aIndex, |
|
1136 |
TInt aSelectorResId) |
|
1137 |
{ |
|
1138 |
TBool ret = EFalse; |
|
1139 |
||
1140 |
MVPbkBaseContactField* field = FieldAtLC(aIndex); |
|
1141 |
||
1142 |
if (field) |
|
1143 |
{ |
|
1144 |
TPbk2StoreContactAnalyzer analyzer(iAppServices->ContactManager(), NULL); |
|
1145 |
||
1146 |
ret = analyzer.IsFieldTypeIncludedL(*field, aSelectorResId); |
|
1147 |
||
1148 |
CleanupStack::PopAndDestroy(field); |
|
1149 |
} |
|
1150 |
||
1151 |
return ret; |
|
1152 |
} |
|
1153 |
||
1154 |
// --------------------------------------------------------------------------- |
|
1155 |
// CCCAppDetailsViewListBoxModel::HandleTextTypeFieldL |
|
1156 |
// --------------------------------------------------------------------------- |
|
1157 |
// |
|
1158 |
TBool CCCAppDetailsViewListBoxModel::HandleTextTypeFieldL( |
|
1159 |
TInt aIndex, |
|
1160 |
const MVPbkContactFieldData& aFieldData, |
|
1161 |
CCCAppDetailsViewListBoxRow* aRow, |
|
1162 |
TInt aResId) |
|
1163 |
{ |
|
1164 |
TBool defaultTextInserted(EFalse); |
|
1165 |
const TDesC& fieldText = |
|
1166 |
MVPbkContactFieldTextData::Cast(aFieldData).Text(); |
|
1167 |
||
1168 |
if (aResId == R_VPBK_FIELD_TYPE_CALLEROBJIMG || |
|
1169 |
aResId == R_VPBK_FIELD_TYPE_RINGTONE) |
|
1170 |
{ |
|
1171 |
RFs& fsSession(iCoeEnv.FsSession()); |
|
1172 |
||
1173 |
if (FileExists(fsSession, fieldText)) |
|
1174 |
{ |
|
1175 |
// parse path and show only filename. |
|
1176 |
HBufC* textBuf = HBufC::NewLC(fieldText.Length()); |
|
1177 |
TPtr text = textBuf->Des(); |
|
1178 |
text.Append(fieldText); |
|
1179 |
||
1180 |
TParsePtr parse(text); |
|
1181 |
TPtrC fileName(parse.Name()); |
|
1182 |
||
1183 |
aRow->AppendColumnL(fileName); |
|
1184 |
||
1185 |
CleanupStack::PopAndDestroy(textBuf); |
|
1186 |
} |
|
1187 |
else |
|
1188 |
{ |
|
1189 |
defaultTextInserted = ETrue; |
|
1190 |
TInt textResId = R_QTN_PHOB_FIELD_DEFAULT_TONE; // in pbk2uicontrols.rsg |
|
1191 |
||
1192 |
if (aResId == R_VPBK_FIELD_TYPE_CALLEROBJIMG) |
|
1193 |
{ |
|
1194 |
textResId = R_QTN_PHOB_FIELD_THUMBNAIL; // in pbk2uicontrols.rsg |
|
1195 |
} |
|
1196 |
||
1197 |
// cold filename (e.g mem card not present), show default text. |
|
1198 |
HBufC* defaultText = iCoeEnv.AllocReadResourceLC(textResId); |
|
1199 |
aRow->AppendColumnL(*defaultText); |
|
1200 |
CleanupStack::PopAndDestroy(defaultText); |
|
1201 |
} |
|
1202 |
} |
|
1203 |
else |
|
1204 |
{ |
|
1205 |
TBool isNumberField = IsFieldTypeL(aIndex, R_DETAILSVIEW_PHONENUMBER_SELECTOR); |
|
1206 |
TBool isAddressField = IsFieldTypeL(aIndex, R_DETAILSVIEW_EL_ADDRESS_SELECTOR); |
|
1207 |
||
1208 |
if (isNumberField || isAddressField) |
|
1209 |
{ |
|
1210 |
aRow->SetClipRequired(ETrue); |
|
1211 |
} |
|
1212 |
||
1213 |
TPtr columnBuf(iColumnBuf->Des()); |
|
1214 |
||
1215 |
columnBuf.Set(ExpandColumnBufferL(fieldText.Length())); |
|
1216 |
columnBuf.Zero(); |
|
1217 |
||
1218 |
// replace listbox separator characters. |
|
1219 |
Pbk2PresentationUtils::AppendAndReplaceChars( |
|
1220 |
columnBuf, fieldText, KCharsToReplace, KReplacementChars); |
|
1221 |
||
1222 |
// Replace characters that can not be displayed correctly. |
|
1223 |
Pbk2PresentationUtils::ReplaceNonGraphicCharacters(columnBuf, ' '); |
|
1224 |
||
1225 |
if ( isNumberField ) |
|
1226 |
{ |
|
1227 |
AknTextUtils::LanguageSpecificNumberConversion( columnBuf ); |
|
1228 |
} |
|
1229 |
aRow->AppendColumnL(columnBuf); |
|
1230 |
} |
|
1231 |
return defaultTextInserted; |
|
1232 |
} |
|
1233 |
||
1234 |
// --------------------------------------------------------------------------- |
|
1235 |
// CCCAppDetailsViewListBoxModel::HandleDateTimeTypeFieldL |
|
1236 |
// --------------------------------------------------------------------------- |
|
1237 |
// |
|
1238 |
void CCCAppDetailsViewListBoxModel::HandleDateTimeTypeFieldL( |
|
1239 |
const MVPbkContactFieldData& aFieldData, |
|
1240 |
CCCAppDetailsViewListBoxRow* aRow) |
|
1241 |
{ |
|
1242 |
TLocale locale; |
|
1243 |
TBuf<64> dateBuffer; |
|
1244 |
||
1245 |
const MVPbkContactFieldDateTimeData& date = |
|
1246 |
MVPbkContactFieldDateTimeData::Cast(aFieldData); |
|
1247 |
||
1248 |
TTime time(date.DateTime()); |
|
1249 |
||
1250 |
HBufC* dateFormat = iCoeEnv.AllocReadResourceLC( |
|
1251 |
R_QTN_DATE_USUAL_WITH_ZERO); // in avkon.rsg |
|
1252 |
time.FormatL(dateBuffer, *dateFormat, locale); |
|
1253 |
CleanupStack::PopAndDestroy(dateFormat); |
|
1254 |
||
1255 |
AknTextUtils::LanguageSpecificNumberConversion( dateBuffer ); |
|
1256 |
aRow->AppendColumnL(dateBuffer); |
|
1257 |
} |
|
1258 |
||
1259 |
// --------------------------------------------------------------------------- |
|
1260 |
// CCCAppDetailsViewListBoxModel::HandleUriTypeFieldL |
|
1261 |
// --------------------------------------------------------------------------- |
|
1262 |
// |
|
1263 |
void CCCAppDetailsViewListBoxModel::HandleUriTypeFieldL( |
|
1264 |
TInt aIndex, |
|
1265 |
const MVPbkContactFieldData& aFieldData, |
|
1266 |
CCCAppDetailsViewListBoxRow* aRow) |
|
1267 |
{ |
|
1268 |
TBool isXspField = IsFieldTypeL( aIndex, R_DETAILSVIEW_EL_ADDRESS_SELECTOR ); |
|
1269 |
if ( isXspField ) |
|
1270 |
{ |
|
1271 |
aRow->SetClipRequired( ETrue ); |
|
1272 |
} |
|
1273 |
||
1274 |
const MVPbkContactFieldUriData& uri = |
|
1275 |
MVPbkContactFieldUriData::Cast(aFieldData); |
|
1276 |
||
1277 |
HBufC* tempBuf = uri.Text().AllocLC(); |
|
1278 |
TPtr text = tempBuf->Des(); |
|
1279 |
// Replace characters that can not be displayed correctly. |
|
1280 |
Pbk2PresentationUtils::ReplaceNonGraphicCharacters( text, KReplacedChars ); |
|
1281 |
aRow->AppendColumnL(text); |
|
1282 |
CleanupStack::PopAndDestroy(tempBuf); |
|
1283 |
} |
|
1284 |
||
1285 |
// --------------------------------------------------------------------------- |
|
1286 |
// CCCAppDetailsViewListBoxModel::AddIconsToEndL |
|
1287 |
// --------------------------------------------------------------------------- |
|
1288 |
// |
|
1289 |
void CCCAppDetailsViewListBoxModel::AddIconsToEndL( |
|
1290 |
TInt aIndex, |
|
1291 |
CCCAppDetailsViewListBoxRow* aRow) |
|
1292 |
{ |
|
1293 |
TBuf<KBufferSize> buffer; |
|
1294 |
TInt iconIndex = 0; |
|
1295 |
TInt storeIndex = iPresentationContact->PresentationFields(). |
|
1296 |
StoreIndexOfField(aIndex); |
|
1297 |
||
1298 |
if (HasDefaultsL(storeIndex)) |
|
1299 |
{ |
|
1300 |
buffer.Zero(); |
|
1301 |
TPbk2IconId iconId( |
|
1302 |
TUid::Uid(KCCADetailsViewPluginImplmentationUid), |
|
1303 |
ECCAppDetailsViewQgn_indi_default_conn_add ); |
|
1304 |
iconIndex = iIconArray.FindIcon(iconId); |
|
1305 |
buffer.AppendNum(iconIndex); |
|
1306 |
aRow->AppendColumnL(buffer); |
|
1307 |
} |
|
1308 |
||
1309 |
// Check and add speed dial icon |
|
1310 |
MVPbkStoreContactField* storefield = |
|
1311 |
iStoreContact->Fields().FieldAtLC(storeIndex); |
|
1312 |
||
1313 |
if (storefield) |
|
1314 |
{ |
|
1315 |
MVPbkStoreContactField2* fieldext = |
|
1316 |
reinterpret_cast<MVPbkStoreContactField2*> |
|
1317 |
(storefield->StoreContactFieldExtension |
|
1318 |
(KMVPbkStoreContactFieldExtension2Uid)); |
|
1319 |
||
1320 |
if (fieldext) |
|
1321 |
{ |
|
1322 |
CArrayFix<TInt>* array = fieldext->SpeedDialIndexesL(); |
|
1323 |
||
1324 |
if (array) |
|
1325 |
{ |
|
1326 |
CleanupStack::PushL(array); |
|
1327 |
||
1328 |
buffer.Zero(); |
|
1329 |
||
1330 |
// find speed dial key (1 to 9) and set correct icon |
|
1331 |
TInt key = 0; |
|
1332 |
TInt count = array->Count(); |
|
1333 |
if ( count >0 ) |
|
1334 |
{ |
|
1335 |
key = (*array)[0]; |
|
1336 |
// Loop from end of array to find smallest key |
|
1337 |
// if more than one has been set to same field. |
|
1338 |
for ( TInt i = 1; i < count; i++ ) |
|
1339 |
{ |
|
1340 |
if ( (*array)[i] < key ) |
|
1341 |
{ |
|
1342 |
key = (*array)[i]; |
|
1343 |
} |
|
1344 |
} |
|
1345 |
} |
|
1346 |
||
1347 |
if (key > 0 && key <= 9) |
|
1348 |
{ |
|
1349 |
// icon id ECCAppDetailsViewQgn_indi_qdial_one_add = 1 |
|
1350 |
// so icons from one to nine maps to key value. |
|
1351 |
TPbk2IconId iconId( |
|
1352 |
TUid::Uid(KCCADetailsViewPluginImplmentationUid), key); |
|
1353 |
iconIndex = iIconArray.FindIcon(iconId); |
|
1354 |
||
1355 |
buffer.AppendNum(iconIndex); |
|
1356 |
aRow->AppendColumnL(buffer); |
|
1357 |
} |
|
1358 |
||
1359 |
CleanupStack::PopAndDestroy(array); |
|
1360 |
} |
|
1361 |
} |
|
1362 |
||
1363 |
CleanupStack::PopAndDestroy(storefield); |
|
1364 |
} |
|
1365 |
} |
|
1366 |
||
1367 |
// -------------------------------------------------------------------------- |
|
1368 |
// CCCAppDetailsViewListBoxModel::ClipFromBeginning |
|
1369 |
// -------------------------------------------------------------------------- |
|
1370 |
// |
|
1371 |
TBool CCCAppDetailsViewListBoxModel::ClipFromBeginning( |
|
1372 |
TDes& aBuffer, |
|
1373 |
TInt aItemIndex, |
|
1374 |
TInt aSubCellNumber) const |
|
1375 |
{ |
|
1376 |
CAknFormDoubleGraphicStyleListBox* listbox = |
|
1377 |
static_cast<CAknFormDoubleGraphicStyleListBox*>(&iListBox); |
|
1378 |
||
1379 |
return AknTextUtils::ClipToFit( |
|
1380 |
aBuffer, |
|
1381 |
AknTextUtils::EClipFromBeginning, |
|
1382 |
listbox, |
|
1383 |
aItemIndex, |
|
1384 |
aSubCellNumber); |
|
1385 |
} |
|
1386 |
||
1387 |
// -------------------------------------------------------------------------- |
|
1388 |
// CCCAppDetailsViewListBoxModel::ExpandBuffersL |
|
1389 |
// -------------------------------------------------------------------------- |
|
1390 |
// |
|
1391 |
void CCCAppDetailsViewListBoxModel::ExpandBuffersL( |
|
1392 |
CCCAppDetailsViewListBoxRow* aRow) |
|
1393 |
{ |
|
1394 |
// Row formatting buffer |
|
1395 |
const TInt rowLength = aRow->TotalLength() + aRow->ColumnCount(); // for separator characters |
|
1396 |
||
1397 |
if (rowLength > iLineBuf->Des().MaxLength()) |
|
1398 |
{ |
|
1399 |
iLineBuf = iLineBuf->ReAllocL(rowLength); |
|
1400 |
} |
|
1401 |
||
1402 |
ExpandColumnBufferL(aRow->MaxColumnLength()); |
|
1403 |
} |
|
1404 |
||
1405 |
// -------------------------------------------------------------------------- |
|
1406 |
// CCCAppDetailsViewListBoxModel::ExpandColumnBufferL |
|
1407 |
// -------------------------------------------------------------------------- |
|
1408 |
// |
|
1409 |
TPtr CCCAppDetailsViewListBoxModel::ExpandColumnBufferL(TInt aRequiredLength) |
|
1410 |
{ |
|
1411 |
if (aRequiredLength > iColumnBuf->Des().MaxLength()) |
|
1412 |
{ |
|
1413 |
iColumnBuf = iColumnBuf->ReAllocL(aRequiredLength); |
|
1414 |
} |
|
1415 |
||
1416 |
return (iColumnBuf->Des()); |
|
1417 |
} |
|
1418 |
||
1419 |
// -------------------------------------------------------------------------- |
|
1420 |
// CCCAppDetailsViewListBoxModel::ExecuteEditorL |
|
1421 |
// -------------------------------------------------------------------------- |
|
1422 |
// |
|
1423 |
void CCCAppDetailsViewListBoxModel::ExecuteEditorL() |
|
1424 |
{ |
|
1425 |
// verify syncronization field existance and content |
|
1426 |
/* |
|
1427 |
VPbkUtils::VerifySyncronizationFieldL( |
|
1428 |
CCoeEnv::Static()->FsSession(), |
|
1429 |
iStoreContact->ParentStore().StoreProperties().SupportedFields(), |
|
1430 |
*iStoreContact); |
|
1431 |
*/ |
|
1432 |
||
1433 |
// adjust focus |
|
1434 |
TPbk2ContactEditorParams params; |
|
1435 |
||
1436 |
params.iFocusedContactField = FocusedFieldLC(); |
|
1437 |
||
1438 |
// create and execute editing dialog |
|
1439 |
CPbk2ContactEditorDlg* dlg = |
|
1440 |
CPbk2ContactEditorDlg::NewL(params, iStoreContact, *this); |
|
1441 |
||
1442 |
iStoreContact = NULL; // ownership went to editor |
|
1443 |
dlg->ExecuteLD(); |
|
1444 |
||
1445 |
// clean after dialog execution |
|
1446 |
if (params.iFocusedContactField) |
|
1447 |
{ |
|
1448 |
CleanupStack::PopAndDestroy(params.iFocusedContactField); |
|
1449 |
} |
|
1450 |
||
1451 |
// If editing has been aborted we don't set focused contact. |
|
1452 |
if (iStoreContact && !iIsEditingAborted) |
|
1453 |
{ |
|
1454 |
// It is possible that the contact got changed while in edit |
|
1455 |
//iUiControl->SetFocusedFieldIndex(params.iFocusedIndex); |
|
1456 |
//iUiControl->SetFocusedContactL(*iStoreContact); |
|
1457 |
} |
|
1458 |
||
1459 |
// If contact got deleted in the editor, this call ensures |
|
1460 |
// that the contact info view is switched to the names list |
|
1461 |
//iUiControl->UpdateAfterCommandExecution(); |
|
1462 |
} |
|
1463 |
||
1464 |
// -------------------------------------------------------------------------- |
|
1465 |
// CCCAppDetailsViewListBoxModel::GetLabelLC |
|
1466 |
// -------------------------------------------------------------------------- |
|
1467 |
// |
|
1468 |
HBufC* CCCAppDetailsViewListBoxModel::GetLabelLC( |
|
1469 |
const CPbk2PresentationContactField& aField) |
|
1470 |
{ |
|
1471 |
TPtr columnBuf(iColumnBuf->Des()); |
|
1472 |
columnBuf.Set(ExpandColumnBufferL(aField.FieldLabel().Length())); |
|
1473 |
columnBuf.Zero(); |
|
1474 |
||
1475 |
// replace listbox separator characters. |
|
1476 |
Pbk2PresentationUtils::AppendAndReplaceChars( |
|
1477 |
columnBuf, aField.FieldLabel(), KCharsToReplace, KReplacementChars); |
|
1478 |
||
1479 |
// Replace characters that can not be displayed correctly |
|
1480 |
Pbk2PresentationUtils::ReplaceNonGraphicCharacters(columnBuf, ' '); |
|
1481 |
||
1482 |
HBufC* data = HBufC::NewLC(columnBuf.Length()); |
|
1483 |
data->Des().Append(columnBuf); |
|
1484 |
||
1485 |
return data; |
|
1486 |
} |
|
1487 |
||
1488 |
// -------------------------------------------------------------------------- |
|
1489 |
// CCCAppDetailsViewListBoxModel::SetEmptyTextL |
|
1490 |
// Sets empty text for list box from given resource id. |
|
1491 |
// -------------------------------------------------------------------------- |
|
1492 |
// |
|
1493 |
void CCCAppDetailsViewListBoxModel::SetEmptyTextL(TInt aResourceId) |
|
1494 |
{ |
|
1495 |
HBufC* text = iCoeEnv.AllocReadResourceLC(aResourceId); |
|
1496 |
iListBox.View()->SetListEmptyTextL(*text); |
|
1497 |
CleanupStack::PopAndDestroy(text); |
|
1498 |
} |
|
1499 |
||
1500 |
// -------------------------------------------------------------------------- |
|
1501 |
// CCCAppDetailsViewListBoxModel::SetTitleL |
|
1502 |
// Sets empty text for list box from given resource id. |
|
1503 |
// -------------------------------------------------------------------------- |
|
1504 |
// |
|
1505 |
void CCCAppDetailsViewListBoxModel::SetTitleL() |
|
1506 |
{ |
|
1507 |
HBufC* title = GetContactTitleL(); |
|
1508 |
CleanupStack::PushL(title); |
|
1509 |
iPlugin.SetTitleL(*title); |
|
1510 |
CleanupStack::PopAndDestroy(); |
|
1511 |
} |
|
1512 |
||
1513 |
// -------------------------------------------------------------------------- |
|
1514 |
// CCCAppDetailsViewListBoxModel::IsContactEditable |
|
1515 |
// -------------------------------------------------------------------------- |
|
1516 |
// |
|
1517 |
TBool CCCAppDetailsViewListBoxModel::IsContactEditable() |
|
1518 |
{ |
|
1519 |
return !(IsSdnContact() || IsReadOnlyContact()); |
|
1520 |
} |
|
1521 |
||
1522 |
// -------------------------------------------------------------------------- |
|
1523 |
// CCCAppDetailsViewListBoxModel::UpdateMSKinCbaL |
|
1524 |
// Sets empty MSK or MSK with text "Edit" when contact is editable. |
|
1525 |
// -------------------------------------------------------------------------- |
|
1526 |
// |
|
1527 |
void CCCAppDetailsViewListBoxModel::UpdateMSKinCbaL() |
|
1528 |
{ |
|
1529 |
iPlugin.UpdateMSKinCbaL(IsContactEditable()); |
|
1530 |
} |
|
1531 |
||
1532 |
// -------------------------------------------------------------------------- |
|
1533 |
// CCCAppDetailsViewListBoxModel::HandleEditRequestL |
|
1534 |
// -------------------------------------------------------------------------- |
|
1535 |
// |
|
1536 |
void CCCAppDetailsViewListBoxModel::HandleEditRequestL() |
|
1537 |
{ |
|
1538 |
if (iStoreContact != NULL && IsContactEditable()) |
|
1539 |
{ |
|
1540 |
iPlugin.HandleEditRequestL(); |
|
1541 |
} |
|
1542 |
} |
|
1543 |
||
1544 |
// -------------------------------------------------------------------------- |
|
1545 |
// CCCAppDetailsViewListBoxModel::HandleDeleteRequestL |
|
1546 |
// -------------------------------------------------------------------------- |
|
1547 |
// |
|
1548 |
void CCCAppDetailsViewListBoxModel::HandleDeleteRequestL() |
|
1549 |
{ |
|
1550 |
if ( iStoreContact != NULL && IsContactEditable() ) |
|
1551 |
{ |
|
1552 |
iPlugin.HandleDeleteRequestL(); |
|
1553 |
} |
|
1554 |
} |
|
1555 |
||
1556 |
// -------------------------------------------------------------------------- |
|
1557 |
// CCCAppDetailsViewListBoxModel::IsFieldMapped |
|
1558 |
// -------------------------------------------------------------------------- |
|
1559 |
// |
|
1560 |
TBool CCCAppDetailsViewListBoxModel::IsFieldMapped() const |
|
1561 |
{ |
|
1562 |
const TInt *index = iInxToPresentationIdx.Find(iListBox.CurrentItemIndex()); |
|
1563 |
if ( index && (*index >= KErrNone) && ( *index != iListBox.CurrentItemIndex())) |
|
1564 |
{ |
|
1565 |
return ETrue; |
|
1566 |
} |
|
1567 |
else |
|
1568 |
{ |
|
1569 |
return EFalse; |
|
1570 |
} |
|
1571 |
} |
|
1572 |
||
1573 |
// End of File |