browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiUserInteractions.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    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 
       
    20 // INCLUDE FILES
    18 // INCLUDE FILES
    21 #include    "CDownloadMgrUiUserInteractions.h"
    19 #include    <cdownloadmgruiuserinteractions.h>
    22 #include    "CUserInteractionsUtils.h"
    20 #include    "CUserInteractionsUtils.h"
    23 #include    "CDownloadMgrUiDownloadsList.h"
    21 #include    <cdownloadmgruidownloadslist.h>
    24 #include    "CDownloadMgrUiLibRegistry.h"
    22 #include    <cdownloadmgruilibregistry.h>
    25 #include    "UserInteractionsEventHandler.h"
    23 #include    "UserInteractionsEventHandler.h"
    26 #include    "AsyncEventHandlerArray.h"
    24 #include    "AsyncEventHandlerArray.h"
    27 #include    "UiLibLogger.h"
    25 #include    "UiLibLogger.h"
    28 #include    "DMgrUiLibPanic.h"
    26 #include    "DMgrUiLibPanic.h"
    29 #include    "MDownloadHandlerObserver.h"
    27 #include    "MDownloadHandlerObserver.h"
   354 
   352 
   355     // will delete client's completed, not hidden downloads
   353     // will delete client's completed, not hidden downloads
   356     THttpDownloadState state;
   354     THttpDownloadState state;
   357     THttpProgressState progState;
   355     THttpProgressState progState;
   358     TBool isHiddenDel = EFalse;
   356     TBool isHiddenDel = EFalse;
   359     TBool isCodDownload( EFalse );
       
   360     TBool isProg (EFalse);
   357     TBool isProg (EFalse);
   361     // check if progressive download, if yes, will NOT delete from the list, otherwise will
   358     // check if progressive download, if yes, will NOT delete from the list, otherwise will
   362     const CDownloadArray& downloadsDel = iRegistryModel.DownloadMgr().CurrentDownloads();
   359     const CDownloadArray& downloadsDel = iRegistryModel.DownloadMgr().CurrentDownloads();
   363     for ( TInt i = downloadCnt - 1; i >= 0; --i )
   360     for ( TInt i = downloadCnt - 1; i >= 0; --i )
   364         {
   361         {
   455         TInt resp = conf->RunLD();
   452         TInt resp = conf->RunLD();
   456         CleanupStack::PopAndDestroy( prompt ); // prompt
   453         CleanupStack::PopAndDestroy( prompt ); // prompt
   457         
   454         
   458         downloadCnt = iRegistryModel.DownloadCount();
   455         downloadCnt = iRegistryModel.DownloadCount();
   459 
   456 
   460         TBool isProgressive (EFalse);
   457        
   461         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   458         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   462 		    {
   459 		    {
   463             for ( TInt i = downloadCnt - 1; i >=0; --i )
   460             for ( TInt i = downloadCnt - 1; i >=0; --i )
   464 		        {
   461 		        {
   465 	            RHttpDownload* dl = downloads.At(i); //current download
   462 	            RHttpDownload* dl = downloads.At(i); //current download
   466                 dl->GetBoolAttribute( EDlAttrProgressive, isProgressive );
       
   467                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   463                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   468                 if (!( isProgressive || isPausable ) ) // delete only no-PDL downloads and Non pausable Downloads
   464                 if (!( isPausable ) ) // delete only Non pausable Downloads
   469     			    {
   465     			    {
   470                     // Delete not attached downloads.
   466                     // Delete not attached downloads.
   471     	            dl->Delete(); // Return value ignored.
   467     	            dl->Delete(); // Return value ignored.
   472 			        }
   468 			        }
   473 		        }
   469 		        }
   910     THttpDownloadState state;
   906     THttpDownloadState state;
   911     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   907     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   912     for( TInt i = 0; i < downloadCnt; ++i )
   908     for( TInt i = 0; i < downloadCnt; ++i )
   913         {
   909         {
   914         RHttpDownload* dl = downloads.At(i); // current download
   910         RHttpDownload* dl = downloads.At(i); // current download
       
   911         // we do not have to show the download in case of invalid descriptor
       
   912         HBufC* name = HBufC::NewLC( KMaxUrlLength );
       
   913         TPtr tempPtr = name->Des(); 
       
   914         dl->GetStringAttribute( EDlAttrName, tempPtr );		
   915         err = dl->GetBoolAttribute( EDlAttrPausable, isPausable );
   915         err = dl->GetBoolAttribute( EDlAttrPausable, isPausable );
   916         if ( !err )
   916         if ( !err )
   917             {
   917             {
   918             err = dl->GetBoolAttribute( EDlAttrHidden, isHidden );
   918             err = dl->GetBoolAttribute( EDlAttrHidden, isHidden );
   919             }
   919             }
   936         if ( !err )
   936         if ( !err )
   937         	{
   937         	{
   938         	err = dl->GetBoolAttribute( EDlAttrNoMedia, isNoMedia );
   938         	err = dl->GetBoolAttribute( EDlAttrNoMedia, isNoMedia );
   939         	}
   939         	}
   940         CLOG_WRITE_FORMAT(" err: %d",err);
   940         CLOG_WRITE_FORMAT(" err: %d",err);
   941         if ( !err && ( !isPausable || isHidden ||isNoMedia || state == EHttpDlMultipleMOCompleted  ) )
   941         if ( !err && ( !isPausable || isHidden ||isNoMedia || state == EHttpDlMultipleMOCompleted || !tempPtr.Length()  ) )
   942             {
   942             {
   943             ++ignoredDownloads;
   943             ++ignoredDownloads;
   944             }
   944             }
       
   945         CleanupStack::PopAndDestroy( name ); // name 			
   945         }
   946         }
   946     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   947     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   947     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   948     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   948         
   949         
   949     // the new downloadCnt holds only those downloads, that count from the 
   950     // the new downloadCnt holds only those downloads, that count from the 
  1040         if ( &(handlerI->Download()) == &aDownload )
  1041         if ( &(handlerI->Download()) == &aDownload )
  1041             {
  1042             {
  1042             // found one.
  1043             // found one.
  1043             if ( handlerI->DownloadConfirmationShown() )
  1044             if ( handlerI->DownloadConfirmationShown() )
  1044                 {
  1045                 {
       
  1046                 iEventHandlerArray->Remove( handlerI );
  1045                 delete handlerI;
  1047                 delete handlerI;
  1046                 iEventHandlerArray->Remove( handlerI );
       
  1047                 --i;
  1048                 --i;
  1048                 --handlerCount;
  1049                 --handlerCount;
  1049                 }
  1050                 }
  1050             }
  1051             }
  1051         }
  1052         }