browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
equal deleted inserted replaced
93:79859ed3eea9 94:919f36ff910f
    13 *
    13 *
    14 * Description:  Supports Download Menu and Downloads List
    14 * Description:  Supports Download Menu and Downloads List
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 // INCLUDE FILES
    18 // INCLUDE FILES
    21 //#include <platform/mw/Browser_platform_variant.hrh>
    19 #include    <browser_platform_variant.hrh>
    22 #include    <Browser_platform_variant.hrh>
    20 #include    <cdownloadmgruidownloadslist.h>
    23 #include    "CDownloadMgrUiDownloadsList.h"
    21 #include    <cdownloadmgruilibregistry.h>
    24 #include    "CDownloadMgrUiLibRegistry.h"
    22 #include    <cdownloadmgruidownloadmenu.h>
    25 #include    "CDownloadMgrUiDownloadMenu.h"
       
    26 #include    "CDownloadsListArray.h"
    23 #include    "CDownloadsListArray.h"
    27 #include    "CDownloadsListDlg.h"
    24 #include    "CDownloadsListDlg.h"
    28 #include    "AsyncEventHandlerArray.h"
    25 #include    "AsyncEventHandlerArray.h"
    29 #include    "DMgrUiLibPanic.h"
    26 #include    "DMgrUiLibPanic.h"
    30 #include    "DownloadMgrUiLib.hrh"
    27 #include    "DownloadMgrUiLib.hrh"
    38 #include    <coemain.h>
    35 #include    <coemain.h>
    39 #include    <eikmenup.h>
    36 #include    <eikmenup.h>
    40 #include    <gulicon.h>
    37 #include    <gulicon.h>
    41 #include    <uikon.hrh>
    38 #include    <uikon.hrh>
    42 #include    <AknServerApp.h>
    39 #include    <AknServerApp.h>
    43 #include    <uriutils.h>
    40 #include    <UriUtils.h>
    44 
       
    45 // following line is temporary: AVKON dependency removal
       
    46 #undef BRDO_APP_GALLERY_SUPPORTED_FF
       
    47 
    41 
    48 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
    42 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
    49 #include    <MGXFileManagerFactory.h>
    43 #include    <MGXFileManagerFactory.h>
    50 #include    <CMGXFileManager.h>
    44 #include    <CMGXFileManager.h>
    51 #include    <MediaGalleryUID.h>  //Gallery UIDs
    45 #include    <MediaGalleryUID.h>  //Gallery UIDs
    52 #endif
    46 #endif
    53 
    47 
    54 #include    <DocumentHandler.h>
    48 #include    <DocumentHandler.h>
    55 #include    "bautils.h"
    49 #include    "bautils.h"
    56 #include    <BrowserUiSDKCRKeys.h>
    50 #include    <browseruisdkcrkeys.h>
    57 #include    <aknnotewrappers.h>
    51 #include    <aknnotewrappers.h> 
    58 #include    <StringLoader.h>
    52 #include    <StringLoader.h>
    59 #include    <apgtask.h>
    53 #include    <apgtask.h>
    60 
    54 
    61 
    55 
    62 
    56 
    72 // FORWARD DECLARATIONS
    66 // FORWARD DECLARATIONS
    73 class CDownloadsListExecuter;
    67 class CDownloadsListExecuter;
    74 
    68 
    75 // LOCAL FUNCTION PROTOTYPES
    69 // LOCAL FUNCTION PROTOTYPES
    76 
    70 
    77 /**
    71 /** 
    78 * Find the given download in the model and give back the ui data and the index.
    72 * Find the given download in the model and give back the ui data and the index.
    79 * It returns 0, if the given download is not found in aListModel and aIndex is set to KErrNotFound!
    73 * It returns 0, if the given download is not found in aListModel and aIndex is set to KErrNotFound!
    80 */
    74 */
    81 inline TDownloadUiData* FindDlUiData( CDownloadsListArray& aListModel,
    75 inline TDownloadUiData* FindDlUiData( CDownloadsListArray& aListModel, 
    82                                        RHttpDownload& aDownload,
    76                                        RHttpDownload& aDownload,
    83                                        TInt& aIndex );
    77                                        TInt& aIndex );
    84 
    78 
    85 #ifdef __WINS__
    79 #ifdef __WINS__
    86 TInt AskIapIdL( TUint32& aId );
    80 TInt AskIapIdL( TUint32& aId );
    91 */
    85 */
    92 NONSHARABLE_CLASS( CDownloadsListExtension ) : public CBase,
    86 NONSHARABLE_CLASS( CDownloadsListExtension ) : public CBase,
    93                                                public MDownloadHandlerObserver
    87                                                public MDownloadHandlerObserver
    94     {
    88     {
    95     public:  // Constructors and destructor
    89     public:  // Constructors and destructor
    96 
    90         
    97         /**
    91         /**
    98         * Two-phased constructor.
    92         * Two-phased constructor.
    99         */
    93         */
   100         static CDownloadsListExtension* NewL
    94         static CDownloadsListExtension* NewL
   101              ( CDownloadMgrUiDownloadsList& aDownloadsList );
    95              ( CDownloadMgrUiDownloadsList& aDownloadsList );
   102 
    96         
   103         /**
    97         /**
   104         * Destructor.
    98         * Destructor.
   105         */
    99         */
   106         virtual ~CDownloadsListExtension();
   100         virtual ~CDownloadsListExtension();
   107 
   101 
   158 
   152 
   159         /**
   153         /**
   160         * Start a progress info timer update.
   154         * Start a progress info timer update.
   161         */
   155         */
   162 		void StartProgressTimer();
   156 		void StartProgressTimer();
   163 
   157         
   164     protected: // Constructors
   158     protected: // Constructors
   165 
   159 
   166         /**
   160         /**
   167         * C++ default constructor.
   161         * C++ default constructor.
   168         */
   162         */
   191 		CPeriodic*		iUpdateProgressInfoTimer;
   185 		CPeriodic*		iUpdateProgressInfoTimer;
   192 
   186 
   193 		/*
   187 		/*
   194 		* callback function for the UpdateProgressInfo
   188 		* callback function for the UpdateProgressInfo
   195 		*/
   189 		*/
   196 		static TInt		UpdateProgressInfoCallback(TAny* aPtr);
   190 		static TInt		UpdateProgressInfoCallback(TAny* aPtr); 
   197     };
   191     };
   198 
   192 
   199 
   193 
   200 
   194 
   201 NONSHARABLE_CLASS( CDownloadsListExecuter ) : public CActive
   195 NONSHARABLE_CLASS( CDownloadsListExecuter ) : public CActive
   202     {
   196     {
   203     public:  // Constructors and destructor
   197     public:  // Constructors and destructor
   204 
   198         
   205         /**
   199         /**
   206         * Two-phased constructor.
   200         * Two-phased constructor.
   207         */
   201         */
   208         static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList,
   202         static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, 
   209                                              CDownloadsListExecuter** aReferer );
   203                                              CDownloadsListExecuter** aReferer );
   210 
   204         
   211         /**
   205         /**
   212         * Two-phased constructor.
   206         * Two-phased constructor.
   213         */
   207         */
   214         static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList,
   208         static CDownloadsListExecuter* NewL( CDownloadMgrUiDownloadsList& aDownloadsList, 
   215                                              CDownloadsListExecuter** aReferer,
   209                                              CDownloadsListExecuter** aReferer, 
   216                                              RHttpDownload& aHighlightDl );
   210                                              RHttpDownload& aHighlightDl );
   217 
   211         
   218         /**
   212         /**
   219         * Destructor.
   213         * Destructor.
   220         */
   214         */
   221         virtual ~CDownloadsListExecuter();
   215         virtual ~CDownloadsListExecuter();
   222 
   216 
   223     public: // New
   217     public: // New
   224 
   218     
   225         /**
   219         /**
   226         * Invoke RunL.
   220         * Invoke RunL.
   227         */
   221         */
   228         void Start();
   222         void Start();
   229 
   223         
   230         /**
   224         /**
   231         * Check if the dialog already exists.
   225         * Check if the dialog already exists.
   232         */
   226         */
   233         TBool DialogExists() const;
   227         TBool DialogExists() const;
   234 
   228         
   235         /**
   229         /**
   236         * Get a reference. Panics if null!
   230         * Get a reference. Panics if null!
   237         */
   231         */
   238         CDownloadsListDlg& Dialog() const;
   232         CDownloadsListDlg& Dialog() const;
   239 
   233         
   240         /**
   234         /**
   241         * Execute the dialog now (wait dialog).
   235         * Execute the dialog now (wait dialog).
   242         */
   236         */
   243         void ExecuteLD();
   237         void ExecuteLD();
   244 
   238         
   245     private: // Constructors
   239     private: // Constructors
   246 
   240 
   247         /**
   241         /**
   248         * C++ default constructor.
   242         * C++ default constructor.
   249         */
   243         */
   250         CDownloadsListExecuter( CDownloadMgrUiDownloadsList& aDownloadsList,
   244         CDownloadsListExecuter( CDownloadMgrUiDownloadsList& aDownloadsList, 
   251                                 CDownloadsListExecuter** aReferer, RHttpDownload* aHighlightDl );
   245                                 CDownloadsListExecuter** aReferer, RHttpDownload* aHighlightDl );
   252 
   246 
   253         /**
   247         /**
   254         * By default Symbian 2nd phase constructor is private.
   248         * By default Symbian 2nd phase constructor is private.
   255         */
   249         */
   268         CDownloadsListDlg*          iDialog; ///< Not owned - only reference.
   262         CDownloadsListDlg*          iDialog; ///< Not owned - only reference.
   269         CDownloadsListExecuter**    iReferer;
   263         CDownloadsListExecuter**    iReferer;
   270         RHttpDownload* iHighlightDl; ///< Not owned.
   264         RHttpDownload* iHighlightDl; ///< Not owned.
   271         TBool iProgressiveDownload;
   265         TBool iProgressiveDownload;
   272     };
   266     };
   273 
   267     
   274 
   268     
   275 
   269     
   276 // -----------------------------------------------------------------------------
   270 // -----------------------------------------------------------------------------
   277 // CDownloadsListExecuter::CDownloadsListExecuter
   271 // CDownloadsListExecuter::CDownloadsListExecuter
   278 // -----------------------------------------------------------------------------
   272 // -----------------------------------------------------------------------------
   279 //
   273 //
   280 CDownloadsListExecuter::CDownloadsListExecuter
   274 CDownloadsListExecuter::CDownloadsListExecuter
   281     ( CDownloadMgrUiDownloadsList& aDownloadsList,
   275     ( CDownloadMgrUiDownloadsList& aDownloadsList, 
   282       CDownloadsListExecuter** aReferer,
   276       CDownloadsListExecuter** aReferer, 
   283       RHttpDownload* aHighlightDl )
   277       RHttpDownload* aHighlightDl ) 
   284 :   CActive( CActive::EPriorityHigh ), // EPriorityHigh to be visible ASAP.
   278 :   CActive( CActive::EPriorityHigh ), // EPriorityHigh to be visible ASAP.
   285     iDownloadsList( aDownloadsList ),
   279     iDownloadsList( aDownloadsList ), 
   286     iReferer( aReferer ),
   280     iReferer( aReferer ),
   287     iHighlightDl( aHighlightDl )
   281     iHighlightDl( aHighlightDl )
   288     {
   282     {
   289     CActiveScheduler::Add( this );
   283     CActiveScheduler::Add( this );
   290     }
   284     }
   303 // -----------------------------------------------------------------------------
   297 // -----------------------------------------------------------------------------
   304 //
   298 //
   305 CDownloadsListExecuter* CDownloadsListExecuter::NewL
   299 CDownloadsListExecuter* CDownloadsListExecuter::NewL
   306     ( CDownloadMgrUiDownloadsList& aDownloadsList, CDownloadsListExecuter** aReferer )
   300     ( CDownloadMgrUiDownloadsList& aDownloadsList, CDownloadsListExecuter** aReferer )
   307     {
   301     {
   308     CDownloadsListExecuter* self =
   302     CDownloadsListExecuter* self = 
   309         new (ELeave) CDownloadsListExecuter( aDownloadsList, aReferer, 0 );
   303         new (ELeave) CDownloadsListExecuter( aDownloadsList, aReferer, 0 );
   310     CleanupStack::PushL( self );
   304     CleanupStack::PushL( self );
   311     self->ConstructL();
   305     self->ConstructL();
   312     CleanupStack::Pop();
   306     CleanupStack::Pop();
   313     return self;
   307     return self;
   316 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   317 // CDownloadsListExecuter::NewL
   311 // CDownloadsListExecuter::NewL
   318 // -----------------------------------------------------------------------------
   312 // -----------------------------------------------------------------------------
   319 //
   313 //
   320 CDownloadsListExecuter* CDownloadsListExecuter::NewL
   314 CDownloadsListExecuter* CDownloadsListExecuter::NewL
   321     ( CDownloadMgrUiDownloadsList& aDownloadsList,
   315     ( CDownloadMgrUiDownloadsList& aDownloadsList, 
   322       CDownloadsListExecuter** aReferer,
   316       CDownloadsListExecuter** aReferer, 
   323       RHttpDownload& aHighlightDl )
   317       RHttpDownload& aHighlightDl )
   324     {
   318     {
   325     CDownloadsListExecuter* self =
   319     CDownloadsListExecuter* self = 
   326         new (ELeave) CDownloadsListExecuter
   320         new (ELeave) CDownloadsListExecuter
   327             ( aDownloadsList, aReferer, &aHighlightDl );
   321             ( aDownloadsList, aReferer, &aHighlightDl );
   328     CleanupStack::PushL( self );
   322     CleanupStack::PushL( self );
   329     self->ConstructL();
   323     self->ConstructL();
   330     CleanupStack::Pop();
   324     CleanupStack::Pop();
   384 // -----------------------------------------------------------------------------
   378 // -----------------------------------------------------------------------------
   385 //
   379 //
   386 void CDownloadsListExecuter::ExecuteLD()
   380 void CDownloadsListExecuter::ExecuteLD()
   387     {
   381     {
   388     CLOG_ENTERFN("CDownloadsListExecuter::ExecuteLD");
   382     CLOG_ENTERFN("CDownloadsListExecuter::ExecuteLD");
   389 
   383     
   390     delete iDialog;
   384     delete iDialog;
   391     iDialog = NULL;
   385     iDialog = NULL;
   392     iDialog = CDownloadsListDlg::NewL( iDownloadsList, iProgressiveDownload );
   386     iDialog = CDownloadsListDlg::NewL( iDownloadsList, iProgressiveDownload );
   393     // No leaving functions before ExecuteLD!
   387     // No leaving functions before ExecuteLD!
   394 
   388 
   395     // If there is download that should be highlighted:
   389     // If there is download that should be highlighted:
   396     if ( iHighlightDl )
   390     if ( iHighlightDl )
   397         {
   391         {
   398         iDialog->HighlightDownload( *iHighlightDl );
   392         iDialog->HighlightDownload( *iHighlightDl );
   399         }
   393         }
   400 
   394         
   401     // Execute wait dialog... While it is running, 'this' can be deleted:
   395     // Execute wait dialog... While it is running, 'this' can be deleted:
   402     TBool deleted( EFalse );
   396     TBool deleted( EFalse );
   403     iDeleted = &deleted;
   397     iDeleted = &deleted;
   404     TRAP_IGNORE( iDialog->ExecuteLD() );
   398     TRAP_IGNORE( iDialog->ExecuteLD() );
   405     iDeleted = 0; // No more needed.
   399     iDeleted = 0; // No more needed.
   412         {
   406         {
   413             if( !iDownloadsList.GetDownloadHide() )
   407             if( !iDownloadsList.GetDownloadHide() )
   414                 {
   408                 {
   415                 delete iDialog;
   409                 delete iDialog;
   416                 }
   410                 }
   417 
   411            
   418             iDownloadsList.SetDownloadListHide( EFalse );
   412             iDownloadsList.SetDownloadListHide( EFalse );
   419 
   413       
   420             iDialog = NULL;
   414             iDialog = NULL;
   421             // Reset owner pointer to this object.
   415             // Reset owner pointer to this object.
   422        	    if ( iReferer )
   416        	    if ( iReferer )
   423             {
   417             {
   424             *iReferer = 0;
   418             *iReferer = 0;
   425             CLOG_WRITE(" referer set was to 0");
   419             CLOG_WRITE(" referer set was to 0");
   426             }
   420             }
   427         // and delete this
   421         // and delete this
   428         delete this;
   422         delete this;
   429         }
   423         }
   430 
   424         
   431     CLOG_LEAVEFN("CDownloadsListExecuter::ExecuteLD");
   425     CLOG_LEAVEFN("CDownloadsListExecuter::ExecuteLD");
   432     }
   426     }
   433 
   427 
   434 // -----------------------------------------------------------------------------
   428 // -----------------------------------------------------------------------------
   435 // CDownloadsListExecuter::DoCancel
   429 // CDownloadsListExecuter::DoCancel
   457 // -----------------------------------------------------------------------------
   451 // -----------------------------------------------------------------------------
   458 //
   452 //
   459 TInt CDownloadsListExecuter::RunError(TInt /*aError*/)
   453 TInt CDownloadsListExecuter::RunError(TInt /*aError*/)
   460     {
   454     {
   461     CLOG_ENTERFN("CDownloadsListExecuter::RunError");
   455     CLOG_ENTERFN("CDownloadsListExecuter::RunError");
   462 
   456     
   463     // Reset owner pointer to this object.
   457     // Reset owner pointer to this object.
   464     if ( iReferer )
   458     if ( iReferer )
   465         {
   459         {
   466         *iReferer = 0;
   460         *iReferer = 0;
   467         }
   461         }
   468     delete this;
   462     delete this;
   469 
   463     
   470     CLOG_LEAVEFN("CDownloadsListExecuter::RunError");
   464     CLOG_LEAVEFN("CDownloadsListExecuter::RunError");
   471     return 0;
   465     return 0;
   472     }
   466     }
   473 
   467         
   474 // ============================ MEMBER FUNCTIONS ===============================
   468 // ============================ MEMBER FUNCTIONS ===============================
   475 
   469 
   476 // -----------------------------------------------------------------------------
   470 // -----------------------------------------------------------------------------
   477 // CDownloadsListExtension::CDownloadsListExtension
   471 // CDownloadsListExtension::CDownloadsListExtension
   478 // -----------------------------------------------------------------------------
   472 // -----------------------------------------------------------------------------
   479 //
   473 //
   480 CDownloadsListExtension::CDownloadsListExtension
   474 CDownloadsListExtension::CDownloadsListExtension
   481     ( CDownloadMgrUiDownloadsList& aDownloadsList )
   475     ( CDownloadMgrUiDownloadsList& aDownloadsList ) 
   482 :   iDownloadsList( aDownloadsList ),
   476 :   iDownloadsList( aDownloadsList ),
   483     iIapId( 0 ),
   477     iIapId( 0 ),
   484     iIapIdGotAndSet( ETrue )
   478     iIapIdGotAndSet( ETrue )
   485     {
   479     {
   486     }
   480     }
   500 // -----------------------------------------------------------------------------
   494 // -----------------------------------------------------------------------------
   501 //
   495 //
   502 CDownloadsListExtension* CDownloadsListExtension::NewL
   496 CDownloadsListExtension* CDownloadsListExtension::NewL
   503     ( CDownloadMgrUiDownloadsList& aDownloadsList )
   497     ( CDownloadMgrUiDownloadsList& aDownloadsList )
   504     {
   498     {
   505     CDownloadsListExtension* self =
   499     CDownloadsListExtension* self = 
   506         new (ELeave) CDownloadsListExtension( aDownloadsList );
   500         new (ELeave) CDownloadsListExtension( aDownloadsList );
   507     CleanupStack::PushL( self );
   501     CleanupStack::PushL( self );
   508     self->ConstructL();
   502     self->ConstructL();
   509     CleanupStack::Pop();
   503     CleanupStack::Pop();
   510     return self;
   504     return self;
   579         // Do nothing if visible?
   573         // Do nothing if visible?
   580         CLOG_WRITE(" already visible");
   574         CLOG_WRITE(" already visible");
   581         }
   575         }
   582     else
   576     else
   583         {
   577         {
   584         iDownloadsListExecuter =
   578         iDownloadsListExecuter = 
   585             CDownloadsListExecuter::NewL( iDownloadsList, &iDownloadsListExecuter );
   579             CDownloadsListExecuter::NewL( iDownloadsList, &iDownloadsListExecuter );
   586         iDownloadsListExecuter->ExecuteLD();
   580         iDownloadsListExecuter->ExecuteLD();
   587         }
   581         }
   588 
   582 
   589     CLOG_LEAVEFN("CDownloadsListExtension::DisplayDownloadsListL");
   583     CLOG_LEAVEFN("CDownloadsListExtension::DisplayDownloadsListL");
   602         // Do nothing if visible?
   596         // Do nothing if visible?
   603         CLOG_WRITE(" already visible");
   597         CLOG_WRITE(" already visible");
   604         }
   598         }
   605     else
   599     else
   606         {
   600         {
   607         iDownloadsListExecuter =
   601         iDownloadsListExecuter = 
   608             CDownloadsListExecuter::NewL( iDownloadsList, &iDownloadsListExecuter );
   602             CDownloadsListExecuter::NewL( iDownloadsList, &iDownloadsListExecuter );
   609         iDownloadsListExecuter->Start();
   603         iDownloadsListExecuter->Start();
   610         }
   604         }
   611 
   605 
   612     CLOG_LEAVEFN("CDownloadsListExtension::DisplayDownloadsListAsynchronouslyL");
   606     CLOG_LEAVEFN("CDownloadsListExtension::DisplayDownloadsListAsynchronouslyL");
   688 //
   682 //
   689 void CDownloadsListExtension::StartProgressTimer()
   683 void CDownloadsListExtension::StartProgressTimer()
   690 {
   684 {
   691 	iUpdateProgressInfoTimer->Start(
   685 	iUpdateProgressInfoTimer->Start(
   692 		0,
   686 		0,
   693 		KUpdateProgressInfoInterval,
   687 		KUpdateProgressInfoInterval,  
   694 		TCallBack( UpdateProgressInfoCallback, this ) );
   688 		TCallBack( UpdateProgressInfoCallback, this ) );
   695 }
   689 }
   696 
   690 
   697 
   691 
   698 // -----------------------------------------------------------------------------
   692 // -----------------------------------------------------------------------------
   749     CLOG_WRITE(" iEventHandlerArray");
   743     CLOG_WRITE(" iEventHandlerArray");
   750 	iIsTimerStarted = EFalse;
   744 	iIsTimerStarted = EFalse;
   751 	iProgressiveDownload = EFalse;
   745 	iProgressiveDownload = EFalse;
   752 	iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload);
   746 	iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload);
   753     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL");
   747     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL");
   754 
   748     
   755     //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh
   749     //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh
   756     #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
   750     #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
   757     iPlatformSupportsGallery = ETrue;
   751     iPlatformSupportsGallery = ETrue;
   758     #endif
   752     #endif
   759 
   753   
   760     }
   754     }
   761 
   755 
   762 // -----------------------------------------------------------------------------
   756 // -----------------------------------------------------------------------------
   763 // CDownloadMgrUiDownloadsList::NewL
   757 // CDownloadMgrUiDownloadsList::NewL
   764 // -----------------------------------------------------------------------------
   758 // -----------------------------------------------------------------------------
   765 //
   759 //
   766 CDownloadMgrUiDownloadsList* CDownloadMgrUiDownloadsList::NewL
   760 CDownloadMgrUiDownloadsList* CDownloadMgrUiDownloadsList::NewL
   767 ( CDownloadMgrUiLibRegistry& aRegistryModel )
   761 ( CDownloadMgrUiLibRegistry& aRegistryModel )
   768     {
   762     {
   769     CDownloadMgrUiDownloadsList* self =
   763     CDownloadMgrUiDownloadsList* self = 
   770         new ( ELeave ) CDownloadMgrUiDownloadsList( aRegistryModel );
   764         new ( ELeave ) CDownloadMgrUiDownloadsList( aRegistryModel );
   771     CleanupStack::PushL( self );
   765     CleanupStack::PushL( self );
   772     self->ConstructL();
   766     self->ConstructL();
   773     CleanupStack::Pop();
   767     CleanupStack::Pop();
   774     return self;
   768     return self;
   797     CLOG_WRITE(" iDownloadMenu");
   791     CLOG_WRITE(" iDownloadMenu");
   798     // iExtension should be the last deleted.
   792     // iExtension should be the last deleted.
   799     delete iExtension;
   793     delete iExtension;
   800     iExtension = 0;
   794     iExtension = 0;
   801     CLOG_WRITE(" iExtension");
   795     CLOG_WRITE(" iExtension");
   802     delete iAIWServiceHandler;
   796     delete iAIWServiceHandler; 
   803     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::~CDownloadMgrUiDownloadsList");
   797     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::~CDownloadMgrUiDownloadsList");
   804     }
   798     }
   805 
   799 
   806 // -----------------------------------------------------------------------------
   800 // -----------------------------------------------------------------------------
   807 // CDownloadMgrUiDownloadsList::DownloadMenu
   801 // CDownloadMgrUiDownloadsList::DownloadMenu
   808 // -----------------------------------------------------------------------------
   802 // -----------------------------------------------------------------------------
   809 //
   803 //
   810 EXPORT_C
   804 EXPORT_C 
   811 CDownloadMgrUiDownloadMenu& CDownloadMgrUiDownloadsList::DownloadMenu() const
   805 CDownloadMgrUiDownloadMenu& CDownloadMgrUiDownloadsList::DownloadMenu() const
   812     {
   806     {
   813     __ASSERT_DEBUG( iDownloadMenu, Panic( EUiLibPanNull ) );
   807     __ASSERT_DEBUG( iDownloadMenu, Panic( EUiLibPanNull ) );
   814     return(*iDownloadMenu);
   808     return(*iDownloadMenu);
   815     }
   809     }
   816 
   810 
   817 // -----------------------------------------------------------------------------
   811 // -----------------------------------------------------------------------------
   818 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL
   812 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL
   819 // -----------------------------------------------------------------------------
   813 // -----------------------------------------------------------------------------
   820 //
   814 //
   821 EXPORT_C
   815 EXPORT_C 
   822 void CDownloadMgrUiDownloadsList::DisplayDownloadsListL()
   816 void CDownloadMgrUiDownloadsList::DisplayDownloadsListL()
   823     {
   817     {
   824     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL");
   818     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL");
   825 
   819     
   826     long noMediaDls = 0;
   820     long noMediaDls = 0;
   827     iRegistryModel.DownloadMgr().GetIntAttribute( EDlMgrNoMediaDls, noMediaDls );
   821     iRegistryModel.DownloadMgr().GetIntAttribute( EDlMgrNoMediaDls, noMediaDls );
   828     TInt dlCount = iRegistryModel.DownloadMgr().CurrentDownloads().Count();
   822     TInt dlCount = iRegistryModel.DownloadMgr().CurrentDownloads().Count();
   829 
   823     
   830     if (dlCount > noMediaDls)
   824     if (dlCount > noMediaDls)
   831     	iExtension->DisplayDownloadsListAsynchronouslyL();
   825     	iExtension->DisplayDownloadsListAsynchronouslyL();
   832 
   826     
   833     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL");
   827     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DisplayDownloadsListL");
   834     }
   828     }
   835 
   829 
   836 // -----------------------------------------------------------------------------
   830 // -----------------------------------------------------------------------------
   837 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL
   831 // CDownloadMgrUiDownloadsList::DisplayDownloadsListL
   847 
   841 
   848 // -----------------------------------------------------------------------------
   842 // -----------------------------------------------------------------------------
   849 // CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList
   843 // CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList
   850 // -----------------------------------------------------------------------------
   844 // -----------------------------------------------------------------------------
   851 //
   845 //
   852 EXPORT_C
   846 EXPORT_C 
   853 void CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList()
   847 void CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList()
   854     {
   848     {
   855     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList");
   849     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::CancelDisplayingDownloadsList");
   856     delete iDialog;
   850     delete iDialog;
   857     iDialog = 0;
   851     iDialog = 0;
   862 
   856 
   863 // -----------------------------------------------------------------------------
   857 // -----------------------------------------------------------------------------
   864 // CDownloadMgrUiDownloadsList::IsVisible
   858 // CDownloadMgrUiDownloadsList::IsVisible
   865 // -----------------------------------------------------------------------------
   859 // -----------------------------------------------------------------------------
   866 //
   860 //
   867 EXPORT_C
   861 EXPORT_C 
   868 TBool CDownloadMgrUiDownloadsList::IsVisible() const
   862 TBool CDownloadMgrUiDownloadsList::IsVisible() const
   869     {
   863     {
   870     return iExtension->IsDialogVisible();
   864     return iExtension->IsDialogVisible();
   871     }
   865     }
   872 
   866 
   873 // -----------------------------------------------------------------------------
   867 // -----------------------------------------------------------------------------
   874 // CDownloadMgrUiDownloadsList::Count
   868 // CDownloadMgrUiDownloadsList::Count
   875 // -----------------------------------------------------------------------------
   869 // -----------------------------------------------------------------------------
   876 //
   870 //
   877 EXPORT_C
   871 EXPORT_C 
   878 TInt CDownloadMgrUiDownloadsList::Count() const
   872 TInt CDownloadMgrUiDownloadsList::Count() const
   879     {
   873     {
   880     return ((iListModel!=NULL)?iListModel->Count():0);
   874     return ((iListModel!=NULL)?iListModel->Count():0);
   881     }
   875     }
   882 
   876 
   883 // Not yet supported functions
   877 // Not yet supported functions
   884 EXPORT_C
   878 EXPORT_C 
   885 void CDownloadMgrUiDownloadsList::GetIntAttributeL( const TUint /*aAttribute*/, TInt32& /*aValue*/ )
   879 void CDownloadMgrUiDownloadsList::GetIntAttributeL( const TUint /*aAttribute*/, TInt32& /*aValue*/ )
   886     {
   880     {
   887     User::Leave( KErrNotSupported );
   881     User::Leave( KErrNotSupported );
   888     }
   882     }
   889 
   883     
   890 EXPORT_C
   884 EXPORT_C 
   891 void CDownloadMgrUiDownloadsList::GetBoolAttributeL( const TUint /*aAttribute*/, TBool& /*aValue*/ )
   885 void CDownloadMgrUiDownloadsList::GetBoolAttributeL( const TUint /*aAttribute*/, TBool& /*aValue*/ )
   892     {
   886     {
   893     User::Leave( KErrNotSupported );
   887     User::Leave( KErrNotSupported );
   894     }
   888     }
   895 
   889     
   896 EXPORT_C
   890 EXPORT_C 
   897 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes16& /*aValue*/  )
   891 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes16& /*aValue*/  )
   898     {
   892     {
   899     User::Leave( KErrNotSupported );
   893     User::Leave( KErrNotSupported );
   900     }
   894     }
   901 
   895     
   902 EXPORT_C
   896 EXPORT_C 
   903 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes8& /*aValue*/  )
   897 void CDownloadMgrUiDownloadsList::GetStringAttributeL( const TUint /*aAttribute*/, TDes8& /*aValue*/  )
   904     {
   898     {
   905     User::Leave( KErrNotSupported );
   899     User::Leave( KErrNotSupported );
   906     }
   900     }
   907 
   901     
   908 EXPORT_C
   902 EXPORT_C 
   909 void CDownloadMgrUiDownloadsList::SetIntAttributeL( const TUint /*aAttribute*/, TInt32 /*aValue*/ )
   903 void CDownloadMgrUiDownloadsList::SetIntAttributeL( const TUint /*aAttribute*/, TInt32 /*aValue*/ )
   910     {
   904     {
   911     User::Leave( KErrNotSupported );
   905     User::Leave( KErrNotSupported );
   912     }
   906     }
   913 
   907     
   914 EXPORT_C
   908 EXPORT_C 
   915 void CDownloadMgrUiDownloadsList::SetBoolAttributeL( const TUint /*aAttribute*/, TBool /*aValue*/ )
   909 void CDownloadMgrUiDownloadsList::SetBoolAttributeL( const TUint /*aAttribute*/, TBool /*aValue*/ )
   916     {
   910     {
   917     User::Leave( KErrNotSupported );
   911     User::Leave( KErrNotSupported );
   918     }
   912     }
   919 
   913     
   920 EXPORT_C
   914 EXPORT_C 
   921 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC16& /*aValue*/ )
   915 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC16& /*aValue*/ )
   922     {
   916     {
   923     User::Leave( KErrNotSupported );
   917     User::Leave( KErrNotSupported );
   924     }
   918     }
   925 
   919     
   926 EXPORT_C
   920 EXPORT_C 
   927 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC8& /*aValue*/ )
   921 void CDownloadMgrUiDownloadsList::SetStringAttributeL( const TUint /*aAttribute*/, const TDesC8& /*aValue*/ )
   928     {
   922     {
   929     User::Leave( KErrNotSupported );
   923     User::Leave( KErrNotSupported );
   930     }
   924     }
   931 
   925     
   932 // -----------------------------------------------------------------------------
   926 // -----------------------------------------------------------------------------
   933 // CDownloadMgrUiDownloadsList::AddDownloadsToListModelL
   927 // CDownloadMgrUiDownloadsList::AddDownloadsToListModelL
   934 // -----------------------------------------------------------------------------
   928 // -----------------------------------------------------------------------------
   935 //
   929 //
   936 void CDownloadMgrUiDownloadsList::AddDownloadsToListModelL
   930 void CDownloadMgrUiDownloadsList::AddDownloadsToListModelL
   937 ( CDownloadsListArray& aLBModel, RHttpDownloadMgr& aDownloadMgr )
   931 ( CDownloadsListArray& aLBModel, RHttpDownloadMgr& aDownloadMgr )
   938     {
   932     {
   939     TInt downloads = aDownloadMgr.CurrentDownloads().Count();
   933     TInt downloads = aDownloadMgr.CurrentDownloads().Count();
   940     for ( TInt i = 0; i < downloads; ++i )
   934     for ( TInt i = 0; i < downloads; ++i )
   941         {
   935         {
   942         RHttpDownload* download =
   936         RHttpDownload* download = 
   943             (RHttpDownload*)(aDownloadMgr.CurrentDownloads().At(i));
   937             (RHttpDownload*)(aDownloadMgr.CurrentDownloads().At(i));
   944         // Extract the necessary information from 'download' and
   938         // Extract the necessary information from 'download' and 
   945         // add a list box item.
   939         // add a list box item.
   946         (void)AddDownloadToListModelL( aLBModel, *download );
   940         (void)AddDownloadToListModelL( aLBModel, *download );
   947         }
   941         }
   948     }
   942     }
   949 
   943 
   950 // -----------------------------------------------------------------------------
   944 // -----------------------------------------------------------------------------
   951 // CDownloadMgrUiDownloadsList::AddDownloadToListModelL
   945 // CDownloadMgrUiDownloadsList::AddDownloadToListModelL
   952 // This is a very expensive method, so when updating list box items,
   946 // This is a very expensive method, so when updating list box items, 
   953 // call the less expensive 'update' methods!
   947 // call the less expensive 'update' methods!
   954 // -----------------------------------------------------------------------------
   948 // -----------------------------------------------------------------------------
   955 //
   949 //
   956 TInt CDownloadMgrUiDownloadsList::AddDownloadToListModelL
   950 TInt CDownloadMgrUiDownloadsList::AddDownloadToListModelL
   957     ( CDownloadsListArray& aLBModel, RHttpDownload& aDownload )
   951     ( CDownloadsListArray& aLBModel, RHttpDownload& aDownload )
   965         // It is already on the list - do not add it again.
   959         // It is already on the list - do not add it again.
   966         CLOG_WRITE_FORMAT(" aDownload already on list (%d)",itemIndex);
   960         CLOG_WRITE_FORMAT(" aDownload already on list (%d)",itemIndex);
   967         }
   961         }
   968     else
   962     else
   969         {
   963         {
   970         // Do not add the download to the list if the storage
   964         // Do not add the download to the list if the storage 
   971         // media is not in the device.
   965         // media is not in the device.
   972         TBool noMedia( EFalse );
   966         TBool noMedia( EFalse );
   973         User::LeaveIfError( aDownload.GetBoolAttribute
   967         User::LeaveIfError( aDownload.GetBoolAttribute
   974                           ( EDlAttrNoMedia, noMedia ) );
   968                           ( EDlAttrNoMedia, noMedia ) );
   975         CLOG_WRITE_FORMAT(" EDlAttrNoMedia: %d",noMedia);
   969         CLOG_WRITE_FORMAT(" EDlAttrNoMedia: %d",noMedia);
   976         // Do not add the download to the list if it is hidden
   970         // Do not add the download to the list if it is hidden
   977         TBool isHidden( EFalse );
   971         TBool isHidden( EFalse );
   978         User::LeaveIfError( aDownload.GetBoolAttribute
   972         User::LeaveIfError( aDownload.GetBoolAttribute
   979                           ( EDlAttrHidden, isHidden ) );
   973                           ( EDlAttrHidden, isHidden ) );
   980         CLOG_WRITE_FORMAT(" EDlAttrHidden: %d",isHidden);
   974         CLOG_WRITE_FORMAT(" EDlAttrHidden: %d",isHidden);
   981 
   975         
   982         if ( noMedia || isHidden )
   976         if ( noMedia || isHidden )
   983             {
   977             {
   984             // Do not add it to the list - hide it from the user.
   978             // Do not add it to the list - hide it from the user.
   985             }
   979             }
   986         else
   980         else
   989             // Quite big structure, allocate it on the heap!
   983             // Quite big structure, allocate it on the heap!
   990             TDownloadUiData* dlData = new (ELeave) TDownloadUiData;
   984             TDownloadUiData* dlData = new (ELeave) TDownloadUiData;
   991             CleanupStack::PushL( dlData );
   985             CleanupStack::PushL( dlData );
   992 
   986 
   993             TInt err(KErrNone);
   987             TInt err(KErrNone);
   994 
   988             
   995             //      Get progress info
   989             //      Get progress info
   996             err = aDownload.GetIntAttribute
   990             err = aDownload.GetIntAttribute
   997                 ( EDlAttrState, dlData->iDownloadState );
   991                 ( EDlAttrState, dlData->iDownloadState );
   998             CLOG_WRITE_FORMAT(" EDlAttrState err: %d",err);
   992             CLOG_WRITE_FORMAT(" EDlAttrState err: %d",err);
   999             User::LeaveIfError( err );
   993             User::LeaveIfError( err );
  1000 
   994             
  1001             //Changes for the bug JERI-7P8CF2
   995             //Changes for the bug JERI-7P8CF2
  1002             //Changes made in the server side to fix the video center receiving unexpected events
   996             //Changes made in the server side to fix the video center receiving unexpected events
  1003             //Reassigning these events back to the changes done in server side
   997             //Reassigning these events back to the changes done in server side
  1004             if(dlData->iDownloadState  == EHttpDlCompleted )
   998             if(dlData->iDownloadState  == EHttpDlCompleted )
  1005 		        {
   999 		        {
  1019             CLOG_WRITE_FORMAT(" EDlAttrLength err: %d",err);
  1013             CLOG_WRITE_FORMAT(" EDlAttrLength err: %d",err);
  1020             if ( err != KErrNone && err != KErrNotFound )
  1014             if ( err != KErrNone && err != KErrNotFound )
  1021                 {
  1015                 {
  1022                 User::LeaveIfError( err );
  1016                 User::LeaveIfError( err );
  1023                 }
  1017                 }
  1024 
  1018             
  1025             // Number of media objects in download ( inalbum)?
  1019             // Number of media objects in download ( inalbum)?
  1026             err = aDownload.GetIntAttribute
  1020             err = aDownload.GetIntAttribute
  1027                 ( EDlAttrNumMediaObjects, dlData->iNumMediaObjects );
  1021                 ( EDlAttrNumMediaObjects, dlData->iNumMediaObjects );
  1028             CLOG_WRITE_FORMAT(" EDlAttrNumMediaObjects err: %d",err);
  1022             CLOG_WRITE_FORMAT(" EDlAttrNumMediaObjects err: %d",err);
  1029             User::LeaveIfError( err );
  1023             User::LeaveIfError( err );
  1030 
  1024             
  1031             //      Get file name
  1025             //      Get file name
  1032             // In case of album - if download is complete, query album name,
  1026             // In case of album - if download is complete, query album name, 
  1033             // otherwise query track name
  1027             // otherwise query track name                
  1034             if ((dlData->iNumMediaObjects > 1) &&
  1028             if ((dlData->iNumMediaObjects > 1) &&
  1035                 (EHttpDlMultipleMOCompleted == dlData->iDownloadState))
  1029                 (EHttpDlMultipleMOCompleted == dlData->iDownloadState))
  1036                 {
  1030                 {
  1037                 err = aDownload.GetStringAttribute
  1031                 err = aDownload.GetStringAttribute
  1038                     ( EDlAttrAlbumName, dlData->iName );
  1032                     ( EDlAttrAlbumName, dlData->iName );
  1039                 CLOG_WRITE_FORMAT(" EDlAttrAlbumName err: %d",err);
  1033                 CLOG_WRITE_FORMAT(" EDlAttrAlbumName err: %d",err);    
  1040                 }
  1034                 }
  1041             else
  1035             else
  1042                 {
  1036                 {
  1043                 err = aDownload.GetStringAttribute
  1037                 err = aDownload.GetStringAttribute
  1044                     ( EDlAttrName, dlData->iName );
  1038                     ( EDlAttrName, dlData->iName );
  1045                 CLOG_WRITE_FORMAT(" EDlAttrName err: %d",err);
  1039                 CLOG_WRITE_FORMAT(" EDlAttrName err: %d",err);
  1046                 }
  1040                 }
  1047 
  1041                 
  1048             if ( err != KErrNone && err != KErrNotFound )
  1042             if ( err != KErrNone && err != KErrNotFound )
  1049                 {
  1043                 {
  1050                 User::LeaveIfError( err );
  1044                 User::LeaveIfError( err );
  1051                 }
  1045                 }
  1052             CLOG_WRITE_FORMAT(" EDlAttrName: %S",&(dlData->iName));
  1046             CLOG_WRITE_FORMAT(" EDlAttrName: %S",&(dlData->iName));
  1053 
  1047             
  1054             // If download name is empty, use the file name got from URI
  1048             // If download name is empty, use the file name got from URI
  1055             if ( dlData->iName.Length() == 0 )
  1049             if ( dlData->iName.Length() == 0 )
  1056                 {
  1050                 {
  1057                 HBufC* url = HBufC::NewLC( KMaxUrlLength );
  1051                 HBufC* url = HBufC::NewLC( KMaxUrlLength );
  1058                 TPtr urlPtr = url->Des();
  1052                 TPtr urlPtr = url->Des();
  1112 
  1106 
  1113             // Is the download pausable?
  1107             // Is the download pausable?
  1114             User::LeaveIfError( aDownload.GetBoolAttribute
  1108             User::LeaveIfError( aDownload.GetBoolAttribute
  1115                 ( EDlAttrPausable, dlData->iPausable ) );
  1109                 ( EDlAttrPausable, dlData->iPausable ) );
  1116             CLOG_WRITE_FORMAT(" EDlAttrPausable: %d",dlData->iPausable);
  1110             CLOG_WRITE_FORMAT(" EDlAttrPausable: %d",dlData->iPausable);
  1117 
  1111     
  1118             // Is the download on an external/removable memory (like MMC)?
  1112             // Is the download on an external/removable memory (like MMC)?
  1119             err = aDownload.GetBoolAttribute
  1113             err = aDownload.GetIntAttribute
  1120                 ( EDlAttrDestRemovable, dlData->iIsOnExternalMemory );
  1114                 ( EDlAttrDestRemovable, dlData->iExternalMemoryStatus );
  1121             CLOG_WRITE_FORMAT(" EDlAttrDestRemovable err: %d",err);
  1115             CLOG_WRITE_FORMAT(" EDlAttrDestRemovable err: %d",err);
  1122             // 'err' is ignored.
  1116             // 'err' is ignored.
  1123             CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData->iIsOnExternalMemory);
  1117             CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData->iExternalMemoryStatus);
  1124 
  1118 
  1125             // Currently active media object's index (in album)?
  1119             // Currently active media object's index (in album)?
  1126             err = aDownload.GetIntAttribute
  1120             err = aDownload.GetIntAttribute
  1127                 ( EDlAttrActiveDownload, dlData->iActiveMoIndex );
  1121                 ( EDlAttrActiveDownload, dlData->iActiveMoIndex );
  1128             CLOG_WRITE_FORMAT(" EDlAttrActiveDownload err: %d",err);
  1122             CLOG_WRITE_FORMAT(" EDlAttrActiveDownload err: %d",err);
  1129             User::LeaveIfError( err );
  1123             User::LeaveIfError( err );
  1130 
  1124     
  1131             // First add the handler app's icon to model, so that we then
  1125             // First add the handler app's icon to model, so that we then 
  1132             // know the index of it that can then be set in the item text,
  1126             // know the index of it that can then be set in the item text, 
  1133             // which is then also added to the model.
  1127             // which is then also added to the model.
  1134             dlData->iIconIndex =
  1128             dlData->iIconIndex = 
  1135                 iListModel->AddHandlerAppIconL( dlData->iContentType );
  1129                 iListModel->AddHandlerAppIconL( dlData->iContentType );
  1136             CLOG_WRITE(" AddHandlerAppIconL OK");
  1130             CLOG_WRITE(" AddHandlerAppIconL OK");
  1137 
  1131 
  1138             // Add now the structure to the model:
  1132             // Add now the structure to the model:
  1139             itemIndex = aLBModel.AppendL( *dlData, aDownload );
  1133             itemIndex = aLBModel.AppendL( *dlData, aDownload );
  1178                 iListModel->Delete( index );
  1172                 iListModel->Delete( index );
  1179                 }
  1173                 }
  1180             else
  1174             else
  1181                 {
  1175                 {
  1182                 iListModel->Delete( index );
  1176                 iListModel->Delete( index );
  1183 
  1177                               
  1184                 // Update view
  1178                 // Update view
  1185                 if ( iExtension->IsDialogVisible() )
  1179                 if ( iExtension->IsDialogVisible() )
  1186                     {
  1180                     {
  1187                     iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadRemoved, index );
  1181                     iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadRemoved, index );
  1188                     CLOG_WRITE(" HandleModelChangeL OK");
  1182                     CLOG_WRITE(" HandleModelChangeL OK");
  1189                     }
  1183                     }
  1190                 }
  1184                 }
  1191             }
  1185             }
  1192         }
  1186         }
  1193 
  1187     
  1194     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DeleteDownloadL");
  1188     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DeleteDownloadL");
  1195     }
  1189     }
  1196 
  1190 
  1197 // -----------------------------------------------------------------------------
  1191 // -----------------------------------------------------------------------------
  1198 // CDownloadMgrUiDownloadsList::DeleteDownloadL
  1192 // CDownloadMgrUiDownloadsList::DeleteDownloadL
  1199 // -----------------------------------------------------------------------------
  1193 // -----------------------------------------------------------------------------
  1200 //
  1194 //
  1201 TBool CDownloadMgrUiDownloadsList::IsOneProgressive()
  1195 TBool CDownloadMgrUiDownloadsList::IsOneProgressive()
  1202    {
  1196    {
  1203    TBool anyOneProgress = EFalse;
  1197    TBool anyOneProgress = EFalse; 
  1204    if (iListModel == NULL)
  1198    if (iListModel == NULL)
  1205       {
  1199       {
  1206    	  return EFalse;
  1200    	  return EFalse; 
  1207       }
  1201       }
  1208    else
  1202    else 
  1209       {
  1203       {
  1210       TInt count = Count();
  1204       TInt count = Count(); 
  1211       for ( TInt i = 0; i < count; ++i )
  1205       for ( TInt i = 0; i < count; ++i )
  1212          {
  1206          {
  1213       	 RHttpDownload& download = iListModel->Download(i);
  1207       	 RHttpDownload& download = iListModel->Download(i); 
  1214          TInt err = download.GetBoolAttribute( EDlAttrProgressive, anyOneProgress );
  1208          TInt err = download.GetBoolAttribute( EDlAttrProgressive, anyOneProgress );
  1215           // If there is a COD download and check if it is attached. Then set it as attached while resuming
  1209           // If there is a COD download and check if it is attached. Then set it as attached while resuming
  1216          TBool isCodDownload;
  1210          TBool isCodDownload;
  1217          download.GetBoolAttribute(EDlAttrCodDownload,isCodDownload);
  1211          download.GetBoolAttribute(EDlAttrCodDownload,isCodDownload);
  1218          if(isCodDownload && anyOneProgress )
  1212          if(isCodDownload && anyOneProgress )
  1220             download.SetBoolAttribute( EDlAttrProgressive, ETrue );
  1214             download.SetBoolAttribute( EDlAttrProgressive, ETrue );
  1221             }
  1215             }
  1222          THttpProgressState state;
  1216          THttpProgressState state;
  1223          if( anyOneProgress )
  1217          if( anyOneProgress )
  1224          	{
  1218          	{
  1225          	download.GetIntAttribute(EDlAttrProgressState, (TInt32&)state);
  1219          	download.GetIntAttribute(EDlAttrProgressState, (TInt32&)state);	
  1226          	if(state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1220          	if(state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1227          	    {
  1221          	    {
  1228          	    anyOneProgress = 0;//once the move() has happened the progressive Download is finished
  1222          	    anyOneProgress = 0;//once the move() has happened the progressive Download is finished
  1229          	    }                  //and we can  bring MP to foreground and start another PD
  1223          	    }                  //and we can  bring MP to foreground and start another PD 
  1230            	}
  1224            	}	
  1231          CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err);
  1225          CLOG_WRITE_FORMAT(" EDlAttrProgressive err: %d",err);
  1232          if ( anyOneProgress )
  1226          if ( anyOneProgress ) 
  1233             return ETrue;
  1227             return ETrue;      	 
  1234          }
  1228          }
  1235       }
  1229       }
  1236    return anyOneProgress;
  1230    return anyOneProgress; 
  1237    }
  1231    }
  1238 
  1232 
  1239 
  1233         
  1240 // -----------------------------------------------------------------------------
  1234 // -----------------------------------------------------------------------------
  1241 // CDownloadMgrUiDownloadsList::NewDownloadCreatedL
  1235 // CDownloadMgrUiDownloadsList::NewDownloadCreatedL
  1242 // -----------------------------------------------------------------------------
  1236 // -----------------------------------------------------------------------------
  1243 //
  1237 //
  1244 void CDownloadMgrUiDownloadsList::NewDownloadCreatedL( RHttpDownload& aDownload )
  1238 void CDownloadMgrUiDownloadsList::NewDownloadCreatedL( RHttpDownload& aDownload )
  1259     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanProgressNotVisible ) );
  1253     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanProgressNotVisible ) );
  1260     // Update the download progress info at the current index.
  1254     // Update the download progress info at the current index.
  1261     // First find the current download in the model.
  1255     // First find the current download in the model.
  1262     TInt index(0);
  1256     TInt index(0);
  1263     TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index );
  1257     TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index );
  1264     if ( !dlDataPtr )
  1258     if ( !dlDataPtr || dlDataPtr->iDownloadState == EHttpDlCompleted )
  1265         {
  1259         {
  1266         // do nothing
  1260          /*
       
  1261           For download completed do not update any thing in UI list.Download was small and may
       
  1262           have completed before you could recieve progress notification        
       
  1263           
       
  1264           do nothing 
       
  1265           */ 
  1267         }
  1266         }
  1268     else
  1267     else
  1269         {
  1268         {
  1270         // Create a local copy
  1269         // Create a local copy
  1271         TDownloadUiData dlData = *dlDataPtr;
  1270         TDownloadUiData dlData = *dlDataPtr;
  1272 
  1271         
  1273         // Track changed? We need to change icon of new track
  1272         // Track changed? We need to change icon of new track
  1274         TInt32 moIndex(0);
  1273         TInt32 moIndex(0);
  1275         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) );
  1274         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, moIndex ) );
  1276         TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex);
  1275         TBool activeIndexChanged = (dlData.iActiveMoIndex != moIndex);
  1277 
  1276         
  1278         // Update download state - this must always be done!
  1277         // Update download state - this must always be done!
  1279         dlData.iDownloadState = aEvent.iDownloadState;
  1278         dlData.iDownloadState = aEvent.iDownloadState;
  1280 		dlData.iProgressState = aEvent.iProgressState;
  1279 		dlData.iProgressState = aEvent.iProgressState;
  1281 		dlData.iActiveMoIndex = moIndex;
  1280 		dlData.iActiveMoIndex = moIndex;
  1282         aDownload.GetStringAttribute( EDlAttrName, dlData.iName );
  1281         aDownload.GetStringAttribute( EDlAttrName, dlData.iName );
  1283         // Permanent redirection changes the filename.
  1282         // Permanent redirection changes the filename.
  1284         if ( aEvent.iProgressState == EHttpProgRedirectedPermanently ||
  1283         if ( aEvent.iProgressState == EHttpProgRedirectedPermanently || 
  1285              aEvent.iProgressState == EHttpProgRedirectedTemporarily )
  1284              aEvent.iProgressState == EHttpProgRedirectedTemporarily )
  1286             {
  1285             {
  1287             CLOG_WRITE(" Redirection");
  1286             CLOG_WRITE(" Redirection");
  1288             }
  1287             }
  1289         else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived )
  1288         else if ( aEvent.iProgressState == EHttpProgResponseHeaderReceived )
  1290         	{
  1289                 {
  1291             // Is the download on an external/removable memory (like MMC)?
  1290                 // Is the download on an external/removable memory (like MMC)?
  1292             aDownload.GetBoolAttribute
  1291                 // Return value is ignored.
  1293                 ( EDlAttrDestRemovable, dlData.iIsOnExternalMemory );
  1292                 aDownload.GetIntAttribute( EDlAttrDestRemovable, dlData.iExternalMemoryStatus );
  1294             // Return value is ignored.
  1293                 CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iExternalMemoryStatus);
  1295             CLOG_WRITE_FORMAT(" EDlAttrDestRemovable: %d",dlData.iIsOnExternalMemory);
  1294                 }
  1296         	}
       
  1297         else if ( aEvent.iProgressState == EHttpProgDlNameChanged )
  1295         else if ( aEvent.iProgressState == EHttpProgDlNameChanged )
  1298             {
  1296             {
  1299             CLOG_WRITE(" EHttpProgDlNameChanged");
  1297             CLOG_WRITE(" EHttpProgDlNameChanged");
  1300             }
  1298             }
  1301 
  1299         
  1302         if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged )
  1300         if (( aEvent.iProgressState == EHttpProgContentTypeChanged ) || activeIndexChanged )
  1303             {
  1301             {
  1304             // Update handler application icon
  1302             // Update handler application icon
  1305             // Also update the content type, because the handler application
  1303             // Also update the content type, because the handler application 
  1306             // icon depends from this.
  1304             // icon depends from this.
  1307             CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex);
  1305             CLOG_WRITE_FORMAT(" EHttpProgContentTypeChanged: ActiveIndex - %d",dlData.iActiveMoIndex);
  1308             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue );
  1306             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue );
  1309             // Not pushed to cleanup stack - unnecessary.
  1307             // Not pushed to cleanup stack - unnecessary.
  1310             // There is a limit for dlData.iContentType
  1308             // There is a limit for dlData.iContentType
  1320             delete contentType;
  1318             delete contentType;
  1321             contentType = 0;
  1319             contentType = 0;
  1322             dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType );
  1320             dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType );
  1323             }
  1321             }
  1324         // Update the progress info.
  1322         // Update the progress info.
  1325         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrDownloadedSize,
  1323         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrDownloadedSize, 
  1326                                                        dlData.iDownloadedSize ) );
  1324                                                        dlData.iDownloadedSize ) );
  1327         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrLength,
  1325         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrLength, 
  1328                                                        dlData.iFullSize ) );
  1326                                                        dlData.iFullSize ) );
  1329         // Update the download ui data in the 'model'.
  1327         // Update the download ui data in the 'model'.
  1330         iListModel->UpdateL( index, dlData );
  1328         iListModel->UpdateL( index, dlData );
  1331         // Update the 'view'
  1329         // Update the 'view'
  1332         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1330         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1339 //
  1337 //
  1340 void CDownloadMgrUiDownloadsList::DownloadPausedL
  1338 void CDownloadMgrUiDownloadsList::DownloadPausedL
  1341     ( RHttpDownload& aDownload, THttpDownloadEvent aEvent )
  1339     ( RHttpDownload& aDownload, THttpDownloadEvent aEvent )
  1342     {
  1340     {
  1343     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DownloadPausedL");
  1341     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DownloadPausedL");
  1344 
  1342     
  1345     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanPausedNotVisible ) );
  1343     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanPausedNotVisible ) );
  1346     // First find the current download in the model.
  1344     // First find the current download in the model.
  1347     TInt index(0);
  1345     TInt index(0);
  1348     TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index );
  1346     TDownloadUiData* dlDataPtr = FindDlUiData( *iListModel, aDownload, index );
  1349     if ( !dlDataPtr )
  1347     if ( !dlDataPtr )
  1358         // Update download state - this must always be done!
  1356         // Update download state - this must always be done!
  1359         dlData.iDownloadState = aEvent.iDownloadState;
  1357         dlData.iDownloadState = aEvent.iDownloadState;
  1360 		dlData.iProgressState = aEvent.iProgressState;
  1358 		dlData.iProgressState = aEvent.iProgressState;
  1361 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1359 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1362 		aDownload.GetStringAttribute( EDlAttrName, dlData.iName );
  1360 		aDownload.GetStringAttribute( EDlAttrName, dlData.iName );
  1363         // Here we have to initialize the full size, if the
  1361         // Here we have to initialize the full size, if the 
  1364         // content-type header arrives!!
  1362         // content-type header arrives!!
  1365         if ( aEvent.iProgressState == EHttpContentTypeReceived )
  1363         if ( aEvent.iProgressState == EHttpContentTypeReceived )
  1366             {
  1364             {
  1367             TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize );
  1365             TInt err = aDownload.GetIntAttribute( EDlAttrLength, dlData.iFullSize );
  1368             if ( err != KErrNone && err != KErrNotFound )
  1366             if ( err != KErrNone && err != KErrNotFound )
  1369                 {
  1367                 {
  1370                 User::LeaveIfError( err );
  1368                 User::LeaveIfError( err );
  1371                 }
  1369                 }
  1372 
  1370 
  1373             // Also update the content type, because the handler application
  1371             // Also update the content type, because the handler application 
  1374             // icon depends from this.
  1372             // icon depends from this.
  1375             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue );
  1373             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue );
  1376             // Not pushed to cleanup stack - unnecessary.
  1374             // Not pushed to cleanup stack - unnecessary.
  1377             // There is a limit for dlData.iContentType
  1375             // There is a limit for dlData.iContentType
  1378             if ( contentType->Length() > KMaxContentTypeLength )
  1376             if ( contentType->Length() > KMaxContentTypeLength )
  1387             delete contentType;
  1385             delete contentType;
  1388             contentType = 0;
  1386             contentType = 0;
  1389             dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType );
  1387             dlData.iIconIndex = iListModel->AddHandlerAppIconL( dlData.iContentType );
  1390             }
  1388             }
  1391 
  1389 
  1392         // Update downloaded size (introduced, because for non-pausable downloads
  1390         // Update downloaded size (introduced, because for non-pausable downloads 
  1393         // paused command sets downloaded size back to 0 kB).
  1391         // paused command sets downloaded size back to 0 kB).
  1394         User::LeaveIfError( aDownload.GetIntAttribute
  1392         User::LeaveIfError( aDownload.GetIntAttribute
  1395                           ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) );
  1393                           ( EDlAttrDownloadedSize, dlData.iDownloadedSize ) );
  1396 
  1394         
  1397         // Update the download ui data in the 'model'.
  1395         // Update the download ui data in the 'model'.
  1398         iListModel->UpdateL( index, dlData );
  1396         iListModel->UpdateL( index, dlData );
  1399         // Update the 'view'
  1397         // Update the 'view'
  1400         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1398         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1401         // Also need to update the middle softkey
  1399         // Also need to update the middle softkey 
  1402         iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL();
  1400         iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL();        
  1403         }
  1401         }
  1404 
  1402     
  1405     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL");
  1403     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DownloadPausedL");
  1406     }
  1404     }
  1407 
  1405 
  1408 // -----------------------------------------------------------------------------
  1406 // -----------------------------------------------------------------------------
  1409 // CDownloadMgrUiDownloadsList::DownloadCompletedL
  1407 // CDownloadMgrUiDownloadsList::DownloadCompletedL
  1428         TDownloadUiData dlData = *dlDataPtr;
  1426         TDownloadUiData dlData = *dlDataPtr;
  1429         // Update download state - this must always be done!
  1427         // Update download state - this must always be done!
  1430         dlData.iDownloadState = aEvent.iDownloadState;
  1428         dlData.iDownloadState = aEvent.iDownloadState;
  1431 		dlData.iProgressState = aEvent.iProgressState;
  1429 		dlData.iProgressState = aEvent.iProgressState;
  1432 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1430 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1433 
  1431 		
  1434 		// In case of Album download, change the name to Album name
  1432 		// In case of Album download, change the name to Album name
  1435 		if (dlData.iNumMediaObjects > 1)
  1433 		if (dlData.iNumMediaObjects > 1)
  1436 		    {
  1434 		    {
  1437 		    aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName );
  1435 		    aDownload.GetStringAttribute( EDlAttrAlbumName, dlData.iName );
  1438 		    }
  1436 		    }
  1439 		else if (dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged)
  1437 		else if ( !(dlData.iProgressState == EHttpProgContentFileMoved) || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged)
  1440 			// Filename changed, get the updated filename
  1438 			// Filename changed, get the updated filename
  1441 		    {
  1439 		    {
  1442 			CLOG_WRITE(" EHttpProgDlNameChanged");
  1440 			CLOG_WRITE(" EHttpProgDlNameChanged");
  1443  	        aDownload.GetStringAttribute( EDlAttrName, dlData.iName );
  1441  	        aDownload.GetStringAttribute( EDlAttrName, dlData.iName ); 
  1444 		    }
  1442 		    }
  1445 
  1443 
  1446         __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted,
  1444         __ASSERT_DEBUG( aEvent.iDownloadState == EHttpDlMultipleMOCompleted, 
  1447                         Panic( EUiLibPanDlStateNotCompleted ) );
  1445                         Panic( EUiLibPanDlStateNotCompleted ) );
  1448 
  1446         
  1449         if( dlData.iProgressState == EHttpProgContentFileMoved  || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
  1447         if( dlData.iProgressState == EHttpProgContentFileMoved  || dlData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
  1450            {
  1448            {
       
  1449             aDownload.GetIntAttribute( EDlAttrDestRemovable, dlData.iExternalMemoryStatus );
  1451             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex );
  1450             HBufC8* contentType = iUiUtils->ContentTypeL( aDownload, ETrue, KFirstMoIndex );
  1452             if ( contentType->Length() > KMaxContentTypeLength )
  1451             if ( contentType->Length() > KMaxContentTypeLength )
  1453                 {
  1452                 {
  1454                 // What can we do? Use an empty mime string.
  1453                 // What can we do? Use an empty mime string.
  1455                 CLOG_WRITE_FORMAT(" Length overflow: %d",contentType->Length());
  1454                 CLOG_WRITE_FORMAT(" Length overflow: %d",contentType->Length());
  1457                 contentType = 0;
  1456                 contentType = 0;
  1458                 contentType = KNullDesC8().AllocL();
  1457                 contentType = KNullDesC8().AllocL();
  1459                 }
  1458                 }
  1460             dlData.iContentType.Copy( *contentType );
  1459             dlData.iContentType.Copy( *contentType );
  1461             delete contentType;
  1460             delete contentType;
  1462             dlData.iIconIndex =
  1461             dlData.iIconIndex = 
  1463                 iListModel->AddHandlerAppIconL( dlData.iContentType );
  1462                 iListModel->AddHandlerAppIconL( dlData.iContentType );  
  1464 
  1463             
  1465             }
  1464             }
  1466         // Unnecessary to update dlData.iDownloadedSize, as it is not displayed.
  1465         // Unnecessary to update dlData.iDownloadedSize, as it is not displayed.
  1467         // Update the download ui data in the 'model'.
  1466         // Update the download ui data in the 'model'.
  1468         iListModel->UpdateL( index, dlData );
  1467         iListModel->UpdateL( index, dlData );
  1469         // Update the 'view'
  1468         // Update the 'view'
  1470         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1469         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1471         // Also need to update the middle softkey
  1470         // Also need to update the middle softkey 
  1472         iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL();
  1471         iExtension->DlExecuter().Dialog().HandleMiddleSoftKeyChangeL();
  1473         }
  1472         }
  1474     }
  1473     }
  1475 
  1474 
  1476 // -----------------------------------------------------------------------------
  1475 // -----------------------------------------------------------------------------
  1498         dlData.iDownloadState = aEvent.iDownloadState;
  1497         dlData.iDownloadState = aEvent.iDownloadState;
  1499 		dlData.iProgressState = aEvent.iProgressState;
  1498 		dlData.iProgressState = aEvent.iProgressState;
  1500 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1499 		User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrActiveDownload, dlData.iActiveMoIndex ) );
  1501 
  1500 
  1502         // By default, update the progress info. Only the downloaded size changes.
  1501         // By default, update the progress info. Only the downloaded size changes.
  1503         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrDownloadedSize,
  1502         User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrDownloadedSize, 
  1504                                                        dlData.iDownloadedSize ) );
  1503                                                        dlData.iDownloadedSize ) );
  1505         // Update the download ui data in the 'model'.
  1504         // Update the download ui data in the 'model'.
  1506         iListModel->UpdateL( index, dlData );
  1505         iListModel->UpdateL( index, dlData );
  1507         // Update the 'view'
  1506         // Update the 'view'
  1508         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1507         iExtension->DlExecuter().Dialog().HandleModelChangeL( EDownloadChanged, index );
  1532         dlData.iPausable = aPausable;
  1531         dlData.iPausable = aPausable;
  1533         // Update the download ui data in the 'model'.
  1532         // Update the download ui data in the 'model'.
  1534         iListModel->UpdateL( index, dlData );
  1533         iListModel->UpdateL( index, dlData );
  1535         }
  1534         }
  1536     }
  1535     }
  1537 
  1536     
  1538 // -----------------------------------------------------------------------------
  1537 // -----------------------------------------------------------------------------
  1539 // CDownloadMgrUiDownloadsList::HideMenu
  1538 // CDownloadMgrUiDownloadsList::HideMenu
  1540 // -----------------------------------------------------------------------------
  1539 // -----------------------------------------------------------------------------
  1541 //
  1540 //
  1542 void CDownloadMgrUiDownloadsList::HideMenu()
  1541 void CDownloadMgrUiDownloadsList::HideMenu()
  1577             {
  1576             {
  1578 				// Update progress info every KUpdateProgressInfoInterval
  1577 				// Update progress info every KUpdateProgressInfoInterval
  1579 				if (!iIsTimerStarted )
  1578 				if (!iIsTimerStarted )
  1580                 {
  1579                 {
  1581 					iIsTimerStarted = ETrue;
  1580 					iIsTimerStarted = ETrue;
  1582 					// start the timer.
  1581 					// start the timer. 
  1583 					iExtension->StartProgressTimer();
  1582 					iExtension->StartProgressTimer();
  1584                 }
  1583                 }
  1585 
  1584 
  1586 				if (iExtension->iIsUpdateInfoAllowed)
  1585 				if (iExtension->iIsUpdateInfoAllowed)
  1587                 {
  1586                 {
  1610             }
  1609             }
  1611 
  1610 
  1612         case EHttpDlMoved:
  1611         case EHttpDlMoved:
  1613             {
  1612             {
  1614             // Download moved to this session.
  1613             // Download moved to this session.
  1615             // Add it to the list
  1614             // Add it to the list 
  1616             NewDownloadCreatedL( aDownload );
  1615             NewDownloadCreatedL( aDownload );
  1617             break;
  1616             break;
  1618             }
  1617             }
  1619 
  1618 
  1620         case EHttpDlMediaRemoved:
  1619         case EHttpDlMediaRemoved:
  1621             {
  1620             {
  1622             // Remove the download from the list
  1621             // Remove the download from the list
  1623             DeleteDownloadL( aDownload );
  1622             DeleteDownloadL( aDownload );
  1624             break;
  1623             break;
  1625             }
  1624             }
  1626 
  1625             
  1627         case EHttpDlMediaInserted:
  1626         case EHttpDlMediaInserted:
  1628             {
  1627             {
  1629             // Add new download to the list
  1628             // Add new download to the list
  1630             NewDownloadCreatedL( aDownload );
  1629             NewDownloadCreatedL( aDownload );
  1631             break;
  1630             break;
  1632             }
  1631             }
  1633 
  1632             
  1634         case EHttpDlPausable:
  1633         case EHttpDlPausable:
  1635         case EHttpDlNonPausable:
  1634         case EHttpDlNonPausable:
  1636             {
  1635             {
  1637             // Update the download UI data
  1636             // Update the download UI data
  1638             PauseableStateChangedL( aDownload, aEvent.iDownloadState==EHttpDlPausable );
  1637             PauseableStateChangedL( aDownload, aEvent.iDownloadState==EHttpDlPausable );
  1688 // -----------------------------------------------------------------------------
  1687 // -----------------------------------------------------------------------------
  1689 //
  1688 //
  1690 void CDownloadMgrUiDownloadsList::PreLayoutDynInitL( CDownloadsListDlg& aDialog )
  1689 void CDownloadMgrUiDownloadsList::PreLayoutDynInitL( CDownloadsListDlg& aDialog )
  1691     {
  1690     {
  1692     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::PreLayoutDynInitL");
  1691     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::PreLayoutDynInitL");
  1693 
  1692     
  1694     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) );
  1693     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) );
  1695 
  1694     
  1696     delete iListModel;
  1695     delete iListModel;
  1697     iListModel = NULL;
  1696     iListModel = NULL;
  1698     iListModel = CDownloadsListArray::NewL();
  1697     iListModel = CDownloadsListArray::NewL();
  1699     CLOG_WRITE(" NewL OK");
  1698     CLOG_WRITE(" NewL OK");
  1700 
  1699 
  1728     if ( aiwServiceId != KAiwCmdNone )
  1727     if ( aiwServiceId != KAiwCmdNone )
  1729         {
  1728         {
  1730         HandleAIWCommandL(aCommandId, currDownload);
  1729         HandleAIWCommandL(aCommandId, currDownload);
  1731         return;
  1730         return;
  1732         }
  1731         }
  1733 
  1732         
  1734     switch ( aCommandId )
  1733     switch ( aCommandId )
  1735         {
  1734         {
  1736         case EAknSoftkeyOpen: // handle middlesoft key
  1735         case EAknSoftkeyOpen: // handle middlesoft key 
  1737             {
  1736             {
  1738             // First close the downloads list.
  1737             // First close the downloads list.
  1739             CancelDisplayingDownloadsList();
  1738             CancelDisplayingDownloadsList();
  1740             CLOG_WRITE(" CancelDisplayingDownloadsList OK");
  1739             CLOG_WRITE(" CancelDisplayingDownloadsList OK");
  1741 
  1740 
  1742 			if(iProgressiveDownload)
  1741 			if(iProgressiveDownload)
  1743 			{
  1742 			{
  1744             // check if it's pd supported
  1743             // check if it's pd supported 
  1745             TBool isPdSupported = EFalse;
  1744             TBool isPdSupported = EFalse; 
  1746             // Get the PD player application's UID for the download
  1745             // Get the PD player application's UID for the download
  1747             TUid pdPlayerUid = { 0 };
  1746             TUid pdPlayerUid = { 0 };    
  1748             HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex  );
  1747             HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue, KFirstMoIndex  );
  1749             TDataType dataType( *contentType );
  1748             TDataType dataType( *contentType );
  1750             delete contentType;
  1749             delete contentType;
  1751             contentType = NULL;
  1750             contentType = NULL;          
  1752             CDocumentHandler* docHandler = CDocumentHandler::NewLC();
  1751             CDocumentHandler* docHandler = CDocumentHandler::NewLC();
  1753             isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid );
  1752             isPdSupported = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid );
  1754             CleanupStack::PopAndDestroy( docHandler ); // docHandler
  1753             CleanupStack::PopAndDestroy( docHandler ); // docHandler
  1755 
  1754             
  1756             if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() )
  1755             if ( isPdSupported && iUiUtils->IsNetworkPdCompatibleL() )
  1757                 {
  1756                 {
  1758                 // Get the UI data for the current download
  1757                 // Get the UI data for the current download
  1759                 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  1758                 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  1760                 TInt32 state( dlData.iProgressState );
  1759                 TInt32 state( dlData.iProgressState );       
  1761                 TBool isProgressively = ETrue;
  1760                 TBool isProgressively = ETrue;
  1762                 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1761                 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1763                     {
  1762                     {
  1764                     // this will be used to tell multimedia app that content file
  1763                     // this will be used to tell multimedia app that content file
  1765                     // has already been moved, and it does not need to attach
  1764                     // has already been moved, and it does not need to attach
  1766                     // to download - it can just read completed download from
  1765                     // to download - it can just read completed download from
  1767                     // filesystem.
  1766                     // filesystem.
  1768                     isProgressively = EFalse;
  1767                     isProgressively = EFalse;                       
  1769                     }
  1768                     }
  1770                 // First close the downloads list.
  1769                 // First close the downloads list.
  1771                 CancelDisplayingDownloadsList();
  1770                 if ( state != EHttpProgMovingContentFile )
  1772                 iUiUtils->LaunchPdAppL(currDownload, isProgressively);
  1771                     {
  1773                 }
  1772                      CancelDisplayingDownloadsList();
  1774             else
  1773                      iUiUtils->LaunchPdAppL(currDownload, isProgressively);
       
  1774                     }
       
  1775                 }
       
  1776             else 
  1775                 {
  1777                 {
  1776                 iUiUtils->HandleContentL( currDownload, *iExtension );
  1778                 iUiUtils->HandleContentL( currDownload, *iExtension );
  1777                 CLOG_WRITE("HandleContentL OK");
  1779                 CLOG_WRITE("HandleContentL OK");              
  1778                 }
  1780                 }
  1779 			}
  1781 			}
  1780 		else
  1782 		else
  1781 			{
  1783 			{
  1782     	    iUiUtils->HandleContentL( currDownload, *iExtension );
  1784     	    iUiUtils->HandleContentL( currDownload, *iExtension );
  1783 	        CLOG_WRITE("HandleContentL OK");
  1785 	        CLOG_WRITE("HandleContentL OK");                        
  1784 			}
  1786 			}
  1785            break;
  1787            break;
  1786             }
  1788             }
  1787 
  1789 
  1788 
  1790 
  1791             // First close the downloads list.
  1793             // First close the downloads list.
  1792             CancelDisplayingDownloadsList();
  1794             CancelDisplayingDownloadsList();
  1793             CLOG_WRITE(" CancelDisplayingDownloadsList OK");
  1795             CLOG_WRITE(" CancelDisplayingDownloadsList OK");
  1794 
  1796 
  1795            iUiUtils->HandleContentL( currDownload, *iExtension );
  1797            iUiUtils->HandleContentL( currDownload, *iExtension );
  1796            CLOG_WRITE("HandleContentL OK");
  1798            CLOG_WRITE("HandleContentL OK");            	
  1797            // After the termination of the handler, download is removed
  1799            // After the termination of the handler, download is removed 
  1798            // from the list of downloads in NotifyHandlerExitL().
  1800            // from the list of downloads in NotifyHandlerExitL().
  1799             break;
  1801             break;
  1800             }
  1802             }
  1801 
  1803             
  1802         case EDownloadsListCmdPlay:
  1804         case EDownloadsListCmdPlay:
  1803             {
  1805             {
  1804 			#ifdef __DMGR_PD_TESTHARNESS
  1806 			#ifdef __DMGR_PD_TESTHARNESS
  1805                 // First close the downloads list.
  1807                 // First close the downloads list.
  1806                 CancelDisplayingDownloadsList();
  1808                 CancelDisplayingDownloadsList();
  1807 				iUiUtils->TestLaunchPdAppL(currDownload);
  1809 				iUiUtils->TestLaunchPdAppL(currDownload);
  1808 			#else
  1810 			#else
  1809 				// Get the UI data for the current download
  1811 				// Get the UI data for the current download
  1810                 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  1812                 TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  1811                 TInt32 state( dlData.iProgressState );
  1813                 TInt32 state( dlData.iProgressState );       
  1812                 TBool isProgressively = ETrue;
  1814                 TBool isProgressively = ETrue;
  1813                 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1815                 if ( state == EHttpProgContentFileMoved || state == EHttpProgContentFileMovedAndDestFNChanged )
  1814                     {
  1816                     {
  1815                     // this will be used to tell multimedia app that content file
  1817                     // this will be used to tell multimedia app that content file
  1816                     // has already been moved, and it does not need to attach
  1818                     // has already been moved, and it does not need to attach
  1817                     // to download - it can just read completed download from
  1819                     // to download - it can just read completed download from
  1818                     // filesystem.
  1820                     // filesystem.
  1819                     isProgressively = EFalse;
  1821                     isProgressively = EFalse;                     	
  1820                     }
  1822                     }
  1821                     // First close the downloads list.
  1823                     // First close the downloads list.
  1822                     CancelDisplayingDownloadsList();
  1824                     CancelDisplayingDownloadsList();
  1823 					if (iUiUtils->IsNetworkPdCompatibleL() )
  1825 					if (iUiUtils->IsNetworkPdCompatibleL() )
  1824 						{
  1826 						{
  1826 						}
  1828 						}
  1827 			#endif	//__DMGR_PD_TESTHARNESS
  1829 			#endif	//__DMGR_PD_TESTHARNESS
  1828 
  1830 
  1829             break;
  1831             break;
  1830             }
  1832             }
  1831 
  1833             
  1832         case EDownloadsListCmdSave:
  1834         case EDownloadsListCmdSave:
  1833             {
  1835             {
  1834             TBool saved = iUiUtils->SaveContentL( currDownload );
  1836             TBool saved = iUiUtils->SaveContentL( currDownload );
  1835             if ( saved )
  1837             if ( saved )
  1836                 {
  1838                 {
  1837                 // Remove the download from the Downloads List to
  1839                 // Remove the download from the Downloads List to 
  1838                 // avoid confusion...
  1840                 // avoid confusion...
  1839                 DeleteDownloadL( currDownload );
  1841                 DeleteDownloadL( currDownload );
  1840                 }
  1842                 }
  1841 	        // The save (moving) procedure is asynchronous!
  1843 	        // The save (moving) procedure is asynchronous!
  1842 	        // CUserInteractionsEventHandler handles
  1844 	        // CUserInteractionsEventHandler handles 
  1843 	        // EHttpDlCompleted/EHttpProgMovingContentFile and
  1845 	        // EHttpDlCompleted/EHttpProgMovingContentFile and
  1844 	        // EHttpDlCompleted/EHttpProgContentFileMoved.
  1846 	        // EHttpDlCompleted/EHttpProgContentFileMoved.
  1845             break;
  1847             break;
  1846             }
  1848             }
  1847 
  1849 
  1848         case EDownloadsListCmdDelete:
  1850         case EDownloadsListCmdDelete:
  1849             {
  1851             {
  1850             // Retrieve the full path to filename before deletion
  1852             // Retrieve the full path to filename before deletion
  1851             // this way we check if the the actuall content file was deleted or not,
  1853             // this way we check if the the actuall content file was deleted or not, 
  1852             // if not, we will manually delete it
  1854             // if not, we will manually delete it
  1853             HBufC* fileName = HBufC::NewLC( KMaxPath );
  1855             HBufC* fileName = HBufC::NewLC( KMaxPath );
  1854             TPtr fileNamePtr = fileName->Des();
  1856             TPtr fileNamePtr = fileName->Des();
  1855             User::LeaveIfError
  1857             User::LeaveIfError
  1856                ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  1858                ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  1863             User::LeaveIfError(fs.Connect());
  1865             User::LeaveIfError(fs.Connect());
  1864             CleanupClosePushL(fs);
  1866             CleanupClosePushL(fs);
  1865             TFindFile file(fs);
  1867             TFindFile file(fs);
  1866             TPtrC ptr(KNullDesC);
  1868             TPtrC ptr(KNullDesC);
  1867             TInt found = file.FindByPath(fileNamePtr1,&ptr); //when second parameter to the API is Null then the it searches for the file in the Dir specified in the first parameter
  1869             TInt found = file.FindByPath(fileNamePtr1,&ptr); //when second parameter to the API is Null then the it searches for the file in the Dir specified in the first parameter
       
  1870             TBool isFileOpen(EFalse);
       
  1871             TInt fileopenstatus = fs.IsFileOpen(fileNamePtr1,isFileOpen);
  1868             CleanupStack::PopAndDestroy(&fs);
  1872             CleanupStack::PopAndDestroy(&fs);
  1869             CleanupStack::PopAndDestroy(fileName1);
  1873             CleanupStack::PopAndDestroy(fileName1);
       
  1874             if(fileopenstatus ==KErrNone && isFileOpen)
       
  1875                 User::Leave(KErrInUse);
  1870             // Delete in DMgr
  1876             // Delete in DMgr
  1871             TBool deleted = iUiUtils->DeleteWithUserConfirmL( currDownload );
  1877             TBool deleted = iUiUtils->DeleteWithUserConfirmL( currDownload );
  1872             if ( deleted )
  1878             if ( deleted )
  1873                 {
  1879                 {
  1874                 if(!iUiUtils->IsCodDownload())
  1880                 if(!iUiUtils->IsCodDownload())
  1878                           HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND);
  1884                           HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND);
  1879                           CAknInformationNote* note = new(ELeave)  CAknInformationNote();
  1885                           CAknInformationNote* note = new(ELeave)  CAknInformationNote();
  1880                           note->ExecuteLD(*infoPrompt);
  1886                           note->ExecuteLD(*infoPrompt);
  1881                           CleanupStack::PopAndDestroy(infoPrompt);
  1887                           CleanupStack::PopAndDestroy(infoPrompt);
  1882                          }
  1888                          }
  1883     			   // Do not wait until the delete event is reported through the
  1889     			   // Do not wait until the delete event is reported through the 
  1884     			   // observer callback, but update the list right now,
  1890     			   // observer callback, but update the list right now, 
  1885     			   // so the user will not be able to access and modify an already
  1891     			   // so the user will not be able to access and modify an already
  1886     			   // deleted download:
  1892     			   // deleted download:
  1887     			   DeleteDownloadL( currDownload );
  1893     			   DeleteDownloadL( currDownload );
  1888     			   TBool result( EFalse );
  1894     			   TBool result( EFalse );
  1889     			   RFs rfs;
  1895     			   RFs rfs;
  1897     			       result = BaflUtils::DeleteFile( rfs, fileNamePtr );
  1903     			       result = BaflUtils::DeleteFile( rfs, fileNamePtr );
  1898     			       }
  1904     			       }
  1899     			   CleanupStack::PopAndDestroy( &rfs );
  1905     			   CleanupStack::PopAndDestroy( &rfs );
  1900 
  1906 
  1901     			   // Notify Media Gallery about new media file
  1907     			   // Notify Media Gallery about new media file
  1902 
  1908     			   
  1903     			#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
  1909     			#ifdef BRDO_APP_GALLERY_SUPPORTED_FF   
  1904 
  1910     			
  1905     			   CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
  1911     			   CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
  1906     			       CEikonEnv::Static()->FsSession() );
  1912     			       CEikonEnv::Static()->FsSession() );
  1907     			   if( fileNamePtr.Length() > 0 )
  1913     			   if( fileNamePtr.Length() > 0 )
  1908     			       {
  1914     			       {
  1909     			       TRAP_IGNORE( mgFileManager->UpdateL( fileNamePtr ) );
  1915     			       TRAP_IGNORE( mgFileManager->UpdateL( fileNamePtr ) );
  1911     			       }
  1917     			       }
  1912     			   else
  1918     			   else
  1913     			       {
  1919     			       {
  1914     			       TRAP_IGNORE( mgFileManager->UpdateL() );
  1920     			       TRAP_IGNORE( mgFileManager->UpdateL() );
  1915     			       }
  1921     			       }
  1916 
  1922     			 
  1917     			   delete mgFileManager;
  1923     			   delete mgFileManager;
  1918     			   mgFileManager = NULL;
  1924     			   mgFileManager = NULL;
  1919 
  1925     			 
  1920     			 #else
  1926     			 #else
  1921 
  1927     			 
  1922     			  if( fileNamePtr.Length() > 0 )
  1928     			  if( fileNamePtr.Length() > 0 )
  1923     			       {
  1929     			       {
  1924     			       TRAP_IGNORE( iUiUtils->UpdateDCFRepositoryL( fileNamePtr ) );
  1930     			       TRAP_IGNORE( iUiUtils->UpdateDCFRepositoryL( fileNamePtr ) );
  1925     			       }
  1931     			       }
  1926 
  1932     			 
  1927     			 #endif
  1933     			 #endif  
  1928 
  1934     			   
  1929                 	}
  1935                 	}
  1930                  else
  1936                  else
  1931     	           	{
  1937     	           	{
  1932     	           	DeleteDownloadL( currDownload );
  1938     	           	DeleteDownloadL( currDownload );
  1933     	           	}
  1939     	           	} 
  1934     			 }
  1940     			 }
  1935 
  1941 
  1936                CleanupStack::PopAndDestroy( fileName );
  1942                CleanupStack::PopAndDestroy( fileName );
  1937                break;
  1943                break;
  1938            }
  1944            }
  1968             for ( TInt i = 0; i < count; ++i )
  1974             for ( TInt i = 0; i < count; ++i )
  1969                 {
  1975                 {
  1970                 RHttpDownload& download = iListModel->Download(i);
  1976                 RHttpDownload& download = iListModel->Download(i);
  1971                 TInt32 dlState(0);
  1977                 TInt32 dlState(0);
  1972                 TInt err = download.GetIntAttribute( EDlAttrState, dlState );
  1978                 TInt err = download.GetIntAttribute( EDlAttrState, dlState );
  1973 
  1979                 
  1974                 //Changes for the bug JERI-7P8CF2
  1980                 //Changes for the bug JERI-7P8CF2
  1975                 //Changes made in the server side to fix the video center receiving unexpected events
  1981                 //Changes made in the server side to fix the video center receiving unexpected events
  1976                 //Reassigning these events back to the changes done in server side
  1982                 //Reassigning these events back to the changes done in server side
  1977                 if( !err && dlState  == EHttpDlCompleted )
  1983                 if( !err && dlState  == EHttpDlCompleted )
  1978 		            {
  1984 		            {
  1980 		            }
  1986 		            }
  1981                 else if( !err && dlState  == EHttpDlFailed )
  1987                 else if( !err && dlState  == EHttpDlFailed )
  1982 		            {
  1988 		            {
  1983 		    	     dlState  = EHttpDlMultipleMOFailed;
  1989 		    	     dlState  = EHttpDlMultipleMOFailed;
  1984 		            }
  1990 		            }
  1985 
  1991                 
  1986                 if ( !err && ( dlState == EHttpDlPaused || dlState == EHttpDlMultipleMOFailed ) )
  1992                 if ( !err && ( dlState == EHttpDlPaused || dlState == EHttpDlMultipleMOFailed ) )
  1987                     {
  1993                     {
  1988                     download.Start(); // return value is ignored.
  1994                     download.Start(); // return value is ignored.
  1989                     }
  1995                     }
  1990                 }
  1996                 }
  2001 	            if (err != KErrNone)
  2007 	            if (err != KErrNone)
  2002 	            	{
  2008 	            	{
  2003 	            	iIsCancelInProgress = EFalse;
  2009 	            	iIsCancelInProgress = EFalse;
  2004 	            	User::LeaveIfError(err);
  2010 	            	User::LeaveIfError(err);
  2005 	            	}
  2011 	            	}
  2006 
  2012 	            
  2007 	            if ( cancelled )
  2013 	            if ( cancelled )
  2008 	                {
  2014 	                {
  2009 	                DeleteDownloadL( currDownload );
  2015                     DeleteDownloadL( currDownload );
       
  2016                     
       
  2017 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF     
       
  2018                     TInt currentItemIndex = aDialog.CurrentItemIndex();
       
  2019                     if (currentItemIndex != -1)
       
  2020                         {   
       
  2021                         TInt Inprogress = iListModel->DownloadsCount
       
  2022                                       ( MASKED_DL_STATE(EHttpDlCreated) |
       
  2023                                         MASKED_DL_STATE(EHttpDlPaused) |
       
  2024                                         MASKED_DL_STATE(EHttpDlInprogress) |
       
  2025                                         MASKED_DL_STATE(EHttpDlMultipleMOFailed));
       
  2026                         if ( Inprogress > 1 )
       
  2027                             {
       
  2028                             aDialog.ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue );
       
  2029                             } 
       
  2030                         else
       
  2031                             {
       
  2032                             aDialog.ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
       
  2033                             }
       
  2034                         }
       
  2035 #endif                    
  2010 	                }
  2036 	                }
  2011 	            iIsCancelInProgress = EFalse;
  2037 	            iIsCancelInProgress = EFalse;
  2012             	}
  2038             	}
  2013             break;
  2039             break;
  2014             }
  2040             }
  2015 
  2041             
  2016         case EDownloadsListCmdCancelAll:
  2042         case EDownloadsListCmdCancelAll:
  2017         	{
  2043         	{
  2018             if (!iIsCancelInProgress)
  2044             if (!iIsCancelInProgress)
  2019             	{
  2045             	{
  2020             	iIsCancelInProgress = ETrue;
  2046             	iIsCancelInProgress = ETrue;
  2043         	break;
  2069         	break;
  2044         	}
  2070         	}
  2045 
  2071 
  2046         case EDownloadsListCmdGallery:
  2072         case EDownloadsListCmdGallery:
  2047             {
  2073             {
  2048 
  2074             
  2049 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
  2075 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
  2050 
  2076             
  2051             TVwsViewId id = TVwsViewId(
  2077             TVwsViewId id = TVwsViewId(
  2052                 TUid::Uid( KMediaGalleryUID3 ),
  2078                 TUid::Uid( KMediaGalleryUID3 ),
  2053                 TUid::Uid( KMediaGalleryListViewUID ) );
  2079                 TUid::Uid( KMediaGalleryListViewUID ) );
  2054 
  2080 
  2055             // By default, custom message is empty
  2081             // By default, custom message is empty
  2056             TPtrC8 customMessage( KNullDesC8 );
  2082             TPtrC8 customMessage( KNullDesC8 );
  2057 
  2083 
  2058             CEikonEnv::Static()->EikAppUi()->ActivateViewL(
  2084             CEikonEnv::Static()->EikAppUi()->ActivateViewL( 
  2059                     id,
  2085                     id, 
  2060                     TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ),
  2086                     TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ),
  2061                     customMessage );
  2087                     customMessage );
  2062 #endif
  2088 #endif                    
  2063             break;
  2089             break;
  2064             }
  2090             }
  2065 
  2091       
  2066         case EDownloadsListCmdFileManager:
  2092         case EDownloadsListCmdFileManager:
  2067             {
  2093             {
  2068 
  2094  
  2069             if ( iPlatformSupportsGallery )
  2095             if ( iPlatformSupportsGallery )
  2070                 {
  2096                 {
  2071             	LaunchFileManagerApplication();
  2097             	LaunchFileManagerApplication();
  2072                 }
  2098                 }
  2073             else
  2099             else
  2074                 {
  2100                 {
  2075             	CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL();
  2101             	CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL();
  2076                 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST );
  2102                 serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST );
  2077 
  2103             
  2078                 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
  2104                 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
  2079 
  2105              
  2080                 //get the destination file path
  2106                 //get the destination file path
  2081                 HBufC* fileName = HBufC::NewLC( KMaxPath );
  2107                 HBufC* fileName = HBufC::NewLC( KMaxPath );
  2082                 TPtr fileNamePtr = fileName->Des();
  2108                 TPtr fileNamePtr = fileName->Des();
  2083                 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  2109                 User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  2084 
  2110                
  2085                 // Locate the last '\\' character and remove the file name so that we will get the folder name
  2111                 // Locate the last '\\' character and remove the file name so that we will get the folder name
  2086                 TInt len = fileNamePtr.LocateReverse('\\');
  2112                 TInt len = fileNamePtr.LocateReverse('\\');
  2087                 TPtr ptr = fileNamePtr.LeftTPtr(len + 1);
  2113                 TPtr ptr = fileNamePtr.LeftTPtr(len + 1);
  2088 
  2114             
  2089                 // Append the directory name to be opened
  2115                 // Append the directory name to be opened
  2090                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) );
  2116                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) );
  2091                 //Append the sort method
  2117                 //Append the sort method
  2092                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) );
  2118                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) );
  2093                 //Append to define whether to open in standalone mode
  2119                 //Append to define whether to open in standalone mode
  2094                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) );
  2120                 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) );
  2095 
  2121     
  2096                 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() ));
  2122                 TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() ));
  2097 
  2123             
  2098     	   		CleanupStack::PopAndDestroy( fileName );
  2124     	   		CleanupStack::PopAndDestroy( fileName );
  2099             	CleanupStack::PopAndDestroy( inParams );
  2125             	CleanupStack::PopAndDestroy( inParams );
  2100 
  2126         	
  2101         	    delete serviceHandler;
  2127         	    delete serviceHandler;
  2102 
  2128         	    
  2103         	    //if there is any error, open the file manager in root folder
  2129         	    //if there is any error, open the file manager in root folder
  2104                 if (err != KErrNone)
  2130                 if (err != KErrNone)
  2105           	        {
  2131           	        {
  2106           	        LaunchFileManagerApplication();
  2132           	        LaunchFileManagerApplication();
  2107            		    }
  2133            		    }
  2108                 }
  2134                 }
  2109 
  2135   
  2110             break;
  2136             break;
  2111             }
  2137             }
  2112 
  2138          
  2113         default:
  2139         default:
  2114             {
  2140             {
  2115             break;
  2141             break;
  2116             }
  2142             }
  2117         }
  2143         }
  2118     }
  2144     }
  2119 
  2145     
  2120 
  2146     
  2121 // -----------------------------------------------------------------------------
  2147 // -----------------------------------------------------------------------------
  2122 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication
  2148 // CDownloadMgrUiDownloadsList::LaunchFileManagerApplication
  2123 // -----------------------------------------------------------------------------
  2149 // -----------------------------------------------------------------------------
  2124 //
  2150 //
  2125 
  2151 
  2126 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication()
  2152 void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication()
  2127 {
  2153 {
  2128 
  2154 	
  2129     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  2155     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  2130     CRepository *repository=CRepository::NewL(KCRUidBrowser);
  2156     CRepository *repository=CRepository::NewL(KCRUidBrowser);
  2131     TInt fileManagerId;
  2157     TInt fileManagerId;
  2132     User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId ));
  2158     User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId ));
  2133     TUid id = TUid::Uid(fileManagerId);
  2159     TUid id = TUid::Uid(fileManagerId);
  2134     TApaTask task = taskList.FindApp( id );
  2160     TApaTask task = taskList.FindApp( id );
  2135     if ( task.Exists() )
  2161     if ( task.Exists() )
  2136         {
  2162         {
  2137         task.BringToForeground();
  2163         task.BringToForeground();
  2138         }
  2164         }
  2139     else
  2165     else 
  2140         {
  2166         {
  2141         RApaLsSession appArcSession;
  2167         RApaLsSession appArcSession;
  2142         User::LeaveIfError( appArcSession.Connect() );
  2168         User::LeaveIfError( appArcSession.Connect() );
  2143         CleanupClosePushL( appArcSession );
  2169         CleanupClosePushL( appArcSession );
  2144         TThreadId id1;
  2170         TThreadId id1;
  2145         User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) );
  2171         User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) );  
  2146         CleanupStack::PopAndDestroy( &appArcSession );
  2172         CleanupStack::PopAndDestroy( &appArcSession );
  2147         }
  2173         }
  2148 
  2174 	
  2149 }
  2175 }
  2150 
  2176 
  2151 
  2177 
  2152 // -----------------------------------------------------------------------------
  2178 // -----------------------------------------------------------------------------
  2153 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL
  2179 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL
  2154 // -----------------------------------------------------------------------------
  2180 // -----------------------------------------------------------------------------
  2155 //
  2181 //
  2156 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog,
  2182 void CDownloadMgrUiDownloadsList::DynInitMenuPaneL( CDownloadsListDlg& aDialog, 
  2157                                                     TInt aResourceId,
  2183                                                     TInt aResourceId, 
  2158                                                     CEikMenuPane* aMenuPane )
  2184                                                     CEikMenuPane* aMenuPane )
  2159     {
  2185     {
  2160     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL");
  2186     CLOG_ENTERFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL");
  2161 
  2187 
  2162     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) );
  2188     __ASSERT_DEBUG( iExtension->IsDialogVisible(), Panic( EUiLibPanNull ) );
  2168 
  2194 
  2169         TInt currentItemIndex = aDialog.CurrentItemIndex();
  2195         TInt currentItemIndex = aDialog.CurrentItemIndex();
  2170         __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) );
  2196         __ASSERT_DEBUG( 0 <= currentItemIndex, Panic( EUiLibPanDLNegItemIndex ) );
  2171         RHttpDownload& currDownload = iListModel->Download( currentItemIndex );
  2197         RHttpDownload& currDownload = iListModel->Download( currentItemIndex );
  2172         CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload);
  2198         CLOG_WRITE_FORMAT(" currDownload: 0x%x",&currDownload);
  2173 
  2199         
  2174         // Get the UI data for the current download
  2200         // Get the UI data for the current download
  2175         TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  2201         TDownloadUiData& dlData = iListModel->DlUiData( aDialog.CurrentItemIndex() );
  2176         TInt32 state( dlData.iDownloadState );
  2202         TInt32 state( dlData.iDownloadState );
  2177         CLOG_WRITE_FORMAT(" state: %d",state);
  2203         CLOG_WRITE_FORMAT(" state: %d",state);
  2178 
  2204 
  2179         // The moved state is only a temporary state - the server
  2205         // The moved state is only a temporary state - the server 
  2180         // sets the download's original state back right after it,
  2206         // sets the download's original state back right after it, 
  2181         // thus we query the state again:
  2207         // thus we query the state again:
  2182         if ( state == EHttpDlMoved )
  2208         if ( state == EHttpDlMoved )
  2183             {
  2209             {
  2184             User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) );
  2210             User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrState, state ) );
  2185 
  2211             
  2186             //Changes for the bug JERI-7P8CF2
  2212             //Changes for the bug JERI-7P8CF2
  2187             //Changes made in the server side to fix the video center receiving unexpected events
  2213             //Changes made in the server side to fix the video center receiving unexpected events
  2188             //Reassigning these events back to the changes done in server side
  2214             //Reassigning these events back to the changes done in server side
  2189             if( state  == EHttpDlCompleted )
  2215             if( state  == EHttpDlCompleted )
  2190 		        {
  2216 		        {
  2192 		        }
  2218 		        }
  2193             else if(state  == EHttpDlFailed )
  2219             else if(state  == EHttpDlFailed )
  2194 		        {
  2220 		        {
  2195 		        state  = EHttpDlMultipleMOFailed;
  2221 		        state  = EHttpDlMultipleMOFailed;
  2196 		        }
  2222 		        }
  2197 
  2223 		            
  2198             CLOG_WRITE_FORMAT(" state re-query: %d",state);
  2224             CLOG_WRITE_FORMAT(" state re-query: %d",state);
  2199             }
  2225             }
  2200         __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) );
  2226         __ASSERT_DEBUG( state != EHttpDlMoved, Panic( EUiLibPanStateIsStillMoved ) );        
  2201 
  2227         
  2202         TBool wasCompleted   = state == EHttpDlMultipleMOCompleted;
  2228         TBool wasCompleted   = state == EHttpDlMultipleMOCompleted;        
  2203 
  2229         
  2204         // Get if it's theme
  2230         // Get if it's theme         
  2205         TInt isThemeType = 0;
  2231         TInt isThemeType = 0; 
  2206         HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength);
  2232         HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength);
  2207         TPtr8 contentTypePtr = contentType->Des();
  2233         TPtr8 contentTypePtr = contentType->Des(); 
  2208         User::LeaveIfError
  2234         User::LeaveIfError
  2209                 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) );
  2235                 ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) );
  2210         isThemeType = !contentType->Compare(KSisxContentType);
  2236         isThemeType = !contentType->Compare(KSisxContentType);  
  2211         CleanupStack::PopAndDestroy( contentType );
  2237         CleanupStack::PopAndDestroy( contentType );        
  2212 
  2238 		
  2213     if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU )
  2239     if ( aResourceId == R_DMUL_DOWNLOADSLIST_MENU )
  2214         {
  2240         {
  2215         __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) );
  2241         __ASSERT_DEBUG( 0<iListModel->Count(), Panic( EUiLibPanOptionsShownWhileNoDownloads ) );
  2216 
  2242 
  2217         TBool isCreated     = state == EHttpDlCreated;
  2243         // The fix of PHAN-6KVK5R makes this line no longer necessary 
  2218         // The fix of PHAN-6KVK5R makes this line no longer necessary
       
  2219         // TBool isInProgress  = state == EHttpDlInprogress;
  2244         // TBool isInProgress  = state == EHttpDlInprogress;
  2220         TBool isPaused      = state == EHttpDlPaused;
       
  2221         TBool isCompleted   = state == EHttpDlMultipleMOCompleted;
  2245         TBool isCompleted   = state == EHttpDlMultipleMOCompleted;
  2222         TBool isFailed      = state == EHttpDlMultipleMOFailed;
       
  2223         TBool isDrmDownload = EFalse;
  2246         TBool isDrmDownload = EFalse;
  2224         TBool isDrmRightsOnPhone = EFalse;
  2247         TBool isDrmRightsOnPhone = EFalse;
  2225         TBool isPreviewRights = EFalse;
  2248         TBool isPreviewRights = EFalse;
  2226         // OMA DRM information is used only in case of completed downloads
  2249         // OMA DRM information is used only in case of completed downloads
  2227         if ( isCompleted )
  2250         if ( isCompleted )
  2235             }
  2258             }
  2236         TBool s60Supported( EFalse );
  2259         TBool s60Supported( EFalse );
  2237         TBool gallerySupported( EFalse );
  2260         TBool gallerySupported( EFalse );
  2238         s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType );
  2261         s60Supported = iUiUtils->IsContentTypeSupportedL( dlData.iContentType );
  2239         gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType);
  2262         gallerySupported = CDownloadUtils::IsGallerySupported(dlData.iContentType);
  2240         CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported);
  2263         CLOG_WRITE_FORMAT(" s60Supported: %d",s60Supported);       
  2241         CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported);
  2264         CLOG_WRITE_FORMAT(" gallerySupported: %d",gallerySupported);        
  2242 
  2265 
  2243         TBool isCodDownload( EFalse );
  2266         TBool isCodDownload( EFalse );
  2244         TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload );
  2267         TInt err = currDownload.GetBoolAttribute( EDlAttrCodDownload, isCodDownload );
  2245         CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err);
  2268         CLOG_WRITE_FORMAT(" EDlAttrCodDownload err: %d",err);
  2246 
  2269         
  2247         TBool isCodPdDownload( EFalse );
  2270         TBool isCodPdDownload( EFalse );
  2248         err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload );
  2271         err = currDownload.GetBoolAttribute( EDlAttrCodPdAvailable, isCodPdDownload );
  2249         CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err);
  2272         CLOG_WRITE_FORMAT(" EDlAttrCodPdAvailable err: %d",err);
  2250 
  2273         
  2251         // Get if it can be handled progressively
  2274         // Get if it can be handled progressively 
  2252         TBool canProgHandled = EFalse;
  2275         TBool canProgHandled = EFalse; 
  2253         TUid pdPlayerUid = { 0 };
  2276         TUid pdPlayerUid = { 0 };    
  2254         HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue );
  2277         HBufC8* contentType = iUiUtils->ContentTypeL( currDownload, ETrue );
  2255         TDataType dataType( *contentType );
  2278         TDataType dataType( *contentType );
  2256         delete contentType;
  2279         delete contentType;
  2257         contentType = NULL;
  2280         contentType = NULL;          
  2258         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
  2281         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
  2259         canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid );
  2282         canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid );
  2260         CleanupStack::PopAndDestroy( docHandler ); // docHandler
  2283         CleanupStack::PopAndDestroy( docHandler ); // docHandler              
  2261 
  2284 
       
  2285 #ifndef BRDO_SINGLE_CLICK_ENABLED_FF 
       
  2286         TBool isCreated     = state == EHttpDlCreated;
       
  2287         TBool isPaused      = state == EHttpDlPaused;
       
  2288         TBool isFailed      = state == EHttpDlMultipleMOFailed;
  2262         //delete open file manager when download is not complete
  2289         //delete open file manager when download is not complete
  2263         if( !(isCompleted))
  2290         if( !(isCompleted))
  2264             {
  2291             {
  2265             aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
  2292             aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );    
  2266             }
  2293             }
  2267 
  2294             
  2268         // For any gallery supported download,  "go to gallery" option should be displayed in the download list option when the download completes
  2295         // For any gallery supported download,  "go to gallery" option should be displayed in the download list option when the download completes     
  2269 
  2296         
  2270 
  2297         
  2271         if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) )
  2298         if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) )
  2272             {
  2299             {
  2273 			aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery );
  2300 			aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery );
  2274     		}
  2301     		}
  2275 
  2302     		
  2276         if ( !( isCompleted && s60Supported && gallerySupported &&
  2303         if ( !( isCompleted && s60Supported && gallerySupported && 
  2277               ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2304               ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2278             {
  2305             {
  2279             aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs );
  2306             aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs );
  2280 			}
  2307 			}
  2281 
  2308     		
  2282 	    else
  2309 	    else
  2283 	        {
  2310 	        {
  2284 	        TInt32 numMediaObjects = 0;
  2311 	        TInt32 numMediaObjects = 0;
  2285             User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) );
  2312             User::LeaveIfError( currDownload.GetIntAttribute( EDlAttrNumMediaObjects, numMediaObjects ) );
  2286 	        if (numMediaObjects > KFirstMoIndex)
  2313 	        if (numMediaObjects > KFirstMoIndex)
  2287     	        {
  2314     	        {
  2288 	            aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs );
  2315 	            aMenuPane->DeleteMenuItem( EDownloadsListCmdUseAs );
  2289 	            }
  2316 	            }
  2290 	        }
  2317 	        }
  2291 
  2318 	            
  2292         if( iProgressiveDownload || isCompleted )
  2319         if( iProgressiveDownload || isCompleted )
  2293             {
  2320             {
  2294             if ( canProgHandled )
  2321             if ( canProgHandled )
  2295                 {
  2322                 {
  2296                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2323                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );           
  2297                 if (isCodDownload && !isCompleted )
  2324                 if (isCodDownload && !isCompleted ) 
  2298                     {
  2325                     {
  2299                     if ( !( gallerySupported && canProgHandled  && isCodPdDownload &&
  2326                     if ( !( gallerySupported && canProgHandled  && isCodPdDownload &&
  2300                        ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed))
  2327                        ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) || (isPaused || isFailed))
  2301                        aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2328                        aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );                
  2302                     }
  2329                     }
  2303                     else
  2330                     else 
  2304                     {
  2331                     {
  2305                         if ( !( gallerySupported && canProgHandled &&
  2332                         if ( !( gallerySupported && canProgHandled &&
  2306                            ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed))
  2333                            ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ))) || (isPaused || isFailed))           
  2307                            aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2334                            aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );	
  2308                     }
  2335                     }     
  2309                 }
  2336                 }
  2310             else
  2337             else 
  2311                 {
  2338                 {
  2312                 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2339                 aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2313 
  2340             
  2314                 if ( !( isCompleted && ( s60Supported ) &&
  2341                 if ( !( isCompleted && ( s60Supported ) && 
  2315                       ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2342                       ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2316                     {
  2343                     {
  2317                     aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2344                     aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2318                     }
  2345                     }
  2319 
  2346                
  2320          //there should not be open in menu when download is not complete and file is not supported by s60  or Gallery
  2347          //there should not be open in menu when download is not complete and file is not supported by s60  or Gallery        
  2321               /*  else if( isCompleted && ( !s60Supported && !gallerySupported))
  2348               /*  else if( isCompleted && ( !s60Supported && !gallerySupported))  
  2322                     {
  2349                     {
  2323                     aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2350                     aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );   
  2324                     }*/
  2351                     }*/
  2325                 }
  2352                 }
  2326              }
  2353              }
  2327 
  2354             
  2328         else // if iProgressiveDownload == EFalse
  2355         else // if iProgressiveDownload == EFalse
  2329             {
  2356             {
  2330             aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2357             aMenuPane->DeleteMenuItem( EDownloadsListCmdPlay );
  2331 
  2358             
  2332             if ( !( isCompleted && s60Supported &&
  2359             if ( !( isCompleted && s60Supported && 
  2333                   ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2360                   ( !isDrmDownload || ( isDrmDownload && isDrmRightsOnPhone ) ) ) )
  2334                 {
  2361                 {
  2335                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2362                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2336                 }
  2363                 }
  2337 
  2364                       
  2338             else if( isCompleted && !s60Supported && gallerySupported)
  2365             else if( isCompleted && !s60Supported && gallerySupported)  
  2339                 {
  2366                 {
  2340                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );
  2367                 aMenuPane->DeleteMenuItem( EDownloadsListCmdOpen );   
  2341                 }
  2368                 }
  2342             }
  2369             }
  2343 
  2370             
  2344         // ELFG-732DK3: There is no need to have save option since it's already saved
  2371         // ELFG-732DK3: There is no need to have save option since it's already saved 
  2345         aMenuPane->DeleteMenuItem( EDownloadsListCmdSave );
  2372         aMenuPane->DeleteMenuItem( EDownloadsListCmdSave ); 
  2346 
  2373                     
  2347         if ( !( isCompleted ) )
  2374         if ( !( isCompleted ) )
  2348             {
  2375             {
  2349             aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete );
  2376             aMenuPane->DeleteMenuItem( EDownloadsListCmdDelete );
  2350             }
  2377             }
  2351         else
  2378         else
  2361 */
  2388 */
  2362         if ( !( isCreated || isPaused || isFailed ) )
  2389         if ( !( isCreated || isPaused || isFailed ) )
  2363             {
  2390             {
  2364             aMenuPane->DeleteMenuItem( EDownloadsListCmdResume );
  2391             aMenuPane->DeleteMenuItem( EDownloadsListCmdResume );
  2365             }
  2392             }
  2366         // Count paused downloads. Note that Creates and Failed downloads
  2393         // Count paused downloads. Note that Creates and Failed downloads 
  2367         // are also considered as Paused, and they can be resumed.
  2394         // are also considered as Paused, and they can be resumed.
  2368         TInt pausedCount = iListModel->DownloadsCount
  2395         TInt pausedCount = iListModel->DownloadsCount
  2369                            ( MASKED_DL_STATE(EHttpDlCreated) |
  2396                            ( MASKED_DL_STATE(EHttpDlCreated) |
  2370                              MASKED_DL_STATE(EHttpDlPaused) |
  2397                              MASKED_DL_STATE(EHttpDlPaused) |
  2371                              MASKED_DL_STATE(EHttpDlMultipleMOFailed) );
  2398                              MASKED_DL_STATE(EHttpDlMultipleMOFailed) );
  2372         CLOG_WRITE_FORMAT(" paused count: %d",pausedCount);
  2399         CLOG_WRITE_FORMAT(" paused count: %d",pausedCount);
  2373         //
  2400         //
  2374         if ( !( 1 < pausedCount ) )
  2401         if ( !( 1 < pausedCount ) )
  2375             {
  2402             {
  2376             aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll );
  2403             aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll );
  2377             }
  2404             } 
  2378 
  2405             
  2379         TInt downloadCount = iListModel->DownloadsCount
  2406         TInt downloadCount = iListModel->DownloadsCount
  2380                              ( MASKED_DL_STATE(EHttpDlCreated) |
  2407                              ( MASKED_DL_STATE(EHttpDlCreated) |
  2381                                MASKED_DL_STATE(EHttpDlInprogress)|
  2408                                MASKED_DL_STATE(EHttpDlInprogress)|
  2382                                MASKED_DL_STATE(EHttpDlPaused) );
  2409                                MASKED_DL_STATE(EHttpDlPaused) );
  2383         CLOG_WRITE_FORMAT(" download count: %d",downloadCount);
  2410         CLOG_WRITE_FORMAT(" download count: %d",downloadCount);
  2384 
  2411         
  2385         if ( !( 1 < downloadCount ) )
  2412         if ( !( 1 < downloadCount ) )
  2386             {
  2413             {
  2387             aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll );
  2414             aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll );
  2388             }
  2415             }              
  2389 
  2416                              
  2390        	if ( iPlatformSupportsGallery )
  2417        	if ( iPlatformSupportsGallery )
  2391        	    {
  2418        	    {
  2392        		if ( isCompleted && gallerySupported && s60Supported )
  2419        		if ( isCompleted && gallerySupported && s60Supported )
  2393                 {
  2420                 {
  2394                 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
  2421                 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
  2395                 }
  2422                 }
  2396        	    }
  2423             }
  2397         }
  2424 #else
  2398 
  2425     // Count paused downloads. Note that Creates and Failed downloads 
  2399     if ( wasCompleted && !isThemeType )
  2426             // are also considered as Paused, and they can be resumed.
  2400         {
  2427             TInt pausedCount = iListModel->DownloadsCount
  2401         InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload );
  2428                                ( MASKED_DL_STATE(EHttpDlCreated) |
       
  2429                                  MASKED_DL_STATE(EHttpDlPaused) |
       
  2430                                  MASKED_DL_STATE(EHttpDlMultipleMOFailed) );
       
  2431             CLOG_WRITE_FORMAT(" paused count: %d",pausedCount);
       
  2432             //
       
  2433             if ( !( 1 < pausedCount ) )
       
  2434                 {
       
  2435                 aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll );
       
  2436                 } 
       
  2437                 
       
  2438             TInt downloadCount = iListModel->DownloadsCount
       
  2439                                  ( MASKED_DL_STATE(EHttpDlCreated) |
       
  2440                                    MASKED_DL_STATE(EHttpDlInprogress)|
       
  2441                                    MASKED_DL_STATE(EHttpDlPaused) );
       
  2442             CLOG_WRITE_FORMAT(" download count: %d",downloadCount);
       
  2443             
       
  2444             if ( !( 1 < downloadCount ) )
       
  2445                 {
       
  2446                 aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll );
       
  2447                 }              
       
  2448 #endif          
       
  2449         }
       
  2450     if ( wasCompleted && !isThemeType ) 
       
  2451         {
       
  2452         InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload );		
  2402         }
  2453         }
  2403     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL");
  2454     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL");
  2404     }
  2455     }
  2405 
  2456 
       
  2457 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
       
  2458 void CDownloadMgrUiDownloadsList::AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
  2459     {
       
  2460     if( !iAIWServiceHandler )
       
  2461         {
       
  2462         AttachAIWInterestL();
       
  2463         }
       
  2464     RHttpDownload& currDownload = iListModel->Download( 0 );
       
  2465     InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload );  
       
  2466     }
       
  2467 #endif
  2406 // -----------------------------------------------------------------------------
  2468 // -----------------------------------------------------------------------------
  2407 // CDownloadMgrUiDownloadsList::OfferKeyEventL
  2469 // CDownloadMgrUiDownloadsList::OfferKeyEventL
  2408 // -----------------------------------------------------------------------------
  2470 // -----------------------------------------------------------------------------
  2409 //
  2471 //
  2410 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL
  2472 TKeyResponse CDownloadMgrUiDownloadsList::OfferKeyEventL
  2440 
  2502 
  2441 // -----------------------------------------------------------------------------
  2503 // -----------------------------------------------------------------------------
  2442 // FindDlUiData
  2504 // FindDlUiData
  2443 // -----------------------------------------------------------------------------
  2505 // -----------------------------------------------------------------------------
  2444 //
  2506 //
  2445 inline TDownloadUiData* FindDlUiData( CDownloadsListArray& aListModel,
  2507 inline TDownloadUiData* FindDlUiData( CDownloadsListArray& aListModel, 
  2446                                        RHttpDownload& aDownload,
  2508                                        RHttpDownload& aDownload,
  2447                                        TInt& aIndex )
  2509                                        TInt& aIndex )
  2448     {
  2510     {
  2449     TInt err = aListModel.Find( aDownload, aIndex );
  2511     TInt err = aListModel.Find( aDownload, aIndex );
  2450     if ( err == KErrNotFound )
  2512     if ( err == KErrNotFound )
  2455     else
  2517     else
  2456         {
  2518         {
  2457         return &( aListModel.DlUiData( aIndex ) );
  2519         return &( aListModel.DlUiData( aIndex ) );
  2458         }
  2520         }
  2459     };
  2521     };
  2460 
  2522     
  2461 // -----------------------------------------------------------------------------
  2523 // -----------------------------------------------------------------------------
  2462 // CDownloadMgrDownloadsList::AttachAIWInterestL
  2524 // CDownloadMgrDownloadsList::AttachAIWInterestL
  2463 // -----------------------------------------------------------------------------
  2525 // -----------------------------------------------------------------------------
  2464 //
  2526 //
  2465 void CDownloadMgrUiDownloadsList::AttachAIWInterestL()
  2527 void CDownloadMgrUiDownloadsList::AttachAIWInterestL()
  2485 // ----------------------------------------------------
  2547 // ----------------------------------------------------
  2486 // CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload)
  2548 // CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload)
  2487 // ----------------------------------------------------
  2549 // ----------------------------------------------------
  2488 //
  2550 //
  2489 void CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload)
  2551 void CDownloadMgrUiDownloadsList::HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload)
  2490     {
  2552     
  2491     // The command is an AIW command
  2553     {
       
  2554     //Check if file exists
       
  2555     HBufC* fileName = HBufC::NewLC( KMaxPath );
       
  2556     TPtr fileNamePtr = fileName->Des();
       
  2557     User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
       
  2558 	if(!iUiUtils->IsDuplicateL(fileNamePtr))
       
  2559 	    {
       
  2560 		HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND);
       
  2561         CAknInformationNote* note = new(ELeave)  CAknInformationNote();
       
  2562         note->ExecuteLD(*infoPrompt);
       
  2563         CleanupStack::PopAndDestroy(infoPrompt);	
       
  2564         CleanupStack::PopAndDestroy(fileName);  
       
  2565         return;
       
  2566 	    }			    	
       
  2567     CleanupStack::PopAndDestroy(fileName);			
       
  2568     
       
  2569     // The command is an AIW command    
  2492     CAiwGenericParamList& params = iAIWServiceHandler->InParamListL();
  2570     CAiwGenericParamList& params = iAIWServiceHandler->InParamListL();
  2493     TInt aiwOptions( 0 );
  2571     TInt aiwOptions( 0 );
  2494 
  2572 
  2495     ProvideInputParametersL( params, aiwOptions, aDownload );
  2573     ProvideInputParametersL( params, aiwOptions, aDownload );
  2496     CAiwGenericParamList& output = iAIWServiceHandler->OutParamListL();
  2574     CAiwGenericParamList& output = iAIWServiceHandler->OutParamListL();
  2512     TAiwVariant fileNameVariant( fileNamePtr );
  2590     TAiwVariant fileNameVariant( fileNamePtr );
  2513     TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant );
  2591     TAiwGenericParam genericParamFileName( EGenericParamFile, fileNameVariant );
  2514 	aParams.AppendL( genericParamFileName );
  2592 	aParams.AppendL( genericParamFileName );
  2515 
  2593 
  2516 	HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength);
  2594 	HBufC* contentType = HBufC::NewLC(KMaxContentTypeLength);
  2517 	TPtr contentTypePtr = contentType->Des();
  2595 	TPtr contentTypePtr = contentType->Des(); 
  2518     User::LeaveIfError
  2596     User::LeaveIfError
  2519                 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) );
  2597                 ( aDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) );
  2520     fileNameVariant.Set(contentTypePtr);
  2598     fileNameVariant.Set(contentTypePtr);
  2521     TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant );
  2599     TAiwGenericParam genericParamMimeType( EGenericParamMIMEType, fileNameVariant );
  2522     aParams.AppendL( genericParamMimeType );
  2600     aParams.AppendL( genericParamMimeType );
  2523     CleanupStack::PopAndDestroy( contentType );
  2601     CleanupStack::PopAndDestroy( contentType );
  2524     CleanupStack::PopAndDestroy( fileName );
  2602     CleanupStack::PopAndDestroy( fileName );
  2525 
  2603    
  2526     }
  2604     }
  2527 
  2605     
  2528 // -----------------------------------------------------------------------------
  2606 // -----------------------------------------------------------------------------
  2529 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL
  2607 // CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL
  2530 // -----------------------------------------------------------------------------
  2608 // -----------------------------------------------------------------------------
  2531 //
  2609 //
  2532 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId,
  2610 void CDownloadMgrUiDownloadsList::InitializeAIWPlugInMenusL( TInt aResourceId,
  2563     {
  2641     {
  2564     iDownloadListHide = aHide;
  2642     iDownloadListHide = aHide;
  2565     }
  2643     }
  2566 #ifdef __WINS__
  2644 #ifdef __WINS__
  2567 #include <commdb.h>
  2645 #include <commdb.h>
  2568 #include <aknlists.h>
  2646 #include <AknLists.h>
  2569 // ----------------------------------------------------------------------------
  2647 // ----------------------------------------------------------------------------
  2570 // AskIapId(TUint32& aId)
  2648 // AskIapId(TUint32& aId)
  2571 // Ask IAP id from the user. Used due to efficiency only on WINS* platforms.
  2649 // Ask IAP id from the user. Used due to efficiency only on WINS* platforms.
  2572 // ----------------------------------------------------------------------------
  2650 // ----------------------------------------------------------------------------
  2573 //
  2651 //
  2576     RArray<TUint32> idArray;
  2654     RArray<TUint32> idArray;
  2577     CleanupClosePushL( idArray );
  2655     CleanupClosePushL( idArray );
  2578 
  2656 
  2579     CDesCArrayFlat* nameArray = new (ELeave) CDesCArrayFlat(16);
  2657     CDesCArrayFlat* nameArray = new (ELeave) CDesCArrayFlat(16);
  2580     CleanupStack::PushL( nameArray );
  2658     CleanupStack::PushL( nameArray );
  2581 
  2659     
  2582     // Get IAP names and ids from the database
  2660     // Get IAP names and ids from the database
  2583     CCommsDatabase* TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
  2661     CCommsDatabase* TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
  2584     CleanupStack::PushL( TheDb );
  2662     CleanupStack::PushL( TheDb );
  2585 
  2663 
  2586     TheDb->ShowHiddenRecords();
  2664     TheDb->ShowHiddenRecords();
  2592     TInt res = view->GotoFirstRecord();
  2670     TInt res = view->GotoFirstRecord();
  2593     while( res == KErrNone )
  2671     while( res == KErrNone )
  2594     {
  2672     {
  2595         view->ReadTextL( TPtrC(COMMDB_NAME), name );
  2673         view->ReadTextL( TPtrC(COMMDB_NAME), name );
  2596         view->ReadUintL( TPtrC(COMMDB_ID), id );
  2674         view->ReadUintL( TPtrC(COMMDB_ID), id );
  2597 
  2675         
  2598         idArray.Insert( id, 0 );
  2676         idArray.Insert( id, 0 );
  2599         nameArray->InsertL( 0, name );
  2677         nameArray->InsertL( 0, name );
  2600 
  2678 
  2601         res = view->GotoNextRecord();
  2679         res = view->GotoNextRecord();
  2602         RDebug::Print(_L("IAP name, id: %S, %d"), &name, id);
  2680         RDebug::Print(_L("IAP name, id: %S, %d"), &name, id);
  2603     }
  2681     }
  2604 
  2682     
  2605     CleanupStack::PopAndDestroy( view ); // view
  2683     CleanupStack::PopAndDestroy( view ); // view
  2606     CleanupStack::PopAndDestroy( TheDb ); // TheDb
  2684     CleanupStack::PopAndDestroy( TheDb ); // TheDb
  2607 
  2685     
  2608     // Create listbox and PUSH it.
  2686     // Create listbox and PUSH it.
  2609     CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox;
  2687     CEikTextListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox;
  2610     CleanupStack::PushL( list );
  2688     CleanupStack::PushL( list );
  2611 
  2689     
  2612     // Create popup list and PUSH it.
  2690     // Create popup list and PUSH it.
  2613     CAknPopupList* popupList = CAknPopupList::NewL(
  2691     CAknPopupList* popupList = CAknPopupList::NewL(
  2614         list, R_AVKON_SOFTKEYS_OK_EMPTY__OK,
  2692         list, R_AVKON_SOFTKEYS_OK_EMPTY__OK,
  2615         AknPopupLayouts::EMenuWindow);
  2693         AknPopupLayouts::EMenuWindow);
  2616     CleanupStack::PushL( popupList );
  2694     CleanupStack::PushL( popupList );
  2617 
  2695     
  2618     // initialize listbox.
  2696     // initialize listbox.
  2619     list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
  2697     list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
  2620     list->CreateScrollBarFrameL( ETrue );
  2698     list->CreateScrollBarFrameL( ETrue );
  2621     list->ScrollBarFrame()->SetScrollBarVisibilityL(
  2699     list->ScrollBarFrame()->SetScrollBarVisibilityL(
  2622         CEikScrollBarFrame::EOff,
  2700         CEikScrollBarFrame::EOff,
  2623         CEikScrollBarFrame::EAuto );
  2701         CEikScrollBarFrame::EAuto );
  2624 
  2702     
  2625     // Set listitems.
  2703     // Set listitems.
  2626     CTextListBoxModel* model = list->Model();
  2704     CTextListBoxModel* model = list->Model();
  2627     model->SetItemTextArray( nameArray );
  2705     model->SetItemTextArray( nameArray );
  2628     model->SetOwnershipType( ELbmDoesNotOwnItemArray );
  2706     model->SetOwnershipType( ELbmDoesNotOwnItemArray );
  2629 
  2707     
  2630     // Set title
  2708     // Set title
  2631     popupList->SetTitleL( _L("Select IAP:") );
  2709     popupList->SetTitleL( _L("Select IAP:") );
  2632 
  2710     
  2633     // Show popup list.
  2711     // Show popup list.
  2634     TInt popupOk = popupList->ExecuteLD();
  2712     TInt popupOk = popupList->ExecuteLD();
  2635     CleanupStack::Pop( popupList ); // popupList
  2713     CleanupStack::Pop( popupList ); // popupList
  2636     if ( popupOk )
  2714     if ( popupOk )
  2637         {
  2715         {
  2638         TInt index = list->CurrentItemIndex();
  2716         TInt index = list->CurrentItemIndex();
  2639         aId = idArray[index];
  2717         aId = idArray[index];
  2640         }
  2718         }
  2641 
  2719     
  2642     CleanupStack::PopAndDestroy( 3, &idArray );  // list, nameArray, idArray
  2720     CleanupStack::PopAndDestroy( 3, &idArray );  // list, nameArray, idArray
  2643 
  2721     
  2644     return popupOk;
  2722     return popupOk;
  2645     }
  2723     }
  2646 #endif // #ifdef __WINS__
  2724 #endif // #ifdef __WINS__
  2647 
  2725 
  2648 /* End of file. */
  2726 /* End of file. */
  2649 
  2727 
       
  2728