# HG changeset patch # User Santosh V Patil # Date 1266572014 -19800 # Node ID 343c622c9f65a89a6140b4491e243cefbfdd0cb2 # Parent 8ed1157e94879d217cac9cc0bf68a18088e9b47a Contribution of bootstrap component of the Nokia Smart Installer (beta) diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/data/smartinstaller.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/data/smartinstaller.rls Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* File to list the various language resource files +* +* +*/ + + +// LOCALISATION STRINGS + +#ifdef LANGUAGE_SC +#include "smartinstaller_01.rls" // default U.K. English +#elif defined LANGUAGE_01 +#include "smartinstaller_01.rls" // U.K. English +#endif diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/data/smartinstaller.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/data/smartinstaller.rss Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Resource file for Bootstrap +* +* +*/ + + +// RESOURCE IDENTIFIER +NAME SIBS // 4 letter ID + +// INCLUDES +#include +#include +#include +#include +#include "smartinstaller.rls" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +// ----------------------------------------------------------------------------- +// +// Default Document Name +// +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name + { + buf="SIBS"; + } + +// ----------------------------------------------------------------------------- +// +// Define default menu and CBA key. +// +// ----------------------------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_focusevent_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +RESOURCE MENU_BAR r_focusevent_menubar + { + titles = + { + }; + } + + +RESOURCE TBUF r_http_transaction_err { buf = STRING_r_http_transaction_err; } +RESOURCE TBUF r_installation_failure_err { buf = STRING_r_installation_failure_err; } +RESOURCE TBUF r_installation_cancelled { buf = STRING_r_installation_cancelled; } +RESOURCE TBUF64 r_adm_env_creation_wait_text { buf = STRING_r_adm_env_creation_wait_text; } + +// ---------------------------------------------------------------------------- +// +// r_bootstrap_localisable_app_info +// +// ---------------------------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_bootstrap_localisable_app_info + { + short_caption = STRING_r_sibs_short_caption_string; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = STRING_r_sibs_caption_string; + }; + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/data/smartinstaller_01.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/data/smartinstaller_01.rls Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* English language Resource file for Bootstrap +* +* +*/ + + +// LOCALISATION STRINGS + +//Caption string for app. +rls_string STRING_r_sibs_caption_string "Nokia Smart Installer" + +//Short caption string for app. +rls_string STRING_r_sibs_short_caption_string "Smart Installer" + +// Localizable resource file location +rls_string STRING_r_bootstrap_loc_resource_file_1 "\\resource\\apps\\smartinstaller" + +rls_string STRING_r_adm_env_creation_wait_text "Checking dependencies, please wait" + +// +// Http messages +// +rls_string STRING_r_http_transaction_err "Download error!" + +rls_string STRING_r_installation_failure_err "Installation failed!" + +rls_string STRING_r_installation_cancelled "Installation cancelled!" + +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/data/smartinstaller_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/data/smartinstaller_reg.rss Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Registration Resource file for Bootstrap +* +* +*/ + + +#include "smartinstaller.rls" +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x2002CCCD + +RESOURCE APP_REGISTRATION_INFO + { + app_file="smartinstaller"; + localisable_resource_file = STRING_r_smartinstaller_loc_resource_file_1; + localisable_resource_id = R_BOOTSTRAP_LOCALISABLE_APP_INFO; + + hidden = KAppIsHidden; + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/group/bld.inf Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Build file for Bootstrap +* +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +smartinstaller.mmp diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/group/smartinstaller.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/group/smartinstaller.mmp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* MMP file for Bootstrap +* +* +*/ + + +TARGET smartinstaller.exe +TARGETTYPE exe +UID 0x100039CE 0x2002CCCD + +// Use maximum stack of 80kB +EPOCSTACKSIZE 0x14000 + +SECUREID 0x2002CCCD + +SOURCEPATH ..\src +SOURCE bootstrap.cpp +SOURCE bootstrapapplication.cpp +SOURCE bootstrapappui.cpp +SOURCE bootstrapdocument.cpp +SOURCE bootstrapglobalwaitnoteobserver.cpp +SOURCE bootstrapinstallationobserver.cpp + +SOURCEPATH ..\..\common +SOURCE config.cpp + +SOURCEPATH ..\data + +START RESOURCE smartinstaller.rss +HEADER +TARGETPATH resource\apps +END //RESOURCE + +START RESOURCE smartinstaller_reg.rss +#ifdef WINSCW +TARGETPATH \private\10003a3f\apps +#else +TARGETPATH \private\10003a3f\import\apps +#endif +END //RESOURCE + + + +USERINCLUDE ..\inc +USERINCLUDE ..\..\common + +SYSTEMINCLUDE \epoc32\include\private\swi +SYSTEMINCLUDE \epoc32\include\private +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE \epoc32\include\ecom + +SYSTEMINCLUDE \epoc32\include\osextensions +SYSTEMINCLUDE \epoc32\include\middleware +SYSTEMINCLUDE \epoc32\include\domain\middleware + + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY commonengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY aknnotify.lib +LIBRARY sisregistryclient.lib // Sis Registry information +LIBRARY apgrfx.lib +LIBRARY ws32.lib +LIBRARY SWInstCli.lib // Silent Installation +LIBRARY DownloadMgr.lib // Download +LIBRARY flogger.lib // Logging +LIBRARY centralrepository.lib +LIBRARY esock.lib +LIBRARY connmon.lib +LIBRARY SenXml.LIB // Xml parser + +LANG SC + +VENDORID 0 +CAPABILITY NetworkServices TrustedUI ReadUserData ReadDeviceData WriteDeviceData + +MACRO PRODUCTION_RELEASE +// MACRO USE_LOGFILE +// MACRO DEBUG_ADM +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapapplication.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main Application File for Bootstrap +* +* +*/ + + +#ifndef __BOOTSTRAPAPPLICATION_H__ +#define __BOOTSTRAPAPPLICATION_H__ + +// INCLUDES +#include + +// CLASS DECLARATION + +/** +* CBootstrapApplication application class. +* Provides factory to create concrete document object. +*/ +class CBootstrapApplication : public CAknApplication + { + public: // Functions from base classes + + /** + * From CApaApplication, AppDllUid. + * @return Application's UID + */ + TUid AppDllUid() const; + + protected: // Functions from base classes + + /** + * From CApaApplication, CreateDocumentL. + * Creates CCBootstrapDocument document object. The returned + * pointer in not owned by the CBootstrapApplication object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // __BOOTSTRAPAPPLICATION_H__ + +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapappui.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBootstrapAppUi application UI class declaration. +* +* +*/ + + +#ifndef __BOOTSTRAPAPPUI_H__ +#define __BOOTSTRAPAPPUI_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include "debug.h" + +const TInt KMaxDlConnectionAttempts = 6; + +// FORWARD DECLARATIONS +class CBootstrapAppView; +class CAknGlobalNote; +class CGlobalWaitNoteObserver; +class CInstallObserver; + +enum AppState + { + EInitialState, // 0 + EChangesDownloadState, + EChangesParseState, + EADMDownloadState, + EADMInstallState, + EADMLaunchState + }; + +// Mandatory changes xml elements +_LIT8(KFieldVersion,"Version"); +_LIT8(KFieldSisName,"SisFileName"); +// Optional changes xml element +_LIT8(KFieldUrl,"Url"); + +enum XmlParserError + { + EErrorXmlNotWelformed, + EMissingVersion, + EInvalidVersion, + EMissingSisFileName, + }; + +struct AdmChangesInfo + { + AdmChangesInfo() + :iVersion(0,0,0), + iSisName(NULL), + iUrl(NULL) + {} + ~AdmChangesInfo() + { + delete iSisName; + delete iUrl; + } + TVersion iVersion; + HBufC8 *iSisName; + HBufC8 *iUrl; + }; + +// CLASS DECLARATION +/** +* CBootstrapAppUi application UI class. +* Interacts with the user through the UI and request message processing +* from the handler class +*/ +class CBootstrapAppUi : public CAknAppUi, + public MHttpDownloadMgrObserver + { + public: // Constructors and destructor + + /** + * ConstructL. + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * CBootstrapAppUi. + * C++ default constructor. This needs to be public due to + * the way the framework constructs the AppUi + */ + CBootstrapAppUi(); + + /** + * ~CBootstrapAppUi. + * Virtual Destructor. + */ + virtual ~CBootstrapAppUi(); + + void ExitWithError(const TInt& aResourceId ); + + private: // Functions from base classes + + + /** + * Push the application to background. + * Called by the framework when the application switches + * to foreground. + */ + void HandleForegroundEventL(TBool aForeground); + + /** + * Sends application to background. + */ + void SendToBackgroundL(TBool aBackground = ETrue); + + /** + * Check if the ADM is already present in the device or not + */ + TBool IsPackagePresentL(const TUid& aUid, TVersion& aVersion); + + + /* + * Installs the specified package + */ + void AsyncInstallPackageL(const TDesC& aResponseFilename); + + + TInt LaunchAdmL (); + + void ShowGlobalWaitNoteL(); + + void StopGlobalWaitNoteL(); + + void SetFileNameInfoL(); + + void ShowNoteL( const TAknGlobalNoteType& aType , const TInt& aResourceId ); + + /** + * Fetch ADM from the web server. + */ + void DownloadL(); + + void CloseApp(); + + void DeleteFile(const TDesC& aFileName); + + void WaitForInstallCompleteL(); + + TUint32 GetLatestInstalledL(); + + + void HandleCommandL(TInt aCommand); + + TInt ReadConfigurationL(); + +#ifdef FEATURE_BOOTSTRAP_SETIAP + void SetIAPL(); +#endif + void ParseChangesInfoL( const TDesC& aChangesFileName ); + + public: + + void HandleInstallCompleteL(const TInt& aStatus); + /** + *Handle the Global Query Response + */ + void HandleHttpFetchCompleteL(const TBool& aStatus); + + /** + *Handle download manager events. + */ + void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); + + /** + * Handle user press cancel + */ + void HandleGlobalWaitNoteCancel(const TInt& aStatus); + + private: // Data + + /** + * The application view + * Owned by CBootstrapAppUi + */ + + /** + * IAP for Download Manager. Passed to ADM. + */ + TInt32 iIAP; + + HBufC* iDepFilename; + + HBufC* iSisFileName; + + /** + * URL provided by the configuration file to the server root or + * the default URL, if config file is missing. + */ + HBufC8* iConfigUrl; + + /** + * URL + */ + HBufC8* iUrl; + + HBufC* iDownloadFileName; + + TBool iAllowForeground; + + TBool iIsAdmInstalled; + + TVersion iAdmInstalledVersion; + + /* + * Downloadmanager object + */ + RHttpDownloadMgr iDownloadManager; + + CAknGlobalNote* iGlobalWaitNote; + + CGlobalWaitNoteObserver* iGlobalWaitNoteObserver; + + TInt iGlobalWaitNoteId; + + TUint32 iWrapperPackageUid; + + TBool iPausable; + + TInt iConnectionAttempts; + + SwiUI::RSWInstSilentLauncher iLauncher; + + SwiUI::TInstallOptionsPckg iOptionsPckg; + + AppState iAppState; + + TInt iInstallAttempt; + + CInstallObserver* iInstallObsrv; + + AdmChangesInfo iAdmChangesInfo; + + TBool isIapCancelled; + + INIT_OBJECT_DEBUG_LOG +}; + +#endif // __BootstrapAPPUI_H__ + +// End of File + diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapconst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapconst.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of Bootstrap constants. +* +* +*/ + +#ifndef __BOOTSTRAPCONST_H__ +#define __BOOTSTRAPCONST_H__ + +#include +// UID for the application; +// this should correspond to the uid defined in the mmp file +const TUid KUidBootstrapApp = { 0x2002CCCD }; +// "Ok" button press code +const TInt KOkButtonCode = 3005; + +#endif // __BOOTSTRAPCONST_H__ + +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapdocument.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CBootstrapDocument class. +* +* +*/ + + +#ifndef __BOOTSTRAPDOCUMENT_H__ +#define __BOOTSTRAPDOCUMENT_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CBootstrapAppUi; +class CEikApplication; + + +// CLASS DECLARATION + +/** +* CBootstrapDocument application class. +* An instance of class CBootstrapDocument is the Document part of the +* AVKON application framework for the Bootstrap application. +*/ +class CBootstrapDocument : public CAknDocument + { + public: // Constructors and destructor + + /** + * NewL. + * Two-phased constructor. + * Construct a CBootstrapDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of CBootstrapDocument. + */ + static CBootstrapDocument* NewL( CEikApplication& aApp ); + + /** + * NewLC. + * Two-phased constructor. + * Construct a CBootstrapDocument for the AVKON application aApp + * using two phase construction, and return a pointer + * to the created object. + * @param aApp Application creating this document. + * @return A pointer to the created instance of CBootstrapDocument. + */ + static CBootstrapDocument* NewLC( CEikApplication& aApp ); + + /** + * ~CBootstrapDocument + * Virtual Destructor. + */ + virtual ~CBootstrapDocument(); + + public: // Functions from base classes + + /** + * CreateAppUiL + * From CEikDocument, CreateAppUiL. + * Create a CBootstrapAppUi object and return a pointer to it. + * The object returned is owned by the Uikon framework. + * @return Pointer to created instance of AppUi. + */ + CEikAppUi* CreateAppUiL(); + + private: // Constructors + + /** + * ConstructL + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * CBootstrapDocument. + * C++ default constructor. + * @param aApp Application creating this document. + */ + CBootstrapDocument( CEikApplication& aApp ); + + }; + +#endif // __BOOTSTRAPDOCUMENT_H__ + +// End of File + diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapglobalwaitnoteobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapglobalwaitnoteobserver.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CGlobalWaitNoteObserver class. +* +* +*/ + + +#include + +class CBootstrapAppUi; + +class CGlobalWaitNoteObserver : public CActive + { + public: + CGlobalWaitNoteObserver(CBootstrapAppUi* aADMAppUiObj); + virtual ~CGlobalWaitNoteObserver(); + void Start(); + protected: + void RunL() ; + TInt RunError(TInt aError); + void DoCancel(); + private: + CBootstrapAppUi* iBsAppUiObj; + }; diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/inc/bootstrapinstallationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/inc/bootstrapinstallationobserver.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CInstallObserver class. +* +* +*/ + + +#include + +class CBootstrapAppUi; + +class CInstallObserver : public CActive + { + public: + CInstallObserver(CBootstrapAppUi* aADMAppUiObj); + virtual ~CInstallObserver(); + void Start(); + + protected: + void RunL() ; + TInt RunError(TInt aError); + void DoCancel(); + + private: + CBootstrapAppUi* iBsAppUiObj; + }; diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/sis/Wrapper.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/sis/Wrapper.pkg Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Languages +&EN + +; Header +#{"FluidLauncher (wrapped)"},(0xe0000236),1,0,0 + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v3.1, v3.2, v5.0 +[0x102032BE], 0, 0, 0, {"S60ProductID"} +[0x102752AE], 0, 0, 0, {"S60ProductID"} +[0x1028315F], 0, 0, 0, {"S60ProductID"} + +; Wrapped depfile and actual Sis application +"fluidlauncher.sis" -"!:\ADM\fluidlauncher.sis" + +; Nokia SmartInstaller App +@"smartinstaller.sis",(0x2002CCCD) diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/sis/config.ini diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/sis/smartinstaller.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/sis/smartinstaller.pkg Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Languages +&EN + +; Header +#{"Nokia Smart Installer"},(0x2002CCCD),0,9,0 + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v3.1, v3.2, v5.0 +[0x102032BE], 0, 0, 0, {"S60ProductID"} +[0x102752AE], 0, 0, 0, {"S60ProductID"} +[0x1028315F], 0, 0, 0, {"S60ProductID"} + +; BootStrap Files +"\epoc32\data\z\resource\apps\smartinstaller.RSC" -"c:\resource\apps\smartinstaller.RSC", FF +"\epoc32\data\z\private\10003a3f\import\apps\smartinstaller_reg.RSC" -"c:\private\10003a3f\import\apps\smartinstaller_reg.RSC", FF +"config.ini" -"c:\private\2002CCCD\config.ini",FF +"\epoc32\release\armv5\urel\smartinstaller.exe" -"c:\sys\bin\smartinstaller.exe", FR, RI diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrap.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Main Application class. +* +* +*/ + + +// INCLUDE FILES +#include +#include "bootstrapapplication.h" + +/** + * factory function to create the CBootstrapApplication class + */ +LOCAL_C CApaApplication* NewApplication() + { + return new CBootstrapApplication; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrapapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrapapplication.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBootstrapApplication class implementation. +* +* +*/ + + +// INCLUDE FILES +#include "bootstrapconst.h" +#include "bootstrapdocument.h" +#include "bootstrapapplication.h" + +// ============================ MEMBER FUNCTIONS =============================== +// ----------------------------------------------------------------------------- +// CBootstrapApplication::CreateDocumentL() +// Creates CApaDocument object +// ----------------------------------------------------------------------------- +// +CApaDocument* CBootstrapApplication::CreateDocumentL() + { + // Create an Bootstrap document, and return a pointer to it + return (static_cast + ( CBootstrapDocument::NewL( *this ) ) ); + } + +// ----------------------------------------------------------------------------- +// CBootstrapApplication::AppDllUid() +// Returns application UID +// ----------------------------------------------------------------------------- +// +TUid CBootstrapApplication::AppDllUid() const + { + // Return the UID for the Bootstrap application + return KUidBootstrapApp; + } + +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrapappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrapappui.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,1385 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBootstrapAppUi class implementation. +* +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include // CRepository +#include // KCRUidBrowser +#include +#include +#include + +#include "bootstrapapplication.h" +#include "bootstrapappui.h" +#include "bootstrapconst.h" +#include "bootstrapglobalwaitnoteobserver.h" +#include "bootstrapinstallationobserver.h" +#include "debug.h" +#include "globals.h" +#include "macros.h" +#include "config.h" + +// ADM binary name +_LIT(KAdmExePath, "ADM.exe"); + +_LIT(KDownloadFolder,"?:\\ADM\\"); +// Sis file extension +_LIT(KSisExtn,".SIS"); +_LIT(KSisxExtn,".SISX"); +// Xml file extension +_LIT(KXMLExtn,".XML"); +// Dep file extension +_LIT(KDepExtn,"_DEP"); +// ADM changes file name +_LIT8(KAdmChangesFile, "adm_changes.xml"); + +// Logging information +_LIT(KADMLogDir, "ADM"); +_LIT(KBootstrapLogFileName, "Bootstraplog.txt" ); +_LIT(KBootstrapLogFile, "?:\\logs\\ADM\\Bootstraplog.txt"); + +// Private folder of SWI Daemon +_LIT(KSWIDaemonPrivateFolder, "\\private\\10202dce\\"); +_LIT8(KForwardSlash, "/"); + +// ADM Uid +const TUid KUidAdm = { 0x2002CCCE }; +// Max no of connection attempts to Installer +const TInt KMaxInstallerConnectionAttempts = 6; + +// ============================ MEMBER FUNCTIONS =============================== +void CBootstrapAppUi::ConstructL() + { + // Create the log + INIT_DEBUG_LOG( KBootstrapLogFile(), KADMLogDir, KBootstrapLogFileName ); + + // Hide from application task list + HideApplicationFromFSW(); + + // Send us to background + SendToBackgroundL(); + + // Initialise app UI with standard value. + BaseConstructL( ENoScreenFurniture /* CAknAppUi::EAknEnableSkin */ ); + + StatusPane()->MakeVisible(EFalse); + + // Wait for the installer to be free + WaitForInstallCompleteL(); + + // Bring us to foreground + SendToBackgroundL(EFalse); + + // Get the Uid of the latest installed package + iWrapperPackageUid = GetLatestInstalledL(); + + // Connect to the Download Manager + TBool masterInstance( !iEikonEnv->StartedAsServerApp() ); + iDownloadManager.ConnectL( KUidBootstrapApp, *this, masterInstance ); + + // Read the config file + ReadConfigurationL(); + + // Get the dep file and actual application name(if present) + TRAPD(err, SetFileNameInfoL()); + if (err != KErrNone) + { + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + +#ifdef FEATURE_BOOTSTRAP_SETIAP + SetIAPL(); +#endif + + ShowGlobalWaitNoteL(); + + // Create view object + + User::LeaveIfError(iLauncher.Connect()); + + LOG("Checking ADM presence in the device"); + iIsAdmInstalled = IsPackagePresentL(KUidAdm, iAdmInstalledVersion); + + LOG( "* State changed to EChangesDownloadState" ); + iAppState = EChangesDownloadState; + DownloadL(); + } + +// ----------------------------------------------------------------------------- +// CBootstrapAppUi::CBootstrapAppUi() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CBootstrapAppUi::CBootstrapAppUi(): + iAllowForeground(EFalse), + iIsAdmInstalled(EFalse), + iAdmChangesInfo() + { + LOG ( "SmartInstaller starts"); + // disable possible transition effects + SetFullScreenApp(EFalse); + } + +// ----------------------------------------------------------------------------- +// CBootstrapAppUi::~CBootstrapAppUi() +// Destructor. +// ----------------------------------------------------------------------------- +// +CBootstrapAppUi::~CBootstrapAppUi() + { + LOG( "Bootstrap App ends"); + DELETE_IF_NONNULL( iDepFilename ); + DELETE_IF_NONNULL( iSisFileName ); + delete iGlobalWaitNoteObserver; + delete iGlobalWaitNote; + delete iInstallObsrv; + delete iConfigUrl; + delete iUrl; + delete iDownloadFileName; + + iDownloadManager.DeleteAll(); + iDownloadManager.Close(); + + iLauncher.Close(); + + CLOSE_DEBUG_LOG; + } + +void CBootstrapAppUi::HandleGlobalWaitNoteCancel(const TInt& aStatus) + { + LOG3( "+ Cancel note %d, %d", iAppState, aStatus ); + + // Do the cleanup based on the state + if (aStatus == -1) + { + iGlobalWaitNoteId = -1; + + switch(iAppState) + { + case EInitialState: + // No CleanUp required here + break; + + case EChangesDownloadState: + { + // Cancel download + iDownloadManager.ResetAll(); + break; + } + + case EChangesParseState: + { + // Delete the downloaded dep file + if (iDownloadFileName) + { + DeleteFile(*iDownloadFileName); + } + } + // fall-through + + case EADMDownloadState: + { + // Cancel download + iDownloadManager.ResetAll(); + break; + } + + case EADMInstallState: + { + // Cancel installation + iLauncher.CancelAsyncRequest(SwiUI::ERequestSilentInstall); + // Delete the downloaded sis file. + if (iDownloadFileName) + { + DeleteFile(*iDownloadFileName); + } + } + // fall-through + + case EADMLaunchState: + // No CleanUp required here + break; + + default: + break; + } + + TRAP_IGNORE( + ShowNoteL(EAknGlobalErrorNote, R_INSTALLATION_CANCELLED); + ); + + // Always delete the dep file in case of failure in + // bootstrap to ensure correct dep file is picked up + // when the outer package is installed. + if((KBootstrapVersion == 3)&&(iDepFilename)) + { + DeleteFile(*iDepFilename); + } + else if((KBootstrapVersion == 4)&&(iSisFileName)) + { + DeleteFile(*iSisFileName); + } + + // Close the bootstrap application + CloseApp(); + } + LOG3( "- Cancel note %d, %d", iAppState, aStatus ); + } + +void CBootstrapAppUi::ParseChangesInfoL( const TDesC& aChangesFileName ) + { + LOG2("+ Parse File ('%S')", &aChangesFileName); + + // Initailize the parser + CSenXmlReader* XmlReader = CSenXmlReader::NewLC(EErrorOnUnrecognisedTags); + CSenDomFragment* DomFragment = CSenDomFragment::NewL(); + CleanupStack::PushL(DomFragment); + + XmlReader->SetContentHandler(*DomFragment); + DomFragment->SetReader(*XmlReader); + + // Parse the provided changes file + XmlReader->ParseL(CEikonEnv::Static()->FsSession(), aChangesFileName); + + // Get package version + CSenElement* packageElement; + packageElement = DomFragment->AsElement().Element(KFieldVersion); + if (packageElement == NULL) + { + User::Leave(EMissingVersion); + } + else + { + TPtrC8 versionPtr = packageElement->Content(); + TVersion ver; + if (SetVersion(versionPtr, iAdmChangesInfo.iVersion) == EFalse) + { + User::Leave(EInvalidVersion); + } + } + + // Get the ADM sis file name + packageElement = DomFragment->AsElement().Element(KFieldSisName); + if (packageElement) + { + TPtrC8 sisNamePtr = packageElement->Content(); + iAdmChangesInfo.iSisName = sisNamePtr.AllocL(); + } + else + { + User::Leave(EMissingSisFileName); + } + + //URL read from ADM changes file is disabled. + //ADM.sis will be fetched from the default config url always...same as ADM_changes.xml +#if 0 + // Get the optional URL + packageElement = DomFragment->AsElement().Element(KFieldUrl); + if (packageElement) + { + TPtrC8 urlPtr = packageElement->Content(); + iAdmChangesInfo.iUrl = urlPtr.AllocL(); + } +#endif + + CleanupStack::PopAndDestroy( DomFragment ) ; + CleanupStack::PopAndDestroy( XmlReader ) ; + + LOG( "- ParseChangesInfoL()" ); + } + +#ifdef FEATURE_BOOTSTRAP_SETIAP +void CBootstrapAppUi::SetIAPL() + { + LOG( "+ CBootstrapAppUi::SetIAPL()" ); + // Use the browser default IAP, if available + CRepository *repository = CRepository::NewLC( KCRUidBrowser ); + TInt ret, browserIAP; + ret = repository->Get( KBrowserDefaultAccessPoint, browserIAP ); + CleanupStack::PopAndDestroy( repository ); + + LOG3("Browser IAP ID = %d, ret = %d ", browserIAP, ret); + if ( ( ret != KErrNone ) || ( browserIAP < 0 ) ) + { + + browserIAP = 0; + + } + + //No Browser default IAP. Fetch from connection monitor + RConnectionMonitor monitor; + CleanupClosePushL(monitor); + + TUint count; + TRequestStatus status; + + monitor.ConnectL(); + monitor.GetConnectionCount( count, status ); + LOG2("ConnMon connCount = %d", count); + User::WaitForRequest( status ); + if ( status.Int() != KErrNone ) + { + // error + LOG2("ConnMon.ConnCount() ret = %d, ignoring.", status.Int() ); + } + + // get all available IAPs + TConnMonIapInfoBuf iapBuf; + + monitor.GetPckgAttribute( EBearerIdAll, 0, KIapAvailability, iapBuf, status ); + User::WaitForRequest( status ) ; + + if ( status.Int() != KErrNone ) + { + LOG2("ConnMon.GetAttr() ret = %d, ignoring.", ret); + } + else + { + TInt countIaps = iapBuf().iCount; + LOG2("IAP count %d", countIaps); + + // Get the IAPId of the first IAP in the buffer. + iIAP = iapBuf().iIap[ 0 ].iIapId; + + LOG2("IAP ID[0] is %d", iIAP); + + //Now check whether any IAPId matches BrowserIAP, if yes then set the browserIAP as iIAP + while( countIaps > 0) + { + LOG3("IAP %d: ID = %d", countIaps, iapBuf().iIap[ countIaps ].iIapId); + if( iapBuf().iIap[ countIaps ].iIapId == browserIAP) + { + iIAP = browserIAP; + break; + } + countIaps--; + } + + LOG2("IAP ID after comparison %d", iIAP); + } + + + + if ( iIAP > 0) + { +#ifdef DO_LOG + TBuf<64> iapName; + monitor.GetStringAttribute( iIAP, 0, KIAPName, iapName, status ); + User::WaitForRequest( status ); + if ( status.Int() != KErrNone ) + { + LOG2( "ConnMon.GetStrAttr() ret = %d, ignoring.", status.Int() ); + } + LOG3( "Setting DownloadManager IAP to %d ('%S'). No user prompt for IAP.", iIAP, &iapName ); +#endif + // Set the download manager to silent mode + iDownloadManager.SetBoolAttribute( EDlMgrSilentMode, ETrue ); + iDownloadManager.SetIntAttribute( EDlMgrIap, iIAP ); + } + //else implies user will be prompted. + CleanupStack::PopAndDestroy( &monitor ); + } + + LOG( "- CBootstrapAppUi::SetIAPL()" ); + } +#endif +void CBootstrapAppUi::DownloadL() + { + LOG2( "+ Download(): %d,", iAppState ); + + TPtrC8 filename(NULL,0); + HBufC8* Url = NULL; + + // Set the download filename and Url based + // on the state. + switch(iAppState) + { + case EChangesDownloadState: + { + filename.Set(KAdmChangesFile); + Url = iConfigUrl; + break; + } + case EADMDownloadState: + { + User::LeaveIfNull(iAdmChangesInfo.iSisName); + filename.Set((iAdmChangesInfo.iSisName)->Des()); + // If the Url is not provided as part of the changes file, + // take the default Url + Url = (iAdmChangesInfo.iUrl==NULL) ?iConfigUrl :iAdmChangesInfo.iUrl; + break; + } + default: + { + LOG2( "! Unexpected state: %d", iAppState ); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + } + + // Create the full URL for download + DELETE_IF_NONNULL( iUrl); + iUrl = HBufC8::NewL(Url->Length() + filename.Length() + KForwardSlash().Length() ); + *iUrl = *Url; + TPtr8 ptr(iUrl->Des()); + + // Append forward slash if that's missing + if (ptr.Right(1) != KForwardSlash) + { + ptr.Append(KForwardSlash); + } + ptr.Append(filename); + + + // Set download file name along with path + TChar systemDrive; + RFs::DriveToChar(RFs::GetSystemDrive(),systemDrive); + + DELETE_IF_NONNULL( iDownloadFileName ); + iDownloadFileName = HBufC::NewL(KDownloadFolder().Length() + filename.Length()); + + *iDownloadFileName = KDownloadFolder; + iDownloadFileName->Des()[0] = systemDrive; + + TPtr responseFilenamePtr = iDownloadFileName->Des(); + + HBufC* filename16 = HBufC::NewLC(filename.Length()); + filename16->Des().Copy(filename); + responseFilenamePtr.Append(*filename16); + CleanupStack::PopAndDestroy(filename16); + + iPausable = EFalse; + iConnectionAttempts = 0; + + // Create new download + LOG8_2( "Downloading from URL: '%S'", iUrl ); + LOG2(" Download begins for '%S'", iDownloadFileName ); + TBool isNewDl = ETrue; + RHttpDownload& dl = iDownloadManager.CreateDownloadL( *iUrl, isNewDl ); + + ConeUtils::EnsurePathExistsL(*iDownloadFileName); + if(isNewDl) + { + LOG2( "Response body filename is '%S'", iDownloadFileName ); + dl.SetStringAttribute( EDlAttrDestFilename, *iDownloadFileName ); + dl.Start(); + } + + LOG( "- Download()" ); + } + +void CBootstrapAppUi::WaitForInstallCompleteL() + { + LOG( "+ WaitForInstallCompleteL()" ); + + // Use publish and subscribe mechanism to + // get notified when installer is free. + RProperty installComplete; + User::LeaveIfError( installComplete.Attach(KUidSystemCategory, Swi::KUidSoftwareInstallKey) ); + + TInt value; + if ( installComplete.Get( KUidSystemCategory, Swi::KUidSoftwareInstallKey, value ) == KErrNotFound ) + { + LOG( "! Could not get installer" ); + installComplete.Close(); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + else if ( (value & Swi::KSwisOperationMask) == Swi::ESwisNone ) + { + // Installer is idle. + } + else + { + LOG( "Waiting for the Installer to finish installation" ); + TRequestStatus status; + installComplete.Subscribe(status); + User::WaitForRequest(status); + } + + iAllowForeground = ETrue; + LOG( "Installer is idle" ); + installComplete.Close(); + LOG( "- WaitForInstallCompleteL()" ); + } + +TUint32 CBootstrapAppUi::GetLatestInstalledL() + { + LOG( "+ GetLatestInstalledL()" ); + + // Use publish and subscribe mechanism to + // get Uid of the latest installed package. + RProperty lastInstall; + User::LeaveIfError(lastInstall.Attach(KUidSystemCategory, KUidSwiLatestInstallation)); + + TInt value = -1; + if (lastInstall.Get( KUidSystemCategory, KUidSwiLatestInstallation, value ) == KErrNotFound) + { + LOG( "! Could not get installer" ); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + LOG2( "- GetLatestInstalled(): wrapper=0x%08x", value ); + return value; + } + +void CBootstrapAppUi::ShowGlobalWaitNoteL() + { + + // Allocate TBuf with constant length. + TBuf text( NULL ); + + // Reads a resource into a descriptor. + CEikonEnv::Static()->ReadResource( text, R_ADM_ENV_CREATION_WAIT_TEXT ); + + // Create new CAknGlobalNote instance. + iGlobalWaitNote = CAknGlobalNote::NewL(); + + iGlobalWaitNoteObserver = new (ELeave) CGlobalWaitNoteObserver(this); + iGlobalWaitNoteObserver->iStatus = KRequestPending; + iGlobalWaitNoteObserver->Start(); + + iGlobalWaitNoteId = iGlobalWaitNote->ShowNoteL( + iGlobalWaitNoteObserver->iStatus, + EAknGlobalWaitNote, + text ); + } + +void CBootstrapAppUi::StopGlobalWaitNoteL() + { + LOG2( "+ CBootstrapAppUi::StopGlobalWaitNoteL(): %d", iGlobalWaitNoteId ); + if(iGlobalWaitNote && (iGlobalWaitNoteId >= 0)) + { + iGlobalWaitNote->CancelNoteL(iGlobalWaitNoteId); + } + iGlobalWaitNoteId = -1; + + DELETE_IF_NONNULL( iGlobalWaitNote ); + DELETE_IF_NONNULL( iGlobalWaitNoteObserver ); + LOG( "- CBootstrapAppUi::StopGlobalWaitNoteL()" ); + } + +void CBootstrapAppUi::HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ) + { + LOG3("+HandleDMgrEventL(): DlState=%d, ProgState=%d", aEvent.iDownloadState, aEvent.iProgressState); + + TInt32 tmp; + THttpDownloadMgrError dlErrorId; + TInt32 sysErrorId( KErrNone ); + + // If DL is in final state (complete/fail), there's an error id available. + // TODO: Handle error condition + TInt sysErr = aDownload.GetIntAttribute( EDlAttrGlobalErrorId ,sysErrorId ); + TInt dlErr = aDownload.GetIntAttribute( EDlAttrErrorId ,tmp ); + dlErrorId = (THttpDownloadMgrError)tmp; + + //TODO: Include Log5 + //LOG5( "SysErrId=%d, DlErrId=%d. DlSize=%d, CntSize=%d.", sysErrorId, dlErrorId, downloadedsize, contentsize ); + + switch ( aEvent.iDownloadState ) + { + case EHttpDlCreated: + { + break; + } + case EHttpDlInprogress: + { + switch ( aEvent.iProgressState) + { + case EHttpProgCreatingConnection: + { + break; + } + case EHttpProgConnected: + { + break; + } + case EHttpProgConnectionSuspended: + case EHttpProgDisconnected: + { + // Try to reconnect if: + // 1. No of connection attempts is less than KMaxDlConnectionAttempts + // 2. IAP selection dialog is not cancelled. + if ((iConnectionAttempts < KMaxDlConnectionAttempts) + && !(dlErrorId == EConnectionFailed && sysErrorId == KErrCancel)) + { + ++iConnectionAttempts; + LOG2("Restart attempt is '%d'",iConnectionAttempts); + aDownload.Start(); + } + break; + } + case EHttpProgDownloadStarted: + { + break; + } + case EHttpContentTypeRequested: + { + break; + } + case EHttpProgResponseHeaderReceived: + { + break; + } + case EHttpProgResponseBodyReceived: + { + break; + } + default : + break; + } + break; + } + case EHttpDlPausable: + { + iPausable = ETrue; + break; + } + case EHttpDlNonPausable: + { + iPausable = EFalse; + break; + } + case EHttpDlCompleted: + { + iDownloadManager.GetIntAttribute( EDlMgrIap, iIAP ); + LOG2("IAP set to %d", iIAP); + + HandleHttpFetchCompleteL(EFalse); + break; + } + case EHttpDlPaused: + { + if((dlErrorId == EConnectionFailed) && (sysErrorId == KErrCancel)) + { + isIapCancelled = 1; + } + + // Continue dowload if paused in EHttpContentTypeReceived + if(aEvent.iProgressState == EHttpContentTypeReceived) + { + aDownload.Start(); + } + // Try to reconnect if: + // 1. No of connection attempts is less than KMaxDlConnectionAttempts + // 2. IAP selection dialog is not cancelled. + else if((iConnectionAttempts < KMaxDlConnectionAttempts) + && (!isIapCancelled)) + { + aDownload.Start(); + } + else if(iPausable) + { + aDownload.Start(); + } + else + { + HandleHttpFetchCompleteL(ETrue); + } + break; + } + case EHttpDlFailed: + { + if((dlErrorId == EConnectionFailed) && (sysErrorId == KErrCancel)) + { + isIapCancelled = 1; + } + + HandleHttpFetchCompleteL(ETrue); + break; + } + case EHttpDlDeleting: + { + break; + } + case EHttpDlDeleted: + { + break; + } + default: + { + break; + } + } + } + + +void CBootstrapAppUi::HandleHttpFetchCompleteL(const TBool& aStatus) + { + LOG3( "+ Fetch(): s=%d, a=%d", aStatus, iAppState ); + + User::LeaveIfNull(iDownloadFileName); + + if (aStatus == EFalse) + { + switch(iAppState) + { + case EChangesDownloadState: + { + // Parse downloaded changes file + iAppState = EChangesParseState; + LOG("* State changed to EChangesParseState"); + + TRAPD(err, ParseChangesInfoL(*iDownloadFileName)); + LOG2( "Changes file parsing completed with status: %d", err); + + // Delete no longer required changes file + DeleteFile(*iDownloadFileName); + + // 1. Install ADM if not already present + // 2. Upgrade ADM if higher version is available + // 3. If the upgrade fails, launch the current version + // of ADM in device. + TBool isAdmDownloadRequired = CompareVersions(iAdmInstalledVersion, iAdmChangesInfo.iVersion) + == EGreaterSecondVersion; + + if ((err==KErrNone) && isAdmDownloadRequired) + { + LOG( "* Changing state to EADMDownloadState" ); + iAppState = EADMDownloadState; + DownloadL(); + } + else if (iIsAdmInstalled) + { + LOG( "* Changing state to EADMLaunchState" ); + iAppState = EADMLaunchState; + TRAPD( err, LaunchAdmL() ); + if (err != KErrNone) + { + LOG2( "ADM launch fail %d", err ); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + LOG( "ADM launched OK, exiting! 1" ); + TRAP_IGNORE( StopGlobalWaitNoteL() ); + CloseApp(); + } + else + { + // Adm changes file parse error + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + break; + } + + case EADMDownloadState: + { + LOG2( "ADM downloaded OK: '%S'", iDownloadFileName); + + iAppState = EADMInstallState; + LOG( "* State changed to EADMInstallState" ); + AsyncInstallPackageL(*iDownloadFileName); + break; + } + + default: + { + LOG2( "Unexpected state %d", iAppState ); + // Unexpected State + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + } + } + else + { + // Launch existing version of ADM (if present) in device + // in case of download failure. + if (iIsAdmInstalled && (!isIapCancelled)) + { + LOG( "* Changing state to EADMLaunchState" ); + iAppState = EADMLaunchState; + TRAPD(err, LaunchAdmL()); + if (err != KErrNone) + { + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + LOG( "ADM launched OK, exiting! 2" ); + TRAP_IGNORE( StopGlobalWaitNoteL() ); + CloseApp(); + } + else + { + LOG( "! ADM download failed!" ); + ExitWithError(R_HTTP_TRANSACTION_ERR); + } + } + + LOG( "- Fetch complete "); + } + +void CBootstrapAppUi::SetFileNameInfoL() + { + LOG( "+ SetFileNameInfoL()" ); + LOG2( "Bootstrap version: %d", KBootstrapVersion); + + if(KBootstrapVersion<1 && KBootstrapVersion>4) + { + // Unsupported Bootstrap version + User::Leave(KErrNotSupported); + } + + // Connect to SisRegistry to fetch Package info + Swi::RSisRegistrySession registrySession; + User::LeaveIfError(registrySession.Connect()); + CleanupClosePushL(registrySession); + + Swi::RSisRegistryEntry entry; + + // Open registry entry + User::LeaveIfError(entry.Open(registrySession, TUid::Uid(iWrapperPackageUid))); + CleanupClosePushL(entry); + + RPointerArray packageFiles; + entry.FilesL(packageFiles); + const TInt filesCount(packageFiles.Count()); + + // look into the files installed as part of the package, + // to find the dep file name and actuall application file name. + for (TInt i=0; iDes(), NULL, NULL); + if (err != KErrNone) + { + continue; + } + TPtrC orgExtn = parse.Ext(); + + if (orgExtn.Length() == 0) + { + continue; + } + + HBufC* extn = orgExtn.AllocLC(); + TPtr extnPtr = extn->Des(); + extnPtr.UpperCase(); + + if(KBootstrapVersion != 3) + { + if ((extnPtr.Compare(KSisExtn) == 0)||(extnPtr.Compare(KSisxExtn) == 0)) + { + TPtrC privatePath( KNullDesC ); + const TInt driveLength = 2; + if (packageFiles[i]->Length() > (KSWIDaemonPrivateFolder().Length() + driveLength)) + { + privatePath.Set( packageFiles[i]->Des().Mid( driveLength ) ); + privatePath.Set( privatePath.Left( KSWIDaemonPrivateFolder().Length() ) ); + } + + // Ignore if its a Stub Sis file + if(privatePath.CompareF(KSWIDaemonPrivateFolder)) + { + if (iSisFileName == NULL) + { + iSisFileName = packageFiles[i]->AllocL(); + LOG2( "Actual application name is '%S'", iSisFileName); + } + else + // More than one sis present in the Wrapper Pkg + { + LOG2( "! More than one sis file present: '%S'. LEAVE.", packageFiles[i] ); + + User::Leave(KErrNotSupported); + } + } + }//end of sis extension + }//end of Bootstrapversion 2 + if (KBootstrapVersion != 4) + { + if(extnPtr.Compare(KXMLExtn) == 0) + { + TPtrC orgName = parse.Name(); + const TInt namelength = orgName.Length(); + const TInt depSuffixlength = KDepExtn().Length(); + + if (namelength > depSuffixlength) + { + TPtrC depSuffix = orgName.Mid((namelength-depSuffixlength), depSuffixlength); + + HBufC* name = depSuffix.AllocLC(); + TPtr namePtr = name->Des(); + namePtr.UpperCase(); + + if (namePtr.Compare(KDepExtn) == 0) + { + if (iDepFilename == NULL) + { + iDepFilename = packageFiles[i]->AllocL(); + LOG2( "Dep file name is '%S'", iDepFilename); + } + else + // More than one dep file present in the Wrapper Pkg + { + LOG2( "! More than one dep file present: '%S'. LEAVE.", packageFiles[i] ); + User::Leave(KErrNotSupported); + } + } + CleanupStack::PopAndDestroy(name); + } + } + } + CleanupStack::PopAndDestroy(extn); + } + + packageFiles.ResetAndDestroy(); + packageFiles.Close(); + + if(KBootstrapVersion != 3) + { + User::LeaveIfNull(iSisFileName); + if (!(ConeUtils::FileExists(*iSisFileName))) + { + User::Leave(KErrNotFound); + } + } + if(KBootstrapVersion != 4) + { + User::LeaveIfNull(iDepFilename); + } + + CleanupStack::PopAndDestroy(&entry); + CleanupStack::PopAndDestroy(®istrySession); + + LOG( "- SetFileNameInfoL()" ); + } + +TInt CBootstrapAppUi::LaunchAdmL() + { + LOG( "+ LaunchAdmL()" ); + + // In case of approach 3 , cleanup of only BootStrap + // is required. + if (KBootstrapVersion == 3) + { + iWrapperPackageUid = KUidBootstrapApp.iUid; + } + +#ifdef __USE_RAPA + HBufC *processArgs = HBufC::NewLC(iDepFilename->Length() + iSisFileName->Length() + 10 + 3 + 2); + TPtr cmdLineParams = processArgs->Des(); + cmdLineParams.Append(iDepFilename->Des()); + cmdLineParams.Append(' '); + cmdLineParams.Append(iSisFileName->Des()); + cmdLineParams.Append(' '); + cmdLineParams.AppendNum(iWrapperPackageUid); + cmdLineParams.Append(' '); + cmdLineParams.AppendNum(iIAP); + HBufC *tmp = HBufC::NewLC( cmdLineParams.Length() ); + tmp->Des().Copy( cmdLineParams ); + LOG2( "cmdLineParams '%S'", tmp ); + CleanupStack::PopAndDestroy(tmp); + TApaAppInfo appInfo; + RProcess process; + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + LOG("RApaLsSession.Connect() OK"); + CleanupClosePushL( process ); + CleanupClosePushL( appArcSession ); + User::LeaveIfError( appArcSession.GetAppInfo( appInfo, KUidAdm ) ); + LOG("RApaLsSession.GetAppInfo() OK"); + TFileName appName = appInfo.iFullName; + LOG2("RApaLsSession: iFullName='%S'", &appName); + User::LeaveIfError( process.Create( appName, processArgs->Des() ) ); + HBufC8 *tail = HBufC8::NewLC( processArgs->Length() ); + tail->Des().Copy(processArgs->Des()); + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appName ); + cmdLine->SetCommandL( EApaCommandBackground ); + cmdLine->SetTailEndL( tail->Des() ); + cmdLine->SetProcessEnvironmentL( process ); + LOG("RApaLsSession: going to launch"); + User::LeaveIfError( appArcSession.StartApp( *cmdLine ) ); + process.Resume(); + CleanupStack::PopAndDestroy( cmdLine ); + CleanupStack::PopAndDestroy( tail ); + CleanupStack::PopAndDestroy( &appArcSession ); + CleanupStack::PopAndDestroy( &process ); + CleanupStack::PopAndDestroy( processArgs ); + LOG("launch OK"); +#else + // Create ADM command line: + // adm.exe dependency_filename sis_filename uid_in_dec + // + // Size of 32-bit Bootstrap Version Value is 10 characters + // Size of 32-bit UID when converted to numeric string is 10 characters (4294967295) + // Max size of iIAP(TInt) when converted to numeric string is 10 characters + // Size of 2 spaces is 2 characters + const TInt mandatoryOptionsLength = 10+ 10+ 10+ 2; + TBufC mandatoryOptions; + TPtr mandatoryOptionsPtr = mandatoryOptions.Des(); + + mandatoryOptionsPtr.AppendNum(KBootstrapVersion); + mandatoryOptionsPtr.Append(' '); + mandatoryOptionsPtr.AppendNum(iWrapperPackageUid); + mandatoryOptionsPtr.Append(' '); + mandatoryOptionsPtr.AppendNum(iIAP); + + HBufC *processArgs = NULL; + + switch (KBootstrapVersion) + { + case 1: + case 2: + { + User::LeaveIfNull(iSisFileName); + User::LeaveIfNull(iDepFilename); + // Size of 2 spaces is 2 characters + processArgs = HBufC::NewLC( + mandatoryOptionsLength + + iDepFilename->Length() + + iSisFileName->Length() + + 2); + TPtr cmdLine = processArgs->Des(); + cmdLine.Append(mandatoryOptionsPtr); + cmdLine.Append(' '); + cmdLine.Append(*iDepFilename); + cmdLine.Append(' '); + cmdLine.Append(*iSisFileName); + break; + } + case 3: + { + User::LeaveIfNull(iDepFilename); + // Size of 1 spaces is 1 characters + processArgs = HBufC::NewLC( + mandatoryOptionsLength + + iDepFilename->Length() + + 1); + TPtr cmdLine = processArgs->Des(); + cmdLine.Append(mandatoryOptionsPtr); + cmdLine.Append(' '); + cmdLine.Append(*iDepFilename); + break; + } + case 4: + { + User::LeaveIfNull(iSisFileName); + // Size of 1 spaces is 1 characters + processArgs = HBufC::NewLC( + mandatoryOptionsLength + + iSisFileName->Length() + + 1); + TPtr cmdLine = processArgs->Des(); + cmdLine.Append(mandatoryOptionsPtr); + cmdLine.Append(' '); + cmdLine.Append(*iSisFileName); + break; + } + default: + // Unsupported Bootstrap Version + ExitWithError(R_INSTALLATION_FAILURE_ERR); + break; + } + + // Launch ADM + LOG3( "Launching %S '%S'", &KAdmExePath, processArgs); + + RProcess process; + CleanupClosePushL( process ); + + const TInt err = process.Create( KAdmExePath, processArgs->Des() ); + if (err != KErrNone) + { + LOG2( "ADM launch failed with error: %d", err ); + CleanupStack::PopAndDestroy( &process ); + CleanupStack::PopAndDestroy( processArgs ); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + + process.SetPriority( EPriorityBackground ); + process.Resume(); +#if 0 + const TInt type = process.ExitType(); + const TInt reason = process.ExitReason(); + TExitCategoryName cat = process.ExitCategory(); + LOG4( "Exit type %d, reason %d, cat '%S'", type, reason, &cat); +#endif + CleanupStack::PopAndDestroy( &process ); + CleanupStack::PopAndDestroy( processArgs ); + +#endif // if __USE_RAPA + LOG2( "- LaunchAdmL(): %d", err ); + return KErrNone; + } + +void CBootstrapAppUi::AsyncInstallPackageL(const TDesC& aResponseFilename) + { + SwiUI::TInstallOptions Options; + + Options.iUpgrade = SwiUI::EPolicyAllowed; + Options.iOCSP = SwiUI::EPolicyNotAllowed; + Options.iDrive = 'c'; + Options.iUntrusted = SwiUI::EPolicyNotAllowed; + Options.iCapabilities = SwiUI::EPolicyNotAllowed; + Options.iOverwrite = SwiUI::EPolicyAllowed; + + iOptionsPckg = Options; + + if (iInstallObsrv == NULL) + { + iInstallObsrv = new (ELeave) CInstallObserver(this); + } + iInstallObsrv->iStatus = KRequestPending; + iInstallObsrv->Start(); + // Start asynchronous installation + iLauncher.SilentInstall(iInstallObsrv->iStatus, aResponseFilename, iOptionsPckg); + } + +void CBootstrapAppUi::HandleInstallCompleteL(const TInt& aStatus) + { + LOG2("+ HandleInstallCompleteL(%d)", aStatus); + User::LeaveIfNull(iDownloadFileName); + + // If the install server is busy , try connecting multiple times. + if (aStatus == SwiUI::KSWInstErrBusy && ((++iInstallAttempt) <= KMaxInstallerConnectionAttempts)) + { + LOG2( "Retrying installation %d", aStatus ); + AsyncInstallPackageL(*iDownloadFileName); + } + else + { + LOG2("ADM installation status: %d", aStatus); + + LOG("Deleting ADM sis file"); + // Delete no longer required sis file. + DeleteFile(*iDownloadFileName); + + if (aStatus == KErrNone || iIsAdmInstalled) + { + iAppState = EADMLaunchState; + TRAPD( err, LaunchAdmL() ); + if ( err != KErrNone ) + { + LOG2( "ADM launch failed %d", err ); + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + LOG2( "ADM launched OK %d", err ); + TRAP_IGNORE( StopGlobalWaitNoteL() ); + CloseApp(); + } + else + { + ExitWithError(R_INSTALLATION_FAILURE_ERR); + } + } + LOG("- HandleInstallCompleteL()"); + } + +TBool CBootstrapAppUi::IsPackagePresentL(const TUid& aUid, TVersion& aVersion) + { + LOG( "+ ADMPresent()"); + + // Connect to SisRegistry to find if the package is + // already installed. + Swi::RSisRegistrySession registrySession; + + User::LeaveIfError(registrySession.Connect()); + CleanupClosePushL(registrySession); + + const TBool isPkgInstalled = registrySession.IsInstalledL(aUid); + + if (isPkgInstalled) + { + Swi::RSisRegistryEntry entry; + + // Open registry entry + User::LeaveIfError(entry.Open(registrySession, aUid)); + CleanupClosePushL(entry); + aVersion = entry.VersionL(); + + CleanupStack::PopAndDestroy(&entry); + } + + CleanupStack::PopAndDestroy(®istrySession); + + LOG3( "- ADMPresent(): 0x%x = %d", aUid.iUid, isPkgInstalled ); + + return isPkgInstalled; + } + +void CBootstrapAppUi::DeleteFile(const TDesC& aFileName) + { + CCoeEnv::Static()->FsSession().Delete(aFileName); + } + +void CBootstrapAppUi::ShowNoteL( const TAknGlobalNoteType& aType , const TInt& aResourceId ) + { + // Allocate TBuf with constant length. + TBuf text; + + // Reads a resource into a descriptor. + CEikonEnv::Static()->ReadResource( text, aResourceId ); + + // Create new CAknGlobalNote instance. + CAknGlobalNote* globalNote = CAknGlobalNote::NewLC(); + globalNote->ShowNoteL( aType , text ); + CleanupStack::PopAndDestroy(globalNote); + } + +void CBootstrapAppUi::ExitWithError(const TInt& aResourceId ) + { + LOG2( "+ ExitWithError(): 0x%08x", aResourceId ); + + // Display error message + TRAP_IGNORE( + StopGlobalWaitNoteL(); + ShowNoteL(EAknGlobalErrorNote, aResourceId); + ); + + // Delete the dep file is present + if((KBootstrapVersion == 3)&&(iDepFilename)) + { + DeleteFile(*iDepFilename); + } + else if((KBootstrapVersion == 4)&&(iSisFileName)) + { + DeleteFile(*iSisFileName); + } + + RunAppShutter(); + Exit(); + + LOG( "- ExitWithError()" ); + } + +void CBootstrapAppUi::CloseApp() + { + LOG( "+ CloseApp()" ); + + RunAppShutter(); + Exit(); + + LOG( "- CloseApp()" ); + } + +void CBootstrapAppUi::HandleForegroundEventL(TBool aForeground) + { + LOG3("+ CBootstrapAppUi::HandleForegroundEventL(%d): allow=%d", aForeground, iAllowForeground); + CAknAppUi::HandleForegroundEventL(aForeground); + if (aForeground && !iAllowForeground) + { + SendToBackgroundL(); + } + LOG("- CBootstrapAppUi::HandleForegroundEventL()" ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +void CBootstrapAppUi::SendToBackgroundL(TBool aBackground) + { + LOG2( "+ SendToBackgroundL(%d)", aBackground ); + // We have gained the focus + RWsSession aWsSession; + User::LeaveIfError( aWsSession.Connect() ); + TApaTask task(aWsSession); + + // Initialise the object with the window group id of + // our application (so that it represent our app) + task.SetWgId(CEikonEnv::Static()->RootWin().Identifier()); + if (aBackground) + { + task.SendToBackground(); + } + else + { + task.BringToForeground(); + } + aWsSession.Close(); + LOG( "- SendToBackgroundL() "); + } + +void CBootstrapAppUi::HandleCommandL(TInt aCommand) + { + switch (aCommand) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; + + default: + break; + } + } + +// --------------------------------------------------------------------------- +// CBootstrapAppUi::ReadConfigurationL +// Leaves if runs out of memory +// +// @return KErrNone if configuration was read correctly, error code otherwise +// --------------------------------------------------------------------------- +// +TInt CBootstrapAppUi::ReadConfigurationL() + { + TFileName configFile; + RArray< TPtrC > lineBuffer; + TInt ret( KErrNone ); + RFs& rfs = CEikonEnv::Static()->FsSession(); + + // Find the configuration file from the private directory + ret = rfs.PrivatePath(configFile); + if (ret == KErrNone) + { + TBuf<2> appDrive; + // Insert the drive of the running application + appDrive.Copy(Application()->AppFullName().Left(2)); + configFile.Insert(0, appDrive); + // Append the configuration file name + configFile.Append(KConfigFile); + + LOG2( "configFile = %S", &configFile ); + + HBufC* buffer = ReadConfigFile(rfs, configFile, lineBuffer, ret ); + + if ( buffer && ret == KErrNone ) + { + // Get Url from the config file + TPtrC urlLine = GetConfigValue( KCfgTagUrl, lineBuffer, ret ); + if ( ret == KErrNone ) + { + iConfigUrl = HBufC8::NewL(urlLine.Length()); + iConfigUrl->Des().Copy(urlLine); + LOG8_2( "configUrl = %S", iConfigUrl ); + } + delete buffer; + } + } + if ( !iConfigUrl ) + { + // Error occured while reading the configuration, use default URL + iConfigUrl = HBufC8::NewL(KDefaultDepServerUrl().Length()); + *iConfigUrl = KDefaultDepServerUrl; + LOG8_2( "configUrl = %S (default)", iConfigUrl ); + } + + lineBuffer.Close(); + + return ret; + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrapdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrapdocument.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CBootstrapDocument class implementation. +* +* +*/ + + +// INCLUDE FILES +#include "BootstrapAppUi.h" +#include "BootstrapDocument.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBootstrapDocument::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBootstrapDocument* CBootstrapDocument::NewL( CEikApplication& aApp ) + { + CBootstrapDocument* self = NewLC( aApp ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CBootstrapDocument::NewLC() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBootstrapDocument* CBootstrapDocument::NewLC( CEikApplication& + aApp ) + { + CBootstrapDocument* self = + new ( ELeave ) CBootstrapDocument( aApp ); + + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBootstrapDocument::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBootstrapDocument::ConstructL() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CBootstrapDocument::CBootstrapDocument() +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CBootstrapDocument::CBootstrapDocument( CEikApplication& aApp ) + : CAknDocument( aApp ) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// CBootstrapDocument::~CBootstrapDocument() +// Destructor. +// --------------------------------------------------------------------------- +// +CBootstrapDocument::~CBootstrapDocument() + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// CBootstrapDocument::CreateAppUiL() +// Constructs CreateAppUi. +// --------------------------------------------------------------------------- +// +CEikAppUi* CBootstrapDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it; + // the framework takes ownership of this object + return ( static_cast ( new ( ELeave ) + CBootstrapAppUi ) ); + } + +// End of File diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrapglobalwaitnoteobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrapglobalwaitnoteobserver.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CGlobalWaitNoteObserver class implementation. +* +* +*/ + + +#include "bootstrapglobalwaitnoteobserver.h" +#include "bootstrapappui.h" + +CGlobalWaitNoteObserver::CGlobalWaitNoteObserver(CBootstrapAppUi* aBsAppUiObj) : + CActive(CActive::EPriorityStandard), + iBsAppUiObj(aBsAppUiObj) + { + CActiveScheduler::Add(this); + } + +CGlobalWaitNoteObserver::~CGlobalWaitNoteObserver() + { + Cancel(); + } + +void CGlobalWaitNoteObserver::RunL() + { + // Invoke the handler function for cancel + iBsAppUiObj->HandleGlobalWaitNoteCancel(iStatus.Int()); + } + +TInt CGlobalWaitNoteObserver::RunError(TInt /*aError*/) + { + iBsAppUiObj->ExitWithError(R_INSTALLATION_FAILURE_ERR); + return KErrNone; + } + +void CGlobalWaitNoteObserver::DoCancel() + { + } + +void CGlobalWaitNoteObserver::Start() + { + SetActive(); + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/bootstrap/src/bootstrapinstallationobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/bootstrap/src/bootstrapinstallationobserver.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CInstallObserver class implementation. +* +* +*/ + + +#include +#include +#include "bootstrapinstallationobserver.h" +#include "bootstrapappui.h" + +CInstallObserver::CInstallObserver(CBootstrapAppUi* aBsAppUiObj) : + CActive(CActive::EPriorityStandard), + iBsAppUiObj(aBsAppUiObj) + { + CActiveScheduler::Add(this); + } + +CInstallObserver::~CInstallObserver() + { + Cancel(); + } + +void CInstallObserver::RunL() + { + // Invoke the handler function installation complete, + // passing the status + iBsAppUiObj->HandleInstallCompleteL(iStatus.Int()); + } + +TInt CInstallObserver::RunError(TInt aError) + { + // TODO: HACK! We just ignore the RunError. + // This will get called when ADM is downloaded/installed and + // when bootstrap tries to exit, we get run error -1003. +// RDebug::Print(_L("BOOTSTRAP: CInstallObserver::RunError(%d)"), aError); +/* + iBsAppUiObj->ExitWithError(R_INSTALLATION_FAILURE_ERR); +*/ + return KErrNone; + } + +void CInstallObserver::DoCancel() + { + } + +void CInstallObserver::Start() + { + SetActive(); + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/config.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/config.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation to read from the config file. +* +* +*/ + + +#include "config.h" + +// --------------------------------------------------------------------------- +// ReadConfigFile +// +// Reads the configuration file to aBuffer, aLineBuffer containing the pointers to lines. +// +// @return TInt normal Symbian error code or KErrNone if all went OK. +// --------------------------------------------------------------------------- +// +TInt ReadConfigFile(RFile& aFile, TDes& aBuffer, RArray< TPtrC >& aLineBuffer ) + { + // Read text file into buffers + TInt ret( KErrNone ); + TFileText tf; + tf.Set( aFile ); + aBuffer.SetMax(); + TPtr ptr( aBuffer.MidTPtr( 0 ) ); + TInt used( 0 ); + do + { + ret = tf.Read( ptr ); + TInt len( ptr.Length() ); + if ( ( ret == KErrNone || ret == KErrEof ) && len > 0 ) + { + // Store non-empty text line + TInt err( aLineBuffer.Append( ptr ) ); + if ( err == KErrNone ) + { + ptr.SetMax(); + ptr.Set( ptr.MidTPtr( len ) ); + ptr.Zero(); + used += len; + } + else + { + ret = err; + } + } + } + while ( ret == KErrNone ); + if ( ret == KErrEof ) + { + // reached the end of file without any other error => this is OK + ret = KErrNone; + } + aBuffer.SetLength( used ); + + return ret; + } + +// --------------------------------------------------------------------------- +// ReadConfigFile +// +// @return HBufC containg the read config file. aLineBuffer arrays pointing to lines. +// --------------------------------------------------------------------------- +// +HBufC* ReadConfigFile( RFs& aFs, const TDesC& aFullPath, RArray< TPtrC >& aLineBuffer, TInt& aError ) + { + RFile file; + aError = file.Open( aFs, aFullPath, EFileRead | EFileStreamText | EFileShareReadersOnly ); + if ( aError != KErrNone ) + { + return NULL; + } + TInt size( 0 ); + aError = file.Size( size ); + if ( aError != KErrNone ) + { + file.Close(); + return NULL; + } + // Get text size, create buffer for text and read text file + HBufC* ret = HBufC::New( ( size + sizeof( TText ) - 1 ) / sizeof( TText ) ); + if ( !ret ) + { + aError = KErrNoMemory; + file.Close(); + return NULL; + } + TPtr ptr( ret->Des() ); + aError = ReadConfigFile( file, ptr, aLineBuffer ); + file.Close(); + if ( aError != KErrNone ) + { + delete ret; + aLineBuffer.Reset(); + return NULL; + } + return ret; + } + +// --------------------------------------------------------------------------- +// GetConfigValue +// +// Gets string specified by tag. For examples: +// Tag1=Value1 Tag1 = aTag, Value1 will be copied to aTag +// aError Normal Symbian error code or KErrNone if all went OK. +// --------------------------------------------------------------------------- +// +TPtrC GetConfigValue( const TDesC& aTag, const RArray< TPtrC >& aLineBuffer, TInt& aError ) + { + aError = KErrNotFound; + TPtrC ret( KNullDesC ); + const TInt tagLen( aTag.Length() ); + const TInt count( aLineBuffer.Count() ); + for( TInt i( 0 ); i < count; ++i ) + { + TPtrC line( aLineBuffer[ i ] ); + if ( !line.Left( tagLen ).CompareF( aTag ) ) + { + ret.Set( line.Mid( tagLen ) ); + aError = KErrNone; + break; + } + } + + return ret; + } + +TInt CompareVersions(TVersion& version1,TVersion& version2) + { + // Compare the versions based on major,minor and build number. + if((version1.iMajor == version2.iMajor)&&(version1.iMinor == version2.iMinor)&&(version1.iBuild == version2.iBuild)) + { + return EEqualVersion; + } + else if ((version1.iMajor > version2.iMajor) || + ((version1.iMajor == version2.iMajor)&&(version1.iMinor > version2.iMinor)) || + ((version1.iMajor == version2.iMajor)&&(version1.iMinor == version2.iMinor)&&(version1.iBuild >= version2.iBuild))) + { + return EGreaterFirstVersion; + } + else + { + return EGreaterSecondVersion; + } + } + +TBool SetVersion(const TDesC8& aVersionPtr, TVersion& aVer) + { + // Function will return EFalse if aVersionPtr is not a valid + // version string + TLex8 lex(aVersionPtr); + TInt count = 0; + lex.SkipSpace(); + + // Get Major Version (max length 3) + const TInt maxMajorVersionLength = 3; + lex.Mark(); + while ( (count 0) + { + return EFalse; + } + else + { + aVer.iBuild = 0; + return ETrue; + } + } + + // Get Build Number(max length 5) + const TInt maxBuildNoLength = 5; + lex.Inc(); + lex.Mark(); + lex.SkipCharacters(); + + if (lex.TokenLength() > maxBuildNoLength) + { + return EFalse; + } + + lexToken.Assign(lex.MarkedToken()); + if ( lexToken.Val(aVer.iBuild) != KErrNone ) + { + return EFalse; + } + return ETrue; + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/config.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Functions to read from the config file. +* +* +*/ + + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include +#include + +#include "globals.h" + +// Configuration file containing the URL for the server. Stored in private directory. +_LIT(KConfigFile, "config.ini"); +_LIT(KCfgTagUrl, "Url="); + +enum VersionResult + { + EEqualVersion, + EGreaterFirstVersion, + EGreaterSecondVersion + }; + +TInt ReadConfigFile(RFile& aFile, TDes& aBuffer, RArray< TPtrC >& aLineBuffer ); + +HBufC* ReadConfigFile( RFs& aFs, const TDesC& aFullPath, RArray< TPtrC >& aLineBuffer, TInt& aError ); + +TPtrC GetConfigValue( const TDesC& aTag, const RArray< TPtrC >& aLineBuffer, TInt& aError ); + +TInt CompareVersions(TVersion& version1,TVersion& version2); + +TBool SetVersion(const TDesC8& aVersionPtr, TVersion& aVer); + +#endif diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/debug.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Debug definitions. +* +* +*/ + + +#ifndef __SI_DEBUG_H__ +#define __SI_DEBUG_H__ + +#include +#include +#include + +#define INIT_DEBUG_LOG( aLogFile, aLogDir, aLogName ) \ +{ \ +HBufC* buf = aLogFile.AllocLC(); \ +TChar systemDrive; \ +RFs::DriveToChar(RFs::GetSystemDrive(),systemDrive); \ +buf->Des()[0] = systemDrive; \ +ConeUtils::EnsurePathExistsL( *buf ); \ +CleanupStack::PopAndDestroy(buf); \ +iLog.Connect(); \ +iLog.CreateLog( aLogDir, aLogName, EFileLoggingModeOverwrite); \ +} + +#define CLOSE_DEBUG_LOG \ + iLog.CloseLog(); \ + iLog.Close(); + +#define INIT_OBJECT_DEBUG_LOG \ + RFileLogger iLog; + +#if defined(DEBUG_ADM) || defined(_DEBUG) +#ifdef USE_LOGFILE + +#define LOG( aMsg ) { _LIT(KMsg, aMsg); iLog.Write( KMsg ); RDebug::Print( KMsg ); } +#define LOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print( KMsg, aParam1 ); } +#define LOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2 ); RDebug::Print( KMsg, aParam1, aParam2 ); } +#define LOG4( aMsg, aParam1, aParam2, aParam3 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3 ); } +#define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4 ); } +#define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); } +#define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); } +#define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); } +#define LOG8_2( aMsg, aParam1 ) { _LIT8(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print(_L("RDebug _L8() at line %d"), __LINE__); } +#else + +#define LOG( aMsg ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg ); } +#define LOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1 ); } +#define LOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2 ); } +#define LOG4( aMsg, aParam1, aParam2, aParam3 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3 ); } +#define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4 ); } +#define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); } +#define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); } +#define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); } +#define LOG8_2( aMsg, aParam1 ) { _LIT8(KMsg, aMsg); TBuf8<128> t; t.AppendFormat(KMsg, aParam1); RDebug::RawPrint(t); } +#endif + +#define RLOG( aMsg ) { RDebug::Print ( aMsg ); } + +#else + +#define LOG( a ) +#define LOG2( a, b ) +#define LOG3( a, b, c ) +#define LOG4( a, b, c, d ) +#define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) +#define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) +#define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) +#define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) +#define LOG8_2( a, b ) +#endif + +// Forced Logs - Always printed. +#define FLOG( aMsg ) { _LIT(KMsg, aMsg); iLog.Write( KMsg ); RDebug::Print( KMsg ); } +#define FLOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print( KMsg, aParam1 ); } +#define FLOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2 ); RDebug::Print( KMsg, aParam1, aParam2 ); } + +#endif diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/globals.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of the global constants. +* +* +*/ + + +#ifndef GLOBALS_H_ +#define GLOBALS_H_ + +// Constants + +// Define the bootstrap version to be used. +// Currently the versions supported are 1, 2, 3 and 4. +#define KBootstrapVersion 4 + +// Maximum length of popup dialog message +const TInt KMaxMsgSize = 128; + +// Download size threshold. If download size exceeds this, the user is prompted to continue with the download. +const TInt KMaxDownloadWithoutPrompt = 10*1024*1024; + +// TODO: make the URL runtime configurable +#ifdef PRODUCTION_RELEASE +_LIT8(KDefaultDepServerUrl, ""); +#else +// Beta2 URL +_LIT8(KDefaultDepServerUrl, ""); +#endif + +#endif /* GLOBALS_H_ */ diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/globalwaitnote.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/globalwaitnote.cpp Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "globalwaitnote.h" + +CGlobalWaitNote* CGlobalWaitNote::NewLC(MGlobalWaitNoteClient& aOwner, TBool aCancellable) + { + CGlobalWaitNote* self = new(ELeave) CGlobalWaitNote(aOwner, aCancellable); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CGlobalWaitNote* CGlobalWaitNote::NewL(MGlobalWaitNoteClient& aOwner, TBool aCancellable) + { + CGlobalWaitNote* self = NewLC(aOwner, aCancellable); + CleanupStack::Pop(self); + return self; + } + +CGlobalWaitNote::CGlobalWaitNote(MGlobalWaitNoteClient& aOwner, TBool aCancellable) : + CActive(EPriorityStandard), + iOwner(aOwner), + iCancellable(aCancellable) + { + } + +void CGlobalWaitNote::ConstructL() + { + iWaitNote = CAknGlobalNote::NewL(); + CActiveScheduler::Add(this); + } + +CGlobalWaitNote::~CGlobalWaitNote() + { + Cancel(); + delete iWaitNote; + iWaitNote = NULL; + } + +void CGlobalWaitNote::StartL(const TDesC& aText) + { + if ( !IsActive() ) + { + if ( !iCancellable ) + { + iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY ); + } + iWaitNoteId = iWaitNote->ShowNoteL( + iStatus, + EAknGlobalWaitNote, + aText ); + SetActive(); + } + } + +void CGlobalWaitNote::StopL() + { + if ( iWaitNote && iWaitNoteId >= 0 ) + { + iWaitNote->CancelNoteL( iWaitNoteId ); + iWaitNoteId = -1; + } + } + +void CGlobalWaitNote::RunL() + { + if ( iCancellable && iStatus.Int() == EAknSoftkeyCancel ) + { + iOwner.WaitNoteCancelled(); + } + } + +void CGlobalWaitNote::DoCancel() + { + } diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/globalwaitnote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/globalwaitnote.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CGlobalWaitNoteObserver class. +* +* +*/ + + +#include + +class CGlobalWaitNote : public CActive + { +public: + class MGlobalWaitNoteClient + { + public: + virtual void WaitNoteCancelled() = 0; + }; + static CGlobalWaitNote* NewL (MGlobalWaitNoteClient& aOwner, TBool aCancellable = ETrue); + static CGlobalWaitNote* NewLC(MGlobalWaitNoteClient& aOwner, TBool aCancellable = ETrue); + +public: + virtual ~CGlobalWaitNote(); + void StartL(const TDesC& aText); + void StopL(); + +protected: + void ConstructL(); + void RunL() ; + void DoCancel(); + +private: + CGlobalWaitNote(MGlobalWaitNoteClient& aOwner, TBool aCancellable); + +private: + MGlobalWaitNoteClient& iOwner; + CAknGlobalNote* iWaitNote; + TInt iWaitNoteId; + TBool iCancellable; + TRequestStatus iStatus; + }; diff -r 8ed1157e9487 -r 343c622c9f65 smartinstaller/common/macros.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smartinstaller/common/macros.h Fri Feb 19 15:03:34 2010 +0530 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Macros used in Bootstrap/ADM +* +* +*/ + + +#ifndef __MACROS_H__ +#define __MACROS_H__ + +#ifndef DELETE_IF_NONNULL +#define DELETE_IF_NONNULL(x) \ + if (x) \ + { \ + delete x; \ + x = NULL; \ + } +#endif + +#endif