alarmui/src/alarmutils.cpp
branchRCL_3
changeset 86 ed599363c2d7
parent 66 bd7edf625bdd
equal deleted inserted replaced
78:356f28cd5ca0 86:ed599363c2d7
    48 #include <CalendarInternalCRKeys.h>
    48 #include <CalendarInternalCRKeys.h>
    49 #include <wakeupalarm.h>
    49 #include <wakeupalarm.h>
    50 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    50 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
    51 #include <AknUtils.h>
    51 #include <AknUtils.h>
    52 #include <hwrmpowerstatesdkpskeys.h>
    52 #include <hwrmpowerstatesdkpskeys.h>
       
    53 #include <startupdomainpskeys.h>
       
    54 
    53 
    55 
    54 #ifndef SYMBIAN_CALENDAR_V2
    56 #ifndef SYMBIAN_CALENDAR_V2
    55 #include <agmalarm.h> // deprecated, use CalAlarm.h when SYMBIAN_CALENDAR_V2 flag is enabled
    57 #include <agmalarm.h> // deprecated, use CalAlarm.h when SYMBIAN_CALENDAR_V2 flag is enabled
    56 #endif // SYMBIAN_CALENDAR_V2
    58 #endif // SYMBIAN_CALENDAR_V2
    57 #include <calsession.h>
    59 #include <calsession.h>
   965     
   967     
   966     // charging state added for the err EMDN-835CW2.
   968     // charging state added for the err EMDN-835CW2.
   967     TInt chargingState;
   969     TInt chargingState;
   968     RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus , chargingState );
   970     RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus , chargingState );
   969     
   971     
   970     if( IsDeviceInAlarmState() && ( chargingState != EChargingStatusCharging ) )
   972     if( IsDeviceInAlarmState() && ( chargingState == EChargingStatusNotConnected ) )
   971         {       
   973         {       
   972             iShutdownTimer->Cancel();
   974         iShutdownTimer->Cancel();
   973             if( StarterConnect() )
   975         if( StarterConnect() )
   974                 {
   976             {
   975                 iStarter.Shutdown();
   977             iStarter.Shutdown();
   976                 iStarter.Close();
   978             iStarter.Close();
   977                 }    
   979             }    
   978         }
   980         }
   979     TRACE_EXIT_POINT;
   981     TRACE_EXIT_POINT;
   980     }
   982     }
   981 
   983 
   982 // ---------------------------------------------------------
   984 // ---------------------------------------------------------
  1638 //
  1640 //
  1639 TBool CAlarmUtils::IsSecurityLockActive()
  1641 TBool CAlarmUtils::IsSecurityLockActive()
  1640     {
  1642     {
  1641     TRACE_ENTRY_POINT;
  1643     TRACE_ENTRY_POINT;
  1642     TInt keyVal( 0 );
  1644     TInt keyVal( 0 );
       
  1645     TInt currentBootupQueriesStatus(0);
  1643     TBool retVal( EFalse );
  1646     TBool retVal( EFalse );
  1644 
  1647 
  1645     PIM_ASSERT( RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, keyVal ); )
  1648     PIM_ASSERT( RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, keyVal ); )
  1646     if( keyVal > EAutolockOff )
  1649     PIM_ASSERT(RProperty::Get(KPSUidStartup,KPSStartupUiPhase,currentBootupQueriesStatus ); )
       
  1650     
       
  1651     if( (keyVal > EAutolockOff) || (currentBootupQueriesStatus != EStartupUiPhaseAllDone ) )
  1647         {
  1652         {
  1648         retVal = ETrue;
  1653         retVal = ETrue;
  1649         }
  1654         }
  1650     TRACE_EXIT_POINT;
  1655     TRACE_EXIT_POINT;
  1651     return retVal;
  1656     return retVal;
  1714         #endif // RD_ALMALERT__SENSOR_SUPPORT
  1719         #endif // RD_ALMALERT__SENSOR_SUPPORT
  1715         }
  1720         }
  1716     TRACE_EXIT_POINT;     
  1721     TRACE_EXIT_POINT;     
  1717     }
  1722     }
  1718 
  1723 
       
  1724 // ---------------------------------------------------------
       
  1725 // Check if the alarm is duplicate calendar alarm
       
  1726 // Rest of the details in header file
       
  1727 // ---------------------------------------------------------
       
  1728 //
       
  1729 TBool CAlarmUtils::CheckForDuplicateAlarm()
       
  1730     {
       
  1731 	TRACE_ENTRY_POINT;
       
  1732     TBool ret = EFalse;
       
  1733     if(IsCalendarAlarm())
       
  1734         {
       
  1735         TTime currAlarmOrigExpTime = iAlarmData.iAlarm.OriginalExpiryTime();
       
  1736 
       
  1737         if(currAlarmOrigExpTime == iPrevAlarmOriginalExpiryTime && iPrevLocalUid == iAlarmData.iLocalUid 
       
  1738 			&& !iPrevCalFileName.CompareF(iAlarmData.iCalFileName) )
       
  1739             {    
       
  1740             TInt& count = iAlarmData.iAlarm.ClientData1();
       
  1741             if( (count >= KAlmAlertMinSnooze && 
       
  1742                 count <= KAlmAlertMaxSnooze ))
       
  1743                 {
       
  1744                 ret = ETrue;
       
  1745                 }
       
  1746             }
       
  1747         }
       
  1748 	TRACE_EXIT_POINT;
       
  1749     return ret;
       
  1750     }
       
  1751 
       
  1752 
       
  1753 // ---------------------------------------------------------
       
  1754 // Store details of current alarm for future comparison when next calendar alarm comes.
       
  1755 // Rest of the details in header file
       
  1756 // ---------------------------------------------------------
       
  1757 //
       
  1758 void CAlarmUtils::StoreCurrentCalendarAlarmData()
       
  1759 	{
       
  1760 	TRACE_ENTRY_POINT;
       
  1761 	iPrevLocalUid					= iAlarmData.iLocalUid;  
       
  1762     iPrevCalFileName 				= iAlarmData.iCalFileName;
       
  1763 	iPrevAlarmOriginalExpiryTime 	= iAlarmData.iAlarm.OriginalExpiryTime();
       
  1764 	TRACE_EXIT_POINT;
       
  1765 	}
       
  1766 	
  1719 // End of File
  1767 // End of File