filemanager/Engine/src/CFileManagerEngine.cpp
branchRCL_3
changeset 12 60626d494346
parent 0 6a9f87576119
child 19 5181328fad28
equal deleted inserted replaced
10:1772663c5b4e 12:60626d494346
    75     0x201D, // Right quote
    75     0x201D, // Right quote
    76     0x201F, // Reversed quote
    76     0x201F, // Reversed quote
    77     0x21B2, // Downwards arrow with tip leftwards
    77     0x21B2, // Downwards arrow with tip leftwards
    78     0, // Array terminator
    78     0, // Array terminator
    79 };
    79 };
    80 
    80 const TUint KDiskEventCheckInterval = 100000; // microseconds
    81 //const TInt KMGFileArrayGranularity = 32;
    81 
    82 
    82 
    83 
    83 
    84 // ============================ LOCAL FUNCTIONS ================================
    84 // ============================ LOCAL FUNCTIONS ================================
    85 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    86 // SearchMGAlbumIdL
    86 // SearchMGAlbumIdL
   120 // C++ default constructor can NOT contain any code, that
   120 // C++ default constructor can NOT contain any code, that
   121 // might leave.
   121 // might leave.
   122 // -----------------------------------------------------------------------------
   122 // -----------------------------------------------------------------------------
   123 //
   123 //
   124 CFileManagerEngine::CFileManagerEngine( RFs& aFs ) :
   124 CFileManagerEngine::CFileManagerEngine( RFs& aFs ) :
   125 		iFs( aFs ), iObserver( NULL ), iSisFile( EFalse )
   125 		iFs( aFs ), iObserver( NULL ), iSisFile( EFalse ),iDelayedDiskEventNotify( NULL )
   126     {
   126     {
   127     FUNC_LOG
   127     FUNC_LOG
   128     }
   128     }
   129 
   129 
   130 // -----------------------------------------------------------------------------
   130 // -----------------------------------------------------------------------------
   220     delete iActiveSize;
   220     delete iActiveSize;
   221     delete iDiskEvent;
   221     delete iDiskEvent;
   222     delete iUtils;
   222     delete iUtils;
   223     delete iDriveName;
   223     delete iDriveName;
   224     delete iFeatureManager;
   224     delete iFeatureManager;
       
   225     if( iDelayedDiskEventNotify != NULL )
       
   226         {
       
   227         iDelayedDiskEventNotify->Cancel();
       
   228         delete iDelayedDiskEventNotify;
       
   229         }
   225     }
   230     }
   226 
   231 
   227 // -----------------------------------------------------------------------------
   232 // -----------------------------------------------------------------------------
   228 // CFileManagerEngine::SetFileSystemEventL
   233 // CFileManagerEngine::SetFileSystemEventL
   229 // -----------------------------------------------------------------------------
   234 // -----------------------------------------------------------------------------
  1154         }
  1159         }
  1155     return iRefresher->CancelRefresh();
  1160     return iRefresher->CancelRefresh();
  1156     }
  1161     }
  1157 
  1162 
  1158 // ------------------------------------------------------------------------------
  1163 // ------------------------------------------------------------------------------
       
  1164 // CFileManagerEngine::DriveAddedOrChangeAsyncL
       
  1165 //
       
  1166 // ------------------------------------------------------------------------------
       
  1167 //
       
  1168 TInt CFileManagerEngine::DriveAddedOrChangeAsyncL( TAny* aPtr )
       
  1169     {
       
  1170     static_cast<CFileManagerEngine*>( aPtr )->DriveAddedOrChangedL();
       
  1171 
       
  1172     //return value will be ignored by CPeriodic that calls this function
       
  1173     //following line keeps the compiler happy
       
  1174     return 0;
       
  1175     }
       
  1176 
       
  1177 // ------------------------------------------------------------------------------
  1159 // CFileManagerEngine::DriveAddedOrChangedL
  1178 // CFileManagerEngine::DriveAddedOrChangedL
  1160 //
  1179 //
  1161 // ------------------------------------------------------------------------------
  1180 // ------------------------------------------------------------------------------
  1162 //
  1181 //
  1163 void CFileManagerEngine::DriveAddedOrChangedL()
  1182 void CFileManagerEngine::DriveAddedOrChangedL()
  1185         if ( iProcessObserver &&
  1204         if ( iProcessObserver &&
  1186              !iEmbeddedApplicationOn &&
  1205              !iEmbeddedApplicationOn &&
  1187              !iWaitDialogOn &&
  1206              !iWaitDialogOn &&
  1188              !iRefresher->IsActive() )
  1207              !iRefresher->IsActive() )
  1189             {
  1208             {
       
  1209             StopDiskEventNotifyTimerAsync();
  1190             TPtrC dir( iNavigator->CurrentDirectory() );
  1210             TPtrC dir( iNavigator->CurrentDirectory() );
  1191             if ( dir.Length() )
  1211             if ( dir.Length() )
  1192                 {
  1212                 {
  1193                 TBool isAvailable( CurrentDriveAvailable() );
  1213                 TBool isAvailable( CurrentDriveAvailable() );
  1194 
  1214 
  1220                 // Notify always when no folder is opened
  1240                 // Notify always when no folder is opened
  1221                 iProcessObserver->NotifyL(
  1241                 iProcessObserver->NotifyL(
  1222                     MFileManagerProcessObserver::ENotifyDisksChanged, 0 );
  1242                     MFileManagerProcessObserver::ENotifyDisksChanged, 0 );
  1223                 }
  1243                 }
  1224             }
  1244             }
       
  1245         else
       
  1246             {
       
  1247             if( ( iProcessObserver == NULL ) || iEmbeddedApplicationOn )
       
  1248                 {
       
  1249                 //Do not refresh while embedded application is running or process observer is not set
       
  1250                 StopDiskEventNotifyTimerAsync();
       
  1251                 }
       
  1252             else
       
  1253                 {
       
  1254                 if( iRefresher->IsActive() )
       
  1255                    {
       
  1256                    //start Timer and notify disk event until current disk refresh finishes
       
  1257                    StartDiskEventNotifyTimerAsyncL();
       
  1258                    }
       
  1259                 }
       
  1260             }
  1225         }
  1261         }
  1226     }
  1262     }
  1227 
  1263 
  1228 // ------------------------------------------------------------------------------
  1264 // ------------------------------------------------------------------------------
  1229 // CFileManagerEngine::FolderContentChangedL
  1265 // CFileManagerEngine::FolderContentChangedL
  2215 EXPORT_C void CFileManagerEngine::DeleteBackupsL()
  2251 EXPORT_C void CFileManagerEngine::DeleteBackupsL()
  2216     {
  2252     {
  2217     iRemovableDrvHandler->DeleteBackupsL();
  2253     iRemovableDrvHandler->DeleteBackupsL();
  2218     }
  2254     }
  2219 
  2255 
  2220 
  2256 // ---------------------------------------------------------------------------
  2221 //  End of File  
  2257 // CFileManagerEngine::StartDiskEventNotifyTimerAsyncL()
       
  2258 // ---------------------------------------------------------------------------
       
  2259 //
       
  2260 void CFileManagerEngine::StartDiskEventNotifyTimerAsyncL()
       
  2261     {
       
  2262     if ( iDelayedDiskEventNotify == NULL )
       
  2263         {
       
  2264         iDelayedDiskEventNotify = CPeriodic::NewL( CActive::EPriorityStandard );
       
  2265         }
       
  2266     if ( !iDelayedDiskEventNotify->IsActive() )
       
  2267         {
       
  2268        //ignore disk event notification while timer is already active
       
  2269        iDelayedDiskEventNotify->Start( KDiskEventCheckInterval,
       
  2270            KDiskEventCheckInterval,
       
  2271            TCallBack( DriveAddedOrChangeAsyncL, this ) );
       
  2272         }
       
  2273     }
       
  2274 
       
  2275 // ---------------------------------------------------------------------------
       
  2276 // CFileManagerEngine::StopDiskEventNotifyTimerAsync()
       
  2277 // ---------------------------------------------------------------------------
       
  2278 //
       
  2279 void CFileManagerEngine::StopDiskEventNotifyTimerAsync()
       
  2280     {
       
  2281     if ( iDelayedDiskEventNotify != NULL )
       
  2282         {
       
  2283         iDelayedDiskEventNotify->Cancel();
       
  2284         delete iDelayedDiskEventNotify;
       
  2285         iDelayedDiskEventNotify = NULL;
       
  2286         }
       
  2287     }
       
  2288 
       
  2289 
       
  2290 //  End of File