ui/commandhandlers/commandhandlerbase/inc/glxmpxcommandhandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:58:46 +0300
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 29 2c833fc9e98f
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/
#ifndef GLXMPXCOMMANDHANDLER_H
#define GLXMPXCOMMANDHANDLER_H

#include <QObject>
#include<glxcommandhandler.h>
#include <glxfiltergeneraldefs.h>
#include <mpxcommand.h>
#include <mglxmedialistobserver.h>

#ifdef BUILD_COMMANDHANDLERBASE
#define GLX_COMMANDHANDLERBASE_EXPORT Q_DECL_EXPORT
#else
#define GLX_COMMANDHANDLERBASE_EXPORT Q_DECL_IMPORT
#endif
class MGlxMediaList;
class HbProgressDialog;

class GLX_COMMANDHANDLERBASE_EXPORT GlxMpxCommandHandler : public GlxCommandHandler, public MGlxMediaListObserver
{
public:
    GlxMpxCommandHandler();
    virtual ~GlxMpxCommandHandler();
    virtual void executeCommand(int commandId,int collectionId,QList<QModelIndex> indexList = QList<QModelIndex>() );

protected: // From MGlxMediaListObserver    
    /// See @ref MGlxMediaListObserver::HandleItemAddedL
    void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleMediaL
    void HandleMediaL(TInt aListIndex, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleItemRemovedL
    void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleItemModifiedL
    void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL
    void HandleAttributesAvailableL(TInt aItemIndex,     
        const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList);
            
    /// See @ref MGlxMediaListObserver::HandleFocusChangedL
    void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleItemSelectedL
    void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleMessageL
    void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleCommandCompleteL
    void HandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList);
    
    /// See @ref MGlxMediaListObserver::HandleError
    void HandleError(TInt aError);
protected: // From derived class    
 
    virtual void DoHandleCommandCompleteL(TAny* aSessionId, 
            CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); 

    virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aMediaList, TBool& aConsume) const = 0;
	virtual void DoExecuteCommandL(TInt aCommandId, MGlxMediaList& aMediaList, TBool& aConsume);
	virtual void HandleErrorL(TInt aErrorCode);
	virtual QString CompletionTextL() const;
	virtual QString ProgressTextL() const;        
    virtual QString ConfirmationTextL(bool multiSelection = false) const; 
private: 
    bool ConfirmationNoteL(MGlxMediaList& aMediaList) const;
    bool ConfirmationNoteSingleL(MGlxMediaList& aMediaList) const;
    bool ConfirmationNoteMultipleL(MGlxMediaList& aMediaList) const;
	void ProgressNoteL(TInt aCommandId);
	void DismissProgressNoteL();
	void CompletionNoteL() const;
    void TryExitL(TInt aErrorCode);
    void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) ;
    void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType);
private:
    // Instance of Media List
    MGlxMediaList* iMediaList;
	TBool iProgressComplete;
	HbProgressDialog* mProgressDialog;
};
#endif //GLXMPXCOMMANDHANDLER_H