|
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 #ifdef RD_HIDE_MEMORY_IN_USE |
|
55 return EFalse; |
|
56 #endif // RD_HIDE_MEMORY_IN_USE |
|
57 TBool memoryInUse = ETrue; |
|
58 if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) |
|
59 { |
|
60 if ( FeatureManager::FeatureSupported( KFeatureIdMmcHotswap ) ) |
|
61 { |
|
62 // if not hotswap phone, then Memory in use is enabled |
|
63 // if hotswap phone, check from shared data, if |
|
64 // Memory in use is enabled |
|
65 |
|
66 CRepository* repository = NULL; |
|
67 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
68 CleanupStack::PushL( repository ); |
|
69 |
|
70 TInt featureBitmask = 0; |
|
71 |
|
72 if ( ret == KErrNone ) |
|
73 { |
|
74 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
75 { |
|
76 memoryInUse = ETrue; |
|
77 } |
|
78 else |
|
79 { |
|
80 if ( !( featureBitmask & KMceFeatureIdHotswap ) ) |
|
81 { |
|
82 memoryInUse = EFalse; |
|
83 } |
|
84 } |
|
85 } |
|
86 CleanupStack::Pop( repository ); |
|
87 delete repository; |
|
88 } |
|
89 } |
|
90 else |
|
91 { |
|
92 //no mmc support |
|
93 memoryInUse = EFalse; |
|
94 } |
|
95 return memoryInUse; |
|
96 } |
|
97 |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // MceSettingsUtils::NewMailIndicatorL |
|
101 // This is static function |
|
102 // Returns ETrue if new mail indicator setting is supported |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 TBool MceSettingsUtils::NewMailIndicatorL() |
|
106 { |
|
107 TBool newMailIndicator = EFalse; |
|
108 |
|
109 CRepository* repository = NULL; |
|
110 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
111 CleanupStack::PushL( repository ); |
|
112 |
|
113 TInt featureBitmask = 0; |
|
114 |
|
115 if ( ret == KErrNone ) |
|
116 { |
|
117 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
118 { |
|
119 newMailIndicator = EFalse; |
|
120 } |
|
121 else |
|
122 { |
|
123 newMailIndicator = featureBitmask & KMceFeatureIdNewMailIndicator; |
|
124 } |
|
125 } |
|
126 |
|
127 CleanupStack::Pop( repository ); |
|
128 delete repository; |
|
129 |
|
130 return newMailIndicator; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------- |
|
134 // MceSettingsUtils::CspBitsL |
|
135 // Returns ETrue if csp bits is supported |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 TBool MceSettingsUtils::CspBitsL( ) |
|
139 { |
|
140 TBool csp = EFalse; |
|
141 |
|
142 CRepository* repository = NULL; |
|
143 TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuVariation ) ); |
|
144 CleanupStack::PushL( repository ); |
|
145 |
|
146 TInt featureBitmask = 0; |
|
147 |
|
148 if ( ret == KErrNone ) |
|
149 { |
|
150 if ( repository->Get( KMuiuMceFeatures,featureBitmask ) != KErrNone ) |
|
151 { |
|
152 csp = EFalse; |
|
153 } |
|
154 else |
|
155 { |
|
156 csp = featureBitmask & KMceFeatureIdCSPSupport; |
|
157 } |
|
158 } |
|
159 |
|
160 CleanupStack::Pop( repository ); |
|
161 delete repository; |
|
162 |
|
163 return csp; |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------- |
|
167 // MceUtils::GetHealthyMailboxList |
|
168 // This is static function |
|
169 // (other items were commented in a header). |
|
170 // --------------------------------------------------------- |
|
171 // |
|
172 TInt MceSettingsUtils::GetHealthyMailboxListL( |
|
173 const MImumInHealthServices& aHealthServices, |
|
174 MImumInHealthServices::RMailboxIdArray& aMailboxIdArray, |
|
175 TBool aGetImap4, |
|
176 TBool aGetPop3, |
|
177 TBool aGetSyncML, |
|
178 TBool aGetOther ) |
|
179 { |
|
180 TInt64 mailboxFlags = MImumInHealthServices::EFlagGetHealthy; |
|
181 |
|
182 if ( aGetImap4 ) |
|
183 { |
|
184 mailboxFlags |= MImumInHealthServices::EFlagIncludeImap4; |
|
185 } |
|
186 if ( aGetPop3 ) |
|
187 { |
|
188 mailboxFlags |= MImumInHealthServices::EFlagIncludePop3; |
|
189 } |
|
190 if ( aGetSyncML ) |
|
191 { |
|
192 mailboxFlags |= MImumInHealthServices::EFlagIncludeSyncMl; |
|
193 } |
|
194 if ( aGetOther ) |
|
195 { |
|
196 mailboxFlags |= MImumInHealthServices::EFlagIncludeOther; |
|
197 } |
|
198 |
|
199 TInt error = aHealthServices.GetMailboxList( |
|
200 aMailboxIdArray, |
|
201 mailboxFlags ); |
|
202 |
|
203 return error; |
|
204 } |
|
205 |
|
206 |
|
207 // End of File |