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