--- a/iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp Tue Aug 31 15:21:33 2010 +0300
+++ b/iaupdate/IAD/backgroundchecker/src/iaupdatebgrefreshtimer.cpp Wed Sep 01 12:22:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -25,12 +25,15 @@
#include <apgwgnam.h>
#include <apgcli.h>
#include <apacmdln.h>
+#include <avkon.hrh>
+#include <StringLoader.h>
+#include <iaupdate.rsg>
+#include <data_caging_path_literals.hrh>
#include <bautils.h>
#include <apgtask.h>
#include <sysversioninfo.h> //sysversioninfo
#include <featurecontrol.h>
-#include <hb/hbcore/hbtextresolversymbian.h>
#include "iaupdateprivatecrkeys.h"
#include "iaupdate.hrh"
@@ -42,7 +45,9 @@
//MACROS
_LIT8( KRefreshFromNetworkDenied, "1" );
+_LIT(KIAUpdateResourceFile, "iaupdate.rsc");
_LIT(KIAUpdateLauncherExe, "iaupdatelauncher.exe" );
+//_LIT(KImageFile, "qgn_note_swupdate_notification.svg");
//CONSTANTS
const TUint KIADUpdateLauncherUid( 0x2001FE2F );
@@ -68,6 +73,7 @@
CTimer::ConstructL();
CActiveScheduler::Add( this );
+ iReminderTimer = CIAUpdateBGReminderTimer::NewL( this );
iUpdate = NULL;
iParameters = NULL;
@@ -78,20 +84,26 @@
iInternalFile = CIAUpdateBGInternalFileHandler::NewL();
- iSoftNotification = CIAUpdateBGSoftNotification::NewL( this );
-
- iIndicatorNotifyHandler = CIAUpdateBGNotifyHandler::NewL();
+ iSoftNotification = CIAUpdateBGSoftNotification::NewL( this, iInternalFile );
+ iSoftNotification->StartObservingIfNeededL();
- // loc: initialize localisation text loader
- /*
- TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
- if ( res != KErrNone )
- {
- // nothing to do
- }
- */
+ // Get resource file path
+ TFileName fileName;
+ fileName.Copy(TParsePtrC(RProcess().FileName()).Drive());
+ fileName.Append(KDC_APP_RESOURCE_DIR);
+ fileName.Append(KIAUpdateResourceFile);
+
+ User::LeaveIfError(iFs.Connect());
+
+ // Get language of resource file
+ BaflUtils::NearestLanguageFile( iFs, fileName );
+
+ // Open resource file
+ iResourceFile.OpenL( iFs, fileName );
+ iResourceFile.ConfirmSignatureL();
}
+
// ----------------------------------------------------------
// CIAUpdateBGTimer::~CIAUpdateBGTimer()
// ----------------------------------------------------------
@@ -100,6 +112,7 @@
Cancel();
delete iUpdate;
delete iParameters;
+ delete iReminderTimer;
if ( iNotifyHandler )
{
@@ -111,37 +124,26 @@
delete iControllerFile;
delete iInternalFile;
delete iSoftNotification;
- delete iIndicatorNotifyHandler;
+ iResourceFile.Close();
+ iFs.Close();
}
+
// ----------------------------------------------------------
// CIAUpdateBGTimer::StartProcessL()
// ----------------------------------------------------------
void CIAUpdateBGTimer::StartProcessL()
{
FLOG("[bgchecker] StartProcessL");
-
- // start listening indicator remove
- iIndicatorNotifyHandler->StartListeningL( this );
-
-
+
iMode = ModeL();
switch ( iMode )
{
case EFirstTimeMode:
+ case EFirstTimeRemindMode:
{
- // while not released keep in sleep mode
- int test = 0;
- if ( test == 0 )
- {
- ListenAutoUpdateSettingsL();
- iMode = ESleepMode;
- SetModeL( iMode );
- return;
- }
-
if ( IsFirstTimeDialogDisabledL() )
{
//this should only happen in testing
@@ -169,6 +171,9 @@
FLOG("[bgchecker] StartProcessL EFirstTimeMode");
+
+
+
//Wait for some days before activate the first time mode
TTimeIntervalMinutes timetowait =
TimeIntervalFromNextShowOfNewFeatureDialogL();
@@ -215,7 +220,14 @@
case EFirstTimeMode2:
{
- FLOG("[bgchecker] StartProcessL EFirstTimeMode 2");
+ FLOG("[bgchecker] StartProcessL EFirstTimeMode2");
+ RunL();
+ break;
+ }
+
+ case EFirstTimeMode3:
+ {
+ FLOG("[bgchecker] StartProcessL EFirstTimeMode 3");
//if user accepted the disclaimer already and reboot the phone,
//this mode could go to network immediately after boot
//We put one min delay here to wait for network ready.
@@ -238,39 +250,13 @@
}
iNotifyHandler->StartListeningL();
-
-
- if ( !IsAgreementAcceptedL() )
- {
- FLOG("[bgchecker] EFirstTimeMode4 ShowIndicator");
- // Set number of updates; zero for first case
- iSoftNotification->SetNrOfUpdates( 0 );
-
- // do not show indicator when testing
- int test = 0;
- if ( test == 1)
- iSoftNotification->ShowIndicatorL();
-
- }
-
-
break;
}
case ENormalMode:
case ERetryMode:
{
-
- // Should indicator be shown ?
- TInt entries = NrOfIndicatorEntries();
- if ( entries )
- {
- iSoftNotification->SetNrOfUpdates( entries );
- iSoftNotification->ShowIndicatorL();
- }
-
StartUpdatesCheckingL();
-
break;
}
@@ -297,6 +283,19 @@
// ----------------------------------------------------------
+// CIAUpdateBGTimer::IsAskedAlreadyL()
+// ----------------------------------------------------------
+TBool CIAUpdateBGTimer::IsAskedAlreadyL()
+ {
+ CIAUpdateBGFirstTimeHandler* fthandler = CIAUpdateBGFirstTimeHandler::NewL();
+ CleanupStack::PushL( fthandler );
+ TBool result = fthandler->AgreementAskedL();
+ CleanupStack::PopAndDestroy( fthandler );
+ return result;
+ }
+
+
+// ----------------------------------------------------------
// CIAUpdateBGTimer::StartUpdatesCheckingL()
// ----------------------------------------------------------
void CIAUpdateBGTimer::StartUpdatesCheckingL()
@@ -332,7 +331,36 @@
FLOG_NUM( "Start checking update after %d minutes", timetowait.Int());
StartL( timetowait );
- }
+ //start reminder timer also if user choose later before reboot
+ //check the value from private folder
+
+ if ( ReminderOnL() )
+ {
+ TTime currenttime;
+ currenttime.UniversalTime();
+
+ FTIME( currenttime );
+
+ TTime nextremindtime = NextRemindTimeL();
+
+ FTIME( nextremindtime );
+
+ TTimeIntervalMinutes timetogo;
+ nextremindtime.MinutesFrom( currenttime, timetogo );
+
+ FLOG_NUM("time to go = %d", timetogo.Int() );
+
+ if ( timetogo.Int() <= 0 )
+ {
+ //pop up the reminder directly
+ ReminderTimerCallBack();
+ }
+ else
+ {
+ iReminderTimer->StartReminderTimerL( timetogo );
+ }
+ }
+ }
}
@@ -457,6 +485,49 @@
return err;
}
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::NextRemindTimeL()
+// ----------------------------------------------------------
+TTime CIAUpdateBGTimer::NextRemindTimeL()
+ {
+ iInternalFile->ReadControllerDataL();
+ return iInternalFile->NextRemindTime();
+ }
+
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::SetNextRemindTimeL()
+// ----------------------------------------------------------
+TInt CIAUpdateBGTimer::SetNextRemindTimeL( TTime aTime )
+ {
+ iInternalFile->SetNextRemindTime( aTime );
+ TRAPD( err,iInternalFile->WriteControllerDataL() );
+ return err;
+ }
+
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::ReminderOnL()
+// ----------------------------------------------------------
+TBool CIAUpdateBGTimer::ReminderOnL()
+ {
+ iInternalFile->ReadControllerDataL();
+ return iInternalFile->ReminderOn();
+ }
+
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::SetReminderL()
+// ----------------------------------------------------------
+TInt CIAUpdateBGTimer::SetReminderL( TBool aOn )
+ {
+ iInternalFile->SetReminder( aOn );
+ TRAPD( err,iInternalFile->WriteControllerDataL() );
+ return err;
+ }
+
+
// ----------------------------------------------------------
// CIAUpdateBGTimer::ModeL()
// ----------------------------------------------------------
@@ -477,25 +548,6 @@
return err;
}
-// ----------------------------------------------------------
-// CIAUpdateBGTimer::NrOfIndicatorEntries()
-// ----------------------------------------------------------
-TInt CIAUpdateBGTimer::NrOfIndicatorEntries()
- {
- iInternalFile->ReadControllerDataL();
- return iInternalFile->NrOfIndicatorEntries();
- }
-
-
-// ----------------------------------------------------------
-// CIAUpdateBGTimer::SetNrOfIndicatorEntriesL()
-// ----------------------------------------------------------
-TInt CIAUpdateBGTimer::SetNrOfIndicatorEntriesL( TInt aEntries )
- {
- iInternalFile->SetNrOfIndicatorEntries( aEntries );
- TRAPD( err,iInternalFile->WriteControllerDataL() );
- return err;
- }
// ----------------------------------------------------------
// CIAUpdateBGTimer::RetryTimesL()
@@ -533,6 +585,15 @@
void CIAUpdateBGTimer::DoUpdatesCheckingL( const TBool& aUpdateFromServer )
{
FLOG( "DoUpdatesCheckingL update");
+ //turn off the reminder, user will decide whether to turn if on or off
+ //The user's decision will be checked in soft notification callback function
+
+ if ( ReminderOnL())
+ {
+ FLOG( "Do CheckUpdates 3");
+ iReminderTimer->CancelReminderTimerL();
+ SetReminderL( EFalse );
+ }
if( !iUpdate )
{
@@ -583,15 +644,6 @@
{
FLOG_NUM( "CheckUpdatesComplete aErrorCode = %d", aErrorCode );
FLOG_NUM( "CheckUpdatesComplete aAvailableUpdates = %d", aAvailableUpdates );
-
- //HLa
- int test = 0;
- if ( test == 0 )
- {
- aErrorCode = 0;
- aAvailableUpdates = 0;
- }
-
if ( !IAUpdateEnabledL() )
{
Shutdown();
@@ -636,7 +688,8 @@
{
FLOG( "CheckUpdatesComplete 4");
- LaunchNotificationL( aAvailableUpdates );
+ LaunchSoftNotificationL(R_IAUPDATE_UPDATE_AVAILABLE,
+ R_TEXT_SOFTKEY_SHOW, R_TEXT_SOFTKEY_LATER );
}
FLOG( "CheckUpdatesComplete 5");
@@ -683,6 +736,19 @@
StartL( interval );
SetLastRefreshTime();
}
+ else
+ {
+ //don't show soft notification and restart the timer.
+ TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() );
+ TTime currenttime;
+ currenttime.UniversalTime();
+ TTime nextRemindTime = currenttime + oneweek;
+
+ SetReminderL( ETrue );
+ SetNextRemindTimeL( nextRemindTime );
+
+ iReminderTimer->StartReminderTimerL( oneweek );
+ }
//clear the retry time
SetRetryTimesL( 0 );
}
@@ -827,6 +893,7 @@
break;
case EFirstTimeMode:
+ case EFirstTimeRemindMode:
{
FLOG("[bgchecker] runl EFirstTimeMode");
@@ -854,7 +921,14 @@
case EFirstTimeMode2:
{
- FLOG("[bgchecker] runl EFirstTimeMode2");
+ FLOG("[bgchecker] runl EFirstTimeMode2");
+ LaunchSoftNotificationL(R_IAUPDATE_REMIND_LATER, R_TEXT_SOFTKEY_YES, R_TEXT_SOFTKEY_NO );
+ }
+ break;
+
+ case EFirstTimeMode3:
+ {
+ FLOG("[bgchecker] runl EFirstTimeMode3");
//disclaimer is not accepted
if ( !IsAgreementAcceptedL() )
@@ -910,7 +984,8 @@
{
//this is first time mode
FLOG("[bgchecker]HandlerFirstTimeL 3 ");
- LaunchNotificationL( 0 );
+ LaunchSoftNotificationL( R_IAUPDATE_FEATURES_AVAILABLE,
+ R_TEXT_SOFTKEY_OK, R_TEXT_SOFTKEY_CANCEL );
}
}
@@ -1177,6 +1252,11 @@
FLOG(" current mode is FirstTimeMode ");
interval = FirstTimeDialogDelayInMinutesL();
}
+ else if ( ModeL() == EFirstTimeRemindMode )
+ {
+ FLOG(" current mode is FirstTimeRemindMode");
+ interval = FirstTimeDialogReminderIntervalInMinutesL();
+ }
else
{
//nothing
@@ -1210,19 +1290,16 @@
switch ( iMode )
{
case EFirstTimeMode:
+ case EFirstTimeRemindMode:
{
FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode");
if ( !aIsAccepted )
{
- FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode, not accepted");
- //in sleep mode now
- iMode = ESleepMode;
+ FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode not accepted");
+ iMode = EFirstTimeMode2;
SetModeL( iMode );
-
- //subscribe to cenrep key for automatic checking for wake up from sleep mode
- ListenAutoUpdateSettingsL();
-
+ StartL( StartNow );
}
else
{
@@ -1232,7 +1309,7 @@
//check the disclaimer acceptance and automatic checking setting in 10mins
StartL( KDelayForUserToAcceptDisclaimer );
- iMode = EFirstTimeMode2;
+ iMode = EFirstTimeMode3;
SetModeL( iMode );
@@ -1242,19 +1319,64 @@
break;
}
+
+
+ case EFirstTimeMode2:
+ {
+ FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2 ");
+ if ( aIsAccepted )
+ {
+ FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, accepted");
+ //user wants to be reminder so remind in 4 weeks
+ //set to first time remind mode
+ iMode = EFirstTimeRemindMode;
+ SetModeL( iMode );
+ TTimeIntervalMinutes fourweeks( FirstTimeDialogReminderIntervalInMinutesL() );
+ TTime currenttime;
+ currenttime.UniversalTime();
+
+ //save the next show new feature dialog time
+ //in case use switch off the device and restarted.
+ User::LeaveIfError( SetLastTimeShowNewFeatureDialogL( currenttime ) );
+
+ StartL( fourweeks );
+ return;
+ }
+ else
+ {
+ FLOG("[bgchecker] SoftNotificationCallBack EFirstTimeMode2, not accepted");
+ //in sleep mode now
+ iMode = ESleepMode;
+ SetModeL( iMode );
+
+ //subscribe to cenrep key for automatic checking for wake up from sleep mode
+ ListenAutoUpdateSettingsL();
+ }
+ break;
+ }
+
case ENormalMode:
{
FLOG("[bgchecker] SoftNotificationCallBack ENormalMode");
if ( !aIsAccepted )
{
FLOG("[bgchecker] SoftNotificationCallBack ENormalMode not accpeted");
+ //user wants to be reminded later
+ TTimeIntervalMinutes oneweek( UpdateAvailableReminderIntervalInMinutesL() );
+ TTime currenttime;
+ currenttime.UniversalTime();
+ TTime nextRemindTime = currenttime + oneweek;
+
+ SetReminderL( ETrue );
+ SetNextRemindTimeL( nextRemindTime );
+ iReminderTimer->StartReminderTimerL( oneweek );
+
+ //the reminder call back function will be called when reminder timer expires.
}
else
{
- //accepted, clear indicator entries
- SetNrOfIndicatorEntriesL( 0 );
- // start IAD
+ //accepted, launch iad
StartIaupdateL();
}
break;
@@ -1289,110 +1411,81 @@
return iMode;
}
-// ----------------------------------------------------------
-// CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates )
-// ----------------------------------------------------------
-void CIAUpdateBGTimer::LaunchNotificationL( const int aNrOfUpdates )
- {
-
- _LIT( KFirstTimeText, "Update checking" );
- _LIT( KNormalText, "Updates available" );
- _LIT( KSecondText, "Tap to view" );
- // loc:
- /*
- _LIT( KIcon, "z:\\resource\\iaupdate\\qgn_note_swupdate_notification.svg" );
- _LIT(KLocFile, "Text_Map_Swupdate_");
- _LIT(KLocFilePath, "z:\\resource\\iaupdate\\");
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::DoReminderTimerCallBack()
+// ----------------------------------------------------------
+void CIAUpdateBGTimer::DoReminderTimerCallBackL()
+ {
+ FLOG("[bgchecker] ReminderTimerCallBack begin");
+ if ( !IAUpdateEnabledL() )
+ {
+ Shutdown();
+ return;
+ }
+ //Check the automatic update setting, if it has been disabled,
+ //then go to sleep mode.
+ if ( IsAutoUpdateDisabledL() )
+ {
+ FLOG("[bgchecker] ReminderTimerCallBack autoupdate is disabled, switch to sleep mode");
+ ListenAutoUpdateSettingsL();
+ iMode = ESleepMode;
+ SetModeL( iMode );
+ return;
+ }
+
+ TTimeIntervalMinutes timetowait = TimeIntervalFromNextRefreshL();
+
+ if ( timetowait.Int() <= KRefreshTimerReminderTimerGap )
+ {
+ FLOG("[bgchecker] ReminderTimerCallBack refresh is about to come in one day. We don't show reminder then");
+ return;
+ }
- _LIT(KTitleFirstTime, "txt_software_dpophead_update_checking");
- _LIT(KTitleOneUpdate, "txt_software_dpophead_update_available");
- _LIT(KTitleSeveralUpdates, "txt_software_dpophead_updates_available");
-
+ //if reminder is still on which means the BGTimer is not expired
+ //and checkupdate() is not called yet, then go ahead to call DoupdatesChecking
+ //this is to avoid DoUpdateChecking being called at the same time.
+
+ if ( ReminderOnL() )
+ {
+ FLOG("[bgchecker] ReminderTimerCallBack Reminder is still ON");
+ DoUpdatesCheckingL( EFalse );
+ }
+ FLOG("[bgchecker] ReminderTimerCallBack end");
+ }
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::ReminderTimerCallBack()
+// ----------------------------------------------------------
+void CIAUpdateBGTimer::ReminderTimerCallBack()
+ {
+ TRAP_IGNORE( DoReminderTimerCallBackL() );
+ }
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::LaunchSoftNotificationL()
+// ----------------------------------------------------------
+void CIAUpdateBGTimer::LaunchSoftNotificationL( const TInt& aResourceId, const TInt& SK1, const TInt& SK2 )
+ {
+ iInternalFile->ReadControllerDataL();
+ TInt snid = iInternalFile->SoftNotificationID();
+ if ( snid )
+ {
+ //there is a soft notification buffered, remove it
+ iSoftNotification->RemoveSoftNotificationL( snid );
+ }
- _LIT(KSecondFirstTime, "txt_software_dpopinfo_tap_to_view");
- _LIT(KSecondOneUpdate, "txt_software_dpopinfo_tap_to_view");
- _LIT(KSecondSeveralUpdates, "txt_software_dpopinfo_tap_to_view");
- */
+ FLOG("[bgchecker] LaunchSoftNotificationL ");
+ HBufC* text = ReadResourceLC( aResourceId );
+ HBufC* sk1 = ReadResourceLC( SK1 );
+ HBufC* sk2 = ReadResourceLC( SK2 );
- FLOG("[bgchecker] LaunchNotificationL ");
iMode = ModeL();
- // loc: initialize localisation text loader
- /*
- TBool res = HbTextResolverSymbian::Init(KLocFile, KLocFilePath);
- if ( res != KErrNone )
- {
- // nothing to do
- }
- */
-
-
- // loc: Resolve title text
- /*
- HBufC* titleText;
- if ( aNrOfUpdates == 0 )
- {
- // First time case
- titleText = HbTextResolverSymbian::LoadL( KTitleFirstTime );
- }
- else if ( aNrOfUpdates == 1 )
- {
- // one update available
- titleText = HbTextResolverSymbian::LoadL( KTitleOneUpdate );
- }
- else
- {
- // several updates available
- titleText = HbTextResolverSymbian::LoadL( KTitleSeveralUpdates );
- }
-
- // Resolve second text
- HBufC* secondText;
- if ( aNrOfUpdates == 0 )
- {
- // First time case
- secondText = HbTextResolverSymbian::LoadL( KSecondFirstTime );
- }
- else if ( aNrOfUpdates == 1 )
- {
- // one update available
- secondText = HbTextResolverSymbian::LoadL( KSecondOneUpdate, aNrOfUpdates );
- }
- else
- {
- // several updates available
- // loc: text.append(hbTrId("txt_software_dblist_updates_available"));
- secondText = HbTextResolverSymbian::LoadL( KSecondSeveralUpdates, aNrOfUpdates );
- }
- */
-
- // loc: Load title and second line
- // HBufC* titleText = HbTextResolverSymbian::LoadL(KTextTitle);
- // CleanupStack::PushL( titleText );
- // HBufC* secondText3 = HbTextResolverSymbian::LoadL(KTextSecond);
- // CleanupStack::PushL( titleText );
-
-
- TBuf<128> titleText;
- TBuf<128> secondText;
-
- //title text (normal/first time)
- if ( iMode == ENormalMode )
- {
- titleText.Append(KNormalText);
- }
- else
- {
- titleText.Append(KFirstTimeText);
- }
-
- //text for 2nd line
- secondText.Append(KSecondText);
-
- // icon
- /* HLa-->
+/*
+ // Commented out, so no icon is shown in the soft notification.
+ // Other functions, used by the code below, are also commented out.
if ( iMode == ENormalMode )
{
TFileName path;
@@ -1400,35 +1493,187 @@
if ( err == KErrNone )
{
- iSoftNotification->SetImagePathL( path );
- //HBufC8* image = LoadFileLC( path );
- //iSoftNotification->SetImageL( *image );
- //CleanupStack::PopAndDestroy( image );
+ HBufC8* image = LoadFileLC( path );
+ iSoftNotification->SetImageL( *image );
+ CleanupStack::PopAndDestroy( image );
}
}
- */
- // loc: set image path
- // iSoftNotification->SetImagePathL( KIcon );
+*/
- // Set texts
- // loc: iSoftNotification->SetTextL( titleText->Des(), secondText->Des() );
- iSoftNotification->SetTextL( titleText, secondText );
+
+ iSoftNotification->SetTextL( *text, *text );
+ iSoftNotification->SetSoftkeyLabelsL( *sk1, *sk2 );
+
+ iSoftNotification->ShowSoftNotificationL();
+ FLOG("[bgchecker] LaunchSoftNotificationL 1");
+ CleanupStack::PopAndDestroy( 3 ); //text, sk1, sk2
+ }
+
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::GetPrivatePathL()
+// ----------------------------------------------------------
+TInt CIAUpdateBGTimer::GetPrivatePathL( TFileName& /*aPath*/ )
+ {
+/*
+ RFs fsSession;
+ User::LeaveIfError( fsSession.Connect() );
+ CleanupClosePushL( fsSession );
+
+ // This will set the correct drive and private path
+ // for the file server session.
+ TInt err = KErrNone;
+ TRAP( err, SetPrivateDriveL( fsSession, KImageFile ) );
+
+ if ( err != KErrNone )
+ {
+ CleanupStack::PopAndDestroy( &fsSession );
+ return err;
+ }
+
+ err = fsSession.SessionPath( aPath );
+ aPath.Append( KImageFile );
- // loc: delete text buffers
- // CleanupStack::PopAndDestroy( titleText );
- // CleanupStack::PopAndDestroy( titleText );
-
- // Set number of updates for dialog and internal file
- iSoftNotification->SetNrOfUpdates( aNrOfUpdates );
- SetNrOfIndicatorEntriesL( aNrOfUpdates );
-
- iSoftNotification->ShowNotificationL();
- FLOG("[bgchecker] LaunchNotificationL 1");
-
- return;
+ CleanupStack::PopAndDestroy( &fsSession );
+ return err;
+*/
+ return 0;
}
// ----------------------------------------------------------
+// CIAUpdateBGTimer::LoadFileLC()
+// ----------------------------------------------------------
+ HBufC8* CIAUpdateBGTimer::LoadFileLC(const TDesC& /*aFile*/)
+ {
+/*
+ RFs fs;
+ User::LeaveIfError( fs.Connect() );
+ CleanupClosePushL( fs );
+ RFile file;
+ User::LeaveIfError(file.Open(fs, aFile, EFileRead));
+ CleanupClosePushL(file);
+ TInt size;
+ User::LeaveIfError(file.Size(size));
+ HBufC8* imagebuf = HBufC8::NewL(size);
+ TPtr8 imageptr(imagebuf->Des());
+ file.Read(imageptr);
+ CleanupStack::PopAndDestroy( &file );
+ CleanupStack::PopAndDestroy( &fs );
+ CleanupDeletePushL(imagebuf);
+ return imagebuf;
+*/
+ return NULL;
+ }
+
+
+ // ----------------------------------------------------------
+ // CIAUpdateBGTimer::SetPrivateDriveL()
+ // ----------------------------------------------------------
+ void CIAUpdateBGTimer::SetPrivateDriveL(
+ RFs& /*aFs*/,
+ const TDesC& /*aFileName*/ ) const
+ {
+/*
+ // First try to find the file from the private directory
+ // of the drive where the process exists.
+ RProcess process;
+
+ // Set the session private path according to
+ // the process file name drive.
+ TInt driveNum(
+ SetSessionPrivatePathL( aFs, process.FileName() ) );
+
+ // Get the session path that was set above.
+ TFileName sessionPath;
+ User::LeaveIfError( aFs.SessionPath( sessionPath ) );
+
+ // Use the file finder to check if the file actually exists
+ // in the given drive path. If it does not, the file finder
+ // will automatically check from other drives. So, here we
+ // should always find the file if any exists.
+ TFindFile finder( aFs );
+ User::LeaveIfError( finder.FindByDir( aFileName, sessionPath ) );
+
+ // The drive may have changed if the file was not found from
+ // the first suggested drive. So, be sure to have the correct
+ // private path.
+ driveNum = SetSessionPrivatePathL( aFs, finder.File() );
+
+ // Use the drive info to check if the drive is ROM drive.
+ // We prefer non ROM drives. But, accept ROM if nothing else is
+ // available.
+ TDriveInfo info;
+ User::LeaveIfError( aFs.Drive( info, driveNum ) );
+ TBool isRomDrive( info.iDriveAtt & KDriveAttRom );
+ if ( !isRomDrive )
+ {
+ // The current file is not in ROM drive so use that.
+ return;
+ }
+
+ // Because previous finding was ROM file, try to find a non ROM file.
+ TInt findErrorCode( finder.Find() );
+ if ( findErrorCode == KErrNotFound )
+ {
+ // Because no new file is found, use the current settings.
+ return;
+ }
+ User::LeaveIfError( findErrorCode );
+
+ // Update the session path for the correct file.
+ SetSessionPrivatePathL( aFs, finder.File() );
+*/
+ }
+
+
+ // ----------------------------------------------------------
+ // CIAUpdateBGTimer::SetSessionPrivatePathL()
+ // ----------------------------------------------------------
+ TInt CIAUpdateBGTimer::SetSessionPrivatePathL(
+ RFs& /*aFs*/,
+ const TDesC& /*aPath*/ ) const
+ {
+/*
+ // Use the parser to get the drive information from the path.
+ TParsePtrC parser( aPath );
+
+ if ( !parser.DrivePresent() )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // Drive check was passed above.
+ // So, drive information is safe to use.
+ const TDesC& drive( parser.Drive() );
+ const TChar driveChar( drive[ 0 ] );
+ TInt driveNum( EDriveA );
+ User::LeaveIfError(
+ RFs::CharToDrive( driveChar, driveNum ) );
+
+ // Set the file drive to be file session private path drive.
+ User::LeaveIfError( aFs.SetSessionToPrivate( driveNum ) );
+
+ return driveNum;
+*/
+ return 0;
+ }
+
+// ----------------------------------------------------------
+// CIAUpdateBGTimer::ReadResourceLC()
+// ----------------------------------------------------------
+HBufC* CIAUpdateBGTimer::ReadResourceLC( TInt aResourceId )
+ {
+ TResourceReader reader;
+ HBufC8* buff = iResourceFile.AllocReadLC( aResourceId );
+ reader.SetBuffer( buff );
+ HBufC* text = reader.ReadHBufCL();
+ CleanupStack::PopAndDestroy( buff );
+ CleanupStack::PushL( text );
+ return text;
+ }
+
+
+// ----------------------------------------------------------
// CIAUpdateBGTimer::IsAutoUpdateDisabledL()
// ----------------------------------------------------------
TBool CIAUpdateBGTimer::IsAutoUpdateDisabledL()
@@ -1555,8 +1800,8 @@
delete iUpdate;
iUpdate = NULL;
- //delete iReminderTimer;
- //iReminderTimer = NULL;
+ delete iReminderTimer;
+ iReminderTimer = NULL;
if ( iNotifyHandler )
{
@@ -1567,31 +1812,18 @@
if ( iSoftNotification )
{
+ TRAP_IGNORE( iSoftNotification->RemoveSoftNotificationL( iSoftNotification->Id() ) );
delete iSoftNotification;
iSoftNotification = NULL;
}
- if ( iIndicatorNotifyHandler )
- {
- delete iIndicatorNotifyHandler;
- iIndicatorNotifyHandler = NULL;
- }
-
CActiveScheduler::Stop();
FLOG("[bgchecker] Shutdown() end");
- }
-// ---------------------------------------------------------------------------
-// CIAUpdateBGTimer::HandleIndicatorRemoveL()
-// ---------------------------------------------------------------------------
-//
-void CIAUpdateBGTimer::HandleIndicatorRemoveL()
- {
- // remove indicator from indicator menu
- iSoftNotification->RemoveIndicatorL();
-
- //clear nr of indicator entries in internal file
- SetNrOfIndicatorEntriesL( 0 );
}
+
+
// End of file
+
+