75 void CIAUpdateBGTimer::ConstructL() |
67 void CIAUpdateBGTimer::ConstructL() |
76 { |
68 { |
77 CTimer::ConstructL(); |
69 CTimer::ConstructL(); |
78 CActiveScheduler::Add( this ); |
70 CActiveScheduler::Add( this ); |
79 |
71 |
80 iReminderTimer = CIAUpdateBGReminderTimer::NewL( this ); |
|
81 iUpdate = NULL; |
72 iUpdate = NULL; |
82 iParameters = NULL; |
73 iParameters = NULL; |
83 |
74 |
84 iIAUpdateCRSession = NULL; |
75 iIAUpdateCRSession = NULL; |
85 iNotifyHandler = NULL; |
76 iNotifyHandler = NULL; |
86 |
77 |
87 iControllerFile = CIAUpdateBGControllerFile::NewL(); |
78 iControllerFile = CIAUpdateBGControllerFile::NewL(); |
88 |
79 |
89 iInternalFile = CIAUpdateBGInternalFileHandler::NewL(); |
80 iInternalFile = CIAUpdateBGInternalFileHandler::NewL(); |
90 |
81 |
91 iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); //, iInternalFile ); |
82 iSoftNotification = CIAUpdateBGSoftNotification::NewL( this ); |
92 // HLa: iSoftNotification->StartObservingIfNeededL(); |
83 |
93 |
84 // loc: initialize localisation text loader |
94 // Get resource file path |
85 /* |
95 /* HLa |
86 TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath); |
96 TFileName fileName; |
87 if ( res != KErrNone ) |
97 fileName.Copy(TParsePtrC(RProcess().FileName()).Drive()); |
88 { |
98 fileName.Append(KDC_APP_RESOURCE_DIR); |
89 // nothing to do |
99 fileName.Append(KIAUpdateResourceFile); |
90 } |
100 */ |
91 */ |
101 |
92 } |
102 User::LeaveIfError(iFs.Connect()); |
|
103 |
|
104 // Get language of resource file |
|
105 //BaflUtils::NearestLanguageFile( iFs, fileName ); |
|
106 |
|
107 // Open resource file |
|
108 //iResourceFile.OpenL( iFs, fileName ); |
|
109 //iResourceFile.ConfirmSignatureL(); |
|
110 } |
|
111 |
|
112 |
93 |
113 // ---------------------------------------------------------- |
94 // ---------------------------------------------------------- |
114 // CIAUpdateBGTimer::~CIAUpdateBGTimer() |
95 // CIAUpdateBGTimer::~CIAUpdateBGTimer() |
115 // ---------------------------------------------------------- |
96 // ---------------------------------------------------------- |
116 CIAUpdateBGTimer::~CIAUpdateBGTimer() |
97 CIAUpdateBGTimer::~CIAUpdateBGTimer() |
117 { |
98 { |
118 Cancel(); |
99 Cancel(); |
119 delete iUpdate; |
100 delete iUpdate; |
120 delete iParameters; |
101 delete iParameters; |
121 delete iReminderTimer; |
|
122 |
102 |
123 if ( iNotifyHandler ) |
103 if ( iNotifyHandler ) |
124 { |
104 { |
125 iNotifyHandler->StopListening(); |
105 iNotifyHandler->StopListening(); |
126 delete iNotifyHandler; |
106 delete iNotifyHandler; |
129 delete iIAUpdateCRSession; |
109 delete iIAUpdateCRSession; |
130 delete iControllerFile; |
110 delete iControllerFile; |
131 delete iInternalFile; |
111 delete iInternalFile; |
132 delete iSoftNotification; |
112 delete iSoftNotification; |
133 |
113 |
134 // iResourceFile.Close(); |
114 } |
135 iFs.Close(); |
|
136 } |
|
137 |
|
138 |
115 |
139 // ---------------------------------------------------------- |
116 // ---------------------------------------------------------- |
140 // CIAUpdateBGTimer::StartProcessL() |
117 // CIAUpdateBGTimer::StartProcessL() |
141 // ---------------------------------------------------------- |
118 // ---------------------------------------------------------- |
142 void CIAUpdateBGTimer::StartProcessL() |
119 void CIAUpdateBGTimer::StartProcessL() |
143 { |
120 { |
144 FLOG("[bgchecker] StartProcessL"); |
121 FLOG("[bgchecker] StartProcessL"); |
145 |
122 |
146 iMode = ModeL(); |
123 iMode = ModeL(); |
147 |
124 |
148 //HLa |
|
149 TBool test1 = IsAgreementAcceptedL(); |
|
150 TBool test2 = ReminderOnL(); |
|
151 |
|
152 int test = 0; |
|
153 switch ( iMode ) |
125 switch ( iMode ) |
154 { |
126 { |
155 case EFirstTimeMode: |
127 case EFirstTimeMode: |
156 |
|
157 // while not released keep in sleep mode |
|
158 //int test = 1; |
|
159 if ( test == 0 ) |
|
160 { |
128 { |
161 ListenAutoUpdateSettingsL(); |
129 // while not released keep in sleep mode |
162 iMode = ESleepMode; |
130 int test = 0; |
163 SetModeL( iMode ); |
131 if ( test == 0 ) |
164 return; |
132 { |
165 } |
133 ListenAutoUpdateSettingsL(); |
|
134 iMode = ESleepMode; |
|
135 SetModeL( iMode ); |
|
136 return; |
|
137 } |
166 |
138 |
167 //case EFirstTimeRemindMode: |
|
168 { |
|
169 if ( IsFirstTimeDialogDisabledL() ) |
139 if ( IsFirstTimeDialogDisabledL() ) |
170 { |
140 { |
171 //this should only happen in testing |
141 //this should only happen in testing |
172 FLOG("[bgchecker] StartProcessL Firs time dialog is disabled, this should only happen in testing"); |
142 FLOG("[bgchecker] StartProcessL Firs time dialog is disabled, this should only happen in testing"); |
173 |
143 |
525 return err; |
445 return err; |
526 } |
446 } |
527 |
447 |
528 |
448 |
529 // ---------------------------------------------------------- |
449 // ---------------------------------------------------------- |
530 // CIAUpdateBGTimer::NextRemindTimeL() |
|
531 // ---------------------------------------------------------- |
|
532 TTime CIAUpdateBGTimer::NextRemindTimeL() |
|
533 { |
|
534 iInternalFile->ReadControllerDataL(); |
|
535 return iInternalFile->NextRemindTime(); |
|
536 } |
|
537 |
|
538 |
|
539 // ---------------------------------------------------------- |
|
540 // CIAUpdateBGTimer::SetNextRemindTimeL() |
|
541 // ---------------------------------------------------------- |
|
542 TInt CIAUpdateBGTimer::SetNextRemindTimeL( TTime aTime ) |
|
543 { |
|
544 iInternalFile->SetNextRemindTime( aTime ); |
|
545 TRAPD( err,iInternalFile->WriteControllerDataL() ); |
|
546 return err; |
|
547 } |
|
548 |
|
549 |
|
550 // ---------------------------------------------------------- |
|
551 // CIAUpdateBGTimer::ReminderOnL() |
|
552 // ---------------------------------------------------------- |
|
553 TBool CIAUpdateBGTimer::ReminderOnL() |
|
554 { |
|
555 iInternalFile->ReadControllerDataL(); |
|
556 return iInternalFile->ReminderOn(); |
|
557 } |
|
558 |
|
559 |
|
560 // ---------------------------------------------------------- |
|
561 // CIAUpdateBGTimer::SetReminderL() |
|
562 // ---------------------------------------------------------- |
|
563 TInt CIAUpdateBGTimer::SetReminderL( TBool aOn ) |
|
564 { |
|
565 iInternalFile->SetReminder( aOn ); |
|
566 TRAPD( err,iInternalFile->WriteControllerDataL() ); |
|
567 return err; |
|
568 } |
|
569 |
|
570 |
|
571 // ---------------------------------------------------------- |
|
572 // CIAUpdateBGTimer::ModeL() |
450 // CIAUpdateBGTimer::ModeL() |
573 // ---------------------------------------------------------- |
451 // ---------------------------------------------------------- |
574 TIAUpdateBGMode CIAUpdateBGTimer::ModeL() |
452 TIAUpdateBGMode CIAUpdateBGTimer::ModeL() |
575 { |
453 { |
576 iInternalFile->ReadControllerDataL(); |
454 iInternalFile->ReadControllerDataL(); |
1010 break; |
853 break; |
1011 }; |
854 }; |
1012 |
855 |
1013 } |
856 } |
1014 |
857 |
1015 /* |
|
1016 // ---------------------------------------------------------- |
|
1017 // CIAUpdateBGTimer::RunL() |
|
1018 // ---------------------------------------------------------- |
|
1019 void CIAUpdateBGTimer::RunL() |
|
1020 { |
|
1021 FLOG("[bgchecker]RunL() "); |
|
1022 if ( !IAUpdateEnabledL() ) |
|
1023 { |
|
1024 Shutdown(); |
|
1025 return; |
|
1026 } |
|
1027 User::LeaveIfError( iStatus.Int() ); |
|
1028 //Check the mode again, in case the mode is changed while waiting. |
|
1029 iMode = ModeL(); |
|
1030 |
|
1031 switch ( iMode ) |
|
1032 { |
|
1033 case ENormalMode: |
|
1034 case ERetryMode: |
|
1035 { |
|
1036 FLOG("[bgchecker]RunL() ENormalMode"); |
|
1037 //roaming case is checked in IAUpdate server side |
|
1038 if ( IsAutoUpdateDisabledL() ) |
|
1039 { |
|
1040 ListenAutoUpdateSettingsL(); |
|
1041 |
|
1042 iMode = ESleepMode; |
|
1043 SetModeL( iMode ); |
|
1044 |
|
1045 //the program is waked up when automatic checking is changed by user. |
|
1046 //cenrep call back will be used. |
|
1047 return; |
|
1048 } |
|
1049 |
|
1050 FLOG("[bgchecker]RunL() ENormalMode 1"); |
|
1051 |
|
1052 if(iRuns == 0) |
|
1053 { |
|
1054 FLOG("[bgchecker]RunL() ENormalMode 2"); |
|
1055 // if user did the refresh from server while waiting, restart the timer. |
|
1056 // the last refresh time is read from the private file of IAUpdate server. |
|
1057 TTimeIntervalMinutes timetowait = |
|
1058 TimeIntervalFromNextRefreshL(); |
|
1059 |
|
1060 if (timetowait.Int() <= 0 ) |
|
1061 { |
|
1062 DoUpdatesCheckingL( ETrue ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 StartL( timetowait ); |
|
1067 } |
|
1068 FLOG("[bgchecker]RunL() ENormalMode 3"); |
|
1069 } |
|
1070 else |
|
1071 { |
|
1072 FLOG("[bgchecker]RunL() ENormalMode 4"); |
|
1073 TTimeIntervalMinutes timetowait = TimeIntervalFromNextRefreshL(); |
|
1074 |
|
1075 if ( timetowait.Int() <= 0 ) |
|
1076 { |
|
1077 StartL( StartNow ); |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 StartL( timetowait ); |
|
1082 } |
|
1083 FLOG("[bgchecker]RunL() ENormalMode 5"); |
|
1084 } |
|
1085 } |
|
1086 break; |
|
1087 |
|
1088 case EFirstTimeMode: |
|
1089 case EFirstTimeRemindMode: |
|
1090 { |
|
1091 FLOG("[bgchecker] runl EFirstTimeMode"); |
|
1092 |
|
1093 if ( iRuns == 0 ) |
|
1094 { |
|
1095 FLOG("[bgchecker] runl run = 0"); |
|
1096 HandlerFirstTimeL(); |
|
1097 } |
|
1098 else |
|
1099 { |
|
1100 FLOG("[bgchecker] runl still wait"); |
|
1101 TTimeIntervalMinutes timetowait = TimeIntervalFromNextShowOfNewFeatureDialogL(); |
|
1102 |
|
1103 if ( timetowait.Int() <= 0 ) |
|
1104 { |
|
1105 StartL( StartNow ); |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 StartL( timetowait ); |
|
1110 } |
|
1111 } |
|
1112 } |
|
1113 break; |
|
1114 |
|
1115 case EFirstTimeMode2: |
|
1116 { |
|
1117 FLOG("[bgchecker] runl EFirstTimeMode2"); |
|
1118 LaunchNotificationL( 1 ); |
|
1119 //LaunchSoftNotificationL(R_IAUPDATE_REMIND_LATER, R_TEXT_SOFTKEY_YES, R_TEXT_SOFTKEY_NO ); |
|
1120 } |
|
1121 break; |
|
1122 |
|
1123 case EFirstTimeMode3: |
|
1124 { |
|
1125 FLOG("[bgchecker] runl EFirstTimeMode3"); |
|
1126 //disclaimer is not accepted |
|
1127 |
|
1128 if ( !IsAgreementAcceptedL() ) |
|
1129 { |
|
1130 FLOG("[bgchecker] runl EFirstTimeMode reject disclaimer"); |
|
1131 //user accepte the new feature dialog but user reject sthe disclaimer |
|
1132 //in sleep mode now |
|
1133 iMode = ESleepMode; |
|
1134 SetModeL( iMode ); |
|
1135 //subscribe to cenrep key for automatic checking for wake up from sleep mode |
|
1136 ListenAutoUpdateSettingsL(); |
|
1137 } |
|
1138 else |
|
1139 { |
|
1140 FLOG("[bgchecker] runl EFirstTimeMode go to normal mode"); |
|
1141 //Set to Normal mode |
|
1142 //check autochecksetting in Runl later |
|
1143 iMode = ENormalMode; |
|
1144 SetModeL( iMode ); |
|
1145 StartL( StartNow ); |
|
1146 } |
|
1147 } |
|
1148 break; |
|
1149 |
|
1150 default: |
|
1151 break; |
|
1152 }; |
|
1153 |
|
1154 }*/ |
|
1155 |
858 |
1156 // ---------------------------------------------------------- |
859 // ---------------------------------------------------------- |
1157 // CIAUpdateBGTimer::HandlerFirstTimeL() |
860 // CIAUpdateBGTimer::HandlerFirstTimeL() |
1158 // ---------------------------------------------------------- |
861 // ---------------------------------------------------------- |
1159 void CIAUpdateBGTimer::HandlerFirstTimeL() |
862 void CIAUpdateBGTimer::HandlerFirstTimeL() |
1522 //check user's setting and disclamier after 10mins. |
1210 //check user's setting and disclamier after 10mins. |
1523 } |
1211 } |
1524 break; |
1212 break; |
1525 } |
1213 } |
1526 |
1214 |
1527 |
|
1528 /* |
|
1529 case EFirstTimeMode2: // reminder |
|
1530 { |
|
1531 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2 "); |
|
1532 if ( aIsAccepted ) // reminder accepted ? |
|
1533 { |
|
1534 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, accepted"); |
|
1535 //user wants to be reminder so remind in 4 weeks |
|
1536 //set to first time remind mode |
|
1537 iMode = EFirstTimeRemindMode; |
|
1538 SetModeL( iMode ); |
|
1539 TTimeIntervalMinutes fourweeks( FirstTimeDialogReminderIntervalInMinutesL() ); |
|
1540 TTime currenttime; |
|
1541 currenttime.UniversalTime(); |
|
1542 |
|
1543 //save the next show new feature dialog time |
|
1544 //in case use switch off the device and restarted. |
|
1545 User::LeaveIfError( SetLastTimeShowNewFeatureDialogL( currenttime ) ); |
|
1546 |
|
1547 StartL( fourweeks ); |
|
1548 return; |
|
1549 } |
|
1550 else |
|
1551 { |
|
1552 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, not accepted"); |
|
1553 //in sleep mode now |
|
1554 iMode = ESleepMode; |
|
1555 SetModeL( iMode ); |
|
1556 |
|
1557 //subscribe to cenrep key for automatic checking for wake up from sleep mode |
|
1558 ListenAutoUpdateSettingsL(); |
|
1559 } |
|
1560 break; |
|
1561 } |
|
1562 */ |
|
1563 case ENormalMode: |
1215 case ENormalMode: |
1564 { |
1216 { |
1565 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode"); |
1217 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode"); |
1566 if ( !aIsAccepted ) |
1218 if ( !aIsAccepted ) |
1567 { |
1219 { |
1568 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted"); |
1220 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted"); |
1569 //user wants to be reminded later |
|
1570 TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() ); |
|
1571 TTime currenttime; |
|
1572 currenttime.UniversalTime(); |
|
1573 TTime nextRemindTime = currenttime + oneweek; |
|
1574 |
|
1575 SetReminderL( ETrue ); |
|
1576 SetNextRemindTimeL( nextRemindTime ); |
|
1577 |
1221 |
1578 iReminderTimer->StartReminderTimerL( oneweek ); |
|
1579 |
|
1580 //the reminder call back function will be called when reminder timer expires. |
|
1581 } |
1222 } |
1582 else |
1223 else |
1583 { |
1224 { |
1584 //accepted, launch iad |
1225 //accepted, launch iad |
1585 StartIaupdateL(); |
1226 StartIaupdateL(); |
1597 default: |
1238 default: |
1598 break; |
1239 break; |
1599 } |
1240 } |
1600 } |
1241 } |
1601 |
1242 |
1602 /* |
|
1603 // ---------------------------------------------------------- |
|
1604 // CIAUpdateBGTimer::DoSoftNotificationCallBackL() |
|
1605 // ---------------------------------------------------------- |
|
1606 void CIAUpdateBGTimer::DoSoftNotificationCallBackL( TBool aIsAccepted ) |
|
1607 { |
|
1608 FLOG("[bgchecker] SoftNotificationCallBack"); |
|
1609 if ( !IAUpdateEnabledL() ) |
|
1610 { |
|
1611 Shutdown(); |
|
1612 return; |
|
1613 } |
|
1614 iMode = ModeL(); |
|
1615 |
|
1616 switch ( iMode ) |
|
1617 { |
|
1618 case EFirstTimeMode: |
|
1619 case EFirstTimeRemindMode: |
|
1620 { |
|
1621 |
|
1622 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode"); |
|
1623 if ( !aIsAccepted ) |
|
1624 { |
|
1625 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode not accepted"); |
|
1626 iMode = EFirstTimeMode2; |
|
1627 SetModeL( iMode ); |
|
1628 StartL( StartNow ); |
|
1629 } |
|
1630 else |
|
1631 { |
|
1632 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMod accepeted"); |
|
1633 StartIaupdateL(); |
|
1634 //iaupdate is launched |
|
1635 //check the disclaimer acceptance and automatic checking setting in 10mins |
|
1636 |
|
1637 StartL( KDelayForUserToAcceptDisclaimer ); |
|
1638 iMode = EFirstTimeMode3; |
|
1639 SetModeL( iMode ); |
|
1640 |
|
1641 |
|
1642 //Still in first time mode, |
|
1643 //check user's setting and disclamier after 10mins. |
|
1644 } |
|
1645 break; |
|
1646 } |
|
1647 |
|
1648 |
|
1649 |
|
1650 case EFirstTimeMode2: // reminder |
|
1651 { |
|
1652 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2 "); |
|
1653 if ( aIsAccepted ) // reminder accepted ? |
|
1654 { |
|
1655 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, accepted"); |
|
1656 //user wants to be reminder so remind in 4 weeks |
|
1657 //set to first time remind mode |
|
1658 iMode = EFirstTimeRemindMode; |
|
1659 SetModeL( iMode ); |
|
1660 TTimeIntervalMinutes fourweeks( FirstTimeDialogReminderIntervalInMinutesL() ); |
|
1661 TTime currenttime; |
|
1662 currenttime.UniversalTime(); |
|
1663 |
|
1664 //save the next show new feature dialog time |
|
1665 //in case use switch off the device and restarted. |
|
1666 User::LeaveIfError( SetLastTimeShowNewFeatureDialogL( currenttime ) ); |
|
1667 |
|
1668 StartL( fourweeks ); |
|
1669 return; |
|
1670 } |
|
1671 else |
|
1672 { |
|
1673 FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, not accepted"); |
|
1674 //in sleep mode now |
|
1675 iMode = ESleepMode; |
|
1676 SetModeL( iMode ); |
|
1677 |
|
1678 //subscribe to cenrep key for automatic checking for wake up from sleep mode |
|
1679 ListenAutoUpdateSettingsL(); |
|
1680 } |
|
1681 break; |
|
1682 } |
|
1683 |
|
1684 case ENormalMode: |
|
1685 { |
|
1686 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode"); |
|
1687 if ( !aIsAccepted ) |
|
1688 { |
|
1689 FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted"); |
|
1690 //user wants to be reminded later |
|
1691 TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() ); |
|
1692 TTime currenttime; |
|
1693 currenttime.UniversalTime(); |
|
1694 TTime nextRemindTime = currenttime + oneweek; |
|
1695 |
|
1696 SetReminderL( ETrue ); |
|
1697 SetNextRemindTimeL( nextRemindTime ); |
|
1698 |
|
1699 iReminderTimer->StartReminderTimerL( oneweek ); |
|
1700 |
|
1701 //the reminder call back function will be called when reminder timer expires. |
|
1702 } |
|
1703 else |
|
1704 { |
|
1705 //accepted, launch iad |
|
1706 StartIaupdateL(); |
|
1707 } |
|
1708 break; |
|
1709 } |
|
1710 |
|
1711 case ESleepMode: |
|
1712 { |
|
1713 FLOG("[bgchecker] SoftNotificationCallBack ESleepMode"); |
|
1714 //donothing |
|
1715 break; |
|
1716 } |
|
1717 |
|
1718 default: |
|
1719 break; |
|
1720 } |
|
1721 } */ |
|
1722 |
|
1723 // ---------------------------------------------------------- |
1243 // ---------------------------------------------------------- |
1724 // CIAUpdateBGTimer::SoftNotificationCallBack() |
1244 // CIAUpdateBGTimer::SoftNotificationCallBack() |
1725 // ---------------------------------------------------------- |
1245 // ---------------------------------------------------------- |
1726 void CIAUpdateBGTimer::SoftNotificationCallBack( TBool aIsAccepted ) |
1246 void CIAUpdateBGTimer::SoftNotificationCallBack( TBool aIsAccepted ) |
1727 { |
1247 { |
1735 TIAUpdateBGMode CIAUpdateBGTimer::CurrentMode() |
1255 TIAUpdateBGMode CIAUpdateBGTimer::CurrentMode() |
1736 { |
1256 { |
1737 return iMode; |
1257 return iMode; |
1738 } |
1258 } |
1739 |
1259 |
1740 |
|
1741 |
|
1742 // ---------------------------------------------------------- |
|
1743 // CIAUpdateBGTimer::DoReminderTimerCallBack() |
|
1744 // ---------------------------------------------------------- |
|
1745 void CIAUpdateBGTimer::DoReminderTimerCallBackL() |
|
1746 { |
|
1747 FLOG("[bgchecker] ReminderTimerCallBack begin"); |
|
1748 if ( !IAUpdateEnabledL() ) |
|
1749 { |
|
1750 Shutdown(); |
|
1751 return; |
|
1752 } |
|
1753 //Check the automatic update setting, if it has been disabled, |
|
1754 //then go to sleep mode. |
|
1755 if ( IsAutoUpdateDisabledL() ) |
|
1756 { |
|
1757 FLOG("[bgchecker] ReminderTimerCallBack autoupdate is disabled, switch to sleep mode"); |
|
1758 ListenAutoUpdateSettingsL(); |
|
1759 iMode = ESleepMode; |
|
1760 SetModeL( iMode ); |
|
1761 return; |
|
1762 } |
|
1763 |
|
1764 TTimeIntervalMinutes timetowait = TimeIntervalFromNextRefreshL(); |
|
1765 |
|
1766 if ( timetowait.Int() <= KRefreshTimerReminderTimerGap ) |
|
1767 { |
|
1768 FLOG("[bgchecker] ReminderTimerCallBack refresh is about to come in one day. We don't show reminder then"); |
|
1769 return; |
|
1770 } |
|
1771 |
|
1772 //if reminder is still on which means the BGTimer is not expired |
|
1773 //and checkupdate() is not called yet, then go ahead to call DoupdatesChecking |
|
1774 //this is to avoid DoUpdateChecking being called at the same time. |
|
1775 |
|
1776 if ( ReminderOnL() ) |
|
1777 { |
|
1778 FLOG("[bgchecker] ReminderTimerCallBack Reminder is still ON"); |
|
1779 DoUpdatesCheckingL( EFalse ); |
|
1780 } |
|
1781 FLOG("[bgchecker] ReminderTimerCallBack end"); |
|
1782 } |
|
1783 |
|
1784 // ---------------------------------------------------------- |
|
1785 // CIAUpdateBGTimer::ReminderTimerCallBack() |
|
1786 // ---------------------------------------------------------- |
|
1787 void CIAUpdateBGTimer::ReminderTimerCallBack() |
|
1788 { |
|
1789 TRAP_IGNORE( DoReminderTimerCallBackL() ); |
|
1790 } |
|
1791 |
|
1792 // ---------------------------------------------------------- |
1260 // ---------------------------------------------------------- |
1793 // CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates ) |
1261 // CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates ) |
1794 // ---------------------------------------------------------- |
1262 // ---------------------------------------------------------- |
1795 void CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates ) |
1263 void CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates ) |
1796 { |
1264 { |
1920 |
1388 |
1921 // Set number of updates |
1389 // Set number of updates |
1922 iSoftNotification->SetNrOfUpdates( aNrOfUpdates ); |
1390 iSoftNotification->SetNrOfUpdates( aNrOfUpdates ); |
1923 |
1391 |
1924 iSoftNotification->ShowNotificationL(); |
1392 iSoftNotification->ShowNotificationL(); |
1925 FLOG("[bgchecker] LaunchSoftNotificationL 1"); |
1393 FLOG("[bgchecker] LaunchNotificationL 1"); |
1926 // CleanupStack::PopAndDestroy( 3 ); //text, sk1, sk2 |
|
1927 |
1394 |
1928 return; |
1395 return; |
1929 } |
1396 } |
1930 // ---------------------------------------------------------- |
|
1931 // CIAUpdateBGTimer::LaunchSoftNotificationL() |
|
1932 // ---------------------------------------------------------- |
|
1933 /* HLa |
|
1934 void CIAUpdateBGTimer::LaunchSoftNotificationL( const TInt& aResourceId, const TInt& SK1, const TInt& SK2 ) |
|
1935 { |
|
1936 iInternalFile->ReadControllerDataL(); |
|
1937 TInt snid = iInternalFile->SoftNotificationID(); |
|
1938 if ( snid ) |
|
1939 { |
|
1940 //there is a soft notification buffered, remove it |
|
1941 iSoftNotification->RemoveSoftNotificationL( snid ); |
|
1942 } |
|
1943 |
|
1944 FLOG("[bgchecker] LaunchSoftNotificationL "); |
|
1945 HBufC* text = ReadResourceLC( aResourceId ); |
|
1946 HBufC* sk1 = ReadResourceLC( SK1 ); |
|
1947 HBufC* sk2 = ReadResourceLC( SK2 ); |
|
1948 |
|
1949 |
|
1950 iMode = ModeL(); |
|
1951 |
|
1952 if ( iMode == ENormalMode ) |
|
1953 { |
|
1954 TFileName path; |
|
1955 TInt err = GetPrivatePathL( path ); |
|
1956 |
|
1957 if ( err == KErrNone ) |
|
1958 { |
|
1959 HBufC8* image = LoadFileLC( path ); |
|
1960 iSoftNotification->SetImageL( *image ); |
|
1961 //iSoftNotification->SetImagePathL( *image ); |
|
1962 CleanupStack::PopAndDestroy( image ); |
|
1963 } |
|
1964 } |
|
1965 |
|
1966 |
|
1967 iSoftNotification->SetTextL( *text, *text ); |
|
1968 |
|
1969 iSoftNotification->ShowSoftNotificationL(); |
|
1970 FLOG("[bgchecker] LaunchSoftNotificationL 1"); |
|
1971 CleanupStack::PopAndDestroy( 3 ); //text, sk1, sk2 |
|
1972 } |
|
1973 */ |
|
1974 |
|
1975 |
|
1976 // ---------------------------------------------------------- |
|
1977 // CIAUpdateBGTimer::GetPrivatePathL() |
|
1978 // ---------------------------------------------------------- |
|
1979 TInt CIAUpdateBGTimer::GetPrivatePathL( TFileName& aPath ) |
|
1980 { |
|
1981 RFs fsSession; |
|
1982 User::LeaveIfError( fsSession.Connect() ); |
|
1983 CleanupClosePushL( fsSession ); |
|
1984 |
|
1985 // This will set the correct drive and private path |
|
1986 // for the file server session. |
|
1987 TInt err = KErrNone; |
|
1988 TRAP( err, SetPrivateDriveL( fsSession, KImageFile ) ); |
|
1989 |
|
1990 if ( err != KErrNone ) |
|
1991 { |
|
1992 CleanupStack::PopAndDestroy( &fsSession ); |
|
1993 return err; |
|
1994 } |
|
1995 |
|
1996 err = fsSession.SessionPath( aPath ); |
|
1997 aPath.Append( KImageFile ); |
|
1998 |
|
1999 CleanupStack::PopAndDestroy( &fsSession ); |
|
2000 return err; |
|
2001 } |
|
2002 |
|
2003 /* |
|
2004 // ---------------------------------------------------------- |
|
2005 // CIAUpdateBGTimer::LoadFileLC() |
|
2006 // ---------------------------------------------------------- |
|
2007 HBufC8* CIAUpdateBGTimer::LoadFileLC(const TDesC& aFile) |
|
2008 { |
|
2009 RFs fs; |
|
2010 User::LeaveIfError( fs.Connect() ); |
|
2011 CleanupClosePushL( fs ); |
|
2012 RFile file; |
|
2013 User::LeaveIfError(file.Open(fs, aFile, EFileRead)); |
|
2014 CleanupClosePushL(file); |
|
2015 TInt size; |
|
2016 User::LeaveIfError(file.Size(size)); |
|
2017 HBufC8* imagebuf = HBufC8::NewL(size); |
|
2018 TPtr8 imageptr(imagebuf->Des()); |
|
2019 file.Read(imageptr); |
|
2020 CleanupStack::PopAndDestroy( &file ); |
|
2021 CleanupStack::PopAndDestroy( &fs ); |
|
2022 CleanupDeletePushL(imagebuf); |
|
2023 return imagebuf; |
|
2024 } |
|
2025 */ |
|
2026 |
|
2027 // ---------------------------------------------------------- |
|
2028 // CIAUpdateBGTimer::SetPrivateDriveL() |
|
2029 // ---------------------------------------------------------- |
|
2030 void CIAUpdateBGTimer::SetPrivateDriveL( |
|
2031 RFs& aFs, |
|
2032 const TDesC& aFileName ) const |
|
2033 { |
|
2034 // First try to find the file from the private directory |
|
2035 // of the drive where the process exists. |
|
2036 RProcess process; |
|
2037 |
|
2038 // Set the session private path according to |
|
2039 // the process file name drive. |
|
2040 TInt driveNum( |
|
2041 SetSessionPrivatePathL( aFs, process.FileName() ) ); |
|
2042 |
|
2043 // Get the session path that was set above. |
|
2044 TFileName sessionPath; |
|
2045 User::LeaveIfError( aFs.SessionPath( sessionPath ) ); |
|
2046 |
|
2047 // Use the file finder to check if the file actually exists |
|
2048 // in the given drive path. If it does not, the file finder |
|
2049 // will automatically check from other drives. So, here we |
|
2050 // should always find the file if any exists. |
|
2051 TFindFile finder( aFs ); |
|
2052 User::LeaveIfError( finder.FindByDir( aFileName, sessionPath ) ); |
|
2053 |
|
2054 // The drive may have changed if the file was not found from |
|
2055 // the first suggested drive. So, be sure to have the correct |
|
2056 // private path. |
|
2057 driveNum = SetSessionPrivatePathL( aFs, finder.File() ); |
|
2058 |
|
2059 // Use the drive info to check if the drive is ROM drive. |
|
2060 // We prefer non ROM drives. But, accept ROM if nothing else is |
|
2061 // available. |
|
2062 TDriveInfo info; |
|
2063 User::LeaveIfError( aFs.Drive( info, driveNum ) ); |
|
2064 TBool isRomDrive( info.iDriveAtt & KDriveAttRom ); |
|
2065 if ( !isRomDrive ) |
|
2066 { |
|
2067 // The current file is not in ROM drive so use that. |
|
2068 return; |
|
2069 } |
|
2070 |
|
2071 // Because previous finding was ROM file, try to find a non ROM file. |
|
2072 TInt findErrorCode( finder.Find() ); |
|
2073 if ( findErrorCode == KErrNotFound ) |
|
2074 { |
|
2075 // Because no new file is found, use the current settings. |
|
2076 return; |
|
2077 } |
|
2078 User::LeaveIfError( findErrorCode ); |
|
2079 |
|
2080 // Update the session path for the correct file. |
|
2081 SetSessionPrivatePathL( aFs, finder.File() ); |
|
2082 } |
|
2083 |
|
2084 |
|
2085 // ---------------------------------------------------------- |
|
2086 // CIAUpdateBGTimer::SetSessionPrivatePathL() |
|
2087 // ---------------------------------------------------------- |
|
2088 TInt CIAUpdateBGTimer::SetSessionPrivatePathL( |
|
2089 RFs& aFs, |
|
2090 const TDesC& aPath ) const |
|
2091 { |
|
2092 // Use the parser to get the drive information from the path. |
|
2093 TParsePtrC parser( aPath ); |
|
2094 |
|
2095 if ( !parser.DrivePresent() ) |
|
2096 { |
|
2097 User::Leave( KErrArgument ); |
|
2098 } |
|
2099 |
|
2100 // Drive check was passed above. |
|
2101 // So, drive information is safe to use. |
|
2102 const TDesC& drive( parser.Drive() ); |
|
2103 const TChar driveChar( drive[ 0 ] ); |
|
2104 TInt driveNum( EDriveA ); |
|
2105 User::LeaveIfError( |
|
2106 RFs::CharToDrive( driveChar, driveNum ) ); |
|
2107 |
|
2108 // Set the file drive to be file session private path drive. |
|
2109 User::LeaveIfError( aFs.SetSessionToPrivate( driveNum ) ); |
|
2110 |
|
2111 return driveNum; |
|
2112 } |
|
2113 |
|
2114 |
|
2115 // ---------------------------------------------------------- |
|
2116 // CIAUpdateBGTimer::ReadResourceLC() |
|
2117 // ---------------------------------------------------------- |
|
2118 /* HLa |
|
2119 HBufC* CIAUpdateBGTimer::ReadResourceLC( TInt aResourceId ) |
|
2120 { |
|
2121 TResourceReader reader; |
|
2122 HBufC8* buff = iResourceFile.AllocReadLC( aResourceId ); |
|
2123 reader.SetBuffer( buff ); |
|
2124 HBufC* text = reader.ReadHBufCL(); |
|
2125 CleanupStack::PopAndDestroy( buff ); |
|
2126 CleanupStack::PushL( text ); |
|
2127 return text; |
|
2128 } */ |
|
2129 |
|
2130 |
1397 |
2131 // ---------------------------------------------------------- |
1398 // ---------------------------------------------------------- |
2132 // CIAUpdateBGTimer::IsAutoUpdateDisabledL() |
1399 // CIAUpdateBGTimer::IsAutoUpdateDisabledL() |
2133 // ---------------------------------------------------------- |
1400 // ---------------------------------------------------------- |
2134 TBool CIAUpdateBGTimer::IsAutoUpdateDisabledL() |
1401 TBool CIAUpdateBGTimer::IsAutoUpdateDisabledL() |