|
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: Creates PackageInfo objects asynchronously |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmngr2packageinfomaker.h" // CAppMngr2PackageInfoMaker |
|
20 #include "appmngr2infomakerobserver.h" // MAppMngr2InfoMakerObserver |
|
21 #include <appmngr2runtime.h> // CAppMngr2Runtime |
|
22 #include <appmngr2packageinfo.h> // CAppMngr2PackageInfo |
|
23 #include <appmngr2recognizedfile.h> // CAppMngr2RecognizedFile |
|
24 #include <appmngr2debugutils.h> // FLOG macros |
|
25 |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // CAppMngr2PackageInfoMaker::NewL() |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CAppMngr2PackageInfoMaker* CAppMngr2PackageInfoMaker::NewL( CAppMngr2Runtime& aPlugin, |
|
34 MAppMngr2InfoMakerObserver& aObserver, RFs& aFs ) |
|
35 { |
|
36 CAppMngr2PackageInfoMaker* self = CAppMngr2PackageInfoMaker::NewLC( aPlugin, |
|
37 aObserver, aFs ); |
|
38 CleanupStack::Pop( self ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CAppMngr2PackageInfoMaker::NewLC() |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CAppMngr2PackageInfoMaker* CAppMngr2PackageInfoMaker::NewLC( CAppMngr2Runtime& aPlugin, |
|
47 MAppMngr2InfoMakerObserver& aObserver, RFs& aFs ) |
|
48 { |
|
49 CAppMngr2PackageInfoMaker* self = new (ELeave) CAppMngr2PackageInfoMaker( aPlugin, |
|
50 aObserver, aFs ); |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 return self; |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CAppMngr2PackageInfoMaker::~CAppMngr2PackageInfoMaker() |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CAppMngr2PackageInfoMaker::~CAppMngr2PackageInfoMaker() |
|
61 { |
|
62 Cancel(); |
|
63 iFiles.ResetAndDestroy(); |
|
64 iPackageInfos.ResetAndDestroy(); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CAppMngr2PackageInfoMaker::DoCancel() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void CAppMngr2PackageInfoMaker::DoCancel() |
|
72 { |
|
73 iPlugin.CancelGetInstallationFiles(); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CAppMngr2PackageInfoMaker::RunL() |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CAppMngr2PackageInfoMaker::RunL() |
|
81 { |
|
82 if( iStatus.Int() == KErrNone ) |
|
83 { |
|
84 iObserver.NewPackagesCreatedL( *this, iPackageInfos ); |
|
85 } |
|
86 else |
|
87 { |
|
88 iObserver.ErrorInCreatingPackagesL( *this, iStatus.Int() ); |
|
89 } |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CAppMngr2PackageInfoMaker::AddFileL() |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 void CAppMngr2PackageInfoMaker::AddFileL( CAppMngr2RecognizedFile* aFile ) |
|
97 { |
|
98 iFiles.AppendL( aFile ); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CAppMngr2PackageInfoMaker::StartGettingInstallationFilesL() |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CAppMngr2PackageInfoMaker::StartGettingInstallationFilesL() |
|
106 { |
|
107 if( !IsActive() ) |
|
108 { |
|
109 TRAPD( err, iPlugin.GetInstallationFilesL( iPackageInfos, iFiles, |
|
110 iFs, iStatus ) ); |
|
111 SetActive(); |
|
112 |
|
113 // Complete immediately if there was some error |
|
114 if( err != KErrNone ) |
|
115 { |
|
116 TRequestStatus* status = &iStatus; |
|
117 User::RequestComplete( status, err ); |
|
118 } |
|
119 } |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CAppMngr2PackageInfoMaker::CAppMngr2PackageInfoMaker() |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 CAppMngr2PackageInfoMaker::CAppMngr2PackageInfoMaker( CAppMngr2Runtime& aPlugin, |
|
127 MAppMngr2InfoMakerObserver& aObserver, RFs& aFs ) : |
|
128 CAppMngr2InfoMaker( aPlugin , aObserver, aFs ) |
|
129 { |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CAppMngr2PackageInfoMaker::ConstructL() |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void CAppMngr2PackageInfoMaker::ConstructL() |
|
137 { |
|
138 } |
|
139 |