|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "hsps_builds_cfg.hrh" |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "hspsinstaller.h" |
|
23 #include "hspsthemeserver.h" |
|
24 #include "hspsinstallationhandler.h" |
|
25 #include "hspsthememanagement.h" |
|
26 |
|
27 // ========================= MEMBER FUNCTIONS ================================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CHSPSInstaller::NewL() |
|
31 // Two-phased constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 CHSPSInstaller* CHSPSInstaller::NewL( |
|
34 ChspsThemeServer& aServer ) |
|
35 { |
|
36 CHSPSInstaller* self = new ( ELeave ) CHSPSInstaller( aServer ); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CHSPSInstaller::ConstructL() |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CHSPSInstaller::ConstructL() |
|
49 { |
|
50 iInstallationHandler = ChspsInstallationHandler::NewL( iServer ); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CHSPSInstaller::CHSPSInstaller() |
|
55 // C++ default constructor can NOT contain any code, that might leave. |
|
56 // ----------------------------------------------------------------------------- |
|
57 CHSPSInstaller::CHSPSInstaller( |
|
58 ChspsThemeServer& aServer ): |
|
59 CActive(EPriorityStandard), |
|
60 iServer( aServer ) |
|
61 { |
|
62 CActiveScheduler::Add( this ); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CHSPSInstaller::~CHSPSInstaller() |
|
67 // Destructor. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CHSPSInstaller::~CHSPSInstaller() |
|
71 { |
|
72 Cancel(); // Causes call to DoCancel() |
|
73 delete iLoop; |
|
74 delete iInstallationHandler; |
|
75 } |
|
76 |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CHSPSInstaller::InstallConfigurationL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 ThspsServiceCompletedMessage CHSPSInstaller::InstallConfigurationL( |
|
83 const TDesC& aFileName ) |
|
84 { |
|
85 // Start installation by reading the manifest file |
|
86 iRet = iInstallationHandler->hspsInstallTheme( aFileName, iHeaderData ); |
|
87 if ( iRet == EhspsInstallThemeSuccess && !IsActive() ) |
|
88 { |
|
89 // Continue with remaining installation phases |
|
90 SetActive(); |
|
91 iInstallationHandler->hspsInstallNextPhaseL( iHeaderData, iStatus ); |
|
92 |
|
93 // Wait until the installation phases have been executed (async->sync) |
|
94 iLoop = new ( ELeave )CActiveSchedulerWait(); |
|
95 iLoop->Start(); |
|
96 |
|
97 } |
|
98 |
|
99 return iRet; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CHSPSInstaller::InstallationHandler |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 ChspsInstallationHandler& CHSPSInstaller::InstallationHandler() |
|
107 { |
|
108 return *iInstallationHandler; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CHSPSInstaller::RunError |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 TInt CHSPSInstaller::RunError( TInt /*aError*/ ) |
|
116 { |
|
117 // Called when error occurred in asynchronous request |
|
118 iLoop->AsyncStop(); |
|
119 return KErrNone; |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CHSPSInstaller::RunL |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 void CHSPSInstaller::RunL() |
|
127 { |
|
128 iRet = (ThspsServiceCompletedMessage)iStatus.Int(); |
|
129 switch ( iStatus.Int() ) |
|
130 { |
|
131 case EhspsInstallPhaseSuccess: |
|
132 { |
|
133 // Execute next phase of the installation |
|
134 if ( !IsActive() ) |
|
135 { |
|
136 SetActive(); |
|
137 iInstallationHandler->hspsInstallNextPhaseL( iHeaderData, iStatus ); |
|
138 } |
|
139 } |
|
140 break; |
|
141 |
|
142 case EhspsInstallThemeSuccess: |
|
143 case EhspsInstallThemeFailed: |
|
144 default: |
|
145 { |
|
146 // Allow continuation of the InstallTheme function |
|
147 iLoop->AsyncStop(); |
|
148 } |
|
149 break; |
|
150 } |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CHSPSInstaller::DoCancel() |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void CHSPSInstaller::DoCancel() |
|
158 { |
|
159 // Cancels any outstanding operation - nothing to do |
|
160 } |
|
161 |
|
162 // End of File |