browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiUserInteractions.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 91 30342f40acbf
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    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"
   352 
   354 
   353     // will delete client's completed, not hidden downloads
   355     // will delete client's completed, not hidden downloads
   354     THttpDownloadState state;
   356     THttpDownloadState state;
   355     THttpProgressState progState;
   357     THttpProgressState progState;
   356     TBool isHiddenDel = EFalse;
   358     TBool isHiddenDel = EFalse;
       
   359     TBool isCodDownload( EFalse );
   357     TBool isProg (EFalse);
   360     TBool isProg (EFalse);
   358     // check if progressive download, if yes, will NOT delete from the list, otherwise will
   361     // check if progressive download, if yes, will NOT delete from the list, otherwise will
   359     const CDownloadArray& downloadsDel = iRegistryModel.DownloadMgr().CurrentDownloads();
   362     const CDownloadArray& downloadsDel = iRegistryModel.DownloadMgr().CurrentDownloads();
   360     for ( TInt i = downloadCnt - 1; i >= 0; --i )
   363     for ( TInt i = downloadCnt - 1; i >= 0; --i )
   361         {
   364         {
   452         TInt resp = conf->RunLD();
   455         TInt resp = conf->RunLD();
   453         CleanupStack::PopAndDestroy( prompt ); // prompt
   456         CleanupStack::PopAndDestroy( prompt ); // prompt
   454         
   457         
   455         downloadCnt = iRegistryModel.DownloadCount();
   458         downloadCnt = iRegistryModel.DownloadCount();
   456 
   459 
   457        
   460         TBool isProgressive (EFalse);
   458         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   461         if ( resp == EAknSoftkeyYes || resp == EAknSoftkeyOk )
   459 		    {
   462 		    {
   460             for ( TInt i = downloadCnt - 1; i >=0; --i )
   463             for ( TInt i = downloadCnt - 1; i >=0; --i )
   461 		        {
   464 		        {
   462 	            RHttpDownload* dl = downloads.At(i); //current download
   465 	            RHttpDownload* dl = downloads.At(i); //current download
       
   466                 dl->GetBoolAttribute( EDlAttrProgressive, isProgressive );
   463                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   467                 dl->GetBoolAttribute( EDlAttrPausable , isPausable );
   464                 if (!( isPausable ) ) // delete only Non pausable Downloads
   468                 if (!( isProgressive || isPausable ) ) // delete only no-PDL downloads and Non pausable Downloads
   465     			    {
   469     			    {
   466                     // Delete not attached downloads.
   470                     // Delete not attached downloads.
   467     	            dl->Delete(); // Return value ignored.
   471     	            dl->Delete(); // Return value ignored.
   468 			        }
   472 			        }
   469 		        }
   473 		        }
   906     THttpDownloadState state;
   910     THttpDownloadState state;
   907     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   911     const CDownloadArray& downloads = iRegistryModel.DownloadMgr().CurrentDownloads();
   908     for( TInt i = 0; i < downloadCnt; ++i )
   912     for( TInt i = 0; i < downloadCnt; ++i )
   909         {
   913         {
   910         RHttpDownload* dl = downloads.At(i); // current download
   914         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 || !tempPtr.Length()  ) )
   941         if ( !err && ( !isPausable || isHidden ||isNoMedia || state == EHttpDlMultipleMOCompleted  ) )
   942             {
   942             {
   943             ++ignoredDownloads;
   943             ++ignoredDownloads;
   944             }
   944             }
   945         CleanupStack::PopAndDestroy( name ); // name 			
       
   946         }
   945         }
   947     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   946     CLOG_WRITE_FORMAT(" downloadCnt: %d",downloadCnt);
   948     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   947     CLOG_WRITE_FORMAT(" ignoredDownloads: %d",ignoredDownloads);
   949         
   948         
   950     // the new downloadCnt holds only those downloads, that count from the 
   949     // the new downloadCnt holds only those downloads, that count from the 
  1041         if ( &(handlerI->Download()) == &aDownload )
  1040         if ( &(handlerI->Download()) == &aDownload )
  1042             {
  1041             {
  1043             // found one.
  1042             // found one.
  1044             if ( handlerI->DownloadConfirmationShown() )
  1043             if ( handlerI->DownloadConfirmationShown() )
  1045                 {
  1044                 {
       
  1045                 delete handlerI;
  1046                 iEventHandlerArray->Remove( handlerI );
  1046                 iEventHandlerArray->Remove( handlerI );
  1047                 delete handlerI;
       
  1048                 --i;
  1047                 --i;
  1049                 --handlerCount;
  1048                 --handlerCount;
  1050                 }
  1049                 }
  1051             }
  1050             }
  1052         }
  1051         }