13 * |
13 * |
14 * Description: Dialog containing the Downloads List |
14 * Description: Dialog containing the Downloads List |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
|
19 |
|
20 // INCLUDE FILES |
18 // INCLUDE FILES |
21 #include "CDownloadsListDlg.h" |
19 #include "CDownloadsListDlg.h" |
22 #include "CDownloadUtils.h" |
20 #include "CDownloadUtils.h" |
23 #include "DownloadsListDlgObserver.h" |
21 #include <downloadslistdlgobserver.h> |
24 #include "CDownloadsListArray.h" |
22 #include "CDownloadsListArray.h" |
25 #include "DownloadMgrUiLib.hrh" |
23 #include "DownloadMgrUiLib.hrh" |
26 #include "DMgrUiLibPanic.h" |
24 #include "DMgrUiLibPanic.h" |
27 #include "UiLibLogger.h" |
25 #include "UiLibLogger.h" |
28 #include <DownloadMgrUiLib.rsg> |
26 #include <DownloadMgrUiLib.rsg> |
33 #include <eikfrlbd.h> |
31 #include <eikfrlbd.h> |
34 #include <aknlists.h> |
32 #include <aknlists.h> |
35 #include <StringLoader.h> |
33 #include <StringLoader.h> |
36 #include <eikenv.h> |
34 #include <eikenv.h> |
37 #include <DocumentHandler.h> |
35 #include <DocumentHandler.h> |
38 |
36 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
37 #include "CDownloadsStylusPopupMenu.h" |
|
38 #define pixelOffset 36 |
|
39 #endif |
39 #include "eikon.hrh" |
40 #include "eikon.hrh" |
40 |
|
41 |
41 |
42 // ============================ MEMBER FUNCTIONS =============================== |
42 // ============================ MEMBER FUNCTIONS =============================== |
43 |
43 |
44 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
45 // CDownloadsListDlg::CDownloadsListDlg |
45 // CDownloadsListDlg::CDownloadsListDlg |
108 iRefreshTimer = CPeriodic::NewL( KRefreshTimerPriority ); |
108 iRefreshTimer = CPeriodic::NewL( KRefreshTimerPriority ); |
109 CLOG_WRITE(" iRefreshTimer created"); |
109 CLOG_WRITE(" iRefreshTimer created"); |
110 |
110 |
111 iDownloadUtils = CDownloadUtils::NewL(); |
111 iDownloadUtils = CDownloadUtils::NewL(); |
112 |
112 |
|
113 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
114 iStylusMenu = CDlStylusPopupMenu::NewL(); |
|
115 #endif |
113 CLOG_LEAVEFN("CDownloadsListDlg::ConstructL"); |
116 CLOG_LEAVEFN("CDownloadsListDlg::ConstructL"); |
114 } |
117 } |
115 |
118 |
116 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
117 // CDownloadsListDlg::NewL |
120 // CDownloadsListDlg::NewL |
156 iRefreshTimer = 0; |
159 iRefreshTimer = 0; |
157 delete iListBox; |
160 delete iListBox; |
158 iListBox = NULL; |
161 iListBox = NULL; |
159 delete iDownloadUtils; |
162 delete iDownloadUtils; |
160 iDownloadUtils = NULL; |
163 iDownloadUtils = NULL; |
161 |
164 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
165 if (iStylusMenu) |
|
166 { |
|
167 delete iStylusMenu; |
|
168 iStylusMenu = NULL; |
|
169 } |
|
170 #endif |
162 CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg"); |
171 CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg"); |
163 } |
172 } |
164 |
173 |
165 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
166 // CDownloadsListDlg::SetModelL |
175 // CDownloadsListDlg::SetModelL |
196 // Disable Options softkey. |
205 // Disable Options softkey. |
197 ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse ); |
206 ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse ); |
198 CLOG_WRITE(" aModel.Count() == 0"); |
207 CLOG_WRITE(" aModel.Count() == 0"); |
199 } |
208 } |
200 |
209 |
|
210 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
211 TInt Inprogress = iDownloadsListArray->DownloadsCount |
|
212 ( MASKED_DL_STATE(EHttpDlCreated) | |
|
213 MASKED_DL_STATE(EHttpDlPaused) | |
|
214 MASKED_DL_STATE(EHttpDlInprogress) | |
|
215 MASKED_DL_STATE(EHttpDlMultipleMOFailed)); |
|
216 |
|
217 if ( Inprogress > 1 ) |
|
218 { |
|
219 ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue ); |
|
220 } |
|
221 else |
|
222 { |
|
223 ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse ); |
|
224 } |
|
225 #endif |
|
226 |
201 CLOG_LEAVEFN("CDownloadsListDlg::SetModelL"); |
227 CLOG_LEAVEFN("CDownloadsListDlg::SetModelL"); |
202 } |
228 } |
203 |
229 |
204 // ----------------------------------------------------------------------------- |
230 // ----------------------------------------------------------------------------- |
205 // CDownloadsListDlg::HandleModelChangeL |
231 // CDownloadsListDlg::HandleModelChangeL |
278 iRefreshTimer->Cancel(); |
304 iRefreshTimer->Cancel(); |
279 CLOG_WRITE(" iRefreshTimer cancelled"); |
305 CLOG_WRITE(" iRefreshTimer cancelled"); |
280 } |
306 } |
281 } |
307 } |
282 |
308 |
|
309 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
310 TInt inProgressCount = iDownloadsListArray->DownloadsCount |
|
311 ( MASKED_DL_STATE(EHttpDlCreated) | |
|
312 MASKED_DL_STATE(EHttpDlPaused) | |
|
313 MASKED_DL_STATE(EHttpDlInprogress) | |
|
314 MASKED_DL_STATE(EHttpDlMultipleMOFailed)); |
|
315 |
|
316 if ( inProgressCount <= 1 ) |
|
317 { |
|
318 ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse ); |
|
319 } |
|
320 #endif |
283 // Close the dialog, if necessary |
321 // Close the dialog, if necessary |
284 if ( iListBox->Model()->NumberOfItems() == 0 ) |
322 if ( iListBox->Model()->NumberOfItems() == 0 ) |
285 { |
323 { |
286 CancelPopup(); |
324 CancelPopup(); |
287 } |
325 } |
615 { |
653 { |
616 HandleMiddleSoftKeyChangeL(); |
654 HandleMiddleSoftKeyChangeL(); |
617 break; |
655 break; |
618 } |
656 } |
619 case MEikListBoxObserver::EEventItemDoubleClicked: |
657 case MEikListBoxObserver::EEventItemDoubleClicked: |
620 { |
658 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
659 case MEikListBoxObserver::EEventItemSingleClicked: |
|
660 #endif |
|
661 { |
|
662 TDownloadUiData& dlData = iDownloadsListArray->DlUiData( CurrentItemIndex() ); |
|
663 TInt32 state( dlData.iProgressState ); |
|
664 if(state == EHttpProgContentFileMoved) |
|
665 { |
|
666 if (!ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen)) |
|
667 { |
|
668 ButtonGroupContainer()->MakeCommandVisible(EAknSoftkeyOpen,ETrue); |
|
669 } |
|
670 } |
621 // If EAknSoftkeyOpen is visible, then we can activate the selected download |
671 // If EAknSoftkeyOpen is visible, then we can activate the selected download |
622 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen)) |
672 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen)) |
623 { |
673 { |
624 ProcessCommandL(EAknSoftkeyOpen); |
674 ProcessCommandL(EAknSoftkeyOpen); |
625 } |
675 } |
626 } |
676 } |
|
677 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
678 case MEikListBoxObserver::EEventPenDownOnItem: |
|
679 { |
|
680 if ( iPointerEvent.iType == TPointerEvent::EButton1Down) |
|
681 { |
|
682 iStylusMenu->HandlePointerEventL(iPointerEvent, this); |
|
683 } |
|
684 break; |
|
685 } |
|
686 #endif |
627 default: |
687 default: |
628 { |
688 { |
629 break; |
689 break; |
630 } |
690 } |
631 } |
691 } |
681 // CDownloadsListDlg::HandlePointerEventL |
741 // CDownloadsListDlg::HandlePointerEventL |
682 // ----------------------------------------------------------------------------- |
742 // ----------------------------------------------------------------------------- |
683 // |
743 // |
684 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
744 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
685 { |
745 { |
|
746 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
747 if ( aPointerEvent.iType == TPointerEvent::EButton1Down) |
|
748 { |
|
749 iPointerEvent = aPointerEvent; |
|
750 } |
|
751 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
752 { |
|
753 iPointerEvent = aPointerEvent; |
|
754 iStylusMenu->cancelLongTapL(); |
|
755 if(iStylusMenu->islongtapRunning()) |
|
756 { |
|
757 iStylusMenu->reSetLongTapFlag(); |
|
758 return; |
|
759 } |
|
760 } |
|
761 else if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
|
762 { |
|
763 if((Abs(iPointerEvent.iPosition.iX - aPointerEvent.iPosition.iX) > pixelOffset ) || |
|
764 (Abs(iPointerEvent.iPosition.iY - aPointerEvent.iPosition.iY) > pixelOffset )) |
|
765 { |
|
766 iStylusMenu->cancelLongTapL(); |
|
767 if(iStylusMenu->islongtapRunning()) |
|
768 { |
|
769 iStylusMenu->reSetLongTapFlag(); |
|
770 return; |
|
771 } |
|
772 } |
|
773 } |
|
774 #endif |
|
775 |
686 CAknPopupList::HandlePointerEventL(aPointerEvent); |
776 CAknPopupList::HandlePointerEventL(aPointerEvent); |
687 } |
777 } |
688 |
778 |
689 // ----------------------------------------------------------------------------- |
779 // ----------------------------------------------------------------------------- |
690 // CDownloadsListDlg::OfferKeyEventL |
780 // CDownloadsListDlg::OfferKeyEventL |