|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Phonebook 2 contact view sort policy. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTVIEWSORTPOLICY_H |
|
20 #define CPBK2CONTACTVIEWSORTPOLICY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <CVPbkContactViewSortPolicy.h> |
|
24 #include "TPbk2SortOrderFieldMapper.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CSortUtil; |
|
28 class MVPbkFieldTypeList; |
|
29 class CVPbkFieldTypeSelector; |
|
30 class CPbk2SortKeyArray; |
|
31 |
|
32 // CLASS DESCRIPTION |
|
33 |
|
34 /** |
|
35 * Phonebook 2 contact view sort policy. |
|
36 * Responsible for implementing Virtual Phonebook defined contact |
|
37 * view sort policy by following the rules specied for contact |
|
38 * sorting in UI level specifications. |
|
39 */ |
|
40 class CPbk2ContactViewSortPolicy : public CVPbkContactViewSortPolicy |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @param aParam Virtual Phonebook sort policy parameter. |
|
48 * @return A new instance of this class. |
|
49 */ |
|
50 static CPbk2ContactViewSortPolicy* NewL( |
|
51 TParam* aParam ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 ~CPbk2ContactViewSortPolicy(); |
|
57 |
|
58 private: // From CVPbkContactViewSortPolicy |
|
59 void SetSortOrderL( |
|
60 const MVPbkFieldTypeList& aSortOrder ); |
|
61 void SortStartL(); |
|
62 void SortCompleted(); |
|
63 TInt CompareContacts( |
|
64 const MVPbkViewContact& aLhs, |
|
65 const MVPbkViewContact& aRhs ); |
|
66 TInt CompareItems( |
|
67 const MVPbkSortKeyArray& aLhs, |
|
68 const MVPbkSortKeyArray& aRhs ) const; |
|
69 |
|
70 private: // Implementation |
|
71 CPbk2ContactViewSortPolicy(); |
|
72 void ConstructL( |
|
73 TParam* aParam ); |
|
74 TInt PostProcessResult( |
|
75 TInt aSortUtilResult ); |
|
76 |
|
77 private: // Data |
|
78 /// Own: Sort Util to forward sorting requests |
|
79 CSortUtil* iSortUtil; |
|
80 /// Own: Field type selector for pronunciation fields |
|
81 CVPbkFieldTypeSelector* iPronunciationFieldSelector; |
|
82 /// Own: sort key array for left hand side |
|
83 CPbk2SortKeyArray* iLeftSortKeyArray; |
|
84 /// Own: sort key array for right hand side |
|
85 CPbk2SortKeyArray* iRightSortKeyArray; |
|
86 /// Own: Sort order of the view that this sort policy is related to |
|
87 const MVPbkFieldTypeList* iSortOrder; |
|
88 /// Own: Contact field mapper for mapping |
|
89 /// contact fields to sort order fields |
|
90 TPbk2SortOrderFieldMapper iFieldMapper; |
|
91 /// Own: Indicates succesfull initialization |
|
92 TBool iSortPolicyParameterReceived; |
|
93 }; |
|
94 |
|
95 #endif // CPBK2CONTACTVIEWSORTPOLICY_H |
|
96 |
|
97 // End of File |