|
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: Add folder command |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MMMOVETOFOLDERCOMMAND_H |
|
21 #define MMMOVETOFOLDERCOMMAND_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "mmfoldercommand.h" |
|
25 |
|
26 class CMmFolder; |
|
27 |
|
28 /** |
|
29 * CMmMoveToFolderCommand is a class inherits from CMmFolderCommand. |
|
30 * It's responsible for handling command adding folder to MCS. Plugin supports |
|
31 * MMCreateNewFolderCommand command. It displays query, get name and executes |
|
32 * MCS query creating new folder. After successfully folder creation it send |
|
33 * request to HN engine to set focus on added folder. |
|
34 * |
|
35 * @lib mmfolderuiextensionplugin.lib |
|
36 * @since S60 5.0 |
|
37 * @ingroup group_mmfolderuiextensionplugin |
|
38 */ |
|
39 NONSHARABLE_CLASS( CMmMoveToFolderCommand ) : public CMmFolderCommand |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Instantiates an object of this type. |
|
44 * @return Instance of the CMmMoveToFolderCommand class. |
|
45 */ |
|
46 static CMmMoveToFolderCommand* NewL(); |
|
47 |
|
48 /** |
|
49 * Virtual C++ Destructor. |
|
50 */ |
|
51 ~CMmMoveToFolderCommand(); |
|
52 |
|
53 private: |
|
54 |
|
55 /** |
|
56 * Performs add folder operation. |
|
57 * @param aEventParamList List of the event parameters. |
|
58 */ |
|
59 void ExecuteActionL( CLiwGenericParamList* aEventParamList ); |
|
60 |
|
61 /** |
|
62 * Handles notifications caused by an asynchronous Execute*CmdL call |
|
63 * or an event. |
|
64 * @param aCmdId The service command associated to the event. |
|
65 * @param aEventId Occured event, see LiwCommon.hrh. |
|
66 * @param aEventParamList Event parameters, if any, as defined per |
|
67 * each event. |
|
68 * @param aInParamList Input parameters, if any, given in the |
|
69 * related HandleCommmandL. |
|
70 * @return Error code for the callback. |
|
71 */ |
|
72 TInt HandleNotifyL( TInt aCmdId, TInt aEventId, |
|
73 CLiwGenericParamList& aEventParamList, |
|
74 const CLiwGenericParamList& aInParamList ); |
|
75 |
|
76 /** |
|
77 * Default C++ constructor. |
|
78 */ |
|
79 CMmMoveToFolderCommand(); |
|
80 |
|
81 /** |
|
82 * Second phase Symbian constructor. |
|
83 */ |
|
84 void ConstructL(); |
|
85 |
|
86 /** |
|
87 * Second phase Symbian constructor. |
|
88 */ |
|
89 CMmFolder* CurrentFolder(); |
|
90 |
|
91 /** |
|
92 * Selects folder. |
|
93 */ |
|
94 void SelectFolderL( const RPointerArray< CMmFolder >& aFolderContent ); |
|
95 |
|
96 /** |
|
97 * Moves item with given id to another folder. |
|
98 * @param aId Id of an item to be moved. |
|
99 * @param aFolderId Id of the target folder. |
|
100 * If KErrNotFound than item moved in |
|
101 * hierarchy is the current folder. |
|
102 * @param aBeforeItemId Id of the item after which an item should be |
|
103 * placed. If KErrNotFound than items are placed at the end of the |
|
104 * folder. |
|
105 */ |
|
106 void MoveToFolderL( TInt aId, TInt aFolderId, |
|
107 TInt aBeforeItemId = KErrNotFound ); |
|
108 |
|
109 |
|
110 /** |
|
111 * Gets index of the selected item. |
|
112 * @param aItems Folder list. |
|
113 * @param aCurrentFolderId Id of the current folder. |
|
114 * @return Index of the selected item. |
|
115 */ |
|
116 TInt SelectFolderFromListL( CDesCArrayFlat* aItems, TBool aIsRoot ); |
|
117 |
|
118 /** |
|
119 * Provides array contains folder icons. |
|
120 * @return Array of icons. |
|
121 */ |
|
122 CArrayPtr<CGulIcon>* GetFolderIconsL(); |
|
123 |
|
124 /** |
|
125 * Browses folder from list. |
|
126 * @param aParentId Parent folder id. |
|
127 * @param aMovingItemId Id of the moving item. |
|
128 * @param aDestinationFolderId Id of the selected folder. |
|
129 * @param aWidgetType Type of the current widget. |
|
130 */ |
|
131 void BrowseFolderL( TInt aParentId, TInt aMovingItemId, |
|
132 TInt& aDestinationFolderId, const TDesC& aWidgetType ); |
|
133 |
|
134 /** |
|
135 * Displays notification. |
|
136 */ |
|
137 void NotificationMovingCompleteL(); |
|
138 |
|
139 /** |
|
140 * Displays notification. |
|
141 */ |
|
142 void NotificationItemAlreadyStoredL(); |
|
143 |
|
144 /** |
|
145 * Gets default name of root folder. |
|
146 * @param aIdentifier Identifier of resource. |
|
147 * @return Descriptor from resource. |
|
148 */ |
|
149 HBufC* GetFromResourceLC( TInt aIdentifier ); |
|
150 |
|
151 /** |
|
152 * Removes last folder from opened hierarchy |
|
153 */ |
|
154 void StepBackInHierarchy(); |
|
155 |
|
156 |
|
157 /** |
|
158 * Handles MoveToFolder operation |
|
159 */ |
|
160 void ExecuteMoveToFolderL(); |
|
161 |
|
162 /** |
|
163 * Fill aFolderArray with folders from GetList output |
|
164 */ |
|
165 void GetFoldersL(RPointerArray<CMmFolder >& aFolderArray); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * Id of the parent folder. |
|
171 */ |
|
172 TInt32 iParentId; |
|
173 |
|
174 TInt iItemId; |
|
175 |
|
176 TBool iFlagLeave; |
|
177 |
|
178 RBuf iWidgetType; |
|
179 |
|
180 RBuf iItemName; |
|
181 |
|
182 RBuf iFolderName; |
|
183 |
|
184 RPointerArray< CMmFolder > iOpenedHierarchy; |
|
185 |
|
186 }; |
|
187 |
|
188 |
|
189 |
|
190 NONSHARABLE_CLASS( CMmFolder ) : public CBase |
|
191 { |
|
192 public: |
|
193 /** |
|
194 * Instantiates an object of this type. |
|
195 * @return Instance of the CMmMoveToFolderCommand class. |
|
196 */ |
|
197 static CMmFolder* NewL(); |
|
198 |
|
199 /** |
|
200 * Virtual C++ Destructor. |
|
201 */ |
|
202 ~CMmFolder(); |
|
203 |
|
204 /** |
|
205 * Setter for the folder name. |
|
206 * @param aName Name of the folder. |
|
207 */ |
|
208 void SetNameL( const TDesC& aName ); |
|
209 |
|
210 /** |
|
211 * Getter for the folder name. |
|
212 * @return Name of the item. |
|
213 */ |
|
214 const TDesC& Name() const; |
|
215 |
|
216 /** |
|
217 * Setter for the folder id. |
|
218 * @param aId Id of the folder. |
|
219 */ |
|
220 void SetId( TInt aId ); |
|
221 |
|
222 /** |
|
223 * Getter for the folder id. |
|
224 * @return Id of the folder. |
|
225 */ |
|
226 TInt Id(); |
|
227 |
|
228 private: |
|
229 /** |
|
230 * Default C++ constructor. |
|
231 */ |
|
232 CMmFolder(); |
|
233 |
|
234 /** |
|
235 * Second phase Symbian constructor. |
|
236 */ |
|
237 void ConstructL(); |
|
238 |
|
239 private: |
|
240 /** |
|
241 * Own. |
|
242 * Name of the folder. |
|
243 */ |
|
244 RBuf iName; |
|
245 |
|
246 /** |
|
247 * Id of the folder. |
|
248 */ |
|
249 TInt iId; |
|
250 |
|
251 }; |
|
252 |
|
253 #endif /*MMMOVETOFOLDERCOMMAND_H*/ |
|
254 |
|
255 // End of file |