|
1 /* |
|
2 * Copyright (c) 2008 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: PIM manager singleton native side, a starting point to PIM API. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMMANAGER_H |
|
20 #define CPIMMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <badesca.h> |
|
26 #include "pimcommon.h" |
|
27 #include "mpimcontactadaptermanager.h" |
|
28 #include "mpimeventadaptermanager.h" |
|
29 #include "mpimtodoadaptermanager.h" |
|
30 #include "functionserver.h" |
|
31 #include "pimbasemanager.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MPIMLocalizationManager; |
|
35 class CPIMVersit; |
|
36 class CPIMList; |
|
37 class pimbaselist; |
|
38 class CPIMContactList; |
|
39 class CPIMEventList; |
|
40 class CPIMToDoList; |
|
41 class CPIMItem; |
|
42 class CPIMContactValidator; |
|
43 class CPIMEventValidator; |
|
44 class CPIMToDoValidator; |
|
45 class MPIMAdapterAccess; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * PIM manager class. Provides access to PIM functionalities. |
|
51 */ |
|
52 NONSHARABLE_CLASS(CPIMManager): public CBase, |
|
53 public pimbasemanager, |
|
54 public java::util::FunctionServer |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Creates a new PIMManager and initializes it. |
|
60 * Initialization includes: |
|
61 * @li Initializing Validators |
|
62 * @li Initializing Adapter Managers from Adapter Access objects |
|
63 * @li Initializing Localization Manager |
|
64 * @li Initializing proper Localizations for each list |
|
65 * @li Initializing Versit |
|
66 */ |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * This constructor should be used in unit tests only. |
|
71 */ |
|
72 //static pimbasemanager* CPIMManager::getInstance( ) ; |
|
73 |
|
74 static CPIMManager* NewL(); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CPIMManager(); |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 /** |
|
84 * LocalizationManager |
|
85 * Returns an interface for PIM Localization manager |
|
86 * Note that caller does not take the ownership of the instance |
|
87 * |
|
88 * @return PIM Localization Manager |
|
89 */ |
|
90 MPIMLocalizationManager* localizationManager() const; |
|
91 |
|
92 /** |
|
93 * Appends a new Adapter Access to the end of the list of |
|
94 * Adapter Accesses. |
|
95 * |
|
96 * The order of Adapter Access objects and the lists provided by |
|
97 * them matters; default list of each type is the first list |
|
98 * of that type encountered when searched sequentially through |
|
99 * the Adapter Access objects and their lists. |
|
100 * |
|
101 * @param aAdapterAccess The new Adapter Access. |
|
102 * Owhership of the argument is taken. |
|
103 * |
|
104 * @par Leaving: |
|
105 * @li Any - fatal error. |
|
106 */ |
|
107 void AddAdapterAccessL(MPIMAdapterAccess* aAdapterAccess); |
|
108 |
|
109 /** |
|
110 * Opens a PIM list of given type. |
|
111 * |
|
112 * @param aPimListType List type. |
|
113 * @param aPimListName Name of the list. The name must be valid list |
|
114 * name. If not present, name is resolved to the default list |
|
115 * of the given type. |
|
116 * |
|
117 * @return PIM list. Type of the list corresponds to |
|
118 * \a aPimListType argument. |
|
119 * |
|
120 * @par Leaving: |
|
121 * The method leaves on error. Error codes should be interpreted as |
|
122 * follows: |
|
123 * @li \c KErrArgument - \a aPimListType is invalid. |
|
124 * @li \c KErrNotSupported - \a aPimListType is not supported. |
|
125 * @li \c KErrNotFound - No list was found by \a aPimListName. |
|
126 * @li \c KErrAlreadyExists - The list was already opened and multiple |
|
127 * instances of the list are not supported. |
|
128 * @li Other - Internal error. |
|
129 */ |
|
130 pimbaselist* openPimList( |
|
131 const TPIMListType& aPimListType, |
|
132 jstring aPimListName, |
|
133 JNIEnv* aJniEnv); |
|
134 |
|
135 /** |
|
136 * Lists PIM lists of given type. |
|
137 * The first entry in the list is the default list of the given type. |
|
138 * |
|
139 * @param aPimListType List type. |
|
140 * |
|
141 * @return Array of list names. |
|
142 * Caller takes the ownership of the returned object. |
|
143 * |
|
144 * @par Leaving: |
|
145 * @li \c KErrArgument - \a aPimListType is not valid PIM list type. |
|
146 */ |
|
147 |
|
148 jobjectArray listPimLists( |
|
149 const TPIMListType& aPimListType, |
|
150 jintArray aError, |
|
151 JNIEnv* aJniEnv); |
|
152 |
|
153 /** |
|
154 * Provides a Contact validator. |
|
155 */ |
|
156 const CPIMContactValidator& ContactValidator(); |
|
157 |
|
158 /** |
|
159 * Provides an Event validator. |
|
160 */ |
|
161 const CPIMEventValidator& EventValidator(); |
|
162 |
|
163 /** |
|
164 * Provides a ToDo validator. |
|
165 */ |
|
166 const CPIMToDoValidator& ToDoValidator(); |
|
167 |
|
168 protected: // New functions |
|
169 |
|
170 /** |
|
171 * Opens a contact list. |
|
172 * |
|
173 * @param aListName Name of the list or NULL to indicate |
|
174 * default list. |
|
175 * |
|
176 * @return A new list or NULL if no matching list was found. |
|
177 */ |
|
178 CPIMContactList* DoOpenContactListL( |
|
179 const TDesC* aListName); |
|
180 |
|
181 /** |
|
182 * Opens an event list. |
|
183 * |
|
184 * @param aListName Name of the list or NULL to indicate |
|
185 * default list. |
|
186 * |
|
187 * @return A new list or NULL if no matching list was found. |
|
188 */ |
|
189 CPIMEventList* DoOpenEventListL( |
|
190 const TDesC* aListName); |
|
191 |
|
192 /** |
|
193 * Opens a to-do list. |
|
194 * |
|
195 * @param aListName Name of the list or NULL to indicate |
|
196 * default list. |
|
197 * |
|
198 * @return A new list or NULL if no matching list was found. |
|
199 */ |
|
200 CPIMToDoList* DoOpenToDoListL( |
|
201 const TDesC* aListName); |
|
202 |
|
203 CDesCArray* CPIMManager::DoListPimListsL( |
|
204 const TPIMListType& aPimListType); |
|
205 |
|
206 pimbaselist* CPIMManager::DoOpenPimListL( |
|
207 const TPIMListType& aPimListType, |
|
208 const TDesC* aPimListName); |
|
209 |
|
210 void dispose(); |
|
211 |
|
212 private: // Constructors |
|
213 |
|
214 /** |
|
215 * C++ default constructor. |
|
216 */ |
|
217 CPIMManager(); |
|
218 |
|
219 /** |
|
220 * Symbian 2nd phase constructor. |
|
221 */ |
|
222 void ConstructL(); |
|
223 |
|
224 private: // Data |
|
225 |
|
226 /** Owned. */ |
|
227 MPIMLocalizationManager* iLocalizationManager; |
|
228 |
|
229 /** |
|
230 * List of Adapter Access objects. Elements are owned. |
|
231 */ |
|
232 RPointerArray< MPIMAdapterAccess> iAdapterAccesses; |
|
233 |
|
234 /** Owned. */ |
|
235 CPIMContactValidator* iContactValidator; |
|
236 |
|
237 /** Owned. */ |
|
238 CPIMEventValidator* iEventValidator; |
|
239 |
|
240 /** Owned. */ |
|
241 CPIMToDoValidator* iToDoValidator; |
|
242 |
|
243 |
|
244 }; |
|
245 |
|
246 #endif // CPIMMANAGER_H |
|
247 // End of File |