smartinstaller/bootstrap/src/bootstrapappui.cpp
author Santosh V Patil <santosh.v.patil@nokia.com>
Fri, 19 Feb 2010 15:03:34 +0530
branchADM
changeset 14 343c622c9f65
permissions -rw-r--r--
Contribution of bootstrap component of the Nokia Smart Installer (beta)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     1
/*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     8
*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    11
*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    12
* Contributors:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    13
*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    14
* Description: 
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    15
*     CBootstrapAppUi class implementation.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    16
*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    17
*
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    18
*/
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    19
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    20
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    21
// INCLUDE FILES
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    22
#include <aknglobalnote.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    23
#include <stringloader.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    24
#include <swinstdefs.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    25
#include <swi/sisregistrysession.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    26
#include <swi/sisregistryentry.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    27
#include <swi/swispubsubdefs.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    28
#include <httpdownloadmgrcommon.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    29
#include <coeutils.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    30
#include <apgcli.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    31
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    32
#include <SenDomFragment.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    33
#include <SenXmlReader.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    34
#include <SenElement.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    35
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    36
#include <centralrepository.h>      // CRepository
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    37
#include <browseruisdkcrkeys.h>     // KCRUidBrowser
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    38
#include <httpdownloadmgrcommon.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    39
#include <es_enum.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    40
#include <rconnmon.h>
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    41
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    42
#include "bootstrapapplication.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    43
#include "bootstrapappui.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    44
#include "bootstrapconst.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    45
#include "bootstrapglobalwaitnoteobserver.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    46
#include "bootstrapinstallationobserver.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    47
#include "debug.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    48
#include "globals.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    49
#include "macros.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    50
#include "config.h"
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    51
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    52
// ADM binary name
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    53
_LIT(KAdmExePath, "ADM.exe");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    54
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    55
_LIT(KDownloadFolder,"?:\\ADM\\");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    56
// Sis file extension
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    57
_LIT(KSisExtn,".SIS");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    58
_LIT(KSisxExtn,".SISX");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    59
// Xml file extension
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    60
_LIT(KXMLExtn,".XML");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    61
// Dep file extension
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    62
_LIT(KDepExtn,"_DEP");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    63
// ADM changes file name
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    64
_LIT8(KAdmChangesFile, "adm_changes.xml");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    65
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    66
// Logging information
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    67
_LIT(KADMLogDir, "ADM");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    68
_LIT(KBootstrapLogFileName, "Bootstraplog.txt" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    69
_LIT(KBootstrapLogFile, "?:\\logs\\ADM\\Bootstraplog.txt");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    70
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    71
// Private folder of SWI Daemon
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    72
_LIT(KSWIDaemonPrivateFolder, "\\private\\10202dce\\");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    73
_LIT8(KForwardSlash, "/");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    74
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    75
// ADM Uid
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    76
const TUid KUidAdm = { 0x2002CCCE };
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    77
// Max no of connection attempts to Installer
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    78
const TInt KMaxInstallerConnectionAttempts = 6;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    79
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    80
// ============================ MEMBER FUNCTIONS ===============================
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    81
void CBootstrapAppUi::ConstructL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    82
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    83
	// Create the log
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    84
	INIT_DEBUG_LOG( KBootstrapLogFile(), KADMLogDir, KBootstrapLogFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    85
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    86
	// Hide from application task list
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    87
	HideApplicationFromFSW();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    88
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    89
	// Send us to background
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    90
	SendToBackgroundL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    91
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    92
	// Initialise app UI with standard value.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    93
	BaseConstructL( ENoScreenFurniture /* CAknAppUi::EAknEnableSkin */ );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    94
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    95
	StatusPane()->MakeVisible(EFalse);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    96
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    97
	// Wait for the installer to be free
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    98
	WaitForInstallCompleteL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    99
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   100
	// Bring us to foreground
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   101
	SendToBackgroundL(EFalse);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   102
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   103
	// Get the Uid of the latest installed package
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   104
	iWrapperPackageUid = GetLatestInstalledL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   105
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   106
	// Connect to the Download Manager
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   107
	TBool masterInstance( !iEikonEnv->StartedAsServerApp() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   108
	iDownloadManager.ConnectL( KUidBootstrapApp, *this, masterInstance );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   109
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   110
	// Read the config file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   111
	ReadConfigurationL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   112
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   113
	// Get the dep file and actual application name(if present)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   114
	TRAPD(err, SetFileNameInfoL());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   115
	if (err != KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   116
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   117
		ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   118
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   119
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   120
#ifdef FEATURE_BOOTSTRAP_SETIAP
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   121
	SetIAPL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   122
#endif
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   123
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   124
	ShowGlobalWaitNoteL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   125
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   126
	// Create view object
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   127
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   128
	User::LeaveIfError(iLauncher.Connect());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   129
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   130
	LOG("Checking ADM presence in the device");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   131
	iIsAdmInstalled = IsPackagePresentL(KUidAdm, iAdmInstalledVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   132
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   133
	LOG( "* State changed to EChangesDownloadState" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   134
	iAppState = EChangesDownloadState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   135
	DownloadL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   136
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   137
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   138
// -----------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   139
// CBootstrapAppUi::CBootstrapAppUi()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   140
// C++ default constructor can NOT contain any code, that might leave.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   141
// -----------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   142
//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   143
CBootstrapAppUi::CBootstrapAppUi():
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   144
						iAllowForeground(EFalse),
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   145
						iIsAdmInstalled(EFalse),
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   146
						iAdmChangesInfo()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   147
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   148
	LOG ( "SmartInstaller starts");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   149
	// disable possible transition effects
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   150
	SetFullScreenApp(EFalse);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   151
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   152
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   153
// -----------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   154
// CBootstrapAppUi::~CBootstrapAppUi()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   155
// Destructor.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   156
// -----------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   157
//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   158
CBootstrapAppUi::~CBootstrapAppUi()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   159
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   160
	LOG( "Bootstrap App ends");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   161
	DELETE_IF_NONNULL( iDepFilename );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   162
	DELETE_IF_NONNULL( iSisFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   163
	delete iGlobalWaitNoteObserver;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   164
	delete iGlobalWaitNote;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   165
	delete iInstallObsrv;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   166
	delete iConfigUrl;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   167
	delete iUrl;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   168
	delete iDownloadFileName;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   169
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   170
	iDownloadManager.DeleteAll();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   171
	iDownloadManager.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   172
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   173
	iLauncher.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   174
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   175
	CLOSE_DEBUG_LOG;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   176
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   177
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   178
void CBootstrapAppUi::HandleGlobalWaitNoteCancel(const TInt& aStatus)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   179
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   180
	LOG3( "+ Cancel note %d, %d", iAppState, aStatus );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   181
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   182
	// Do the cleanup based on the state
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   183
	if (aStatus == -1)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   184
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   185
		iGlobalWaitNoteId = -1;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   186
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   187
		switch(iAppState)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   188
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   189
			case EInitialState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   190
				// No CleanUp required here
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   191
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   192
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   193
			case EChangesDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   194
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   195
				// Cancel download
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   196
				iDownloadManager.ResetAll();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   197
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   198
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   199
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   200
			case EChangesParseState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   201
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   202
				// Delete the downloaded dep file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   203
				if (iDownloadFileName)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   204
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   205
					DeleteFile(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   206
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   207
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   208
				// fall-through
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   209
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   210
			case EADMDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   211
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   212
				// Cancel download
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   213
				iDownloadManager.ResetAll();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   214
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   215
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   216
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   217
			case EADMInstallState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   218
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   219
				// Cancel installation
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   220
				iLauncher.CancelAsyncRequest(SwiUI::ERequestSilentInstall);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   221
				// Delete the downloaded sis file.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   222
				if (iDownloadFileName)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   223
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   224
					DeleteFile(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   225
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   226
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   227
				// fall-through
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   228
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   229
			case EADMLaunchState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   230
				// No CleanUp required here
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   231
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   232
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   233
			default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   234
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   235
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   236
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   237
		TRAP_IGNORE(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   238
			ShowNoteL(EAknGlobalErrorNote, R_INSTALLATION_CANCELLED);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   239
		);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   240
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   241
		// Always delete the dep file in case of failure in
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   242
		// bootstrap to ensure correct dep file is picked up
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   243
		// when the outer package is installed.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   244
		if((KBootstrapVersion == 3)&&(iDepFilename))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   245
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   246
			DeleteFile(*iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   247
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   248
		else if((KBootstrapVersion == 4)&&(iSisFileName))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   249
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   250
			DeleteFile(*iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   251
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   252
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   253
		// Close the bootstrap application
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   254
		CloseApp();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   255
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   256
	LOG3( "- Cancel note %d, %d", iAppState, aStatus );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   257
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   258
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   259
void CBootstrapAppUi::ParseChangesInfoL( const TDesC& aChangesFileName )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   260
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   261
	LOG2("+ Parse File ('%S')", &aChangesFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   262
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   263
	// Initailize the parser
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   264
	CSenXmlReader* XmlReader = CSenXmlReader::NewLC(EErrorOnUnrecognisedTags);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   265
	CSenDomFragment* DomFragment = CSenDomFragment::NewL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   266
	CleanupStack::PushL(DomFragment);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   267
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   268
	XmlReader->SetContentHandler(*DomFragment);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   269
	DomFragment->SetReader(*XmlReader);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   270
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   271
	// Parse the provided changes file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   272
	XmlReader->ParseL(CEikonEnv::Static()->FsSession(), aChangesFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   273
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   274
	// Get package version
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   275
	CSenElement* packageElement;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   276
	packageElement = DomFragment->AsElement().Element(KFieldVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   277
	if (packageElement == NULL)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   278
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   279
		User::Leave(EMissingVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   280
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   281
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   282
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   283
		TPtrC8 versionPtr = packageElement->Content();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   284
		TVersion ver;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   285
		if (SetVersion(versionPtr, iAdmChangesInfo.iVersion) == EFalse)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   286
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   287
			User::Leave(EInvalidVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   288
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   289
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   290
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   291
	// Get the ADM sis file name
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   292
	packageElement = DomFragment->AsElement().Element(KFieldSisName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   293
	if (packageElement)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   294
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   295
		TPtrC8 sisNamePtr = packageElement->Content();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   296
		iAdmChangesInfo.iSisName = sisNamePtr.AllocL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   297
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   298
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   299
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   300
		User::Leave(EMissingSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   301
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   302
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   303
	//URL read from ADM changes file is disabled.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   304
	//ADM.sis will be fetched from the default config url always...same as ADM_changes.xml
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   305
#if 0
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   306
	// Get the optional URL
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   307
	packageElement = DomFragment->AsElement().Element(KFieldUrl);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   308
	if (packageElement)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   309
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   310
		TPtrC8 urlPtr = packageElement->Content();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   311
		iAdmChangesInfo.iUrl = urlPtr.AllocL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   312
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   313
#endif
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   314
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   315
	CleanupStack::PopAndDestroy( DomFragment ) ;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   316
	CleanupStack::PopAndDestroy( XmlReader ) ;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   317
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   318
	LOG( "- ParseChangesInfoL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   319
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   320
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   321
#ifdef FEATURE_BOOTSTRAP_SETIAP
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   322
void CBootstrapAppUi::SetIAPL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   323
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   324
	LOG( "+ CBootstrapAppUi::SetIAPL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   325
	// Use the browser default IAP, if available
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   326
	CRepository *repository = CRepository::NewLC( KCRUidBrowser );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   327
	TInt ret, browserIAP;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   328
	ret = repository->Get( KBrowserDefaultAccessPoint, browserIAP );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   329
	CleanupStack::PopAndDestroy( repository );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   330
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   331
	LOG3("Browser IAP ID = %d, ret = %d ", browserIAP, ret);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   332
	if ( ( ret != KErrNone ) || ( browserIAP < 0 ) )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   333
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   334
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   335
		browserIAP = 0;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   336
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   337
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   338
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   339
	//No Browser default IAP. Fetch from connection monitor
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   340
	RConnectionMonitor monitor;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   341
	CleanupClosePushL(monitor);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   342
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   343
	TUint count;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   344
	TRequestStatus status;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   345
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   346
	monitor.ConnectL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   347
	monitor.GetConnectionCount( count, status );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   348
	LOG2("ConnMon connCount = %d", count);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   349
	User::WaitForRequest( status );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   350
	if ( status.Int() != KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   351
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   352
		// error
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   353
		LOG2("ConnMon.ConnCount() ret = %d, ignoring.", status.Int() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   354
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   355
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   356
	// get all available IAPs
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   357
	TConnMonIapInfoBuf iapBuf;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   358
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   359
	monitor.GetPckgAttribute(  EBearerIdAll,  0, KIapAvailability, iapBuf, status );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   360
	User::WaitForRequest( status ) ;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   361
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   362
	if ( status.Int() != KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   363
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   364
			LOG2("ConnMon.GetAttr() ret = %d, ignoring.", ret);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   365
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   366
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   367
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   368
		TInt countIaps = iapBuf().iCount;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   369
		LOG2("IAP count %d", countIaps);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   370
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   371
		// Get the IAPId of the first IAP in the buffer.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   372
		iIAP = iapBuf().iIap[ 0 ].iIapId;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   373
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   374
		LOG2("IAP ID[0] is %d", iIAP);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   375
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   376
		//Now check whether any IAPId matches BrowserIAP, if yes then set the browserIAP as iIAP
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   377
		while( countIaps > 0)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   378
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   379
			LOG3("IAP %d: ID = %d", countIaps, iapBuf().iIap[ countIaps ].iIapId);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   380
			if( iapBuf().iIap[ countIaps ].iIapId == browserIAP)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   381
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   382
				iIAP = browserIAP;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   383
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   384
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   385
				countIaps--;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   386
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   387
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   388
			LOG2("IAP ID after comparison %d", iIAP);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   389
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   390
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   391
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   392
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   393
	if ( iIAP > 0)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   394
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   395
#ifdef DO_LOG
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   396
			TBuf<64> iapName;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   397
			monitor.GetStringAttribute( iIAP, 0, KIAPName, iapName, status );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   398
			User::WaitForRequest( status );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   399
			if ( status.Int() != KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   400
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   401
				LOG2( "ConnMon.GetStrAttr() ret = %d, ignoring.", status.Int() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   402
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   403
			LOG3( "Setting DownloadManager IAP to %d ('%S'). No user prompt for IAP.", iIAP, &iapName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   404
#endif
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   405
		// Set the download manager to silent mode
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   406
		iDownloadManager.SetBoolAttribute( EDlMgrSilentMode, ETrue );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   407
		iDownloadManager.SetIntAttribute( EDlMgrIap, iIAP );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   408
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   409
	//else implies user will be prompted.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   410
		CleanupStack::PopAndDestroy( &monitor );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   411
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   412
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   413
	LOG( "- CBootstrapAppUi::SetIAPL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   414
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   415
#endif
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   416
void CBootstrapAppUi::DownloadL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   417
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   418
	LOG2( "+ Download(): %d,", iAppState );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   419
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   420
	TPtrC8 filename(NULL,0);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   421
	HBufC8* Url = NULL;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   422
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   423
	// Set the download filename and Url based
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   424
	// on the state.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   425
	switch(iAppState)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   426
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   427
		case EChangesDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   428
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   429
			filename.Set(KAdmChangesFile);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   430
			Url = iConfigUrl;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   431
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   432
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   433
		case EADMDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   434
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   435
			User::LeaveIfNull(iAdmChangesInfo.iSisName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   436
			filename.Set((iAdmChangesInfo.iSisName)->Des());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   437
			// If the Url is not provided as part of the changes file,
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   438
			// take the default Url
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   439
			Url = (iAdmChangesInfo.iUrl==NULL) ?iConfigUrl :iAdmChangesInfo.iUrl;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   440
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   441
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   442
		default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   443
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   444
			LOG2( "! Unexpected state: %d", iAppState );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   445
			ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   446
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   447
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   448
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   449
	// Create the full URL for download
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   450
	DELETE_IF_NONNULL( iUrl);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   451
	iUrl = HBufC8::NewL(Url->Length() + filename.Length() + KForwardSlash().Length() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   452
	*iUrl = *Url;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   453
	TPtr8 ptr(iUrl->Des());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   454
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   455
	// Append forward slash if that's missing
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   456
	if (ptr.Right(1) != KForwardSlash)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   457
	   {
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   458
	   ptr.Append(KForwardSlash);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   459
	   }
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   460
	ptr.Append(filename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   461
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   462
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   463
	// Set download file name along with path
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   464
	TChar systemDrive;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   465
	RFs::DriveToChar(RFs::GetSystemDrive(),systemDrive);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   466
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   467
	DELETE_IF_NONNULL( iDownloadFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   468
	iDownloadFileName = HBufC::NewL(KDownloadFolder().Length() + filename.Length());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   469
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   470
	*iDownloadFileName = KDownloadFolder;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   471
	iDownloadFileName->Des()[0] = systemDrive;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   472
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   473
	TPtr responseFilenamePtr = iDownloadFileName->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   474
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   475
	HBufC* filename16 = HBufC::NewLC(filename.Length());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   476
	filename16->Des().Copy(filename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   477
	responseFilenamePtr.Append(*filename16);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   478
	CleanupStack::PopAndDestroy(filename16);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   479
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   480
	iPausable = EFalse;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   481
	iConnectionAttempts = 0;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   482
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   483
	// Create new download
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   484
	LOG8_2( "Downloading from URL: '%S'", iUrl );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   485
	LOG2(" Download begins for '%S'", iDownloadFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   486
	TBool isNewDl = ETrue;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   487
	RHttpDownload& dl = iDownloadManager.CreateDownloadL( *iUrl, isNewDl );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   488
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   489
	ConeUtils::EnsurePathExistsL(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   490
	if(isNewDl)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   491
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   492
			LOG2( "Response body filename is '%S'", iDownloadFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   493
			dl.SetStringAttribute( EDlAttrDestFilename, *iDownloadFileName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   494
			dl.Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   495
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   496
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   497
	LOG( "- Download()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   498
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   499
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   500
void CBootstrapAppUi::WaitForInstallCompleteL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   501
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   502
	LOG( "+ WaitForInstallCompleteL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   503
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   504
	// Use publish and subscribe mechanism to
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   505
	// get notified when installer is free.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   506
	RProperty installComplete;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   507
	User::LeaveIfError( installComplete.Attach(KUidSystemCategory, Swi::KUidSoftwareInstallKey) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   508
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   509
	TInt value;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   510
	if ( installComplete.Get( KUidSystemCategory, Swi::KUidSoftwareInstallKey, value ) == KErrNotFound )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   511
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   512
		LOG( "! Could not get installer" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   513
		installComplete.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   514
		ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   515
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   516
	else if ( (value & Swi::KSwisOperationMask) == Swi::ESwisNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   517
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   518
		// Installer is idle.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   519
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   520
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   521
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   522
		LOG( "Waiting for the Installer to finish installation" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   523
		TRequestStatus status;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   524
		installComplete.Subscribe(status);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   525
		User::WaitForRequest(status);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   526
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   527
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   528
	iAllowForeground = ETrue;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   529
	LOG( "Installer is idle" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   530
	installComplete.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   531
	LOG( "- WaitForInstallCompleteL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   532
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   533
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   534
TUint32 CBootstrapAppUi::GetLatestInstalledL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   535
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   536
	LOG( "+ GetLatestInstalledL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   537
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   538
	// Use publish and subscribe mechanism to
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   539
	// get Uid of the latest installed package.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   540
	RProperty lastInstall;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   541
	User::LeaveIfError(lastInstall.Attach(KUidSystemCategory, KUidSwiLatestInstallation));
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   542
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   543
	TInt value = -1;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   544
	if (lastInstall.Get( KUidSystemCategory, KUidSwiLatestInstallation, value ) == KErrNotFound)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   545
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   546
		LOG( "! Could not get installer" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   547
		ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   548
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   549
	LOG2( "- GetLatestInstalled(): wrapper=0x%08x", value );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   550
	return value;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   551
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   552
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   553
void CBootstrapAppUi::ShowGlobalWaitNoteL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   554
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   555
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   556
	// Allocate TBuf with constant length.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   557
	TBuf<KMaxMsgSize> text( NULL );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   558
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   559
	// Reads a resource into a descriptor.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   560
	CEikonEnv::Static()->ReadResource( text, R_ADM_ENV_CREATION_WAIT_TEXT );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   561
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   562
	// Create new CAknGlobalNote instance.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   563
	iGlobalWaitNote = CAknGlobalNote::NewL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   564
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   565
	iGlobalWaitNoteObserver = new (ELeave) CGlobalWaitNoteObserver(this);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   566
	iGlobalWaitNoteObserver->iStatus = KRequestPending;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   567
	iGlobalWaitNoteObserver->Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   568
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   569
	iGlobalWaitNoteId = iGlobalWaitNote->ShowNoteL(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   570
			iGlobalWaitNoteObserver->iStatus,
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   571
			EAknGlobalWaitNote,
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   572
			text );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   573
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   574
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   575
void CBootstrapAppUi::StopGlobalWaitNoteL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   576
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   577
	LOG2( "+ CBootstrapAppUi::StopGlobalWaitNoteL(): %d", iGlobalWaitNoteId );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   578
	if(iGlobalWaitNote && (iGlobalWaitNoteId >= 0))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   579
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   580
		iGlobalWaitNote->CancelNoteL(iGlobalWaitNoteId);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   581
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   582
	iGlobalWaitNoteId = -1;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   583
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   584
	DELETE_IF_NONNULL( iGlobalWaitNote         );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   585
	DELETE_IF_NONNULL( iGlobalWaitNoteObserver );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   586
	LOG( "- CBootstrapAppUi::StopGlobalWaitNoteL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   587
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   588
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   589
void CBootstrapAppUi::HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   590
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   591
	LOG3("+HandleDMgrEventL(): DlState=%d, ProgState=%d", aEvent.iDownloadState, aEvent.iProgressState);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   592
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   593
	TInt32                      tmp;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   594
	THttpDownloadMgrError       dlErrorId;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   595
	TInt32                      sysErrorId( KErrNone );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   596
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   597
	// If DL is in final state (complete/fail), there's an error id available.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   598
	// TODO: Handle error condition
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   599
	TInt sysErr = aDownload.GetIntAttribute( EDlAttrGlobalErrorId ,sysErrorId );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   600
	TInt dlErr = aDownload.GetIntAttribute( EDlAttrErrorId ,tmp );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   601
	dlErrorId = (THttpDownloadMgrError)tmp;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   602
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   603
	//TODO: Include Log5
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   604
	//LOG5( "SysErrId=%d, DlErrId=%d. DlSize=%d, CntSize=%d.", sysErrorId, dlErrorId, downloadedsize, contentsize );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   605
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   606
	switch ( aEvent.iDownloadState )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   607
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   608
		case EHttpDlCreated:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   609
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   610
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   611
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   612
		case EHttpDlInprogress:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   613
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   614
			switch ( aEvent.iProgressState)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   615
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   616
				case EHttpProgCreatingConnection:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   617
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   618
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   619
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   620
				case EHttpProgConnected:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   621
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   622
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   623
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   624
				case EHttpProgConnectionSuspended:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   625
				case EHttpProgDisconnected:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   626
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   627
					// Try to reconnect if:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   628
					// 1. No of connection attempts is less than KMaxDlConnectionAttempts
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   629
					// 2. IAP selection dialog is not cancelled.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   630
					if ((iConnectionAttempts < KMaxDlConnectionAttempts)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   631
					&& !(dlErrorId == EConnectionFailed && sysErrorId == KErrCancel))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   632
						{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   633
						++iConnectionAttempts;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   634
						LOG2("Restart attempt is '%d'",iConnectionAttempts);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   635
						aDownload.Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   636
						}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   637
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   638
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   639
				case EHttpProgDownloadStarted:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   640
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   641
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   642
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   643
				case EHttpContentTypeRequested:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   644
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   645
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   646
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   647
				case EHttpProgResponseHeaderReceived:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   648
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   649
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   650
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   651
				case EHttpProgResponseBodyReceived:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   652
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   653
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   654
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   655
				default :
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   656
					break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   657
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   658
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   659
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   660
		case EHttpDlPausable:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   661
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   662
			iPausable = ETrue;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   663
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   664
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   665
		case EHttpDlNonPausable:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   666
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   667
			iPausable = EFalse;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   668
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   669
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   670
		case EHttpDlCompleted:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   671
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   672
			iDownloadManager.GetIntAttribute( EDlMgrIap, iIAP );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   673
			LOG2("IAP set to %d", iIAP);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   674
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   675
			HandleHttpFetchCompleteL(EFalse);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   676
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   677
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   678
		case EHttpDlPaused:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   679
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   680
			if((dlErrorId == EConnectionFailed) && (sysErrorId == KErrCancel))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   681
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   682
				isIapCancelled = 1;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   683
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   684
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   685
			// Continue dowload if paused in EHttpContentTypeReceived
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   686
			if(aEvent.iProgressState == EHttpContentTypeReceived)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   687
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   688
				aDownload.Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   689
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   690
			// Try to reconnect if:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   691
			// 1. No of connection attempts is less than KMaxDlConnectionAttempts
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   692
			// 2. IAP selection dialog is not cancelled.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   693
			else if((iConnectionAttempts < KMaxDlConnectionAttempts)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   694
					&& (!isIapCancelled))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   695
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   696
				aDownload.Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   697
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   698
			else if(iPausable)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   699
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   700
				aDownload.Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   701
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   702
			else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   703
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   704
				HandleHttpFetchCompleteL(ETrue);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   705
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   706
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   707
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   708
		case EHttpDlFailed:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   709
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   710
			if((dlErrorId == EConnectionFailed) && (sysErrorId == KErrCancel))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   711
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   712
				isIapCancelled = 1;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   713
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   714
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   715
			HandleHttpFetchCompleteL(ETrue);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   716
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   717
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   718
		case EHttpDlDeleting:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   719
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   720
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   721
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   722
		case EHttpDlDeleted:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   723
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   724
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   725
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   726
		default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   727
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   728
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   729
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   730
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   731
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   732
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   733
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   734
void CBootstrapAppUi::HandleHttpFetchCompleteL(const TBool& aStatus)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   735
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   736
	LOG3( "+ Fetch(): s=%d, a=%d", aStatus, iAppState );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   737
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   738
	User::LeaveIfNull(iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   739
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   740
	if (aStatus == EFalse)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   741
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   742
		switch(iAppState)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   743
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   744
			case EChangesDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   745
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   746
				// Parse downloaded changes file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   747
				iAppState = EChangesParseState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   748
				LOG("* State changed to EChangesParseState");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   749
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   750
				TRAPD(err, ParseChangesInfoL(*iDownloadFileName));
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   751
				LOG2( "Changes file parsing completed with status: %d", err);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   752
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   753
				// Delete no longer required changes file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   754
				DeleteFile(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   755
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   756
				// 1. Install ADM if not already present
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   757
				// 2. Upgrade ADM if higher version is available
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   758
				// 3. If the upgrade fails, launch the current version
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   759
				//    of ADM in device.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   760
				TBool isAdmDownloadRequired = CompareVersions(iAdmInstalledVersion, iAdmChangesInfo.iVersion)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   761
												== EGreaterSecondVersion;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   762
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   763
				if ((err==KErrNone) && isAdmDownloadRequired)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   764
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   765
					LOG( "* Changing state to EADMDownloadState" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   766
					iAppState = EADMDownloadState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   767
					DownloadL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   768
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   769
				else if (iIsAdmInstalled)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   770
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   771
					LOG( "* Changing state to EADMLaunchState" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   772
					iAppState = EADMLaunchState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   773
					TRAPD( err, LaunchAdmL() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   774
					if (err != KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   775
						{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   776
						LOG2( "ADM launch fail %d", err );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   777
						ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   778
						}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   779
					LOG( "ADM launched OK, exiting! 1" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   780
					TRAP_IGNORE( StopGlobalWaitNoteL() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   781
					CloseApp();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   782
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   783
				else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   784
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   785
					// Adm changes file parse error
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   786
					ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   787
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   788
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   789
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   790
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   791
			case EADMDownloadState:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   792
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   793
				LOG2( "ADM downloaded OK: '%S'", iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   794
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   795
				iAppState = EADMInstallState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   796
				LOG( "* State changed to EADMInstallState" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   797
				AsyncInstallPackageL(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   798
				break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   799
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   800
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   801
			default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   802
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   803
				LOG2( "Unexpected state %d", iAppState );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   804
				// Unexpected State
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   805
				ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   806
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   807
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   808
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   809
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   810
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   811
		// Launch existing version of ADM (if present) in device
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   812
		// in case of download failure.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   813
		if (iIsAdmInstalled && (!isIapCancelled))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   814
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   815
			LOG( "* Changing state to EADMLaunchState" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   816
			iAppState = EADMLaunchState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   817
			TRAPD(err, LaunchAdmL());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   818
			if (err != KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   819
				 {
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   820
				 ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   821
				 }
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   822
			LOG( "ADM launched OK, exiting! 2" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   823
			TRAP_IGNORE( StopGlobalWaitNoteL() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   824
			CloseApp();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   825
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   826
		else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   827
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   828
			LOG( "! ADM download failed!" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   829
			ExitWithError(R_HTTP_TRANSACTION_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   830
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   831
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   832
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   833
	LOG( "- Fetch complete ");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   834
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   835
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   836
void CBootstrapAppUi::SetFileNameInfoL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   837
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   838
	LOG( "+ SetFileNameInfoL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   839
	LOG2( "Bootstrap version: %d", KBootstrapVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   840
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   841
	if(KBootstrapVersion<1 && KBootstrapVersion>4)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   842
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   843
		// Unsupported Bootstrap version
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   844
		User::Leave(KErrNotSupported);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   845
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   846
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   847
	// Connect to SisRegistry to fetch Package info
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   848
	Swi::RSisRegistrySession registrySession;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   849
	User::LeaveIfError(registrySession.Connect());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   850
	CleanupClosePushL(registrySession);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   851
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   852
	Swi::RSisRegistryEntry entry;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   853
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   854
	// Open registry entry
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   855
	User::LeaveIfError(entry.Open(registrySession, TUid::Uid(iWrapperPackageUid)));
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   856
	CleanupClosePushL(entry);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   857
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   858
	RPointerArray<HBufC> packageFiles;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   859
	entry.FilesL(packageFiles);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   860
	const TInt filesCount(packageFiles.Count());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   861
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   862
	// look into the files installed as part of the package,
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   863
	// to find the dep file name and actuall application file name.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   864
	for (TInt i=0; i<filesCount; i++)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   865
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   866
		TParse parse;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   867
		TInt err = parse.Set(packageFiles[i]->Des(), NULL, NULL);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   868
		if (err != KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   869
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   870
			continue;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   871
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   872
		TPtrC orgExtn = parse.Ext();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   873
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   874
		if (orgExtn.Length() == 0)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   875
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   876
			continue;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   877
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   878
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   879
		HBufC* extn = orgExtn.AllocLC();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   880
		TPtr extnPtr = extn->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   881
		extnPtr.UpperCase();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   882
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   883
		if(KBootstrapVersion != 3)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   884
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   885
			if ((extnPtr.Compare(KSisExtn) == 0)||(extnPtr.Compare(KSisxExtn) == 0))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   886
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   887
				TPtrC privatePath( KNullDesC );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   888
				const TInt driveLength = 2;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   889
				if (packageFiles[i]->Length() > (KSWIDaemonPrivateFolder().Length() + driveLength))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   890
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   891
					privatePath.Set( packageFiles[i]->Des().Mid( driveLength ) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   892
					privatePath.Set( privatePath.Left( KSWIDaemonPrivateFolder().Length() ) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   893
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   894
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   895
				// Ignore if its a Stub Sis file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   896
				if(privatePath.CompareF(KSWIDaemonPrivateFolder))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   897
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   898
					if (iSisFileName == NULL)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   899
						{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   900
						iSisFileName = packageFiles[i]->AllocL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   901
						LOG2( "Actual application name is '%S'", iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   902
						}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   903
					else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   904
						// More than one sis present in the Wrapper Pkg
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   905
						{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   906
					LOG2( "! More than one sis file present: '%S'. LEAVE.", packageFiles[i] );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   907
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   908
					User::Leave(KErrNotSupported);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   909
						}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   910
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   911
				}//end of sis extension
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   912
			}//end of Bootstrapversion 2
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   913
		if (KBootstrapVersion != 4)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   914
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   915
			if(extnPtr.Compare(KXMLExtn) == 0)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   916
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   917
				TPtrC orgName = parse.Name();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   918
				const TInt namelength = orgName.Length();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   919
				const TInt depSuffixlength = KDepExtn().Length();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   920
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   921
				if (namelength > depSuffixlength)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   922
					{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   923
					TPtrC depSuffix = orgName.Mid((namelength-depSuffixlength), depSuffixlength);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   924
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   925
					HBufC* name = depSuffix.AllocLC();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   926
					TPtr namePtr = name->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   927
					namePtr.UpperCase();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   928
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   929
					if (namePtr.Compare(KDepExtn) == 0)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   930
						{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   931
						if (iDepFilename == NULL)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   932
							{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   933
							iDepFilename = packageFiles[i]->AllocL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   934
							LOG2( "Dep file name is '%S'", iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   935
							}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   936
						else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   937
							// More than one dep file present in the Wrapper Pkg
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   938
							{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   939
							LOG2( "! More than one dep file present: '%S'. LEAVE.", packageFiles[i] );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   940
							User::Leave(KErrNotSupported);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   941
							}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   942
						}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   943
					CleanupStack::PopAndDestroy(name);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   944
					}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   945
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   946
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   947
		CleanupStack::PopAndDestroy(extn);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   948
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   949
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   950
	packageFiles.ResetAndDestroy();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   951
	packageFiles.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   952
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   953
	if(KBootstrapVersion != 3)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   954
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   955
		User::LeaveIfNull(iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   956
		if (!(ConeUtils::FileExists(*iSisFileName)))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   957
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   958
			User::Leave(KErrNotFound);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   959
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   960
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   961
	if(KBootstrapVersion != 4)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   962
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   963
		User::LeaveIfNull(iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   964
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   965
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   966
	CleanupStack::PopAndDestroy(&entry);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   967
	CleanupStack::PopAndDestroy(&registrySession);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   968
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   969
	LOG( "- SetFileNameInfoL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   970
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   971
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   972
TInt CBootstrapAppUi::LaunchAdmL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   973
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   974
	LOG( "+ LaunchAdmL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   975
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   976
	// In case of approach 3 , cleanup of only BootStrap
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   977
	// is required.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   978
	if (KBootstrapVersion == 3)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   979
	   {
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   980
	   iWrapperPackageUid = KUidBootstrapApp.iUid;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   981
	   }
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   982
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   983
#ifdef __USE_RAPA
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   984
	HBufC *processArgs = HBufC::NewLC(iDepFilename->Length() + iSisFileName->Length() + 10 + 3 + 2);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   985
	TPtr cmdLineParams = processArgs->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   986
	cmdLineParams.Append(iDepFilename->Des());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   987
	cmdLineParams.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   988
	cmdLineParams.Append(iSisFileName->Des());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   989
	cmdLineParams.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   990
	cmdLineParams.AppendNum(iWrapperPackageUid);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   991
	cmdLineParams.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   992
	cmdLineParams.AppendNum(iIAP);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   993
	HBufC *tmp = HBufC::NewLC( cmdLineParams.Length() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   994
	tmp->Des().Copy( cmdLineParams );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   995
	LOG2( "cmdLineParams '%S'", tmp );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   996
	CleanupStack::PopAndDestroy(tmp);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   997
	TApaAppInfo appInfo;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   998
	RProcess process;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
   999
	RApaLsSession appArcSession;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1000
	User::LeaveIfError( appArcSession.Connect() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1001
	LOG("RApaLsSession.Connect() OK");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1002
	CleanupClosePushL<RProcess>( process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1003
	CleanupClosePushL<RApaLsSession>( appArcSession );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1004
	User::LeaveIfError( appArcSession.GetAppInfo( appInfo, KUidAdm ) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1005
	LOG("RApaLsSession.GetAppInfo() OK");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1006
	TFileName appName = appInfo.iFullName;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1007
	LOG2("RApaLsSession: iFullName='%S'", &appName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1008
	User::LeaveIfError( process.Create( appName, processArgs->Des() ) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1009
	HBufC8 *tail = HBufC8::NewLC( processArgs->Length() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1010
	tail->Des().Copy(processArgs->Des());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1011
	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1012
	cmdLine->SetExecutableNameL( appName );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1013
	cmdLine->SetCommandL( EApaCommandBackground );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1014
	cmdLine->SetTailEndL( tail->Des() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1015
	cmdLine->SetProcessEnvironmentL( process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1016
	LOG("RApaLsSession: going to launch");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1017
	User::LeaveIfError( appArcSession.StartApp( *cmdLine ) );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1018
	process.Resume();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1019
	CleanupStack::PopAndDestroy( cmdLine );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1020
	CleanupStack::PopAndDestroy( tail );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1021
	CleanupStack::PopAndDestroy( &appArcSession );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1022
	CleanupStack::PopAndDestroy( &process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1023
	CleanupStack::PopAndDestroy( processArgs );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1024
	LOG("launch OK");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1025
#else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1026
	// Create ADM command line:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1027
	// adm.exe dependency_filename sis_filename uid_in_dec
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1028
	//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1029
	// Size of 32-bit Bootstrap Version Value is 10 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1030
	// Size of 32-bit UID when converted to numeric string is 10 characters (4294967295)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1031
	// Max size of iIAP(TInt) when converted to numeric string is 10 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1032
	// Size of 2 spaces is 2 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1033
	const TInt mandatoryOptionsLength = 10+ 10+ 10+ 2;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1034
	TBufC<mandatoryOptionsLength> mandatoryOptions;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1035
	TPtr mandatoryOptionsPtr = mandatoryOptions.Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1036
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1037
	mandatoryOptionsPtr.AppendNum(KBootstrapVersion);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1038
	mandatoryOptionsPtr.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1039
	mandatoryOptionsPtr.AppendNum(iWrapperPackageUid);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1040
	mandatoryOptionsPtr.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1041
	mandatoryOptionsPtr.AppendNum(iIAP);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1042
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1043
	HBufC *processArgs  = NULL;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1044
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1045
	switch (KBootstrapVersion)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1046
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1047
		case 1:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1048
		case 2:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1049
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1050
			User::LeaveIfNull(iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1051
			User::LeaveIfNull(iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1052
			// Size of 2 spaces is 2 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1053
			processArgs = HBufC::NewLC(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1054
								mandatoryOptionsLength +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1055
								iDepFilename->Length() +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1056
								iSisFileName->Length() +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1057
								2);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1058
			TPtr cmdLine = processArgs->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1059
			cmdLine.Append(mandatoryOptionsPtr);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1060
			cmdLine.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1061
			cmdLine.Append(*iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1062
			cmdLine.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1063
			cmdLine.Append(*iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1064
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1065
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1066
		case 3:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1067
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1068
			User::LeaveIfNull(iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1069
			// Size of 1 spaces is 1 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1070
			processArgs = HBufC::NewLC(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1071
								mandatoryOptionsLength +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1072
								iDepFilename->Length() +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1073
								1);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1074
			TPtr cmdLine = processArgs->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1075
			cmdLine.Append(mandatoryOptionsPtr);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1076
			cmdLine.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1077
			cmdLine.Append(*iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1078
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1079
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1080
		case 4:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1081
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1082
			User::LeaveIfNull(iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1083
			// Size of 1 spaces is 1 characters
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1084
			processArgs = HBufC::NewLC(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1085
								mandatoryOptionsLength +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1086
								iSisFileName->Length() +
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1087
								1);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1088
			TPtr cmdLine = processArgs->Des();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1089
			cmdLine.Append(mandatoryOptionsPtr);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1090
			cmdLine.Append(' ');
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1091
			cmdLine.Append(*iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1092
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1093
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1094
		default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1095
			// Unsupported Bootstrap Version
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1096
			ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1097
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1098
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1099
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1100
	// Launch ADM
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1101
	LOG3( "Launching %S '%S'", &KAdmExePath, processArgs);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1102
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1103
	RProcess process;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1104
	CleanupClosePushL<RProcess>( process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1105
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1106
	const TInt err = process.Create( KAdmExePath, processArgs->Des() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1107
	if (err != KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1108
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1109
		LOG2( "ADM launch failed with error: %d", err );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1110
		CleanupStack::PopAndDestroy( &process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1111
		CleanupStack::PopAndDestroy( processArgs );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1112
		ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1113
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1114
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1115
	process.SetPriority( EPriorityBackground );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1116
	process.Resume();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1117
#if 0
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1118
	const TInt type = process.ExitType();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1119
	const TInt reason = process.ExitReason();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1120
	TExitCategoryName cat = process.ExitCategory();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1121
	LOG4( "Exit type %d, reason %d, cat '%S'", type, reason, &cat);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1122
#endif
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1123
	CleanupStack::PopAndDestroy( &process );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1124
	CleanupStack::PopAndDestroy( processArgs );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1125
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1126
#endif // if __USE_RAPA
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1127
	LOG2( "- LaunchAdmL(): %d", err );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1128
	return KErrNone;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1129
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1130
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1131
void CBootstrapAppUi::AsyncInstallPackageL(const TDesC& aResponseFilename)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1132
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1133
	SwiUI::TInstallOptions Options;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1134
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1135
	Options.iUpgrade = SwiUI::EPolicyAllowed;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1136
	Options.iOCSP    = SwiUI::EPolicyNotAllowed;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1137
	Options.iDrive   = 'c';
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1138
	Options.iUntrusted = SwiUI::EPolicyNotAllowed;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1139
	Options.iCapabilities = SwiUI::EPolicyNotAllowed;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1140
	Options.iOverwrite = SwiUI::EPolicyAllowed;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1141
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1142
	iOptionsPckg = Options;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1143
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1144
	if (iInstallObsrv == NULL)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1145
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1146
		iInstallObsrv = new (ELeave) CInstallObserver(this);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1147
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1148
	iInstallObsrv->iStatus = KRequestPending;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1149
	iInstallObsrv->Start();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1150
	// Start asynchronous installation
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1151
	iLauncher.SilentInstall(iInstallObsrv->iStatus, aResponseFilename, iOptionsPckg);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1152
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1153
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1154
void CBootstrapAppUi::HandleInstallCompleteL(const TInt& aStatus)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1155
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1156
	LOG2("+ HandleInstallCompleteL(%d)", aStatus);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1157
	User::LeaveIfNull(iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1158
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1159
	// If the install server is busy , try connecting multiple times.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1160
	if (aStatus == SwiUI::KSWInstErrBusy && ((++iInstallAttempt) <= KMaxInstallerConnectionAttempts))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1161
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1162
		LOG2( "Retrying installation %d", aStatus );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1163
		AsyncInstallPackageL(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1164
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1165
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1166
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1167
		LOG2("ADM installation status: %d", aStatus);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1168
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1169
		LOG("Deleting ADM sis file");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1170
		// Delete no longer required sis file.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1171
		DeleteFile(*iDownloadFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1172
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1173
		if (aStatus == KErrNone || iIsAdmInstalled)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1174
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1175
			iAppState = EADMLaunchState;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1176
			TRAPD( err, LaunchAdmL() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1177
			if ( err != KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1178
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1179
				LOG2( "ADM launch failed %d", err );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1180
				ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1181
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1182
			LOG2( "ADM launched OK %d", err );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1183
			TRAP_IGNORE( StopGlobalWaitNoteL() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1184
			CloseApp();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1185
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1186
		else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1187
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1188
			ExitWithError(R_INSTALLATION_FAILURE_ERR);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1189
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1190
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1191
	LOG("- HandleInstallCompleteL()");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1192
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1193
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1194
TBool CBootstrapAppUi::IsPackagePresentL(const TUid& aUid, TVersion& aVersion)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1195
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1196
	LOG( "+ ADMPresent()");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1197
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1198
	// Connect to SisRegistry to find if the package is
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1199
	// already installed.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1200
	Swi::RSisRegistrySession registrySession;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1201
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1202
	User::LeaveIfError(registrySession.Connect());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1203
	CleanupClosePushL(registrySession);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1204
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1205
	const TBool isPkgInstalled = registrySession.IsInstalledL(aUid);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1206
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1207
	if (isPkgInstalled)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1208
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1209
		Swi::RSisRegistryEntry entry;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1210
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1211
		// Open registry entry
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1212
		User::LeaveIfError(entry.Open(registrySession, aUid));
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1213
		CleanupClosePushL(entry);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1214
		aVersion = entry.VersionL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1215
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1216
		CleanupStack::PopAndDestroy(&entry);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1217
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1218
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1219
	CleanupStack::PopAndDestroy(&registrySession);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1220
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1221
	LOG3( "- ADMPresent(): 0x%x = %d", aUid.iUid, isPkgInstalled );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1222
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1223
	return isPkgInstalled;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1224
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1225
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1226
void CBootstrapAppUi::DeleteFile(const TDesC& aFileName)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1227
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1228
	CCoeEnv::Static()->FsSession().Delete(aFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1229
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1230
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1231
void CBootstrapAppUi::ShowNoteL( const TAknGlobalNoteType& aType , const TInt& aResourceId )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1232
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1233
	// Allocate TBuf with constant length.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1234
	TBuf<KMaxMsgSize> text;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1235
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1236
	// Reads a resource into a descriptor.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1237
	CEikonEnv::Static()->ReadResource( text, aResourceId );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1238
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1239
	// Create new CAknGlobalNote instance.
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1240
	CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1241
	globalNote->ShowNoteL( aType , text );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1242
	CleanupStack::PopAndDestroy(globalNote);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1243
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1244
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1245
void CBootstrapAppUi::ExitWithError(const TInt& aResourceId )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1246
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1247
	LOG2( "+ ExitWithError(): 0x%08x", aResourceId );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1248
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1249
	// Display error message
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1250
	TRAP_IGNORE(
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1251
		StopGlobalWaitNoteL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1252
		ShowNoteL(EAknGlobalErrorNote, aResourceId);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1253
	);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1254
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1255
	// Delete the dep file is present
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1256
	if((KBootstrapVersion == 3)&&(iDepFilename))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1257
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1258
		DeleteFile(*iDepFilename);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1259
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1260
	else if((KBootstrapVersion == 4)&&(iSisFileName))
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1261
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1262
		DeleteFile(*iSisFileName);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1263
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1264
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1265
	RunAppShutter();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1266
	Exit();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1267
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1268
	LOG( "- ExitWithError()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1269
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1270
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1271
void CBootstrapAppUi::CloseApp()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1272
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1273
	LOG( "+ CloseApp()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1274
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1275
	RunAppShutter();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1276
	Exit();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1277
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1278
	LOG( "- CloseApp()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1279
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1280
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1281
void CBootstrapAppUi::HandleForegroundEventL(TBool aForeground)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1282
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1283
	LOG3("+ CBootstrapAppUi::HandleForegroundEventL(%d): allow=%d", aForeground, iAllowForeground);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1284
	CAknAppUi::HandleForegroundEventL(aForeground);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1285
	if (aForeground && !iAllowForeground)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1286
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1287
		SendToBackgroundL();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1288
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1289
	LOG("- CBootstrapAppUi::HandleForegroundEventL()" );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1290
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1291
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1292
// ---------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1293
//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1294
// ---------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1295
void CBootstrapAppUi::SendToBackgroundL(TBool aBackground)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1296
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1297
	LOG2( "+ SendToBackgroundL(%d)", aBackground );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1298
	// We have gained the focus
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1299
	RWsSession aWsSession;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1300
	User::LeaveIfError( aWsSession.Connect() );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1301
	TApaTask task(aWsSession);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1302
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1303
	// Initialise the object with the window group id of
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1304
	// our application (so that it represent our app)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1305
	task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1306
	if (aBackground)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1307
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1308
		task.SendToBackground();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1309
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1310
	else
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1311
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1312
		task.BringToForeground();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1313
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1314
	aWsSession.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1315
	LOG( "- SendToBackgroundL() ");
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1316
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1317
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1318
void CBootstrapAppUi::HandleCommandL(TInt aCommand)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1319
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1320
	switch (aCommand)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1321
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1322
		case EEikCmdExit:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1323
		case EAknSoftkeyExit:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1324
			Exit();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1325
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1326
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1327
		default:
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1328
			break;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1329
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1330
	}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1331
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1332
// ---------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1333
// CBootstrapAppUi::ReadConfigurationL
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1334
// Leaves if runs out of memory
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1335
//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1336
// @return KErrNone if configuration was read correctly, error code otherwise
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1337
// ---------------------------------------------------------------------------
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1338
//
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1339
TInt CBootstrapAppUi::ReadConfigurationL()
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1340
	{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1341
	TFileName configFile;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1342
	RArray< TPtrC > lineBuffer;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1343
	TInt ret( KErrNone );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1344
	RFs& rfs = CEikonEnv::Static()->FsSession();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1345
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1346
	// Find the configuration file from the private directory
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1347
	ret = rfs.PrivatePath(configFile);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1348
	if (ret == KErrNone)
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1349
		{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1350
		TBuf<2> appDrive;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1351
		// Insert the drive of the running application
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1352
		appDrive.Copy(Application()->AppFullName().Left(2));
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1353
		configFile.Insert(0, appDrive);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1354
		// Append the configuration file name
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1355
		configFile.Append(KConfigFile);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1356
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1357
		LOG2( "configFile = %S", &configFile );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1358
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1359
		HBufC* buffer = ReadConfigFile(rfs, configFile, lineBuffer, ret );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1360
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1361
		if ( buffer && ret == KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1362
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1363
			// Get Url from the config file
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1364
			TPtrC urlLine = GetConfigValue( KCfgTagUrl, lineBuffer, ret );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1365
			if ( ret == KErrNone )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1366
				{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1367
				iConfigUrl = HBufC8::NewL(urlLine.Length());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1368
				iConfigUrl->Des().Copy(urlLine);
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1369
				LOG8_2( "configUrl = %S", iConfigUrl );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1370
				}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1371
			delete buffer;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1372
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1373
		}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1374
		if ( !iConfigUrl )
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1375
			{
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1376
			// Error occured while reading the configuration, use default URL
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1377
			iConfigUrl = HBufC8::NewL(KDefaultDepServerUrl().Length());
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1378
			*iConfigUrl = KDefaultDepServerUrl;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1379
			LOG8_2( "configUrl = %S (default)", iConfigUrl );
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1380
			}
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1381
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1382
	lineBuffer.Close();
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1383
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1384
	return ret;
343c622c9f65 Contribution of bootstrap component of the Nokia Smart Installer (beta)
Santosh V Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
  1385
	}