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