ncdengine/engine/transport/src/catalogshttpdownloadmanagerimpl.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    30 #include "catalogsnetworkmanager.h"
    30 #include "catalogsnetworkmanager.h"
    31 #include "catalogshttpsessionimpl.h"
    31 #include "catalogshttpsessionimpl.h"
    32 #include "catalogsconnection.h"
    32 #include "catalogsconnection.h"
    33 
    33 
    34 #include "catalogsdebug.h"
    34 #include "catalogsdebug.h"
    35 #include <QString>
    35 
    36 #include <QVector>
       
    37 #include <QList>
       
    38 #include <downloadevent.h>
       
    39 #include <xqconversions.h>
       
    40 // ======== MEMBER FUNCTIONS ========
    36 // ======== MEMBER FUNCTIONS ========
    41 
    37 
    42 // ---------------------------------------------------------------------------
    38 // ---------------------------------------------------------------------------
    43 // Creator
    39 // Creator
    44 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    61                 aTransactionManager, 
    57                 aTransactionManager, 
    62                 aConnectionManager );        
    58                 aConnectionManager );        
    63             
    59             
    64     DLTRACE(("constructor ok"));
    60     DLTRACE(("constructor ok"));
    65     CleanupStack::PushL( self );
    61     CleanupStack::PushL( self );
    66    
       
    67     self->ConstructL( aCleanup );
    62     self->ConstructL( aCleanup );
    68     CleanupStack::Pop( self );
    63     CleanupStack::Pop( self );
    69     return self;
    64     return self;
    70     }
    65     }
    71 
    66 
    76 CCatalogsHttpDownloadManager::~CCatalogsHttpDownloadManager()
    71 CCatalogsHttpDownloadManager::~CCatalogsHttpDownloadManager()
    77     {
    72     {
    78     DLTRACEIN( ( "" ) );
    73     DLTRACEIN( ( "" ) );
    79 
    74 
    80     Cancel();
    75     Cancel();
    81     // HLa iEventQueue.Close();
    76     iEventQueue.Close();
    82 
    77 
    83     // Release downloads
    78     // Release downloads
    84     TInt count = iDownloads.Count() - 1;
    79     TInt count = iDownloads.Count() - 1;
    85     while( count > -1 )
    80     while( count > -1 )
    86         {
    81         {
   105     if ( iNetworkManager ) 
   100     if ( iNetworkManager ) 
   106         {
   101         {
   107         iNetworkManager->RemoveObserver( *this );
   102         iNetworkManager->RemoveObserver( *this );
   108         }
   103         }
   109 
   104 
   110 
   105     if ( iDmgr.Handle() ) 
   111     if ( iDmgr ) 
       
   112         {
   106         {
   113         DLTRACE(("We were connected to DL manager"));
   107         DLTRACE(("We were connected to DL manager"));
   114         DeleteHangingDownloads();
   108         DeleteHangingDownloads();
   115         }
   109         }
   116       
   110         
   117     // Close download manager session    
   111     // Close download manager session    
   118     iDmgr->removeAll();
   112     iDmgr.Close();
   119     
   113     
   120    
       
   121     delete iDefaultConfig;
   114     delete iDefaultConfig;
   122     iManager.Release();
   115     iManager.Release();
   123     
   116     
   124     iFs.Close();
   117     iFs.Close();
   125 
   118 
   129 
   122 
   130 void CCatalogsHttpDownloadManager::DeleteHangingDownloads() 
   123 void CCatalogsHttpDownloadManager::DeleteHangingDownloads() 
   131     {
   124     {
   132     DLTRACEIN((""));
   125     DLTRACEIN((""));
   133     // This pauses all downloads in addition to disconnecting
   126     // This pauses all downloads in addition to disconnecting
   134  	iDmgr->pauseAll(); 
   127     iDmgr.Disconnect();
   135    TInt count = iDownloads.Count();
   128     const CDownloadArray& downloads( iDmgr.CurrentDownloads() );
   136     for ( TInt i = 0; i < count; ++i )
   129 
   137         {
   130     TInt count = downloads.Count();
   138          TInt32 deleteStatus = 0;
   131     while( count-- )
   139          deleteStatus = dynamic_cast<CCatalogsHttpDownload*>(iDownloads[i])->GetStatusState();
   132         {                         
   140        
   133         RHttpDownload& dl = *( downloads[ count ] );
   141          if ( deleteStatus == CCatalogsHttpDownload::EDownloadCanBeDeleted ) 
   134         TInt32 deleteStatus = 0;
       
   135         dl.GetIntAttribute( EDlAttrUserData, deleteStatus );
       
   136         DLTRACE(("DeleteStatus: %d", deleteStatus ));
       
   137         
       
   138         if ( deleteStatus == CCatalogsHttpDownload::EDownloadCanBeDeleted ) 
   142             {
   139             {
   143             DLTRACE(("Deleting download"));
   140             DLTRACE(("Deleting download"));
   144             iDmgr->removeOne(dynamic_cast<CCatalogsHttpDownload*>(iDownloads[i])->GetDownload());
   141             dl.Delete();
   145             }
   142             }
   146         }        
   143         
   147         
   144         }
   148     }
   145     }
   149 
   146 
   150 // ---------------------------------------------------------------------------
   147 // ---------------------------------------------------------------------------
   151 // Download creator
   148 // Download creator
   152 // ---------------------------------------------------------------------------
   149 // ---------------------------------------------------------------------------
   173 MCatalogsHttpOperation* CCatalogsHttpDownloadManager::CreateDownloadL( 
   170 MCatalogsHttpOperation* CCatalogsHttpDownloadManager::CreateDownloadL( 
   174     const TDesC8& aUrl, TBool /* aStart */, MCatalogsHttpObserver* aObserver )
   171     const TDesC8& aUrl, TBool /* aStart */, MCatalogsHttpObserver* aObserver )
   175     {
   172     {
   176     DLTRACEIN((""));
   173     DLTRACEIN((""));
   177     // Create a new download
   174     // Create a new download
   178     QString Url = XQConversions::s60Desc8ToQString(aUrl);  
       
   179     iDownload = iDmgr->createDownload( Url );
       
   180     
       
   181     CCatalogsHttpDownload* dl = CCatalogsHttpDownload::NewLC( 
   175     CCatalogsHttpDownload* dl = CCatalogsHttpDownload::NewLC( 
   182         *this,
   176         *this,
   183         //download,
   177         //download,
   184         iDownload,
   178         NULL,
   185         *iDefaultConfig );
   179         *iDefaultConfig );
   186     
   180     
   187     dl->SetUriL( aUrl );
   181     dl->SetUriL( aUrl );
   188     dl->SetFileServerSession( iFs );
   182     dl->SetFileServerSession( iFs );
   189         // If the given observer != NULL, set it as the observer for the download
   183     
       
   184     // If the given observer != NULL, set it as the observer for the download
   190     if ( aObserver ) 
   185     if ( aObserver ) 
   191         {        
   186         {        
   192         dl->Config().SetObserver( aObserver );        
   187         dl->Config().SetObserver( aObserver );        
   193         }
   188         }
   194     
   189     
   210     const TCatalogsTransportOperationId& aId ) const
   205     const TCatalogsTransportOperationId& aId ) const
   211     {
   206     {
   212     TInt count = iDownloads.Count();
   207     TInt count = iDownloads.Count();
   213     for ( TInt i = 0; i < count; ++i )
   208     for ( TInt i = 0; i < count; ++i )
   214         {
   209         {
   215         	
       
   216         if ( iDownloads[i]->OperationId() == aId ) 
   210         if ( iDownloads[i]->OperationId() == aId ) 
   217             {
   211             {
   218             return iDownloads[i];
   212             return iDownloads[i];
   219             }
   213             }
   220         }
   214         }
   400     const TCatalogsConnectionMethod& aMethod )
   394     const TCatalogsConnectionMethod& aMethod )
   401     {
   395     {
   402     DLTRACEIN((""));
   396     DLTRACEIN((""));
   403     if ( aMethod != iCurrentAp )
   397     if ( aMethod != iCurrentAp )
   404         {
   398         {
   405 		try
       
   406 		{
       
   407         DLTRACE( ( "Set AP, type: %d, id: %u, apn: %d", 
   399         DLTRACE( ( "Set AP, type: %d, id: %u, apn: %d", 
   408             aMethod.iType, aMethod.iId, aMethod.iApnId ));
   400             aMethod.iType, aMethod.iId, aMethod.iApnId ));
   409 		 iDmgr->pauseAll(); 
   401         User::LeaveIfError( iDmgr.Disconnect() );    
   410 		 
   402         User::LeaveIfError( iDmgr.SetIntAttribute( EDlMgrIap, aMethod.iApnId ) );
   411         iCurrentAp = aMethod;
   403         iCurrentAp = aMethod;
   412         DLTRACE(("AP set"));
   404         DLTRACE(("AP set"));
   413 		}
       
   414 		 catch(const std::exception& exception)
       
   415 		 {
       
   416 		 qt_symbian_exception2LeaveL(exception);
       
   417 		 }
       
   418         }    
   405         }    
   419     }
   406     }
   420 
   407 
   421 
   408 
   422 // ---------------------------------------------------------------------------
   409 // ---------------------------------------------------------------------------
   471 //
   458 //
   472 TInt32 CCatalogsHttpDownloadManager::SessionId() const
   459 TInt32 CCatalogsHttpDownloadManager::SessionId() const
   473     {
   460     {
   474     return iSessionId;
   461     return iSessionId;
   475     }
   462     }
   476 
   463     
       
   464     
   477 // ---------------------------------------------------------------------------
   465 // ---------------------------------------------------------------------------
   478 // Handles download manager events
   466 // Handles download manager events
   479 // ---------------------------------------------------------------------------
   467 // ---------------------------------------------------------------------------
   480 //    
   468 //
   481  void CCatalogsHttpDownloadManager::downloadMgrEventRecieved(WRT::DownloadManagerEvent* dlmEvent)
   469 void CCatalogsHttpDownloadManager::HandleDMgrEventL( RHttpDownload& aDownload,
   482   {
   470 	THttpDownloadEvent aEvent )
   483   	
   471     {
   484   	switch(dlmEvent ->type())
   472     DLTRACEIN(( "Dl state: %i, pr: %i, DL: %x", aEvent.iDownloadState, 
   485 		{
   473         aEvent.iProgressState, &aDownload ));
   486  
   474         
   487     default:
   475     TDownloadEvent event( aDownload, aEvent );
   488     	break;
   476 
   489 		};
   477     if ( IsOneOf( aEvent.iDownloadState, EHttpDlDeleted, EHttpDlDeleting ) )
   490 
   478         {
   491   	
   479         DLTRACEOUT(("Download was deleted"))
   492   }  
   480         RemoveUnhandledEvents( event );
       
   481         }
       
   482     // Handle everything but Download name change events
       
   483     else if ( aEvent.iProgressState != EHttpProgDlNameChanged )     
       
   484         {        
       
   485         DLTRACE(("Adding event to queue"));        
       
   486         
       
   487         if ( aEvent.iProgressState == EHttpProgResponseBodyReceived ) 
       
   488             {
       
   489             // Filter unhandled progress events from the queue
       
   490             RemoveUnhandledProgressEvents( event );
       
   491             }
       
   492         
       
   493         iEventQueue.AppendL( event );    
       
   494         ContinueEventHandling();    
       
   495         }
       
   496     }
   493 
   497 
   494 
   498 
   495 // ---------------------------------------------------------------------------
   499 // ---------------------------------------------------------------------------
   496 // Accesspoint observer
   500 // Accesspoint observer
   497 // ---------------------------------------------------------------------------
   501 // ---------------------------------------------------------------------------
   501     const TCatalogsAccessPointEvent& aEvent )
   505     const TCatalogsAccessPointEvent& aEvent )
   502     {
   506     {
   503     DLTRACEIN((""));
   507     DLTRACEIN((""));
   504     if ( aEvent == ECatalogsAccessPointClosed ) 
   508     if ( aEvent == ECatalogsAccessPointClosed ) 
   505         {
   509         {
   506 		try
       
   507 		{
       
   508         DLTRACE(("Disconnecting download manager"));
   510         DLTRACE(("Disconnecting download manager"));
   509 
   511         User::LeaveIfError( iDmgr.Disconnect() );
   510 		iDmgr->pauseAll();
       
   511 	}
       
   512 
       
   513  		catch(const std::exception& exception) 
       
   514                { 
       
   515                qt_symbian_exception2LeaveL(exception); 
       
   516                } 
       
   517             
       
   518 
       
   519         }
   512         }
   520     }
   513     }
   521 
   514 
   522 
   515 
   523 // ---------------------------------------------------------------------------
   516 // ---------------------------------------------------------------------------
   561     DLTRACEIN((""));
   554     DLTRACEIN((""));
   562     User::LeaveIfError( iFs.Connect() );
   555     User::LeaveIfError( iFs.Connect() );
   563     
   556     
   564     // shared so that RFiles can be given to Download manager
   557     // shared so that RFiles can be given to Download manager
   565     User::LeaveIfError( iFs.ShareProtected() ); 
   558     User::LeaveIfError( iFs.ShareProtected() ); 
   566    	
       
   567    	QString DmgrUid(QString::number(KNCDEngineAppID));
       
   568     iDmgr =  new DownloadManager(DmgrUid);
       
   569     iDmgr->initialize();
       
   570     iQTmgr = new CCatalogsHttpQTDownloadManager(this,iDmgr);
       
   571     
   559     
   572     TUid sessionId( TUid::Uid( iSessionId ) );
   560     TUid sessionId( TUid::Uid( iSessionId ) );
   573     if ( aCleanup ) 
   561     if ( aCleanup ) 
   574         {
   562         {
   575         DLTRACE(("Cleaning download manager before connecting"));        
   563         DLTRACE(("Cleaning download manager before connecting"));        
   591     TInt err = KErrNone;
   579     TInt err = KErrNone;
   592     TInt retries = KCatalogsDlMgrConnectRetryAttempts;
   580     TInt retries = KCatalogsDlMgrConnectRetryAttempts;
   593     
   581     
   594     do    
   582     do    
   595         {
   583         {
       
   584         TRAP( err, iDmgr.ConnectL( sessionId, *this, ETrue ) );
   596         if ( err != KErrNone ) 
   585         if ( err != KErrNone ) 
   597             {
   586             {
   598             DLERROR(("DL manager connection failed with err: %d, retry attempts left", 
   587             DLERROR(("DL manager connection failed with err: %d, retry attempts left", 
   599                 err, retries ));
   588                 err, retries ));
   600             // This halts the whole thread which is not nice but shouldn't
   589             // This halts the whole thread which is not nice but shouldn't
   616     iDefaultConfig = CCatalogsHttpConfig::NewL();
   605     iDefaultConfig = CCatalogsHttpConfig::NewL();
   617     
   606     
   618     iNetworkManager = &CCatalogsHttpSessionManager::NetworkManagerL();
   607     iNetworkManager = &CCatalogsHttpSessionManager::NetworkManagerL();
   619     iNetworkManager->AddObserverL( *this );    
   608     iNetworkManager->AddObserverL( *this );    
   620     
   609     
       
   610     iDmgr.SetIntAttribute( EDlMgrExitAction, EExitPause );
   621     // Restore downloads from previous sessions
   611     // Restore downloads from previous sessions
   622 //    RestoreDownloadsL();
   612     RestoreDownloadsL();
   623  
       
   624     DLTRACEOUT((""));
   613     DLTRACEOUT((""));
   625 
   614     }
   626     }
   615     
   627     
   616 
   628 DownloadManager* CCatalogsHttpDownloadManager::GetDownloadManager()
       
   629 {
       
   630 	return iDmgr;
       
   631 }
       
   632 // ---------------------------------------------------------------------------
   617 // ---------------------------------------------------------------------------
   633 // Restore downloads from previous session
   618 // Restore downloads from previous session
   634 // ---------------------------------------------------------------------------
   619 // ---------------------------------------------------------------------------
   635 //        
   620 //        
   636 void CCatalogsHttpDownloadManager::RestoreDownloadsL()
   621 void CCatalogsHttpDownloadManager::RestoreDownloadsL()
   637     {
   622     {
   638     DLTRACEIN((""));
   623     DLTRACEIN((""));
   639     
   624     const CDownloadArray& downloads = iDmgr.CurrentDownloads();    
   640     const TInt KMaxUrlLength = 2048; // HLa
   625     
   641     TBuf8<KMaxUrlLength> url;
   626     TBuf8<KMaxUrlLength> url;
   642     
   627     TBuf<KMaxPath> filename;
   643     
   628     
   644     QList<WRT::Download*> downloads = iDmgr->currentDownloads();
       
   645 
       
   646 
       
   647     // Go through downloads, create wrappers for DL manager downloads and
   629     // Go through downloads, create wrappers for DL manager downloads and
   648     // add them to HttpDownloadManager
   630     // add them to HttpDownloadManager
   649     for ( TInt i = 0; i < downloads.size(); ++i ) 
   631     for ( TInt i = 0; i < downloads.Count(); ++i ) 
   650         {                 
   632         {                 
   651         DLTRACE(( "Restoring dl %i", i ));
   633         DLTRACE(( "Restoring dl %i", i ));
   652         WRT::Download *dlPtr = downloads[i];
   634         RHttpDownload* dlPtr = downloads[i];
   653 
   635 
   654         // Create the download and push it to cleanup stack
   636         // Create the download and push it to cleanup stack
   655         CCatalogsHttpDownload* dl = CCatalogsHttpDownload::NewLC( *this,
   637         CCatalogsHttpDownload* dl = CCatalogsHttpDownload::NewLC( *this,
   656             dlPtr, *iDefaultConfig );
   638             dlPtr, *iDefaultConfig );
   657 
   639 
   658         // set file server session
   640         // set file server session
   659         dl->SetFileServerSession( iFs );
   641         dl->SetFileServerSession( iFs );
   660        
   642         
   661          QString name   =  dlPtr->attribute(FileName).toString();
   643         dlPtr->GetStringAttribute( EDlAttrDestFilename, filename );
   662          TBuf<KMaxPath> filename(name.utf16());
       
   663 
   644 
   664         // Separate the filename from the path
   645         // Separate the filename from the path
   665         TParsePtrC parser( filename );
   646         TParsePtrC parser( filename );
   666         
   647         
   667         if ( parser.PathPresent() ) 
   648         if ( parser.PathPresent() ) 
   692     
   673     
   693 
   674 
   694 // ---------------------------------------------------------------------------
   675 // ---------------------------------------------------------------------------
   695 // Finds the index for the given download in iDownloads
   676 // Finds the index for the given download in iDownloads
   696 // ---------------------------------------------------------------------------
   677 // ---------------------------------------------------------------------------
   697 //   
   678 //            
   698 /* HLa
       
   699 TInt CCatalogsHttpDownloadManager::FindInDownloads( 
   679 TInt CCatalogsHttpDownloadManager::FindInDownloads( 
   700     const RCatalogsHttpOperationArray& aArray,
   680     const RCatalogsHttpOperationArray& aArray,
   701     RHttpDownload* aDownload ) const
   681     RHttpDownload* aDownload ) const
   702     {    
   682     {    
   703     DASSERT( aDownload );
   683     DASSERT( aDownload );
   704     
   684     
   705     TInt32 id = 0;
   685     TInt32 id = 0;
   706     //aDownload->GetIntAttribute( EDlAttrId, id );    
   686     aDownload->GetIntAttribute( EDlAttrId, id );    
   707             
   687             
   708     TInt count = aArray.Count();
   688     TInt count = aArray.Count();
   709     for ( TInt i = 0; i < count; ++i )
   689     for ( TInt i = 0; i < count; ++i )
   710         {
   690         {
   711         if ( aArray[ i ]->OperationId().SecondaryId() == id ) 
   691         if ( aArray[ i ]->OperationId().SecondaryId() == id ) 
   713             return i;
   693             return i;
   714             }
   694             }
   715         }
   695         }
   716     return KErrNotFound;
   696     return KErrNotFound;
   717     }
   697     }
   718 */
   698 
   719 
   699 
   720 // ---------------------------------------------------------------------------
   700 // ---------------------------------------------------------------------------
   721 // Finds the index for the given download in the given array
   701 // Finds the index for the given download in the given array
   722 // ---------------------------------------------------------------------------
   702 // ---------------------------------------------------------------------------
   723 //            
   703 //            
   738 TInt CCatalogsHttpDownloadManager::StartOperation( 
   718 TInt CCatalogsHttpDownloadManager::StartOperation( 
   739     MCatalogsHttpOperation* aOperation )
   719     MCatalogsHttpOperation* aOperation )
   740     {
   720     {
   741     DLTRACEIN(( "" ));
   721     DLTRACEIN(( "" ));
   742     DASSERT( aOperation );
   722     DASSERT( aOperation );
   743     TInt err = iManager.StartOperation( aOperation, EFalse );
   723     TInt err = iManager.StartOperation( aOperation );
   744     if ( err == KErrNone || err == KCatalogsHttpOperationQueued ) 
   724     if ( err == KErrNone || err == KCatalogsHttpOperationQueued ) 
   745         {
   725         {
   746         TInt err2 = MoveRestoredDlToCurrentDls( *aOperation );
   726         TInt err2 = MoveRestoredDlToCurrentDls( *aOperation );
   747         // Check for unwanted errors
   727         // Check for unwanted errors
   748         if ( err2 != KErrNone && err2 != KErrNotFound ) 
   728         if ( err2 != KErrNone && err2 != KErrNotFound ) 
   835 void CCatalogsHttpDownloadManager::RunL()
   815 void CCatalogsHttpDownloadManager::RunL()
   836     {
   816     {
   837     DLTRACEIN(( "Event queue count: %d", iEventQueue.Count() ));
   817     DLTRACEIN(( "Event queue count: %d", iEventQueue.Count() ));
   838    
   818    
   839     // Handle the event queue 
   819     // Handle the event queue 
   840     /* HLa
       
   841     while ( iEventQueue.Count() ) 
   820     while ( iEventQueue.Count() ) 
   842         {
   821         {
   843         
   822         
   844         TDownloadEvent dlEvent( iEventQueue[0] );
   823         TDownloadEvent dlEvent( iEventQueue[0] );
   845         iEventQueue.Remove( 0 );
   824         iEventQueue.Remove( 0 );
   897                 DLERROR(( "Observer was NULL" ));
   876                 DLERROR(( "Observer was NULL" ));
   898                 User::Leave( eventErr );
   877                 User::Leave( eventErr );
   899                 }
   878                 }
   900             }
   879             }
   901         }
   880         }
   902         */
       
   903     }
   881     }
   904     
   882     
   905     
   883     
   906 void CCatalogsHttpDownloadManager::DoCancel()
   884 void CCatalogsHttpDownloadManager::DoCancel()
   907     {
   885     {
   923     
   901     
   924     
   902     
   925 void CCatalogsHttpDownloadManager::ContinueEventHandling()
   903 void CCatalogsHttpDownloadManager::ContinueEventHandling()
   926     {
   904     {
   927     DLTRACEIN((""));
   905     DLTRACEIN((""));
   928     /* HLa
       
   929     if( iEventQueue.Count() && !IsActive() ) 
   906     if( iEventQueue.Count() && !IsActive() ) 
   930         {
   907         {
   931         DLTRACE(("More events to handle"));
   908         DLTRACE(("More events to handle"));
   932         iStatus = KRequestPending;
   909         iStatus = KRequestPending;
   933         SetActive();
   910         SetActive();
   934         TRequestStatus* status = &iStatus;
   911         TRequestStatus* status = &iStatus;
   935         User::RequestComplete( status, KErrNone );
   912         User::RequestComplete( status, KErrNone );
   936         }
   913         }
   937         */
   914     }
   938     }
   915     
   939 
   916     
   940     
       
   941     /* HLa
       
   942 void CCatalogsHttpDownloadManager::RemoveUnhandledEvents( 
   917 void CCatalogsHttpDownloadManager::RemoveUnhandledEvents( 
   943     const TDownloadEvent& aEvent )
   918     const TDownloadEvent& aEvent )
   944     {
   919     {
   945     DLTRACEIN((""));
   920     DLTRACEIN((""));
   946     TInt index = iEventQueue.Count();
   921     TInt index = iEventQueue.Count();
   951             DLTRACE(("Removing unhandled event"));
   926             DLTRACE(("Removing unhandled event"));
   952             iEventQueue.Remove( index );
   927             iEventQueue.Remove( index );
   953             }        
   928             }        
   954         }    
   929         }    
   955     }
   930     }
   956 */
   931 
   957 
   932 
   958 /* HLa
       
   959 void CCatalogsHttpDownloadManager::RemoveUnhandledProgressEvents( 
   933 void CCatalogsHttpDownloadManager::RemoveUnhandledProgressEvents( 
   960     const TDownloadEvent& aEvent )
   934     const TDownloadEvent& aEvent )
   961     {
   935     {
   962     DLTRACEIN((""));
   936     DLTRACEIN((""));
   963     TInt index = iEventQueue.Count();
   937     TInt index = iEventQueue.Count();
   970             iEventQueue.Remove( index );
   944             iEventQueue.Remove( index );
   971             break;
   945             break;
   972             }        
   946             }        
   973         }    
   947         }    
   974     }
   948     }
   975 */
   949 
   976 
   950 
   977 TInt CCatalogsHttpDownloadManager::NewDownloadId()
   951 TInt CCatalogsHttpDownloadManager::NewDownloadId()
   978     {
   952     {
   979     return ++iCurrentDlId;
   953     return ++iCurrentDlId;
   980     }
   954     }
   981 
   955 
   982 
   956 
   983 Download& CCatalogsHttpDownloadManager::CreatePlatformDownloadL( 
   957 RHttpDownload& CCatalogsHttpDownloadManager::CreatePlatformDownloadL( 
   984     const TDesC8& aUrl )
   958     const TDesC8& aUrl )
   985     {
   959     {
   986     
   960     return iDmgr.CreateDownloadL( aUrl );
   987    	QString myString=	QString::fromRawData( reinterpret_cast<const QChar*>(aUrl.Ptr()),aUrl.Length());
   961     }
   988 
       
   989     return *(iDmgr->createDownload( myString ));
       
   990     }
       
   991     
       
   992 CCatalogsHttpQTDownloadManager::CCatalogsHttpQTDownloadManager(CCatalogsHttpDownloadManager* aDownloadManager,DownloadManager* aDmgr)
       
   993 	{
       
   994 		iDownloadManager = aDownloadManager;
       
   995 		iDmgr = aDmgr;
       
   996 		connect(iDmgr, SIGNAL(downloadManagerEvent(DownloadManagerEvent*)), this,SLOT(downloadMgrEventRecieved(DownloadManagerEvent*)));
       
   997 	}
       
   998 	
       
   999 void CCatalogsHttpQTDownloadManager::downloadMgrEventRecieved(DownloadManagerEvent* aEvent)
       
  1000 	{
       
  1001 		iDownloadManager->downloadMgrEventRecieved(aEvent);
       
  1002 	}