mmappcomponents/harvester/filehandler/src/mpxharvesterfilehandlerimp.cpp
branchRCL_3
changeset 42 4aca42fa4eb1
parent 30 6f9f6e99a23e
child 55 6c1dfe4da5dd
equal deleted inserted replaced
34:e257e2b6459d 42:4aca42fa4eb1
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Handles all file related activities
    14 * Description:  Handles all file related activities
    15 *  Version     : %version: da1mmcf#72.1.14.2.4.1.4.1.2.1.7 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: da1mmcf#72.1.14.2.4.1.4.1.2.1.9 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #include <e32base.h>
    20 #include <e32base.h>
    59 #include "mpxharvesterdbitem.h"
    59 #include "mpxharvesterdbitem.h"
    60 #include "mpxfhcommon.h"
    60 #include "mpxfhcommon.h"
    61 #include "mpxbrokenlinkcleanup.h"
    61 #include "mpxbrokenlinkcleanup.h"
    62 
    62 
    63 // ============ CONSTANTS ==========
    63 // ============ CONSTANTS ==========
    64 _LIT( KDefaultScanPath, "C:\\DATA\\|E:\\" );
    64 _LIT( KDefaultScanPath, "C:\\DATA\\|E:\\|F:\\" );
    65 _LIT( KDefaultBlockPath, "\\SYS\\|\\PRIVATE\\|\\SYSTEM\\|\\CITIES\\");
    65 _LIT( KDefaultBlockPath, "\\SYS\\|\\PRIVATE\\|\\SYSTEM\\|\\CITIES\\|\\SOUNDS\\SIMPLE\\|\\GAMES\\|\\RESOURCE\\|\\IMAGES\\"); 
    66 _LIT( KDefaultContainers, ".odf|.dcf|.asf|.m4a|.mp4" );
    66 _LIT( KDefaultContainers, ".odf|.dcf|.asf|.m4a|.mp4" );
    67 _LIT( KDefaultAutoScanFolder, "C:\\data\\sounds\\digital\\|E:\\sounds\\digital\\");
    67 _LIT( KDefaultAutoScanFolder, "C:\\data\\sounds\\digital\\|E:\\sounds\\digital\\");
    68 const TUid KCRUIDHarvesterFeatures  = { 0x101FFCD2 };
    68 const TUid KCRUIDHarvesterFeatures  = { 0x101FFCD2 };
    69 const TUid KMusicPlayerUid = {0x102072C3};
    69 const TUid KMusicPlayerUid = {0x102072C3};
    70 const TInt KHarvesterScanPathKey = 1;
    70 const TInt KHarvesterScanPathKey = 1;
   341             while(index < count)
   341             while(index < count)
   342                 {
   342                 {
   343                 // Remove current drive from the scanned drives list
   343                 // Remove current drive from the scanned drives list
   344                 TParse fileNameParser;
   344                 TParse fileNameParser;
   345                 User::LeaveIfError(fileNameParser.Set(iFilteredDrivesToScan[index],NULL,NULL));
   345                 User::LeaveIfError(fileNameParser.Set(iFilteredDrivesToScan[index],NULL,NULL));
   346                 TFileName driveName(fileNameParser.Drive());
   346                 TPtrC driveName(fileNameParser.Drive());
   347                 TInt driveNumber = TDriveUnit( driveName );
   347                 TInt driveNumber = TDriveUnit( driveName );
   348                 if (currentDriveNumber == driveNumber)
   348                 if (currentDriveNumber == driveNumber)
   349                     {
   349                     {
   350                     iFilteredDrivesToScan.Remove(index);
   350                     iFilteredDrivesToScan.Remove(index);
   351                     iFilteredOutOfDisk = ETrue;
       
   352                     count--;
   351                     count--;
   353                     }
   352                     }
   354                 else
   353                 else
   355                     {
   354                     {
   356                     index++;
   355                     index++;
   357                     }
   356                     }
   358                 }
   357                 }
   359             iDBManager->CloseDatabase(static_cast<TDriveNumber>(currentDriveNumber));
   358             iDBManager->CloseDatabase(static_cast<TDriveNumber>(currentDriveNumber));
       
   359             iFilteredOutOfDisk = ETrue;
   360             }
   360             }
   361         }
   361         }
   362 
   362 
   363     iSynchronizing = CheckDbInSyncL();
   363     iSynchronizing = CheckDbInSyncL();
   364 
   364 
  1735     // Gets the string from cenrep, use default if leave
  1735     // Gets the string from cenrep, use default if leave
  1736     // string should be in the form 'item1' 'item2'
  1736     // string should be in the form 'item1' 'item2'
  1737     //
  1737     //
  1738     TBuf<255> scanPath;
  1738     TBuf<255> scanPath;
  1739     TBuf<255> blockPath;
  1739     TBuf<255> blockPath;
  1740     CRepository* cenrep(NULL);
  1740     TRAPD( err, FetchPathsFromCenrepL(scanPath,blockPath) );
  1741     TRAPD( err, cenrep = CRepository::NewL( KCRUIDHarvesterFeatures ) );
  1741     if( err )
  1742     if( err == KErrNone )
       
  1743         {
       
  1744         cenrep->Get( KHarvesterScanPathKey, scanPath );
       
  1745         cenrep->Get( KHarvesterBlockPathKey, blockPath );
       
  1746         delete cenrep;
       
  1747         }
       
  1748     else
       
  1749         {
  1742         {
  1750         scanPath = KDefaultScanPath;
  1743         scanPath = KDefaultScanPath;
  1751         blockPath = KDefaultBlockPath;
  1744         blockPath = KDefaultBlockPath;
  1752         }
  1745         }
  1753 
  1746 
  1754     MPX_DEBUG2("ParseScanPathL scanPaths: %S", &scanPath);
  1747     MPX_DEBUG2("ParseScanPathL scanPaths: %S", &scanPath);
  1755     MPX_DEBUG2("ParseScanPathL blockPaths: %S", &blockPath);
  1748     MPX_DEBUG2("ParseScanPathL blockPaths: %S", &blockPath);
  1756     ::ExtractTokensL( scanPath, iConfiguredDrivesToScan );
  1749     ::ExtractTokensL( scanPath, iConfiguredDrivesToScan );
  1757     ::ExtractTokensL( blockPath, iPathsToBlock );
  1750     ::ExtractTokensL( blockPath, iPathsToBlock );
       
  1751     }
       
  1752 
       
  1753 // ---------------------------------------------------------------------------
       
  1754 // Fetches scan - and block - paths from cenrep 
       
  1755 // ---------------------------------------------------------------------------
       
  1756 //
       
  1757 void CMPXHarvesterFileHandlerImp::FetchPathsFromCenrepL( TDes16& aScanPath, 
       
  1758                                                          TDes16& aBlockPath )
       
  1759     {
       
  1760     MPX_FUNC("CMPXHarvesterFileHandlerImp::FetchPathsFromCenrepL");
       
  1761     CRepository* cenrep( CRepository::NewLC( KCRUIDHarvesterFeatures ) );
       
  1762     User::LeaveIfError( cenrep->Get( KHarvesterScanPathKey, aScanPath ) );
       
  1763     User::LeaveIfError( cenrep->Get( KHarvesterBlockPathKey, aBlockPath ) );
       
  1764     CleanupStack::PopAndDestroy(cenrep);
  1758     }
  1765     }
  1759 
  1766 
  1760 // ---------------------------------------------------------------------------
  1767 // ---------------------------------------------------------------------------
  1761 // Parses cenrep setting for container file types
  1768 // Parses cenrep setting for container file types
  1762 // ---------------------------------------------------------------------------
  1769 // ---------------------------------------------------------------------------