|
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 the License "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: User Interactions event handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef USERINTERACTIONSEVENTHANDLER_H |
|
21 #define USERINTERACTIONSEVENTHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "AsyncEventHandlerBase.h" |
|
25 #include <badesca.h> |
|
26 |
|
27 // CONSTANTS |
|
28 LOCAL_D const TInt KMaxDownloadSizeTextLength = 64; |
|
29 LOCAL_D const TInt KMaxLength = 1024; |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CUserInteractionsUtils; |
|
33 class CAknPopupList; |
|
34 class RApaLsSession; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * User Interactions event handler |
|
40 */ |
|
41 NONSHARABLE_CLASS( CUserInteractionsEventHandler ) : public CAsyncEventHandlerBase |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * C++ default constructor. |
|
47 */ |
|
48 CUserInteractionsEventHandler( RHttpDownload& aDownload, |
|
49 THttpDownloadEvent aEvent, |
|
50 MDownloadMgrUiLibRegModel& aRegistryModel, |
|
51 CAsyncEventHandlerArray& aOwner, |
|
52 CUserInteractionsUtils& aUiUtils ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CUserInteractionsEventHandler(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Check the free disk space. |
|
63 * @return ETrue - the indicate dsize will be below critical level. |
|
64 */ |
|
65 #ifdef RD_MULTIPLE_DRIVE |
|
66 TBool DiskSpaceBelowCriticalLevelL( RHttpDownload& aDownload, |
|
67 TInt aSize ) const; |
|
68 #else |
|
69 TBool DiskSpaceBelowCriticalLevelL( TInt aSize ) const; |
|
70 #endif |
|
71 |
|
72 TBool DownloadConfirmationShown() const |
|
73 { return iDownloadConfirmationShown; }; |
|
74 |
|
75 protected: // New functions |
|
76 |
|
77 /** |
|
78 * Show confiration (with wait dialogs). |
|
79 * The confirmation may not be shown in some cases! |
|
80 * @param aDownload The actual download |
|
81 * @param aCbaResource Softkeys resource ID (eg. R_AVKON_SOFTKEYS_OK_CANCEL) |
|
82 * @param aForce Set it to ETrue if it must be shown in any case. |
|
83 * @return Confirmation accepted? True/False. |
|
84 */ |
|
85 TBool ShowDownloadConfirmationL( RHttpDownload& aDownload, |
|
86 TInt aCbaResource, |
|
87 TBool aForce ); |
|
88 |
|
89 /** |
|
90 * Show confiration (with wait dialogs). |
|
91 * @param aDownload The actual download |
|
92 * @param aCbaResource Softkeys resource ID (eg. R_AVKON_SOFTKEYS_OK_CANCEL) |
|
93 * @return Confirmation accepted? True/False. |
|
94 */ |
|
95 TBool ShowDownloadConfirmationL( RHttpDownload& aDownload, |
|
96 TInt aCbaResource ); |
|
97 |
|
98 /** |
|
99 * Construct the handler application's name.. |
|
100 * @param aAppUid UID of the application. |
|
101 * @param aApaLs APPARC session. |
|
102 * @return The allocated heap buffer. |
|
103 */ |
|
104 HBufC* ConstructHandlerAppNameLC( const TUid& aAppUid, RApaLsSession& aApaLs ); |
|
105 |
|
106 /** |
|
107 * Format list box string for Download confirmation. |
|
108 * @param aFirst First line |
|
109 * @param aSecond Second line of list item |
|
110 * @return The allocated heap buffer. |
|
111 */ |
|
112 HBufC* FormatListBoxItemLC( const TDesC& aFirst, const TDesC& aSecond ); |
|
113 |
|
114 /** |
|
115 * Handle download in EHttpDlInprogress state. It operates on iDownload. |
|
116 * @param aThisDeleted Indicator. Output parameter. |
|
117 */ |
|
118 void HandleInProgressStateL( TBool& aThisDeleted ); |
|
119 |
|
120 /** |
|
121 * Handle download in EHttpDlPaused state. It operates on iDownload. |
|
122 * @param aThisDeleted Indicator. Output parameter. |
|
123 */ |
|
124 void HandlePausedStateL( TBool& aThisDeleted ); |
|
125 |
|
126 /** |
|
127 * Handle download in EHttpDlCompleted state. It operates on iDownload. |
|
128 */ |
|
129 void HandleCompletedStateL(); |
|
130 |
|
131 /** |
|
132 * Handle download in EHttpDlFailed state. It operates on iDownload. |
|
133 */ |
|
134 void HandleFailedStateL(); |
|
135 |
|
136 /** |
|
137 * Show info note and delete the download.. |
|
138 */ |
|
139 void HandleUnrecoverableFailL(); |
|
140 |
|
141 protected: // Functions from CActive |
|
142 |
|
143 virtual void DoCancel(); |
|
144 virtual void RunL(); |
|
145 virtual TInt RunError( TInt aError ); |
|
146 |
|
147 protected: // Data |
|
148 |
|
149 CUserInteractionsUtils& iUiUtils; ///< Reference to the UI utils. |
|
150 /** |
|
151 * Temp storage. Should be long enough to hold R_DMUL_DOWNLOADCONF_UNKNOWN |
|
152 * localized string or the content size (max. 7 characters). |
|
153 */ |
|
154 TBuf<KMaxDownloadSizeTextLength> iSizeInfoRes; |
|
155 |
|
156 /// Indicator if the download confirmation is being shown. |
|
157 TBool iDownloadConfirmationShown; |
|
158 |
|
159 /// Popup. Not owned. |
|
160 CAknPopupList* iPopupList; |
|
161 TBool* iDownloadConfirmationDeletedPtr; |
|
162 TBool* iDeletedPtr; |
|
163 }; |
|
164 |
|
165 #endif /* USERINTERACTIONSEVENTHANDLER_H */ |