19 #include "activerunner.h" |
19 #include "activerunner.h" |
20 |
20 |
21 |
21 |
22 ActiveRunnerPrivate::ActiveRunnerPrivate(ActiveRunner *aRunner) : |
22 ActiveRunnerPrivate::ActiveRunnerPrivate(ActiveRunner *aRunner) : |
23 CActive( CActive::EPriorityStandard ), q_ptr( aRunner ) |
23 CActive( CActive::EPriorityStandard ), q_ptr( aRunner ) |
24 { |
24 { |
25 CActiveScheduler::Add(this); |
25 CActiveScheduler::Add(this); |
26 } |
26 } |
27 |
27 |
28 ActiveRunnerPrivate::~ActiveRunnerPrivate() |
28 ActiveRunnerPrivate::~ActiveRunnerPrivate() |
29 { |
29 { |
30 Cancel(); |
30 Cancel(); |
31 if( iUseSif ) |
31 if( iUseSif ) |
32 { |
32 { |
33 iSoftwareInstall.Close(); |
33 iSoftwareInstall.Close(); |
34 } |
34 } |
52 else |
52 else |
53 { |
53 { |
54 ret = iSWInstLauncher.Connect(); |
54 ret = iSWInstLauncher.Connect(); |
55 } |
55 } |
56 return ret; |
56 return ret; |
57 } |
57 } |
58 |
58 |
59 TInt ActiveRunnerPrivate::Install( const QString& aFileName, bool aSilent ) |
59 TInt ActiveRunnerPrivate::Install( const QString& aFileName, bool aSilent ) |
60 { |
60 { |
61 TRAPD( err, DoInstallL( aFileName, aSilent ) ); |
61 TRAPD( err, DoInstallL( aFileName, aSilent ) ); |
62 return err; |
62 return err; |
63 } |
63 } |
|
64 |
|
65 TInt ActiveRunnerPrivate::Remove( const Usif::TComponentId& aComponentId, bool aSilent ) |
|
66 { |
|
67 TRAPD( err, DoRemoveL( aComponentId, aSilent ) ); |
|
68 return err; |
|
69 } |
|
70 |
|
71 TInt ActiveRunnerPrivate::Remove( const TUid& aUid, const TDesC8& aMime, bool aSilent ) |
|
72 { |
|
73 TRAPD( err, DoRemoveL( aUid, aMime, aSilent ) ); |
|
74 return err; |
|
75 } |
64 |
76 |
65 void ActiveRunnerPrivate::DoCancel() |
77 void ActiveRunnerPrivate::DoCancel() |
66 { |
78 { |
67 if( iUseSif ) |
79 if( iUseSif ) |
68 { |
80 { |
69 iSoftwareInstall.CancelOperation(); |
81 iSoftwareInstall.CancelOperation(); |
70 } |
82 } |
71 else |
83 else |
72 { |
84 { |
73 iSWInstLauncher.CancelAsyncRequest( SwiUI::ERequestInstall ); |
85 iSWInstLauncher.CancelAsyncRequest( SwiUI::ERequestInstall ); |
74 } |
86 } |
75 } |
87 } |
76 |
88 |
77 void ActiveRunnerPrivate::RunL() |
89 void ActiveRunnerPrivate::RunL() |
78 { |
90 { |
79 User::LeaveIfError( iStatus.Int() ); |
91 User::LeaveIfError( iStatus.Int() ); |
80 |
92 |
81 RDebug::Printf( "USIFTestInstaller: Installation completed" ); |
93 RDebug::Printf( "USIFTestInstaller: Installation completed" ); |
82 if( q_ptr ) { |
94 if( q_ptr ) |
|
95 { |
83 q_ptr->handleCompletion(); |
96 q_ptr->handleCompletion(); |
84 } |
97 } |
85 } |
98 } |
86 |
99 |
87 TInt ActiveRunnerPrivate::RunError( TInt aError ) |
100 TInt ActiveRunnerPrivate::RunError( TInt aError ) |
88 { |
101 { |
89 RDebug::Printf( "USIFTestInstaller: Error %d", aError ); |
102 RDebug::Printf( "USIFTestInstaller: Error %d", aError ); |
90 if( q_ptr ) { |
103 if( q_ptr ) |
|
104 { |
91 q_ptr->handleError( aError ); |
105 q_ptr->handleError( aError ); |
92 } |
106 } |
93 return KErrNone; |
107 return KErrNone; |
94 } |
108 } |
95 |
109 |
96 void ActiveRunnerPrivate::DoInstallL( const QString& aFileName, bool aSilent ) |
110 void ActiveRunnerPrivate::DoInstallL( const QString& aFileName, bool aSilent ) |
97 { |
111 { |
98 if( iFileName ) |
112 if( iFileName ) |
99 { |
113 { |
149 } |
163 } |
150 } |
164 } |
151 SetActive(); |
165 SetActive(); |
152 } |
166 } |
153 |
167 |
|
168 void ActiveRunnerPrivate::DoRemoveL( const Usif::TComponentId& aComponentId, bool aSilent ) |
|
169 { |
|
170 if( aSilent ) |
|
171 { |
|
172 delete iArguments; |
|
173 iArguments = NULL; |
|
174 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
175 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, 1 ); |
|
176 |
|
177 delete iResults; |
|
178 iResults = NULL; |
|
179 iResults = Usif::COpaqueNamedParams::NewL(); |
|
180 |
|
181 iSoftwareInstall.Uninstall( aComponentId, *iArguments, *iResults, iStatus ); |
|
182 } |
|
183 else |
|
184 { |
|
185 iSoftwareInstall.Uninstall( aComponentId, iStatus ); |
|
186 } |
|
187 SetActive(); |
|
188 } |
|
189 |
|
190 void ActiveRunnerPrivate::DoRemoveL( const TUid& aUid, const TDesC8& aMime, bool aSilent ) |
|
191 { |
|
192 if( aSilent ) |
|
193 { |
|
194 SwiUI::TUninstallOptions defaultOptions; |
|
195 SwiUI::TUninstallOptionsPckg optPckg( defaultOptions ); |
|
196 iSWInstLauncher.SilentUninstall( iStatus, aUid, optPckg, aMime ); |
|
197 } |
|
198 else |
|
199 { |
|
200 iSWInstLauncher.Uninstall( iStatus, aUid, aMime ); |
|
201 } |
|
202 SetActive(); |
|
203 } |
|
204 |