|
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 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 @released |
|
23 */ |
|
24 |
|
25 |
|
26 #ifndef __CPREDICTIVESEARCHSYNCHRONIZER_H__ |
|
27 #define __CPREDICTIVESEARCHSYNCHRONIZER_H__ |
|
28 |
|
29 // INCLUDES |
|
30 #include <e32base.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class RSqlDatabase; |
|
34 class CContactItem; |
|
35 class CPplPredictiveSearchTableBase; |
|
36 class C12keyPredictiveSearchTable; |
|
37 class CQwertyPredictiveSearchTable; |
|
38 class CPredictiveSearchSettingsTable; |
|
39 |
|
40 |
|
41 /** |
|
42 The CPredictiveSearchSynchronizer class takes care of populating predictive |
|
43 search tables with the relevant data from contacts. |
|
44 */ |
|
45 NONSHARABLE_CLASS(CPredictiveSearchSynchronizer) : public CBase |
|
46 { |
|
47 public: |
|
48 static CPredictiveSearchSynchronizer* |
|
49 NewL(RSqlDatabase& aDatabase, |
|
50 C12keyPredictiveSearchTable& a12keyTable, |
|
51 CQwertyPredictiveSearchTable& aQwertyTable, |
|
52 CPredictiveSearchSettingsTable& aSettingsTable); |
|
53 static CPredictiveSearchSynchronizer* |
|
54 NewLC(RSqlDatabase& aDatabase, |
|
55 C12keyPredictiveSearchTable& a12keyTable, |
|
56 CQwertyPredictiveSearchTable& aQwertyTable, |
|
57 CPredictiveSearchSettingsTable& aSettingsTable); |
|
58 virtual ~CPredictiveSearchSynchronizer(); |
|
59 |
|
60 public: // New functions |
|
61 void SynchronizeTablesL(); |
|
62 |
|
63 /** |
|
64 * Create and fill the specified predictive search tables. |
|
65 * |
|
66 * aAllTables If ETrue, then 12-key, QWERTY table and settings table are |
|
67 * created. Otherwise just QWERTY table is created. |
|
68 */ |
|
69 void CreatePredSearchTablesL(TBool aAllTables = ETrue); |
|
70 void DeletePredSearchTablesL(); |
|
71 |
|
72 private: |
|
73 void ConstructL(); |
|
74 CPredictiveSearchSynchronizer(RSqlDatabase& aDatabase, |
|
75 C12keyPredictiveSearchTable& a12keyTable, |
|
76 CQwertyPredictiveSearchTable& aQwertyTable, |
|
77 CPredictiveSearchSettingsTable& aSettingsTable); |
|
78 |
|
79 private: // New functions |
|
80 TBool CheckIfPredSearchTableExistsL(const TDesC& aTableName) const; |
|
81 void DeletePredSearchTableL(CPplPredictiveSearchTableBase& aTable); |
|
82 TBool ReadMailAddressesL(CContactItem& aContact); |
|
83 |
|
84 private: // Data |
|
85 RSqlDatabase& iDatabase; |
|
86 C12keyPredictiveSearchTable& i12keyTable; |
|
87 CQwertyPredictiveSearchTable& iQwertyTable; |
|
88 CPredictiveSearchSettingsTable& iSettingsTable; |
|
89 |
|
90 // For unit testing |
|
91 friend class UT_CPplPredictiveSearchTable; |
|
92 }; |
|
93 |
|
94 #endif // __CPREDICTIVESEARCHSYNCHRONIZER_H__ |