equal
deleted
inserted
replaced
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include "cpimmanager.h" |
20 #include "cpimmanager.h" |
21 #include <e32std.h> |
21 #include <e32std.h> |
22 #include <badesca.h> |
22 #include <badesca.h> |
23 #include <calsession.h> |
|
24 #include "pimcommon.h" |
23 #include "pimcommon.h" |
25 #include "mpimcontactadaptermanager.h" |
24 #include "mpimcontactadaptermanager.h" |
26 #include "mpimeventadaptermanager.h" |
25 #include "mpimeventadaptermanager.h" |
27 #include "mpimtodoadaptermanager.h" |
26 #include "mpimtodoadaptermanager.h" |
28 #include "mpimcontactlistadapter.h" |
27 #include "mpimcontactlistadapter.h" |
43 #include "cpimtodoadapteraccess.h" |
42 #include "cpimtodoadapteraccess.h" |
44 #include "pimpanics.h" |
43 #include "pimpanics.h" |
45 #include "pimjnitools.h" |
44 #include "pimjnitools.h" |
46 #include "pimutils.h" |
45 #include "pimutils.h" |
47 #include "jstringutils.h" |
46 #include "jstringutils.h" |
48 #include "fs_methodcall.h" |
|
49 #include "logger.h" |
47 #include "logger.h" |
50 #include "cpimlocalizationmanager.h" |
48 #include "cpimlocalizationmanager.h" |
51 |
|
52 #include "s60commonutils.h" |
|
53 |
|
54 |
|
55 |
49 |
56 // CONSTANTS |
50 // CONSTANTS |
57 |
51 |
58 /** |
52 /** |
59 * Array granularity for arrays of managers, cached list names and |
53 * Array granularity for arrays of managers, cached list names and |
78 |
72 |
79 iLocalizationManager |
73 iLocalizationManager |
80 = (MPIMLocalizationManager*)(CPIMLocalizationManager::NewL()); |
74 = (MPIMLocalizationManager*)(CPIMLocalizationManager::NewL()); |
81 |
75 |
82 createServerToNewThread(); |
76 createServerToNewThread(); |
83 CallMethodL(this, &CPIMManager::CreateCalSessionL, this); |
77 } |
84 } |
|
85 |
|
86 void CPIMManager::CreateCalSessionL() |
|
87 { |
|
88 iCalSession = CCalSession::NewL(); |
|
89 TRAPD(err, iCalSession->OpenL(iCalSession->DefaultFileNameL())); |
|
90 if ( KErrNotFound == err) |
|
91 { |
|
92 iCalSession->CreateCalFileL(iCalSession->DefaultFileNameL()); |
|
93 iCalSession->OpenL(iCalSession->DefaultFileNameL()); |
|
94 } |
|
95 else |
|
96 { |
|
97 User::LeaveIfError(err); |
|
98 } |
|
99 } |
|
100 |
78 |
101 pimbasemanager* pimbasemanager::getInstance() |
79 pimbasemanager* pimbasemanager::getInstance() |
102 { |
80 { |
103 JELOG2(EPim); |
81 JELOG2(EPim); |
104 // Create CPIMManager |
82 // Create CPIMManager |
154 iAdapterAccesses.ResetAndDestroy(); |
132 iAdapterAccesses.ResetAndDestroy(); |
155 delete iContactValidator; |
133 delete iContactValidator; |
156 iContactValidator = NULL; |
134 iContactValidator = NULL; |
157 delete iEventValidator; |
135 delete iEventValidator; |
158 iEventValidator = NULL; |
136 iEventValidator = NULL; |
159 delete iToDoValidator; |
137 delete iToDoValidator; |
160 CallMethod(this, &CPIMManager::DeleteSessions, this); |
|
161 |
|
162 iToDoValidator = NULL; |
138 iToDoValidator = NULL; |
163 stopServer(); |
139 stopServer(); |
164 } |
140 } |
165 void CPIMManager::DeleteSessions() |
|
166 { |
|
167 delete iCalSession; |
|
168 iCalSession = NULL; |
|
169 } |
|
170 |
141 |
171 void CPIMManager::dispose() |
142 void CPIMManager::dispose() |
172 { |
143 { |
173 JELOG2(EPim); |
144 JELOG2(EPim); |
174 delete iContactValidator; |
145 delete iContactValidator; |
362 JELOG2(EPim); |
333 JELOG2(EPim); |
363 CPIMEventList* eventList = NULL; |
334 CPIMEventList* eventList = NULL; |
364 |
335 |
365 MPIMEventAdapterManager* eventAdapterManager = NULL; |
336 MPIMEventAdapterManager* eventAdapterManager = NULL; |
366 MPIMEventListAdapter* eventListAdapter = NULL; |
337 MPIMEventListAdapter* eventListAdapter = NULL; |
367 MPIMLocalizationData* localizationData = NULL; |
338 MPIMLocalizationData* localizationData = NULL; |
|
339 |
368 const TInt n = iAdapterAccesses.Count(); |
340 const TInt n = iAdapterAccesses.Count(); |
369 for (TInt i = 0; i < n; i++) |
341 for (TInt i = 0; i < n; i++) |
370 { |
342 { |
371 if (iAdapterAccesses[i]->OpenEventListL(iCalSession,aListName, |
343 if (iAdapterAccesses[i]->OpenEventListL(aListName, |
372 &eventAdapterManager, &eventListAdapter, &localizationData)) |
344 &eventAdapterManager, &eventListAdapter, &localizationData)) |
373 { |
345 { |
374 // got one |
346 // got one |
375 CleanupDeletePushL(eventAdapterManager); |
347 CleanupDeletePushL(eventAdapterManager); |
376 CleanupDeletePushL(eventListAdapter); |
348 CleanupDeletePushL(eventListAdapter); |
395 JELOG2(EPim); |
367 JELOG2(EPim); |
396 CPIMToDoList* toDoList = NULL; |
368 CPIMToDoList* toDoList = NULL; |
397 |
369 |
398 MPIMToDoAdapterManager* toDoAdapterManager = NULL; |
370 MPIMToDoAdapterManager* toDoAdapterManager = NULL; |
399 MPIMToDoListAdapter* toDoListAdapter = NULL; |
371 MPIMToDoListAdapter* toDoListAdapter = NULL; |
400 MPIMLocalizationData* localizationData = NULL; |
372 MPIMLocalizationData* localizationData = NULL; |
|
373 |
401 const TInt n = iAdapterAccesses.Count(); |
374 const TInt n = iAdapterAccesses.Count(); |
402 for (TInt i = 0; i < n; i++) |
375 for (TInt i = 0; i < n; i++) |
403 { |
376 { |
404 if (iAdapterAccesses[i]->OpenToDoListL(iCalSession,aListName, &toDoAdapterManager, |
377 if (iAdapterAccesses[i]->OpenToDoListL(aListName, &toDoAdapterManager, |
405 &toDoListAdapter, &localizationData)) |
378 &toDoListAdapter, &localizationData)) |
406 { |
379 { |
407 // got one |
380 // got one |
408 CleanupDeletePushL(toDoAdapterManager); |
381 CleanupDeletePushL(toDoAdapterManager); |
409 CleanupDeletePushL(toDoListAdapter); |
382 CleanupDeletePushL(toDoListAdapter); |