diff -r d189ee25cf9d -r 3533d4323edc ipsservices/ipssosaoplugin/src/IpsSosAOSchedulerUtils.cpp --- a/ipsservices/ipssosaoplugin/src/IpsSosAOSchedulerUtils.cpp Tue Aug 31 15:04:17 2010 +0300 +++ b/ipsservices/ipssosaoplugin/src/IpsSosAOSchedulerUtils.cpp Wed Sep 01 12:28:57 2010 +0100 @@ -16,7 +16,12 @@ * */ -#include "ipssosaopluginheaders.h" + +#include "emailtrace.h" +#include "IpsSosAOSchedulerUtils.h" +#include "ipssetdataextension.h" + + const TInt KAOSecondsIn24Hours = 86400; //const TUint KAOEveryDayMask = 0x7f; @@ -25,10 +30,9 @@ // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // -// -CIpsSosAOSchedulerUtils::CIpsSosAOSchedulerUtils( CIpsSosAOSettingsHandler& aSettings ): - iSettings(aSettings) -// +CIpsSosAOSchedulerUtils::CIpsSosAOSchedulerUtils( + const CIpsSetDataExtension& aExtentedSettings ) + : iExtentedSettings( aExtentedSettings ) { FUNC_LOG; } @@ -52,14 +56,11 @@ // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // -// -CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewL(CIpsSosAOSettingsHandler& aSettings) -// +CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewL( + const CIpsSetDataExtension& aExtentedSettings ) { FUNC_LOG; - // - CIpsSosAOSchedulerUtils* self = NewLC(aSettings); - // + CIpsSosAOSchedulerUtils* self = NewLC( aExtentedSettings ); CleanupStack::Pop( self ); return self; @@ -68,15 +69,12 @@ // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // -// -CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewLC(CIpsSosAOSettingsHandler& aSettings) -// +CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewLC( + const CIpsSetDataExtension& aExtentedSettings ) { FUNC_LOG; CIpsSosAOSchedulerUtils* self = - // - new ( ELeave ) CIpsSosAOSchedulerUtils(aSettings); - // + new ( ELeave ) CIpsSosAOSchedulerUtils( aExtentedSettings ); CleanupStack::PushL( self ); self->ConstructL(); @@ -222,7 +220,8 @@ TDay currentDay = aClock.DayNoInWeek(); TDay previousDay = GetPrevDay( currentDay ); TIpsSosAOValidConnectionDay result; - + + // Connection can be made anyday if ( IsDaySelected( currentDay ) && IsDaySelected( previousDay ) ) { @@ -243,19 +242,17 @@ result = EAOVCDConnectionPreviousDayOnly; } // no selected days this is wron in settings side but still return anyday - // - else if ( iSettings.SelectedWeekDays() == 0 ) + else if ( iExtentedSettings.SelectedWeekDays() == 0 ) { result = EAOVCDConnectionAnyDay; } - // // Connection is not allowed else { result = EAOVCDNoConnection; } - + return result; } @@ -385,10 +382,8 @@ TTime zeroTime( 0 ); TTime adjustedHomeTime = AdjustHomeTime( aClock ); - // - TTime selectedTimeStart = iSettings.SelectedTimeStart(); - TTime selectedTimeStop = iSettings.SelectedTimeStop(); - // + TTime selectedTimeStart = iExtentedSettings.SelectedTimeStart(); + TTime selectedTimeStop = iExtentedSettings.SelectedTimeStop(); adjustedHomeTime.SecondsFrom( zeroTime, aHome ); selectedTimeStart.SecondsFrom( zeroTime, aStart ); selectedTimeStop.SecondsFrom( zeroTime, aStop ); @@ -501,7 +496,6 @@ // ---------------------------------------------------------------------------- // TTimeIntervalSeconds CIpsSosAOSchedulerUtils::CalcSecsToNextScheduledDay( -// const TTime& aClock, const TTimeIntervalSeconds& aHome, const TBool aScheduledDay ) @@ -512,14 +506,16 @@ // First check if all of the days are unchecked, which should not happen // at all, but just in case - - if ( !iSettings.SelectedWeekDays() ) + if ( !iExtentedSettings.SelectedWeekDays() ) { + // Temporarly set all the days selected return seconds; + /* __ASSERT_DEBUG( ( + EFalse ), + User::Panic( _L("AO"), KErrGeneral) );*/ } TBool hit = EFalse; - TDay today = aClock.DayNoInWeek(); TDay dayAfter = GetNextDay( today ); TInt dayCount = KErrNotFound; @@ -535,19 +531,17 @@ seconds = KAOSecondsIn24Hours - aHome.Int() + dayCount * KAOSecondsIn24Hours; - // + return seconds; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // -// TBool CIpsSosAOSchedulerUtils::IsDaySelected( const TUint aDay ) const { FUNC_LOG; - return ( iSettings.SelectedWeekDays() >> aDay ) & 0x01; - // + return ( iExtentedSettings.SelectedWeekDays() >> aDay ) & 0x01; } // End of File