|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 application services. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPbk2UIApplicationServices.h" |
|
21 #include "tpbk2multidriveavailable.h" |
|
22 |
|
23 // Phonebook 2 |
|
24 #include <CPbk2StoreManager.h> |
|
25 #include <CPbk2SortOrderManager.h> |
|
26 #include <MPbk2ContactNameFormatter.h> |
|
27 #include <CPbk2CommandHandler.h> |
|
28 #include <MPbk2ViewExplorer.h> |
|
29 #include <Pbk2ContactNameFormatterFactory.h> |
|
30 #include <Pbk2CommonUi.rsg> |
|
31 #include <CPbk2StorePropertyArray.h> |
|
32 #include <CPbk2FieldPropertyArray.h> |
|
33 #include <Pbk2MenuFilteringFlags.hrh> |
|
34 #include <Phonebook2PrivateCRKeys.h> |
|
35 #include <CPbk2ContactViewSupplier.h> |
|
36 #include <CPbk2StoreConfiguration.h> |
|
37 #include <CPbk2ServiceManager.h> |
|
38 |
|
39 // Virtual Phonebook |
|
40 #include <CVPbkContactManager.h> |
|
41 #include <CVPbkContactStoreUriArray.h> |
|
42 |
|
43 // System includes |
|
44 #include <StringLoader.h> |
|
45 #include <sendui.h> |
|
46 |
|
47 // Debugging headers |
|
48 #include <Pbk2Config.hrh> |
|
49 #include <Pbk2Debug.h> |
|
50 #include <Pbk2Profile.h> |
|
51 |
|
52 // -------------------------------------------------------------------------- |
|
53 // CPbk2UIApplicationServices::CPbk2UIApplicationServices |
|
54 // -------------------------------------------------------------------------- |
|
55 // |
|
56 CPbk2UIApplicationServices::CPbk2UIApplicationServices() : |
|
57 iFsSession( CCoeEnv::Static()->FsSession() ) |
|
58 { |
|
59 } |
|
60 |
|
61 // -------------------------------------------------------------------------- |
|
62 // CPbk2UIApplicationServices::~CPbk2UIApplicationServices |
|
63 // -------------------------------------------------------------------------- |
|
64 // |
|
65 CPbk2UIApplicationServices::~CPbk2UIApplicationServices() |
|
66 { |
|
67 // Command handler is calling iStoreConfiguration's RemoveObserver |
|
68 // in its destructor. So delete command handler before store |
|
69 // configuration. |
|
70 delete iCommandHandler; |
|
71 delete iSendUi; |
|
72 |
|
73 Release( iAppServices ); |
|
74 } |
|
75 |
|
76 // -------------------------------------------------------------------------- |
|
77 // CPbk2UIApplicationServices::ConstructL |
|
78 // -------------------------------------------------------------------------- |
|
79 // |
|
80 inline void CPbk2UIApplicationServices::ConstructL() |
|
81 { |
|
82 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
83 ( "CPbk2UIApplicationServices::ConstructL(0x%x)"), this ); |
|
84 |
|
85 iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
86 |
|
87 // Set core Phonebook 2 stores |
|
88 //iAppServices->StoreManager().EnsureDefaultSavingStoreIncludedL(); |
|
89 //iAppServices->StoreManager().EnsureCurrentConfigurationStoresIncludedL(); |
|
90 |
|
91 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
92 ("CPbk2UIApplicationServices::ConstructL(0x%x) end"), this); |
|
93 } |
|
94 |
|
95 // -------------------------------------------------------------------------- |
|
96 // CPbk2UIApplicationServices::NewL |
|
97 // -------------------------------------------------------------------------- |
|
98 // |
|
99 CPbk2UIApplicationServices* CPbk2UIApplicationServices::NewL() |
|
100 { |
|
101 CPbk2UIApplicationServices* self = |
|
102 new ( ELeave ) CPbk2UIApplicationServices(); |
|
103 CleanupStack::PushL( self ); |
|
104 self->ConstructL(); |
|
105 CleanupStack::Pop( self ); |
|
106 return self; |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 // CPbk2UIApplicationServices::ContactManager |
|
111 // -------------------------------------------------------------------------- |
|
112 // |
|
113 CVPbkContactManager& CPbk2UIApplicationServices::ContactManager() const |
|
114 { |
|
115 return iAppServices->ContactManager(); |
|
116 } |
|
117 |
|
118 // -------------------------------------------------------------------------- |
|
119 // CPbk2UIApplicationServices::CommandHandlerL |
|
120 // -------------------------------------------------------------------------- |
|
121 // |
|
122 MPbk2CommandHandler* CPbk2UIApplicationServices::CommandHandlerL() |
|
123 { |
|
124 if ( !iCommandHandler ) |
|
125 { |
|
126 iCommandHandler = CPbk2CommandHandler::NewL(); |
|
127 } |
|
128 |
|
129 return iCommandHandler; |
|
130 } |
|
131 |
|
132 // -------------------------------------------------------------------------- |
|
133 // CPbk2UIApplicationServices::NameFormatter |
|
134 // -------------------------------------------------------------------------- |
|
135 // |
|
136 MPbk2ContactNameFormatter& CPbk2UIApplicationServices::NameFormatter() const |
|
137 { |
|
138 return iAppServices->NameFormatter(); |
|
139 } |
|
140 |
|
141 // -------------------------------------------------------------------------- |
|
142 // CPbk2UIApplicationServices::SortOrderManager |
|
143 // -------------------------------------------------------------------------- |
|
144 // |
|
145 CPbk2SortOrderManager& CPbk2UIApplicationServices::SortOrderManager() const |
|
146 { |
|
147 return iAppServices->SortOrderManager(); |
|
148 } |
|
149 |
|
150 // -------------------------------------------------------------------------- |
|
151 // CPbk2UIApplicationServices::SendUiL |
|
152 // -------------------------------------------------------------------------- |
|
153 // |
|
154 CSendUi* CPbk2UIApplicationServices::SendUiL() |
|
155 { |
|
156 if ( !iSendUi ) |
|
157 { |
|
158 iSendUi = CSendUi::NewL(); |
|
159 PBK2_DEBUG_PRINT( PBK2_DEBUG_STRING |
|
160 ( "CPbk2UIApplicationServices::SendUiL(0x%x) SendUI created"), |
|
161 this ); |
|
162 } |
|
163 return iSendUi; |
|
164 } |
|
165 |
|
166 // -------------------------------------------------------------------------- |
|
167 // CPbk2UIApplicationServices::StoreProperties |
|
168 // -------------------------------------------------------------------------- |
|
169 // |
|
170 CPbk2StorePropertyArray& CPbk2UIApplicationServices::StoreProperties() const |
|
171 { |
|
172 return iAppServices->StoreProperties(); |
|
173 } |
|
174 |
|
175 // -------------------------------------------------------------------------- |
|
176 // CPbk2UIApplicationServices::FieldProperties |
|
177 // -------------------------------------------------------------------------- |
|
178 // |
|
179 CPbk2FieldPropertyArray& CPbk2UIApplicationServices::FieldProperties() const |
|
180 { |
|
181 return iAppServices->FieldProperties(); |
|
182 } |
|
183 |
|
184 // -------------------------------------------------------------------------- |
|
185 // CPbk2UIApplicationServices::StoreConfiguration |
|
186 // -------------------------------------------------------------------------- |
|
187 // |
|
188 CPbk2StoreConfiguration& CPbk2UIApplicationServices::StoreConfiguration() const |
|
189 { |
|
190 return iAppServices->StoreConfiguration(); |
|
191 } |
|
192 |
|
193 // -------------------------------------------------------------------------- |
|
194 // CPbk2UIApplicationServices::StoreObservationRegister |
|
195 // -------------------------------------------------------------------------- |
|
196 // |
|
197 MPbk2StoreObservationRegister& |
|
198 CPbk2UIApplicationServices::StoreObservationRegister() const |
|
199 { |
|
200 return iAppServices->StoreManager(); |
|
201 } |
|
202 |
|
203 // -------------------------------------------------------------------------- |
|
204 // CPbk2UIApplicationServices::StoreValidityInformer |
|
205 // -------------------------------------------------------------------------- |
|
206 // |
|
207 MPbk2StoreValidityInformer& |
|
208 CPbk2UIApplicationServices::StoreValidityInformer() const |
|
209 { |
|
210 return iAppServices->StoreManager(); |
|
211 } |
|
212 |
|
213 |
|
214 // -------------------------------------------------------------------------- |
|
215 // CPbk2UIApplicationServices::ViewSupplier |
|
216 // -------------------------------------------------------------------------- |
|
217 // |
|
218 MPbk2ContactViewSupplier& CPbk2UIApplicationServices::ViewSupplier() const |
|
219 { |
|
220 return iAppServices->ViewSupplier(); |
|
221 } |
|
222 |
|
223 // -------------------------------------------------------------------------- |
|
224 // CPbk2UIApplicationServices::GlobalMenuFilteringFlagsL |
|
225 // -------------------------------------------------------------------------- |
|
226 // |
|
227 TInt CPbk2UIApplicationServices::GlobalMenuFilteringFlagsL() const |
|
228 { |
|
229 TInt result = KPbk2MenuFilteringFlagsNone; |
|
230 |
|
231 if ( TPbk2MultiDriveAvailable::MultiDriveAvailable( iFsSession ) ) |
|
232 { |
|
233 result |= KPbk2MultiDriveAvailable; |
|
234 } |
|
235 |
|
236 return result; |
|
237 } |
|
238 |
|
239 // -------------------------------------------------------------------------- |
|
240 // CPbk2UIApplicationServices::LocallyVariatedFeatureEnabled |
|
241 // -------------------------------------------------------------------------- |
|
242 // |
|
243 TBool CPbk2UIApplicationServices::LocallyVariatedFeatureEnabled( |
|
244 TVPbkLocalVariantFlags aFeatureFlag) |
|
245 { |
|
246 return iAppServices->LocallyVariatedFeatureEnabled(aFeatureFlag); |
|
247 } |
|
248 |
|
249 // -------------------------------------------------------------------------- |
|
250 // CPbk2UIApplicationServices::MPbk2ApplicationServicesExtension |
|
251 // -------------------------------------------------------------------------- |
|
252 // |
|
253 TAny* CPbk2UIApplicationServices::MPbk2ApplicationServicesExtension( |
|
254 TUid aExtensionUid ) |
|
255 { |
|
256 if ( aExtensionUid == KMPbk2ApplicationServicesExtension2Uid ) |
|
257 { |
|
258 return static_cast<MPbk2ApplicationServices2*>( this ); |
|
259 } |
|
260 return NULL; |
|
261 } |
|
262 |
|
263 // -------------------------------------------------------------------------- |
|
264 // CPbk2UIApplicationServices::StoreManager |
|
265 // -------------------------------------------------------------------------- |
|
266 // |
|
267 CPbk2StoreManager& CPbk2UIApplicationServices::StoreManager() const |
|
268 { |
|
269 return iAppServices->StoreManager(); |
|
270 } |
|
271 |
|
272 // -------------------------------------------------------------------------- |
|
273 // CPbk2UIApplicationServices::ServicesManager |
|
274 // -------------------------------------------------------------------------- |
|
275 // |
|
276 CPbk2ServiceManager& CPbk2UIApplicationServices::ServiceManager() const |
|
277 { |
|
278 return iAppServices->ServiceManager(); |
|
279 } |
|
280 |
|
281 // End of File |