author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:32:09 +0300 | |
branch | RCL_3 |
changeset 75 | 01504893d9cb |
parent 60 | 5b3385a43d68 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2008-2009 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: MPX Command generating Command Handler |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
#ifndef __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ |
|
22 |
#define __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ |
|
23 |
||
24 |
#include <AknProgressDialog.h> |
|
25 |
#include <e32base.h> |
|
26 |
#include <mpxcommand.h> |
|
27 |
#include <mpxmessage.h> |
|
28 |
#include "glxmedialistcommandhandler.h" |
|
29 |
||
30 |
class MGlxMediaList; |
|
31 |
class MGlxMediaListProvider; |
|
32 |
class CAknAppUi; |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
33 |
|
60 | 34 |
/** |
35 |
* @class CGlxMpxCommandCommandHandler |
|
36 |
* |
|
37 |
* Command handler that creates and issues an MPXCommand |
|
38 |
* |
|
39 |
* @ingroup glx_group_command_handlers |
|
40 |
* |
|
41 |
* @lib glxviewbase.lib |
|
42 |
*/ |
|
43 |
class CGlxMpxCommandCommandHandler : public CGlxMediaListCommandHandler, |
|
44 |
public MGlxMediaListObserver, public MProgressDialogCallback |
|
45 |
{ |
|
46 |
public: |
|
47 |
/** |
|
48 |
* Constructor |
|
49 |
* @param aMediaListProvider The owner of the media list to use |
|
50 |
*/ |
|
51 |
IMPORT_C CGlxMpxCommandCommandHandler(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem = EFalse ); |
|
52 |
||
53 |
/** |
|
54 |
* Destructor |
|
55 |
*/ |
|
56 |
IMPORT_C virtual ~CGlxMpxCommandCommandHandler(); |
|
57 |
||
58 |
protected: // API for deriving classes |
|
59 |
/** |
|
60 |
* Attempts to "exit" the command handler |
|
61 |
* (Exit means closing the progress note and allowing user to do something.) |
|
62 |
* The command handler will exit if |
|
63 |
* - progress is complete <b>and</b> deriving class returns ETrue from OkToExit |
|
64 |
* - aErrorCode is not KErrNone |
|
65 |
* |
|
66 |
* Usually deriving classes never need to call this. This is called |
|
67 |
* automatically after receiving a collection message. Only call if the |
|
68 |
* completion can happen (= the result of OkToExit() call changes) based |
|
69 |
* on another event than collection message. |
|
70 |
* |
|
71 |
* @param aErrorCode Error code. Shows an error note if other than KErrNone |
|
72 |
*/ |
|
73 |
IMPORT_C void TryExitL(TInt aErrorCode); |
|
74 |
||
75 |
/** |
|
76 |
* See @ref CGlxCommandHandler::DoActivateL |
|
77 |
* Default implementation does nothing |
|
78 |
*/ |
|
79 |
IMPORT_C virtual void DoActivateL( TInt aViewId ); |
|
80 |
||
81 |
/** |
|
82 |
* Called when the owning view is deactivated |
|
83 |
*/ |
|
84 |
IMPORT_C virtual void Deactivate(); |
|
85 |
||
86 |
/** |
|
87 |
* Handles error |
|
88 |
* Default implementation shows an error note |
|
89 |
*/ |
|
90 |
IMPORT_C virtual void HandleErrorL(TInt aErrorCode); |
|
91 |
||
92 |
/** |
|
93 |
* Creates a command object, and decides whether to consume the command. |
|
94 |
* @param aList Media list to which the command will be issued. |
|
95 |
* @param aConsume Set this to false, if the command |
|
96 |
* id should not be consumed. Default value is true. |
|
97 |
* @return command object If NULL returned, no MPX command will be issued, |
|
98 |
* but the command id may still be consumed, depending |
|
99 |
* on the value of aDoNotConsume |
|
100 |
* Caller gets ownership of the command object. |
|
101 |
*/ |
|
102 |
virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, |
|
103 |
TBool& aConsume) const = 0; |
|
104 |
||
105 |
/** |
|
106 |
* Handles a message other than progress message. |
|
107 |
* Deriving classes can override this to receive and handle messages |
|
108 |
* from media list (i.e., from MPX server) |
|
109 |
* The default implementation does not do anything. |
|
110 |
* @return Error code. If other than KErrNone, the command handler |
|
111 |
* closes the progress note and shows an error note. |
|
112 |
*/ |
|
113 |
IMPORT_C virtual TInt DoHandleMessageL(const CMPXMessage& aMessage, |
|
114 |
MGlxMediaList& aList); |
|
115 |
||
116 |
/** |
|
117 |
* Called by HandleCommandCompleteL() to allow derived classes |
|
118 |
* to perform processing specific to individual command handlers. |
|
119 |
* The defalut implementation does not do anything. |
|
120 |
* |
|
121 |
*/ |
|
122 |
IMPORT_C virtual void DoHandleCommandCompleteL(TAny* aSessionId, |
|
123 |
CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); |
|
124 |
||
125 |
/** |
|
126 |
* Called by HandleCommandCompleteL() to allow derived classes |
|
127 |
* to perform processing specific to individual command handlers. |
|
128 |
* The defalut implementation does not do anything. |
|
129 |
* |
|
130 |
*/ |
|
131 |
IMPORT_C virtual void DoHandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
132 |
||
133 |
/** |
|
134 |
* Called to check if the deriving class is ready and progress note |
|
135 |
* can be closed. The deriving class may be expecting a message (etc) after |
|
136 |
* the last progress notification is received, and by overriding |
|
137 |
* this class, they can wait for that info. |
|
138 |
* Default implementation returns ETrue. |
|
139 |
* @return ETrue if command handler is ready exit |
|
140 |
*/ |
|
141 |
IMPORT_C virtual TBool OkToExit() const; |
|
142 |
||
143 |
/** |
|
144 |
* Creates and returns confirmation note text |
|
145 |
* Deriving class can override this to get a confirmation note shown |
|
146 |
* before execution |
|
147 |
* @param aCommandId Id of the command that is about to be executed |
|
148 |
* @param aMultiSelection ETrue when more than one item is selected |
|
149 |
* @return New descriptor with confirmation note |
|
150 |
* If single selection, the descriptor must contain %U, which |
|
151 |
* will be populated with the title of the selected/focused item |
|
152 |
* If multiselection, the descriptor must contain %N, which |
|
153 |
* will be populated with the number of selected items |
|
154 |
* Or return NULL, in which case no note will be shown and the command |
|
155 |
* is simply executed. |
|
156 |
* Caller gets ownership of the descriptor. |
|
157 |
* Default implementation returns NULL. |
|
158 |
*/ |
|
159 |
IMPORT_C virtual HBufC* ConfirmationTextL(TInt aCommandId, TBool aMultiSelection) const; |
|
160 |
||
161 |
/** |
|
162 |
* Creates and returns progress note text |
|
163 |
* Deriving class can override this to customise the progress note |
|
164 |
* @return New descriptor with progress text |
|
165 |
* Or return NULL, in which case default progress text will be |
|
166 |
* used |
|
167 |
* Default implementation returns default progress note |
|
168 |
* Caller gets ownership of the descriptor. |
|
169 |
*/ |
|
170 |
IMPORT_C virtual HBufC* ProgressTextL(TInt aCommandId) const; |
|
171 |
||
172 |
/** |
|
173 |
* Creates and returns completion note text |
|
174 |
* Deriving class can override this to show a completion note |
|
175 |
* @return New descriptor with completion text |
|
176 |
* Or return NULL, in which case the note will not be shown |
|
177 |
* Default implementation returns NULL |
|
178 |
* Caller gets ownership of the descriptor. |
|
179 |
*/ |
|
180 |
IMPORT_C virtual HBufC* CompletionTextL() const; |
|
181 |
||
182 |
private: |
|
183 |
/** See @ref CGlxMediaListCommandHandler::DoExecuteL */ |
|
184 |
IMPORT_C virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); |
|
185 |
||
186 |
/** |
|
187 |
* Launch a confirmation note (single or multiple depending on media list selection) |
|
188 |
* Declared as virtual to allow deriving class to show non-media list dependent |
|
189 |
* confirmation note, etc. |
|
190 |
* @return ETrue if the user confirms, EFalse if user cancels |
|
191 |
*/ |
|
192 |
IMPORT_C virtual TBool ConfirmationNoteL(TInt aCommandId, MGlxMediaList& aMediaList) const; |
|
193 |
||
194 |
/** |
|
195 |
* Launch a confirmation note (single) |
|
196 |
* @return ETrue if the user confirms |
|
197 |
*/ |
|
198 |
TBool ConfirmationNoteSingleL(TInt aCommandId, MGlxMediaList& aMediaList) const; |
|
199 |
||
200 |
/** |
|
201 |
* Launch a confirmation note (multiple) |
|
202 |
* @return ETrue if the user confirms |
|
203 |
*/ |
|
204 |
TBool ConfirmationNoteMultipleL(TInt aCommandId, MGlxMediaList& aMediaList) const; |
|
205 |
||
206 |
/** |
|
207 |
* Launch a progress note |
|
208 |
*/ |
|
209 |
void ProgressNoteL(TInt aCommandId); |
|
210 |
||
211 |
/** |
|
212 |
* Update progress based on message |
|
213 |
* @param aMessage message with progress info |
|
214 |
* @param aError extracts an error code from message and returns in this argument |
|
215 |
* @param ETrue if progress complete. EFalse if note |
|
216 |
*/ |
|
217 |
TBool UpdateProgressL(const CMPXMessage& aMessage, TInt& aError); |
|
218 |
||
219 |
/** |
|
220 |
* Dismiss the active progress note |
|
221 |
*/ |
|
222 |
void DismissProgressNoteL(); |
|
223 |
||
224 |
/** |
|
225 |
* Show a completion note |
|
226 |
*/ |
|
227 |
void CompletionNoteL() const; |
|
228 |
||
229 |
/** |
|
230 |
* Remove medialist observer |
|
231 |
*/ |
|
232 |
void RemoveMediaListObserver(); |
|
233 |
||
234 |
protected: // From MGlxMediaListObserver |
|
235 |
/// See @ref MGlxMediaListObserver::HandleItemAddedL |
|
236 |
IMPORT_C void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
237 |
||
238 |
/// See @ref MGlxMediaListObserver::HandleMediaL |
|
239 |
IMPORT_C void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
240 |
||
241 |
/// See @ref MGlxMediaListObserver::HandleItemRemovedL |
|
242 |
IMPORT_C void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
243 |
||
244 |
/// See @ref MGlxMediaListObserver::HandleItemModifiedL |
|
245 |
IMPORT_C void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList); |
|
246 |
||
247 |
/// See @ref MGlxMediaListObserver::HandleAttributesAvailableL |
|
248 |
IMPORT_C void HandleAttributesAvailableL(TInt aItemIndex, |
|
249 |
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
250 |
||
251 |
/// See @ref MGlxMediaListObserver::HandleFocusChangedL |
|
252 |
IMPORT_C void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); |
|
253 |
||
254 |
/// See @ref MGlxMediaListObserver::HandleItemSelectedL |
|
255 |
IMPORT_C void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
256 |
||
257 |
/// See @ref MGlxMediaListObserver::HandleMessageL |
|
258 |
IMPORT_C void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
259 |
||
260 |
/// See @ref MGlxMediaListObserver::HandleCommandCompleteL |
|
261 |
IMPORT_C void HandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); |
|
262 |
||
263 |
public: // from MProgressDialogCallback |
|
264 |
IMPORT_C void DialogDismissedL(TInt aButtonId); |
|
265 |
||
266 |
private: |
|
267 |
/// Progress dialog |
|
268 |
CAknProgressDialog* iProgressDialog; |
|
269 |
||
270 |
// Progress info for the progress dialog |
|
271 |
CEikProgressInfo* iProgressInfo; |
|
272 |
||
273 |
// CEikProgressInfo does not store whether progress is complete, so store here |
|
274 |
TBool iProgressComplete; |
|
275 |
||
276 |
// Resource offset |
|
277 |
mutable TInt iResourceOffset; |
|
278 |
||
279 |
/// Whether the GIF animation is currently halted |
|
280 |
TBool iAnimationStopped; |
|
281 |
||
282 |
/// The AppUI. Not owned |
|
283 |
CAknAppUi* iAppUi; |
|
284 |
}; |
|
285 |
||
286 |
#endif // __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ |