|
1 /* |
|
2 * Copyright (c) 2007-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: Interface of the folder command |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MMFOLDERCOMMAND_H |
|
21 #define MMFOLDERCOMMAND_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <liwcommon.h> |
|
25 #include "mmdialogmanager.h" |
|
26 #include "mcsmenusapi.h" |
|
27 |
|
28 class CMmPluginSharedResources; |
|
29 class CHnMdBaseKey; |
|
30 class CHnServiceHandler; |
|
31 class CAknQueryDialog; |
|
32 class MMmActionRequest; |
|
33 class MMmDialogManager; |
|
34 |
|
35 /** |
|
36 * Base class for folder operations |
|
37 * @since S60 v5.0 |
|
38 */ |
|
39 |
|
40 /** |
|
41 * CMmFolderCommand is a class which all command classes derived from. |
|
42 * It has a several common functions responsible for creating appropriate |
|
43 * command instance, displaying dialogs, controlling command execution, |
|
44 * getting data from resources, displaying dialogs and executing MCS queries. |
|
45 * CMmFolderCommand is using only as a base class in inheritance. |
|
46 * |
|
47 * @lib mmfolderuiextensionplugin.lib |
|
48 * @since S60 5.0 |
|
49 * @ingroup group_mmfolderuiextensionplugin |
|
50 */ |
|
51 NONSHARABLE_CLASS( CMmFolderCommand ) : public CBase, |
|
52 public MMmDialogManager, |
|
53 public MLiwNotifyCallback |
|
54 { |
|
55 |
|
56 protected: |
|
57 |
|
58 /** |
|
59 * Current state of folder name validation. |
|
60 */ |
|
61 enum TValidation |
|
62 { |
|
63 EValidationOk = 0, |
|
64 EValidationInvalid = 1, |
|
65 EValidationNotAllowed = 2 |
|
66 }; |
|
67 |
|
68 public: |
|
69 |
|
70 /** |
|
71 * Factory Method which returns concrete class |
|
72 * representing folder operation. |
|
73 * @param aCommand Descriptor contains required command. |
|
74 * @return If aCommand is supported, operations instance is returned. |
|
75 */ |
|
76 static CMmFolderCommand* FactoryL( const TDesC& aCommand ); |
|
77 |
|
78 /** |
|
79 * Returns TInt value using the given path. |
|
80 * |
|
81 * @since S60 v5.0 |
|
82 * @param aParam Param list. |
|
83 * @param aPath URI Path. |
|
84 * @return TInt value or KErrNotFound. |
|
85 */ |
|
86 TInt GetIntL( const CLiwGenericParamList& aParam, const TDesC8& aPath ); |
|
87 |
|
88 /** |
|
89 * Returns string value using the given path. |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 * @param aParam Param list. |
|
93 * @param aPath URI Path. |
|
94 * @return String value or KNullDesC. |
|
95 */ |
|
96 TPtrC GetStringL( const CLiwGenericParamList& aParam, const TDesC8& aPath ); |
|
97 |
|
98 /** |
|
99 * Returns bool value using the given path. |
|
100 * |
|
101 * @since S60 v5.0 |
|
102 * @param aParam Param list. |
|
103 * @param aPath URI Path. |
|
104 * @return TBool value. |
|
105 */ |
|
106 TBool GetBoolL( const CLiwGenericParamList& aParam, const TDesC8& aPath ); |
|
107 |
|
108 /** |
|
109 * Performs operation on folder. |
|
110 * @param aEventParamList List of parameters for operations. |
|
111 */ |
|
112 virtual void ExecuteActionL( CLiwGenericParamList* aEventParamList ) = 0; |
|
113 |
|
114 /** |
|
115 * Setter for App UI. |
|
116 * @param aActionRequest Interface enabling to issues request to App UI. |
|
117 */ |
|
118 void SetRequestInterface( MMmActionRequest* aActionRequest ); |
|
119 |
|
120 /** |
|
121 * Setter for shared resources. |
|
122 * @param aActionRequest Interface enabling to issues request to App UI. |
|
123 */ |
|
124 void SetSharedResources( CMmPluginSharedResources* aResources ); |
|
125 |
|
126 /** |
|
127 * Setter for dialog. |
|
128 * @param aDialog Dialog instance. |
|
129 * @return Result of the dialog. |
|
130 */ |
|
131 void SetDialogL( CAknQueryDialog* aDialog ); |
|
132 |
|
133 /** |
|
134 * Removes active dialog. |
|
135 */ |
|
136 void RemoveDialogL(); |
|
137 |
|
138 /** |
|
139 * Virtual C++ Destructor. |
|
140 */ |
|
141 virtual ~CMmFolderCommand(); |
|
142 |
|
143 protected: |
|
144 |
|
145 /** |
|
146 * Base Plugin constructor |
|
147 */ |
|
148 void BaseConstructL(); |
|
149 |
|
150 /** |
|
151 * Gets folder name. |
|
152 * @param aFolderName Name of the folder. |
|
153 * @return Modal dialog displaying result. |
|
154 */ |
|
155 TBool DoChangeNameL( RBuf& aFolderName, TInt aDefaultNameLength, |
|
156 RBuf& aNumberInBracket, CLiwGenericParamList& aFoldersNames, |
|
157 TLiwVariant& aVar, TInt aNumberToAppend = 0 ); |
|
158 |
|
159 /** |
|
160 * Gets folder name. |
|
161 * @param aFolderName Name of the folder. |
|
162 * @return Modal dialog displaying result. |
|
163 */ |
|
164 void ChangeNameIfAlreadyExistsL( RBuf& aFolderName, |
|
165 CLiwGenericParamList* aFoldersNames, TInt aNumberToAppend = 0 ); |
|
166 |
|
167 /** |
|
168 * Gets list of the folders names. |
|
169 * @param aFolderName Name of the folder. |
|
170 */ |
|
171 void GetFolderListL( TInt aItemId ); |
|
172 |
|
173 /** |
|
174 * Gets list of the items names. |
|
175 * @param aFolderName Name of the folder. |
|
176 */ |
|
177 void GetListL( TInt aItemId ); |
|
178 |
|
179 /** |
|
180 * Gets folder name. |
|
181 * @param aFolderName Name of the folder. |
|
182 * @return Modal dialog displaying result. |
|
183 */ |
|
184 TBool GetFolderNameL( RBuf& aFolderName, |
|
185 CLiwGenericParamList* aFoldersNames = 0 ); |
|
186 |
|
187 /** |
|
188 * Displays notification contains reason of the deletion cancel. |
|
189 * @param aFolderName Name of the folder. |
|
190 */ |
|
191 void DisplayErrorInfoL( const TDesC& aFolderName ); |
|
192 |
|
193 /** |
|
194 * Executes query on MCS service. |
|
195 * @param aQueryName Query name. |
|
196 * @param aInputData Input data. |
|
197 * @param aFilter Query filter. |
|
198 * @param aCallback Interface handling query execution. |
|
199 */ |
|
200 void MCSQueryExecutionL( const TDesC8& aQueryName, |
|
201 const CHnMdBaseKey* aInputData, |
|
202 const CHnMdBaseKey* aFilter, |
|
203 MLiwNotifyCallback* aCallback ); |
|
204 |
|
205 /** |
|
206 * Add new key to existing key. |
|
207 * @param aInDataKey An existing key. |
|
208 * @param aKeyName Name of the new key. |
|
209 * @param aKeyType Type of the new key. |
|
210 * @param aKeyValue Value of the new key. |
|
211 */ |
|
212 void AddSubKeyL( CHnMdBaseKey* aInDataKey, |
|
213 const TDesC8& aKeyName, |
|
214 const TDesC8& aKeyType, |
|
215 const TDesC8& aKeyValue ); |
|
216 |
|
217 /** |
|
218 * Add new key to existing key. |
|
219 * @param aInDataKey An existing key. |
|
220 * @param aKeyName Name of the new key. |
|
221 * @param aKeyType Type of the new key. |
|
222 * @param aKeyValue Value of the new key. |
|
223 */ |
|
224 void AddSubKeyL( CHnMdBaseKey* aInDataKey, |
|
225 const TDesC8& aKeyName, |
|
226 const TDesC8& aKeyType, |
|
227 const TDesC& aKeyValue ); |
|
228 |
|
229 /** |
|
230 * Checks if folder name is valid and consists of allowed characters |
|
231 * @param aFolderName Folder name to check |
|
232 * @return Validation result. |
|
233 */ |
|
234 TInt FolderNameValidationL(RBuf& aFolderName, |
|
235 CLiwGenericParamList* aFoldersNames = 0); |
|
236 |
|
237 /** |
|
238 * Removes illegal character |
|
239 * @param aFolderName Folder name to check |
|
240 * @return Validation result. |
|
241 */ |
|
242 TInt IllegalCharacterRemoveL(RBuf& aFolderName, |
|
243 CLiwGenericParamList* aFoldersNames = 0); |
|
244 |
|
245 /** |
|
246 * Checks if folder name is valid |
|
247 * @param aFolderName Folder name to check |
|
248 * @return Validation result. |
|
249 */ |
|
250 TInt CheckValidFileNameL( const TDes& aFolderName ); |
|
251 |
|
252 /** |
|
253 * Checks if folder name consists of allowed characters |
|
254 * @param aFolderName Folder name to check |
|
255 * @return Validation result. |
|
256 */ |
|
257 TInt CheckAllowedCharsL( const TDes& aFolderName ); |
|
258 |
|
259 /** |
|
260 * Displays notification contains reason of the add folder/rename folder name cancel. |
|
261 * @param aResourceId The numeric ID of the resource string to be read. |
|
262 */ |
|
263 void DisplayNameErrorInfoL( const TDesC& aMsg ); |
|
264 |
|
265 private: |
|
266 |
|
267 /** |
|
268 * Prepare GetList input data for specified folder |
|
269 * @param aItemId id of folder. |
|
270 */ |
|
271 void PrepareGetListInputL(TInt aItemId); |
|
272 |
|
273 /** |
|
274 * Prepare GetList filter for folders |
|
275 */ |
|
276 void PrepareGetListFolderFilterL(); |
|
277 |
|
278 /** |
|
279 * Prepare GetList filter for folders |
|
280 */ |
|
281 void PrepareGetListFilterL(); |
|
282 |
|
283 /** |
|
284 * Insert Liw map to Liw list |
|
285 * @param aList |
|
286 * @param aKey |
|
287 * @param aMap |
|
288 */ |
|
289 void InsertToLiwListL(CLiwGenericParamList* aList, |
|
290 const TDesC8& aKey, const CLiwDefaultMap* aMap); |
|
291 |
|
292 /** |
|
293 * Externalize GetList input list |
|
294 */ |
|
295 void ExternalizeInputListL(); |
|
296 |
|
297 /** |
|
298 * Internalize GetList output list |
|
299 */ |
|
300 void InternalizeOutputListL(); |
|
301 |
|
302 |
|
303 protected: |
|
304 |
|
305 /** |
|
306 * Own. |
|
307 * Intance of the service handler. |
|
308 */ |
|
309 CHnServiceHandler* iServiceHandler; |
|
310 |
|
311 |
|
312 /** |
|
313 * Not Own. |
|
314 * Pointer to the App UI. |
|
315 */ |
|
316 MMmActionRequest* iActionRequest; |
|
317 |
|
318 /** |
|
319 * Own. |
|
320 * Pointer to active dialog. |
|
321 */ |
|
322 CAknQueryDialog* iDialog; |
|
323 |
|
324 /** |
|
325 * Flag indicating wheather dialog can be displayed. |
|
326 */ |
|
327 TBool iLockDialog; |
|
328 |
|
329 /* |
|
330 * MCS sesion. |
|
331 * Own. |
|
332 * */ |
|
333 RMenuSapi iMcs; |
|
334 |
|
335 /** |
|
336 * GetList input and output parameter lists. |
|
337 * Own. |
|
338 */ |
|
339 CLiwGenericParamList* iGetListInParam; |
|
340 CLiwGenericParamList* iGetListOutParam; |
|
341 |
|
342 /** |
|
343 * GetList serialized input and output parameter lists. |
|
344 * Own. |
|
345 */ |
|
346 RBuf8 iSerializedInputList; |
|
347 RBuf8 iSerializedOutputList; |
|
348 |
|
349 /** |
|
350 * Pointer to shared resources class. |
|
351 * Not owned. |
|
352 */ |
|
353 CMmPluginSharedResources* iSharedResources; |
|
354 |
|
355 }; |
|
356 |
|
357 #endif /*MMFOLDERCOMMAND_H*/ |
|
358 |
|
359 // End of file |