diff -r 84d9eb65b26f -r 518b245aa84c messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Fri Jun 25 15:47:40 2010 +0530 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2010 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: + * The header file for mde tone fetcher. + * + */ +#ifndef MSGAUDIOSELECTIONENGINE_H +#define MSGAUDIOSELECTIONENGINE_H + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS + +/** + * This class is used for quering tones from mde. + */ +class MsgAudioSelectionEngine : public QObject, + public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver +{ +Q_OBJECT + +public: + + enum TStorageType + { + EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer + // string + }; + +public: + MsgAudioSelectionEngine(); + virtual ~MsgAudioSelectionEngine(); + void CreateMetaDataSession(); +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(QStringList nameList, QStringList uriList); + void queryError(int error); + void notifyObjectChanged(); + +public: + static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); + void QueryTones(); + void SetAttr(int attr, int value); + +private: + void LeaveIfSessionClosedL(); + CMdEPropertyDef& PropertyDefL(TInt aAttr); + void QueryTonesL(); + void HandleQueryCompletedL(CMdEQuery& aQuery, TInt aError); + +private: + // from MMdESessionObserver + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + +private: + // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount); + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); +private: + // from MMdEObjectObserver + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + +private: + // from MMdEObjectPresentObserver + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void AddObjectObserverL(); +private: + + + // session to metadata engine + CMdESession* iSession; + + // metadata query + CMdEObjectQuery* iQuery; + + // used for saving the quering result. + //both name and uri. + QStringList iNameList; + QStringList iUriList; + + // is metadata session open + TBool iSessionOpen; + + // max audio file file size + TInt iMaxFileSize; + + // query error + TInt iQueryError; +}; +#endif /* MSGAUDIOSELECTIONENGINE_H */ +