|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CCONTACTSPLUGIN_H |
|
19 #define CCONTACTSPLUGIN_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <cntfldst.h> |
|
23 #include <cntitem.h> |
|
24 #include <cntdbobs.h> |
|
25 #include <cindexingplugin.h> |
|
26 #include <common.h> |
|
27 #include "delayedcallback.h" |
|
28 |
|
29 class CSearchDocument; |
|
30 class CContactItemFieldSet; |
|
31 class CCPixIndexer; |
|
32 |
|
33 /** Field names */ |
|
34 _LIT(KContactsGivenNameField, "GivenName"); |
|
35 _LIT(KContactsFamilyNameField, "FamilyName"); |
|
36 _LIT(KContactsCompanyNameField, "CompanyName"); |
|
37 _LIT(KContactsPhoneNumberField, "PhoneNumber"); |
|
38 _LIT(KContactsAddressField, "Address"); |
|
39 _LIT(KContactsNoteField, "Note"); |
|
40 _LIT(KContactsJobTitleField, "JobTitle"); |
|
41 _LIT(KContactsSecondNameField, "SecondName"); |
|
42 |
|
43 _LIT(KContactsSuffixField, "Suffix"); |
|
44 _LIT(KContactsEMailField, "EMail"); |
|
45 _LIT(KContactsUrlField, "URL"); |
|
46 |
|
47 _LIT(KContactsPostOfficeField, "PostOffice"); |
|
48 _LIT(KContactsExtendedAddressField, "ExtendedAddress"); |
|
49 _LIT(KContactsLocalityField, "Locality"); |
|
50 _LIT(KContactsRegionField, "Region"); |
|
51 _LIT(KContactsPostcodeField, "PostCode"); |
|
52 _LIT(KContactsCountryField, "Country"); |
|
53 _LIT(KContactsSIPIDField, "SIPID"); |
|
54 _LIT(KContactsSpouseField, "Spouse"); |
|
55 _LIT(KContactsChildrenField, "Children"); |
|
56 _LIT(KContactsClassField, "Class"); |
|
57 _LIT(KContactsPrefixField, "Prefix"); |
|
58 _LIT(KContactsAdditionalNameField, "AdditionalName"); |
|
59 _LIT(KContactsFaxField, "Fax"); |
|
60 _LIT(KContactsGivenNamePronunciationField, "GivenNamePronunciation"); |
|
61 _LIT(KContactsFamilyNamePronunciationField, "FamilyNamePronunciation"); |
|
62 _LIT(KContactsCompanyNamePronunciationField, "CompanyNamePronunciation"); |
|
63 |
|
64 |
|
65 class CContactsPlugin : public CIndexingPlugin, public MContactDbObserver, public MDelayedCallbackObserver |
|
66 { |
|
67 public: |
|
68 static CContactsPlugin* NewL(); |
|
69 static CContactsPlugin* NewLC(); |
|
70 virtual ~CContactsPlugin(); |
|
71 |
|
72 /** |
|
73 * From CIndexingPlugin |
|
74 */ |
|
75 void StartPluginL(); |
|
76 void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); |
|
77 |
|
78 /** |
|
79 * From MContactDbObserver, HandleDatabaseEventL. |
|
80 */ |
|
81 void HandleDatabaseEventL(TContactDbObserverEvent aEvent); |
|
82 |
|
83 /** |
|
84 * From MDelayedCallbackObserver, DelayedCallbackL |
|
85 */ |
|
86 void DelayedCallbackL(TInt aCode); |
|
87 void DelayedError(TInt aError); |
|
88 |
|
89 protected: |
|
90 CContactsPlugin(); |
|
91 void ConstructL(); |
|
92 |
|
93 /** |
|
94 * Adds information field (if available) |
|
95 */ |
|
96 void AddFieldL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName ); |
|
97 |
|
98 /** |
|
99 * Adds to excerpt |
|
100 */ |
|
101 void AddToExcerptL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName ); |
|
102 |
|
103 /** |
|
104 * Creates the actual contact book index item |
|
105 */ |
|
106 void CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType); |
|
107 |
|
108 private: |
|
109 |
|
110 /** Contact change notifier */ |
|
111 CContactChangeNotifier* iChangeNotifier; |
|
112 /** Sorted contact id array */ |
|
113 const CContactIdArray* iContacts; |
|
114 /** Contacts database. */ |
|
115 CContactDatabase* iDatabase; |
|
116 /** The asynchronizer */ |
|
117 CDelayedCallback* iAsynchronizer; |
|
118 /** Current harvested contact index */ |
|
119 TInt iCurrentIndex; |
|
120 /** placeholder for Excerpt text dynamic creation */ |
|
121 HBufC* iExcerpt; |
|
122 |
|
123 // CPix database |
|
124 CCPixIndexer* iIndexer; |
|
125 |
|
126 #ifdef __PERFORMANCE_DATA |
|
127 TTime iStartTime; |
|
128 TTime iCompleteTime; |
|
129 void UpdatePerformaceDataL(); |
|
130 void UpdatePerformaceDataL(TCPixActionType); |
|
131 #endif |
|
132 }; |
|
133 |
|
134 #endif // CCONTACTSPLUGIN_H |