70 // silent launcher to send request complete before cancel of this |
78 // silent launcher to send request complete before cancel of this |
71 // active object can finish. This is normal active object canel operation behaviour. |
79 // active object can finish. This is normal active object canel operation behaviour. |
72 // Notice, that we do not call the callback functions of the observer here |
80 // Notice, that we do not call the callback functions of the observer here |
73 // because we suppose that the observer has started the cancel operation itself |
81 // because we suppose that the observer has started the cancel operation itself |
74 // or the caller will inform the observer itself. |
82 // or the caller will inform the observer itself. |
75 SilentLauncher().CancelAsyncRequest( iCancelCode ); |
83 |
|
84 SilentLauncher().CancelOperation(); |
76 } |
85 } |
77 |
86 |
78 |
87 |
79 void CNcdSilentInstallActiveObserver::StartToObserveL( const TDesC& aFileName, |
88 void CNcdSilentInstallActiveObserver::StartToObserveL( const TDesC& aFileName, |
80 const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg ) |
89 const Usif::COpaqueNamedParams* aSilentInstallOptions ) |
81 { |
90 { |
82 // For silent installation |
91 // For silent installation |
83 // Notice that if the user does not have TrustedUI capabilities |
92 // Notice that if the user does not have TrustedUI capabilities |
84 // then this will given KErrPermissionDenied. |
93 // then this will given KErrPermissionDenied. |
85 // Connect to the launcher here just before it is needed, |
94 // Connect to the launcher here just before it is needed, |
86 // because the launcher will be shown in the application list. |
95 // because the launcher will be shown in the application list. |
87 // So, it would not be nice to connect in the ConstructL and to show |
96 // So, it would not be nice to connect in the ConstructL and to show |
88 // the icon in the list all the time. |
97 // the icon in the list all the time. |
|
98 // User::LeaveIfError( SilentLauncher().Connect() ); |
89 User::LeaveIfError( SilentLauncher().Connect() ); |
99 User::LeaveIfError( SilentLauncher().Connect() ); |
90 |
100 |
91 iCancelCode = SwiUI::ERequestSilentInstall; |
101 if (!iResults) |
92 SilentLauncher().SilentInstall( iStatus, |
102 { |
93 aFileName, |
103 iResults = Usif::COpaqueNamedParams::NewL(); |
94 aSilentInstallOptionsPckg ); |
104 } |
95 |
105 |
96 SetActive(); |
106 iInstaller.Install( aFileName, *aSilentInstallOptions, *iResults, iStatus ); |
|
107 |
|
108 |
97 } |
109 } |
98 |
110 |
99 |
111 |
100 void CNcdSilentInstallActiveObserver::StartToObserveL( RFile& aFile, |
112 void CNcdSilentInstallActiveObserver::StartToObserveL( RFile& aFile, |
101 const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg ) |
113 const Usif::COpaqueNamedParams* aSilentInstallOptions ) |
102 { |
114 { |
103 // For silent installation |
115 // For silent installation |
104 // Notice that if the user does not have TrustedUI capabilities |
116 // Notice that if the user does not have TrustedUI capabilities |
105 // then this will given KErrPermissionDenied. |
117 // then this will given KErrPermissionDenied. |
106 // Connect to the launcher here just before it is needed, |
118 // Connect to the launcher here just before it is needed, |
107 // because the launcher will be shown in the application list. |
119 // because the launcher will be shown in the application list. |
108 // So, it would not be nice to connect in the ConstructL and to show |
120 // So, it would not be nice to connect in the ConstructL and to show |
109 // the icon in the list all the time. |
121 // the icon in the list all the time. |
|
122 |
110 User::LeaveIfError( SilentLauncher().Connect() ); |
123 User::LeaveIfError( SilentLauncher().Connect() ); |
111 |
124 |
112 iCancelCode = SwiUI::ERequestSilentInstallHandle; |
125 if (!iResults) |
113 SilentLauncher().SilentInstall( iStatus, |
126 { |
114 aFile, |
127 iResults = Usif::COpaqueNamedParams::NewL(); |
115 aSilentInstallOptionsPckg ); |
128 } |
116 |
129 /* |
|
130 if (iResults) |
|
131 { |
|
132 delete (iResults); |
|
133 iResults = 0; |
|
134 } |
|
135 iResults = Usif::COpaqueNamedParams::NewL(); |
|
136 |
|
137 if (iArguments) |
|
138 { |
|
139 delete (iArguments); |
|
140 iArguments = 0; |
|
141 } |
|
142 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
143 |
|
144 // Silent installation request |
|
145 |
|
146 TBool iSet = ETrue; |
|
147 |
|
148 enum TSifPolicy |
|
149 { |
|
150 EAllowed = 0, |
|
151 ENotAllowed = 1, |
|
152 EUserConfirm = 2 |
|
153 }; |
|
154 |
|
155 if (iSet) |
|
156 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, ETrue ); |
|
157 else |
|
158 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, EFalse ); |
|
159 if (iSet) |
|
160 iArguments->AddIntL( Usif::KSifInParam_PerformOCSP, Usif::ENotAllowed ); |
|
161 if (iSet) |
|
162 iArguments->AddIntL( Usif::KSifInParam_AllowUpgrade, Usif::EAllowed ); |
|
163 if (iSet) |
|
164 iArguments->AddIntL( Usif::KSifInParam_AllowUntrusted, Usif::ENotAllowed ); |
|
165 if (iSet) |
|
166 iArguments->AddIntL( Usif::KSifInParam_GrantCapabilities, Usif::ENotAllowed ); |
|
167 if (iSet) |
|
168 iArguments->AddIntL( Usif::KSifInParam_InstallOptionalItems, Usif::EAllowed ); |
|
169 if (iSet) |
|
170 iArguments->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, Usif::EAllowed ); |
|
171 //iArguments->AddIntL( Usif::KSifInParam_PackageInfo, ETrue ); |
|
172 if (iSet) |
|
173 iArguments->AddIntL( Usif::KSifInParam_AllowAppShutdown, Usif::EAllowed ); |
|
174 if (iSet) |
|
175 iArguments->AddIntL( Usif::KSifInParam_AllowDownload, Usif::EAllowed ); |
|
176 if (iSet) |
|
177 iArguments->AddIntL( Usif::KSifInParam_AllowOverwrite, Usif::EAllowed ); |
|
178 |
|
179 |
|
180 //iArguments->AddIntL(Usif::KSifInParam_InstallSilently, 1); |
|
181 //iArguments->AddIntL( Usif::KSifInParam_DisplayPackageInfo, ETrue ); |
|
182 |
|
183 iInstaller.Install(aFile, *iArguments, *iResults, iStatus); |
|
184 */ |
|
185 |
|
186 iInstaller.Install( aFile, *aSilentInstallOptions, *iResults, iStatus ); |
|
187 |
|
188 |
117 SetActive(); |
189 SetActive(); |
118 } |
190 } |
119 |
191 |
120 |
192 |
121 TInt CNcdSilentInstallActiveObserver::CancelAsyncOperation() |
193 TInt CNcdSilentInstallActiveObserver::CancelAsyncOperation() |
138 { |
210 { |
139 // This is called when the silent installer has done its job. |
211 // This is called when the silent installer has done its job. |
140 // Close the installer. |
212 // Close the installer. |
141 // The launcher is shown in the application list. |
213 // The launcher is shown in the application list. |
142 // So, it would not be nice to leave it there after operation is completed. |
214 // So, it would not be nice to leave it there after operation is completed. |
|
215 |
|
216 |
|
217 TInt ErrCategory = 0; |
|
218 TInt ErrCode = 0; |
|
219 TInt ExtendedErrCode =0; |
|
220 |
|
221 TBool ret = iResults->GetIntByNameL(Usif::KSifOutParam_ErrCategory, ErrCategory); |
|
222 ret = iResults->GetIntByNameL(Usif::KSifOutParam_ErrCode, ErrCode); |
|
223 ret = iResults->GetIntByNameL(Usif::KSifOutParam_ExtendedErrCode, ExtendedErrCode); |
143 SilentLauncher().Close(); |
224 SilentLauncher().Close(); |
144 |
225 |
145 TInt errorCode( ConvertErrorCode( iStatus.Int() ) ); |
226 TInt errorCode( ConvertErrorCode( iStatus.Int() ) ); |
146 |
227 |
147 // Just forward the information to the observer. |
228 // Just forward the information to the observer. |