39 #include <glxattributecontext.h> |
39 #include <glxattributecontext.h> |
40 #include <glxattributeretriever.h> |
40 #include <glxattributeretriever.h> |
41 #include <glxuistd.h> |
41 #include <glxuistd.h> |
42 #include <glxuiutilities.rsg> |
42 #include <glxuiutilities.rsg> |
43 #include <glxcommandhandlers.hrh> |
43 #include <glxcommandhandlers.hrh> |
|
44 #include <glxtracer.h> |
44 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
45 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
45 |
46 |
46 /// @todo Move elsewhere |
47 /// @todo Move elsewhere |
47 const TInt KGlxMaxNoteLength = 256; |
48 const TInt KGlxMaxNoteLength = 256; |
48 |
49 |
52 // |
53 // |
53 EXPORT_C CGlxMpxCommandCommandHandler:: |
54 EXPORT_C CGlxMpxCommandCommandHandler:: |
54 CGlxMpxCommandCommandHandler(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) |
55 CGlxMpxCommandCommandHandler(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) |
55 : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem) |
56 : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem) |
56 { |
57 { |
|
58 TRACER("CGlxMpxCommandCommandHandler::CGlxMpxCommandCommandHandler"); |
57 iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); |
59 iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); |
58 } |
60 } |
59 |
61 |
60 // ----------------------------------------------------------------------------- |
62 // ----------------------------------------------------------------------------- |
61 // Destructor |
63 // Destructor |
62 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
63 // |
65 // |
64 EXPORT_C CGlxMpxCommandCommandHandler::~CGlxMpxCommandCommandHandler() |
66 EXPORT_C CGlxMpxCommandCommandHandler::~CGlxMpxCommandCommandHandler() |
65 { |
67 { |
|
68 TRACER("CGlxMpxCommandCommandHandler::~CGlxMpxCommandCommandHandler"); |
66 // cancel command if running |
69 // cancel command if running |
67 if (iProgressComplete) |
70 if (iProgressComplete) |
68 { |
71 { |
69 // MediaList().Cancel(); |
72 // MediaList().Cancel(); |
70 } |
73 } |
82 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
83 // |
86 // |
84 EXPORT_C TBool CGlxMpxCommandCommandHandler::DoExecuteL(TInt aCommandId, |
87 EXPORT_C TBool CGlxMpxCommandCommandHandler::DoExecuteL(TInt aCommandId, |
85 MGlxMediaList& aList) |
88 MGlxMediaList& aList) |
86 { |
89 { |
|
90 TRACER("CGlxMpxCommandCommandHandler::DoExecuteL"); |
87 // reset progress complete flag |
91 // reset progress complete flag |
88 iProgressComplete = EFalse; |
92 iProgressComplete = EFalse; |
89 |
93 |
90 // deriving class consumes command by default |
94 // deriving class consumes command by default |
91 TBool consume = ETrue; |
95 TBool consume = ETrue; |
244 // ----------------------------------------------------------------------------- |
250 // ----------------------------------------------------------------------------- |
245 // |
251 // |
246 EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL(TAny* /*aSessionId*/, |
252 EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL(TAny* /*aSessionId*/, |
247 CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) |
253 CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) |
248 { |
254 { |
|
255 TRACER("CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL"); |
249 } |
256 } |
250 |
257 |
251 |
258 |
252 // ----------------------------------------------------------------------------- |
259 // ----------------------------------------------------------------------------- |
253 // Default implementation of advanced message handling does nothing |
260 // Default implementation of advanced message handling does nothing |
254 // ----------------------------------------------------------------------------- |
261 // ----------------------------------------------------------------------------- |
255 // |
262 // |
256 EXPORT_C TInt CGlxMpxCommandCommandHandler::DoHandleMessageL(const CMPXMessage& /*aMessage*/, |
263 EXPORT_C TInt CGlxMpxCommandCommandHandler::DoHandleMessageL(const CMPXMessage& /*aMessage*/, |
257 MGlxMediaList& /*aList*/) |
264 MGlxMediaList& /*aList*/) |
258 { |
265 { |
|
266 TRACER("CGlxMpxCommandCommandHandler::DoHandleMessageL"); |
259 return KErrNone; |
267 return KErrNone; |
260 } |
268 } |
261 |
269 |
262 // ----------------------------------------------------------------------------- |
270 // ----------------------------------------------------------------------------- |
263 // Default implementation DoHandleItemAddedL does not do anything |
271 // Default implementation DoHandleItemAddedL does not do anything |
264 // ----------------------------------------------------------------------------- |
272 // ----------------------------------------------------------------------------- |
265 // |
273 // |
266 EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleItemAddedL(TInt /*aStartIndex*/, |
274 EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleItemAddedL(TInt /*aStartIndex*/, |
267 TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) |
275 TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) |
268 { |
276 { |
|
277 TRACER("CGlxMpxCommandCommandHandler::DoHandleItemAddedL"); |
269 } |
278 } |
270 |
279 |
271 // ----------------------------------------------------------------------------- |
280 // ----------------------------------------------------------------------------- |
272 // Default implementation is always ready to exit |
281 // Default implementation is always ready to exit |
273 // ----------------------------------------------------------------------------- |
282 // ----------------------------------------------------------------------------- |
274 // |
283 // |
275 EXPORT_C TBool CGlxMpxCommandCommandHandler::OkToExit() const |
284 EXPORT_C TBool CGlxMpxCommandCommandHandler::OkToExit() const |
276 { |
285 { |
|
286 TRACER("CGlxMpxCommandCommandHandler:::OkToExit()"); |
277 return ETrue; |
287 return ETrue; |
278 } |
288 } |
279 |
289 |
280 // ----------------------------------------------------------------------------- |
290 // ----------------------------------------------------------------------------- |
281 // Show confirmation note |
291 // Show confirmation note |
282 // ----------------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------------- |
283 // |
293 // |
284 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteL(TInt aCommandId, |
294 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteL(TInt aCommandId, |
285 MGlxMediaList& aMediaList) const |
295 MGlxMediaList& aMediaList) const |
286 { |
296 { |
|
297 TRACER("CGlxMpxCommandCommandHandler::ConfirmationNoteL"); |
287 TInt selectionCount = aMediaList.SelectionCount(); |
298 TInt selectionCount = aMediaList.SelectionCount(); |
288 |
299 |
289 // If media list is not empty, treat focused item as selected |
300 // If media list is not empty, treat focused item as selected |
290 // At this point can assume that the command was disabled |
301 // At this point can assume that the command was disabled |
291 // if static items were not supported |
302 // if static items were not supported |
313 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
314 // |
325 // |
315 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteSingleL(TInt aCommandId, |
326 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteSingleL(TInt aCommandId, |
316 MGlxMediaList& aMediaList) const |
327 MGlxMediaList& aMediaList) const |
317 { |
328 { |
|
329 TRACER("CGlxMpxCommandCommandHandler::ConfirmationNoteSingleL"); |
318 // if no confirmation note shown, assume command is confirmed |
330 // if no confirmation note shown, assume command is confirmed |
319 TBool confirmed = ETrue; |
331 TBool confirmed = ETrue; |
320 |
332 |
321 // get confirmation note text for single selection |
333 // get confirmation note text for single selection |
322 HBufC* noteText = ConfirmationTextL(aCommandId, EFalse); // EFalse for single selection |
334 HBufC* noteText = ConfirmationTextL(aCommandId, EFalse); // EFalse for single selection |
375 // ----------------------------------------------------------------------------- |
387 // ----------------------------------------------------------------------------- |
376 // |
388 // |
377 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteMultipleL(TInt aCommandId, |
389 EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteMultipleL(TInt aCommandId, |
378 MGlxMediaList& aMediaList) const |
390 MGlxMediaList& aMediaList) const |
379 { |
391 { |
|
392 TRACER("CGlxMpxCommandCommandHandler::ConfirmationNoteMultipleL"); |
380 // if no confirmation note shown, assume command is confirmed |
393 // if no confirmation note shown, assume command is confirmed |
381 TBool confirmed = ETrue; |
394 TBool confirmed = ETrue; |
382 |
395 |
383 // get confirmation note text for multiselection |
396 // get confirmation note text for multiselection |
384 HBufC* noteText = ConfirmationTextL(aCommandId, ETrue); // ETrue for Multiselection |
397 HBufC* noteText = ConfirmationTextL(aCommandId, ETrue); // ETrue for Multiselection |
491 // Remove MediaList Observer |
507 // Remove MediaList Observer |
492 // ----------------------------------------------------------------------------- |
508 // ----------------------------------------------------------------------------- |
493 // |
509 // |
494 void CGlxMpxCommandCommandHandler::RemoveMediaListObserver() |
510 void CGlxMpxCommandCommandHandler::RemoveMediaListObserver() |
495 { |
511 { |
|
512 TRACER("CGlxMpxCommandCommandHandler::RemoveMediaListObserver"); |
496 MGlxMediaList& mediaList = MediaList(); |
513 MGlxMediaList& mediaList = MediaList(); |
497 mediaList.RemoveMediaListObserver(this); |
514 mediaList.RemoveMediaListObserver(this); |
498 } |
515 } |
499 |
516 |
500 // ----------------------------------------------------------------------------- |
517 // ----------------------------------------------------------------------------- |
501 // Show a completion note |
518 // Show a completion note |
502 // ----------------------------------------------------------------------------- |
519 // ----------------------------------------------------------------------------- |
503 // |
520 // |
504 void CGlxMpxCommandCommandHandler::CompletionNoteL() const |
521 void CGlxMpxCommandCommandHandler::CompletionNoteL() const |
505 { |
522 { |
|
523 TRACER("CGlxMpxCommandCommandHandler::CompletionNoteL"); |
506 // Get completion note text |
524 // Get completion note text |
507 HBufC* noteText = CompletionTextL(); |
525 HBufC* noteText = CompletionTextL(); |
508 if ( noteText ) |
526 if ( noteText ) |
509 { |
527 { |
510 CleanupStack::PushL(noteText); |
528 CleanupStack::PushL(noteText); |
585 // ----------------------------------------------------------------------------- |
603 // ----------------------------------------------------------------------------- |
586 // |
604 // |
587 EXPORT_C void CGlxMpxCommandCommandHandler::HandleMessageL(const CMPXMessage& aMessage, |
605 EXPORT_C void CGlxMpxCommandCommandHandler::HandleMessageL(const CMPXMessage& aMessage, |
588 MGlxMediaList* aList) |
606 MGlxMediaList* aList) |
589 { |
607 { |
|
608 TRACER("CGlxMpxCommandCommandHandler::HandleMessageL"); |
590 if ((aMessage.IsSupported(KMPXMessageGeneralId) && |
609 if ((aMessage.IsSupported(KMPXMessageGeneralId) && |
591 (aMessage.IsSupported(KMPXCommandGeneralSessionId)))) |
610 (aMessage.IsSupported(KMPXCommandGeneralSessionId)))) |
592 { |
611 { |
593 TInt msgId = aMessage.ValueTObjectL<TInt>(KMPXMessageGeneralId); |
612 TInt msgId = aMessage.ValueTObjectL<TInt>(KMPXMessageGeneralId); |
594 TAny* sessionId = aMessage.ValueTObjectL<TAny*>(KMPXCommandGeneralSessionId); |
613 TAny* sessionId = aMessage.ValueTObjectL<TAny*>(KMPXCommandGeneralSessionId); |
617 // ----------------------------------------------------------------------------- |
636 // ----------------------------------------------------------------------------- |
618 // |
637 // |
619 EXPORT_C void CGlxMpxCommandCommandHandler::HandleCommandCompleteL(TAny* aSessionId, |
638 EXPORT_C void CGlxMpxCommandCommandHandler::HandleCommandCompleteL(TAny* aSessionId, |
620 CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList) |
639 CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList) |
621 { |
640 { |
|
641 TRACER("CGlxMpxCommandCommandHandler::HandleCommandCompleteL"); |
622 // Unmark all medialist items. Exit Multiple marking mode upon command completion |
642 // Unmark all medialist items. Exit Multiple marking mode upon command completion |
623 iAppUi->ProcessCommandL(EGlxCmdEndMultipleMarking); |
643 iAppUi->ProcessCommandL(EGlxCmdEndMultipleMarking); |
624 |
644 |
625 ///@todo Enforce a single command request at a time on the media list. |
645 ///@todo Enforce a single command request at a time on the media list. |
626 DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList); |
646 DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList); |