videocollection/hgmyvideos/src/vcxhgmyvideosmainview.cpp
branchRCL_3
changeset 10 ce5ada96ab30
parent 6 7d91903f795f
child 14 8970fbd719ec
equal deleted inserted replaced
6:7d91903f795f 10:ce5ada96ab30
    13 *
    13 *
    14 * Description:      My Videos UI main view.*
    14 * Description:      My Videos UI main view.*
    15 */
    15 */
    16 
    16 
    17 
    17 
    18 // Version : %version: TB92_33.1.1 %
    18 // Version : %version: e92_37 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <bldvariant.hrh>
    21 #include <bldvariant.hrh>
    22 #include <aknViewAppUi.h>
    22 #include <aknViewAppUi.h>
    23 #include <avkon.hrh>
    23 #include <avkon.hrh>
    24 #include <StringLoader.h>
    24 #include <StringLoader.h>
    25 #include <coeaui.h>
    25 #include <coeaui.h>
    26 #include <aknnotewrappers.h>
    26 #include <aknnotewrappers.h>
    27 #include <hlplch.h>
    27 #include <hlplch.h>
       
    28 #include <apgcli.h>     // RApaLsSession
       
    29 #include <apacmdln.h>   // CApaCommandLine
    28 
    30 
    29 #include <AknsBasicBackgroundControlContext.h>
    31 #include <AknsBasicBackgroundControlContext.h>
    30 #include <ganes/HgDoubleTextList.h>
    32 #include <ganes/HgDoubleTextList.h>
    31 #include <ganes/HgDoubleGraphicList.h>
    33 #include <ganes/HgDoubleGraphicList.h>
    32 
    34 
    47 
    49 
    48 // CONSTANTS
    50 // CONSTANTS
    49 _LIT( KVcxHgMyVideosMainViewResFile, "\\resource\\apps\\vcxhgmyvideos." );
    51 _LIT( KVcxHgMyVideosMainViewResFile, "\\resource\\apps\\vcxhgmyvideos." );
    50 
    52 
    51 const TUint32 KVcxHgMyVideosViewUid = 0x20021191;
    53 const TUint32 KVcxHgMyVideosViewUid = 0x20021191;
       
    54 const TUid KMediaSettingsAppUid = { 0x10005A3F };
       
    55 const TUid KBrowserAppUid       = { 0x10008D39 };
       
    56 
       
    57 const TInt KVcxHgMyVideosUrlMaxLen = 1024;
       
    58 
       
    59 _LIT( KBrowserProtocol, "4 " );
    52 
    60 
    53 // ============================ MEMBER FUNCTIONS ===============================
    61 // ============================ MEMBER FUNCTIONS ===============================
    54 
    62 
    55 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    56 // CVcxHgMyVideosMainView::CVcxHgMyVideosMainView()
    64 // CVcxHgMyVideosMainView::CVcxHgMyVideosMainView()
   144     if ( !iCategoryList )
   152     if ( !iCategoryList )
   145         {
   153         {
   146         IPTVLOGSTRING_LOW_LEVEL( 
   154         IPTVLOGSTRING_LOW_LEVEL( 
   147             "MPX My Videos UI # CVcxHgMyVideosMainView::CategoryListL: Creating category list." );
   155             "MPX My Videos UI # CVcxHgMyVideosMainView::CategoryListL: Creating category list." );
   148         // Create category list control.
   156         // Create category list control.
   149         CHgDoubleTextList* hgCategoryList = 
   157         CHgDoubleGraphicList* hgCategoryList = 
   150             CHgDoubleTextList::NewL( ClientRect(), 0 );
   158             CHgDoubleGraphicList::NewL( ClientRect(), 0 );
   151         CleanupStack::PushL( hgCategoryList );
   159         CleanupStack::PushL( hgCategoryList );
   152       
   160       
   153         // Create list implementations. 
   161         // Create list implementations. 
   154         // Ownership of list control is transferred. 
   162         // Ownership of list control is transferred. 
   155         iCategoryList = CVcxHgMyVideosCategoryListImpl::NewL( *iModel,
   163         iCategoryList = CVcxHgMyVideosCategoryListImpl::NewL( *iModel,
   359             {
   367             {
   360             TInt highlight = CategoryListL()->Highlight();
   368             TInt highlight = CategoryListL()->Highlight();
   361             
   369             
   362             if ( highlight >= 0 )
   370             if ( highlight >= 0 )
   363                 {
   371                 {
   364                 ActivateVideoListL( highlight );
   372                 CategoryListL()->HandleOpenL( highlight );
   365                 }
   373                 }
   366             }
   374             }
   367             break;
   375             break;
   368         case EVcxHgMyVideosCmdDelete:
   376         case EVcxHgMyVideosCmdDelete:
   369             {
   377             {
   446         case EVcxHgMyVideosCmdMarkAll:
   454         case EVcxHgMyVideosCmdMarkAll:
   447         case EVcxHgMyVideosCmdUnmarkAll:
   455         case EVcxHgMyVideosCmdUnmarkAll:
   448         case EVcxHgMyVideosCmdToggleMultipleMarking:        
   456         case EVcxHgMyVideosCmdToggleMultipleMarking:        
   449             {
   457             {
   450             VideoListL()->HandleMarkCommandL( aCommand );
   458             VideoListL()->HandleMarkCommandL( aCommand );
       
   459             }
       
   460             break;
       
   461         case EVcxHgMyVideosCmdOpenSettings:
       
   462             {
       
   463             // Open MediaSettings application
       
   464             LaunchAppL( KMediaSettingsAppUid ); 
   451             }
   465             }
   452             break;
   466             break;
   453         case EVcxHgMyVideosCmdHelp:
   467         case EVcxHgMyVideosCmdHelp:
   454             {
   468             {
   455             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
   469             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
   754         {
   768         {
   755         rskToSet = R_VCXHGMYVIDEOS_RSK_CANCEL;
   769         rskToSet = R_VCXHGMYVIDEOS_RSK_CANCEL;
   756         }    
   770         }    
   757     else
   771     else
   758         {
   772         {
   759         rskToSet = R_VCXHGMYVIDEOS_RSK_BACK;
   773         if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ||
       
   774              iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryBusy )
       
   775              {
       
   776              rskToSet = R_VCXHGMYVIDEOS_RSK_EXIT;
       
   777              }
       
   778          else 
       
   779              {     
       
   780              rskToSet = R_VCXHGMYVIDEOS_RSK_BACK;
       
   781              }
   760         }
   782         }
   761 
   783 
   762     if ( rskToSet != iCurrentRskResource )
   784     if ( rskToSet != iCurrentRskResource )
   763         {
   785         {
   764         iCurrentRskResource = rskToSet;
   786         iCurrentRskResource = rskToSet;
   781     if ( VideoListL()->IsMarking() )
   803     if ( VideoListL()->IsMarking() )
   782         {
   804         {
   783         VideoListL()->HandleMarkCommandL( EVcxHgMyVideosCmdStopMarking );
   805         VideoListL()->HandleMarkCommandL( EVcxHgMyVideosCmdStopMarking );
   784         }    
   806         }    
   785     }
   807     }
       
   808 
       
   809 // ------------------------------------------------------------------------------
       
   810 // CVcxHgMyVideosMainView::LaunchAppL()
       
   811 // ------------------------------------------------------------------------------
       
   812 //
       
   813 void CVcxHgMyVideosMainView::LaunchAppL( const TUid aAppUid, const TDesC& aMsg )
       
   814     {
       
   815     RWsSession wsSession;
       
   816     User::LeaveIfError( wsSession.Connect() );
       
   817     CleanupClosePushL<RWsSession>( wsSession );
       
   818     TApaTaskList taskList( wsSession );
       
   819     TApaTask task = taskList.FindApp( aAppUid );
       
   820     TInt msgLen = aMsg.Length();
       
   821        
       
   822     if ( task.Exists() )
       
   823         {
       
   824         if ( msgLen > 0 )
       
   825             {
       
   826             // Send message
       
   827             HBufC8* param8 = HBufC8::NewLC( msgLen );
       
   828             param8->Des().Append( aMsg );
       
   829             task.SendMessage( TUid::Uid( 0 ), *param8 );
       
   830             CleanupStack::PopAndDestroy( param8 );
       
   831             }
       
   832         else
       
   833             {
       
   834             task.BringToForeground();
       
   835             }
       
   836         }
       
   837     else // Task didn't exist
       
   838         {
       
   839         RApaLsSession appArcSession;
       
   840         User::LeaveIfError( appArcSession.Connect() );
       
   841         CleanupClosePushL<RApaLsSession>( appArcSession );
       
   842     
       
   843         if ( msgLen > 0 )
       
   844             {
       
   845             TThreadId id;
       
   846             appArcSession.StartDocument( aMsg, aAppUid , id ); 
       
   847             }
       
   848         else
       
   849             {
       
   850             TApaAppInfo appInfo;
       
   851             TInt retVal = appArcSession.GetAppInfo( appInfo, aAppUid );
       
   852             if ( retVal == KErrNone )
       
   853                 {
       
   854                 CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
       
   855                 cmdLine->SetExecutableNameL( appInfo.iFullName );
       
   856                 cmdLine->SetCommandL( EApaCommandRun );
       
   857                 User::LeaveIfError( appArcSession.StartApp( *cmdLine ) );
       
   858                 CleanupStack::PopAndDestroy( cmdLine );
       
   859                 }
       
   860             else
       
   861                 {
       
   862                 IPTVLOGSTRING_LOW_LEVEL( 
       
   863                         "MPX My Videos UI # CVcxHgMyVideosMainView::LaunchAppL - Application not found!" );
       
   864                 }
       
   865             }
       
   866         CleanupStack::PopAndDestroy(); // appArcSession
       
   867         }
       
   868     CleanupStack::PopAndDestroy(); // wsSession
       
   869     }
       
   870 
       
   871 // ------------------------------------------------------------------------------
       
   872 // CVcxHgMyVideosMainView::LaunchBrowserL()
       
   873 // ------------------------------------------------------------------------------
       
   874 //
       
   875 void CVcxHgMyVideosMainView::LaunchBrowserL( const TDesC& aUrl )
       
   876     {
       
   877     HBufC* param = HBufC::NewLC( KVcxHgMyVideosUrlMaxLen );
       
   878     param->Des().Copy( KBrowserProtocol() );
       
   879     param->Des().Append( aUrl );
       
   880     
       
   881     LaunchAppL( KBrowserAppUid, *param );
       
   882     
       
   883     CleanupStack::PopAndDestroy( param );
       
   884     }
       
   885