sysresmonitoring/oodmonitor/oodmonitor2/src/outofdiskmonitor.cpp
changeset 28 b0b858956ed5
parent 0 2e3d3ce01487
child 77 b01c07dfcf84
equal deleted inserted replaced
21:c4cbaa4fb734 28:b0b858956ed5
   105     iOutOfDiskPSObserver = COutOfDiskPSObserver::NewL( this );
   105     iOutOfDiskPSObserver = COutOfDiskPSObserver::NewL( this );
   106 
   106 
   107     CRepository* repository( NULL );
   107     CRepository* repository( NULL );
   108     TInt warningThreshold(0);
   108     TInt warningThreshold(0);
   109     TInt criticalThreshold(0);
   109     TInt criticalThreshold(0);
       
   110     TInt warningThresholdMassMemory(0);
   110     TRAPD( err, repository = CRepository::NewL( KCRUidUiklaf ) );
   111     TRAPD( err, repository = CRepository::NewL( KCRUidUiklaf ) );
   111     if ( err == KErrNone )
   112     if ( err == KErrNone )
   112         {
   113         {
   113         err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevel, warningThreshold);
   114         err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevel, warningThreshold);
   114         err = repository->Get(KUikOODDiskCriticalThreshold, criticalThreshold);
   115         err = repository->Get(KUikOODDiskCriticalThreshold, criticalThreshold);
       
   116         err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory, warningThresholdMassMemory);
   115         }
   117         }
   116     delete repository;
   118     delete repository;
   117     iOODWarningThreshold = warningThreshold;
   119     iOODWarningThreshold = warningThreshold;
   118     iOODCriticalThreshold = criticalThreshold;
   120     iOODCriticalThreshold = criticalThreshold;
   119     
   121     iOODWarningThresholdMassMemory = warningThresholdMassMemory;
   120 	TRACES1("COutOfDiskMonitor::ConstructL: Warning threshold: %d percent",iOODWarningThreshold);
   122     
       
   123 	TRACES1("COutOfDiskMonitor::ConstructL: Warning threshold Phone Memory: %d percent",iOODWarningThreshold);
   121     TRACES1("COutOfDiskMonitor::ConstructL: Critical threshold: %ld bytes",iOODCriticalThreshold);
   124     TRACES1("COutOfDiskMonitor::ConstructL: Critical threshold: %ld bytes",iOODCriticalThreshold);
       
   125     TRACES1("COutOfDiskMonitor::ConstructL: Warning threshold Mass Memory: %ld bytes",iOODWarningThresholdMassMemory);
   122     
   126     
   123     iOutOfDiskNotifyObserver = COutOfDiskNotifyObserver::NewL( this, iFs );
   127     iOutOfDiskNotifyObserver = COutOfDiskNotifyObserver::NewL( this, iFs );
   124     TRACES("COutOfDiskMonitor::ConstructL: End");
   128     TRACES("COutOfDiskMonitor::ConstructL: End");
   125     }
   129     }
   126 
   130 
   206 		TInt ret( iFs.Volume( volInfo, aDrive ) );
   210 		TInt ret( iFs.Volume( volInfo, aDrive ) );
   207         TInt64 volSize(volInfo.iSize);
   211         TInt64 volSize(volInfo.iSize);
   208         TRACES1("COutOfDiskMonitor::GetThreshold: Volume size: %ld",volSize);		
   212         TRACES1("COutOfDiskMonitor::GetThreshold: Volume size: %ld",volSize);		
   209 		if ( ret == KErrNone )
   213 		if ( ret == KErrNone )
   210 			{
   214 			{
   211 			TRACES1("COutOfDiskMonitor::GetThreshold: Warning threshold: Used disk space %d percent",iOODWarningThreshold);
   215 			if(aDrive == EDriveC)
   212 			threshold = ((volSize*(100-iOODWarningThreshold))/100);		
   216 			    {
       
   217                 TRACES1("COutOfDiskMonitor::GetThreshold: Warning threshold Phone Memory: Used disk space %d percent",iOODWarningThreshold);
       
   218                 threshold = ((volSize*(100-iOODWarningThreshold))/100);
       
   219 			    }
       
   220 			else
       
   221 			    {
       
   222 			    if(iOODWarningThresholdMassMemory < volSize )
       
   223                     {
       
   224                     TRACES1("COutOfDiskMonitor::GetThreshold: Warning threshold Mass Memory: %ld bytes",iOODWarningThresholdMassMemory);
       
   225                     threshold = iOODWarningThresholdMassMemory;
       
   226                     }
       
   227                 else
       
   228                     {
       
   229                     TRACES1("COutOfDiskMonitor::GetThreshold: Warning threshold Phone Memory: Used disk space %d percent",iOODWarningThreshold);
       
   230                     threshold = ((volSize*(100-iOODWarningThreshold))/100);                                
       
   231                     }
       
   232 			    }
   213 			}
   233 			}
   214         }
   234         }
   215     else if (aLevel == DISK_SPACE_CRITICAL)
   235     else if (aLevel == DISK_SPACE_CRITICAL)
   216         {
   236         {
   217         threshold = iOODCriticalThreshold;
   237         threshold = iOODCriticalThreshold;