mmappcomponents/harvester/filehandler/src/mpxfoldermonitor.cpp
changeset 27 cbb1bfb7ebfb
parent 25 d881023c13eb
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 #ifdef RD_MULTIPLE_DRIVE
       
    21 #include <pathinfo.h>
    20 #include <pathinfo.h>
    22 #include <driveinfo.h>
    21 #include <driveinfo.h>
    23 #endif //RD_MULTIPLE_DRIVE
       
    24 #include <mpxlog.h>
    22 #include <mpxlog.h>
    25 #include "mpxfoldermonitor.h"
    23 #include "mpxfoldermonitor.h"
    26 #include "mpxfileadditionobserver.h"
    24 #include "mpxfileadditionobserver.h"
    27 #include "mpxfoldermonitorobserver.h"
    25 #include "mpxfoldermonitorobserver.h"
    28 
    26 
    29 // CONSTANTS
    27 // CONSTANTS
    30 #ifdef RD_MULTIPLE_DRIVE
       
    31 _LIT( KMPXMusicPath, "\\Music\\");
    28 _LIT( KMPXMusicPath, "\\Music\\");
    32 #else
       
    33 _LIT( KMPXMusicPath, "\\Music\\");
       
    34 _LIT( KMPXDataPath, "\\Data\\");
       
    35 #endif //RD_MULTIPLE_DRIVE
       
    36 
    29 
    37 
    30 
    38 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    39 // Constructor
    32 // Constructor
    40 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    92 
    85 
    93     // What is the drive name?
    86     // What is the drive name?
    94     delete iFolderName;
    87     delete iFolderName;
    95     iFolderName = NULL;
    88     iFolderName = NULL;
    96 
    89 
    97 #ifdef RD_MULTIPLE_DRIVE
       
    98     switch( aDrive )
    90     switch( aDrive )
    99         {
    91         {
   100         case EDriveC:
    92         case EDriveC:
   101             {
    93             {
   102             // Use the default path for the phone memory
    94             // Use the default path for the phone memory
   133                 }
   125                 }
   134             break;
   126             break;
   135             }
   127             }
   136         }
   128         }
   137     MPX_DEBUG2("CMPXFolderMonitor::Start: Use %S path", iFolderName);
   129     MPX_DEBUG2("CMPXFolderMonitor::Start: Use %S path", iFolderName);
   138 #else
       
   139     switch( aDrive )
       
   140         {
       
   141         case EDriveC:
       
   142             {
       
   143             TDriveName driveName = TDriveUnit( aDrive ).Name();
       
   144             TInt length = KMPXDataPath().Length() + driveName.Length();
       
   145 
       
   146             iFolderName = HBufC::NewL(length);
       
   147 
       
   148             TPtr folderPtr( iFolderName->Des() );
       
   149             folderPtr.Append( driveName );
       
   150             folderPtr.Append( KMPXDataPath );
       
   151 
       
   152             break;
       
   153             }
       
   154         case EDriveE:
       
   155         // deliberate fall through, same actions for E & F drive
       
   156 
       
   157         case EDriveF:
       
   158             {
       
   159 
       
   160             TDriveName driveName = TDriveUnit( aDrive ).Name();
       
   161             TInt length = KMPXMusicPath().Length() + driveName.Length();
       
   162 
       
   163             iFolderName = HBufC::NewL(length);
       
   164 
       
   165             TPtr folderPtr( iFolderName->Des() );
       
   166             folderPtr.Append( driveName );
       
   167             folderPtr.Append( KMPXMusicPath );
       
   168 
       
   169             break;
       
   170             }
       
   171 
       
   172         default:
       
   173             {
       
   174             User::Leave( KErrNotSupported );
       
   175             }
       
   176         }
       
   177 #endif // RD_MULTIPLE_DRIVE
       
   178 
   130 
   179     // Start listening
   131     // Start listening
   180     //
   132     //
   181     TNotifyType notType = ENotifyFile;
   133     TNotifyType notType = ENotifyFile;
   182     iFs.NotifyChange( notType, iStatus, *iFolderName );
   134     iFs.NotifyChange( notType, iStatus, *iFolderName );