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