mpxplugins/viewplugins/inc/mpxaddtracksdialog.h
changeset 0 ff3acec5bc43
child 18 c54d95799c80
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Class declarations of CMPXAddTracksDialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CMPXADDTRACKSDIALOG_H
       
    20 #define C_CMPXADDTRACKSDIALOG_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknselectionlist.h>
       
    24 #include <mpxcollectionobserver.h>
       
    25 #include <mpxcollectionpath.h> // TMPXItemId
       
    26 #include <mpxcollectionuihelper.h>
       
    27 #include <mpxcollectionuihelperobserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CEikTextListBox;
       
    31 class CAknNavigationControlContainer;
       
    32 class CAknNavigationDecorator;
       
    33 class CAknTitlePane;
       
    34 class CAknContextPane;
       
    35 class CEikImage;
       
    36 class CMPXLbxExtendedFeatures;
       
    37 class CMPXAddTracksListModel;
       
    38 class MMPXCollectionUtility;
       
    39 class CMPXMediaArray;
       
    40 class CMPXCommonUiHelper;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  *  CMPXAddTracksDialog class
       
    46  *
       
    47  *  Dialog class for Playlist Add Tracks Mode
       
    48  */
       
    49 NONSHARABLE_CLASS( CMPXAddTracksDialog ) : public CAknSelectionListDialog,
       
    50                                            public MMPXCollectionObserver,
       
    51                                            public MMPXCollectionFindObserver,
       
    52                                            public MMPXCHelperObserver
       
    53     {
       
    54 public:
       
    55 
       
    56     enum TMPXAddTracksListItems
       
    57         {
       
    58         EMPXAddTracksAddAllSongs = 0,
       
    59         EMPXAddTracksAddArtistsBegin
       
    60         };
       
    61 
       
    62 public: // Constructors and destructor
       
    63 
       
    64     /**
       
    65      * Two-phased constructor.
       
    66      * @return A pointer to a newly created object
       
    67      */
       
    68     IMPORT_C static CMPXAddTracksDialog* NewL();
       
    69 
       
    70     /**
       
    71      * Two-phased constructor.
       
    72      * @return A pointer to a newly created object
       
    73      */
       
    74     IMPORT_C static CMPXAddTracksDialog* NewLC();
       
    75 
       
    76     /**
       
    77      * C++ default destructor.
       
    78      */
       
    79     IMPORT_C virtual ~CMPXAddTracksDialog();
       
    80 
       
    81 private:    // Constructors
       
    82 
       
    83     /**
       
    84      * C++ default constructor.
       
    85      */
       
    86     CMPXAddTracksDialog();
       
    87 
       
    88     /*
       
    89      *  Two phased constructor
       
    90      */
       
    91     void ConstructL( TInt aResource );
       
    92 
       
    93 public: // From CAknSelectionListDialog
       
    94 
       
    95 	void ProcessCommandL( TInt aCommandId );
       
    96 
       
    97 private:     // New functions
       
    98 
       
    99     /**
       
   100      * Backup previous status pane to internal members.
       
   101      */
       
   102     void BackupPreviousStatusPaneL();
       
   103 
       
   104     /**
       
   105      * Restore previous status pane from internal members.
       
   106      */
       
   107     void RestorePreviousStatusPaneL();
       
   108 
       
   109     /**
       
   110      * Create context icon for add tracks dialog.
       
   111      */
       
   112     void CreateContextIconL();
       
   113 
       
   114     /**
       
   115      * Update softkey.
       
   116      */
       
   117     void UpdateSoftkeyL();
       
   118 
       
   119     /**
       
   120      * Update listbox content by category.
       
   121      *
       
   122      * @aMedia media array containing the categories
       
   123      */
       
   124     void UpdateListboxByCategoryL( const CMPXMedia& aMedia );
       
   125 
       
   126 	/**
       
   127      * Update listbox content by category after find
       
   128      * @param aFind if find is activated
       
   129      * @param aSongNum found song number
       
   130      */
       
   131     void UpdateListboxByCategoryforFindL( TBool aFind, TInt aSongNum );
       
   132 
       
   133     /**
       
   134      * Gets current listbox item index.
       
   135      * @return Current listbox item index
       
   136      */
       
   137     TInt CurrentLbxItemIndex() const;
       
   138 
       
   139     /**
       
   140      * Return number of listbox items shown in the current listbox.
       
   141      * @return Visible items in the list box
       
   142      */
       
   143     TInt CurrentListItemCount() const;
       
   144 
       
   145     /**
       
   146      * When you change the list item array you should call this method.
       
   147      */
       
   148     void HandleItemArrayChangeL();
       
   149 
       
   150     /**
       
   151      * Highlight list item.
       
   152      * @param aIndex The index to be highlighted
       
   153      */
       
   154     void HighlightListItem( TInt aIndex );
       
   155 
       
   156     /**
       
   157      * Expand current group.
       
   158      */
       
   159     void ExpandCurrentGroupL();
       
   160 
       
   161     /**
       
   162      * Goto the closest group.
       
   163      */
       
   164     void GotoClosestGroupL();
       
   165 
       
   166     /**
       
   167      * Collapse current group.
       
   168      */
       
   169     void CollapseCurrentGroupL();
       
   170 
       
   171     /**
       
   172      * Add current track to playlist.
       
   173      */
       
   174     void AddCurrentTrackToPlaylistL();
       
   175 
       
   176     /**
       
   177      * Find support in artist category and all songs category.
       
   178      */
       
   179     void DoFindL( void );
       
   180 
       
   181     /**
       
   182      * Animation execution
       
   183      */
       
   184     void DoAnimL( void );
       
   185 
       
   186     /**
       
   187      * Animation call back method
       
   188      * @param aObject call back method
       
   189      */
       
   190     static TInt AnimExpireL( TAny* aObject );
       
   191 
       
   192     /**
       
   193      * Stop the Animation execution
       
   194      */
       
   195     void StopAnimL();
       
   196 
       
   197     /**
       
   198      * load resources.
       
   199      */
       
   200     void LoadResourceL();
       
   201 
       
   202     /**
       
   203      * Start find categories
       
   204      */
       
   205     void LoadCategoriesL();
       
   206 
       
   207     /**
       
   208      * Handle collection message
       
   209      *
       
   210      * @param aMessage collection message
       
   211      */
       
   212     void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
       
   213     
       
   214      /**
       
   215      * Function called by CIdle to close the dialog itself when collection view
       
   216      * can not handle the closing of dialog due to waitnote displayed by
       
   217      * CMPXCollectionViewImp::DoIncrementalOpenL
       
   218      * 
       
   219      * @param aPtr pointer to this dialog itself
       
   220      */
       
   221     static TInt DeferredExitCallback( TAny* aPtr );
       
   222 
       
   223 private:    // Functions from base classes
       
   224 
       
   225     /**
       
   226      * From MMPXCollectionObserver
       
   227      * Handle collection message.
       
   228      *
       
   229      * @param aMessage Collection message
       
   230      * @param aErr system error code.
       
   231      */
       
   232     void HandleCollectionMessage(
       
   233         CMPXMessage* aMessage, TInt aError );
       
   234 
       
   235     /**
       
   236      *  From MMPXCollectionObserver
       
   237      *  Handles the collection entries being opened. Typically called
       
   238      *  when client has Open()'d a folder
       
   239      *
       
   240      *  @param aEntries collection entries opened
       
   241      *  @param aIndex focused entry
       
   242      *  @param aComplete ETrue no more entries. EFalse more entries
       
   243      *                   expected
       
   244      *  @param aError error code
       
   245      */
       
   246     void HandleOpenL(
       
   247         const CMPXMedia& aEntries,
       
   248         TInt aIndex,
       
   249         TBool aComplete,
       
   250         TInt aError );
       
   251 
       
   252     /**
       
   253      *  From MMPXCollectionObserver
       
   254      *  Handles the collection entries being opened. Typically called
       
   255      *  when client has Open()'d an item. Client typically responds by
       
   256      *  'playing' the item
       
   257      *
       
   258      *  @param aPlaylist collection path to item
       
   259      *  @param aError error code
       
   260      */
       
   261     void HandleOpenL(
       
   262         const CMPXCollectionPlaylist& aPlaylist,
       
   263         TInt aError );
       
   264 
       
   265     /**
       
   266      *
       
   267      *  From MMPXCollectionObserver
       
   268      *  Handle media properties
       
   269      *
       
   270      *  @param aMedia media
       
   271      *  @param aError error code
       
   272      */
       
   273     void HandleCollectionMediaL(
       
   274         const CMPXMedia& aMedia,
       
   275         TInt aError );
       
   276 
       
   277     /**
       
   278      *  From MMPXCollectionFindObserver
       
   279      *  Handle callback for "find" operation
       
   280      *
       
   281      *  @param aEntries, CMPXMedia to be returned
       
   282      *  @param aComplete ETrue no more entries. EFalse more entries
       
   283      *                   expected
       
   284      *  @param aError error code
       
   285      */
       
   286     void HandleFindAllL(
       
   287         const CMPXMedia& aResults, TBool aComplete, TInt aError );
       
   288 
       
   289     /**
       
   290      * From MMPXCHelperObserver
       
   291      * Handles the completion of any collection helper event.
       
   292      *
       
   293      * @param aOperation, operation completed
       
   294      * @param aErr. the error code
       
   295      * @param aArgument Argument returned from the operation
       
   296      */
       
   297     void HandleOperationCompleteL( TCHelperOperation aOperation,
       
   298                                    TInt aError,
       
   299                                    void* aArgument );
       
   300 
       
   301     /**
       
   302      * From CEikDialog
       
   303      * Prepare for layout.
       
   304      */
       
   305     void PreLayoutDynInitL();
       
   306 
       
   307     /**
       
   308      * From CEikDialog
       
   309      * Check if it's ok to exit.
       
   310      * @param aButtonId Softkey Id
       
   311      * @return ETrue if it's ok to exit, otherwise, EFalse.
       
   312      */
       
   313     TBool OkToExitL( TInt aButtonId );
       
   314 
       
   315     /**
       
   316      * From CCoeControl, handles key-events.
       
   317      * @param aKeyEvent Key event.
       
   318      * @param aType Type of key event(EEventKey, EEventKeyUp or
       
   319      *              EEventKeyDown).
       
   320      * @return If key-event is consumed, EKeyWasConsumed. Else
       
   321      *         EKeyWasNotConsumed.
       
   322      */
       
   323     TKeyResponse OfferKeyEventL(
       
   324         const TKeyEvent& aKeyEvent,
       
   325         TEventCode aType );
       
   326 
       
   327     /**
       
   328      * From CoeControl.
       
   329      * Handles a change to the control's resources.
       
   330      *
       
   331      * @param aType A message UID value.
       
   332      */
       
   333     void HandleResourceChange( TInt aType );
       
   334 
       
   335     /**
       
   336      * From MEikListBoxObserver
       
   337      * Handles listbox events.
       
   338      *
       
   339      * @param aListBox Listbox where the event occurred.
       
   340      * @param aEventType Event type.
       
   341      */
       
   342      void HandleListBoxEventL(
       
   343         CEikListBox* aListBox,
       
   344         TListBoxEvent aEventType );
       
   345 
       
   346 
       
   347 private:    // Data
       
   348 
       
   349     MMPXCollectionUtility*                  iCollectionUtility;  // not own
       
   350     MMPXCollectionUiHelper*                 iCollectionUiHelper;
       
   351     CMPXCommonUiHelper*                     iCommonUiHelper;
       
   352     CMPXMediaArray*                         iCategoryArray;
       
   353     CMPXMediaArray*                         iAllSongsArray;
       
   354 
       
   355     CAknNavigationControlContainer*         iNaviPane;       // Not owned
       
   356     CAknNavigationDecorator*                iOrigNaviPane;   // Not owned
       
   357     CAknContextPane*                        iContextPane;    // Not owned
       
   358     CAknTitlePane*                          iTitlePane;      // Not owned
       
   359     CEikTextListBox*                        iListBox;        // Not owned
       
   360     CAknListBoxFilterItems*                 iLbxFilterItems; // Not owned
       
   361     CAknNavigationDecorator*                iNaviLabelPane;  // New navi label pane
       
   362     CAknNavigationDecorator*                iNaviDecorator;     // Navi decorator
       
   363 
       
   364     CEikImage*                              iOrigIcon;       // Original context icon
       
   365     CEikImage*                              iNewIcon;        // New context icon
       
   366     CPeriodic*                              iPeriodic; 	 	    // Animation timer
       
   367     CMPXLbxExtendedFeatures*                iLbxExtFeat;     // Speed scrolling
       
   368     CMPXAddTracksListModel*                 iListModel;      // Tracks list model
       
   369     HBufC*                                  iOrigTitle;      // Original title text
       
   370     HBufC*                                  iLastFindTxt;    // Last find text
       
   371     HBufC*                                  iNoSongText;
       
   372     HBufC*                                  iNoMatchText;
       
   373 
       
   374     RArray<TInt>                            iMatchedSongArray;
       
   375     RArray<TInt>                            iMatchedGroupArray;
       
   376     TMPXItemId                              iPlaylistId;
       
   377     TInt                                    iAnimIconIndex;
       
   378     TInt                                    iSelectIndex;
       
   379     TInt                                    iResourceOffset;  // must be freed
       
   380     TInt                                    iCurrentOp;
       
   381     TInt                                    iCurrentGroupIndex;
       
   382     TInt                                    iLastIndex;      // Not used but required by base class
       
   383     TBool                                   iSongAllGroupExist;
       
   384     TBool                                   iExpandAllSongs;
       
   385     TBool                                   iDoFind;
       
   386         
       
   387     CIdle*                                  iIdle;  // used to close dialog itself
       
   388     };
       
   389 
       
   390 #endif  // C_CMPXADDTRACKSDIALOG_H
       
   391 
       
   392 // End of File