videocollection/hgmyvideos/inc/vcxhgmyvideosvideolistimpl.h
changeset 0 96612d01cf9f
child 6 7d91903f795f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:      Implementation of UI functionality for video list.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCXHGMYVIDEOSVIDEOLISTIMPL_H
       
    21 #define VCXHGMYVIDEOSVIDEOLISTIMPL_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <e32cmn.h>
       
    25 #include <ganes/HgSelectionObserverIface.h>
       
    26 #include <ganes/HgMarkingObserverIface.h>
       
    27 #include <AknProgressDialog.h>
       
    28 #include <upnpcommandobserver.h>
       
    29 #include "vcxhgmyvideoslistbase.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVcxHgMyVideosVideoModelHandler;
       
    33 class TViaPlayerCustomMessage;
       
    34 class CAknWaitDialog;
       
    35 class CVcxHgMyVideosVideoCopier;
       
    36 class CVcxHgMyVideosUPnPInterface;
       
    37 class CVcxHgTelephonyClient;
       
    38 class CHgScroller;
       
    39 class CSendUi;
       
    40 class CHgMyVideosAiwMenuHandler;
       
    41 class CDRMHelper;
       
    42 
       
    43 namespace DRM
       
    44     {
       
    45     class CDrmUtility;
       
    46     }
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51  * Implementation of UI functionality for video list.
       
    52  * 
       
    53  * @lib vcxhgmyvideos.lib
       
    54  */
       
    55 NONSHARABLE_CLASS( CVcxHgMyVideosVideoListImpl ) : public CVcxHgMyVideosListBase,
       
    56                                                    public MProgressDialogCallback,
       
    57                                                    public MUpnpCommandObserver,
       
    58                                                    public MHgSelectionObserver,
       
    59                                                    public MHgMarkingObserver
       
    60     {
       
    61     public:
       
    62 
       
    63         /**
       
    64          * Two-phased constructor.
       
    65          *
       
    66          * @param aModel Component model
       
    67          * @param aView Component view
       
    68          * @param aScroller Hg list control 
       
    69     
       
    70          * @return Pointer to newly created instance
       
    71          */
       
    72         static CVcxHgMyVideosVideoListImpl* NewL(
       
    73             CVcxHgMyVideosModel& aModel,
       
    74             CVcxHgMyVideosMainView& aView,
       
    75             CHgScroller& aScroller );
       
    76 
       
    77         /**
       
    78          * Two-phased constructor.
       
    79          *
       
    80          * @param aModel Component model 
       
    81          * @param aView Component view
       
    82          * @param aScroller Hg list control
       
    83          *
       
    84          * @return Pointer to newly created instance
       
    85          */
       
    86         static CVcxHgMyVideosVideoListImpl* NewLC( 
       
    87              CVcxHgMyVideosModel& aModel,
       
    88              CVcxHgMyVideosMainView& aView,
       
    89              CHgScroller& aScroller );
       
    90     
       
    91         /**
       
    92         * Destructor.
       
    93         */
       
    94         virtual ~CVcxHgMyVideosVideoListImpl();
       
    95     
       
    96         /**
       
    97          * Activate.
       
    98          * 
       
    99          * @param aIndex Index of video list to activate.
       
   100          */
       
   101         void DoListActivateL( TInt aIndex );
       
   102     
       
   103         /**
       
   104          * Deactivate
       
   105          */
       
   106         void DoListDeactivate();
       
   107 
       
   108         /**
       
   109          * Returns reference to the video model.
       
   110          * 
       
   111          * @return Reference to video model.
       
   112          */
       
   113         CVcxHgMyVideosVideoModelHandler& VideoModel();
       
   114         
       
   115         /**
       
   116          * Returns reference to the uPnP interface
       
   117          * 
       
   118          * @return Reference to uPnP interface
       
   119          */
       
   120         CVcxHgMyVideosUPnPInterface& UPnPInterface();
       
   121 
       
   122         /**
       
   123          * Gets list highlight.
       
   124          * 
       
   125          * @return Highlight.
       
   126          */
       
   127         TInt Highlight();
       
   128 
       
   129         /**
       
   130          * Returns the index(es) of video(s) that are operation targets.
       
   131          * 
       
   132          * @param aOperationTargets On return, index(es) of the video(s).
       
   133          */
       
   134         void GetOperationTargetIndexesL( RArray<TInt>& aOperationTargets );        
       
   135 
       
   136         /**
       
   137          * Starts playback of currently focused video.
       
   138          */
       
   139         void PlayCurrentVideoL();
       
   140                         
       
   141         /**
       
   142          * Deletes currently selected video(s).
       
   143          */
       
   144         void DeleteVideosL();
       
   145 
       
   146         /**
       
   147          * Plays currently selected video.
       
   148          */
       
   149         void PlayVideoL();
       
   150         
       
   151         /**
       
   152          * Resumes currently selected download.
       
   153          */
       
   154         void ResumeDownloadL();
       
   155         
       
   156         /**
       
   157          * Cancels currently selected download.
       
   158          */
       
   159         void CancelDownloadL();        
       
   160         
       
   161         /**
       
   162          * Handles sort command to list.
       
   163          * 
       
   164          * @param aSortCommand Sort command.
       
   165          */
       
   166         void HandleSortCommandL( TInt aSortCommand );
       
   167         
       
   168         /**
       
   169          * Checks the UI and list status and returns information to show
       
   170          * correct mark-menu items.
       
   171          * 
       
   172          * @param aShowMarkSubmenu On return, ETrue if mark sub-menu can be shown.
       
   173          * @param showStartMarking On return, ETrue if start marking menu item can be shown.
       
   174          * @param showEndMarking On return, ETrue if stop marking menu item can be shown.
       
   175          * @param aShowMarkAll On return, ETrue if mark all menu item can be shown.
       
   176          * @param aShowUnmarkAll On return, ETrue if unmark all menu item can be shown.
       
   177          */
       
   178         void ShowMarkMenuItemsL( 
       
   179                  TBool& aShowMarkSubmenu, TBool& showStartMarking, TBool& showEndMarking, 
       
   180                  TBool& aShowMarkAll, TBool& aShowUnmarkAll );
       
   181 
       
   182         /**
       
   183          * Handles mark command to list.
       
   184          * 
       
   185          * @param aMarkCommand Mark command.
       
   186          */
       
   187         void HandleMarkCommandL( TInt aMarkCommand );
       
   188         
       
   189         /**
       
   190          * Checks the UI and list status, and returns information to show correct
       
   191          * move and copy -menu items.
       
   192          * 
       
   193          * @param aShowMoveAndCopySubmenu On return, ETrue if move/copy sub-menu cab be shown.
       
   194          * @param aShowCopy On return, ETrue if copy menu item can be shown.
       
   195          * @param aShowMove On return, ETrue if move menu item can be shown.
       
   196          */
       
   197         void ShowMoveAndCopyMenuItemsL( 
       
   198                  TBool& aShowMoveAndCopySubmenu, TBool& aShowCopy, TBool& aShowMove );
       
   199         
       
   200         /**
       
   201          * Handles move and copy commands to list.
       
   202          * 
       
   203          * @param aCopy ETrue if copy command was given. EFalse if move.
       
   204          */
       
   205         void HandleMoveOrCopyCommandL( TBool aCopy );
       
   206         
       
   207         /**
       
   208          * Set empty list text for list control. 
       
   209          */
       
   210         void SetEmptyListTextL();        
       
   211 
       
   212         /**
       
   213          * Set title text for view.
       
   214          * 
       
   215          * @param aIndex Index of active video list.
       
   216          */
       
   217         void SetTitleTextL( TInt aIndex );
       
   218 
       
   219         /**
       
   220          * Handles dynamic initialisation of menu items specific to video list.
       
   221          * 
       
   222          * @param aResourceId Resource ID of menu to be activated.
       
   223          * @param aMenuPane Pointer to menu pane.
       
   224          */
       
   225         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );        
       
   226         
       
   227         /**
       
   228          * Returns correct MSK resource Id based on current state of video list.
       
   229          *
       
   230          * @return MSK resource Id.
       
   231          */
       
   232         TInt GetMskResourceL();
       
   233         
       
   234         /**
       
   235          * Called by video model when video deletion is completed.
       
   236          * 
       
   237          * @param aFailedCount Count of items that could not be deleted.
       
   238          * @param aFailedName Name of video where deletion failed, if there was only one.
       
   239          */
       
   240         void VideoDeletionCompletedL( TInt aFailedCount, const TDesC& aFailedName );
       
   241         
       
   242         /**
       
   243          * Called by video model when move or copy command is completed.
       
   244          * 
       
   245          * @param aFailedCount Count of items that could not be moved/copied.
       
   246          * @param aFailedName Name of video where move/copy failed, if there was only one.
       
   247          */
       
   248         void VideoMoveOrCopyCompletedL( TInt aFailedCount, const TDesC& aFailedName );
       
   249         
       
   250         /**
       
   251          * Displays note about resume starting from beginning.
       
   252          */
       
   253         void ShowResumeStartsFromBeginningNoteL();
       
   254         
       
   255         /**
       
   256          * Begins multimarking mode.
       
   257          */
       
   258         void StartMarkingMode();
       
   259         
       
   260         /**
       
   261          * Ends multimarking mode.
       
   262          */
       
   263         void EndMarkingMode();
       
   264         
       
   265         /**
       
   266          * Send video using SendUI
       
   267          */
       
   268         void HandleSendL();
       
   269         
       
   270         /**
       
   271          * Handles command if aCommand is an Aiw command
       
   272          * 
       
   273          * @param aCommand Menu command ID
       
   274          */
       
   275         void TryHandleAiwCommandL( TInt aCommand );
       
   276         
       
   277         /**
       
   278          * Checks if we are at marking mode and returns
       
   279          * corresponding value.
       
   280 		 *
       
   281 		 * @return ETrue if in marking mode else EFalse.
       
   282          *  
       
   283          */
       
   284         TBool IsMarking();
       
   285         
       
   286     public: // From MProgressDialogCallback
       
   287 
       
   288         /**
       
   289          * Called when (delete) wait dialog is dismissed.
       
   290          *
       
   291          * @aButtonId Button with which dialog was dismissed.
       
   292          */     
       
   293         void DialogDismissedL( TInt aButtonId ); 
       
   294     
       
   295     public: // From MHgSelectionObserver
       
   296             
       
   297         /**
       
   298          * Handle selection.
       
   299          * 
       
   300          * @param aIndex Selected item index.
       
   301          */
       
   302         void HandleSelectL( TInt aIndex );
       
   303             
       
   304         /**
       
   305          * Handle opening.
       
   306          * 
       
   307          * @param aIndex Opened item index.
       
   308          */
       
   309         void HandleOpenL( TInt aIndex );
       
   310     
       
   311     public: // From MHgMarkingObserver
       
   312         
       
   313         /**
       
   314          * Handle marking.
       
   315          * 
       
   316          * @param aIndex Selected item index.
       
   317          * @param aMarked ETrue if item marked, EFalse if item is unmarked.
       
   318          */
       
   319         void HandleMarkingL( TInt aIndex, TBool aMarked ); 
       
   320         
       
   321     public:
       
   322         
       
   323        /**
       
   324         * Handles async reposnses from CVcxHgMyVideosuPnPInterface::ShowVideo
       
   325         * In case we receive KErrNone or value below it (error), video playback 
       
   326         * has been ended due error or succesfully. 
       
   327         * 
       
   328         * Status might also be positive, which refers some undocumented additional
       
   329         * information. According to UPnP documentation, those status values should 
       
   330         * be ignored. 
       
   331         * 
       
   332         * @param aStatusCode  statuscode from the CVcxHgMyVideosUPnPInterface
       
   333         */
       
   334        void CommandComplete( TInt aStatusCode );
       
   335         
       
   336     protected:    
       
   337         
       
   338         /**
       
   339          * Default constructor
       
   340          *
       
   341          * @param aModel Component model
       
   342          * @param aView Component view
       
   343          * @param aScroller Hg list control
       
   344          */
       
   345         CVcxHgMyVideosVideoListImpl( CVcxHgMyVideosModel& iModel,
       
   346                                      CVcxHgMyVideosMainView& aView,
       
   347                                      CHgScroller& aScroller );
       
   348 
       
   349         /**
       
   350          * 2nd phase constructor.
       
   351          */
       
   352         void ConstructL();
       
   353 
       
   354         /**
       
   355          * Confirms video deletion from user.
       
   356          * 
       
   357          * @param aTargetCount Count of deletion targets.
       
   358          * @param aTargetName Name of deletion target, if there is only one.
       
   359          * @return ETrue if user confirmed deletion.
       
   360          */
       
   361         TBool ConfirmDeleteVideosL( TInt aTargetCount, const TDesC& aTargetName );
       
   362 
       
   363         /**
       
   364          * Opens the deletion wait note.
       
   365          */
       
   366         void OpenDeleteWaitNoteL();
       
   367 
       
   368         /**
       
   369          * Closes the deletion wait note.
       
   370          */
       
   371         void CloseDeleteWaitNote();
       
   372         
       
   373         /**
       
   374          * Checks parental control for a video, and asks lock code.
       
   375          *
       
   376          * @leave KErrPermissionDenied If not allowed to play.
       
   377          * @param aAgeProfile Age profile for the video to be checked.
       
   378          */
       
   379         void CheckParentalControlL( TUint32 aAgeProfile );
       
   380         
       
   381         /**
       
   382          * Fetch SendUI messaging configuration from CenRep
       
   383          * 
       
   384          * @return Messaging configuration from CenRep
       
   385          */
       
   386         TInt MessagingConfL();
       
   387 
       
   388         /**
       
   389          * Returns pointer to instance of CSendUi
       
   390          * 
       
   391          * @return Pointer to CSendUi
       
   392          */
       
   393         CSendUi* SendUiL();
       
   394 
       
   395         /**
       
   396          * Returns pointer to instance of CHgMyVideosAiwMenuHandler.
       
   397          * First call creates handler and attaches AIW menu.
       
   398          * 
       
   399          * @return Pointer to CHgMyVideosAiwMenuHandler
       
   400          */
       
   401         CHgMyVideosAiwMenuHandler* AiwMenuHandlerL();
       
   402 
       
   403     protected:
       
   404     
       
   405         /**
       
   406          * Video model handler.
       
   407          * Own.
       
   408          */
       
   409         CVcxHgMyVideosVideoModelHandler* iVideoModel;    
       
   410         
       
   411         /**
       
   412          * Index of video currently in play.
       
   413          */
       
   414         TInt iCurrentlyPlayedVideo;
       
   415         
       
   416         /**
       
   417          * Delete wait dialog.
       
   418          * Own.
       
   419          */
       
   420         CAknWaitDialog* iDeleteWaitDialog;
       
   421         
       
   422         /**
       
   423          * Class for handling copying and moving of videos.
       
   424          * Own.
       
   425          */
       
   426         CVcxHgMyVideosVideoCopier* iVideoCopier; 
       
   427         
       
   428         /**
       
   429          * UPnP handler interface
       
   430          * Own.
       
   431          */
       
   432         CVcxHgMyVideosUPnPInterface* iUPnP;
       
   433         
       
   434         /**
       
   435          * Central repository access needed for parental control setting.
       
   436          * Own.
       
   437          */
       
   438         CRepository* iCenRep;
       
   439         
       
   440         /**
       
   441          * Telephony client, used for asking lock code from user.
       
   442 		 * Own.
       
   443          */
       
   444         CVcxHgTelephonyClient* iTelephonyClient;
       
   445         
       
   446         /**
       
   447          * Flag for marking mode. True when marking mode enabled.
       
   448          */
       
   449         TBool iMultipleMarkingActive;
       
   450 
       
   451         /**
       
   452          * SendUI
       
   453          * Own
       
   454          */
       
   455         CSendUi* iSendUi;
       
   456 
       
   457         /** 
       
   458          * Aiw Menu Handler
       
   459          * Own
       
   460          */
       
   461         CHgMyVideosAiwMenuHandler* iAiwMenuHandler;
       
   462 
       
   463     };
       
   464 
       
   465 #endif // VCXHGMYVIDEOSVIDEOLISTIMPL_H