browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiUserInteractions.cpp
changeset 65 5bfc169077b2
parent 37 cb62a4f66ebe
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    13 *
    13 *
    14 * Description:  Supports user interaction dialogs for downloads
    14 * Description:  Supports user interaction dialogs for downloads
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
       
    19 
    18 // INCLUDE FILES
    20 // INCLUDE FILES
    19 #include    <cdownloadmgruiuserinteractions.h>
    21 #include    "CDownloadMgrUiUserInteractions.h"
    20 #include    "CUserInteractionsUtils.h"
    22 #include    "CUserInteractionsUtils.h"
    21 #include    <cdownloadmgruidownloadslist.h>
    23 #include    "CDownloadMgrUiDownloadsList.h"
    22 #include    <cdownloadmgruilibregistry.h>
    24 #include    "CDownloadMgrUiLibRegistry.h"
    23 #include    "UserInteractionsEventHandler.h"
    25 #include    "UserInteractionsEventHandler.h"
    24 #include    "AsyncEventHandlerArray.h"
    26 #include    "AsyncEventHandlerArray.h"
    25 #include    "UiLibLogger.h"
    27 #include    "UiLibLogger.h"
    26 #include    "DMgrUiLibPanic.h"
    28 #include    "DMgrUiLibPanic.h"
    27 #include    "MDownloadHandlerObserver.h"
    29 #include    "MDownloadHandlerObserver.h"
   453         TInt resp = conf->RunLD();
   455         TInt resp = conf->RunLD();
   454         CleanupStack::PopAndDestroy( prompt ); // prompt
   456         CleanupStack::PopAndDestroy( prompt ); // prompt
   455         
   457         
   456         downloadCnt = iRegistryModel.DownloadCount();
   458         downloadCnt = iRegistryModel.DownloadCount();
   457 
   459 
   458        
   460         TBool isProgressive (EFalse);
   459         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   461         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   460 		    {
   462 		    {
   461             for ( TInt i = downloadCnt - 1; i >=0; --i )
   463             for ( TInt i = downloadCnt - 1; i >=0; --i )
   462 		        {
   464 		        {
   463 	            RHttpDownload* dl = downloads.At(i); //current download
   465 	            RHttpDownload* dl = downloads.At(i); //current download
       
   466                 dl->GetBoolAttribute( EDlAttrProgressive, isProgressive );
   464                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   467                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   465                 if (!( isPausable ) ) // delete only Non pausable Downloads
   468                 if (!( isProgressive || isPausable ) ) // delete only no-PDL downloads and Non pausable Downloads
   466     			    {
   469     			    {
   467                     // Delete not attached downloads.
   470                     // Delete not attached downloads.
   468     	            dl->Delete(); // Return value ignored.
   471     	            dl->Delete(); // Return value ignored.
   469 			        }
   472 			        }
   470 		        }
   473 		        }
   907     THttpDownloadState state;
   910     THttpDownloadState state;
   908     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   911     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   909     for( TInt i = 0; i < downloadCnt; ++i )
   912     for( TInt i = 0; i < downloadCnt; ++i )
   910         {
   913         {
   911         RHttpDownload* dl = downloads.At(i); // current download
   914         RHttpDownload* dl = downloads.At(i); // current download
   912         // we do not have to show the download in case of invalid descriptor
       
   913         HBufC* name = HBufC::NewLC( KMaxUrlLength );
       
   914         TPtr tempPtr = name->Des(); 
       
   915         dl->GetStringAttribute( EDlAttrName, tempPtr );		
       
   916         err = dl->GetBoolAttribute( EDlAttrPausable, isPausable );
   915         err = dl->GetBoolAttribute( EDlAttrPausable, isPausable );
   917         if ( !err )
   916         if ( !err )
   918             {
   917             {
   919             err = dl->GetBoolAttribute( EDlAttrHidden, isHidden );
   918             err = dl->GetBoolAttribute( EDlAttrHidden, isHidden );
   920             }
   919             }
   937         if ( !err )
   936         if ( !err )
   938         	{
   937         	{
   939         	err = dl->GetBoolAttribute( EDlAttrNoMedia, isNoMedia );
   938         	err = dl->GetBoolAttribute( EDlAttrNoMedia, isNoMedia );
   940         	}
   939         	}
   941         CLOG_WRITE_FORMAT(" err: %d",err);
   940         CLOG_WRITE_FORMAT(" err: %d",err);
   942         if ( !err && ( !isPausable || isHidden ||isNoMedia || state == EHttpDlMultipleMOCompleted || !tempPtr.Length()  ) )
   941         if ( !err && ( !isPausable || isHidden ||isNoMedia || state == EHttpDlMultipleMOCompleted  ) )
   943             {
   942             {
   944             ++ignoredDownloads;
   943             ++ignoredDownloads;
   945             }
   944             }
   946         CleanupStack::PopAndDestroy( name ); // name 			
       
   947         }
   945         }
   948     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   946     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   949     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   947     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   950         
   948         
   951     // the new downloadCnt holds only those downloads, that count from the 
   949     // the new downloadCnt holds only those downloads, that count from the