|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #ifndef CNTSYNCPHONEDATA_H |
|
18 #define CNTSYNCPHONEDATA_H |
|
19 |
|
20 #include "cntphonecontact.h" |
|
21 |
|
22 #include <cntdef.h> |
|
23 #include <cntdb.h> |
|
24 |
|
25 #include <centralrepository.h> // CRepository. |
|
26 #include <e32property.h> |
|
27 #include <phbksync.h> |
|
28 #include <e32base.h> |
|
29 #include <e32cmn.h> |
|
30 |
|
31 class CContactSyncData; |
|
32 |
|
33 NONSHARABLE_CLASS(CContactSyncPhonebookData) : public CBase |
|
34 { |
|
35 public: |
|
36 static CContactSyncPhonebookData* NewLC(TUid aPhonebookUid, CRepository* aRepository); |
|
37 static CContactSyncPhonebookData* NewL(TUint32& aCRKey, CRepository* aRepository); |
|
38 |
|
39 ~CContactSyncPhonebookData(); |
|
40 |
|
41 void AddPhonebookContactL(const TDesC& aName, const TDesC& aNumber); |
|
42 |
|
43 |
|
44 // high level synchronisation control |
|
45 TInt SynchronisePhonebook(CContactDatabase& aDb, TInt aCompletionError, TInt aLeaveError); |
|
46 void ResetSynchronised(TBool aResetTemplateAndGroupIds); |
|
47 |
|
48 |
|
49 // low level twiddling |
|
50 void SetTemplateId(TInt aPhonebookTemplateId); |
|
51 void SetGroupId(TInt aPhonebookGroupId); |
|
52 void SetSynchronised(TInt aSynchronised); |
|
53 void SetSynchronisedLeaveCode(TInt aLeaveError); |
|
54 void CompleteNotificationRequest(TInt aError); |
|
55 void CancelNotificationRequestL(); |
|
56 |
|
57 // metrics |
|
58 TInt NotificationPendingCount(); |
|
59 |
|
60 |
|
61 // directly support Phonebook plug-in interfaces |
|
62 TBool IsSynchronisedL(); |
|
63 TInt StoreNotificationRequest(TInt aError); |
|
64 const TUid& PhonebookUid(); |
|
65 TInt TemplateId(); |
|
66 TInt GroupId(); |
|
67 TInt ErrorCode(); |
|
68 |
|
69 TBool SynchroniseRequired(); |
|
70 void InternaliseFromCRL(TUint32& aCRKey); |
|
71 void ExternaliseToCRL(TUint32& aCRKey); |
|
72 private: |
|
73 CContactSyncPhonebookData(TUid aPhonebookUid, CRepository* aRepository); |
|
74 void ValidateTemplateIdAndLabelL(CContactDatabase& aDb); |
|
75 void CreateTemplateIdL(CContactDatabase &aDb); |
|
76 void ValidateGroupIdAndTemplateL(CContactDatabase& aDb); |
|
77 void CreateGroupIdL(CContactDatabase &aDb); |
|
78 const TDesC& TemplateLabel(); |
|
79 void SynchroniseContactsL(CContactDatabase &aDb); |
|
80 |
|
81 private: |
|
82 TUid iPhonebookUid; // UID of this Phonebook |
|
83 TContactItemId iPhonebookTemplateId; |
|
84 TContactItemId iPhonebookGroupId; |
|
85 |
|
86 // owned data |
|
87 RArray<TInt> iStatusArray; |
|
88 //RArray<CPhonebookContact> iPhonebookContacts; |
|
89 RPointerArray<CPhonebookContact> iPhonebookContacts; |
|
90 CContactItem* iIccTemplate; |
|
91 |
|
92 // state |
|
93 TBool iIsSynchronised; |
|
94 TInt iSynchronisedLeaveCode; |
|
95 TInt iNotificationPending; |
|
96 TInt iErrorCode; |
|
97 |
|
98 CRepository* iRepository; |
|
99 }; |
|
100 |
|
101 #endif |
|
102 |