mpviewplugins/mpcollectionviewplugin/inc/mpcollectionpopuphandler.h
changeset 34 2c5162224003
child 29 8192e5b5c935
equal deleted inserted replaced
22:ecf06a08d4d9 34:2c5162224003
       
     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: Music Player popup handler.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPCOLLECTIONPOPUPHANDLER_H
       
    19 #define MPCOLLECTIONPOPUPHANDLER_H
       
    20 
       
    21 #include <QObject>
       
    22 
       
    23 class MpCollectionView;
       
    24 class HbPopup;
       
    25 class HbAction;
       
    26 class MpEngine;
       
    27 class QAbstractItemModel;
       
    28 class MpMpxCollectionData;
       
    29 class QPointF;
       
    30 
       
    31 class MpCollectionPopupHandler : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35 public:
       
    36     MpCollectionPopupHandler( MpCollectionView *parent );
       
    37     virtual ~MpCollectionPopupHandler();
       
    38 
       
    39     void openDefaultViewContextMenu( int index, const QPointF &coords );
       
    40     void openFetchViewContextMenu( int index, const QPointF &coords );
       
    41     void openRenamePlaylistContainerDialog( const QString &currentName );
       
    42     void openRenamePlaylistItemDialog( const QString &currentName );
       
    43     void openAddSongsToPlaylist( QAbstractItemModel* model );
       
    44     void openDeleteSongs( QAbstractItemModel* model );
       
    45     void openAddToCurrentPlaylist( MpMpxCollectionData* collectionData );
       
    46     void openCreateNewPlaylist( MpMpxCollectionData* collectionData );
       
    47     void openArrangeSongs( MpMpxCollectionData* collectionData );
       
    48     void cancelOngoingPopup();
       
    49 
       
    50     bool showingPopup();
       
    51 
       
    52 public slots:
       
    53     //Context Menus
       
    54     void defaultContextMenuOptionSelected( HbAction *selectedAction );
       
    55     void fetcherContextMenuOptionSelected( HbAction *selectedAction );
       
    56 
       
    57     //Dialogs
       
    58     void handleAddToPlaylistDialogFinished( HbAction *selectedAction );
       
    59     void handleAddToPlaylistGetTextFinished( HbAction *selectedAction );
       
    60     void handleRenamePlaylistContainer( HbAction *selectedAction );
       
    61     void handleRenamePlaylistItem( HbAction *selectedAction );
       
    62     void handleAddSongsToPlayList( HbAction *selectedAction );
       
    63     void handleDeleteSongs( HbAction *selectedAction );
       
    64     void handleAddToCurrentPlaylist( HbAction *selectedAction );
       
    65     void handleCreateNewPlaylistGetTextFinished( HbAction *selectedAction );
       
    66     void handleCreateNewPlaylistGetModelIndexesFinished( HbAction *selectedAction );
       
    67     void handleArrangeSongs( HbAction *selectedAction );
       
    68     void handleRequestDelete( HbAction *selectedAction );
       
    69 
       
    70     void outstandingPopupClosing();
       
    71 
       
    72 private:
       
    73     void setOutstandingPopup( HbPopup *popup );
       
    74     void clearOutstandingPopup( HbPopup *popup );    
       
    75     void launchAddToPlaylistDialog( QList<int> &selection );
       
    76     void queryNewPlaylistName(const QStringList &playlists, const char *handler );
       
    77     void getText(const QString &label, const QString &text, const char *handler );
       
    78     void getModelIndexes( const QString &label, QAbstractItemModel* model, const char *handler );
       
    79     void launchArrangeSongsDialog( MpMpxCollectionData* collectionData );
       
    80     void requestDelete( QList<int> &selection );
       
    81 
       
    82 private:
       
    83     MpCollectionView                *mView;                          // Not own
       
    84     HbPopup                         *mOutstandingPopup;              // Own
       
    85     MpEngine                        *mMpEngine;                      // Not own
       
    86 
       
    87     class MpPopupHandlerPermanentData : public QObject
       
    88     {
       
    89     public:
       
    90         MpPopupHandlerPermanentData( QObject *parent=0 );
       
    91         virtual ~MpPopupHandlerPermanentData();
       
    92         void clear();
       
    93     public:
       
    94         MpMpxCollectionData         *mIsolatedCollectionData;        // Not own
       
    95         QAbstractItemModel          *mAbstractItemModel;             // Own
       
    96         QList<int>                  mSelectedItems;
       
    97         QString                     mOriginalName;
       
    98         int                         mContextMenuIndex;
       
    99     };
       
   100     
       
   101     MpPopupHandlerPermanentData     *mPermanentData;                 // Own
       
   102 };
       
   103 
       
   104 #endif  // MPCOLLECTIONPOPUPHANDLER_H
       
   105