56 |
57 |
57 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
59 // ---------------------------------------------------------------------------- |
59 // |
60 // |
60 //<Qmail> |
61 //<Qmail> |
61 CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewL() |
62 CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewL(CIpsSosAOSettingsHandler& aSettings) |
62 //</Qmail> |
63 //</Qmail> |
63 { |
64 { |
64 FUNC_LOG; |
65 FUNC_LOG; |
65 //<Qmail> |
66 //<Qmail> |
66 CIpsSosAOSchedulerUtils* self = NewLC(); |
67 CIpsSosAOSchedulerUtils* self = NewLC(aSettings); |
67 //</Qmail> |
68 //</Qmail> |
68 CleanupStack::Pop( self ); |
69 CleanupStack::Pop( self ); |
69 |
70 |
70 return self; |
71 return self; |
71 } |
72 } |
72 |
73 |
73 // ---------------------------------------------------------------------------- |
74 // ---------------------------------------------------------------------------- |
74 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
75 // |
76 // |
76 //<Qmail> |
77 //<Qmail> |
77 CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewLC() |
78 CIpsSosAOSchedulerUtils* CIpsSosAOSchedulerUtils::NewLC(CIpsSosAOSettingsHandler& aSettings) |
78 //</Qmail> |
79 //</Qmail> |
79 { |
80 { |
80 FUNC_LOG; |
81 FUNC_LOG; |
81 CIpsSosAOSchedulerUtils* self = |
82 CIpsSosAOSchedulerUtils* self = |
82 //<Qmail> |
83 //<Qmail> |
83 new ( ELeave ) CIpsSosAOSchedulerUtils(); |
84 new ( ELeave ) CIpsSosAOSchedulerUtils(aSettings); |
84 //</Qmail> |
85 //</Qmail> |
85 CleanupStack::PushL( self ); |
86 CleanupStack::PushL( self ); |
86 self->ConstructL(); |
87 self->ConstructL(); |
87 |
88 |
88 return self; |
89 return self; |
225 |
226 |
226 // Get current and previous day and make sure it is selected |
227 // Get current and previous day and make sure it is selected |
227 TDay currentDay = aClock.DayNoInWeek(); |
228 TDay currentDay = aClock.DayNoInWeek(); |
228 TDay previousDay = GetPrevDay( currentDay ); |
229 TDay previousDay = GetPrevDay( currentDay ); |
229 TIpsSosAOValidConnectionDay result; |
230 TIpsSosAOValidConnectionDay result; |
230 |
231 |
231 |
|
232 // Connection can be made anyday |
232 // Connection can be made anyday |
233 if ( IsDaySelected( currentDay ) && IsDaySelected( previousDay ) ) |
233 if ( IsDaySelected( currentDay ) && IsDaySelected( previousDay ) ) |
234 { |
234 { |
235 |
235 |
236 result = EAOVCDConnectionAnyDay; |
236 result = EAOVCDConnectionAnyDay; |
248 |
248 |
249 result = EAOVCDConnectionPreviousDayOnly; |
249 result = EAOVCDConnectionPreviousDayOnly; |
250 } |
250 } |
251 // no selected days this is wron in settings side but still return anyday |
251 // no selected days this is wron in settings side but still return anyday |
252 //<QMail> |
252 //<QMail> |
253 /*else if ( iExtentedSettings.SelectedWeekDays() == 0 ) |
253 else if ( iSettings.SelectedWeekDays() == 0 ) |
254 { |
254 { |
255 result = EAOVCDConnectionAnyDay; |
255 result = EAOVCDConnectionAnyDay; |
256 }*/ |
256 } |
257 //</QMail> |
257 //</QMail> |
258 // Connection is not allowed |
258 // Connection is not allowed |
259 else |
259 else |
260 { |
260 { |
261 |
261 |
262 result = EAOVCDNoConnection; |
262 result = EAOVCDNoConnection; |
263 } |
263 } |
264 |
264 |
265 return result; |
265 return result; |
266 } |
266 } |
267 |
267 |
268 // ----------------------------------------------------------------------------) |
268 // ----------------------------------------------------------------------------) |
269 // ---------------------------------------------------------------------------- |
269 // ---------------------------------------------------------------------------- |
390 FUNC_LOG; |
390 FUNC_LOG; |
391 |
391 |
392 TTime zeroTime( 0 ); |
392 TTime zeroTime( 0 ); |
393 TTime adjustedHomeTime = AdjustHomeTime( aClock ); |
393 TTime adjustedHomeTime = AdjustHomeTime( aClock ); |
394 //<QMail> |
394 //<QMail> |
395 TTime selectedTimeStart;// = iExtentedSettings.SelectedTimeStart(); |
395 TTime selectedTimeStart = iSettings.SelectedTimeStart(); |
396 TTime selectedTimeStop;// = iExtentedSettings.SelectedTimeStop(); |
396 TTime selectedTimeStop = iSettings.SelectedTimeStop(); |
397 //</QMail> |
397 //</QMail> |
398 adjustedHomeTime.SecondsFrom( zeroTime, aHome ); |
398 adjustedHomeTime.SecondsFrom( zeroTime, aHome ); |
399 selectedTimeStart.SecondsFrom( zeroTime, aStart ); |
399 selectedTimeStart.SecondsFrom( zeroTime, aStart ); |
400 selectedTimeStop.SecondsFrom( zeroTime, aStop ); |
400 selectedTimeStop.SecondsFrom( zeroTime, aStop ); |
401 |
401 |
506 // ---------------------------------------------------------------------------- |
506 // ---------------------------------------------------------------------------- |
507 // ---------------------------------------------------------------------------- |
507 // ---------------------------------------------------------------------------- |
508 // |
508 // |
509 TTimeIntervalSeconds CIpsSosAOSchedulerUtils::CalcSecsToNextScheduledDay( |
509 TTimeIntervalSeconds CIpsSosAOSchedulerUtils::CalcSecsToNextScheduledDay( |
510 //<QMail> |
510 //<QMail> |
511 const TTime& /*aClock*/, |
511 const TTime& aClock, |
512 const TTimeIntervalSeconds& /*aHome*/, |
512 const TTimeIntervalSeconds& aHome, |
513 const TBool /*aScheduledDay*/ ) |
513 const TBool aScheduledDay ) |
514 { |
514 { |
515 FUNC_LOG; |
515 FUNC_LOG; |
516 |
516 |
517 TTimeIntervalSeconds seconds = 0; |
517 TTimeIntervalSeconds seconds = 0; |
518 |
518 |
519 // First check if all of the days are unchecked, which should not happen |
519 // First check if all of the days are unchecked, which should not happen |
520 // at all, but just in case |
520 // at all, but just in case |
521 /* |
521 |
522 if ( !iExtentedSettings.SelectedWeekDays() ) |
522 if ( !iSettings.SelectedWeekDays() ) |
523 { |
523 { |
524 // Temporarly set all the days selected |
|
525 return seconds; |
524 return seconds; |
526 __ASSERT_DEBUG( ( |
|
527 EFalse ), |
|
528 User::Panic( _L("AO"), KErrGeneral) ); |
|
529 } |
525 } |
530 |
526 |
531 TBool hit = EFalse; |
527 TBool hit = EFalse; |
532 |
528 |
533 TDay today = aClock.DayNoInWeek(); |
529 TDay today = aClock.DayNoInWeek(); |
542 } |
538 } |
543 |
539 |
544 |
540 |
545 seconds = KAOSecondsIn24Hours - aHome.Int() + |
541 seconds = KAOSecondsIn24Hours - aHome.Int() + |
546 dayCount * KAOSecondsIn24Hours; |
542 dayCount * KAOSecondsIn24Hours; |
547 */ |
543 |
548 //</QMail> |
544 //</QMail> |
549 return seconds; |
545 return seconds; |
550 } |
546 } |
551 |
547 |
552 // ---------------------------------------------------------------------------- |
548 // ---------------------------------------------------------------------------- |
553 // ---------------------------------------------------------------------------- |
549 // ---------------------------------------------------------------------------- |
554 // |
550 // |
555 //<QMail> |
551 //<QMail> |
556 TBool CIpsSosAOSchedulerUtils::IsDaySelected( const TUint /*aDay*/ ) const |
552 TBool CIpsSosAOSchedulerUtils::IsDaySelected( const TUint aDay ) const |
557 { |
553 { |
558 FUNC_LOG; |
554 FUNC_LOG; |
559 //return ( iExtentedSettings.SelectedWeekDays() >> aDay ) & 0x01; |
555 return ( iSettings.SelectedWeekDays() >> aDay ) & 0x01; |
560 return EFalse; |
556 //</QMail> |
561 //</QMail> |
|
562 } |
557 } |
563 |
558 |
564 // End of File |
559 // End of File |
565 |
560 |