browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp
changeset 10 a359256acfc6
parent 1 7c90e6132015
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
  1843             TPtr fileNamePtr = fileName->Des();
  1843             TPtr fileNamePtr = fileName->Des();
  1844             User::LeaveIfError
  1844             User::LeaveIfError
  1845                ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  1845                ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
  1846             CLOG_WRITE_FORMAT(" EDlAttrDestFilename: %S", &fileNamePtr);
  1846             CLOG_WRITE_FORMAT(" EDlAttrDestFilename: %S", &fileNamePtr);
  1847 
  1847 
       
  1848             HBufC* fileName1 = HBufC::NewLC(fileName->Length());
       
  1849             TPtr fileNamePtr1 = fileName1->Des();
       
  1850             fileNamePtr1.Copy(fileNamePtr);
       
  1851             RFs fs;
       
  1852             User::LeaveIfError(fs.Connect());
       
  1853             CleanupClosePushL(fs);
       
  1854             TFindFile file(fs);
       
  1855             TPtrC ptr(KNullDesC);
       
  1856             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
       
  1857             CleanupStack::PopAndDestroy(&fs);
       
  1858             CleanupStack::PopAndDestroy(fileName1);
  1848             // Delete in DMgr
  1859             // Delete in DMgr
  1849             TBool deleted = iUiUtils->DeleteWithUserConfirmL( currDownload );
  1860             TBool deleted = iUiUtils->DeleteWithUserConfirmL( currDownload );
  1850             if ( deleted )
  1861             if ( deleted )
  1851                 {
  1862                 {
  1852                                 
       
  1853                 if(!iUiUtils->IsCodDownload())
  1863                 if(!iUiUtils->IsCodDownload())
  1854                 	{
  1864                 	{
  1855                 	HBufC* fileName1 = HBufC::NewLC(fileName->Length());
  1865                       if(found == KErrNotFound)
  1856                 TPtr fileNamePtr1 = fileName1->Des();
  1866                          {
  1857                 fileNamePtr1.Copy(fileNamePtr);
  1867                           HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND);
  1858                 RFs fs;
  1868                           CAknInformationNote* note = new(ELeave)  CAknInformationNote();
  1859                 User::LeaveIfError(fs.Connect());
  1869                           note->ExecuteLD(*infoPrompt);
  1860                 CleanupClosePushL(fs);
  1870                           CleanupStack::PopAndDestroy(infoPrompt);
  1861                 TFindFile file(fs);
  1871                          }
  1862                 TPtrC ptr(KNullDesC);
       
  1863                 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
       
  1864                 if(found == KErrNotFound)
       
  1865                     {
       
  1866                         HBufC* infoPrompt = StringLoader::LoadLC( R_DMUL_ERROR_FILE_NOT_FOUND);
       
  1867                         CAknInformationNote* note = new(ELeave)  CAknInformationNote();
       
  1868                         note->ExecuteLD(*infoPrompt);
       
  1869                         CleanupStack::PopAndDestroy(infoPrompt);
       
  1870                     }
       
  1871                CleanupStack::PopAndDestroy(&fs);
       
  1872                CleanupStack::PopAndDestroy(fileName1);
       
  1873     			   // Do not wait until the delete event is reported through the 
  1872     			   // Do not wait until the delete event is reported through the 
  1874     			   // observer callback, but update the list right now, 
  1873     			   // observer callback, but update the list right now, 
  1875     			   // so the user will not be able to access and modify an already
  1874     			   // so the user will not be able to access and modify an already
  1876     			   // deleted download:
  1875     			   // deleted download:
  1877     			   DeleteDownloadL( currDownload );
  1876     			   DeleteDownloadL( currDownload );
  2014 	            	{
  2013 	            	{
  2015 	            	iIsCancelInProgress = EFalse;
  2014 	            	iIsCancelInProgress = EFalse;
  2016 	            	User::LeaveIfError(err);
  2015 	            	User::LeaveIfError(err);
  2017 	            	}
  2016 	            	}
  2018 	            TInt count = Count();
  2017 	            TInt count = Count();
  2019 	            for ( TInt i = 0; i < count; i++ )
  2018 	            TInt i = 0;
       
  2019 	            while((count>0) && (i < count))
  2020 	                {
  2020 	                {
  2021 	                RHttpDownload& download = iListModel->Download(i);
  2021 	                RHttpDownload& download = iListModel->Download(i);
       
  2022                     i++;
  2022 	                if ( cancelled )
  2023 	                if ( cancelled )
  2023 	                    {
  2024 	                    {
  2024 	                    DeleteDownloadL( download );
  2025 	                    DeleteDownloadL( download );
       
  2026 	                    i--;
       
  2027 	                    count--;
  2025 	                    }
  2028 	                    }
  2026 	                }
  2029 	                }
  2027 	            iIsCancelInProgress = EFalse;
  2030 	            iIsCancelInProgress = EFalse;
  2028             	}
  2031             	}
  2029         	break;
  2032         	break;