|
1 /* |
|
2 * Copyright (c) 2002 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 * Offers utility functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <msvids.h> |
|
23 #include <msvapi.h> |
|
24 #include <AknUtils.h> // AknTextUtils |
|
25 #include "MceSettingsUtils.h" |
|
26 #include <featmgr.h> |
|
27 |
|
28 #include <messagingvariant.hrh> |
|
29 #include <bldvariant.hrh> |
|
30 |
|
31 #include <centralrepository.h> |
|
32 #include <messaginginternalcrkeys.h> |
|
33 |
|
34 #include <ImumInternalApi.h> |
|
35 #include <ImumInHealthServices.h> |
|
36 |
|
37 #include <muiuflags.h> |
|
38 |
|
39 // CONSTANTS |
|
40 |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 |
|
44 |
|
45 // --------------------------------------------------------- |
|
46 // MceSettingsUtils::MemoryInUseOptionL |
|
47 // This is static function |
|
48 // Returns ETrue if 'Memory in use' option is enabled in |
|
49 // mce/settings |
|
50 // --------------------------------------------------------- |
|
51 // |
|
52 TBool MceSettingsUtils::MemoryInUseOptionL( ) |
|
53 { |
|
54 TBool memoryInUse = ETrue; |
|
55 if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) |
|
56 { |
|
57 if ( FeatureManager::FeatureSupported( KFeatureIdMmcHotswap ) ) |
|
58 { |
|
59 // if not hotswap phone, then Memory in use is enabled |
|
60 // if hotswap phone, check from shared data, if |
|
61 // Memory in use is enabled |
|
62 |
|
63 CRepository* repository = NULL; |
|
64 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
65 CleanupStack::PushL( repository ); |
|
66 |
|
67 TInt featureBitmask = 0; |
|
68 |
|
69 if ( ret == KErrNone ) |
|
70 { |
|
71 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
72 { |
|
73 memoryInUse = ETrue; |
|
74 } |
|
75 else |
|
76 { |
|
77 if ( !( featureBitmask & KMceFeatureIdHotswap ) ) |
|
78 { |
|
79 memoryInUse = EFalse; |
|
80 } |
|
81 } |
|
82 } |
|
83 CleanupStack::Pop( repository ); |
|
84 delete repository; |
|
85 } |
|
86 } |
|
87 else |
|
88 { |
|
89 //no mmc support |
|
90 memoryInUse = EFalse; |
|
91 } |
|
92 return memoryInUse; |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------- |
|
97 // MceSettingsUtils::NewMailIndicatorL |
|
98 // This is static function |
|
99 // Returns ETrue if new mail indicator setting is supported |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 TBool MceSettingsUtils::NewMailIndicatorL() |
|
103 { |
|
104 TBool newMailIndicator = EFalse; |
|
105 |
|
106 CRepository* repository = NULL; |
|
107 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
108 CleanupStack::PushL( repository ); |
|
109 |
|
110 TInt featureBitmask = 0; |
|
111 |
|
112 if ( ret == KErrNone ) |
|
113 { |
|
114 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
115 { |
|
116 newMailIndicator = EFalse; |
|
117 } |
|
118 else |
|
119 { |
|
120 newMailIndicator = featureBitmask & KMceFeatureIdNewMailIndicator; |
|
121 } |
|
122 } |
|
123 |
|
124 CleanupStack::Pop( repository ); |
|
125 delete repository; |
|
126 |
|
127 return newMailIndicator; |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------- |
|
131 // MceSettingsUtils::CspBitsL |
|
132 // Returns ETrue if csp bits is supported |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 TBool MceSettingsUtils::CspBitsL( ) |
|
136 { |
|
137 TBool csp = EFalse; |
|
138 |
|
139 CRepository* repository = NULL; |
|
140 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
141 CleanupStack::PushL( repository ); |
|
142 |
|
143 TInt featureBitmask = 0; |
|
144 |
|
145 if ( ret == KErrNone ) |
|
146 { |
|
147 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
148 { |
|
149 csp = EFalse; |
|
150 } |
|
151 else |
|
152 { |
|
153 csp = featureBitmask & KMceFeatureIdCSPSupport; |
|
154 } |
|
155 } |
|
156 |
|
157 CleanupStack::Pop( repository ); |
|
158 delete repository; |
|
159 |
|
160 return csp; |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------- |
|
164 // MceUtils::GetHealthyMailboxList |
|
165 // This is static function |
|
166 // (other items were commented in a header). |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 TInt MceSettingsUtils::GetHealthyMailboxListL( |
|
170 const MImumInHealthServices& aHealthServices, |
|
171 MImumInHealthServices::RMailboxIdArray& aMailboxIdArray, |
|
172 TBool aGetImap4, |
|
173 TBool aGetPop3, |
|
174 TBool aGetSyncML, |
|
175 TBool aGetOther ) |
|
176 { |
|
177 TInt64 mailboxFlags = MImumInHealthServices::EFlagGetHealthy; |
|
178 |
|
179 if ( aGetImap4 ) |
|
180 { |
|
181 mailboxFlags |= MImumInHealthServices::EFlagIncludeImap4; |
|
182 } |
|
183 if ( aGetPop3 ) |
|
184 { |
|
185 mailboxFlags |= MImumInHealthServices::EFlagIncludePop3; |
|
186 } |
|
187 if ( aGetSyncML ) |
|
188 { |
|
189 mailboxFlags |= MImumInHealthServices::EFlagIncludeSyncMl; |
|
190 } |
|
191 if ( aGetOther ) |
|
192 { |
|
193 mailboxFlags |= MImumInHealthServices::EFlagIncludeOther; |
|
194 } |
|
195 |
|
196 TInt error = aHealthServices.GetMailboxList( |
|
197 aMailboxIdArray, |
|
198 mailboxFlags ); |
|
199 |
|
200 return error; |
|
201 } |
|
202 |
|
203 |
|
204 // End of File |