|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of applicationmanagement components |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CAMDOWNLOADER_H__ |
|
19 #define __CAMDOWNLOADER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "AppMgmtProgDialog.h" |
|
23 #include "AppMgmtSrvApp.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class RHttpDownload; |
|
27 |
|
28 namespace NApplicationManagement |
|
29 { |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * CAMDownloader lets AM to download content. |
|
35 * |
|
36 * @since Series |
|
37 */ |
|
38 class CAMDownloader : public CBase, public MDLProgressDlgObserver |
|
39 { |
|
40 public: |
|
41 // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CAMDownloader* NewL(RHttpDownload& aDownload, |
|
47 MAMDownloaderObserver& aObserver); |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CAMDownloader(); |
|
52 void HandleDLProgressDialogExitL(TInt aButtonId); |
|
53 void DisplayDownloadFailedNoteL(THttpDownloadMgrError aError, TInt32 aGlobalErr); |
|
54 |
|
55 private: |
|
56 /** |
|
57 * C++ default constructor. |
|
58 */ |
|
59 CAMDownloader(RHttpDownload& aDownload, |
|
60 MAMDownloaderObserver& aObserver); |
|
61 |
|
62 /** |
|
63 * By default Symbian 2nd phase constructor is private. |
|
64 */ |
|
65 void ConstructL(); |
|
66 |
|
67 public: |
|
68 // New functions |
|
69 |
|
70 void CreateAndUpdateProgressDialogL(TInt32 aDownloadedSize, |
|
71 TInt32 aContentSize, THttpProgressState aState); |
|
72 /** |
|
73 * Starts download of content |
|
74 * @since |
|
75 * @leave If staring download fails |
|
76 */ |
|
77 TInt StartDownload(); |
|
78 |
|
79 /** |
|
80 * Stop download of content |
|
81 * @since |
|
82 */ |
|
83 TInt StopDownload(); |
|
84 |
|
85 /** |
|
86 * Continue download of content |
|
87 * @since |
|
88 */ |
|
89 TInt ContinueDownload(); |
|
90 |
|
91 /** |
|
92 * |
|
93 * @since |
|
94 */ |
|
95 TBool CompareDownloadURI(const TDesC8& aURI); |
|
96 |
|
97 /** |
|
98 * |
|
99 * @leave If staring download fails |
|
100 */ |
|
101 TInt32 DownloadStatusCodeL(THttpDownloadState aDownloadState); |
|
102 |
|
103 /** |
|
104 * Returns the filename that holds the downloaded |
|
105 * content if download is successful |
|
106 * @since |
|
107 * @return filename |
|
108 */ |
|
109 const TDesC& FileName(); |
|
110 |
|
111 /** |
|
112 * Returns the mimetype of downloaded |
|
113 * @since |
|
114 * @return mimetype |
|
115 */ |
|
116 const TDesC8& MimeType(); |
|
117 |
|
118 /** |
|
119 * Returns the URI for download |
|
120 * @since |
|
121 * @return download URI |
|
122 */ |
|
123 const TDesC8& DownloadURI(); |
|
124 |
|
125 private: |
|
126 void FileNameFromDownloadL(); |
|
127 void ContentTypeFromDownloadL(); |
|
128 void DownloadURIFromDownloadL(); |
|
129 |
|
130 public: |
|
131 // Functions from base classes |
|
132 TUint32 iProgStarted; |
|
133 TUint32 iSetFinalValue; |
|
134 |
|
135 CAppMgmtProgDialog *iProgressNote; |
|
136 |
|
137 private: |
|
138 // Data |
|
139 RHttpDownload &iDownload; |
|
140 |
|
141 HBufC *iFileName; |
|
142 HBufC8 *iContentType; |
|
143 HBufC8 *iURI; |
|
144 MAMDownloaderObserver& iObserver; |
|
145 TBool iProgressCancelled; |
|
146 THttpProgressState iCurrentDownloadProgState; |
|
147 }; |
|
148 |
|
149 } // namespace NApplicationManagement |
|
150 |
|
151 #endif // __CAMDOWNLOADER_H__ |
|
152 // End of File |