harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp
changeset 20 6dfc5f825351
parent 3 b73a2e62868f
child 21 50bf9db68373
equal deleted inserted replaced
3:b73a2e62868f 20:6dfc5f825351
    14 * Description:  Handles mount tasks*
    14 * Description:  Handles mount tasks*
    15 */
    15 */
    16 
    16 
    17 #include <driveinfo.h>
    17 #include <driveinfo.h>
    18 
    18 
       
    19 #ifdef __WINSCW__
       
    20 #include <pathinfo.h>
       
    21 #endif
       
    22 
    19 #include <placeholderdata.h>
    23 #include <placeholderdata.h>
    20 #include "mmcmounttaskao.h"
    24 #include "mmcmounttaskao.h"
    21 #include "mmcmonitorplugin.h"
    25 #include "mmcmonitorplugin.h"
    22 #include "harvesterlog.h"
    26 #include "harvesterlog.h"
    23 #include "mdsfileserverpluginclient.h"
    27 #include "mdsfileserverpluginclient.h"
    54 	iCacheEvents = EFalse;
    58 	iCacheEvents = EFalse;
    55 	iHEM = CHarvesterEventManager::GetInstanceL();
    59 	iHEM = CHarvesterEventManager::GetInstanceL();
    56 	}
    60 	}
    57 
    61 
    58 CMMCMountTaskAO::CMMCMountTaskAO() :
    62 CMMCMountTaskAO::CMMCMountTaskAO() :
    59 		CActive( KHarvesterCustomImportantPriority )
    63 		CActive( KHarvesterPriorityMonitorPlugin )
    60 	{
    64 	{
    61 	WRITELOG( "CMMCMountTaskAO::CMMCMountTaskAO" );
    65 	WRITELOG( "CMMCMountTaskAO::CMMCMountTaskAO" );
    62 	}
    66 	}
    63 	
    67 	
    64 CMMCMountTaskAO::~CMMCMountTaskAO()
    68 CMMCMountTaskAO::~CMMCMountTaskAO()
    66 	WRITELOG( "CMMCMountTaskAO::~CMMCMountTaskAO" );
    70 	WRITELOG( "CMMCMountTaskAO::~CMMCMountTaskAO" );
    67 	Cancel();
    71 	Cancel();
    68 	iFs.Close();
    72 	iFs.Close();
    69 	
    73 	
    70 	iMountDataQueue.ResetAndDestroy();
    74 	iMountDataQueue.ResetAndDestroy();
       
    75 	iEntryArray.ResetAndDestroy();
       
    76 	iHarvestEntryArray.ResetAndDestroy();
    71 	
    77 	
    72 	delete iMdeSession;
    78 	delete iMdeSession;
    73   
    79   
    74 	Deinitialize();
    80 	Deinitialize();
    75 	
    81 	
   180 					SetNextRequest( ERequestFormat );
   186 					SetNextRequest( ERequestFormat );
   181 					}
   187 					}
   182 				}
   188 				}
   183 			else
   189 			else
   184 				{
   190 				{
       
   191 			    SetPriority( KHarvesterCustomImportantPriority );
   185 				SetNextRequest( ERequestIdle );
   192 				SetNextRequest( ERequestIdle );
   186 				iMountDataQueue.Compress();
   193 				iMountDataQueue.Compress();
   187 				}
   194 				}
   188 			}
   195 			}
   189 		break;
   196 		break;
   279 						iMountDataQueue.Insert( iMountData, 0 );
   286 						iMountDataQueue.Insert( iMountData, 0 );
   280 						iMountData = NULL;
   287 						iMountData = NULL;
   281 						}
   288 						}
   282 					Deinitialize();
   289 					Deinitialize();
   283 					SetNextRequest( ERequestStartTask );
   290 					SetNextRequest( ERequestStartTask );
   284 					return;
   291 					break;
   285 					}
   292 					}
   286 				
   293 				
   287 	            if ( iEntryArray.Count() > 0 )
   294 	            if ( iEntryArray.Count() > 0 )
   288 	                {
   295 	                {
   289 	                SetNextRequest( ERequestHandleFileEntry );
   296 	                SetNextRequest( ERequestHandleFileEntry );
   340 		case ERequestCleanup:
   347 		case ERequestCleanup:
   341 			{
   348 			{
   342 			WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" );
   349 			WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" );
   343 			TBool present = (iMountData->iMountType == TMountData::EMount);
   350 			TBool present = (iMountData->iMountType == TMountData::EMount);
   344 			iMdeSession->SetMediaL( iMountData->iMediaID, iMountData->iDrivePath[0], present );
   351 			iMdeSession->SetMediaL( iMountData->iMediaID, iMountData->iDrivePath[0], present );
       
   352 			SetPriority( KHarvesterCustomImportantPriority );
   345 			Deinitialize();
   353 			Deinitialize();
   346 			SetNextRequest( ERequestStartTask );
   354 			SetNextRequest( ERequestStartTask );
   347 			}
   355 			}
   348 		break;
   356 		break;
   349 		
   357 		
   520     		KDriveAttExclude | KDriveAttRemote | KDriveAttRom );
   528     		KDriveAttExclude | KDriveAttRemote | KDriveAttRom );
   521     if( err != KErrNone )
   529     if( err != KErrNone )
   522     	{
   530     	{
   523     	return 0;
   531     	return 0;
   524     	}
   532     	}
       
   533  
       
   534 #ifdef __WINSCW__
       
   535     TFileName systemPath = PathInfo::GetPath( PathInfo::EPhoneMemoryRootPath );
       
   536     TInt systemDriveNum( -1 );
       
   537     iFs.CharToDrive( systemPath[0], systemDriveNum );
       
   538 #endif
   525     
   539     
   526 	TUint32 hdMediaId = 0;
   540 	TUint32 hdMediaId = 0;
   527 	TInt i( 0 );
   541 	TInt i( 0 );
   528 
   542 
   529 	for ( i = 0; i < driveList.Length(); i++ )
   543 	const TInt acount = driveList.Length();
   530 		{
   544 	for ( i = 0; i < acount; i++ )
       
   545 		{
       
   546 #ifdef __WINSCW__
       
   547         if ( i == systemDriveNum )
       
   548             {
       
   549             continue;
       
   550             }
       
   551 #endif
       
   552 	
   531 	    if ( driveList[i] > 0 )
   553 	    if ( driveList[i] > 0 )
   532 	    	{
   554 	    	{
   533 	    	iFs.Drive( driveInfo, i );
   555 	    	iFs.Drive( driveInfo, i );
   534 	        if ( driveInfo.iType == EMediaHardDisk )
   556 	        if ( driveInfo.iType == EMediaHardDisk )
   535 	        	{
   557 	        	{