69 } |
66 } |
70 } |
67 } |
71 |
68 |
72 } /// namespace |
69 } /// namespace |
73 |
70 |
74 /** |
|
75 * Helper class to filter mycard from phonebooks views |
|
76 */ |
|
77 class CPbk2MyCardFilter : public CBase, |
|
78 public MVPbkContactSelector |
|
79 { |
|
80 public: |
|
81 CPbk2MyCardFilter(); |
|
82 ~CPbk2MyCardFilter(); |
|
83 protected: // From MVPbkContactSelector |
|
84 TBool IsContactIncluded( |
|
85 const MVPbkBaseContact& aContact ); |
|
86 }; |
|
87 |
|
88 CPbk2MyCardFilter::CPbk2MyCardFilter() |
|
89 { |
|
90 } |
|
91 |
|
92 CPbk2MyCardFilter::~CPbk2MyCardFilter() |
|
93 { |
|
94 } |
|
95 |
|
96 TBool CPbk2MyCardFilter::IsContactIncluded( |
|
97 const MVPbkBaseContact& aContact ) |
|
98 { |
|
99 TBool isContactIncluded( ETrue ); |
|
100 // this is temporary solution to hide own contact from phonebook contacts list, |
|
101 // TODO remove this code when we can hide own contact with contact model |
|
102 |
|
103 MVPbkBaseContact& contact = const_cast<MVPbkBaseContact&>( aContact ); |
|
104 TAny* extension = contact.BaseContactExtension( |
|
105 KVPbkBaseContactExtension2Uid ); |
|
106 |
|
107 if( extension ) |
|
108 { |
|
109 MVPbkBaseContact2* baseContactExtension = |
|
110 static_cast<MVPbkBaseContact2*>( extension ); |
|
111 TInt error( KErrNone ); |
|
112 isContactIncluded = |
|
113 ( !baseContactExtension->IsOwnContact( error ) ); |
|
114 } |
|
115 |
|
116 return isContactIncluded; |
|
117 } |
|
118 |
71 |
119 // -------------------------------------------------------------------------- |
72 // -------------------------------------------------------------------------- |
120 // CPbk2ServerAppStoreManager::CPbk2ServerAppStoreManager |
73 // CPbk2ServerAppStoreManager::CPbk2ServerAppStoreManager |
121 // -------------------------------------------------------------------------- |
74 // -------------------------------------------------------------------------- |
122 // |
75 // |
138 iOpenedStores.Reset(); |
91 iOpenedStores.Reset(); |
139 iOpenedStores.Close(); |
92 iOpenedStores.Close(); |
140 delete iSortOrderAcquirer; |
93 delete iSortOrderAcquirer; |
141 delete iMonitor; |
94 delete iMonitor; |
142 delete iFetchView; |
95 delete iFetchView; |
143 delete iMyCardFilter; |
|
144 } |
96 } |
145 |
97 |
146 // -------------------------------------------------------------------------- |
98 // -------------------------------------------------------------------------- |
147 // CPbk2ServerAppStoreManager::ConstructL |
99 // CPbk2ServerAppStoreManager::ConstructL |
148 // -------------------------------------------------------------------------- |
100 // -------------------------------------------------------------------------- |
218 MVPbkContactViewBase* result = NULL; |
170 MVPbkContactViewBase* result = NULL; |
219 |
171 |
220 CPbk2ContactViewBuilder* viewBuilder = CPbk2ContactViewBuilder::NewLC |
172 CPbk2ContactViewBuilder* viewBuilder = CPbk2ContactViewBuilder::NewLC |
221 ( iContactManager, aStoreProperties ); |
173 ( iContactManager, aStoreProperties ); |
222 |
174 |
223 if( !iMyCardFilter ) |
|
224 { |
|
225 FeatureManager::InitializeLibL(); |
|
226 if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) ) |
|
227 { |
|
228 iMyCardFilter = new (ELeave) CPbk2MyCardFilter(); |
|
229 } |
|
230 FeatureManager::UnInitializeLib(); |
|
231 } |
|
232 |
|
233 |
|
234 if ( aViewType == EVPbkContactsView ) |
175 if ( aViewType == EVPbkContactsView ) |
235 { |
176 { |
236 result = viewBuilder->CreateContactViewForStoresLC |
177 result = viewBuilder->CreateContactViewForStoresLC |
237 ( aStoreUris, *this, aSortOrderManager.SortOrder(), |
178 ( aStoreUris, *this, aSortOrderManager.SortOrder(), |
238 aViewFilter, aFlags, iMyCardFilter ); |
179 aViewFilter, aFlags ); |
239 CleanupStack::Pop(); // result |
180 CleanupStack::Pop(); // result |
240 } |
181 } |
241 else if ( aViewType == EVPbkGroupsView ) |
182 else if ( aViewType == EVPbkGroupsView ) |
242 { |
183 { |
243 const MVPbkFieldTypeList* sortOrder = NULL; |
184 const MVPbkFieldTypeList* sortOrder = NULL; |