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 |
#ifndef C_CCAPPDETAILSVIEWLISTBOXMODEL_H
|
|
19 |
#define C_CCAPPDETAILSVIEWLISTBOXMODEL_H
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <badesca.h>
|
|
23 |
#include <e32hashtab.h>
|
|
24 |
|
|
25 |
#include <MVPbkSingleContactOperationObserver.h>
|
|
26 |
#include <MVPbkContactObserver.h>
|
|
27 |
|
|
28 |
#include "MPbk2EditedContactObserver.h"
|
|
29 |
|
|
30 |
class CEikListBox;
|
|
31 |
|
|
32 |
class CPbk2ApplicationServices;
|
|
33 |
class MVPbkContactLinkArray;
|
|
34 |
class CVPbkContactLinkArray;
|
|
35 |
class MVPbkContactLink;
|
|
36 |
class MVPbkStoreContact;
|
|
37 |
class MVPbkStoreContactField;
|
|
38 |
class MVPbkBaseContactField;
|
|
39 |
class MVPbkContactOperationBase;
|
|
40 |
class MVPbkFieldType;
|
|
41 |
class MVPbkContactFieldData;
|
|
42 |
|
|
43 |
class MPbk2FieldPropertyArray;
|
|
44 |
class CPbk2FieldPropertyArray;
|
|
45 |
class CPbk2StoreSpecificFieldPropertyArray;
|
|
46 |
class CPbk2PresentationContact;
|
|
47 |
class CPbk2PresentationContactField;
|
|
48 |
class CPbk2IconArray;
|
|
49 |
class CCCAppDetailsViewPlugin;
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Details view list box model row.
|
|
53 |
*
|
|
54 |
*/
|
|
55 |
class CCCAppDetailsViewListBoxRow : public CBase
|
|
56 |
{
|
|
57 |
public: // Constructors and destructor
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Creates a new instance of this class.
|
|
61 |
*
|
|
62 |
* @return A new instance of this class.
|
|
63 |
*/
|
|
64 |
static CCCAppDetailsViewListBoxRow* NewL();
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Destructor.
|
|
68 |
*/
|
|
69 |
~CCCAppDetailsViewListBoxRow();
|
|
70 |
|
|
71 |
public: // Interface
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Returns the number of columns in this row.
|
|
75 |
*
|
|
76 |
* @return Number of columns in this row.
|
|
77 |
*/
|
|
78 |
TInt ColumnCount() const;
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Returns the descriptor at the given position.
|
|
82 |
*
|
|
83 |
* @param aColumnIndex Column index.
|
|
84 |
* @return The descriptor at the given index.
|
|
85 |
*/
|
|
86 |
TPtrC At(TInt aColumnIndex) const;
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Appends a given column to the row.
|
|
90 |
*
|
|
91 |
* @param aColumnText Column to append.
|
|
92 |
*/
|
|
93 |
void AppendColumnL(const TDesC& aColumnText);
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Is clip required.
|
|
97 |
*/
|
|
98 |
TBool IsClipRequired() const;
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Clip text from beginning if field is numeric field or e-mail field.
|
|
102 |
*/
|
|
103 |
void SetClipRequired(TBool aFlag);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Returns the total descriptor length of all the columns.
|
|
107 |
*
|
|
108 |
* @return Total row length.
|
|
109 |
*/
|
|
110 |
TInt TotalLength() const;
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Returns the maximum column length of this row.
|
|
114 |
*
|
|
115 |
* @return Maximum column length.
|
|
116 |
*/
|
|
117 |
TInt MaxColumnLength() const;
|
|
118 |
|
|
119 |
private: // Implementation
|
|
120 |
|
|
121 |
CCCAppDetailsViewListBoxRow();
|
|
122 |
|
|
123 |
private: // Data
|
|
124 |
|
|
125 |
/// Own: Column array
|
|
126 |
RPointerArray<HBufC> iColumns;
|
|
127 |
|
|
128 |
/// Is clip required.
|
|
129 |
TBool iClipBeginning;
|
|
130 |
};
|
|
131 |
|
|
132 |
/**
|
|
133 |
*
|
|
134 |
*
|
|
135 |
* @code
|
|
136 |
* ?good_class_usage_example(s)
|
|
137 |
* @endcode
|
|
138 |
*
|
|
139 |
* @lib ccappdetailsviewplugin.dll
|
|
140 |
*/
|
|
141 |
class CCCAppDetailsViewListBoxModel :
|
|
142 |
public CActive,
|
|
143 |
public MDesCArray,
|
|
144 |
public MVPbkSingleContactOperationObserver,
|
|
145 |
public MVPbkContactObserver,
|
|
146 |
public MPbk2EditedContactObserver
|
|
147 |
{
|
|
148 |
|
|
149 |
public:
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Column indexes.
|
|
153 |
*/
|
|
154 |
enum TColumnIndex
|
|
155 |
{
|
|
156 |
/// Icon column
|
|
157 |
EIconColumn = 0,
|
|
158 |
/// Label column
|
|
159 |
ELabelColumn,
|
|
160 |
/// Content column
|
|
161 |
EContentColumn
|
|
162 |
};
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Two-phased constructor.
|
|
166 |
* @param aListBox
|
|
167 |
*/
|
|
168 |
static CCCAppDetailsViewListBoxModel* NewL(
|
|
169 |
CCoeEnv& aCoeEnv,
|
|
170 |
CEikListBox& aListBox,
|
|
171 |
CPbk2ApplicationServices* aApplicationServices,
|
|
172 |
CPbk2IconArray& aIconArray,
|
|
173 |
CCCAppDetailsViewPlugin& aPlugin);
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Destructor.
|
|
177 |
*/
|
|
178 |
~CCCAppDetailsViewListBoxModel();
|
|
179 |
|
|
180 |
/**
|
|
181 |
*
|
|
182 |
*/
|
|
183 |
void SetLinks(MVPbkContactLinkArray* aLinks);
|
|
184 |
|
|
185 |
/**
|
|
186 |
*
|
|
187 |
*/
|
|
188 |
MVPbkContactLinkArray* Links() const;
|
|
189 |
|
|
190 |
/**
|
|
191 |
*
|
|
192 |
*/
|
|
193 |
void OpenEditorL();
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Get field index of focused list item.
|
|
197 |
*/
|
|
198 |
TInt FocusedFieldIndex();
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Get index of focused list item.
|
|
202 |
*/
|
|
203 |
TInt FocusedListIndex();
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Set initial focused list index.
|
|
207 |
*/
|
|
208 |
void SetInitialFocusIndex(TInt aIndex);
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Set focused list item index by store field index
|
|
212 |
*
|
|
213 |
* @param aIndex, a field index in store
|
|
214 |
* @retrun actually focused list item
|
|
215 |
*/
|
|
216 |
TInt FindFocusListIndexByStoreIndex(TInt aIndex);
|
|
217 |
|
|
218 |
/**
|
|
219 |
*
|
|
220 |
*/
|
|
221 |
MVPbkBaseContactField* FocusedFieldLC();
|
|
222 |
|
|
223 |
/**
|
|
224 |
*
|
|
225 |
*/
|
|
226 |
MVPbkStoreContact* StoreContact();
|
|
227 |
|
|
228 |
/**
|
|
229 |
*
|
|
230 |
*/
|
|
231 |
HBufC* GetContactTitleL();
|
|
232 |
|
|
233 |
/**
|
|
234 |
*
|
|
235 |
*/
|
|
236 |
TBool IsFocusedFieldTypeL(TInt aSelectorResId);
|
|
237 |
|
|
238 |
/**
|
|
239 |
*
|
|
240 |
*/
|
|
241 |
TBool HasContactFieldTypeL(TInt aSelectorResId);
|
|
242 |
|
|
243 |
/**
|
|
244 |
*
|
|
245 |
*/
|
|
246 |
TBool IsTopContact() const;
|
|
247 |
|
|
248 |
/**
|
|
249 |
*
|
|
250 |
*/
|
|
251 |
TBool IsReadOnlyContact() const;
|
|
252 |
|
|
253 |
/**
|
|
254 |
*
|
|
255 |
*/
|
|
256 |
TBool IsSimContact() const;
|
|
257 |
|
|
258 |
/**
|
|
259 |
*
|
|
260 |
*/
|
|
261 |
TBool IsSdnContact() const;
|
|
262 |
|
|
263 |
/**
|
|
264 |
*
|
|
265 |
*/
|
|
266 |
TBool HasSpeedDialL(TInt aIndex);
|
|
267 |
|
|
268 |
/**
|
|
269 |
*
|
|
270 |
*/
|
|
271 |
TBool HasDefaultsL(TInt aIndex);
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Handles an edit request if the contact is editable.
|
|
275 |
*/
|
|
276 |
void HandleEditRequestL();
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Handles a delete request if the contact is editable.
|
|
280 |
*/
|
|
281 |
void HandleDeleteRequestL();
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Judge If the fileds mapped
|
|
285 |
*/
|
|
286 |
TBool IsFieldMapped()const;
|
|
287 |
|
|
288 |
private: // From CActive
|
|
289 |
|
|
290 |
void RunL();
|
|
291 |
|
|
292 |
TInt RunError(TInt aError);
|
|
293 |
|
|
294 |
void DoCancel();
|
|
295 |
|
|
296 |
private: // From MVPbkContactObserver
|
|
297 |
|
|
298 |
void ContactOperationCompleted(TContactOpResult aResult);
|
|
299 |
|
|
300 |
void ContactOperationFailed(
|
|
301 |
TContactOp aOpCode,
|
|
302 |
TInt aErrorCode,
|
|
303 |
TBool aErrorNotified);
|
|
304 |
|
|
305 |
private: // From MPbk2EditedContactObserver
|
|
306 |
|
|
307 |
void ContactEditingComplete(MVPbkStoreContact* aEditedContact);
|
|
308 |
|
|
309 |
void ContactEditingDeletedContact(MVPbkStoreContact* aEditedContact);
|
|
310 |
|
|
311 |
void ContactEditingAborted();
|
|
312 |
|
|
313 |
public: // From MVPbkSingleContactOperationObserver
|
|
314 |
|
|
315 |
void VPbkSingleContactOperationComplete(
|
|
316 |
MVPbkContactOperationBase& aOperation,
|
|
317 |
MVPbkStoreContact* aContact);
|
|
318 |
|
|
319 |
void VPbkSingleContactOperationFailed(
|
|
320 |
MVPbkContactOperationBase& aOperation,
|
|
321 |
TInt aError);
|
|
322 |
|
|
323 |
private: // From MDesCArray
|
|
324 |
|
|
325 |
TInt MdcaCount() const;
|
|
326 |
|
|
327 |
TPtrC MdcaPoint(TInt aIndex) const;
|
|
328 |
|
|
329 |
private:
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Set focused list item.
|
|
333 |
*/
|
|
334 |
void SetFocusedListIndex(TInt aIndex);
|
|
335 |
|
|
336 |
CCCAppDetailsViewListBoxModel(
|
|
337 |
CCoeEnv& aCoeEnv,
|
|
338 |
CEikListBox& aListBox,
|
|
339 |
CPbk2ApplicationServices* aApplicationServices,
|
|
340 |
CPbk2IconArray& aIconArray,
|
|
341 |
CCCAppDetailsViewPlugin& aPlugin);
|
|
342 |
|
|
343 |
void ConstructL();
|
|
344 |
|
|
345 |
private: // new implementation
|
|
346 |
|
|
347 |
enum TCCAppDetailsViewCommand
|
|
348 |
{
|
|
349 |
ECCAppDetailsViewCommandNone = 0,
|
|
350 |
ECCAppDetailsViewCommandEdit = 1
|
|
351 |
};
|
|
352 |
|
|
353 |
/**
|
|
354 |
*
|
|
355 |
*/
|
|
356 |
void IssueRequest(TInt aError = KErrNone);
|
|
357 |
|
|
358 |
/**
|
|
359 |
*
|
|
360 |
*/
|
|
361 |
void CreatePresentationContactL();
|
|
362 |
|
|
363 |
/**
|
|
364 |
* Helper function for adding contact field items to
|
|
365 |
* listbox data model.
|
|
366 |
*
|
|
367 |
*/
|
|
368 |
void AddDataL();
|
|
369 |
|
|
370 |
/**
|
|
371 |
*
|
|
372 |
*/
|
|
373 |
void ExecuteEditorL();
|
|
374 |
|
|
375 |
/**
|
|
376 |
*
|
|
377 |
*/
|
|
378 |
HBufC* GetLabelLC(const CPbk2PresentationContactField& aField);
|
|
379 |
|
|
380 |
/**
|
|
381 |
*
|
|
382 |
*/
|
|
383 |
void SetEmptyTextL(TInt aResourceId);
|
|
384 |
|
|
385 |
/**
|
|
386 |
*
|
|
387 |
*/
|
|
388 |
TBool IsHiddenField(const MVPbkFieldType* aFieldType);
|
|
389 |
|
|
390 |
/**
|
|
391 |
*
|
|
392 |
*/
|
|
393 |
MVPbkBaseContactField* FieldAtLC(TInt aIndex);
|
|
394 |
|
|
395 |
/**
|
|
396 |
*
|
|
397 |
*/
|
|
398 |
TBool IsFieldTypeL(TInt aIndex, TInt aSelectorResId);
|
|
399 |
|
|
400 |
/**
|
|
401 |
*
|
|
402 |
*/
|
|
403 |
TBool HandleTextTypeFieldL(
|
|
404 |
TInt aIndex,
|
|
405 |
const MVPbkContactFieldData& aFieldData,
|
|
406 |
CCCAppDetailsViewListBoxRow* aRow,
|
|
407 |
TInt aResId);
|
|
408 |
|
|
409 |
/**
|
|
410 |
*
|
|
411 |
*/
|
|
412 |
void HandleDateTimeTypeFieldL(
|
|
413 |
const MVPbkContactFieldData& aFieldData,
|
|
414 |
CCCAppDetailsViewListBoxRow* aRow);
|
|
415 |
|
|
416 |
/**
|
|
417 |
*
|
|
418 |
*/
|
|
419 |
void HandleUriTypeFieldL(
|
|
420 |
TInt aIndex,
|
|
421 |
const MVPbkContactFieldData& aFieldData,
|
|
422 |
CCCAppDetailsViewListBoxRow* aRow);
|
|
423 |
|
|
424 |
/**
|
|
425 |
*
|
|
426 |
*/
|
|
427 |
void AddIconsToEndL(
|
|
428 |
TInt aIndex,
|
|
429 |
CCCAppDetailsViewListBoxRow* aRow);
|
|
430 |
|
|
431 |
/**
|
|
432 |
*
|
|
433 |
*/
|
|
434 |
TBool ClipFromBeginning(TDes& aBuffer, TInt aItemIndex, TInt aSubCellNumber) const;
|
|
435 |
|
|
436 |
/**
|
|
437 |
*
|
|
438 |
*/
|
|
439 |
void ExpandBuffersL(CCCAppDetailsViewListBoxRow* aRow);
|
|
440 |
|
|
441 |
/**
|
|
442 |
*
|
|
443 |
*/
|
|
444 |
TPtr ExpandColumnBufferL(TInt aRequiredLength);
|
|
445 |
|
|
446 |
/*
|
|
447 |
* Sets the title to the plugin
|
|
448 |
* @param aTitle - title to be set
|
|
449 |
*/
|
|
450 |
void SetTitleL();
|
|
451 |
|
|
452 |
/**
|
|
453 |
* Returns ETrue if the contact is editable.
|
|
454 |
*/
|
|
455 |
TBool IsContactEditable();
|
|
456 |
|
|
457 |
/**
|
|
458 |
* Sets the CBA labels.
|
|
459 |
*/
|
|
460 |
void UpdateMSKinCbaL();
|
|
461 |
|
|
462 |
/**
|
|
463 |
* Check if address has geocoordinates.
|
|
464 |
*/
|
|
465 |
TBool IsAddressValidated(TInt aGroupId);
|
|
466 |
|
|
467 |
private: // data
|
|
468 |
|
|
469 |
/**
|
|
470 |
* Reference to control environment.
|
|
471 |
* Not own.
|
|
472 |
*/
|
|
473 |
CCoeEnv& iCoeEnv;
|
|
474 |
|
|
475 |
/**
|
|
476 |
* Reference to listbox.
|
|
477 |
* Not own.
|
|
478 |
*/
|
|
479 |
CEikListBox& iListBox;
|
|
480 |
|
|
481 |
/**
|
|
482 |
* Text row array.
|
|
483 |
* Own.
|
|
484 |
*/
|
|
485 |
CArrayPtrFlat<CCCAppDetailsViewListBoxRow> iRows;
|
|
486 |
|
|
487 |
/**
|
|
488 |
* Buffer for storing one formatted listbox row.
|
|
489 |
* Own.
|
|
490 |
*/
|
|
491 |
HBufC* iLineBuf;
|
|
492 |
|
|
493 |
/**
|
|
494 |
* Buffer for storing one formatted listbox column.
|
|
495 |
* Own.
|
|
496 |
*/
|
|
497 |
HBufC* iColumnBuf;
|
|
498 |
|
|
499 |
/**
|
|
500 |
* Reference to Application services.
|
|
501 |
* Not own.
|
|
502 |
*/
|
|
503 |
CPbk2ApplicationServices* iAppServices;
|
|
504 |
|
|
505 |
/**
|
|
506 |
*
|
|
507 |
*/
|
|
508 |
MVPbkContactLinkArray* iLinks;
|
|
509 |
|
|
510 |
/**
|
|
511 |
*
|
|
512 |
*/
|
|
513 |
const MVPbkContactLink* iCurrentLink;
|
|
514 |
|
|
515 |
/**
|
|
516 |
*
|
|
517 |
*/
|
|
518 |
MVPbkContactOperationBase* iRetrieveOperation;
|
|
519 |
|
|
520 |
/**
|
|
521 |
*
|
|
522 |
*/
|
|
523 |
MVPbkStoreContact* iStoreContact;
|
|
524 |
|
|
525 |
/// Own: Phonebook 2 field properties
|
|
526 |
MPbk2FieldPropertyArray* iFieldProperties;
|
|
527 |
|
|
528 |
/// Own: Store specific properties
|
|
529 |
CPbk2StoreSpecificFieldPropertyArray* iSpecificFieldProperties;
|
|
530 |
|
|
531 |
/// Own: Presentation level contact
|
|
532 |
CPbk2PresentationContact* iPresentationContact;
|
|
533 |
|
|
534 |
/// Ref: Icon array
|
|
535 |
const CPbk2IconArray& iIconArray;
|
|
536 |
|
|
537 |
/**
|
|
538 |
*
|
|
539 |
*/
|
|
540 |
TCCAppDetailsViewCommand iCommand;
|
|
541 |
|
|
542 |
/**
|
|
543 |
* The flag indicating if the editing has been aborted
|
|
544 |
*/
|
|
545 |
TBool iIsEditingAborted;
|
|
546 |
|
|
547 |
/**
|
|
548 |
*
|
|
549 |
*/
|
|
550 |
TInt iInitialFocusIndex;
|
|
551 |
|
|
552 |
/**
|
|
553 |
* Ref to plugin.
|
|
554 |
* Not own.
|
|
555 |
*/
|
|
556 |
CCCAppDetailsViewPlugin& iPlugin;
|
|
557 |
|
|
558 |
/// Own: Map current index to Presentation Contact index
|
|
559 |
RHashMap<TInt, TInt> iInxToPresentationIdx;
|
|
560 |
};
|
|
561 |
|
|
562 |
#endif // CCADETAILSVIEWLISTBOXMODEL_H
|
|
563 |
|
|
564 |
// End of File
|