|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 #ifndef GLXMPXCOMMANDHANDLER_H |
|
18 #define GLXMPXCOMMANDHANDLER_H |
|
19 |
|
20 #include <QObject> |
|
21 #include<glxcommandhandler.h> |
|
22 #include <glxfiltergeneraldefs.h> |
|
23 #include <mpxcommand.h> |
|
24 #include <mglxmedialistobserver.h> |
|
25 |
|
26 #ifdef BUILD_COMMANDHANDLERBASE |
|
27 #define GLX_COMMANDHANDLERBASE_EXPORT Q_DECL_EXPORT |
|
28 #else |
|
29 #define GLX_COMMANDHANDLERBASE_EXPORT Q_DECL_IMPORT |
|
30 #endif |
|
31 class MGlxMediaList; |
|
32 class HbProgressDialog; |
|
33 class HbAction; |
|
34 |
|
35 class GLX_COMMANDHANDLERBASE_EXPORT GlxMpxCommandHandler : public GlxCommandHandler, public MGlxMediaListObserver |
|
36 { |
|
37 Q_OBJECT |
|
38 public: |
|
39 GlxMpxCommandHandler(); |
|
40 virtual ~GlxMpxCommandHandler(); |
|
41 virtual void executeCommand(int commandId,int collectionId,QList<QModelIndex> indexList = QList<QModelIndex>() ); |
|
42 |
|
43 public slots: |
|
44 void messageDialogClose(HbAction* action); |
|
45 |
|
46 protected: // From MGlxMediaListObserver |
|
47 /// See @ref MGlxMediaListObserver::HandleItemAddedL |
|
48 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
49 |
|
50 /// See @ref MGlxMediaListObserver::HandleMediaL |
|
51 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
52 |
|
53 /// See @ref MGlxMediaListObserver::HandleItemRemovedL |
|
54 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
55 |
|
56 /// See @ref MGlxMediaListObserver::HandleItemModifiedL |
|
57 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList); |
|
58 |
|
59 /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL |
|
60 void HandleAttributesAvailableL(TInt aItemIndex, |
|
61 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
62 |
|
63 /// See @ref MGlxMediaListObserver::HandleFocusChangedL |
|
64 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); |
|
65 |
|
66 /// See @ref MGlxMediaListObserver::HandleItemSelectedL |
|
67 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
68 |
|
69 /// See @ref MGlxMediaListObserver::HandleMessageL |
|
70 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
71 |
|
72 /// See @ref MGlxMediaListObserver::HandleCommandCompleteL |
|
73 void HandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); |
|
74 |
|
75 /// See @ref MGlxMediaListObserver::HandleError |
|
76 void HandleError(TInt aError); |
|
77 protected: // From derived class |
|
78 |
|
79 virtual void DoHandleCommandCompleteL(TAny* aSessionId, |
|
80 CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); |
|
81 |
|
82 virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aMediaList, TBool& aConsume) const = 0; |
|
83 virtual void DoExecuteCommandL(TInt aCommandId, MGlxMediaList& aMediaList, TBool& aConsume); |
|
84 virtual void HandleErrorL(TInt aErrorCode); |
|
85 virtual QString CompletionTextL() const; |
|
86 virtual QString ProgressTextL() const; |
|
87 virtual QString ConfirmationTextL(bool multiSelection = false) const; |
|
88 private: |
|
89 void ConfirmationNoteL(MGlxMediaList& aMediaList); |
|
90 void ConfirmationNoteSingleL(MGlxMediaList& aMediaList) ; |
|
91 void ConfirmationNoteMultipleL(MGlxMediaList& aMediaList) ; |
|
92 void ProgressNoteL(TInt aCommandId); |
|
93 void DismissProgressNoteL(); |
|
94 void CompletionNoteL() const; |
|
95 void TryExitL(TInt aErrorCode); |
|
96 void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) ; |
|
97 void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType); |
|
98 void executeMpxCommand(bool execute); |
|
99 private: |
|
100 // Instance of Media List |
|
101 MGlxMediaList* iMediaList; |
|
102 TBool iProgressComplete; |
|
103 HbProgressDialog* mProgressDialog; |
|
104 int mCommandId; |
|
105 }; |
|
106 #endif //GLXMPXCOMMANDHANDLER_H |