diff -r ecf06a08d4d9 -r 2c5162224003 mpviewplugins/mpcollectionviewplugin/inc/mpcollectionpopuphandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpcollectionviewplugin/inc/mpcollectionpopuphandler.h Fri Apr 30 19:33:32 2010 -0500 @@ -0,0 +1,105 @@ +/* +* 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: Music Player popup handler. +* +*/ + +#ifndef MPCOLLECTIONPOPUPHANDLER_H +#define MPCOLLECTIONPOPUPHANDLER_H + +#include + +class MpCollectionView; +class HbPopup; +class HbAction; +class MpEngine; +class QAbstractItemModel; +class MpMpxCollectionData; +class QPointF; + +class MpCollectionPopupHandler : public QObject +{ + Q_OBJECT + +public: + MpCollectionPopupHandler( MpCollectionView *parent ); + virtual ~MpCollectionPopupHandler(); + + void openDefaultViewContextMenu( int index, const QPointF &coords ); + void openFetchViewContextMenu( int index, const QPointF &coords ); + void openRenamePlaylistContainerDialog( const QString ¤tName ); + void openRenamePlaylistItemDialog( const QString ¤tName ); + void openAddSongsToPlaylist( QAbstractItemModel* model ); + void openDeleteSongs( QAbstractItemModel* model ); + void openAddToCurrentPlaylist( MpMpxCollectionData* collectionData ); + void openCreateNewPlaylist( MpMpxCollectionData* collectionData ); + void openArrangeSongs( MpMpxCollectionData* collectionData ); + void cancelOngoingPopup(); + + bool showingPopup(); + +public slots: + //Context Menus + void defaultContextMenuOptionSelected( HbAction *selectedAction ); + void fetcherContextMenuOptionSelected( HbAction *selectedAction ); + + //Dialogs + void handleAddToPlaylistDialogFinished( HbAction *selectedAction ); + void handleAddToPlaylistGetTextFinished( HbAction *selectedAction ); + void handleRenamePlaylistContainer( HbAction *selectedAction ); + void handleRenamePlaylistItem( HbAction *selectedAction ); + void handleAddSongsToPlayList( HbAction *selectedAction ); + void handleDeleteSongs( HbAction *selectedAction ); + void handleAddToCurrentPlaylist( HbAction *selectedAction ); + void handleCreateNewPlaylistGetTextFinished( HbAction *selectedAction ); + void handleCreateNewPlaylistGetModelIndexesFinished( HbAction *selectedAction ); + void handleArrangeSongs( HbAction *selectedAction ); + void handleRequestDelete( HbAction *selectedAction ); + + void outstandingPopupClosing(); + +private: + void setOutstandingPopup( HbPopup *popup ); + void clearOutstandingPopup( HbPopup *popup ); + void launchAddToPlaylistDialog( QList &selection ); + void queryNewPlaylistName(const QStringList &playlists, const char *handler ); + void getText(const QString &label, const QString &text, const char *handler ); + void getModelIndexes( const QString &label, QAbstractItemModel* model, const char *handler ); + void launchArrangeSongsDialog( MpMpxCollectionData* collectionData ); + void requestDelete( QList &selection ); + +private: + MpCollectionView *mView; // Not own + HbPopup *mOutstandingPopup; // Own + MpEngine *mMpEngine; // Not own + + class MpPopupHandlerPermanentData : public QObject + { + public: + MpPopupHandlerPermanentData( QObject *parent=0 ); + virtual ~MpPopupHandlerPermanentData(); + void clear(); + public: + MpMpxCollectionData *mIsolatedCollectionData; // Not own + QAbstractItemModel *mAbstractItemModel; // Own + QList mSelectedItems; + QString mOriginalName; + int mContextMenuIndex; + }; + + MpPopupHandlerPermanentData *mPermanentData; // Own +}; + +#endif // MPCOLLECTIONPOPUPHANDLER_H +