|
1 /* |
|
2 * Copyright (c) 2002-2007 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: A store info implementation for the contact model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CContactStoreInfo.h" |
|
22 |
|
23 #include "CContactStore.h" |
|
24 #include "CContactStoreDomain.h" |
|
25 #include <MVPbkFieldType.h> |
|
26 #include <MVPbkContactStoreProperties.h> |
|
27 #include <cntdb.h> |
|
28 |
|
29 namespace VPbkCntModel { |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CContactStoreInfo::CContactStoreInfo |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CContactStoreInfo::CContactStoreInfo(CContactStore& aStore, |
|
40 CContactStoreDomain& aDomain) |
|
41 : iStore(aStore), |
|
42 iDomain(aDomain) |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CContactStoreInfo::NewL |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CContactStoreInfo* CContactStoreInfo::NewL(CContactStore& aStore, |
|
52 CContactStoreDomain& aDomain) |
|
53 { |
|
54 return new(ELeave) CContactStoreInfo(aStore,aDomain); |
|
55 } |
|
56 |
|
57 // Destructor |
|
58 CContactStoreInfo::~CContactStoreInfo() |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CContactStoreInfo::MaxNumberOfContactsL |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 TInt CContactStoreInfo::MaxNumberOfContactsL() const |
|
67 { |
|
68 return KVPbkStoreInfoUnlimitedNumber; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CContactStoreInfo::NumberOfContactsL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 TInt CContactStoreInfo::NumberOfContactsL() const |
|
76 { |
|
77 TInt groupCount = iStore.NativeDatabase().GroupCount(); |
|
78 return iStore.NativeDatabase().CountL() - groupCount; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CContactStoreInfo::ReservedMemoryL |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 TInt64 CContactStoreInfo::ReservedMemoryL() const |
|
86 { |
|
87 return iStore.NativeDatabase().FileSize(); |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CContactStoreInfo::FreeMemoryL |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TInt64 CContactStoreInfo::FreeMemoryL() const |
|
95 { |
|
96 TDriveUnit driveUnit; |
|
97 iStore.NativeDatabase().DatabaseDrive(driveUnit); |
|
98 |
|
99 TVolumeInfo volInfo; |
|
100 User::LeaveIfError(iDomain.FsSession().Volume(volInfo,driveUnit)); |
|
101 return volInfo.iFree; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CContactStoreInfo::MaxNumberOfGroupsL |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CContactStoreInfo::MaxNumberOfGroupsL() const |
|
109 { |
|
110 return KVPbkStoreInfoUnlimitedNumber; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CContactStoreInfo::NumberOfGroupsL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TInt CContactStoreInfo::NumberOfGroupsL() const |
|
118 { |
|
119 return iStore.NativeDatabase().GroupCount(); |
|
120 } |
|
121 |
|
122 } // namespace VPbkCntModel |
|
123 // End of File |