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